Browse Source

(*)业绩汇总表,导入导出

master
ww664853070 2 years ago
parent
commit
c48b04ccb3
  1. 246
      web/client/src/sections/business/containers/performanceReport/performanceSummary.jsx

246
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());
}, []);
@ -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 = `
<tr>
<th rowspan='2'><div style="${tableStyle}">部门</div></th>
<th rowspan='2'><div style="${tableStyle}">销售人员</div></th>
<th rowspan='2'><div style="${tableStyle}">业务线</div></th>
<th rowspan='2'><div style="${tableStyle}">入职日期</div></th>
<th rowspan='2'><div style="${tableStyle}">转正日期</div></th>
<th rowspan='2'><div style="${tableStyle}">工龄</div></th>
<th colspan="3"><div style="${tableStyle}">1</div></th>
<th colspan="3"><div style="${tableStyle}">2</div></th>
<th colspan="3"><div style="${tableStyle}">3</div></th>
<th colspan="2"><div style="${tableStyle}">一季度</div></th>
<th colspan="3"><div style="${tableStyle}">4</div></th>
<th colspan="3"><div style="${tableStyle}">5</div></th>
<th colspan="3"><div style="${tableStyle}">6</div></th>
<th colspan="2"><div style="${tableStyle}">二季度</div></th>
<th colspan="3"><div style="${tableStyle}">7</div></th>
<th colspan="3"><div style="${tableStyle}">8</div></th>
<th colspan="3"><div style="${tableStyle}">9</div></th>
<th colspan="2"><div style="${tableStyle}">三季度</div></th>
<th colspan="3"><div style="${tableStyle}">10</div></th>
<th colspan="3"><div style="${tableStyle}">11</div></th>
<th colspan="3"><div style="${tableStyle}">12</div></th>
<th colspan="2"><div style="${tableStyle}">四季度</div></th>
<th colspan="3><div style="${tableStyle}">2022年度</div></th>
<th rowspan='2'><div style="${tableStyle}">扣除转法务业绩金额</div></th>
<th rowspan='2'><div style="${tableStyle}">2022年最终业绩合计</div></th>
</tr>
<tr>
<th><div style="${tableStyle}">合同金额</div></th>
<th><div style="${tableStyle}">实际业绩</div></th>
<th><div style="${tableStyle}">考核业绩</div></th>
<th><div style="${tableStyle}">销售任务</div></th>
<th><div style="${tableStyle}">完成率</div></th>
<th><div style="${tableStyle}">合同金额</div></th>
<th><div style="${tableStyle}">实际业绩</div></th>
<th><div style="${tableStyle}">考核业绩</div></th>
<th><div style="${tableStyle}">销售任务</div></th>
<th><div style="${tableStyle}">完成率</div></th>
<th><div style="${tableStyle}">合同金额</div></th>
<th><div style="${tableStyle}">实际业绩</div></th>
<th><div style="${tableStyle}">考核业绩</div></th>
<th><div style="${tableStyle}">销售任务</div></th>
<th><div style="${tableStyle}">完成率</div></th>
<th><div style="${tableStyle}">销售任务</div></th>
<th><div style="${tableStyle}">完成率</div></th>
<th><div style="${tableStyle}">合同金额</div></th>
<th><div style="${tableStyle}">实际业绩</div></th>
<th><div style="${tableStyle}">考核业绩</div></th>
<th><div style="${tableStyle}">销售任务</div></th>
<th><div style="${tableStyle}">完成率</div></th>
<th><div style="${tableStyle}">合同金额</div></th>
<th><div style="${tableStyle}">实际业绩</div></th>
<th><div style="${tableStyle}">考核业绩</div></th>
<th><div style="${tableStyle}">销售任务</div></th>
<th><div style="${tableStyle}">完成率</div></th>
<th><div style="${tableStyle}">合同金额</div></th>
<th><div style="${tableStyle}">实际业绩</div></th>
<th><div style="${tableStyle}">考核业绩</div></th>
<th><div style="${tableStyle}">销售任务</div></th>
<th><div style="${tableStyle}">完成率</div></th>
<th><div style="${tableStyle}">销售任务</div></th>
<th><div style="${tableStyle}">完成率</div></th>
<th><div style="${tableStyle}">合同金额</div></th>
<th><div style="${tableStyle}">实际业绩</div></th>
<th><div style="${tableStyle}">考核业绩</div></th>
<th><div style="${tableStyle}">销售任务</div></th>
<th><div style="${tableStyle}">完成率</div></th>
<th><div style="${tableStyle}">合同金额</div></th>
<th><div style="${tableStyle}">实际业绩</div></th>
<th><div style="${tableStyle}">考核业绩</div></th>
<th><div style="${tableStyle}">销售任务</div></th>
<th><div style="${tableStyle}">完成率</div></th>
<th><div style="${tableStyle}">合同金额</div></th>
<th><div style="${tableStyle}">实际业绩</div></th>
<th><div style="${tableStyle}">考核业绩</div></th>
<th><div style="${tableStyle}">销售任务</div></th>
<th><div style="${tableStyle}">完成率</div></th>
<th><div style="${tableStyle}">销售任务</div></th>
<th><div style="${tableStyle}">完成率</div></th>
<th><div style="${tableStyle}">合同金额</div></th>
<th><div style="${tableStyle}">实际业绩</div></th>
<th><div style="${tableStyle}">考核业绩</div></th>
<th><div style="${tableStyle}">销售任务</div></th>
<th><div style="${tableStyle}">完成率</div></th>
<th><div style="${tableStyle}">合同金额</div></th>
<th><div style="${tableStyle}">实际业绩</div></th>
<th><div style="${tableStyle}">考核业绩</div></th>
<th><div style="${tableStyle}">销售任务</div></th>
<th><div style="${tableStyle}">完成率</div></th>
<th><div style="${tableStyle}">合同金额</div></th>
<th><div style="${tableStyle}">实际业绩</div></th>
<th><div style="${tableStyle}">考核业绩</div></th>
<th><div style="${tableStyle}">销售任务</div></th>
<th><div style="${tableStyle}">完成率</div></th>
<th><div style="${tableStyle}">销售任务</div></th>
<th><div style="${tableStyle}">完成率</div></th>
</tr>
`;
//
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 += `
<tr>
<td><div style="${tableStyle}">${d['department']}</div></td>
<td><div style="${tableStyle}">${d['sale']}</div></td>
<td><div style="${tableStyle}">${d['business']}</div></td>
<td><div style="${tableStyle}">${d['hiredate']}</div></td>
<td><div style="${tableStyle}">${d['regularDate']}</div></td>
<td><div style="${tableStyle}">${d['workingYears']}</div></td>
<td><div style="${tableStyle}">${d['oneCompletion']}</div></td>
<td><div style="${tableStyle}">${d['twoCompletion']}</div></td>
<td><div style="${tableStyle}">${d['threeCompletion']}</div></td>
<td><div style="${tableStyle}">${d['oneQuarterTask']}</div></td>
<td><div style="${tableStyle}">${d['phone']}</div></td>
<td><div style="${tableStyle}">${d['post'] ? d['post'] : '暂无'}</div></td>
<td><div style="${tableStyle}">${d['email'] ? d['email'] : '暂无'}</div></td>
<td><div style="${tableStyle}">${d['wechat'] ? d['wechat'] : '暂无'}</div></td>
<td><div style="${tableStyle}">${d['region']}</div></td>
<td><div style="${tableStyle}">${d['regionPathName']}</div></td>
<td><div style="${tableStyle}">${d['projectState']}</div></td>
<td><div style="${tableStyle}">${d['LostTypeName'] ? d['LostTypeName'] : '暂无'}</div></td>
<td><div style="${tableStyle}">${d['cause'] ? d['cause'] : '暂无'}</div></td>
<td><div style="${tableStyle}">${d['groundTime'] ? d['groundTime'] : '暂无'}</div></td>
<td><div style="${tableStyle}">${d['projectSuccess']}</div></td>
<td><div style="${tableStyle}">${d['amountMoney'] ? d['amountMoney'] : '暂无'}</div></td>
<td><div style="${tableStyle}">${d['bidding'] ? '是' : '否'}</div></td>
<td><div style="${tableStyle}">${d['competitor'] ? d['competitor'] : '暂无'}</div></td>
<td><div style="${tableStyle}">${d['fundsSufficient'] ? '是' : '否'}</div></td>
<td><div style="${tableStyle}">${d['planAgreed'] ? '是' : '否'}</div></td>
<td><div style="${tableStyle}">${d['projectProgress'] ? d['projectProgress'] : '暂无'}</div></td>
<td><div style="${tableStyle}">${d['problemAnalysis'] ? d['problemAnalysis'] : '暂无'}</div></td>
<td><div style="${tableStyle}">${d['nextTodo'] ? d['nextTodo'] : '暂无'}</div></td>
<td><div style="${tableStyle}">${d['remarks'] ? d['remarks'] : '暂无'}</div></td>
<td><div style="${tableStyle}">${d['recordTime']}</div></td>
<td><div style="${tableStyle}">${d['intervalDays']}</div></td>
<td><div style="${tableStyle}">${d['newUpdateTime'] ? d['newUpdateTime'] : '暂无'}</div></td>
<td><div style="${tableStyle}">${d['updateInterval']}</div></td>
</tr>
`
}
exportTable = `\uFEFF
<table style='text-alagin:center' border="1">
<tr>
<th colspan="30"><div style="${tableStyle}">储备项目明细表</div></th>
</tr>
${exportTable}
</table>
`;
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) => {
</div>
<div style={{ padding: '6px 20px', background: '#00BA85', color: '#FFFFFF', fontSize: 14, cursor: "pointer", marginLeft: 18 }}
onClick={() => {
exportAllData()
exportDetail()
}}>
导出全部
</div>
@ -174,6 +394,12 @@ const AchievementDetails = (props) => {
</div>
</div>
</div>
{
importModalV ? <ImportPerformanceSummaryModal
onCancel={() => {
setImportModalV(false);
}} /> : ''
}
</div>
</>
)

Loading…
Cancel
Save