wuqun 2 years ago
parent
commit
739bd55f5b
  1. 20
      web/client/src/sections/patrolManage/components/xiafagaojin.js
  2. 176
      web/client/src/sections/patrolManage/containers/yujingguanli.js
  3. 2
      web/client/src/sections/shouye/containers/shouye.js

20
web/client/src/sections/patrolManage/components/xiafagaojin.js

@ -8,10 +8,11 @@ import moment from 'moment';
const { RangePicker } = DatePicker;
const { TextArea } = Input;
const PlanModal = ({ visible, onCancel, dispatch, type, curRecord, tableRef, checkItemsGroup,userlist }) => {
const PlanModal = ({ visible, onCancel, dispatch, type, curRecord, tableRef, checkItemsGroup,userlist ,actions,onHandle}) => {
const [form] = Form.useForm();
const shigutypes = [{value:1,label: '邮件告警'},
{value:2,label:'短信告警'}]
const { issueHandle } = actions
const shigutypes = [{value:1,label: '短信告警'},
{value:2,label:'邮件告警'}]
console.log(userlist,'userlist')
return (
<Modal
@ -35,7 +36,15 @@ const PlanModal = ({ visible, onCancel, dispatch, type, curRecord, tableRef, che
console.log(usedata,'usedata')
dispatch(putxinxi({phone:[params.name],email:[usedata[0]?.email],type:params.type})).then(res=>{
console.log(res,'res')
}).then(()=>{
dispatch(issueHandle.modifyPatrolRecordIssueHandle(curRecord?.patrolRecordIssueHandles[0]?.id,{
isgaojing:true,
yujingshijian:moment().format('YYYY-MM-DD')
})),
onCancel();
onHandle()
})
console.log(curRecord,'curRecord')
console.log(params,'params')
})
.catch((info) => {
@ -69,10 +78,11 @@ const PlanModal = ({ visible, onCancel, dispatch, type, curRecord, tableRef, che
};
function mapStateToProps (state) {
const { auth, checkItemsGroup } = state
const { auth, checkItemsGroup,global } = state
return {
user: auth.user,
checkItemsGroup: checkItemsGroup.data || []
checkItemsGroup: checkItemsGroup.data || [],
actions: global.actions,
}
}
export default connect(mapStateToProps)(PlanModal);

176
web/client/src/sections/patrolManage/containers/yujingguanli.js

@ -13,6 +13,7 @@ function YujingGuanli (props) {
const format = 'YYYY-MM-DD HH:mm:ss'
const { patrolManage } = actions
const [dataSource, setDataSource] = useState([{}]);
const [dataSource2, setDataSource2] = useState([{}]);
const [visible, setVisible] = useState(false);
const [type, setType] = useState();
const [curRecord, setCurRecord] = useState();
@ -35,7 +36,7 @@ function YujingGuanli (props) {
dispatch(patrolManage.records(`patrolRecord/all/${times[0]}/${times[1]}/true/null`)).then(res => {
if (res.success) {
console.log(res,'水平')
let obj = {}
// res?.payload?.data?.map(i=>{
// if(obj[i?.points?.project?.id]){
// // if(obj[i?.points?.project?.id.toString()][i.pointId.toString()]){
@ -61,71 +62,59 @@ function YujingGuanli (props) {
}
console.log(depUser,'depUser')
useEffect(() => {
// dispatch(patrolManage.records(`patrolRecord/all/null/null/true/null`)).then(res=>{
// let obj = {}
// res?.payload?.data?.map(i=>{
// if(obj[i?.points?.project?.id]){
// obj[i?.points?.project?.id].name=i?.points?.project?.name;
// obj[i?.points?.project?.id].num=obj[i?.points?.project?.id].num +1
// }else{
// obj[i?.points?.project?.id]={name:i?.points?.project?.name,num:1}
// }
// })
// settableList(name != null ? res.payload.data?.filter(v =>
// (v.points.user.name.indexOf(name) != -1 || v.points.project.name.indexOf(name) != -1))
// .filter(x => curState == '全部' || curState == renderOptionText(x?.patrolRecordIssueHandles[0]?.state))
// .map(v => ({ ...v, key: v.id })) : res.payload.data?.map(v => ({ ...v, key: v.id })))
// const t1 = Object.keys(obj).map(i=>{
// return {id:i,name:obj[i].name,num:obj[i].num}
// })
// console.log(obj,'obj')
// console.log(res,'res')
// })
dispatch(getDepUser())
queryData()
dispatch(getCheckItemsGroup())
// dispatch(getCheckItemsGroup())
}, [])
console.log(tableList,'tablist')
// console.log(tableList,'tablist')
const columns = [{
title: '结构物名称',
dataIndex: 'name',
key: 'name',
// search: false,
ellipsis: true,
render: (t, r, i) => {
// console.log(r,'测试')
return r?.points?.project?.name
}
}, {
title: '点位名称',
dataIndex: 'describe',
key: 'describe',
dataIndex: 'pointname',
key: 'pointname',
search: false,
ellipsis: true
ellipsis: true,
render: (t, r, i) => {
// console.log(r,'测试')
return r?.points?.itemData?.name
}
}, {
title: '异常次数',
dataIndex: 'user.name',
key: 'user.name',
dataIndex: 'yanshoucishu',
key: 'yanshoucishu',
ellipsis: true,
search: false,
render: (t, r, i) => {
return r.user ? r.user.name : '-'
return r?.patrolRecordIssueHandles && r?.patrolRecordIssueHandles[0]?.yanshoucishu
}
}, {
title: '产生时间',
dataIndex: 'checkItems',
key: 'checkItems',
dataIndex: 'yujingshijian',
key: 'yujingshijia',
ellipsis: true,
search: false,
render: (_, r) => {
return r?.checkItems ? r?.checkItems.map(c => <Tag>{c.name}</Tag>) : '-'
return r?.patrolRecordIssueHandles && moment(r?.patrolRecordIssueHandles[0]?.yujingshijian).format('YYYY-MM-DD HH:mm:ss')
}
}, {
title: '更新时间',
dataIndex: 'checkItems',
key: 'checkItems',
dataIndex: 'updatatime',
key: 'updatatime',
search: false,
ellipsis: true,
render: (_, r) => {
return r?.checkItems ? r?.checkItems.map(c => <Tag>{c.name}</Tag>) : '-'
return r?.patrolRecordIssueHandles && moment(r?.patrolRecordIssueHandles[0]?.yanshoushijian).format('YYYY-MM-DD HH:mm:ss')
}
}, {
title: '操作',
@ -144,7 +133,46 @@ console.log(tableList,'tablist')
</>
},
}];
const columns1 = [{
title: '结构物名称',
dataIndex: 'name',
key: 'name',
// search: false,
ellipsis: true,
render: (t, r, i) => {
// console.log(r,'测试')
return r?.points?.project?.name
}
}, {
title: '点位名称',
dataIndex: 'pointname',
key: 'pointname',
search: false,
ellipsis: true,
render: (t, r, i) => {
// console.log(r,'测试')
return r?.points?.itemData?.name
}
}, {
title: '异常次数',
dataIndex: 'yanshoucishu',
key: 'yanshoucishu',
ellipsis: true,
search: false,
render: (t, r, i) => {
// console.log(r,'r')
return r?.patrolRecordIssueHandles && r?.patrolRecordIssueHandles[0]?.yanshoucishu
}
}, {
title: '下发时间',
dataIndex: 'yujingshijian',
key: 'yujingshijia',
ellipsis: true,
search: false,
render: (_, r) => {
return r?.patrolRecordIssueHandles && moment(r?.patrolRecordIssueHandles[0]?.yujingshijian).format('YYYY-MM-DD HH:mm:ss')
}
}];
return (
<>
<Tabs
@ -164,27 +192,50 @@ console.log(tableList,'tablist')
pagination={{ pageSize: 10 }}
// search={false}
request={async (params = {}) => {
const res = await dispatch(getPatrolTemplate(params));
setDataSource(res?.payload.data?.rows);
return { ...res };
// dispatch(patrolManage.records(`patrolRecord/all/${times[0]}/${times[1]}/true/null`)).then(res => {
// if (res.success) {
// console.log(res,'水平')
// const t1 = res?.payload?.data?.filter(i=>i.patrolRecordIssueHandles[0]?.isgaojing!==true&& i.patrolRecordIssueHandles[0]?.yanshoucishu>=3)
// }
// })
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&&
parseInt(moment(i?.patrolRecordIssueHandles[0].yujingshijian).format('YYYYMMDD'))<parseInt(moment(j?.patrolRecordIssueHandles[0]?.yujingshijian).format('YYYYMMDD'))
).length===0
})
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(params.name)));
}}
// toolBarRender={() => [
// <Button
// type="primary"
// key="primary"
// onClick={() => {
// setType('create')
// setVisible(true)
// }}
// >查询</Button>
// ]}
/>,
},
{
label: `已告警`,
key: '2',
children: `Content of Tab Pane 2`,
children: <ProTable
columns={columns1}
actionRef={tableRef}
options={false}
dataSource={dataSource2 || []}
rowKey='id'
pagination={{ pageSize: 10 }}
// search={false}
request={async (params = {}) => {
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
})
setDataSource2(data.filter(i=>i?.points?.project?.name.match(params.name)));
}}
/>,
}
]}
/>
@ -199,6 +250,27 @@ console.log(tableList,'tablist')
setVisible(false);
setCurRecord({})
}}
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)<parseInt(j?.patrolRecordIssueHandles[0]?.yujingshijian)
).length===0
})
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(i?.patrolRecordIssueHandles[0].yujingshijian)<parseInt(j?.patrolRecordIssueHandles[0]?.yujingshijian)
).length===0
})
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()));
}}
tableRef={tableRef}
/> : null
}

2
web/client/src/sections/shouye/containers/shouye.js

@ -132,7 +132,7 @@ const Information = (props) => {
</div>
<div className='shouyetopitem-right'>
<div>已下发{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}</div>
('YYYYMMDD') === moment().format('YYYYMMDD') && i?.patrolRecordIssueHandles[0]?.isgaojing === true && i?.patrolRecordIssueHandles[0]?.yujingafchishu === 1).length}</div>
</div>
</div>
</div>

Loading…
Cancel
Save