|
@ -13,6 +13,7 @@ function YujingGuanli (props) { |
|
|
const format = 'YYYY-MM-DD HH:mm:ss' |
|
|
const format = 'YYYY-MM-DD HH:mm:ss' |
|
|
const { patrolManage } = actions |
|
|
const { patrolManage } = actions |
|
|
const [dataSource, setDataSource] = useState([{}]); |
|
|
const [dataSource, setDataSource] = useState([{}]); |
|
|
|
|
|
const [dataSource2, setDataSource2] = useState([{}]); |
|
|
const [visible, setVisible] = useState(false); |
|
|
const [visible, setVisible] = useState(false); |
|
|
const [type, setType] = useState(); |
|
|
const [type, setType] = useState(); |
|
|
const [curRecord, setCurRecord] = 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 => { |
|
|
dispatch(patrolManage.records(`patrolRecord/all/${times[0]}/${times[1]}/true/null`)).then(res => { |
|
|
if (res.success) { |
|
|
if (res.success) { |
|
|
console.log(res,'水平') |
|
|
console.log(res,'水平') |
|
|
let obj = {} |
|
|
|
|
|
// res?.payload?.data?.map(i=>{
|
|
|
// res?.payload?.data?.map(i=>{
|
|
|
// if(obj[i?.points?.project?.id]){
|
|
|
// if(obj[i?.points?.project?.id]){
|
|
|
// // if(obj[i?.points?.project?.id.toString()][i.pointId.toString()]){
|
|
|
// // if(obj[i?.points?.project?.id.toString()][i.pointId.toString()]){
|
|
@ -61,71 +62,59 @@ function YujingGuanli (props) { |
|
|
} |
|
|
} |
|
|
console.log(depUser,'depUser') |
|
|
console.log(depUser,'depUser') |
|
|
useEffect(() => { |
|
|
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()) |
|
|
dispatch(getDepUser()) |
|
|
queryData() |
|
|
queryData() |
|
|
dispatch(getCheckItemsGroup()) |
|
|
// dispatch(getCheckItemsGroup())
|
|
|
}, []) |
|
|
}, []) |
|
|
console.log(tableList,'tablist') |
|
|
// console.log(tableList,'tablist')
|
|
|
const columns = [{ |
|
|
const columns = [{ |
|
|
title: '结构物名称', |
|
|
title: '结构物名称', |
|
|
dataIndex: 'name', |
|
|
dataIndex: 'name', |
|
|
key: 'name', |
|
|
key: 'name', |
|
|
// search: false,
|
|
|
// search: false,
|
|
|
ellipsis: true, |
|
|
ellipsis: true, |
|
|
|
|
|
render: (t, r, i) => { |
|
|
|
|
|
// console.log(r,'测试')
|
|
|
|
|
|
return r?.points?.project?.name |
|
|
|
|
|
} |
|
|
}, { |
|
|
}, { |
|
|
title: '点位名称', |
|
|
title: '点位名称', |
|
|
dataIndex: 'describe', |
|
|
dataIndex: 'pointname', |
|
|
key: 'describe', |
|
|
key: 'pointname', |
|
|
search: false, |
|
|
search: false, |
|
|
ellipsis: true |
|
|
ellipsis: true, |
|
|
|
|
|
render: (t, r, i) => { |
|
|
|
|
|
// console.log(r,'测试')
|
|
|
|
|
|
return r?.points?.itemData?.name |
|
|
|
|
|
} |
|
|
}, { |
|
|
}, { |
|
|
title: '异常次数', |
|
|
title: '异常次数', |
|
|
dataIndex: 'user.name', |
|
|
dataIndex: 'yanshoucishu', |
|
|
key: 'user.name', |
|
|
key: 'yanshoucishu', |
|
|
ellipsis: true, |
|
|
ellipsis: true, |
|
|
search: false, |
|
|
search: false, |
|
|
render: (t, r, i) => { |
|
|
render: (t, r, i) => { |
|
|
return r.user ? r.user.name : '-' |
|
|
|
|
|
|
|
|
return r?.patrolRecordIssueHandles && r?.patrolRecordIssueHandles[0]?.yanshoucishu |
|
|
} |
|
|
} |
|
|
}, { |
|
|
}, { |
|
|
title: '产生时间', |
|
|
title: '产生时间', |
|
|
dataIndex: 'checkItems', |
|
|
dataIndex: 'yujingshijian', |
|
|
key: 'checkItems', |
|
|
key: 'yujingshijia', |
|
|
ellipsis: true, |
|
|
ellipsis: true, |
|
|
search: false, |
|
|
search: false, |
|
|
render: (_, r) => { |
|
|
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: '更新时间', |
|
|
title: '更新时间', |
|
|
dataIndex: 'checkItems', |
|
|
dataIndex: 'updatatime', |
|
|
key: 'checkItems', |
|
|
key: 'updatatime', |
|
|
search: false, |
|
|
search: false, |
|
|
ellipsis: true, |
|
|
ellipsis: true, |
|
|
render: (_, r) => { |
|
|
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: '操作', |
|
|
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 ( |
|
|
return ( |
|
|
<> |
|
|
<> |
|
|
<Tabs |
|
|
<Tabs |
|
@ -164,27 +192,50 @@ console.log(tableList,'tablist') |
|
|
pagination={{ pageSize: 10 }} |
|
|
pagination={{ pageSize: 10 }} |
|
|
// search={false}
|
|
|
// search={false}
|
|
|
request={async (params = {}) => { |
|
|
request={async (params = {}) => { |
|
|
const res = await dispatch(getPatrolTemplate(params)); |
|
|
// dispatch(patrolManage.records(`patrolRecord/all/${times[0]}/${times[1]}/true/null`)).then(res => {
|
|
|
setDataSource(res?.payload.data?.rows); |
|
|
// if (res.success) {
|
|
|
return { ...res }; |
|
|
// 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: `已告警`, |
|
|
label: `已告警`, |
|
|
key: '2', |
|
|
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); |
|
|
setVisible(false); |
|
|
setCurRecord({}) |
|
|
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} |
|
|
tableRef={tableRef} |
|
|
/> : null |
|
|
/> : null |
|
|
} |
|
|
} |
|
|