Browse Source

合同明细查询暂交

master
zmh 2 years ago
parent
commit
e8c6e0065e
  1. 28
      api/app/lib/controllers/report/achievement.js
  2. 3
      api/app/lib/routes/report/index.js
  3. 13
      web/client/src/sections/business/actions/achievement-report.js
  4. 47
      web/client/src/sections/business/containers/performanceReport/contractDetails.jsx
  5. 1
      web/client/src/utils/webapi.js

28
api/app/lib/controllers/report/achievement.js

@ -256,7 +256,35 @@ async function exportAchievementDetail(ctx, dataList) {
} }
} }
} }
/**
* 查询合同明细表数据
* @param {*} ctx ctx ctx.query:{keywordTarget-关键字项keyword-关键字内容limit-页宽, page-页码}
*/
async function getContractDetail(ctx) {
try {
const { models } = ctx.fs.dc;
const { keywordTarget, keyword, limit, page } = ctx.query;
const where = {};
if (keywordTarget && keyword) {
where[keywordTarget] = { $iLike: `%${keyword}%` };
}
let contractDetail = await models.ContractDetail.findAndCountAll({
where: where,
offset: Number(page) * Number(limit),
limit: Number(limit),
order: [['id', 'DESC']]
});
ctx.status = 200
ctx.body = contractDetail;
} catch (error) {
ctx.fs.logger.error(`path:${ctx.path},error:${error}`)
ctx.status = 400;
ctx.body = { name: 'FindError', message: '查询合同明细表数据失败' }
}
}
module.exports = { module.exports = {
getReceivedDetail,//回款 getReceivedDetail,//回款
getAchievementDetail,//业绩 getAchievementDetail,//业绩
getContractDetail,
} }

3
api/app/lib/routes/report/index.js

@ -15,4 +15,7 @@ module.exports = function (app, router, opts) {
app.fs.api.logAttr['GET/detail/achievement'] = { content: '查询业绩明细表', visible: false }; app.fs.api.logAttr['GET/detail/achievement'] = { content: '查询业绩明细表', visible: false };
router.get('/detail/achievement', achieve.getAchievementDetail); router.get('/detail/achievement', achieve.getAchievementDetail);
app.fs.api.logAttr['GET/contract/detail'] = { content: '查询合同明细表', visible: false };
router.get('/contract/detail', achieve.getContractDetail);
}; };

13
web/client/src/sections/business/actions/achievement-report.js

@ -27,3 +27,16 @@ export function getAchievementDetail(query) {
reducer: { name: "AchievementDetail", params: { noClear: true } }, reducer: { name: "AchievementDetail", params: { noClear: true } },
}); });
} }
//查询合同明细表
export function getContractDetail(query) {
return (dispatch) => basicAction({
type: "get",
dispatch: dispatch,
actionType: "GET_CONTRACT_DETAIL",
query: query,
url: `${ApiTable.getContractDetail}`,
msg: { option: "查询合同明细表" },
reducer: { name: "ContractDetail", params: { noClear: true } },
});
}

47
web/client/src/sections/business/containers/performanceReport/contractDetails.jsx

