wenlele 2 years ago
parent
commit
dcb933d211
  1. 2
      web/client/src/layout/components/header/index.jsx
  2. 172
      web/client/src/sections/control/containers/control.jsx

2
web/client/src/layout/components/header/index.jsx

@ -27,7 +27,7 @@ const Header = (props) => {
if (v == 'resource_manage') ['facility', 'workOrder', 'means'].map(u => modal.push(u)) if (v == 'resource_manage') ['facility', 'workOrder', 'means'].map(u => modal.push(u))
if (v == 'customer_service') ['service', 'workOrder', 'means'].map(u => modal.push(u)) if (v == 'customer_service') ['service', 'workOrder', 'means'].map(u => modal.push(u))
}) })
modal.push('console') modal.push('control')
modal = [...new Set(modal)] modal = [...new Set(modal)]
modalRole = headerItems?.filter(v => modal.includes(v.itemKey)) modalRole = headerItems?.filter(v => modal.includes(v.itemKey))
if (userRole?.includes('SuperAdmin') || userRole?.includes('admin')) modalRole = headerItems if (userRole?.includes('SuperAdmin') || userRole?.includes('admin')) modalRole = headerItems

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

@ -38,25 +38,26 @@ const Control = (props) => {
const [alter, setAlter] = useState(false); // const [alter, setAlter] = useState(false); //
const [compile, setCompile] = useState({}); // const [compile, setCompile] = useState({}); //
const [toolShow, setToolShow] = useState([]); // const [toolShow, setToolShow] = useState([]); //
const [toolData, setToolData] = useState(0); //
const [tableSetup, setTableSetup] = useState([]); // const [tableSetup, setTableSetup] = useState([]); //
const [workData, setWorkData] = useState({}); // const [workData, setWorkData] = useState({}); //
const [dataBI, setDataBI] = useState({}); //BI- const [dataBI, setDataBI] = useState({}); //BI-
const [videoBI, setVideoBI] = useState([]); //BI- const [videoBI, setVideoBI] = useState([]); //BI-
const [appBI, setAppBI] = useState([]); //BI- const [appBI, setAppBI] = useState([]); //BI-
const [efficiencyBI, setEfficiencyBI] = useState({}); //BI- const [efficiencyBI, setEfficiencyBI] = useState({}); //BI-
const [query, setQuery] = useState({ limit: 10, page: 0, projectCorrelationId: '', types: '1,2,3,4' }); //
const [querydata1, setQueryData1] = useState([]); // const [querydata1, setQueryData1] = useState([]); //
const [long, setLong] = useState(''); // const [long, setLong] = useState(''); //
const [pomsList, setPomsList] = useState([]); // const [pomsList, setPomsList] = useState([]); //
const [projectId, setProjectId] = useState(''); //id const [projectId, setProjectId] = useState(''); //id
const [ask, setASk] = useState(true); // const [ask, setASk] = useState(true); //
const [setData, setSetData] = useState(); // const [setData, setSetData] = useState(); //
const [projectData, setProjectData] = useState([]); //
const exhibition = useRef({ workbench: [], statistical: [] }) // const exhibition = useRef({ workbench: [], statistical: [] }) //
const FormApi = useRef() const FormApi = useRef()
const querydata = useRef([])// const querydata = useRef([])//
// const query={ limit: 10, page: 0, projectCorrelationId: '', types: '1,2,3,4' } // const query = useRef({ limit: 10, page: 0, projectCorrelationId: '', types: '1,2,3,4' }) //
// websocket 使 // websocket 使
useEffect(() => { useEffect(() => {
@ -88,6 +89,7 @@ const Control = (props) => {
async function concentration2 () { async function concentration2 () {
await dispatch(install.getProjectPoms({ global: 1 })).then((res) => { // await dispatch(install.getProjectPoms({ global: 1 })).then((res) => { //
if (res.success) { if (res.success) {
setProjectData(res.payload.data?.rows?.filter(v => v.pepProjectIsDelete !== 1))
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)
@ -95,6 +97,72 @@ const Control = (props) => {
}) })
} }
concentration2() concentration2()
const line = document.getElementById("line")
const news = document.getElementById("news")
if (line && news) {
news.onscroll = () => {
if ((line.clientHeight - 578) < news.scrollTop + 10) {
query.current = { ...query.current, page: query.current.page + 1 }
if (exhibition?.current?.dynamic?.length > 0) {
dispatch(control.getLatestDynamic({ ...query.current, projectCorrelationId: pepProjectId, page: query.current.page })).then(res => {
console.log(res.payload.data)
let branches = [...res.payload.data?.appear, ...res.payload.data?.confirm, ...res.payload.data?.notice]
if (branches?.length == 10) {
news.scrollTop = news.scrollTop - 640
}
let data = querydata.current
if (res.success) {
if (exhibition?.current?.dynamic?.find(v => v.key == 'discovery')) {
res.payload.data?.appear?.map(v => data.push({
seed: 'discovery',
project: v.projectName,
sources: v.alarmInfo?.sourceName,
type: v.type,
time: v.time,
id: v.id,
}))
}
if (exhibition?.current?.dynamic?.find(v => v.key == 'confirm')) {
res.payload.data?.confirm?.map(v => data.push({
seed: 'confirm',
project: v.projectName,
sources: v.alarmInfo?.source,
type: v.alarmInfo?.type,
time: v.confirmTime,
userName: v.userName,
id: v.id,
}))
}
if (exhibition?.current?.dynamic?.find(v => v.key == 'notice')) {
res.payload.data?.notice?.map(v => data.push({
seed: 'notice',
time: v.time,
project: v.projectName,
userName: v.userName?.map(u => u.name),
alarmPushConfig: v.alarmPushConfig?.name,
tactics: v.tactics,
interval: v.tacticsParams?.interval,
deviceProportion: v.tacticsParams?.deviceProportion,
id: v.id,
}))
}
data.sort((a, b) => {
if (moment(a.time).isBefore(b.time)) {
return 1
} else {
return -1
}
})
console.log(data)
querydata.current = data
setQueryData1(data)
}
})
}
}
}
}
return () => { return () => {
} }
@ -103,7 +171,6 @@ const Control = (props) => {
useEffect(() => { useEffect(() => {
async function concentration1 () { async function concentration1 () {
if (pepProjectId) setProjectId(pepProjectId) if (pepProjectId) setProjectId(pepProjectId)
if (!projectId) {
// //
await dispatch(control.getConsoleCount({ pepProjectId: pepProjectId })).then(res => { await dispatch(control.getConsoleCount({ pepProjectId: pepProjectId })).then(res => {
if (res.success) setWorkData(res.payload.data) if (res.success) setWorkData(res.payload.data)
@ -124,6 +191,13 @@ const Control = (props) => {
if (res.success) setEfficiencyBI(res.payload.data[0]) if (res.success) setEfficiencyBI(res.payload.data[0])
}) })
} }
concentration1()
}, [pepProjectId])
useEffect(() => {
async function concentration4 () {
// --& // --&
await dispatch(control.getConsoleAbnormal({ pepProjectId: pepProjectId || projectId })).then(res => { await dispatch(control.getConsoleAbnormal({ pepProjectId: pepProjectId || projectId })).then(res => {
if (res.success) { if (res.success) {
@ -153,24 +227,20 @@ const Control = (props) => {
} }
}) })
} }
concentration1() concentration4()
}, [projectId])
}, [pepProjectId, projectId])
// console.log(exhibition?.current?.dynamic); // console.log(exhibition?.current?.dynamic);
useEffect(() => { useEffect(() => {
// //
async function concentration3 () { async function concentration3 () {
if (exhibition?.current?.dynamic?.length > 0) { if (exhibition?.current?.dynamic?.length > 0) {
console.log(query?.page); let dynamicData = [1]
await dispatch(control.getLatestDynamic({ ...query, projectCorrelationId: pepProjectId })).then(res => { await dispatch(control.getLatestDynamic({ ...query.current, 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 = []
querydata.current = []
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({
@ -223,70 +293,7 @@ const Control = (props) => {
concentration3() concentration3()
}, [pepProjectId, exhibition.current]) }, [pepProjectId, exhibition.current])
useEffect(() => {
const line = document.getElementById("line")
const news = document.getElementById("news")
if (line && news) {
news.onscroll = () => {
if ((line.clientHeight - 600) < news.scrollTop) {
setQuery({ ...query, page: query.page + 1 })
if (exhibition?.current?.dynamic?.length > 0) {
dispatch(control.getLatestDynamic({ ...query, projectCorrelationId: pepProjectId, page: query.page + 1 })).then(res => {
console.log(res.payload.data)
let data = querydata.current
if (res.success) {
if (exhibition?.current?.dynamic?.find(v => v.key == 'discovery')) {
res.payload.data?.appear?.map(v => data.push({
seed: 'discovery',
project: v.projectName,
sources: v.alarmInfo?.sourceName,
type: v.type,
time: v.time,
id: v.id,
}))
}
if (exhibition?.current?.dynamic?.find(v => v.key == 'confirm')) {
res.payload.data?.confirm?.map(v => data.push({
seed: 'confirm',
project: v.projectName,
sources: v.alarmInfo?.source,
type: v.alarmInfo?.type,
time: v.confirmTime,
userName: v.userName,
id: v.id,
}))
}
if (exhibition?.current?.dynamic?.find(v => v.key == 'notice')) {
res.payload.data?.notice?.map(v => data.push({
seed: 'notice',
time: v.time,
project: v.projectName,
userName: v.userName?.map(u => u.name),
alarmPushConfig: v.alarmPushConfig?.name,
tactics: v.tactics,
interval: v.tacticsParams?.interval,
deviceProportion: v.tacticsParams?.deviceProportion,
id: v.id,
}))
}
data.sort((a, b) => {
if (moment(a.time).isBefore(b.time)) {
return 1
} else {
return -1
}
})
console.log(data)
querydata.current = data
setQueryData1(data)
}
})
}
}
}
}
}, [query])
useEffect(() => { useEffect(() => {
@ -378,7 +385,10 @@ 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)
setToolData(res.payload.data?.length)
}
}) })
} }
@ -614,7 +624,7 @@ const Control = (props) => {
</div>} </div>}
{/* 项目里程碑 */} {/* 项目里程碑 */}
{exhibition.current?.statistical?.find(v => v.key == 'milestone') ? {exhibition.current?.statistical?.find(v => v.key == 'milestone') && projectId && projectData?.find(u => u.id == projectId)?.pepProjectName ?
<div style={{ marginBottom: 30, width: 466, height: 221, border: '1px solid rgba(220,222,224,0.2)', boxShadow: '0px 2px 12px 1px #F2F3F5', borderRadius: 2 }}> <div style={{ marginBottom: 30, width: 466, height: 221, border: '1px solid rgba(220,222,224,0.2)', boxShadow: '0px 2px 12px 1px #F2F3F5', borderRadius: 2 }}>
<div style={{ margin: '20px 0px 20px 24px', color: '#4A4A4A', fontSize: 16, fontWeight: 'bold' }}> <div style={{ margin: '20px 0px 20px 24px', color: '#4A4A4A', fontSize: 16, fontWeight: 'bold' }}>
项目里程碑 项目里程碑
@ -1124,11 +1134,16 @@ const Control = (props) => {
border: '1px solid #F2F3F5' border: '1px solid #F2F3F5'
}} }}
onClick={() => { onClick={() => {
if (toolData && toolData < 10) {
setTool(true) setTool(true)
}
}} }}
> >
添加 添加
</Button> </Button>
{toolData && toolData >= 10 ? <div style={{ color: 'red', marginTop: 8 }}>最多可添加10个应用</div> : ""}
</div> : ""} </div> : ""}
</div> </div>
@ -1154,7 +1169,8 @@ const Control = (props) => {
) )
} }
{/* 工具添加修改弹窗 */} {/* 工具添加修改弹窗 */}
{tool ? <Modal {
tool ? <Modal
title={alter ? '编辑' : "添加"} title={alter ? '编辑' : "添加"}
visible={true} visible={true}
width={600} width={600}

Loading…
Cancel
Save