From ba2b7596bf084bfcf5621ee832822b726e497faa Mon Sep 17 00:00:00 2001 From: wenlele Date: Wed, 9 Nov 2022 09:07:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=82=E5=B8=B8&=E9=97=AE=E9=A2=98=20?= =?UTF-8?q?=E8=B7=AF=E7=94=B1=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/alarm/app.js | 20 +++++++++---------- .../sections/problem/components/tableData.jsx | 7 +++---- .../sections/problem/containers/dataAlarm.jsx | 6 +++--- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/api/app/lib/controllers/alarm/app.js b/api/app/lib/controllers/alarm/app.js index 50afafd..5959423 100644 --- a/api/app/lib/controllers/alarm/app.js +++ b/api/app/lib/controllers/alarm/app.js @@ -2,7 +2,7 @@ const moment = require('moment') const { alarmConfirmLog } = require('./alarmConfirmLog'); -async function inspection(ctx) { +async function inspection (ctx) { // 巡查 try { const models = ctx.fs.dc.models; @@ -31,7 +31,7 @@ async function inspection(ctx) { } } -async function inspectionList(ctx) { +async function inspectionList (ctx) { try { const models = ctx.fs.dc.models; const { clickHouse } = ctx.app.fs @@ -116,7 +116,7 @@ async function inspectionList(ctx) { } } -async function notedInspection(ctx) { +async function notedInspection (ctx) { try { const models = ctx.fs.dc.models; const { inspectionId } = ctx.request.body @@ -141,7 +141,7 @@ async function notedInspection(ctx) { } } -async function apiError(ctx) { +async function apiError (ctx) { try { const { utils: { sendAppearToWeb } } = ctx.app.fs const models = ctx.fs.dc.models; @@ -253,12 +253,12 @@ async function apiError(ctx) { } } -async function apiErrorList(ctx) { +async function apiErrorList (ctx) { try { const models = ctx.fs.dc.models; const { clickHouse } = ctx.app.fs const { utils: { anxinStrucIdRange, pomsProjectRange } } = ctx.app.fs - const { keyword, errType, confirmState, sustainTimeStart, sustainTimeEnd, limit, page, pepProjectId } = ctx.query + const { keyword, errType, confirmState, state, sustainTimeStart, sustainTimeEnd, limit, page, pepProjectId } = ctx.query let pomsProject = await pomsProjectRange({ ctx, pepProjectId, @@ -311,10 +311,10 @@ async function apiErrorList(ctx) { if (errType) { findOption.where.type = errType // element / apiError } - if (confirmState) { - if (confirmState == 'confirmd') { + if (confirmState || state) { + if (confirmState == 'confirmd' || state == 'histroy') { findOption.where.confirmTime = { $ne: null } - } else if (confirmState == 'unconfirmed') { + } else if (confirmState == 'unconfirmed' || state == 'new') { findOption.where.confirmTime = null } } @@ -365,7 +365,7 @@ async function apiErrorList(ctx) { } } -async function confirmApiError(ctx) { +async function confirmApiError (ctx) { try { const models = ctx.fs.dc.models; const { confirm, appAlarmId = [], confirmPost } = ctx.request.body diff --git a/web/client/src/sections/problem/components/tableData.jsx b/web/client/src/sections/problem/components/tableData.jsx index 936512c..e49f91c 100644 --- a/web/client/src/sections/problem/components/tableData.jsx +++ b/web/client/src/sections/problem/components/tableData.jsx @@ -14,9 +14,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition const { problem } = actions const [count, setCount] = useState(0) // - // const [search, setSearch] = useState({}) const [checkAll, setCheckAll] = useState(true) //查询 - const api = useRef(); const search = useRef({ state: '', keywordTarget: '', keyword: '', kindId: '', groupUnitId: '', @@ -123,7 +121,8 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition useEffect(() => { if (location) { - search.current = { ...search.current, ...location } + search.current = { ...search.current, ...location, state: 'new' } + api.current?.setValues({...location, state: 'new'}) } if (route !== 'videoAbnormal' && route !== 'useAbnormal') { dispatch(problem.getAlarmDataGroup()).then((res) => { @@ -157,7 +156,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition } }, []) - console.log(location); + return ( <> diff --git a/web/client/src/sections/problem/containers/dataAlarm.jsx b/web/client/src/sections/problem/containers/dataAlarm.jsx index 7a56c0f..716bab9 100644 --- a/web/client/src/sections/problem/containers/dataAlarm.jsx +++ b/web/client/src/sections/problem/containers/dataAlarm.jsx @@ -128,10 +128,10 @@ const DataAlarm = (props) => { { name: '元素异常', value: 'element' }] }, { - name: '异常状态', field: 'confirmState', + name: '异常状态', field: 'state', data: [ - { name: '当前', value: 'unconfirmed' }, - { name: '历史', value: 'confirmd' }] + { name: '当前', value: 'new' }, + { name: '历史', value: 'histroy' }] }], deviceAbnormal: [ // 设备告警(deviceAbnormal) { name: '搜索', field: '1' },