wenlele 2 years ago
parent
commit
9bca2072a3
  1. 229
      web/client/src/sections/control/containers/control.jsx

229
web/client/src/sections/control/containers/control.jsx

@ -85,131 +85,134 @@ const Control = (props) => {
: "" : ""
attribute(v) attribute(v)
}) })
dispatch(install.getProjectPoms({ global: 1 })).then((res) => { // // dispatch(install.getProjectPoms({ global: 1 })).then((res) => { //
if (res.success) { // if (res.success) {
let data = res.payload.data?.rows?.filter(v => v.pepProjectIsDelete !== 1)?.map(v => ({ pepProjectId: v.id, pepProjectName: v.pepProjectName || v.name })) // let data = res.payload.data?.rows?.filter(v => v.pepProjectIsDelete !== 1)?.map(v => ({ pepProjectId: v.id, pepProjectName: v.pepProjectName || v.name }))
setPomsList(data) // setPomsList(data)
setProjectId(data[0]?.pepProjectId) // setProjectId(data[0]?.pepProjectId)
} // }
}) // })
return () => { return () => {
} }
}, []) }, [])
useEffect(() => { useEffect(() => {
if (pepProjectId) setProjectId(pepProjectId) async function csz () {
if (!projectId) { if (pepProjectId) setProjectId(pepProjectId)
// if (!projectId) {
// dispatch(control.getConsoleCount({ pepProjectId: pepProjectId })).then(res => { //
// if (res.success) setWorkData(res.payload.data) // await dispatch(control.getConsoleCount({ pepProjectId: pepProjectId })).then(res => {
// }) // if (res.success) setWorkData(res.payload.data)
// })
// BI- // BI-
dispatch(control.getDataAlarmsAggDay({ pepProjectId: pepProjectId })).then(res => { // dispatch(control.getDataAlarmsAggDay({ pepProjectId: pepProjectId })).then(res => {
if (res.success) setDataBI(res.payload.data) // if (res.success) setDataBI(res.payload.data)
}) // })
// BI- // BI-
dispatch(control.getVideoAlarmsAggDay({ pepProjectId: pepProjectId })).then(res => { // dispatch(control.getVideoAlarmsAggDay({ pepProjectId: pepProjectId })).then(res => {
if (res.success) setVideoBI(res.payload.data) // if (res.success) setVideoBI(res.payload.data)
}) // })
// BI- // BI-
dispatch(control.getAppAlarmsAggDay({ pepProjectId: pepProjectId })).then(res => { // dispatch(control.getAppAlarmsAggDay({ pepProjectId: pepProjectId })).then(res => {
if (res.success) setAppBI(res.payload.data) // if (res.success) setAppBI(res.payload.data)
}) // })
dispatch(control.getAlarmsHandleStatistics({ pepProjectId: pepProjectId })).then(res => { // dispatch(control.getAlarmsHandleStatistics({ pepProjectId: pepProjectId })).then(res => {
if (res.success) setEfficiencyBI(res.payload.data[0]) // if (res.success) setEfficiencyBI(res.payload.data[0])
}) // })
} }
// --& // --&
dispatch(control.getConsoleAbnormal({ pepProjectId: pepProjectId || projectId })).then(res => { // await dispatch(control.getConsoleAbnormal({ pepProjectId: pepProjectId || projectId })).then(res => {
if (res.success) { // if (res.success) {
if (res.payload.data?.length > 4) { // if (res.payload.data?.length > 4) {
setProblemsList([...res.payload.data, ...res.payload.data]) // setProblemsList([...res.payload.data, ...res.payload.data])
startmarquee('problems') // startmarquee('problems')
} else { // } else {
setProblemsList(res.payload.data) // setProblemsList(res.payload.data)
} // }
} // }
}) // })
}
csz()
// --web // --web
dispatch(control.getConsoleUser({ pepId: pepProjectId || projectId })).then(res => { // dispatch(control.getConsoleUser({ pepId: pepProjectId || projectId })).then(res => {
if (res.success) { // if (res.success) {
if (res.payload.data?.personnel?.length > 5) { // if (res.payload.data?.personnel?.length > 5) {
setMemberList([...res.payload.data?.personnel, ...res.payload.data?.personnel]) // setMemberList([...res.payload.data?.personnel, ...res.payload.data?.personnel])
startmarquee('member') // startmarquee('member')
} else { // } else {
setMemberList(res.payload.data?.personnel) // setMemberList(res.payload.data?.personnel)
} // }
if (res.payload.data?.webApp?.length > 3) { // if (res.payload.data?.webApp?.length > 3) {
setWebList([...res.payload.data?.webApp, ...res.payload.data?.webApp]) // setWebList([...res.payload.data?.webApp, ...res.payload.data?.webApp])
startmarquee('web') // startmarquee('web')
} else { // } else {
setWebList(res.payload.data?.webApp) // setWebList(res.payload.data?.webApp)
} // }
} // }
}) // })
}, [pepProjectId, projectId]) }, [pepProjectId, projectId])
// console.log(exhibition?.current?.dynamic); // console.log(exhibition?.current?.dynamic);
useEffect(() => { useEffect(() => {
// //
if (exhibition?.current?.dynamic?.length > 0) { // if (exhibition?.current?.dynamic?.length > 0) {
console.log(query?.page); // console.log(query?.page);
dispatch(control.getLatestDynamic({ ...query, projectCorrelationId: pepProjectId })).then(res => { // dispatch(control.getLatestDynamic({ ...query, projectCorrelationId: pepProjectId })).then(res => {
// console.log(res.payload.data); // // console.log(res.payload.data);
if (res.payload.data?.appear?.length || 0 + res.payload.data?.confirm?.length + res.payload.data?.notice?.length < 10) setASk(false) // if (res.payload.data?.appear?.length || 0 + res.payload.data?.confirm?.length + res.payload.data?.notice?.length < 10) setASk(false)
let data = [] // let data = []
if (res.success) { // if (res.success) {
if (exhibition?.current?.dynamic?.find(v => v.key == 'discovery')) { // if (exhibition?.current?.dynamic?.find(v => v.key == 'discovery')) {
res.payload.data?.appear?.map(v => data.push({ // res.payload.data?.appear?.map(v => data.push({
seed: 'discovery', // seed: 'discovery',
project: v.projectName, // project: v.projectName,
sources: v.alarmInfo?.sourceName, // sources: v.alarmInfo?.sourceName,
type: v.type, // type: v.type,
time: v.time, // time: v.time,
id: v.id, // id: v.id,
})) // }))
} // }
if (exhibition?.current?.dynamic?.find(v => v.key == 'confirm')) { // if (exhibition?.current?.dynamic?.find(v => v.key == 'confirm')) {
res.payload.data?.confirm?.map(v => data.push({ // res.payload.data?.confirm?.map(v => data.push({
seed: 'confirm', // seed: 'confirm',
project: v.projectName, // project: v.projectName,
sources: v.alarmInfo?.source, // sources: v.alarmInfo?.source,
type: v.alarmInfo?.type, // type: v.alarmInfo?.type,
time: v.confirmTime, // time: v.confirmTime,
userName: v.userName, // userName: v.userName,
id: v.id, // id: v.id,
})) // }))
} // }
if (exhibition?.current?.dynamic?.find(v => v.key == 'notice')) { // if (exhibition?.current?.dynamic?.find(v => v.key == 'notice')) {
res.payload.data?.notice?.map(v => data.push({ // res.payload.data?.notice?.map(v => data.push({
seed: 'notice', // seed: 'notice',
time: v.time, // time: v.time,
project: v.projectName, // project: v.projectName,
userName: v.userName?.map(u => u.name), // userName: v.userName?.map(u => u.name),
alarmPushConfig: v.alarmPushConfig?.name, // alarmPushConfig: v.alarmPushConfig?.name,
tactics: v.tactics, // tactics: v.tactics,
interval: v.tacticsParams?.interval, // interval: v.tacticsParams?.interval,
deviceProportion: v.tacticsParams?.deviceProportion, // deviceProportion: v.tacticsParams?.deviceProportion,
id: v.id, // id: v.id,
})) // }))
} // }
data.sort((a, b) => { // data.sort((a, b) => {
if (moment(a.time).isBefore(b.time)) { // if (moment(a.time).isBefore(b.time)) {
return 1 // return 1
} else { // } else {
return -1 // return -1
} // }
}) // })
console.log(data) // console.log(data)
querydata.current = data // querydata.current = data
setQueryData1(data) // setQueryData1(data)
} // }
}) // })
} // }
}, [pepProjectId, exhibition.current]) }, [pepProjectId, exhibition.current])
@ -367,9 +370,9 @@ const Control = (props) => {
}) })
const consoleToollink = () => { const consoleToollink = () => {
dispatch(control.getConsoleToollink()).then(res => { // dispatch(control.getConsoleToollink()).then(res => {
if (res.success) setToolShow(res.payload.data) // if (res.success) setToolShow(res.payload.data)
}) // })
} }
// //

Loading…
Cancel
Save