zhaobing 2 years ago
parent
commit
700b9dae9d
  1. 5
      api/app/lib/controllers/alarm/dataContinuity.js
  2. 3
      api/app/lib/index.js
  3. 7
      web/client/src/sections/data/components/dataQueryCheck.jsx
  4. 7
      web/client/src/sections/data/containers/dataQuery.jsx

5
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

3
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' });

7
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 (
<SideSheet
title={`${checkData?.alarmDataContinuityType?.name} ${moment(checkData.createTime).format('YYYY-MM-DD HH:mm:ss')}`}
title={`${checkData?.alarmDataContinuityType?.name || dataContinuityType?.find(d => 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 || [],
};
}

7
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 })
}}
>
<Form.DatePicker
@ -108,7 +109,7 @@ const DataQuery = (props) => {
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) => {
<Button theme='borderless' type="primary" onClick={() => {
dispatch(sectionData.getContinuityDetail(record.id)).then(res => {
if (res.success) {
downloadWord(res.payload?.data?.file || '', record?.alarmDataContinuityType?.name + moment(record.createTime).format('YYYY-MM-DD HH:mm:ss'))
downloadWord(res.payload?.data?.file || '', (record?.alarmDataContinuityType?.name || dataContinuityType?.find(d => d.typeNumber == record.type)?.name) + moment(record.createTime).format('YYYY-MM-DD HH:mm:ss'))
}
setLoading(false)
})

Loading…
Cancel
Save