From da75cc7e8fce9b805b90e29a482132bd2ea14a8c Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Tue, 27 Jun 2023 09:57:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=9F=A5=E8=AF=A2=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/alarm/dataContinuity.js | 5 +---- api/app/lib/index.js | 3 ++- web/client/src/sections/data/components/dataQueryCheck.jsx | 7 ++++--- web/client/src/sections/data/containers/dataQuery.jsx | 7 ++++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/api/app/lib/controllers/alarm/dataContinuity.js b/api/app/lib/controllers/alarm/dataContinuity.js index 856ce58..3cbda06 100644 --- a/api/app/lib/controllers/alarm/dataContinuity.js +++ b/api/app/lib/controllers/alarm/dataContinuity.js @@ -184,9 +184,6 @@ async function dataContinuityList (ctx) { order: [['createTime', 'desc']], where: {}, attributes: ['id', 'type', 'createTime'], - include: [{ - model: models.AlarmDataContinuityType, - }] } if (limit) { @@ -209,7 +206,7 @@ async function dataContinuityList (ctx) { ctx.status = 200; ctx.body = dataRes } catch (error) { - ctx.fs.logger.error(`path: ${ctx.path}, error: error`); + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); ctx.status = 400; ctx.body = { message: typeof error == 'string' ? error : undefined diff --git a/api/app/lib/index.js b/api/app/lib/index.js index a4fe472..1ce4a5b 100644 --- a/api/app/lib/index.js +++ b/api/app/lib/index.js @@ -60,7 +60,8 @@ module.exports.models = function (dc) { // dc = { orm: Sequelize对象, ORM: Seq const { AppInspection, ProjectApp, ProjectCorrelation, AppAlarm, App, AlarmAppearRecord, AlarmConfirmLog, EmailSendLog, LatestDynamicList, AlarmPushConfig, MaintenanceRecord, MaintenanceRecordExecuteUser, MaintenancePlanExecuteUser, MaintenancePlan, EquipmentMaintenanceRecord, EquipmentMaintenanceRecordProject, - EquipmentMaintenanceRecordExecuteUser, ServerMaintenanceRecordRepairman, ServerMaintenanceRecord + EquipmentMaintenanceRecordExecuteUser, ServerMaintenanceRecordRepairman, ServerMaintenanceRecord, + AlarmDataContinuityType, AlarmDataContinuity } = dc.models; AppInspection.belongsTo(App, { foreignKey: 'projectAppId', targetKey: 'id' }); diff --git a/web/client/src/sections/data/components/dataQueryCheck.jsx b/web/client/src/sections/data/components/dataQueryCheck.jsx index 6c0630f..fcb1cf4 100644 --- a/web/client/src/sections/data/components/dataQueryCheck.jsx +++ b/web/client/src/sections/data/components/dataQueryCheck.jsx @@ -8,7 +8,7 @@ import { Form, Button, Skeleton, Table, Pagination, SideSheet } from '@douyinfe/ import '../style.less' function DataQueryCkeck (props) { - const { clientWidth, visible, onCancel, checkData, actions, dispatch } = props + const { clientWidth, visible, onCancel, checkData, actions, dispatch, dataContinuityType } = props const { data: sectionData } = actions const [loading, setLoading] = useState(false); const [htmlCode, setHtmlCode] = useState(''); @@ -28,7 +28,7 @@ function DataQueryCkeck (props) { return ( d.typeNumber == checkData.type)?.name} ${moment(checkData.createTime).format('YYYY-MM-DD HH:mm:ss')}`} visible={visible} onCancel={() => { onCancel() @@ -50,11 +50,12 @@ function DataQueryCkeck (props) { } function mapStateToProps (state) { - const { auth, global } = state; + const { auth, global, dataContinuityType } = state; return { user: auth.user, actions: global.actions, clientWidth: global.clientWidth, + dataContinuityType: dataContinuityType.data || [], }; } diff --git a/web/client/src/sections/data/containers/dataQuery.jsx b/web/client/src/sections/data/containers/dataQuery.jsx index fa1b4e3..8dc134d 100644 --- a/web/client/src/sections/data/containers/dataQuery.jsx +++ b/web/client/src/sections/data/containers/dataQuery.jsx @@ -60,7 +60,8 @@ const DataQuery = (props) => { values.createTimes = [moment(values?.createTimes[0]).format('YYYY-MM-DD HH:mm:ss'), moment(values?.createTimes[1]).format('YYYY-MM-DD HH:mm:ss')] } setParams({ ...values }) - getData({ createTimes: '', typeNo: '', ...values }) + setQuery({ limit: 10, page: 0 }) + getData({ createTimes: '', typeNo: '', ...values, limit: 10, page: 0 }) }} > { title: '数据类型', dataIndex: 'typeName', render: (text, record, index) => { - return record?.alarmDataContinuityType?.name || '' + return record?.alarmDataContinuityType?.name || dataContinuityType?.find(d => d.typeNumber == record.type)?.name || '' } }, { title: '产生时间', @@ -125,7 +126,7 @@ const DataQuery = (props) => {