密炼机动作维护、日罐物料对应关系
This commit is contained in:
@@ -0,0 +1,154 @@
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||
import { loadTreeData } from '/@/api/common/api';
|
||||
import { queryEquipmentById } from './MesXslDayTankMaterialMap.api';
|
||||
|
||||
function useStatusText(v: unknown) {
|
||||
if (v === 1) return '使用中';
|
||||
if (v === 0) return '停用';
|
||||
return '-';
|
||||
}
|
||||
|
||||
function allowSyncText(v: unknown) {
|
||||
if (v === 1) return '允许';
|
||||
if (v === 0) return '不允许';
|
||||
return '-';
|
||||
}
|
||||
|
||||
const useStatusOptions = [
|
||||
{ label: '使用中', value: 1 },
|
||||
{ label: '停用', value: 0 },
|
||||
];
|
||||
|
||||
const allowSyncOptions = [
|
||||
{ label: '允许', value: 1 },
|
||||
{ label: '不允许', value: 0 },
|
||||
];
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
{ title: '机台代码', align: 'center', dataIndex: 'machineCode', width: 140 },
|
||||
{ title: '机台名称', align: 'center', dataIndex: 'equipmentId_dictText', width: 160 },
|
||||
{ title: '料仓分类', align: 'center', dataIndex: 'siloCategoryId_dictText', width: 140 },
|
||||
{ title: '工位', align: 'center', dataIndex: 'station', width: 120 },
|
||||
{ title: '料仓号', align: 'center', dataIndex: 'siloNo', width: 120 },
|
||||
{ title: '物料名称', align: 'center', dataIndex: 'materialId_dictText', width: 160 },
|
||||
{
|
||||
title: '使用状态',
|
||||
align: 'center',
|
||||
dataIndex: 'useStatus',
|
||||
width: 120,
|
||||
customRender: ({ text }) => useStatusText(text),
|
||||
},
|
||||
{
|
||||
title: '是否允许同步',
|
||||
align: 'center',
|
||||
dataIndex: 'allowSync',
|
||||
width: 120,
|
||||
customRender: ({ text }) => allowSyncText(text),
|
||||
},
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{
|
||||
label: '机台名称',
|
||||
field: 'equipmentId',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'mes_xsl_equipment_ledger,equipment_name,id' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '物料名称',
|
||||
field: 'materialId',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'mes_material,material_name,id' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '料仓分类',
|
||||
field: 'siloCategoryId',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
api: loadTreeData,
|
||||
params: { pcode: 'XSLMES_LCTYPE' },
|
||||
resultField: '',
|
||||
labelField: 'title',
|
||||
valueField: 'key',
|
||||
placeholder: '请选择料仓分类',
|
||||
},
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '使用状态',
|
||||
field: 'useStatus',
|
||||
component: 'Select',
|
||||
componentProps: { options: useStatusOptions },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
];
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
{ label: '', field: 'id', component: 'Input', show: false },
|
||||
{
|
||||
label: '机台名称',
|
||||
field: 'equipmentId',
|
||||
component: 'JDictSelectTag',
|
||||
required: true,
|
||||
componentProps: ({ formModel }) => ({
|
||||
dictCode: 'mes_xsl_equipment_ledger,equipment_name,id',
|
||||
placeholder: '请选择设备台账中的机台名称',
|
||||
onChange: async (value: string) => {
|
||||
if (!value) {
|
||||
formModel.machineCode = '';
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const equipment = await queryEquipmentById({ id: value });
|
||||
formModel.machineCode = equipment?.equipmentCode || '';
|
||||
} catch {
|
||||
formModel.machineCode = '';
|
||||
}
|
||||
},
|
||||
}),
|
||||
},
|
||||
{
|
||||
label: '机台代码',
|
||||
field: 'machineCode',
|
||||
component: 'Input',
|
||||
componentProps: { disabled: true, placeholder: '选择机台名称后自动带出设备编号' },
|
||||
},
|
||||
{
|
||||
label: '料仓分类',
|
||||
field: 'siloCategoryId',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
api: loadTreeData,
|
||||
params: { pcode: 'XSLMES_LCTYPE' },
|
||||
resultField: '',
|
||||
labelField: 'title',
|
||||
valueField: 'key',
|
||||
placeholder: '请选择料仓分类',
|
||||
},
|
||||
},
|
||||
{ label: '工位', field: 'station', component: 'Input' },
|
||||
{ label: '料仓号', field: 'siloNo', component: 'Input' },
|
||||
{
|
||||
label: '物料名称',
|
||||
field: 'materialId',
|
||||
component: 'JDictSelectTag',
|
||||
required: true,
|
||||
componentProps: { dictCode: 'mes_material,material_name,id', placeholder: '请选择胶料信息中的物料名称' },
|
||||
},
|
||||
{
|
||||
label: '使用状态',
|
||||
field: 'useStatus',
|
||||
component: 'Select',
|
||||
defaultValue: 1,
|
||||
componentProps: { options: useStatusOptions },
|
||||
},
|
||||
{
|
||||
label: '是否允许同步',
|
||||
field: 'allowSync',
|
||||
component: 'Select',
|
||||
defaultValue: 1,
|
||||
componentProps: { options: allowSyncOptions },
|
||||
},
|
||||
];
|
||||
Reference in New Issue
Block a user