From 348ccf702123afa338d1586f2f08dc67183cf570 Mon Sep 17 00:00:00 2001 From: ww664853070 Date: Tue, 6 Dec 2022 17:05:54 +0800 Subject: [PATCH] =?UTF-8?q?(*)=E4=B8=9A=E7=BB=A9=E6=B1=87=E6=80=BB?= =?UTF-8?q?=E8=A1=A8=E6=95=B0=E6=8D=AE=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lib/controllers/salePerformance/index.js | 6 +- api/app/lib/models/salePerformance.js | 12 +- .../performanceReport/performanceSummary.jsx | 598 +++--------------- web/client/src/sections/business/style.less | 3 + 4 files changed, 113 insertions(+), 506 deletions(-) diff --git a/api/app/lib/controllers/salePerformance/index.js b/api/app/lib/controllers/salePerformance/index.js index 39ba88f..0659c4d 100644 --- a/api/app/lib/controllers/salePerformance/index.js +++ b/api/app/lib/controllers/salePerformance/index.js @@ -3,10 +3,14 @@ // 查询业绩汇总表-->关联sale表 async function getSalePerformance(ctx, next) { const { type } = ctx.params; + const models = ctx.fs.dc.models; let rslt = null; try { - rslt = await ctx.fs.dc.models.salePerformance.findAll({ + rslt = await models.sale.findAll({ order: [['id', 'DESC']], + include:[{ + model:models.salePerformance + }] // where: { type: type } }) ctx.status = 200 diff --git a/api/app/lib/models/salePerformance.js b/api/app/lib/models/salePerformance.js index 9657ff1..814fbe2 100644 --- a/api/app/lib/models/salePerformance.js +++ b/api/app/lib/models/salePerformance.js @@ -27,7 +27,7 @@ module.exports = dc => { allowNull: false, field: "assessment_performance", }, - completion : { + completion: { type: DataTypes.STRING, allowNull: false, field: "completion ", @@ -43,13 +43,21 @@ module.exports = dc => { field: "year", }, saleId: { - type: DataTypes.STRING, + type: DataTypes.INTEGER, allowNull: false, field: "sale_id", + }, + task: { + type: DataTypes.INTEGER, + allowNull: false, + field: "task", } }, { tableName: "sale_performance", }); + const { sale } = dc.models; + sale.hasMany(salePerformance, { foreighKey: 'saleId', targetKey: "id" }) + dc.models.salePerformance = salePerformance; return salePerformance; }; \ No newline at end of file diff --git a/web/client/src/sections/business/containers/performanceReport/performanceSummary.jsx b/web/client/src/sections/business/containers/performanceReport/performanceSummary.jsx index 4f82db5..0cc188f 100644 --- a/web/client/src/sections/business/containers/performanceReport/performanceSummary.jsx +++ b/web/client/src/sections/business/containers/performanceReport/performanceSummary.jsx @@ -7,40 +7,80 @@ import '../../style.less'; const AchievementDetails = (props) => { const { dispatch, actions, performanceSummaryList } = props - console.log(performanceSummaryList, '------------------'); useEffect(() => { dispatch(actions.businessManagement.getPerformanceSummary()); }, []); + let colums = [{ num: '1月', name: 'one' }, { num: '2月', name: 'two' }, { num: '3月', name: 'three' }, { num: '4月', name: 'four' }, { num: '5月', name: 'five' }, { num: '6月', name: 'sex' }, { num: '7月', name: 'seven' }, { num: '8月', name: 'eight' }, { num: '9月', name: 'nine' }, { num: '10月', name: 'ten' }, { num: '11月', name: 'evelen' }, { num: '12月', name: 'twelve' }] + const columnsList = () => { + colums.forEach(e => { + columns.push({ + title: e.num, + children: [ + { + title: '合同金额', + dataIndex: e.name + '[amount]', + width: 130, + // render: (text, record, index) => index + 1 + }, + { + title: '实际业绩', + dataIndex: e.name + '[actualPerformance]', + width: 130, + // render: (text, record, index) => index + 1 + }, + { + title: '考核业绩', + dataIndex: e.name+'[assessmentPerformance]', + width: 130, + // render: (text, record, index) => index + 1 + }, + { + title: '销售任务', + dataIndex: e.name + '[task]', + width: 130, + // render: (text, record, index) => index + 1 + }, + { + title: '完成率%', + dataIndex: e.name + '[completion]', + width: 130, + // render: (text, record, index) => index + 1 + } + ] + } + ) + }) + } let columns = [ { title: '部门', - dataIndex: 'index', + dataIndex: 'department', width: 130, - render: (text, record, index) => index + 1 + // render: (text, record, index) => index + 1 }, { title: '销售人员', - dataIndex: 'index', + dataIndex: 'sale', width: 130, - render: (text, record, index) => index + 1 + // render: (text, record, index) => index + 1 }, { title: '业务线', - dataIndex: 'index', + dataIndex: 'business', width: 130, - render: (text, record, index) => index + 1 + // render: (text, record, index) => index + 1 }, { title: '入职日期', - dataIndex: 'index', + dataIndex: 'hiredate', width: 130, - render: (text, record, index) => index + 1 + // render: (text, record, index) => index + 1 }, { title: '转正日期', - dataIndex: 'index', + dataIndex: 'regularDate', width: 130, - render: (text, record, index) => index + 1 + // render: (text, record, index) => index + 1 }, { title: '工龄', @@ -48,498 +88,50 @@ const AchievementDetails = (props) => { width: 130, render: (text, record, index) => index + 1 }, - { - title: '1月', - children: [ - { - title: '合同金额', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '实际业绩', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '考核业绩', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '销售任务', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '完成率', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - } - ] - }, - { - title: '2月', - children: [ - { - title: '合同金额', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '实际业绩', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '考核业绩', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '销售任务', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '完成率', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - } - ] - }, - { - title: '3月', - children: [ - { - title: '合同金额', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '实际业绩', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '考核业绩', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '销售任务', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '完成率', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - } - ] - }, - { - title: '一季度', - children: [ - { - title: '销售任务', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '完成率', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - } - ] - }, - { - title: '4月', - children: [ - { - title: '合同金额', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '实际业绩', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '考核业绩', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '销售任务', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '完成率', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - } - ] - }, - { - title: '5月', - children: [ - { - title: '合同金额', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '实际业绩', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '考核业绩', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '销售任务', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '完成率', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - } - ] - }, - { - title: '6月', - children: [ - { - title: '合同金额', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '实际业绩', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '考核业绩', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '销售任务', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '完成率', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - } - ] - }, - { - title: '二季度', - children: [ - { - title: '销售任务', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '完成率', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - } - ] - }, - { - title: '7月', - children: [ - { - title: '合同金额', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '实际业绩', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '考核业绩', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '销售任务', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '完成率', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - } - ] - }, - { - title: '8月', - children: [ - { - title: '合同金额', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '实际业绩', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '考核业绩', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '销售任务', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '完成率', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - } - ] - }, - { - title: '9月', - children: [ - { - title: '合同金额', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '实际业绩', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '考核业绩', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '销售任务', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '完成率', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - } - ] - }, - { - title: '三季度', - children: [ - { - title: '销售任务', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '完成率', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - } - ] - }, - { - title: '10月', - children: [ - { - title: '合同金额', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '实际业绩', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '考核业绩', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '销售任务', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '完成率', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - } - ] - }, - { - title: '11月', - children: [ - { - title: '合同金额', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '实际业绩', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '考核业绩', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '销售任务', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '完成率', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - } - ] - }, - { - title: '12月', - children: [ - { - title: '合同金额', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '实际业绩', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '考核业绩', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '销售任务', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '完成率', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - } - ] - }, - { - title: '四季度', - children: [ - { - title: '销售任务', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - }, - { - title: '完成率', - dataIndex: 'index', - width: 130, - render: (text, record, index) => index + 1 - } - ] - } ] - - - + columnsList() + let arr = performanceSummaryList.map(e => { + e.salePerformances.forEach(i => { + if (i.month == 1) { + e.one = i + } + if (i.month == 2) { + e.two = i + } + if (i.month == 3) { + e.three = i + } + if (i.month == 4) { + e.four = i + } + if (i.month == 5) { + e.five = i + } + if (i.month == 6) { + e.sex = i + } + if (i.month == 7) { + e.seven = i + } + if (i.month == 8) { + e.eight = i + } + if (i.month == 9) { + e.nine = i + } + if (i.month == 10) { + e.ten = i + } + if (i.month == 11) { + e.evelen = i + } + if (i.month == 12) { + e.twelve = i + } + }) + return e + }) + console.log(arr, '================='); const exportAllData = () => { } @@ -578,7 +170,7 @@ const AchievementDetails = (props) => {
- +
diff --git a/web/client/src/sections/business/style.less b/web/client/src/sections/business/style.less index 77a2123..35efeb7 100644 --- a/web/client/src/sections/business/style.less +++ b/web/client/src/sections/business/style.less @@ -15,4 +15,7 @@ .semi-table-thead > .semi-table-row > .semi-table-row-head{ border-right: 1px solid #ccc; } + .semi-table-tbody > .semi-table-row > .semi-table-row-cell{ + border-right: 1px solid #ccc; + } }