From 58c25dc1fb591cf4fd0c78af481ce40c8e0e0fc9 Mon Sep 17 00:00:00 2001 From: dengyinhuan Date: Thu, 9 Mar 2023 15:57:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=85=A5=E5=91=8A=E8=AD=A6=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../patrolManage/components/xiafagaojin.js | 2 +- .../patrolManage/containers/yujingguanli.js | 56 ++++++++------ .../components/alarm/alarmStatistics.js | 76 +++++++++++++++---- .../src/sections/shouye/containers/shouye.js | 21 +++-- 4 files changed, 111 insertions(+), 44 deletions(-) diff --git a/web/client/src/sections/patrolManage/components/xiafagaojin.js b/web/client/src/sections/patrolManage/components/xiafagaojin.js index de0f62d..bdcf527 100644 --- a/web/client/src/sections/patrolManage/components/xiafagaojin.js +++ b/web/client/src/sections/patrolManage/components/xiafagaojin.js @@ -39,7 +39,7 @@ const PlanModal = ({ visible, onCancel, dispatch, type, curRecord, tableRef, che }).then(()=>{ dispatch(issueHandle.modifyPatrolRecordIssueHandle(curRecord?.patrolRecordIssueHandles[0]?.id,{ isgaojing:true, - yujingshijian:moment().format('YYYY-MM-DD') + yujingshijian:moment().format('YYYY-MM-DD HH:mm:ss') })), onCancel(); onHandle() diff --git a/web/client/src/sections/patrolManage/containers/yujingguanli.js b/web/client/src/sections/patrolManage/containers/yujingguanli.js index 674188f..fc4d089 100644 --- a/web/client/src/sections/patrolManage/containers/yujingguanli.js +++ b/web/client/src/sections/patrolManage/containers/yujingguanli.js @@ -17,6 +17,7 @@ function YujingGuanli (props) { const [visible, setVisible] = useState(false); const [type, setType] = useState(); const [curRecord, setCurRecord] = useState(); + const [tabs,settabs] = useState(1) const [data,setdata]= useState([]) const [tableList, settableList] = useState([]) const [name, setName] = useState(''); @@ -25,7 +26,7 @@ function YujingGuanli (props) { const [search, setSearch] = useState({ name: null, time: [times[0], times[1]], state: 'null' }) const STATE_TEXT = { 1: '待制定计划', 2: '待审核', 3: '计划驳回', 4: '待维修', 5: '待验收', 6: '验收通过', 7: '验收不通过', } const onChange = (key) => { - console.log(key); + settabs(key) }; const renderOptionText = (currentState) => { let text = '待制定计划' @@ -176,13 +177,13 @@ function YujingGuanli (props) { return ( <> { + const data = res?.payload?.data?.filter(i=>{ return i?.patrolRecordIssueHandles[0]?.yanshoucishu>2&&i?.patrolRecordIssueHandles[0]?.isgaojing!==true - &&res?.payload?.data?.filter(j=>j?.pointId===i?.pointId - &&j?.points?.project?.id===i?.points?.project?.id&& - parseInt(moment(i?.patrolRecordIssueHandles[0].yujingshijian).format('YYYYMMDD'))j?.pointId===i?.pointId&&j?.points?.project?.id===i?.points?.project?.id + &&j?.patrolRecordIssueHandles[0]?.yujingshijian + &&i?.patrolRecordIssueHandles[0]?.yujingshijian&& + parseInt(moment(i?.patrolRecordIssueHandles[0].yujingshijian).format('YYYYMMDDHHMMSS'))i?.points?.project?.name.match(params.name))); setDataSource(data.filter(i=>i?.points?.project?.name.match(params.name))); }} @@ -214,7 +217,7 @@ function YujingGuanli (props) { }, { label: `已告警`, - key: '2', + key: 2, children: { const res = await dispatch(patrolManage.records(`patrolRecord/all/${times[0]}/${times[1]}/true/null`)); const data = res?.payload?.data?.filter(i=>{ - return i?.patrolRecordIssueHandles[0]?.isgaojing===true&& - res?.payload?.data?.filter(j=>j?.pointId===i?.pointId - &&j?.points?.project?.id===i?.points?.project?.id&& - parseInt(moment(i?.patrolRecordIssueHandles[0].yujingshijian).format('YYYYMMDD'))<=parseInt(moment(j?.patrolRecordIssueHandles[0]?.yujingshijian).format('YYYYMMDD')) - ).length===0 - }) + return i?.patrolRecordIssueHandles[0]?.isgaojing===true&&i?.patrolRecordIssueHandles[0]?.yujingafchishu===null + // &&res?.payload?.data?.filter(j=> + // { + // return j?.pointId===i?.pointId + // &&j?.points?.project?.id===i?.points?.project?.id&&i?.patrolRecordIssueHandles[0]?.yujingshijian&& + // parseInt(moment(i?.patrolRecordIssueHandles[0].yujingshijian).format('YYYYMMDDHHMMSS'))i?.points?.project?.name.match(params.name))); }} @@ -253,12 +259,15 @@ function YujingGuanli (props) { onHandle={async ()=>{ const res = await dispatch(patrolManage.records(`patrolRecord/all/${times[0]}/${times[1]}/true/null`)); const data2 = res?.payload?.data?.filter(i=>{ - return i?.patrolRecordIssueHandles[0]?.isgaojing===true&& - res?.payload?.data?.filter(j=>j?.pointId===i?.pointId - &&j?.points?.project?.id===i?.points?.project?.id&& - parseInt(i?.patrolRecordIssueHandles[0].yujingshijian) + // { + // return j?.pointId===i?.pointId + // &&j?.points?.project?.id===i?.points?.project?.id&&i?.patrolRecordIssueHandles[0]?.yujingshijian&& + // parseInt(moment(i?.patrolRecordIssueHandles[0].yujingshijian).format('YYYYMMDDHHMMSS')){ return i?.patrolRecordIssueHandles[0]?.yanshoucishu>2&&i?.patrolRecordIssueHandles[0]?.isgaojing!==true &&res?.payload?.data?.filter(j=>j?.pointId===i?.pointId @@ -268,8 +277,9 @@ function YujingGuanli (props) { }) console.log(res,'res') // setDataSource(res?.payload?.data.filter(i=>i?.points?.project?.name.match(params.name))); - setDataSource(data.filter(i=>i?.points?.project?.name.match())); - setDataSource2(data2.filter(i=>i?.points?.project?.name.match())); + setDataSource(data); + setDataSource2(data2); + settabs(2) }} tableRef={tableRef} /> : null diff --git a/web/client/src/sections/shouye/components/alarm/alarmStatistics.js b/web/client/src/sections/shouye/components/alarm/alarmStatistics.js index b671de8..6cc94d1 100644 --- a/web/client/src/sections/shouye/components/alarm/alarmStatistics.js +++ b/web/client/src/sections/shouye/components/alarm/alarmStatistics.js @@ -1,32 +1,70 @@ 'use strict' import React, { Component } from 'react'; import { Row, Col, Tooltip } from 'antd'; -import AutoRollComponent from './autorollcomponent'; +import { connect } from 'react-redux'; +import AutoRollComponent from './autorollcomponent' +import moment from 'moment'; class AlarmStatistics extends Component { constructor(props) { super(props); this.state = { alarmList: [ - { item: '点位1', count: 214 }, - { item: '点位2', count: 135 }, - { item: '点位3', count: 88 }, - { item: '点位4', count: 63 }, - { item: '点位5', count: 56 }, - { item: '点位6', count: 115 }, - { item: '点位7', count: 67 }, - { item: '点位8', count: 144 }, - { item: '点位9', count: 21 }, - { item: '点位10', count: 83 }, + // { item: '点位1', count: 214 }, + // { item: '点位2', count: 135 }, + // { item: '点位3', count: 88 }, + // { item: '点位4', count: 63 }, + // { item: '点位5', count: 56 }, + // { item: '点位6', count: 115 }, + // { item: '点位7', count: 67 }, + // { item: '点位8', count: 144 }, + // { item: '点位9', count: 21 }, + // { item: '点位10', count: 83 }, ] } } + + async componentDidMount(){ + const { dispatch, user,actions,depUser} = this.props; + const { patrolManage } = actions + const times = [moment().subtract(70, 'years').format(format), moment().format(format)]; + const format = 'YYYY-MM-DD HH:mm:ss'; + const res = await dispatch(patrolManage.records(`patrolRecord/all/${times[0]}/${times[1]}/true/null`)); + const data = res?.payload?.data?.filter(i=>{ + return i?.patrolRecordIssueHandles[0]?.yanshoucishu>2&&i?.patrolRecordIssueHandles[0]?.isgaojing!==true + &&res?.payload?.data?.filter(j=>j?.pointId===i?.pointId&&j?.points?.project?.id===i?.points?.project?.id + &&j?.patrolRecordIssueHandles[0]?.yujingshijian + &&i?.patrolRecordIssueHandles[0]?.yujingshijian&& + parseInt(moment(i?.patrolRecordIssueHandles[0].yujingshijian).format('YYYYMMDDHHMMSS')){ + if(obj[i.pointId]){ + obj[i.pointId] = {name:i.points.itemData.name,count:obj[i.pointId].count+1} + // return ({name:i.points.itemData.name,count:obj[i.pointId].count+1}) + } + else{ + obj[i.pointId] = {name:i.points.itemData.name,count:1} + } + }) + console.log(data,'data') + const dd= Object.keys(obj).map(i=>{ + return ({item:obj[i].name,count:obj[i].count}) + }) + console.log(obj,'obj') + this.setState({ + alarmList:dd + }) + } + render() { const { height } = this.props; const { alarmList } = this.state; let max = null, content = null; - let data = alarmList.sort((a, b) => b.count - a.count); - max = data[0].count; + let data = alarmList.sort((a, b) => b?.count - a?.count); + max = data[0]?.count; + // console.log(alarmList,'alarmList') content =
{ alarmList.map((wd, i) => { @@ -56,5 +94,13 @@ class AlarmStatistics extends Component { ); } } - -export default AlarmStatistics; \ No newline at end of file +function mapStateToProps (state) { + const { auth, global ,depUser} = state + return { + user: auth.user, + actions: global.actions, + depUser: depUser.data || [], + } +} +export default connect(mapStateToProps)(AlarmStatistics); +// export default AlarmStatistics; \ No newline at end of file diff --git a/web/client/src/sections/shouye/containers/shouye.js b/web/client/src/sections/shouye/containers/shouye.js index c7463b0..fc285cb 100644 --- a/web/client/src/sections/shouye/containers/shouye.js +++ b/web/client/src/sections/shouye/containers/shouye.js @@ -68,7 +68,7 @@ const Information = (props) => { if (ext1) { ext1.value++; } else { - arr1.push({ name: l.point.name, value: 1 }) + arr1.push({ name: l.point?.name, value: 1 }) } } else {//修好了 let ext4 = arr4.find(a => a.name === l.point.name); @@ -127,12 +127,23 @@ const Information = (props) => {
今日预警
-
{shijiandata.filter(i => i?.alarm === true && i?.patrolRecordIssueHandles[0]?.yujingshijian && moment(i?.patrolRecordIssueHandles[0]?.yujingshijian).format - ('YYYYMMDD') === moment().format('YYYYMMDD') && i?.patrolRecordIssueHandles[0]?.isgaojing !== true).length}
+
{shijiandata.filter(i=>{ + return i?.patrolRecordIssueHandles[0]?.yanshoucishu>2&&i?.patrolRecordIssueHandles[0]?.isgaojing!==true + &&shijiandata?.filter(j=>j?.pointId===i?.pointId&&j?.points?.project?.id===i?.points?.project?.id + &&j?.patrolRecordIssueHandles[0]?.yujingshijian + &&i?.patrolRecordIssueHandles[0]?.yujingshijian&&moment(i?.patrolRecordIssueHandles[0]?.yujingshijian).format + ('YYYYMMDD') === moment().format('YYYYMMDD')&& + parseInt(moment(i?.patrolRecordIssueHandles[0].yujingshijian).format('YYYYMMDDHHMMSS'))
-
已下发:{shijiandata.filter(i => i?.alarm === true && i?.patrolRecordIssueHandles[0]?.yujingshijian && moment(i?.patrolRecordIssueHandles[0]?.yujingshijian).format - ('YYYYMMDD') === moment().format('YYYYMMDD') && i?.patrolRecordIssueHandles[0]?.isgaojing === true && i?.patrolRecordIssueHandles[0]?.yujingafchishu === 1).length}个
+
已下发:{shijiandata.filter(i=>{ + return i?.patrolRecordIssueHandles[0]?.isgaojing===true&&i?.patrolRecordIssueHandles[0]?.yujingafchishu===null + &&i?.patrolRecordIssueHandles[0]?.yujingshijian + &&moment(i?.patrolRecordIssueHandles[0]?.yujingshijian).format + ('YYYYMMDD') === moment().format('YYYYMMDD') + }).length}个