| 
					
				 | 
			
			
				@@ -16,34 +16,36 @@ interface iFileState { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   createTime: string
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+interface FiltTable {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  data: iFileState[]
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  total: number
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  pageNo: number
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  pageSize: number
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 const File: React.FC<{ type: 'income' | 'expenditure' }> = ({ type }) => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  const [ data, setData ] = useState<Array<iFileState>>([])
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  const [ total, setTotal ] = useState<number>(0)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  const [ state, setState ] = useState<FiltTable>({ data: [], total: 0, pageNo: 1, pageSize: 7 })
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   const [ id, setId ] = useState<string>('')
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  const [ pagination, setPagination ] = useState({
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    pageNo: 1,
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    pageSize: 7
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  })
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   useEffect(() => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (contractStore.contract.id) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       if (contractStore.contract.id !== id) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         setId(contractStore.contract.id)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         initData()
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } else if (contractStore.activeKey && contractStore.activeKey === '3') {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        initData(pagination.pageNo, pagination.pageSize)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        initData(state.pageNo, state.pageSize)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } else {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      setData([])
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      setTotal(0)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      setState({ ...state, data: [], total: 0 })
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      setId('')
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }, [ contractStore.contract.id, contractStore.activeKey ])
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   const initData = async (pageNo: number = 1, pageSize: number = 7) => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    setPagination({ ...pagination, pageNo, pageSize })
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    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) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      setData(data)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      setTotal(total)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      setState({ ...state, data, total })
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       contractStore.activeKey && (contractStore.changeActiveKey(''))
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -51,8 +53,8 @@ const File: React.FC<{ type: 'income' | 'expenditure' }> = ({ type }) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   const deleteFile = async (id: string) => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const { code = -1 } = await apiDelFile(id)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (code === consts.RET_CODE.SUCCESS) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      const newData = data.filter((file: iFileState) => file.id !== id)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      setData(newData)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const newData = state.data.filter((file: iFileState) => file.id !== id)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      setState({ ...state, data: newData })
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   const columns: ColumnsType<iFileState> = [
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -98,7 +100,7 @@ const File: React.FC<{ type: 'income' | 'expenditure' }> = ({ type }) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   ]
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   return (
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <Table
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      dataSource={data}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      dataSource={state.data}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       columns={columns}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       bordered
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       rowKey={record => record.id}
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -107,7 +109,7 @@ const File: React.FC<{ type: 'income' | 'expenditure' }> = ({ type }) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         size: "small",
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         pageSize: 7,
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         onChange: (page, pageSize) => initData(page, pageSize),
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        total
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        total: state.total
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     />
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   )
 
			 |