设备停机记录、设备报警记录新增

This commit is contained in:
2026-06-05 14:17:43 +08:00
parent 457089e271
commit cbbbabe4cf
39 changed files with 1498 additions and 13 deletions

View File

@@ -0,0 +1,11 @@
import { defHttp } from '/@/utils/http/axios';
enum Api {
list = '/xslmes/mesXslEquipAlarmRecord/list',
queryById = '/xslmes/mesXslEquipAlarmRecord/queryById',
exportXls = '/xslmes/mesXslEquipAlarmRecord/exportXls',
}
export const list = (params) => defHttp.get({ url: Api.list, params });
export const queryById = (params) => defHttp.get({ url: Api.queryById, params });
export const getExportUrl = Api.exportXls;

View File

@@ -0,0 +1,35 @@
import { BasicColumn, FormSchema } from '/@/components/Table';
export const columns: BasicColumn[] = [
{ title: '机台编号', align: 'center', dataIndex: 'equipId', width: 120 },
{ title: '机台名称', align: 'center', dataIndex: 'equipName', width: 140 },
{ title: '机台类型', align: 'center', dataIndex: 'equipType', width: 100 },
{ title: '班次', align: 'center', dataIndex: 'shiftClass', width: 80 },
{ title: '报警内容', align: 'left', dataIndex: 'alarmContent', width: 260 },
{ title: '报警时间', align: 'center', dataIndex: 'alarmTime', width: 170 },
{ title: '类型', align: 'center', dataIndex: 'recordType', width: 80 },
];
export const searchFormSchema: FormSchema[] = [
{ label: '机台编号', field: 'equipId', component: 'JInput', colProps: { span: 6 } },
{ label: '机台名称', field: 'equipName', component: 'JInput', colProps: { span: 6 } },
{ label: '报警内容', field: 'alarmInf', component: 'JInput', colProps: { span: 6 } },
{
label: '报警时间',
field: 'writeTime',
component: 'RangePicker',
componentProps: { valueType: 'Date', showTime: true, placeholder: ['开始时间', '结束时间'] },
colProps: { span: 8 },
},
];
export const formSchema: FormSchema[] = [
{ label: '', field: 'id', component: 'Input', show: false },
{ label: '机台编号', field: 'equipId', component: 'Input', componentProps: { disabled: true }, colProps: { span: 12 } },
{ label: '机台名称', field: 'equipName', component: 'Input', componentProps: { disabled: true }, colProps: { span: 12 } },
{ label: '机台类型', field: 'equipType', component: 'Input', componentProps: { disabled: true }, colProps: { span: 12 } },
{ label: '班次', field: 'shiftClass', component: 'Input', componentProps: { disabled: true }, colProps: { span: 12 } },
{ label: '报警内容', field: 'alarmContent', component: 'InputTextArea', componentProps: { disabled: true, rows: 3 }, colProps: { span: 24 } },
{ label: '报警时间', field: 'alarmTime', component: 'Input', componentProps: { disabled: true }, colProps: { span: 12 } },
{ label: '类型', field: 'recordType', component: 'Input', componentProps: { disabled: true }, colProps: { span: 12 } },
];

View File

