From 7cf724ee4350e02b38797a4880076de015debe09 Mon Sep 17 00:00:00 2001 From: dengyinhuan Date: Fri, 10 Mar 2023 11:41:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E4=BB=8A=E6=97=A5=E5=B7=A1?= =?UTF-8?q?=E6=A3=80=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../patrolManage/containers/yujingguanli.js | 8 ++-- .../src/sections/shouye/containers/shouye.js | 48 ++++++++++++------- 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/web/client/src/sections/patrolManage/containers/yujingguanli.js b/web/client/src/sections/patrolManage/containers/yujingguanli.js index befe81d..462cf29 100644 --- a/web/client/src/sections/patrolManage/containers/yujingguanli.js +++ b/web/client/src/sections/patrolManage/containers/yujingguanli.js @@ -209,8 +209,8 @@ function YujingGuanli (props) { &&moment(i?.patrolRecordIssueHandles[0].yanshoushijian).valueOf()i?.points?.project?.name.match(params.name))); setDataSource(data.filter(i=>i?.points?.project?.name.match(params.name))); }} @@ -239,7 +239,7 @@ function YujingGuanli (props) { // }).length===0 }) console.log(data,'data') - setDataSource2(data.filter(i=>i?.points?.project?.name.match(params.name))); + setDataSource2(data.filter(i=>i?.points?.project?.name.match(params.name)).sort((a, b) => moment(b.patrolRecordIssueHandles[0].yanshoushijian).valueOf() - moment(a.patrolRecordIssueHandles[0].yanshoushijian).valueOf())); }} />, @@ -279,7 +279,7 @@ function YujingGuanli (props) { console.log(res,'res') // setDataSource(res?.payload?.data.filter(i=>i?.points?.project?.name.match(params.name))); setDataSource(data); - setDataSource2(data2); + setDataSource2(data2.sort((a, b) => moment(b.patrolRecordIssueHandles[0].yanshoushijian).valueOf() - moment(a.patrolRecordIssueHandles[0].yanshoushijian).valueOf())); settabs(2) }} tableRef={tableRef} diff --git a/web/client/src/sections/shouye/containers/shouye.js b/web/client/src/sections/shouye/containers/shouye.js index 210cba7..b27a11c 100644 --- a/web/client/src/sections/shouye/containers/shouye.js +++ b/web/client/src/sections/shouye/containers/shouye.js @@ -32,25 +32,39 @@ const Information = (props) => { console.log(res2,'res2') setshijiandata(res2?.payload?.data) setxunjiandata(res2?.payload?.data.filter(i=>parseInt(moment().format('YYYYMMDD'))=== parseInt(moment(i.inspectionTime ).format('YYYYMMDD')))) - const count = res?.payload?.data?.rows?.filter(i=>{ + let num = 0 + res?.payload?.data?.rows?.map(i=>{ // console.log(i?.frequency?.match(/^[0-9]*$/),'jjj') - if(i?.frequency.split('/')[i?.frequency.split('/').length-1]==='天'){ + if(i?.frequency.split('/')[i?.frequency.split('/').length-1]==='天' && parseInt(moment().format('YYYYMMDD'))<=parseInt(moment(i.endTime).format('YYYYMMDD'))){ // console.log(i?.frequency?.match(/[\d.]/g).join(''),'jjj') - return parseInt(moment().format('YYYYMMDD'))<=parseInt(moment(i.endTime).format('YYYYMMDD')) + num = num + parseInt(i?.frequency?.match(/[\d.]/g).join('')) + // return parseInt(moment().format('YYYYMMDD'))<=parseInt(moment(i.endTime).format('YYYYMMDD')) // console.log('是的',i?.frequency.split('/')[i?.frequency.split('/').length-1]) - }else if(i?.frequency.split('/')[i?.frequency.split('/').length-1]==='周'){ + }else if(i?.frequency.split('/')[i?.frequency.split('/').length-1]==='周'){ + if(parseInt(moment().format('YYYYMMDD'))<=parseInt(moment(i.endTime).format('YYYYMMDD'))&&res2?.payload?.data?.filter(j=>j.patrolPlanId===i.id + &&moment(j.inspectionTim).week()===moment().week()).lengthj.patrolPlanId===i.id + &&moment(j.inspectionTim).week()===moment().week()).length) + } // console.log(i?.frequency?.match(/^[0-9]*$/),'jjj') - return parseInt(moment().format('YYYYMMDD'))<=parseInt(moment(i.endTime).format('YYYYMMDD'))&&res2?.payload?.data?.filter(j=>j.patrolPlanId===i.id - &&moment(j.inspectionTim).week()===moment().week()).lengthj.patrolPlanId===i.id + // &&moment(j.inspectionTim).week()===moment().week()).lengthj.patrolPlanId===i.id + &&moment(j.inspectionTim).month()===moment().month()).lengthj.patrolPlanId===i.id + &&moment(j.inspectionTim).month()===moment().month()).length) + } // console.log(i?.frequency?.match(/^[0-9]*$/),'jjj') - return parseInt(moment().format('YYYYMMDD'))<=parseInt(moment(i.endTime).format('YYYYMMDD'))&&res2?.payload?.data?.filter(j=>j.patrolPlanId===i.id - &&moment(j.inspectionTim).month()===moment().month()).lengthj.patrolPlanId===i.id + // &&moment(j.inspectionTim).month()===moment().month()).length { arr1.push({ name: l.point?.name, value: 1 }) } } else {//修好了 - let ext4 = arr4.find(a => a.name === l.point.name); + let ext4 = arr4.find(a => a?.name === l?.point?.name); if (ext4) { ext4.cost += parseFloat(l.patrolRecordIssueHandles[0]?.cost); } else { - arr4.push({ name: l.point.name, cost: parseFloat(l.patrolRecordIssueHandles[0]?.cost) }) + arr4.push({ name: l?.point?.name, cost: parseFloat(l?.patrolRecordIssueHandles[0]?.cost) }) } } //右上 - let ext2 = arr2.find(a => a.name === l.point.name); + let ext2 = arr2.find(a => a?.name === l?.point?.name); if (ext2) { ext2.num++; if(repairOk){ ext2.repairNum += l.patrolRecordIssueHandles[0]?.yanshoucishu; } } else { - let repairNum = repairOk ? l.patrolRecordIssueHandles[0]?.yanshoucishu : 0; - arr2.push({ name: l.point.name, num: 1, repairNum }) + let repairNum = repairOk ? l?.patrolRecordIssueHandles[0]?.yanshoucishu : 0; + arr2?.push({ name: l?.point?.name, num: 1, repairNum }) } }) arr1.sort((a, b) => b.value - a.value); @@ -107,7 +121,7 @@ const Information = (props) => {
今日巡检
-
{planedata.length}
+
{planedata}
完成巡检:{xunjiandata.length}个