设备对应部位功能新增

This commit is contained in:
2026-06-03 16:28:57 +08:00
parent 1c5cede957
commit 457089e271
24 changed files with 747 additions and 7 deletions

View File

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

View File

@@ -0,0 +1,20 @@
import { BasicColumn, FormSchema } from '/@/components/Table';
export const columns: BasicColumn[] = [
{ title: '设备名称', align: 'center', dataIndex: 'equipmentName', width: 180 },
{ title: '机台代号', align: 'center', dataIndex: 'machineCode', width: 140 },
{ title: '设备大部位', align: 'center', dataIndex: 'equipmentPartName', width: 160 },
{ title: '大部位代码', align: 'center', dataIndex: 'partCode', width: 120 },
{ title: '设备小部位', align: 'center', dataIndex: 'equipmentSubPartName', width: 160 },
{ title: '小部位代码', align: 'center', dataIndex: 'subPartCode', width: 120 },
{ title: '创建时间', align: 'center', dataIndex: 'createTime', width: 165 },
];
export const searchFormSchema: FormSchema[] = [
{ label: '设备名称', field: 'equipmentName', component: 'Input', colProps: { span: 6 } },
{ label: '机台代号', field: 'machineCode', component: 'Input', colProps: { span: 6 } },
{ label: '设备大部位', field: 'equipmentPartName', component: 'Input', colProps: { span: 6 } },
{ label: '设备小部位', field: 'equipmentSubPartName', component: 'Input', colProps: { span: 6 } },
{ label: '大部位代码', field: 'partCode', component: 'Input', colProps: { span: 6 } },
{ label: '小部位代码', field: 'subPartCode', component: 'Input', colProps: { span: 6 } },
];

View File

@@ -0,0 +1,45 @@
<template>
<div>
<BasicTable @register="registerTable">
<template #tableTitle>
<a-button
type="primary"
v-auth="'mes:mes_xsl_equip_part_mapping:exportXls'"
preIcon="ant-design:export-outlined"
@click="onExportXls"
>
导出
</a-button>
</template>
</BasicTable>
</div>
</template>
<script lang="ts" name="xslmes-mesXslEquipPartMapping" setup>
import { BasicTable } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage';
import { columns, searchFormSchema } from './MesXslEquipPartMapping.data';
import { list, getExportUrl } from './MesXslEquipPartMapping.api';
const { tableContext, onExportXls } = useListPage({
tableProps: {
title: '设备对应部位',
api: list,
columns,
canResize: true,
showActionColumn: false,
formConfig: {
schemas: searchFormSchema,
labelWidth: 120,
autoSubmitOnEnter: true,
showAdvancedButton: true,
},
},
exportConfig: {
name: '设备对应部位',
url: getExportUrl,
},
});
const [registerTable] = tableContext;
</script>

View File

