From b96edc0add2750dfe3510fe322fc67ca78130fb2 Mon Sep 17 00:00:00 2001 From: deartibers <947466799@qq.com> Date: Tue, 18 Oct 2022 10:08:57 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A8=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../containers/personnelFiles.jsx | 2 +- .../containers/personnelFilesDetail.jsx | 145 +++++++++++------- 2 files changed, 92 insertions(+), 55 deletions(-) diff --git a/web/client/src/sections/humanAffairs/containers/personnelFiles.jsx b/web/client/src/sections/humanAffairs/containers/personnelFiles.jsx index ff26e12..d87ea29 100644 --- a/web/client/src/sections/humanAffairs/containers/personnelFiles.jsx +++ b/web/client/src/sections/humanAffairs/containers/personnelFiles.jsx @@ -152,7 +152,7 @@ const Rest = (props) => {
{ - archivesList?.rows?.map((item, index) => { + archivesList?.map((item, index) => { return (
diff --git a/web/client/src/sections/humanAffairs/containers/personnelFilesDetail.jsx b/web/client/src/sections/humanAffairs/containers/personnelFilesDetail.jsx index 0a3a43f..4bd6cee 100644 --- a/web/client/src/sections/humanAffairs/containers/personnelFilesDetail.jsx +++ b/web/client/src/sections/humanAffairs/containers/personnelFilesDetail.jsx @@ -17,112 +17,114 @@ const Rest = (props) => { const { humanAffairs } = actions; const [option, setOption] = useState({}); const [leaveoption, setLeaveOption] = useState({}); - const [tableData, setTableData] = useState([{}, {}, {}, {}, {}, {}, {}]) //表格数据 - const [leaveData, setLeaveData] = useState([{}, {}, {}, {}, {}, {}, {}]) //表格数据 + const [tableData, setTableData] = useState([]) //表格数据 + const [leaveData, setLeaveData] = useState([]) //表格数据 + const [tableStatistic, setTableStatistic] = useState({}) //加班总数据 + const [leaveStatistic, setLeaveStatistic] = useState({}) //请假总数据 const [deleteModal, setDeleteModal] = useState(false) //删除弹框 const [personnelModal, setPersonnelModal] = useState(false);//档案弹框 const [columns, setColumns] = useState([//表格属性 { title: "实例号", - dataIndex: "index", - key: 'index', + dataIndex: "storyId", + key: 'storyId', render: (text, r, index) => { - return index + 1; + return {text}; }, }, { title: "事由", - dataIndex: "why", - key: 'why', + dataIndex: "reason", + key: 'reason', render: (text, r, index) => { - return index + 1; + return text; }, }, { title: "类型", - dataIndex: "type", - key: 'type', + dataIndex: "compensate", + key: 'compensate', render: (text, r, index) => { - return index + 1; + return text; }, }, { title: "发起时间", - dataIndex: "originatingTime", - key: 'originatingTime', + dataIndex: "createTime", + key: 'createTime', render: (text, r, index) => { - return index + 1; + return moment(text).format('YYYY-MM-DD HH:mm'); }, }, { title: "开始时间", dataIndex: "startTime", key: 'startTime', render: (text, r, index) => { - return index + 1; + return moment(text).format('YYYY-MM-DD HH:mm'); }, }, { title: "结束时间", dataIndex: "endTime", key: 'endTime', render: (text, r, index) => { - return index + 1; + return moment(text).format('YYYY-MM-DD HH:mm'); }, }, { title: "总计时间", - dataIndex: "allTime", - key: 'allTime', + dataIndex: "duration", + key: 'duration', render: (text, r, index) => { - return index + 1; + return (text / 60 / 60 + '小时'); }, }, ]) const [leaveColumns, setLeaveColumns] = useState([//表格属性 { title: "实例号", - dataIndex: "index", - key: 'index', + dataIndex: "storyId", + key: 'storyId', render: (text, r, index) => { - return index + 1; + return {text}; }, }, { title: "事由", - dataIndex: "why", - key: 'why', + dataIndex: "reason", + key: 'reason', render: (text, r, index) => { - return index + 1; + return text; }, }, { title: "类型", dataIndex: "type", key: 'type', render: (text, r, index) => { - return index + 1; + return text; }, }, { title: "发起时间", - dataIndex: "originatingTime", - key: 'originatingTime', + dataIndex: "createTime", + key: 'createTime', render: (text, r, index) => { - return index + 1; + return moment(text).format('YYYY-MM-DD HH:mm'); }, }, { title: "开始时间", dataIndex: "startTime", key: 'startTime', render: (text, r, index) => { - return index + 1; + return moment(text).format('YYYY-MM-DD HH:mm'); }, }, { title: "结束时间", dataIndex: "endTime", key: 'endTime', render: (text, r, index) => { - return index + 1; + return moment(text).format('YYYY-MM-DD HH:mm'); }, }, { title: "总计时间", - dataIndex: "allTime", - key: 'allTime', + dataIndex: "duration", + key: 'duration', render: (text, r, index) => { - return index + 1; + return (text / 60 / 60 + '小时'); }, }, ]) @@ -135,11 +137,13 @@ const Rest = (props) => { const [endDate, setEndDate] = useState('');//结束时间 useEffect(() => { - getWorkOption()//加班信息 - getLeaveOption()//请假信息 setPepUserId(history?.location?.search.slice(1)) peopleDetail() }, []) + useEffect(() => { + getWorkOption()//加班信息 + getLeaveOption()//请假信息 + }, [startDate, endDate]) function peopleDetail () { dispatch(humanAffairs.getMemberList({ keywordTarget: 'number', keyword: history?.location?.search.slice(1) })).then((res) => {//搜索项企用户 if (res.success) { @@ -150,7 +154,8 @@ const Rest = (props) => { function getWorkOption () {//请假折线图 dispatch(humanAffairs.getMemberOvertime({ pepUserId: history?.location?.search.slice(1), startDate: startDate, endDate: endDate })).then((res) => {//搜索项企用户 if (res.success) { - console.log('res.success', res.payload.data); + setTableData(res.payload?.data?.data) + setTableStatistic(res.payload?.data) } }) var date = []; @@ -241,7 +246,30 @@ const Rest = (props) => { function getLeaveOption () {//请假折线图 dispatch(humanAffairs.getMemberVacate({ pepUserId: history?.location?.search.slice(1), startDate: startDate, endDate: endDate })).then((res) => {//搜索项企用户 if (res.success) { - console.log('res.success', res.payload.data); + setLeaveData(res.payload?.data?.data) + let year = 0; + let compassionate = 0; + let sick = 0; + let other = 0; + let all = 0; + for (let i = 0; i < res.payload?.data?.statistic.length; i++) { + if (res.payload?.data?.statistic[i].type == '事假') { + compassionate = compassionate + (res.payload?.data?.statistic[i].sumDuration / 60 / 60) + } + else if (res.payload?.data?.statistic[i].type == '病假') { + sick = sick + (res.payload?.data?.statistic[i].sumDuration / 60 / 60) + } + else if (res.payload?.data?.statistic[i].type == '年休假') { + year = year + (res.payload?.data?.statistic[i].sumDuration / 60 / 60) + } + else { + other = other + (res.payload?.data?.statistic[i].sumDuration / 60 / 60) + } + all = all + (res.payload?.data?.statistic[i].sumDuration / 60 / 60) + } + setLeaveStatistic({ + compassionate, sick, year, other, all + }) } }) var date = []; @@ -310,6 +338,7 @@ const Rest = (props) => { setLeaveOption(data) } function handleChange (date) { + console.log('datedatedatedate', date); setStartDate(moment(date[0]).format('YYYY-MM-DD')) setEndDate(moment(date[1]).format('YYYY-MM-DD')) @@ -648,7 +677,7 @@ const Rest = (props) => { 加班次数:
- 25次 + {tableData.length}次
@@ -656,7 +685,7 @@ const Rest = (props) => { 工作日:
- 115小时 + {tableStatistic.sumPayWorkday / 60 / 60 + tableStatistic.sumTakeRestWorkday / 60 / 60||0}小时
@@ -664,7 +693,7 @@ const Rest = (props) => { 普通假日:
- 12小时 + {tableStatistic.sumTakeRestDayoff / 60 / 60 + tableStatistic.sumTakeRestDayoff / 60 / 60||0}小时
@@ -672,7 +701,7 @@ const Rest = (props) => { 法定假日:
- 1小时 + {tableStatistic.sumPayFestivals / 60 / 60 + tableStatistic.sumTakeRestFestivals / 60 / 60||0}小时
@@ -680,7 +709,7 @@ const Rest = (props) => { 累计加班时长:
- 436小时 + {tableStatistic.sumPayWorkday / 60 / 60 + tableStatistic.sumTakeRestWorkday / 60 / 60 + tableStatistic.sumTakeRestDayoff / 60 / 60 + tableStatistic.sumTakeRestDayoff / 60 / 60 + tableStatistic.sumPayFestivals / 60 / 60 + tableStatistic.sumTakeRestFestivals / 60 / 60||0}小时
@@ -716,44 +745,52 @@ const Rest = (props) => {
-
+
请假次数:
- 25次 + {leaveData.length}次
-
+
年休假:
- 115小时 + {leaveStatistic.year}小时
-
+
事假:
- 12小时 + {leaveStatistic.compassionate}小时
-
+
病假:
- 1小时 + {leaveStatistic.sick}小时
-
+
+
+ 其他类型请假: +
+
+ {leaveStatistic.other}小时 +
+
+
- 剩余年假: + 合计请假时长:
- 436小时 + {leaveStatistic.all}小时