@ -1,6 +1,6 @@
import React, { useEffect, useState, useRef, useMemo } from 'react'; import React, { useEffect, useState, useRef, useMemo } from 'react';
import { connect } from 'react-redux'; 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 { SkeletonScreen, Setup } from "$components";
import { IconSearch } from '@douyinfe/semi-icons'; import { IconSearch } from '@douyinfe/semi-icons';
import ImportContractDetailsModal from './importContractDetailsModal'; import ImportContractDetailsModal from './importContractDetailsModal';
@ -10,7 +10,7 @@ import moment from 'moment'
const ContractDetails = (props) => { const ContractDetails = (props) => {
const { dispatch, actions } = props const { dispatch, actions } = props
const { } = actions; const { businessManagement } = actions;
const [keywordTarget, setKeywordTarget] = useState('contractNo'); const [keywordTarget, setKeywordTarget] = useState('contractNo');
const [keyword, setKeyword] = useState('');// const [keyword, setKeyword] = useState('');//
const [limits, setLimits] = useState()// const [limits, setLimits] = useState()//
@ -20,6 +20,10 @@ const ContractDetails = (props) => {
const [setup, setSetup] = useState(false);// const [setup, setSetup] = useState(false);//
const [setupp, setSetupp] = useState([]);// const [setupp, setSetupp] = useState([]);//
const [exportUrl, setExportUrl] = useState('');
const page = useRef(query.page);
const CONTRACTDETAILS = "contractDetails"; const CONTRACTDETAILS = "contractDetails";
const renderColumns = (columnKeys) => { const renderColumns = (columnKeys) => {
let columns = []; let columns = [];
@ -52,6 +56,7 @@ const ContractDetails = (props) => {
) )
: ""; : "";
attribute(); attribute();
getContractDetailData();
}, []); }, []);
// //
function attribute() { function attribute() {
@ -66,9 +71,16 @@ const ContractDetails = (props) => {
} }
setSetupp(newColumns); 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) {// function handleRow(record, index) {//
if (index % 2 === 0) { if (index % 2 === 0) {
return { return {
@ -80,6 +92,22 @@ const ContractDetails = (props) => {
return {}; 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}&timestamp=${moment().valueOf()}`
setExportUrl(url);
} else {
Toast.info({
content: '暂无可导出的数据',
duration: 3,
})
}
}
})
}
const scroll = useMemo(() => ({}), []); const scroll = useMemo(() => ({}), []);
return ( return (
<> <>
@ -121,6 +149,7 @@ const ContractDetails = (props) => {
<Button theme='solid' type='primary' style={{ width: 80, borderRadius: 2, height: 32, background: '#DBECFF', color: '#005ABD' }} <Button theme='solid' type='primary' style={{ width: 80, borderRadius: 2, height: 32, background: '#DBECFF', color: '#005ABD' }}
onClick={() => { onClick={() => {
setQuery({ limit: 10, page: 0 }) setQuery({ limit: 10, page: 0 })
getContractDetailData({ limit: 10, page: 0 })
}}>查询</Button> }}>查询</Button>
</div> </div>
<div style={{ display: 'flex', marginRight: 20 }}> <div style={{ display: 'flex', marginRight: 20 }}>
@ -131,7 +160,9 @@ const ContractDetails = (props) => {
onClick={() => { setImportModalV(true); }}> onClick={() => { setImportModalV(true); }}>
导入 导入
</div> </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>
</div> </div>
@ -172,7 +203,8 @@ const ContractDetails = (props) => {
pageSizeOpts={[10, 20, 30, 40]} pageSizeOpts={[10, 20, 30, 40]}
onChange={(currentPage, pageSize) => { onChange={(currentPage, pageSize) => {
setQuery({ limit: pageSize, page: currentPage - 1 }); setQuery({ limit: pageSize, page: currentPage - 1 });
page.current = currentPage - 1 getContractDetailData({ limit: pageSize, page: currentPage - 1 });
page.current = currentPage - 1;
}} }}
/> />
</div> </div>
@ -186,6 +218,9 @@ const ContractDetails = (props) => {
setImportModalV(false); setImportModalV(false);
}} /> : '' }} /> : ''
} }
{
exportUrl ? <iframe src={`/_api/${exportUrl}`} style={{ display: 'none' }} /> : ''
}
</div> </div>
{setup ? ( {setup ? (
<Setup <Setup

1
web/client/src/utils/webapi.js

@ -23,6 +23,7 @@ export const ApiTable = {
//业绩报表 //业绩报表
getReceivedDetail: 'detail/received/back', getReceivedDetail: 'detail/received/back',
getAchievementDetail: 'detail/achievement', getAchievementDetail: 'detail/achievement',
getContractDetail: 'contract/detail',
}; };
export const RouteTable = { export const RouteTable = {
apiRoot: "/api/root", apiRoot: "/api/root",

Loading…
Cancel
Save