From c48b04ccb36672d37eda318864f60eafd58e8c0a Mon Sep 17 00:00:00 2001 From: ww664853070 Date: Wed, 7 Dec 2022 16:38:52 +0800 Subject: [PATCH] =?UTF-8?q?(*)=E4=B8=9A=E7=BB=A9=E6=B1=87=E6=80=BB?= =?UTF-8?q?=E8=A1=A8=EF=BC=8C=E5=AF=BC=E5=85=A5=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../performanceReport/performanceSummary.jsx | 248 +++++++++++++++++- 1 file changed, 237 insertions(+), 11 deletions(-) diff --git a/web/client/src/sections/business/containers/performanceReport/performanceSummary.jsx b/web/client/src/sections/business/containers/performanceReport/performanceSummary.jsx index 0cc188f..1c6e7f1 100644 --- a/web/client/src/sections/business/containers/performanceReport/performanceSummary.jsx +++ b/web/client/src/sections/business/containers/performanceReport/performanceSummary.jsx @@ -1,12 +1,14 @@ -import React, { useRef, useEffect, useState, useMemo } from 'react'; +import React, { useEffect, useState } from 'react'; import { connect } from 'react-redux'; import moment from 'moment' -import { Select, Input, Button, Toast, Radio, Tooltip, Table, Pagination, Skeleton } from '@douyinfe/semi-ui'; -import { IconSearch } from '@douyinfe/semi-icons'; +import { Table, } from '@douyinfe/semi-ui'; import '../../style.less'; +import ImportPerformanceSummaryModal from './importPerformanceSummaryModal' +import FileSaver from 'file-saver' const AchievementDetails = (props) => { const { dispatch, actions, performanceSummaryList } = props + const [importModalV, setImportModalV] = useState(false); useEffect(() => { dispatch(actions.businessManagement.getPerformanceSummary()); }, []); @@ -30,7 +32,7 @@ const AchievementDetails = (props) => { }, { title: '考核业绩', - dataIndex: e.name+'[assessmentPerformance]', + dataIndex: e.name + '[assessmentPerformance]', width: 130, // render: (text, record, index) => index + 1 }, @@ -74,19 +76,23 @@ const AchievementDetails = (props) => { title: '入职日期', dataIndex: 'hiredate', width: 130, - // render: (text, record, index) => index + 1 + render: (text, record, index) => moment(text).format('YYYY-MM-DD') }, { title: '转正日期', dataIndex: 'regularDate', width: 130, - // render: (text, record, index) => index + 1 + render: (text, record, index) => moment(text).format('YYYY-MM-DD') }, { title: '工龄', - dataIndex: 'index', + dataIndex: 'workingYears', width: 130, - render: (text, record, index) => index + 1 + render: (text, record, index) => { + let days = moment().diff(moment(record.hiredate).format('YYYY-MM-DD'), 'days') + let day = days / 365 + return day.toFixed(1) + } }, ] columnsList() @@ -131,9 +137,223 @@ const AchievementDetails = (props) => { }) return e }) - console.log(arr, '================='); - const exportAllData = () => { + const exportDetail = () => { + console.log(arr, 'arrarrarr'); + let tableStyle = "text-align: center;font-size:21px" + let exportTable = ` + +
部门
+
销售人员
+
业务线
+
入职日期
+
转正日期
+
工龄
+
1月
+
2月
+
3月
+
一季度
+
4月
+
5月
+
6月
+
二季度
+
7月
+
8月
+
9月
+
三季度
+
10月
+
11月
+
12月
+
四季度
+ 2022年度 +
扣除转法务业绩金额
+
2022年最终业绩合计
+ + +
合同金额
+
实际业绩
+
考核业绩
+
销售任务
+
完成率
+
合同金额
+
实际业绩
+
考核业绩
+
销售任务
+
完成率
+
合同金额
+
实际业绩
+
考核业绩
+
销售任务
+
完成率
+
销售任务
+
完成率
+
合同金额
+
实际业绩
+
考核业绩
+
销售任务
+
完成率
+
合同金额
+
实际业绩
+
考核业绩
+
销售任务
+
完成率
+
合同金额
+
实际业绩
+
考核业绩
+
销售任务
+
完成率
+
销售任务
+
完成率
+
合同金额
+
实际业绩
+
考核业绩
+
销售任务
+
完成率
+
合同金额
+
实际业绩
+
考核业绩
+
销售任务
+
完成率
+
合同金额
+
实际业绩
+
考核业绩
+
销售任务
+
完成率
+
销售任务
+
完成率
+
合同金额
+
实际业绩
+
考核业绩
+
销售任务
+
完成率
+
合同金额
+
实际业绩
+
考核业绩
+
销售任务
+
完成率
+
合同金额
+
实际业绩
+
考核业绩
+
销售任务
+
完成率
+
销售任务
+
完成率
+ + `; + //无数据 + if (JSON.stringify(arr) == '[]') { + message.warning('暂无导出的数据') + } else { + let allList = arr.map(item => { + const oneAssessmentPerformance = item.one && item.one.assessmentPerformance; + const oneTask = item.one && item.one.task; + const oneCompletion = oneAssessmentPerformance && oneTask && oneAssessmentPerformance / oneTask; + const twoAssessmentPerformance = item.two && item.two.assessmentPerformance; + const twoTask = item.two && item.two.task; + const twoCompletion = twoAssessmentPerformance && twoTask && twoAssessmentPerformance / twoTask || '-'; + const threeAssessmentPerformance = item.three && item.three.assessmentPerformance; + const threeTask = item.three && item.three.task; + const threeCompletion = threeAssessmentPerformance && threeTask && threeAssessmentPerformance / threeTask || '-'; + const fourAssessmentPerformance = item.four && item.four.assessmentPerformance; + const fourTask = item.four && item.four.task; + const fourCompletion = fourAssessmentPerformance && fourTask && fourAssessmentPerformance / fourTask || '-'; + const fiveAssessmentPerformance = item.five && item.five.assessmentPerformance; + const fiveTask = item.five && item.five.task; + const fiveCompletion = fiveAssessmentPerformance && fiveTask && fiveAssessmentPerformance / fiveTask || '-'; + const sixAssessmentPerformance = item.six && item.six.assessmentPerformance; + const sixTask = item.six && item.six.task; + const sixCompletion = sixAssessmentPerformance && sixTask && sixAssessmentPerformance / sixTask || '-'; + const sevenAssessmentPerformance = item.seven && item.seven.assessmentPerformance; + const sevenTask = item.seven && item.seven.task; + const sevenCompletion = sevenAssessmentPerformance && sevenTask && sevenAssessmentPerformance / sevenTask || '-'; + const eightAssessmentPerformance = item.eight && item.eight.assessmentPerformance; + const eightTask = item.eight && item.eight.task; + const eightCompletion = eightAssessmentPerformance && eightTask && eightAssessmentPerformance / eightTask || '-'; + const nineAssessmentPerformance = item.nine && item.nine.assessmentPerformance; + const nineTask = item.nine && item.nine.task; + const nineCompletion = nineAssessmentPerformance && nineTask && nineAssessmentPerformance / nineTask || '-'; + const tenAssessmentPerformance = item.ten && item.ten.assessmentPerformance; + const tenTask = item.ten && item.ten.task; + const tenCompletion = tenAssessmentPerformance && tenTask && tenAssessmentPerformance / tenTask || '-'; + const elevenAssessmentPerformance = item.eleven && item.eleven.assessmentPerformance; + const elevenTask = item.eleven && item.eleven.task; + const elevenCompletion = elevenAssessmentPerformance && elevenTask && elevenAssessmentPerformance / elevenTask || '-'; + const twelveAssessmentPerformance = item.twelve && item.twelve.assessmentPerformance; + const twelveTask = item.twelve && item.twelve.task; + const twelveCompletion = twelveAssessmentPerformance && twelveTask && twelveAssessmentPerformance / twelveTask || '-'; + + let days = moment().diff(moment(item.hiredate).format('YYYY-MM-DD'), 'days') + let day = days / 365 + const workingYears = day.toFixed(1) + return Object.assign({}, item, { + oneCompletion: oneCompletion || '-', + twoCompletion: twoCompletion || '-', + threeCompletion: threeCompletion || '-', + oneQuarterTask: (oneAssessmentPerformance || twoAssessmentPerformance || threeAssessmentPerformance) && (oneTask || twoTask || threeTask) && (oneAssessmentPerformance || 0 + twoAssessmentPerformance || 0 + threeAssessmentPerformance || 0) / (oneTask || 0 + twoTask || 0 + threeTask || 0) || '-', + fourCompletion: fourTask || '-', + fiveCompletion: fiveCompletion || '-', + sixCompletion: sixCompletion || '-', + twoQuarterTask: (fourAssessmentPerformance || fiveAssessmentPerformance || sixAssessmentPerformance) && (fourTask || fiveTask || sixTask) && (fourAssessmentPerformance || 0 + fiveAssessmentPerformance || 0 + sixAssessmentPerformance || 0) / (fourTask || 0 + fiveTask || 0 + sixTask || 0) || '-', + sevenCompletion: sevenCompletion || '-', + eightCompletion: eightCompletion || '-', + nineCompletion: nineCompletion || '-', + tenCompletion: tenCompletion || '-', + elevenCompletion: elevenCompletion || '-', + twelveCompletion: twelveCompletion || '-', + workingYears:workingYears, + }) + }) + for (let d of allList) { + exportTable += ` + +
${d['department']}
+
${d['sale']}
+
${d['business']}
+
${d['hiredate']}
+
${d['regularDate']}
+
${d['workingYears']}
+
${d['oneCompletion']}
+
${d['twoCompletion']}
+
${d['threeCompletion']}
+
${d['oneQuarterTask']}
+
${d['phone']}
+
${d['post'] ? d['post'] : '暂无'}
+
${d['email'] ? d['email'] : '暂无'}
+
${d['wechat'] ? d['wechat'] : '暂无'}
+
${d['region']}
+
${d['regionPathName']}
+
${d['projectState']}
+
${d['LostTypeName'] ? d['LostTypeName'] : '暂无'}
+
${d['cause'] ? d['cause'] : '暂无'}
+
${d['groundTime'] ? d['groundTime'] : '暂无'}
+
${d['projectSuccess']}
+
${d['amountMoney'] ? d['amountMoney'] : '暂无'}
+
${d['bidding'] ? '是' : '否'}
+
${d['competitor'] ? d['competitor'] : '暂无'}
+
${d['fundsSufficient'] ? '是' : '否'}
+
${d['planAgreed'] ? '是' : '否'}
+
${d['projectProgress'] ? d['projectProgress'] : '暂无'}
+
${d['problemAnalysis'] ? d['problemAnalysis'] : '暂无'}
+
${d['nextTodo'] ? d['nextTodo'] : '暂无'}
+
${d['remarks'] ? d['remarks'] : '暂无'}
+
${d['recordTime']}
+
${d['intervalDays']}
+
${d['newUpdateTime'] ? d['newUpdateTime'] : '暂无'}
+
${d['updateInterval']}
+ + ` + } + exportTable = `\uFEFF + + + + + ${exportTable} +
储备项目明细表
+ `; + let tempStrs = new Blob([exportTable], { type: 'text/xls' }) + FileSaver.saveAs(tempStrs, `储备中项目明细${moment().format('YYYY-MM-DD')}.xls`) + } } return ( @@ -163,7 +383,7 @@ const AchievementDetails = (props) => {
{ - exportAllData() + exportDetail() }}> 导出全部
@@ -174,6 +394,12 @@ const AchievementDetails = (props) => { + { + importModalV ? { + setImportModalV(false); + }} /> : '' + } )