上传文件添加pdf
This commit is contained in:
parent
9b7c2429cf
commit
3438db919f
@ -5,7 +5,7 @@ import { Form, Select, Button, Upload, message, Input, Modal, Table,Empty } from
|
|||||||
import type { TableColumnsType } from 'antd';
|
import type { TableColumnsType } from 'antd';
|
||||||
const { Search } = Input;
|
const { Search } = Input;
|
||||||
import { UploadOutlined } from '@ant-design/icons';
|
import { UploadOutlined } from '@ant-design/icons';
|
||||||
import { uploadImageUrl, DevUserId, get, post } from "../../util/AjaxUtils.ts";
|
import { DevUserId, get, post,uploadFileUrl} from "../../util/AjaxUtils.ts";
|
||||||
// import { getMenuActive } from '../../util/cache.ts'
|
// import { getMenuActive } from '../../util/cache.ts'
|
||||||
import { useDispatch } from 'react-redux'
|
import { useDispatch } from 'react-redux'
|
||||||
const { TextArea } = Input;
|
const { TextArea } = Input;
|
||||||
@ -32,6 +32,13 @@ export default function CorrectionModal(props: any) {
|
|||||||
|
|
||||||
render: (text: string) => <>{text}</>,
|
render: (text: string) => <>{text}</>,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: '所属者名称',
|
||||||
|
dataIndex: 'applyContactName',
|
||||||
|
align: 'center',
|
||||||
|
|
||||||
|
render: (text: string) => <>{text}</>,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '编号',
|
title: '编号',
|
||||||
dataIndex: 'projContext',
|
dataIndex: 'projContext',
|
||||||
@ -345,13 +352,14 @@ export default function CorrectionModal(props: any) {
|
|||||||
rules={[{ required: true, message: '请上传补正通知书' }]}
|
rules={[{ required: true, message: '请上传补正通知书' }]}
|
||||||
>
|
>
|
||||||
<Upload
|
<Upload
|
||||||
name="image"
|
name="file"
|
||||||
action={uploadImageUrl()}
|
action={uploadFileUrl()}
|
||||||
headers={{ 'X-USER-ID': DevUserId }}
|
headers={{ 'X-USER-ID': DevUserId }}
|
||||||
beforeUpload={(file) => {
|
beforeUpload={(file) => {
|
||||||
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png';
|
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'|| file.type === 'application/pdf';
|
||||||
if (!isJpgOrPng) {
|
// const isPdf = file.type === 'application/pdf';
|
||||||
message.error('只能上传 JPG/PNG 格式文件!');
|
if (!isJpgOrPng ) {
|
||||||
|
message.error('只能上传 JPG/PNG/PDF 格式文件!');
|
||||||
return Upload.LIST_IGNORE; // 不允许上传非
|
return Upload.LIST_IGNORE; // 不允许上传非
|
||||||
}
|
}
|
||||||
return isJpgOrPng;
|
return isJpgOrPng;
|
||||||
|
@ -3,7 +3,7 @@ import './RefunModal.css'
|
|||||||
import { Form, Button, Upload, message, Input, Modal, Table, Empty } from 'antd';
|
import { Form, Button, Upload, message, Input, Modal, Table, Empty } from 'antd';
|
||||||
import type { TableColumnsType } from 'antd';
|
import type { TableColumnsType } from 'antd';
|
||||||
import { UploadOutlined } from '@ant-design/icons';
|
import { UploadOutlined } from '@ant-design/icons';
|
||||||
import { uploadImageUrl, DevUserId, get, post } from "../../util/AjaxUtils.ts";
|
import { DevUserId, get, post,uploadFileUrl } from "../../util/AjaxUtils.ts";
|
||||||
// import { getMenuActive } from '../../util/cache.ts'
|
// import { getMenuActive } from '../../util/cache.ts'
|
||||||
import { useDispatch } from 'react-redux'
|
import { useDispatch } from 'react-redux'
|
||||||
const { Search } = Input;
|
const { Search } = Input;
|
||||||
@ -13,7 +13,8 @@ interface DataType {
|
|||||||
projName: string;
|
projName: string;
|
||||||
projContext: string;
|
projContext: string;
|
||||||
gmtCreate: string;
|
gmtCreate: string;
|
||||||
projId: string
|
projId: string,
|
||||||
|
applyContactName: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function RefunModal(props: any) {
|
export default function RefunModal(props: any) {
|
||||||
@ -32,6 +33,13 @@ export default function RefunModal(props: any) {
|
|||||||
|
|
||||||
render: (text: string) => <>{text}</>,
|
render: (text: string) => <>{text}</>,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: '所属者名称',
|
||||||
|
dataIndex: 'applyContactName',
|
||||||
|
align: 'center',
|
||||||
|
|
||||||
|
render: (text: string) => <>{text}</>,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '编号',
|
title: '编号',
|
||||||
dataIndex: 'projContext',
|
dataIndex: 'projContext',
|
||||||
@ -238,8 +246,11 @@ export default function RefunModal(props: any) {
|
|||||||
valuePropName="fileList"
|
valuePropName="fileList"
|
||||||
getValueFromEvent={(e: any) => {
|
getValueFromEvent={(e: any) => {
|
||||||
if (e.file.status === 'done') {
|
if (e.file.status === 'done') {
|
||||||
|
// console.log(e);
|
||||||
|
|
||||||
refunArray.push(e.file.response.data.fileId);
|
refunArray.push(e.file.response.data.fileId);
|
||||||
setRefunArray(refunArray);
|
setRefunArray(refunArray);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (e.file.status === 'removed') {
|
if (e.file.status === 'removed') {
|
||||||
const idArray = refunArray.filter(item => item != e.file.response.data.fileId);
|
const idArray = refunArray.filter(item => item != e.file.response.data.fileId);
|
||||||
@ -250,13 +261,14 @@ export default function RefunModal(props: any) {
|
|||||||
rules={[{ required: true, message: '请上传补正通知书' }]}
|
rules={[{ required: true, message: '请上传补正通知书' }]}
|
||||||
>
|
>
|
||||||
<Upload
|
<Upload
|
||||||
name="image"
|
name="file"
|
||||||
action={uploadImageUrl()}
|
action={uploadFileUrl()}
|
||||||
headers={{ 'X-USER-ID': DevUserId }}
|
headers={{ 'X-USER-ID': DevUserId }}
|
||||||
beforeUpload={(file) => {
|
beforeUpload={(file) => {
|
||||||
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png';
|
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png' ||file.type === 'application/pdf';
|
||||||
if (!isJpgOrPng) {
|
// const isPng = file.type == 'application/pdf'
|
||||||
message.error('只能上传 JPG/PNG 格式文件!');
|
if (!isJpgOrPng ) {
|
||||||
|
message.error('只能上传 JPG/PNG/PDF 格式文件!');
|
||||||
return Upload.LIST_IGNORE; // 不允许上传非
|
return Upload.LIST_IGNORE; // 不允许上传非
|
||||||
}
|
}
|
||||||
return isJpgOrPng;
|
return isJpgOrPng;
|
||||||
|
Loading…
Reference in New Issue
Block a user