Files
qhmes/jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/MesXslEquipmentLedger.data.ts

200 lines
7.0 KiB
Vue

import { BasicColumn, FormSchema } from '/@/components/Table';
import { checkEquipmentCode, checkEquipmentName } from './MesXslEquipmentLedger.api';
const colHalf = { span: 12 };
export const columns: BasicColumn[] = [
{ title: '设备编号', align: 'center', dataIndex: 'equipmentCode', width: 130 },
{ title: '设备名称', align: 'center', dataIndex: 'equipmentName', width: 160 },
{ title: '工序', align: 'center', dataIndex: 'processOperationName', width: 120 },
{ title: '设备类别', align: 'center', dataIndex: 'equipmentCategoryName', width: 110 },
{ title: '设备类型', align: 'center', dataIndex: 'equipmentTypeName', width: 110 },
{ title: '设备厂家', align: 'center', dataIndex: 'manufacturerName', width: 120 },
{ title: '所属工厂', align: 'center', dataIndex: 'factoryName', width: 120 },
{ title: '设备状态', align: 'center', dataIndex: 'equipmentStatus_dictText', width: 90 },
{ title: '是否启用', align: 'center', dataIndex: 'enabledFlag_dictText', width: 90 },
{ title: '设备型号', align: 'center', dataIndex: 'equipmentModel', width: 110, defaultHidden: true },
{ title: '创建时间', align: 'center', dataIndex: 'createTime', width: 165, defaultHidden: true },
];
export const searchFormSchema: FormSchema[] = [
{ label: '设备编号', field: 'equipmentCode', component: 'Input', colProps: { span: 6 } },
{ label: '设备名称', field: 'equipmentName', component: 'Input', colProps: { span: 6 } },
{ label: '工序名称', field: 'processOperationName', component: 'Input', colProps: { span: 6 } },
{
label: '设备状态',
field: 'equipmentStatus',
component: 'JDictSelectTag',
componentProps: { dictCode: 'xslmes_equipment_ledger_status' },
colProps: { span: 6 },
},
{
label: '是否启用',
field: 'enabledFlag',
component: 'JDictSelectTag',
componentProps: { dictCode: 'yn' },
colProps: { span: 6 },
},
];
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: 'factoryId', component: 'Input', show: false },
{
label: '所属工序',
field: 'processOperationName',
component: 'Input',
slot: 'processOperationPicker',
colProps: colHalf,
dynamicRules: () => [{ required: true, message: '请选择所属工序' }],
},
{
label: '设备编号',
field: 'equipmentCode',
component: 'Input',
colProps: colHalf,
componentProps: { placeholder: '同租户内不可重复' },
dynamicRules: ({ model }) => [
{ required: true, message: '请输入设备编号' },
{
validator: async (_rule, value) => {
const v = value == null ? '' : String(value).trim();
if (!v) return Promise.resolve();
try {
await checkEquipmentCode({ equipmentCode: v, dataId: model?.id });
return Promise.resolve();
} catch (e: any) {
return Promise.reject(e?.response?.data?.message || e?.message || '设备编号不能重复');
}
},
trigger: 'blur',
},
],
},
{
label: '设备名称',
field: 'equipmentName',
component: 'Input',
colProps: colHalf,
componentProps: { placeholder: '同租户内不可重复' },
dynamicRules: ({ model }) => [
{ required: true, message: '请输入设备名称' },
{
validator: async (_rule, value) => {
const v = value == null ? '' : String(value).trim();
if (!v) return Promise.resolve();
try {
await checkEquipmentName({ equipmentName: v, dataId: model?.id });
return Promise.resolve();
} catch (e: any) {
return Promise.reject(e?.response?.data?.message || e?.message || '设备名称不能重复');
}
},
trigger: 'blur',
},
],
},
{
label: '所属设备厂家',
field: 'manufacturerName',
component: 'Input',
slot: 'manufacturerPicker',
colProps: colHalf,
},
{
label: '设备类别',
field: 'equipmentCategoryName',
component: 'Input',
slot: 'equipmentCategoryPicker',
colProps: colHalf,
},
{
label: '设备类型',
field: 'equipmentTypeName',
component: 'Input',
slot: 'equipmentTypePicker',
colProps: colHalf,
},
{
label: '所属工厂',
field: 'factoryName',
component: 'Input',
slot: 'factoryPicker',
colProps: colHalf,
},
{ label: '设备型号', field: 'equipmentModel', component: 'Input', colProps: colHalf },
{
label: '设备状态',
field: 'equipmentStatus',
component: 'JDictSelectTag',
defaultValue: '0',
componentProps: { dictCode: 'xslmes_equipment_ledger_status' },
colProps: colHalf,
required: true,
},
{ label: '序列号', field: 'serialNo', component: 'Input', colProps: colHalf },
{ label: '铭牌', field: 'nameplate', component: 'Input', colProps: colHalf },
{
label: '维修部门',
field: 'maintainDeptId',
component: 'JSelectDept',
componentProps: { checkStrictly: true, multiple: false },
colProps: colHalf,
},
{ label: '维修人员', field: 'maintainPerson', component: 'Input', colProps: colHalf },
{
label: '主管部门',
field: 'manageDeptId',
component: 'JSelectDept',
componentProps: { checkStrictly: true, multiple: false },
colProps: colHalf,
},
{ label: '资料文件编号', field: 'docFileNo', component: 'Input', colProps: colHalf },
{
label: '生产日期',
field: 'productionDate',
component: 'DatePicker',
componentProps: { valueFormat: 'YYYY-MM-DD', style: { width: '100%' } },
colProps: colHalf,
},
{
label: '购买日期',
field: 'purchaseDate',
component: 'DatePicker',
componentProps: { valueFormat: 'YYYY-MM-DD', style: { width: '100%' } },
colProps: colHalf,
},
{
label: '使用日期',
field: 'useDate',
component: 'DatePicker',
componentProps: { valueFormat: 'YYYY-MM-DD', style: { width: '100%' } },
colProps: colHalf,
},
{ label: '厂商联系人', field: 'vendorContact', component: 'Input', colProps: colHalf },
{ label: '价值', field: 'assetValue', component: 'Input', colProps: colHalf },
{ label: '受控PDA', field: 'controlledPda', component: 'Input', colProps: colHalf },
{ label: '超产比率', field: 'overproductionRatio', component: 'Input', colProps: colHalf },
{ label: '有效体积', field: 'effectiveVolume', component: 'Input', colProps: colHalf },
{
label: '是否启用',
field: 'enabledFlag',
component: 'JDictSelectTag',
defaultValue: '1',
componentProps: { dictCode: 'yn' },
colProps: colHalf,
required: true,
},
{
label: '设备描述',
field: 'equipmentDesc',
component: 'InputTextArea',
componentProps: { rows: 3 },
colProps: { span: 24 },
},
];