|
@@ -1,6 +1,5 @@
|
|
-import { apiGetFileList } from '@/components/FileModal/api'
|
|
|
|
import { contractStore } from '@/store/mobx'
|
|
import { contractStore } from '@/store/mobx'
|
|
-import { apiDelFile } from '@/utils/common/api'
|
|
|
|
|
|
+import { apiDelFile, apiGetFileList } from '@/utils/common/api'
|
|
import consts from '@/utils/consts'
|
|
import consts from '@/utils/consts'
|
|
import { dayjsFormat } from '@/utils/util'
|
|
import { dayjsFormat } from '@/utils/util'
|
|
import Table, { ColumnsType } from 'antd/lib/table'
|
|
import Table, { ColumnsType } from 'antd/lib/table'
|
|
@@ -30,7 +29,7 @@ const File:React.FC<{}> = () => {
|
|
contractStore.shouldUpdate && (contractStore.changeUpdate(''))
|
|
contractStore.shouldUpdate && (contractStore.changeUpdate(''))
|
|
}
|
|
}
|
|
}, [ contractStore.contract.id, contractStore.shouldUpdate ])
|
|
}, [ contractStore.contract.id, contractStore.shouldUpdate ])
|
|
- const initData = async(pageNo: number = 1, pageSize: number = 10) => {
|
|
|
|
|
|
+ const initData = async(pageNo: number = 1, pageSize: number = 7) => {
|
|
const { code = -1, data = [], total = 0 } = await apiGetFileList(consts.DATA_TYPE.CONTRACT, contractStore.contract.id, pageNo, pageSize)
|
|
const { code = -1, data = [], total = 0 } = await apiGetFileList(consts.DATA_TYPE.CONTRACT, contractStore.contract.id, pageNo, pageSize)
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
setData(data)
|
|
setData(data)
|
|
@@ -48,33 +47,39 @@ const File:React.FC<{}> = () => {
|
|
{
|
|
{
|
|
dataIndex: 'sort',
|
|
dataIndex: 'sort',
|
|
// eslint-disable-next-line react/display-name
|
|
// eslint-disable-next-line react/display-name
|
|
- render: (_:any, record: iFileState, idx: number) => <span>{idx+1}</span>
|
|
|
|
|
|
+ render: (_:any, record: iFileState, idx: number) => <span>{idx+1}</span>,
|
|
|
|
+ width: 5
|
|
},
|
|
},
|
|
{
|
|
{
|
|
title: '名称',
|
|
title: '名称',
|
|
dataIndex: 'filename',
|
|
dataIndex: 'filename',
|
|
// eslint-disable-next-line react/display-name
|
|
// eslint-disable-next-line react/display-name
|
|
- render: (text: string, record: iFileState) => <a href={consts.OSS_PATH.REVIEW + record.filepath} target="_blank" rel="noopener noreferrer">{text}</a>
|
|
|
|
|
|
+ render: (text: string, record: iFileState) => <a href={consts.OSS_PATH.REVIEW + record.filepath} target="_blank" rel="noopener noreferrer">{text}</a>,
|
|
|
|
+ width: 50
|
|
},
|
|
},
|
|
{
|
|
{
|
|
title: '上传者',
|
|
title: '上传者',
|
|
- dataIndex: 'accountName'
|
|
|
|
|
|
+ dataIndex: 'accountName',
|
|
|
|
+ width: 10
|
|
},
|
|
},
|
|
{
|
|
{
|
|
title: '上传时间',
|
|
title: '上传时间',
|
|
dataIndex: 'createTime',
|
|
dataIndex: 'createTime',
|
|
// eslint-disable-next-line react/display-name
|
|
// eslint-disable-next-line react/display-name
|
|
- render: (time: string) => <span>{dayjsFormat(time, 'YYYY-MM-DD')}</span>
|
|
|
|
|
|
+ render: (time: string) => <span>{dayjsFormat(time, 'YYYY-MM-DD')}</span>,
|
|
|
|
+ width: 20
|
|
},
|
|
},
|
|
{
|
|
{
|
|
title: '操作',
|
|
title: '操作',
|
|
dataIndex: 'opreate',
|
|
dataIndex: 'opreate',
|
|
// eslint-disable-next-line react/display-name
|
|
// eslint-disable-next-line react/display-name
|
|
- render:(_: string, record: iFileState) =>
|
|
|
|
- <div>
|
|
|
|
|
|
+ render:(_: string, record: iFileState) => {
|
|
|
|
+ return <div>
|
|
<a className="pi-mg-right-5" download href={consts.OSS_PATH.DOWNLOAD + record.filepath}>下载</a>
|
|
<a className="pi-mg-right-5" download href={consts.OSS_PATH.DOWNLOAD + record.filepath}>下载</a>
|
|
<span className="pi-link-red" onClick={() => deleteFile(record.id)}>删除</span>
|
|
<span className="pi-link-red" onClick={() => deleteFile(record.id)}>删除</span>
|
|
</div>
|
|
</div>
|
|
|
|
+ },
|
|
|
|
+ width: 15
|
|
}
|
|
}
|
|
]
|
|
]
|
|
return (
|
|
return (
|
|
@@ -86,7 +91,7 @@ const File:React.FC<{}> = () => {
|
|
pagination={{
|
|
pagination={{
|
|
hideOnSinglePage: true,
|
|
hideOnSinglePage: true,
|
|
size: "small",
|
|
size: "small",
|
|
- pageSize: consts.PAGE_SIZE,
|
|
|
|
|
|
+ pageSize: 7,
|
|
onChange: (page, pageSize) => initData(page, pageSize),
|
|
onChange: (page, pageSize) => initData(page, pageSize),
|
|
total
|
|
total
|
|
}}
|
|
}}
|