|
|
@ -1,6 +1,6 @@ |
|
|
|
import React, { useEffect, useState, useRef, useMemo } from 'react'; |
|
|
|
import { connect } from 'react-redux'; |
|
|
|
import { Select, Input, Button, Table, Pagination, Skeleton } from '@douyinfe/semi-ui'; |
|
|
|
import { Select, Input, Button, Table, Pagination, Skeleton, Toast, } from '@douyinfe/semi-ui'; |
|
|
|
import { SkeletonScreen, Setup } from "$components"; |
|
|
|
import { IconSearch } from '@douyinfe/semi-icons'; |
|
|
|
import ImportContractDetailsModal from './importContractDetailsModal'; |
|
|
@ -10,7 +10,7 @@ import moment from 'moment' |
|
|
|
|
|
|
|
const ContractDetails = (props) => { |
|
|
|
const { dispatch, actions } = props |
|
|
|
const { } = actions; |
|
|
|
const { businessManagement } = actions; |
|
|
|
const [keywordTarget, setKeywordTarget] = useState('contractNo'); |
|
|
|
const [keyword, setKeyword] = useState('');//搜索内容 |
|
|
|
const [limits, setLimits] = useState()//每页实际条数 |
|
|
@ -20,6 +20,10 @@ const ContractDetails = (props) => { |
|
|
|
|
|
|
|
const [setup, setSetup] = useState(false);//表格设置是否显现 |
|
|
|
const [setupp, setSetupp] = useState([]);//实际显示的表格列表 |
|
|
|
|
|
|
|
const [exportUrl, setExportUrl] = useState(''); |
|
|
|
const page = useRef(query.page); |
|
|
|
|
|
|
|
const CONTRACTDETAILS = "contractDetails"; |
|
|
|
const renderColumns = (columnKeys) => { |
|
|
|
let columns = []; |
|
|
@ -52,6 +56,7 @@ const ContractDetails = (props) => { |
|
|
|
) |
|
|
|
: ""; |
|
|
|
attribute(); |
|
|
|
getContractDetailData(); |
|
|
|
}, []); |
|
|
|
//获取表格属性设置 |
|
|
|
function attribute() { |
|
|
@ -66,9 +71,16 @@ const ContractDetails = (props) => { |
|
|
|
} |
|
|
|
setSetupp(newColumns); |
|
|
|
} |
|
|
|
useEffect(() => { |
|
|
|
|
|
|
|
}, [query]) |
|
|
|
function getContractDetailData(param) { |
|
|
|
let queryParam = param || query; |
|
|
|
dispatch(businessManagement.getContractDetail({ keywordTarget, keyword, ...queryParam })).then(r => { |
|
|
|
if (r.success) { |
|
|
|
setTableData(r.payload?.data?.rows); |
|
|
|
setLimits(r.payload?.data?.count); |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
function handleRow(record, index) {// 给偶数行设置斑马纹 |
|
|
|
if (index % 2 === 0) { |
|
|
|
return { |
|
|
@ -80,6 +92,22 @@ const ContractDetails = (props) => { |
|
|
|
return {}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const exportAllData = () => { |
|
|
|
dispatch(businessManagement.getContractDetail({ limit: 1, page: 0 })).then((res) => { |
|
|
|
if (res.success) { |
|
|
|
if (res.payload.data.count) { |
|
|
|
let url = `export/contract/detail?token=${user.token}×tamp=${moment().valueOf()}` |
|
|
|
setExportUrl(url); |
|
|
|
} else { |
|
|
|
Toast.info({ |
|
|
|
content: '暂无可导出的数据', |
|
|
|
duration: 3, |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
const scroll = useMemo(() => ({}), []); |
|
|
|
return ( |
|
|
|
<> |
|
|
@ -121,6 +149,7 @@ const ContractDetails = (props) => { |
|
|
|
<Button theme='solid' type='primary' style={{ width: 80, borderRadius: 2, height: 32, background: '#DBECFF', color: '#005ABD' }} |
|
|
|
onClick={() => { |
|
|
|
setQuery({ limit: 10, page: 0 }) |
|
|
|
getContractDetailData({ limit: 10, page: 0 }) |
|
|
|
}}>查询</Button> |
|
|
|
</div> |
|
|
|
<div style={{ display: 'flex', marginRight: 20 }}> |
|
|
@ -131,7 +160,9 @@ const ContractDetails = (props) => { |
|
|
|
onClick={() => { setImportModalV(true); }}> |
|
|
|
导入 |
|
|
|
</div> |
|
|
|
<div style={{ padding: '6px 20px', background: '#00BA85', color: '#FFFFFF', fontSize: 14, marginLeft: 18 }}> |
|
|
|
<div style={{ padding: '6px 20px', background: '#00BA85', color: '#FFFFFF', fontSize: 14, marginLeft: 18 }} onClick={() => { |
|
|
|
exportAllData() |
|
|
|
}}> |
|
|
|
导出全部 |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -172,7 +203,8 @@ const ContractDetails = (props) => { |
|
|
|
pageSizeOpts={[10, 20, 30, 40]} |
|
|
|
onChange={(currentPage, pageSize) => { |
|
|
|
setQuery({ limit: pageSize, page: currentPage - 1 }); |
|
|
|
page.current = currentPage - 1 |
|
|
|
getContractDetailData({ limit: pageSize, page: currentPage - 1 }); |
|
|
|
page.current = currentPage - 1; |
|
|
|
}} |
|
|
|
/> |
|
|
|
</div> |
|
|
@ -186,6 +218,9 @@ const ContractDetails = (props) => { |
|
|
|
setImportModalV(false); |
|
|
|
}} /> : '' |
|
|
|
} |
|
|
|
{ |
|
|
|
exportUrl ? <iframe src={`/_api/${exportUrl}`} style={{ display: 'none' }} /> : '' |
|
|
|
} |
|
|
|
</div> |
|
|
|
{setup ? ( |
|
|
|
<Setup |
|
|
|