diff --git a/api/app/lib/controllers/alarm/data.js b/api/app/lib/controllers/alarm/data.js index 9e1f9a1..af30048 100644 --- a/api/app/lib/controllers/alarm/data.js +++ b/api/app/lib/controllers/alarm/data.js @@ -126,7 +126,9 @@ async function list (ctx) { ${anxinyun}.t_structure.longitude AS StructureLongitude, ${anxinyun}.t_structure.latitude AS StructureLatitude, ${anxinyun}.t_alarm_code.name AS AlarmCodeName, - AlarmContent + AlarmContent, + Project, + AlarmCount AS detailCount ${alarmQueryOptionStr} ORDER BY alarms.StartTime DESC ${!toExport && limit ? 'LIMIT ' + limit : ''} @@ -163,19 +165,21 @@ async function list (ctx) { `).toPromise() : []; - const detailCountAlarm = alarmRes - .map(ar => "'" + ar.AlarmId + "'") - const alarmDetailCount = detailCountAlarm.length ? await clickHouse.dataAlarm.query(` - SELECT - count(Time) AS count, AlarmId - FROM - alarm_details - WHERE - AlarmId IN (${detailCountAlarm.join(',')}) - AND AlarmState < 3 - GROUP BY AlarmId - `).toPromise() : - [] + /** 231019 alarm 表有 AlarmCount 字段 , + * alarmDetailCount就不需要计算查询了 + */ + // const detailCountAlarm = alarmRes + // .map(ar => "'" + ar.AlarmId + "'") + // const alarmDetailCount = detailCountAlarm.length ? await clickHouse.dataAlarm.query(` + // SELECT + // count(Time) AS count, AlarmId + // FROM + // alarm_details + // WHERE + // AlarmId IN (${detailCountAlarm.join(',')}) + // AND AlarmState < 3 + // GROUP BY AlarmId + // `).toPromise() : [] alarmRes.forEach(ar => { @@ -194,8 +198,8 @@ async function list (ctx) { ar.confirmedContent = corConfirmedData.Content || null ar.confirmedTime = corConfirmedData.Time || null - // 告警详情的数量 - ar.detailCount = (alarmDetailCount.find(adc => adc.AlarmId == ar.AlarmId) || { count: 0 }).count + // // 告警详情的数量 + // ar.detailCount = (alarmDetailCount.find(adc => adc.AlarmId == ar.AlarmId) || { count: 0 }).count }) if (toExport) { @@ -321,10 +325,12 @@ async function detail (ctx) { ${limit ? 'LIMIT ' + limit : ''} ${limit && page ? 'OFFSET ' + parseInt(limit) * parseInt(page) : ''} `).toPromise() - const count = await clickHouse.dataAlarm.query(` - SELECT count(*) AS count FROM alarm_details - WHERE AlarmId = '${alarmId}' - `).toPromise() + + // const count = await clickHouse.dataAlarm.query(` + // SELECT count(*) AS count FROM alarm_details + // WHERE AlarmId = '${alarmId}' + // `).toPromise() + ctx.status = 200; // ctx.body = { // count: count[0].count, diff --git a/api/config.js b/api/config.js index d13eb6c..15fde3c 100644 --- a/api/config.js +++ b/api/config.js @@ -196,7 +196,7 @@ const product = { camundarest: { host: FS_CAMUNDA_HOST, root: FS_CAMUNDA_ROOT - }, + }, exclude: [ // "*", { p: '/attachments/:p', o: 'POST' }, @@ -216,8 +216,8 @@ const product = { { p: '/project/group/statistic/alarm', o: 'GET' }, { p: '/project/group/list', o: 'GET' }, { p: '/project/group/:groupId/detail', o: 'GET' }, - {p:'/project/workOrders/repairRank',o:'GET'}, - {p:'/project/workOrders',o:'GET'} + { p: '/project/workOrders/repairRank', o: 'GET' }, + { p: '/project/workOrders', o: 'GET' } ], // 不做认证的路由,也可以使用 exclude: ["*"] 跳过所有路由 apMergeDeVeAnxinProjectId: AP_MERGE_DEVE_ANXINPROJECT_ID, anxinCloud: { @@ -270,10 +270,10 @@ const product = { pssaRequest: [{// name 会作为一个 request 出现在 ctx.app.fs name: 'axyRequest', root: API_ANXINYUN_URL - },{ - name:'craw', - root:API_CRAW_URL, - dataWord:'text' + }, { + name: 'craw', + root: API_CRAW_URL, + dataWord: 'text' }, { name: 'emisRequest', root: API_EMIS_URL diff --git a/web/client/src/sections/problem/components/tableData.jsx b/web/client/src/sections/problem/components/tableData.jsx index c07b746..d498b77 100644 --- a/web/client/src/sections/problem/components/tableData.jsx +++ b/web/client/src/sections/problem/components/tableData.jsx @@ -3,11 +3,6 @@ import { connect } from "react-redux"; import { Button, Form, Modal, Skeleton, Pagination, Table, Tooltip, Toast } from "@douyinfe/semi-ui"; import { SkeletonScreen, } from "$components"; import moment from "moment"; -import { validate } from "schema-utils"; -import { emit } from "superagent"; -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, statusId, setStatusId }) => { @@ -45,6 +40,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition type: v.type ? typeData[v.type] : "", confirm: v.confirm, confirmAuto: v.confirmAuto, + projectLocal: v.Project, })) setCount(tableDatas?.length || 0); setTableData(tableDatas) @@ -76,6 +72,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition confirm: v.confirmContent, camerOnline: v.camerOnline, autoRestore: v.autoRestore, + projectLocal: v.Project, })) setCount(tableDatas?.length || 0); setTableData(tableDatas) @@ -109,6 +106,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition alarmType: v.alarmType, confirm: v.confirmedContent, station: v.StructureLongitude && v.StructureLatitude ? v.StructureLongitude + '. ' + v.StructureLatitude : "", + projectLocal: v.Project, })) setTableData(tableDatas) } diff --git a/web/client/src/sections/problem/containers/dataAlarm.jsx b/web/client/src/sections/problem/containers/dataAlarm.jsx index fbbe8f2..daff70d 100644 --- a/web/client/src/sections/problem/containers/dataAlarm.jsx +++ b/web/client/src/sections/problem/containers/dataAlarm.jsx @@ -310,10 +310,11 @@ const DataAlarm = (props) => { name: '操作', sort: 25, value: 'text', render: (_, r, index) => { return
{r.State < 3 || route && ['videoAbnormal', 'useAbnormal'].includes(route) && !r.confirmTime ? - + r.projectLocal ? '' : + : r.State == 3 || r.autoRestore || r.confirmAuto ? : @@ -344,7 +345,7 @@ const DataAlarm = (props) => { let arr = localStorage.getItem(name) ? JSON.parse(localStorage.getItem(name)) : []; - // console.log(arr); + if (route) { let setup = tableList[route].map(v => columnAll.find(vv => v == vv.value))