@@ -0,0 +1,63 @@
<template>
<div>
<BasicTable @register="registerTable">
<template #tableTitle>
<a-button
type="primary"
v-auth="'mes:mes_xsl_equip_alarm_record:exportXls'"
preIcon="ant-design:export-outlined"
@click="onExportXls"
>
导出
</a-button>
</template>
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" />
</template>
</BasicTable>
<MesXslEquipAlarmRecordModal @register="registerModal" />
</div>
</template>
<script lang="ts" name="xslmes-mesXslEquipAlarmRecord" setup>
import { BasicTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import MesXslEquipAlarmRecordModal from './components/MesXslEquipAlarmRecordModal.vue';
import { columns, searchFormSchema } from './MesXslEquipAlarmRecord.data';
import { list, getExportUrl } from './MesXslEquipAlarmRecord.api';
const [registerModal, { openModal }] = useModal();
const { tableContext, onExportXls } = useListPage({
tableProps: {
title: '设备报警记录',
api: list,
columns,
canResize: true,
showActionColumn: true,
actionColumn: { width: 80, fixed: 'right' },
formConfig: {
schemas: searchFormSchema,
labelWidth: 100,
autoSubmitOnEnter: true,
showAdvancedButton: true,
fieldMapToTime: [['writeTime', ['writeTime_begin', 'writeTime_end'], 'YYYY-MM-DD HH:mm:ss']],
},
},
exportConfig: {
name: '设备报警记录',
url: getExportUrl,
},
});
const [registerTable] = tableContext;
function handleDetail(record: Recordable) {
openModal(true, { record, isUpdate: true, showFooter: false });
}
function getTableAction(record) {
return [{ label: '详情', onClick: handleDetail.bind(null, record) }];
}
</script>

View File

@@ -0,0 +1,23 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" title="设备报警记录详情" :width="800" :showOkBtn="false" cancelText="关闭">
<BasicForm @register="registerForm" />
</BasicModal>
</template>
<script lang="ts" setup>
import { BasicModal, useModalInner } from '/@/components/Modal';
import { BasicForm, useForm } from '/@/components/Form';
import { formSchema } from '../MesXslEquipAlarmRecord.data';
const [registerForm, { resetFields, setFieldsValue }] = useForm({
labelWidth: 120,
schemas: formSchema,
showActionButtonGroup: false,
baseColProps: { span: 24 },
});
const [registerModal] = useModalInner(async (data) => {
await resetFields();
await setFieldsValue({ ...data.record });
});
</script>

View File

@@ -0,0 +1,11 @@
import { defHttp } from '/@/utils/http/axios';
enum Api {
list = '/xslmes/mesXslEquipDowntimeRecord/list',
queryById = '/xslmes/mesXslEquipDowntimeRecord/queryById',
exportXls = '/xslmes/mesXslEquipDowntimeRecord/exportXls',
}
export const list = (params) => defHttp.get({ url: Api.list, params });
export const queryById = (params) => defHttp.get({ url: Api.queryById, params });
export const getExportUrl = Api.exportXls;

View File

@@ -0,0 +1,39 @@
import { BasicColumn, FormSchema } from '/@/components/Table';
export const columns: BasicColumn[] = [
{ title: '机台编号', align: 'center', dataIndex: 'equipId', width: 120 },
{ title: '机台名称', align: 'center', dataIndex: 'equipName', width: 140 },
{ title: '机台类型', align: 'center', dataIndex: 'equipType', width: 100 },
{ title: '班次', align: 'center', dataIndex: 'shiftClass', width: 80 },
{ title: '停机内容', align: 'left', dataIndex: 'downtimeContent', width: 260 },
{ title: '停机开始时间', align: 'center', dataIndex: 'downtimeStartTime', width: 170 },
{ title: '停机结束时间', align: 'center', dataIndex: 'downtimeEndTime', width: 170 },
{ title: '停机时长', align: 'center', dataIndex: 'downtimeDuration', width: 120 },
{ title: '类型', align: 'center', dataIndex: 'recordType', width: 80 },
];
export const searchFormSchema: FormSchema[] = [
{ label: '机台编号', field: 'equipId', component: 'JInput', colProps: { span: 6 } },
{ label: '机台名称', field: 'equipName', component: 'JInput', colProps: { span: 6 } },
{ label: '停机内容', field: 'alarmInf', component: 'JInput', colProps: { span: 6 } },
{
label: '停机开始时间',
field: 'writeTime',
component: 'RangePicker',
componentProps: { valueType: 'Date', showTime: true, placeholder: ['开始时间', '结束时间'] },
colProps: { span: 8 },
},
];
export const formSchema: FormSchema[] = [
{ label: '', field: 'id', component: 'Input', show: false },
{ label: '机台编号', field: 'equipId', component: 'Input', componentProps: { disabled: true }, colProps: { span: 12 } },
{ label: '机台名称', field: 'equipName', component: 'Input', componentProps: { disabled: true }, colProps: { span: 12 } },
{ label: '机台类型', field: 'equipType', component: 'Input', componentProps: { disabled: true }, colProps: { span: 12 } },
{ label: '班次', field: 'shiftClass', component: 'Input', componentProps: { disabled: true }, colProps: { span: 12 } },
{ label: '停机内容', field: 'downtimeContent', component: 'InputTextArea', componentProps: { disabled: true, rows: 3 }, colProps: { span: 24 } },
{ label: '停机开始时间', field: 'downtimeStartTime', component: 'Input', componentProps: { disabled: true }, colProps: { span: 12 } },
{ label: '停机结束时间', field: 'downtimeEndTime', component: 'Input', componentProps: { disabled: true }, colProps: { span: 12 } },
{ label: '停机时长', field: 'downtimeDuration', component: 'Input', componentProps: { disabled: true }, colProps: { span: 12 } },
{ label: '类型', field: 'recordType', component: 'Input', componentProps: { disabled: true }, colProps: { span: 12 } },
];

View File

@@ -0,0 +1,63 @@
<template>
<div>
<BasicTable @register="registerTable">
<template #tableTitle>
<a-button
type="primary"
v-auth="'mes:mes_xsl_equip_downtime_record:exportXls'"
preIcon="ant-design:export-outlined"
@click="onExportXls"
>
导出
</a-button>
</template>
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" />
</template>
</BasicTable>
<MesXslEquipDowntimeRecordModal @register="registerModal" />
</div>
</template>
<script lang="ts" name="xslmes-mesXslEquipDowntimeRecord" setup>
import { BasicTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import MesXslEquipDowntimeRecordModal from './components/MesXslEquipDowntimeRecordModal.vue';
import { columns, searchFormSchema } from './MesXslEquipDowntimeRecord.data';
import { list, getExportUrl } from './MesXslEquipDowntimeRecord.api';
const [registerModal, { openModal }] = useModal();
const { tableContext, onExportXls } = useListPage({
tableProps: {
title: '设备停机记录',
api: list,
columns,
canResize: true,
showActionColumn: true,
actionColumn: { width: 80, fixed: 'right' },
formConfig: {
schemas: searchFormSchema,
labelWidth: 110,
autoSubmitOnEnter: true,
showAdvancedButton: true,
fieldMapToTime: [['writeTime', ['writeTime_begin', 'writeTime_end'], 'YYYY-MM-DD HH:mm:ss']],
},
},
exportConfig: {
name: '设备停机记录',
url: getExportUrl,
},
});
const [registerTable] = tableContext;
function handleDetail(record: Recordable) {
openModal(true, { record, isUpdate: true, showFooter: false });
}
function getTableAction(record) {
return [{ label: '详情', onClick: handleDetail.bind(null, record) }];
}
</script>

View File

@@ -0,0 +1,23 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" title="设备停机记录详情" :width="800" :showOkBtn="false" cancelText="关闭">
<BasicForm @register="registerForm" />
</BasicModal>
</template>
<script lang="ts" setup>
import { BasicModal, useModalInner } from '/@/components/Modal';
import { BasicForm, useForm } from '/@/components/Form';
import { formSchema } from '../MesXslEquipDowntimeRecord.data';
const [registerForm, { resetFields, setFieldsValue }] = useForm({
labelWidth: 120,
schemas: formSchema,
showActionButtonGroup: false,
baseColProps: { span: 24 },
});
const [registerModal] = useModalInner(async (data) => {
await resetFields();
await setFieldsValue({ ...data.record });
});
</script>