From 6e4f134235c8dd9c7fbd1fd023543d1088145254 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Wed, 16 Nov 2022 14:26:14 +0800 Subject: [PATCH 1/5] format --- api/app/lib/controllers/alarm/video.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/api/app/lib/controllers/alarm/video.js b/api/app/lib/controllers/alarm/video.js index e168d4d..d97a4ab 100644 --- a/api/app/lib/controllers/alarm/video.js +++ b/api/app/lib/controllers/alarm/video.js @@ -8,15 +8,15 @@ async function deviceType (ctx) { const { clickHouse } = ctx.app.fs const kindRes = await clickHouse.vcmp.query(` - SELECT DISTINCT - camera_kind.id AS id,camera_kind.kind AS kind - FROM camera_kind - INNER JOIN camera - ON camera_kind.id = camera.kind_id - INNER JOIN camera_status_alarm - ON camera.channel_no = camera_status_alarm.channel_no - AND camera.serial_no = camera_status_alarm.serial_no - `).toPromise() + SELECT DISTINCT + camera_kind.id AS id,camera_kind.kind AS kind + FROM camera_kind + INNER JOIN camera + ON camera_kind.id = camera.kind_id + INNER JOIN camera_status_alarm + ON camera.channel_no = camera_status_alarm.channel_no + AND camera.serial_no = camera_status_alarm.serial_no + `).toPromise() ctx.status = 200; ctx.body = kindRes } catch (error) { From 67f535cd09dfcc23abe20ca16ae780322eab96f8 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Wed, 16 Nov 2022 14:40:24 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E8=A7=86=E9=A2=91=E5=91=8A=E8=AD=A6kind=20?= =?UTF-8?q?=E5=85=BC=E9=A1=BE=20=E7=BB=93=E6=9E=84=E7=89=A9=E5=8F=AF?= =?UTF-8?q?=E8=A7=81=E8=8C=83=E5=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/alarm/data.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/app/lib/controllers/alarm/data.js b/api/app/lib/controllers/alarm/data.js index 7ad2046..65b0c7a 100644 --- a/api/app/lib/controllers/alarm/data.js +++ b/api/app/lib/controllers/alarm/data.js @@ -15,10 +15,10 @@ async function groupList (ctx) { for (let g of groupRes) { g.unit = await await clickHouse.anxinyun.query(` SELECT DISTINCT - t_alarm_group_unit.id AS id,t_alarm_group_unit.name AS name,t_alarm_group_unit.group_id AS groupId + t_alarm_group_unit.id AS id,t_alarm_group_unit.name AS name,t_alarm_group_unit.group_id AS groupId FROM t_alarm_group_unit INNER JOIN ${dataAlarm}.alarms - ON t_alarm_group_unit.id = ${dataAlarm}.alarms.AlarmGroupUnit + ON t_alarm_group_unit.id = ${dataAlarm}.alarms.AlarmGroupUnit WHERE group_id = ${g.id} `).toPromise(); } From 602f5145ecb613653404380c0d27dc06d3d41603 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Wed, 16 Nov 2022 14:40:33 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E8=A7=86=E9=A2=91=E5=91=8A=E8=AD=A6kind=20?= =?UTF-8?q?=E5=85=BC=E9=A1=BE=20=E7=BB=93=E6=9E=84=E7=89=A9=E5=8F=AF?= =?UTF-8?q?=E8=A7=81=E8=8C=83=E5=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/alarm/video.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/api/app/lib/controllers/alarm/video.js b/api/app/lib/controllers/alarm/video.js index 270c0f8..a8ec73a 100644 --- a/api/app/lib/controllers/alarm/video.js +++ b/api/app/lib/controllers/alarm/video.js @@ -6,6 +6,12 @@ async function deviceType (ctx) { try { const { models } = ctx.fs.dc; const { clickHouse } = ctx.app.fs + const { database: anxinyun } = clickHouse.anxinyun.opts.config + const { utils: { judgeSuper, anxinStrucIdRange } } = ctx.app.fs + let anxinStruc = await anxinStrucIdRange({ + ctx, + }) + const anxinStrucIds = anxinStruc.map(a => a.strucId) const kindRes = await clickHouse.vcmp.query(` SELECT DISTINCT @@ -16,6 +22,10 @@ async function deviceType (ctx) { INNER JOIN camera_status_alarm ON camera.channel_no = camera_status_alarm.channel_no AND camera.serial_no = camera_status_alarm.serial_no + INNER JOIN ${anxinyun}.t_video_ipc + ON toString(${anxinyun}.t_video_ipc.channel_no) = camera_status_alarm.channel_no + AND ${anxinyun}.t_video_ipc.serial_no = camera_status_alarm.serial_no + ${`WHERE ${anxinyun}.t_video_ipc.structure IN (${anxinStrucIds.join(',')})`} `).toPromise() ctx.status = 200; ctx.body = kindRes @@ -34,7 +44,7 @@ async function alarmList (ctx) { const { clickHouse } = ctx.app.fs const { utils: { judgeSuper, anxinStrucIdRange } } = ctx.app.fs const { database: anxinyun } = clickHouse.anxinyun.opts.config - const { pepProjectId, keywordTarget, keyword, state, kindId, sustainTimeStart, sustainTimeEnd, limit, page, statusId, toExport} = ctx.query + const { pepProjectId, keywordTarget, keyword, state, kindId, sustainTimeStart, sustainTimeEnd, limit, page, statusId, toExport } = ctx.query let anxinStruc = await anxinStrucIdRange({ ctx, pepProjectId, keywordTarget, keyword @@ -78,7 +88,7 @@ async function alarmList (ctx) { ) `) } - if(statusId){ + if (statusId) { statusAlarmWhereOption.push(`camera_status_alarm.status_id = ${statusId}`) } @@ -279,7 +289,7 @@ async function alarmList (ctx) { } } -async function exportVideoAlarms(ctx, alarmList) { +async function exportVideoAlarms (ctx, alarmList) { let accessType = { yingshi: "萤石云", nvr: "NVR", ipc: "IPC", cascade: "级联" } try { const { clickHouse, utils: { simpleExcelDown, getExportAlarmHeader } } = ctx.app.fs; @@ -328,7 +338,7 @@ async function exportVideoAlarms(ctx, alarmList) { } } } -async function confirm(ctx) { +async function confirm (ctx) { try { const { alarmId, content, confirmPost } = ctx.request.body; // TODO: 以视频·应用的秘钥进行鉴权 From aac030adaed43dc018f733b0dfabc6c27f112f85 Mon Sep 17 00:00:00 2001 From: wenlele Date: Wed, 16 Nov 2022 15:25:34 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sections/control/containers/control.jsx | 33 +- .../install/components/systemModal.jsx | 11 +- .../sections/install/containers/system.jsx | 895 +++++++++--------- .../sections/problem/components/sideSheet.jsx | 8 +- 4 files changed, 460 insertions(+), 487 deletions(-) diff --git a/web/client/src/sections/control/containers/control.jsx b/web/client/src/sections/control/containers/control.jsx index 19fa77c..c4857d2 100644 --- a/web/client/src/sections/control/containers/control.jsx +++ b/web/client/src/sections/control/containers/control.jsx @@ -155,13 +155,7 @@ const Control = ({ dispatch, actions, user, history, loading, socket, pepProject }) } else { if (ProblemAlarm?.length > 0) { - ProblemAlarm.sort((a, b) => { - if (moment(a.StartTime).isBefore(b.StartTime)) { - return 1 - } else { - return -1 - } - }) + ProblemAlarm.sort((a, b) => (moment(a.StartTime).isBefore(b.StartTime) ? 1 : -1)) setProblemsList([...ProblemAlarm, ...problemsList]) } } @@ -187,19 +181,12 @@ const Control = ({ dispatch, actions, user, history, loading, socket, pepProject } }) } - newest.sort((a, b) => { - if (moment(a.time).isBefore(b.time)) { - return 1 - } else { - return -1 - } - }) + newest.sort((a, b) => (moment(a.time).isBefore(b.time) ? 1 : -1)) querydata.current = [...newest, ...querydata.current] setQueryData1([...querydata.current]) } }, [socketData]) - console.log(querydata.current); useEffect(() => { consoleToollink() @@ -423,13 +410,7 @@ const Control = ({ dispatch, actions, user, history, loading, socket, pepProject id: v.id, })) } - data.sort((a, b) => { - if (moment(a.time).isBefore(b.time)) { - return 1 - } else { - return -1 - } - }) + data.sort((a, b) => (moment(a.time).isBefore(b.time) ? 1 : -1)) // console.log(data) querydata.current = data setQueryData1(data) @@ -505,13 +486,7 @@ const Control = ({ dispatch, actions, user, history, loading, socket, pepProject id: v.id, })) } - data.sort((a, b) => { - if (moment(a.time).isBefore(b.time)) { - return 1 - } else { - return -1 - } - }) + data.sort((a, b) => (moment(a.time).isBefore(b.time) ? 1 : -1)) querydata.current = data setQueryData1(data) } diff --git a/web/client/src/sections/install/components/systemModal.jsx b/web/client/src/sections/install/components/systemModal.jsx index 48943f9..011109c 100644 --- a/web/client/src/sections/install/components/systemModal.jsx +++ b/web/client/src/sections/install/components/systemModal.jsx @@ -20,7 +20,8 @@ function adminModal (props) { anxincloudArr,//修改时已经选择的安心云列表 anxinDelete,//修改时安心云项目有删除,显示提示信息 appArr,//修改时添加应用 - bindId + bindId, + mapping //修改时的映射类型 } = props; const { install } = actions; const form = useRef();//表单 @@ -236,16 +237,14 @@ function adminModal (props) { } + > { [ { name: '智慧类', value: 'wisdom' }, diff --git a/web/client/src/sections/install/containers/system.jsx b/web/client/src/sections/install/containers/system.jsx index d0c83fe..b192fbe 100644 --- a/web/client/src/sections/install/containers/system.jsx +++ b/web/client/src/sections/install/containers/system.jsx @@ -8,472 +8,477 @@ import '../style.less' import { set } from 'nprogress'; const Example = (props) => { - const { dispatch, actions, user, loading, socket } = props - const { install } = actions; - const [query, setQuery] = useState({ limit: 10, page: 0 }); //页码信息 - const [limits, setLimits] = useState()//每页实际条数 - const mylimits = useRef(); //每页实际条数 - const [selected, setSelected] = useState([]) //表格被勾选项 - const [systemModal, setSystemModal] = useState(false) //映射关系弹框 - const [systemEdit, setSystemEdit] = useState(false) //是否是修改 - const [anxincloudList, setAnxincloudList] = useState([]) //安心云列表 - const [peplist, setPeplist] = useState([]) //PEP项目管理项目列表 - const [appList, setAppList] = useState([]) //应用列表 - const [pepProjectId, setPepProjectId] = useState() //修改时项企id - const [anxincloudArr, setAnxincloudArr] = useState([]) //修改时已经选择的安心云列表 - const [pepname, setPepname] = useState() //修改时自定义项目名称 - const [anxinDelete, setAnxinDelete] = useState([]) //修改时安心云项目有删除,显示提示信息 - const [appArr, setAppArr] = useState([]) //修改时添加应用 - const [bindId, setBindId] = useState() //修改时绑定的id - const [tableKey, setTableKey] = useState([]) //修改时绑定的id - const page = useRef(query.page);//哪一页 + const { dispatch, actions, user, loading, socket } = props + const { install } = actions; + const [query, setQuery] = useState({ limit: 10, page: 0 }); //页码信息 + const [limits, setLimits] = useState()//每页实际条数 + const mylimits = useRef(); //每页实际条数 + const [selected, setSelected] = useState([]) //表格被勾选项 + const [systemModal, setSystemModal] = useState(false) //映射关系弹框 + const [systemEdit, setSystemEdit] = useState(false) //是否是修改 + const [anxincloudList, setAnxincloudList] = useState([]) //安心云列表 + const [peplist, setPeplist] = useState([]) //PEP项目管理项目列表 + const [appList, setAppList] = useState([]) //应用列表 + const [pepProjectId, setPepProjectId] = useState() //修改时项企id + const [anxincloudArr, setAnxincloudArr] = useState([]) //修改时已经选择的安心云列表 + const [pepname, setPepname] = useState() //修改时自定义项目名称 + const [anxinDelete, setAnxinDelete] = useState([]) //修改时安心云项目有删除,显示提示信息 + const [appArr, setAppArr] = useState([]) //修改时添加应用 + const [bindId, setBindId] = useState() //修改时绑定的id + const [tableKey, setTableKey] = useState([]) //修改时绑定的id + const page = useRef(query.page);//哪一页 + const [mapping, setMapping] = useState() //修改时的映射类型 - function handleRow (record, index) {//斑马条纹 - // 给偶数行设置斑马纹 - if (index % 2 === 0) { - return { - style: { - background: '#FAFCFF', - } - }; - } else { - return {}; - } - } + function handleRow (record, index) {//斑马条纹 + // 给偶数行设置斑马纹 + if (index % 2 === 0) { + return { + style: { + background: '#FAFCFF', + } + }; + } else { + return {}; + } + } - const [tableData, setTableData] = useState([]) //表格数据 + const [tableData, setTableData] = useState([]) //表格数据 - const getPepProject = ()=>{ + const getPepProject = () => { dispatch(install.getProjectPmanage(query)).then((res) => {//获取PEP项目管理项目 setPeplist(res.payload.data) - }) - } + }) + } - useEffect(() => { - dispatch(install.getProjectAnxincloud(query)).then((res) => {//获取安心云项目 - setAnxincloudList(res.payload.data) - }) - getPepProject() - dispatch(install.getProjectAppList(query)).then((res) => {//获取应用列表 - setAppList(res.payload.data) - }) - console.log('user',user); - }, []) - useEffect(() => { - getProjectPomsList(); - }, [query]); + useEffect(() => { + dispatch(install.getProjectAnxincloud(query)).then((res) => {//获取安心云项目 + setAnxincloudList(res.payload.data) + }) + getPepProject() + dispatch(install.getProjectAppList(query)).then((res) => {//获取应用列表 + setAppList(res.payload.data) + }) + console.log('user', user); + }, []) + useEffect(() => { + getProjectPomsList(); + }, [query]); - function getProjectPomsList () { - dispatch(install.getProjectPoms(query)).then((res) => {//获取已绑定项目 - if (res.success) { - let mytableData = JSON.parse(JSON.stringify(res.payload.data.rows)); - let mytableKey = [] - for (let index = 0; index < mytableData.length; index++) { - mytableData[index].key = mytableData[index].id - mytableKey.push(mytableData[index].id) - } - setTableKey(mytableKey) - setTableData(mytableData) - setLimits(res.payload.data.count) - mylimits.current = res.payload.data.rows.length + function getProjectPomsList () { + dispatch(install.getProjectPoms(query)).then((res) => {//获取已绑定项目 + if (res.success) { + let mytableData = JSON.parse(JSON.stringify(res.payload.data.rows)); + let mytableKey = [] + for (let index = 0; index < mytableData.length; index++) { + mytableData[index].key = mytableData[index].id + mytableKey.push(mytableData[index].id) } - }) - } - const [columns, setColumns] = useState([//表格属性 - { - title: "序号", - dataIndex: "index", - key: 'index', - render: (text, r, index) => { - return index + 1; - }, - }, - { - title: 'PEP项企项目名称', - dataIndex: "pepProjectName", - key: 'pepProjectName', - render: (_, row) => { - return ( -
- { - row.pepProjectIsDelete == 1 ? ( - -
- -
-
) : ('') - } - -
7 || row?.name?.length > 7 ? '112px' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}> - {row.pepProjectName || row.name} -
+ setTableKey(mytableKey) + setTableData(mytableData) + setLimits(res.payload.data.count) + mylimits.current = res.payload.data.rows.length + } + }) + } + const [columns, setColumns] = useState([//表格属性 + { + title: "序号", + dataIndex: "index", + key: 'index', + render: (text, r, index) => { + return index + 1; + }, + }, + { + title: 'PEP项企项目名称', + dataIndex: "pepProjectName", + key: 'pepProjectName', + render: (_, row) => { + return ( +
+ { + row.pepProjectIsDelete == 1 ? ( + +
+ +
+
) : ('') + } + +
7 || row?.name?.length > 7 ? '112px' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}> + {row.pepProjectName || row.name} +
+
+ { + row.pepProjectName ? ( +
+
+ +
+
+ {row.constructionStatus} +
+
+ ) : ( +
+
+ +
+
+ POMS +
+
+ ) + } +
+ ) + } + }, + { + title: '安心云项目名称', + dataIndex: "anxinProject", + key: 'anxinProject', + width: 500, + render: (_, row) => { + let anxinerror = false + let anxinerrorArr = [] + for (let i = 0; i < row.anxinProject.length; i++) { + if (row.anxinProject[i].projectState == -1) { + anxinerror = true + anxinerrorArr.push(row.anxinProject[i].name) + } + } + return ( +
+ { + anxinerror ? ( + +
+ +
+
) : ('') + } + { + row.anxinProject.map((item, index) => { + return ( +
+ { + row.anxinProject.length >= 3 ? ( + +
7 ? '112px' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', display: index > 2 ? 'none' : '', color: item.projectState == -1 ? '#F93920' : '' }}> + {item.name} +
+
+ ) : row.anxinProject.length == 2 ? ( + +
12 ? '173.5px' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', color: item.projectState == -1 ? '#F93920' : '' }}> + {item.name} +
+
+ ) : ( + +
25 ? '358px' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', color: item.projectState == -1 ? '#F93920' : '' }}> + {item.name} +
+
+ ) + } +
1 ? 'none' : '' }}>
+
+ ) + }) + } + { + row.anxinProject.length > 3 ? ( + + { + row.anxinProject.map((item, index) => { + return ( +
+ {item.name}, +
+ ) + }) + } +
+ } trigger="click" style={{ lineHeight: 2 }}> +
+ +{row.anxinProject.length - 3} +
- { - row.pepProjectName ? ( -
-
- -
-
- {row.constructionStatus} -
-
- ) : ( -
-
- -
-
- POMS -
-
- ) + ) : ('') + } +
+ ) + } + }, + { + title: '关联时间', + dataIndex: "createTime", + key: 'time', + render: (_, row) => { + return moment(row.createTime).format("YYYY-MM-DD HH:mm:ss") + } + }, + { + title: '修改时间', + dataIndex: "updateTime", + key: 'updateTime', + render: (_, row) => { + return moment(row.updateTime).format("YYYY-MM-DD HH:mm:ss") + } + }, + { + title: '添加人员', + dataIndex: "pepUserName", + key: 'pepUserName', + render: (_, row) => { + return row.pepUserName + } + }, + { + title: "管理", + width: "20%", + dataIndex: "text", + key: 'text', + render: (_, row) => { + return ( +
+
- ) - } - }, - { - title: '安心云项目名称', - dataIndex: "anxinProject", - key: 'anxinProject', - width: 500, - render: (_, row) => { - let anxinerror = false - let anxinerrorArr = [] - for (let i = 0; i < row.anxinProject.length; i++) { - if (row.anxinProject[i].projectState == -1) { - anxinerror = true - anxinerrorArr.push(row.anxinProject[i].name) - } - } - return ( -
- { - anxinerror ? ( - -
- -
-
) : ('') + else { + setPepProjectId() } - { - row.anxinProject.map((item, index) => { - return ( -
- { - row.anxinProject.length >= 3 ? ( - -
7 ? '112px' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', display: index > 2 ? 'none' : '', color: item.projectState == -1 ? '#F93920' : '' }}> - {item.name} -
-
- ) : row.anxinProject.length == 2 ? ( - -
12 ? '173.5px' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', color: item.projectState == -1 ? '#F93920' : '' }}> - {item.name} -
-
- ) : ( - -
25 ? '358px' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', color: item.projectState == -1 ? '#F93920' : '' }}> - {item.name} -
-
- ) - } -
1 ? 'none' : '' }}>
-
- ) - }) + let myanxinArr = [] + let anxinErrorList = [] + for (let i = 0; i < row.anxinProject.length; i++) { + if (row.anxinProject[i].projectState !== -1) { + myanxinArr.push(row.anxinProject[i].id) + } + else { + anxinErrorList.push(row.anxinProject[i].name) + } } - { - row.anxinProject.length > 3 ? ( - - { - row.anxinProject.map((item, index) => { - return ( -
- {item.name}, -
- ) - }) - } -
- } trigger="click" style={{ lineHeight: 2 }}> -
- +{row.anxinProject.length - 3} -
- - ) : ('') + setAnxinDelete(anxinErrorList) + let myapparr = [] + let myarrarrList = JSON.parse(JSON.stringify(row.apps)) + for (let j = 0; j < row.apps.length; j++) { + delete myarrarrList[j].projectApp + myapparr.push(JSON.stringify(myarrarrList[j])) } - - ) - } - }, - { - title: '关联时间', - dataIndex: "createTime", - key: 'time', - render: (_, row) => { - return moment(row.createTime).format("YYYY-MM-DD HH:mm:ss"); - } - }, - { - title: '修改时间', - dataIndex: "updateTime", - key: 'updateTime', - render: (_, row) => { - return moment(row.updateTime).format("YYYY-MM-DD HH:mm:ss"); - } - }, - { - title: '添加人员', - dataIndex: "pepUserName", - key: 'pepUserName', - render: (_, row) => { - return row.pepUserName - } - }, - { - title: "管理", - width: "20%", - dataIndex: "text", - key: 'text', - render: (_, row) => { - return ( -
- - { - dispatch(install.deleteProjectBind({ bindId: row?.id, msg: '删除安心云、项目管理项目绑定关系' })).then(() => { - getPepProject() - if (page.current > 0 && mylimits.current < 2) { - setQuery({ limit: 10, page: page.current - 1 }) - } else { - setQuery({ limit: 10, page: page.current }) - } - }) - }} - > - - -
- ); - }, - }, - ]) - const rowSelection = { - selectedRowKeys: selected, - // onSelect: (record, selected) => { - // // console.log(`select row: ${selected}`, record); - // }, - // onSelectAll: (selected, selectedRows) => { - // // console.log(`select all rows: ${selected}`, selectedRows); - // }, - onChange: (selectedRowKeys, selectedRows) => { - setSelected(selectedRows.map(v => v.key)) - }, - } - return ( - <> -
-
-
-
-
系统映射
-
ASSOCIATION & MAPPING
-
-
- -
-
-
-
平台通过映射能力将多个系统的结构化、非结构化、半结构化数据按照平台算法进行分类关联,形成整体项目信息结构,以项企PEP的项目名称进行规范。
-
-
- - - -
-
-
勾选 {selected.length}条 信息
- - { - dispatch(install.deleteProjectBind({ bindId: selected.join(','), msg: '删除安心云、项目管理项目绑定关系' })).then(() => { - if (page.current > 0 && mylimits.current == selected.length) { - setQuery({ limit: 10, page: page.current - 1 }) - } else { - setQuery({ limit: 10, page: page.current }) - } - setSelected([]) - }) - }} - > - - -
-
- - 共{limits}条信息 - - { - setQuery({ limit: pageSize, page: currentPage - 1 }); - page.current = currentPage - 1 - setSelected([]) - }} - /> -
-
- + + setAppArr(myapparr) + setAnxincloudArr(myanxinArr) + setBindId(row.id) + setMapping(row?.mappingClass) + setSystemEdit(true) + }} + > + 修改 + + { + dispatch(install.deleteProjectBind({ bindId: row?.id, msg: '删除安心云、项目管理项目绑定关系' })).then(() => { + getPepProject() + if (page.current > 0 && mylimits.current < 2) { + setQuery({ limit: 10, page: page.current - 1 }) + } else { + setQuery({ limit: 10, page: page.current }) + } + }) + }} + > + + + + ); + }, + }, + ]) + const rowSelection = { + selectedRowKeys: selected, + // onSelect: (record, selected) => { + // // console.log(`select row: ${selected}`, record); + // }, + // onSelectAll: (selected, selectedRows) => { + // // console.log(`select all rows: ${selected}`, selectedRows); + // }, + onChange: (selectedRowKeys, selectedRows) => { + setSelected(selectedRows.map(v => v.key)) + }, + } + return ( + <> +
+
+
+
+
系统映射
+
ASSOCIATION & MAPPING
+
+
+ +
+
+
+
平台通过映射能力将多个系统的结构化、非结构化、半结构化数据按照平台算法进行分类关联,形成整体项目信息结构,以项企PEP的项目名称进行规范。
- {//映射关系弹框 - systemModal ? - { - setSystemModal(false); +
+ +
+ +
+
+
勾选 {selected.length}条 信息
+ + { + dispatch(install.deleteProjectBind({ bindId: selected.join(','), msg: '删除安心云、项目管理项目绑定关系' })).then(() => { + if (page.current > 0 && mylimits.current == selected.length) { + setQuery({ limit: 10, page: page.current - 1 }) + } else { + setQuery({ limit: 10, page: page.current }) + } + setSelected([]) + }) }} - close={() => { - setSystemModal(false); - getProjectPomsList() - getPepProject() - }} > - : '' - } - - ) + > + + +
+
+ + 共{limits}条信息 + + { + setQuery({ limit: pageSize, page: currentPage - 1 }); + page.current = currentPage - 1 + setSelected([]) + }} + /> +
+
+ + + {//映射关系弹框 + systemModal ? + { + setSystemModal(false); + }} + close={() => { + setSystemModal(false); + getProjectPomsList() + getPepProject() + }} > + : '' + } + + ) } function mapStateToProps (state) { - const { auth, global, ProjectPoms } = state; - return { - loading: ProjectPoms.isRequesting, - user: auth.user, - actions: global.actions, - // members: members.data, - }; + const { auth, global, ProjectPoms } = state; + return { + loading: ProjectPoms.isRequesting, + user: auth.user, + actions: global.actions, + // members: members.data, + }; } export default connect(mapStateToProps)(Example); diff --git a/web/client/src/sections/problem/components/sideSheet.jsx b/web/client/src/sections/problem/components/sideSheet.jsx index 1d7740c..19efa7c 100644 --- a/web/client/src/sections/problem/components/sideSheet.jsx +++ b/web/client/src/sections/problem/components/sideSheet.jsx @@ -32,13 +32,7 @@ function SideSheets ({ dispatch, actions, close, alarmId }) { dispatch(problem.getAlarmDataDetailAgg({ alarmId: alarmId })).then((res) => { if (res?.success) { let dataSort = res.payload.data || [] - dataSort.sort((a, b) => { - if (moment(a.hours).isBefore(b.hours)) { - return -1 - } else { - return 1 - } - }) + dataSort.sort((a, b) => (moment(a.hours).isBefore(b.hours) ? -1 : 1)) let data = { grid: { left: '5%', From bb643a0562d3f40e6426681f57d922c814a68b8c Mon Sep 17 00:00:00 2001 From: deartibers <947466799@qq.com> Date: Wed, 16 Nov 2022 16:20:40 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E8=A7=86=E9=A2=91=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E4=B8=AD=E6=B7=BB=E5=8A=A0=E5=BC=82=E5=B8=B8=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/alarm/video.js | 36 ++++++++++++++++++- api/app/lib/routes/alarm/index.js | 3 ++ .../sections/install/containers/system.jsx | 36 +++++++++---------- .../src/sections/problem/actions/problem.jsx | 11 ++++++ .../sections/problem/components/tableData.jsx | 15 +++++--- .../sections/problem/containers/dataAlarm.jsx | 7 ++++ web/client/src/utils/webapi.js | 1 + 7 files changed, 86 insertions(+), 23 deletions(-) diff --git a/api/app/lib/controllers/alarm/video.js b/api/app/lib/controllers/alarm/video.js index a8ec73a..ce69e26 100644 --- a/api/app/lib/controllers/alarm/video.js +++ b/api/app/lib/controllers/alarm/video.js @@ -38,6 +38,39 @@ async function deviceType (ctx) { } } +async function exceptionType(ctx) { + try { + const { models } = ctx.fs.dc; + const { clickHouse } = ctx.app.fs + const { database: anxinyun } = clickHouse.anxinyun.opts.config + const { utils: { judgeSuper, anxinStrucIdRange } } = ctx.app.fs + let anxinStruc = await anxinStrucIdRange({ + ctx, + }) + const anxinStrucIds = anxinStruc.map(a => a.strucId) + + const statusRes = await clickHouse.vcmp.query(` + SELECT DISTINCT + camera_status.id AS statusId,camera_status.describe AS describe + FROM camera_status + INNER JOIN camera_status_alarm + ON camera_status.id = camera_status_alarm.status_id + INNER JOIN ${anxinyun}.t_video_ipc + ON toString(${anxinyun}.t_video_ipc.channel_no) = camera_status_alarm.channel_no + AND ${anxinyun}.t_video_ipc.serial_no = camera_status_alarm.serial_no + ${`WHERE ${anxinyun}.t_video_ipc.structure IN (${anxinStrucIds.join(',')})`} + `).toPromise() + ctx.status = 200; + ctx.body = statusRes + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = { + message: typeof error == 'string' ? error : undefined + } + } +} + async function alarmList (ctx) { try { const { models } = ctx.fs.dc; @@ -461,5 +494,6 @@ module.exports = { alarmList, confirm, alarmAdded, - vcmpAppAuthToken + vcmpAppAuthToken, + exceptionType }; \ No newline at end of file diff --git a/api/app/lib/routes/alarm/index.js b/api/app/lib/routes/alarm/index.js index cfba9d0..9d97aaf 100644 --- a/api/app/lib/routes/alarm/index.js +++ b/api/app/lib/routes/alarm/index.js @@ -60,4 +60,7 @@ module.exports = function (app, router, opts) { app.fs.api.logAttr['GET/vcmp/auth'] = { content: '获取视频平台应用鉴权token', visible: true }; router.get('/vcmp/auth', videoAlarm.vcmpAppAuthToken); + + app.fs.api.logAttr['GET/alarm/video/exception_statusId'] = { content: '查询视频异常类型', visible: true }; + router.get('/alarm/video/exception_statusId', videoAlarm.exceptionType); }; diff --git a/web/client/src/sections/install/containers/system.jsx b/web/client/src/sections/install/containers/system.jsx index b192fbe..e634b24 100644 --- a/web/client/src/sections/install/containers/system.jsx +++ b/web/client/src/sections/install/containers/system.jsx @@ -225,28 +225,28 @@ const Example = (props) => { } }, { - title: '关联时间', - dataIndex: "createTime", - key: 'time', - render: (_, row) => { - return moment(row.createTime).format("YYYY-MM-DD HH:mm:ss") - } + title: '关联时间', + dataIndex: "createTime", + key: 'time', + render: (_, row) => { + return moment(row.createTime).format("YYYY-MM-DD HH:mm:ss")||'无'; + } }, { - title: '修改时间', - dataIndex: "updateTime", - key: 'updateTime', - render: (_, row) => { - return moment(row.updateTime).format("YYYY-MM-DD HH:mm:ss") - } + title: '修改时间', + dataIndex: "updateTime", + key: 'updateTime', + render: (_, row) => { + return (row.updateTime?moment(row.updateTime).format("YYYY-MM-DD HH:mm:ss"):moment(row.createTime).format("YYYY-MM-DD HH:mm:ss")); + } }, { - title: '添加人员', - dataIndex: "pepUserName", - key: 'pepUserName', - render: (_, row) => { - return row.pepUserName - } + title: '添加人员', + dataIndex: "pepUserName", + key: 'pepUserName', + render: (_, row) => { + return row.pepUserName||'无' + } }, { title: "管理", diff --git a/web/client/src/sections/problem/actions/problem.jsx b/web/client/src/sections/problem/actions/problem.jsx index b8bf96e..903cb7d 100644 --- a/web/client/src/sections/problem/actions/problem.jsx +++ b/web/client/src/sections/problem/actions/problem.jsx @@ -149,6 +149,17 @@ export function getAlarmVideoDeviceKind () { //查询视频设备类型 }); } +export function getAlarmVideoExceptionStatusId () { //查询视频异常类型 + return dispatch => basicAction({ + type: 'get', + dispatch: dispatch, + actionType: 'GET_ALARM_VIDEO_EXCEPTION_STATUS_ID', + url: `${ApiTable.getAlarmVideoExceptionStatusId}`, + msg: { option: '查询视频异常类型' }, + reducer: { name: '' } + }); + } + export function putAlarmVideoConfirm (data) { //确认视频告警 return dispatch => basicAction({ type: 'put', diff --git a/web/client/src/sections/problem/components/tableData.jsx b/web/client/src/sections/problem/components/tableData.jsx index 8c649c6..60f8b94 100644 --- a/web/client/src/sections/problem/components/tableData.jsx +++ b/web/client/src/sections/problem/components/tableData.jsx @@ -10,14 +10,14 @@ import qs from "qs"; const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition, pepProjectId, - selected, setSelected, setIfBulk, setConfirm, genre, setGenre, query, setQuery, tableData, setTableData, location, user }) => { + selected, setSelected, setIfBulk, setConfirm, genre, setGenre, query, setQuery, tableData, setTableData, location, user, statusId, setStatusId}) => { const { problem } = actions const [count, setCount] = useState(0) // const [checkAll, setCheckAll] = useState(true) //查询 const api = useRef(); const search = useRef({ - state: '', keywordTarget: '', keyword: '', kindId: '', groupUnitId: '', + state: '', keywordTarget: '', keyword: '', kindId: '', groupUnitId: '', statusId:'', errType: '', confirmState: '', onlineState: '', sustainTimeStart: '', sustainTimeEnd: '' }) const kindName = useRef() @@ -153,12 +153,17 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition setGenre(res.payload.data.map(v => ({ name: v.kind, value: v.id }))) } }) + dispatch(problem.getAlarmVideoExceptionStatusId()).then((res) => { + if (res.success) { + setStatusId(res.payload.data.map(v => ({ name: v.describe, value: v.statusId }))) + } + }) } }, []) const handleExport = () => { let url = '' - let { keywordTarget, keyword = '', errType = '', state = '', kindId = '', groupUnitId = '', confirmState = '', onlineState = '', sustainTimeStart = '', sustainTimeEnd = '' } = search.current + let { keywordTarget, keyword = '', errType = '', state = '', kindId = '', statusId = '', groupUnitId = '', confirmState = '', onlineState = '', sustainTimeStart = '', sustainTimeEnd = '' } = search.current switch (route) { case 'useAbnormal': url = `alarm/application/api?token=${user.token}&toExport=1×tamp=${moment().valueOf()}&keyword=${keyword}&errType=${errType} @@ -166,7 +171,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition break; case 'videoAbnormal': url = `alarm/video/list?token=${user.token}&toExport=1×tamp=${moment().valueOf()}&keywordTarget=${keywordTarget} - &keyword=${keyword}&kindId=${kindId}&state=${state}&sustainTimeStart=${sustainTimeStart}&sustainTimeEnd=${sustainTimeEnd} + &keyword=${keyword}&kindId=${kindId}&statusId=${statusId}&state=${state}&sustainTimeStart=${sustainTimeStart}&sustainTimeEnd=${sustainTimeEnd} &pepProjectId=${pepProjectId || ''}` break; default: @@ -277,6 +282,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition keywordTarget: v.keywordTarget, keyword: v.keyword, kindId: v.kindId, + statusId: v.statusId, groupUnitId: v.groupUnitId, errType: v.errType, confirmState: v.confirmState, @@ -299,6 +305,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition keywordTarget: v.keywordTarget, keyword: v.keyword, kindId: v.kindId, + statusId: v.statusId, groupUnitId: v.groupUnitId, errType: v.errType, confirmState: v.confirmState, diff --git a/web/client/src/sections/problem/containers/dataAlarm.jsx b/web/client/src/sections/problem/containers/dataAlarm.jsx index 4f1ca61..27ef6be 100644 --- a/web/client/src/sections/problem/containers/dataAlarm.jsx +++ b/web/client/src/sections/problem/containers/dataAlarm.jsx @@ -31,6 +31,7 @@ const DataAlarm = (props) => { const [content, setContent] = useState(false); //确认内容 const [selected, setSelected] = useState([]) //表格被勾选项 const [genre, setGenre] = useState([]) //搜索类型 + const [statusId, setStatusId] = useState([]) //异常类型 const [checkPop, setCheckPop] = useState(false) //查看弹框是否显现 const [alarmId, setAlarmId] = useState(false) //查看alarmId const [query, setQuery] = useState({ limit: 10, page: 0 }) //分页 @@ -112,6 +113,10 @@ const DataAlarm = (props) => { name: '设备类型', field: 'kindId', data: genre, }, + { + name: '异常类型', field: 'statusId', + data: statusId, + }, { name: '异常状态', field: 'state', data: [ @@ -424,11 +429,13 @@ const DataAlarm = (props) => { selected={selected} setSelected={setSelected} setGenre={setGenre} + setStatusId={setStatusId} query={query} setQuery={setQuery} tableData={tableData} setTableData={setTableData} genre={genre} + statusId={statusId} location={props.location?.query} /> {setup ? ( diff --git a/web/client/src/utils/webapi.js b/web/client/src/utils/webapi.js index 8ec5d94..b69f118 100644 --- a/web/client/src/utils/webapi.js +++ b/web/client/src/utils/webapi.js @@ -47,6 +47,7 @@ export const ApiTable = { getAlarmVideoDeviceKind: 'alarm/video/device_kind', //查询视频设备类型 putAlarmVideoConfirm: 'alarm/video/confirm', //确认视频告警信息 getVcmpAuth: 'vcmp/auth', // 获取视频平台应用鉴权token + getAlarmVideoExceptionStatusId: 'alarm/video/exception_statusId', //查询视频设备类型 //服务-信鸽服务 getPush: "push", //获取推送配置列表