@@ -3,6 +3,7 @@ import { defHttp } from '/@/utils/http/axios';
enum Api {
list = '/xslmes/mesXslEquipmentLedger/list',
checkEquipmentCode = '/xslmes/mesXslEquipmentLedger/checkEquipmentCode',
nextLedgerNo = '/xslmes/mesXslEquipmentLedger/nextLedgerNo',
checkEquipmentName = '/xslmes/mesXslEquipmentLedger/checkEquipmentName',
save = '/xslmes/mesXslEquipmentLedger/add',
edit = '/xslmes/mesXslEquipmentLedger/edit',
@@ -20,6 +21,8 @@ export const checkEquipmentCode = (params: { equipmentCode: string; dataId?: str
export const checkEquipmentName = (params: { equipmentName: string; dataId?: string }) =>
defHttp.get({ url: Api.checkEquipmentName, params }, { successMessageMode: 'none', errorMessageMode: 'none' });
export const fetchNextLedgerNo = () => defHttp.get({ url: Api.nextLedgerNo }, { successMessageMode: 'none' });
export const deleteOne = (params, handleSuccess) => defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => handleSuccess());
export const batchDelete = (params, handleSuccess) => defHttp.delete({ url: Api.deleteBatch, params }, { joinParamsToUrl: true }).then(() => handleSuccess());
export const saveOrUpdate = (params, isUpdate) => {

View File

@@ -4,6 +4,7 @@ import { checkEquipmentCode, checkEquipmentName } from './MesXslEquipmentLedger.
const colHalf = { span: 12 };
export const columns: BasicColumn[] = [
{ title: '系统编号', align: 'center', dataIndex: 'ledgerNo', width: 100 },
{ title: '设备编号', align: 'center', dataIndex: 'equipmentCode', width: 130 },
{ title: '设备名称', align: 'center', dataIndex: 'equipmentName', width: 160 },
{ title: '工序', align: 'center', dataIndex: 'processOperationName', width: 120 },
@@ -18,6 +19,7 @@ export const columns: BasicColumn[] = [
];
export const searchFormSchema: FormSchema[] = [
{ label: '系统编号', field: 'ledgerNo', component: 'Input', colProps: { span: 6 } },
{ label: '设备编号', field: 'equipmentCode', component: 'Input', colProps: { span: 6 } },
{ label: '设备名称', field: 'equipmentName', component: 'Input', colProps: { span: 6 } },
{ label: '', field: 'processOperationId', component: 'Input', show: false },
@@ -80,8 +82,8 @@ export const formSchema: FormSchema[] = [
{ label: '', field: 'id', component: 'Input', show: false },
{ label: '', field: 'processOperationId', component: 'Input', show: false },
{ label: '', field: 'manufacturerId', component: 'Input', show: false },
{ label: '', field: 'equipmentCategoryId', component: 'Input', show: false },
{ label: '', field: 'equipmentTypeId', component: 'Input', show: false },
{ label: '', field: 'equipmentCategoryId', component: 'Input', show: false, dynamicRules: () => [{ required: true, message: '请选择设备类别' }] },
{ label: '', field: 'equipmentTypeId', component: 'Input', show: false, dynamicRules: () => [{ required: true, message: '请选择设备类型' }] },
{ label: '', field: 'factoryId', component: 'Input', show: false },
{
label: '所属工序',
@@ -91,6 +93,13 @@ export const formSchema: FormSchema[] = [
colProps: colHalf,
dynamicRules: () => [{ required: true, message: '请选择所属工序' }],
},
{
label: '系统编号',
field: 'ledgerNo',
component: 'Input',
colProps: colHalf,
componentProps: { readonly: true, placeholder: '保存时从001起自动生成' },
},
{
label: '设备编号',
field: 'equipmentCode',
@@ -150,6 +159,7 @@ export const formSchema: FormSchema[] = [
component: 'Input',
slot: 'equipmentCategoryPicker',
colProps: colHalf,
dynamicRules: () => [{ required: true, message: '请选择设备类别' }],
},
{
label: '设备类型',
@@ -157,6 +167,7 @@ export const formSchema: FormSchema[] = [
component: 'Input',
slot: 'equipmentTypePicker',
colProps: colHalf,
dynamicRules: () => [{ required: true, message: '请选择设备类型' }],
},
{
label: '所属工厂',

View File

@@ -62,7 +62,7 @@
import { BasicModal, useModalInner, useModal } from '/@/components/Modal';
import { BasicForm, useForm } from '/@/components/Form/index';
import { formSchema } from '../MesXslEquipmentLedger.data';
import { saveOrUpdate } from '../MesXslEquipmentLedger.api';
import { fetchNextLedgerNo, saveOrUpdate } from '../MesXslEquipmentLedger.api';
import MesXslProcessOperationSelectModal from '/@/views/xslmes/mesXslEquipmentCategory/components/MesXslProcessOperationSelectModal.vue';
import MesXslManufacturerSelectModal from './MesXslManufacturerSelectModal.vue';
import MesXslEquipmentCategorySelectModal from '/@/views/xslmes/mesXslEquipmentType/components/MesXslEquipmentCategorySelectModal.vue';
@@ -112,7 +112,14 @@
isUpdate.value = !!data?.isUpdate;
isDetail.value = !data?.showFooter;
if (unref(isUpdate)) await setFieldsValue({ ...data.record });
else await setFieldsValue({ equipmentStatus: '0', enabledFlag: '1' });
else {
try {
const nextNo = await fetchNextLedgerNo();
await setFieldsValue({ equipmentStatus: '0', enabledFlag: '1', ledgerNo: nextNo });
} catch {
await setFieldsValue({ equipmentStatus: '0', enabledFlag: '1', ledgerNo: '' });
}
}
setProps({ disabled: !data?.showFooter });
});