|
@@ -1,13 +1,14 @@
|
|
|
+import { useTabHeighAuto } from '@/hooks/tabHooks'
|
|
|
import { contractStore } from '@/store/mobx'
|
|
|
import { ContractType } from '@/store/mobx/contract'
|
|
|
import { apiDelFile, apiGetFileList } from '@/utils/common/api'
|
|
|
import consts from '@/utils/consts'
|
|
|
import { dayjsFormat } from '@/utils/util'
|
|
|
-import { ConfigProvider, Popconfirm } from 'antd'
|
|
|
+import { Popconfirm } from 'antd'
|
|
|
import Table, { ColumnsType } from 'antd/lib/table'
|
|
|
import { observer } from 'mobx-react'
|
|
|
import React, { useEffect, useState } from 'react'
|
|
|
-
|
|
|
+import styles from './index.module.scss'
|
|
|
|
|
|
interface iFileState {
|
|
|
id: string
|
|
@@ -25,9 +26,9 @@ interface FiltTable {
|
|
|
}
|
|
|
|
|
|
const File: React.FC<{ type: 'income' | 'expenditure' }> = ({ type }) => {
|
|
|
- const [ state, setState ] = useState<FiltTable>({ data: [], total: 0, pageNo: 1, pageSize: 7 })
|
|
|
+ const [ state, setState ] = useState<FiltTable>({ data: [], total: 0, pageNo: 1, pageSize: 8 })
|
|
|
const [ id, setId ] = useState<string>('')
|
|
|
-
|
|
|
+ const y = useTabHeighAuto()
|
|
|
useEffect(() => {
|
|
|
if (contractStore.contract.id) {
|
|
|
if (contractStore.contract.id !== id) {
|
|
@@ -42,7 +43,7 @@ const File: React.FC<{ type: 'income' | 'expenditure' }> = ({ type }) => {
|
|
|
}
|
|
|
}, [ contractStore.contract.id, contractStore.activeKey ])
|
|
|
|
|
|
- const initData = async (pageNo: number = 1, pageSize: number = 7) => {
|
|
|
+ const initData = async (pageNo: number = 1, pageSize: number = 8) => {
|
|
|
setState({ ...state, pageNo, pageSize })
|
|
|
const { code = -1, data = [], total = 0 } = await apiGetFileList(type === ContractType.INCOME ? consts.DATA_TYPE.INCOME : consts.DATA_TYPE.EXPENDITURE, contractStore.contract.id, pageNo, pageSize)
|
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
@@ -63,26 +64,26 @@ const File: React.FC<{ type: 'income' | 'expenditure' }> = ({ type }) => {
|
|
|
dataIndex: 'sort',
|
|
|
// eslint-disable-next-line react/display-name
|
|
|
render: (_: any, record: iFileState, idx: number) => <span>{idx + 1}</span>,
|
|
|
- width: 5
|
|
|
+ width: '5%'
|
|
|
},
|
|
|
{
|
|
|
title: '名称',
|
|
|
dataIndex: 'filename',
|
|
|
// 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>,
|
|
|
- width: 50
|
|
|
+ width: '50%'
|
|
|
},
|
|
|
{
|
|
|
title: '上传者',
|
|
|
dataIndex: 'accountName',
|
|
|
- width: 10
|
|
|
+ width: '10%'
|
|
|
},
|
|
|
{
|
|
|
title: '上传时间',
|
|
|
dataIndex: 'createTime',
|
|
|
// eslint-disable-next-line react/display-name
|
|
|
render: (time: string) => <span>{dayjsFormat(time, 'YYYY-MM-DD')}</span>,
|
|
|
- width: 20
|
|
|
+ width: '20%'
|
|
|
},
|
|
|
{
|
|
|
title: '操作',
|
|
@@ -96,23 +97,28 @@ const File: React.FC<{ type: 'income' | 'expenditure' }> = ({ type }) => {
|
|
|
</Popconfirm>
|
|
|
</div>
|
|
|
},
|
|
|
- width: 15
|
|
|
+ width: '15%'
|
|
|
}
|
|
|
]
|
|
|
return (
|
|
|
- <Table
|
|
|
- dataSource={state.data}
|
|
|
- columns={columns}
|
|
|
- bordered
|
|
|
- rowKey={record => record.id}
|
|
|
- pagination={{
|
|
|
- hideOnSinglePage: true,
|
|
|
- size: "small",
|
|
|
- pageSize: 7,
|
|
|
- onChange: (page, pageSize) => initData(page, pageSize),
|
|
|
- total: state.total
|
|
|
- }}
|
|
|
- />
|
|
|
+ <div className={styles.contractFileTab}>
|
|
|
+ <Table
|
|
|
+ dataSource={state.data}
|
|
|
+ columns={columns}
|
|
|
+ bordered
|
|
|
+ rowKey={record => record.id}
|
|
|
+ scroll={{ y }}
|
|
|
+ pagination={{
|
|
|
+ hideOnSinglePage: true,
|
|
|
+ size: "small",
|
|
|
+ defaultPageSize: 8,
|
|
|
+ showSizeChanger:false,
|
|
|
+ onChange: (page, pageSize) => initData(page, pageSize),
|
|
|
+ total: state.total
|
|
|
+ }}
|
|
|
+ />
|
|
|
+
|
|
|
+ </div>
|
|
|
)
|
|
|
}
|
|
|
|