Browse Source

本地化项目的告警列表不展示操作

dev
CODE 1 year ago
parent
commit
2f19217018
  1. 46
      api/app/lib/controllers/alarm/data.js
  2. 12
      api/config.js
  3. 8
      web/client/src/sections/problem/components/tableData.jsx
  4. 3
      web/client/src/sections/problem/containers/dataAlarm.jsx

46
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,

12
api/config.js

@ -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

8
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)
}

3
web/client/src/sections/problem/containers/dataAlarm.jsx

@ -310,6 +310,7 @@ const DataAlarm = (props) => {
name: '操作', sort: 25, value: 'text', render: (_, r, index) => {
return <div style={{ width: 195 }}>
{r.State < 3 || route && ['videoAbnormal', 'useAbnormal'].includes(route) && !r.confirmTime ?
r.projectLocal ? '' :
<Button theme='borderless' style={{ width: 65 }} onClick={() => {
setConfirm(true)
setSelected([r.id])
@ -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))

Loading…
Cancel
Save