Files
qhmes/jeecgboot-vue3/src/views/mes/material/MesMaterial.data.ts

144 lines
4.1 KiB
Vue
Raw Normal View History

2026-04-08 16:53:25 +08:00
import { BasicColumn, FormSchema } from '/@/components/Table';
2026-05-20 15:30:42 +08:00
import { loadTreeData } from '/@/api/common/api';
function useStatusText(v: unknown) {
if (v === 1) return '使用中';
if (v === 0) return '停用';
return '-';
}
function specialRubberText(v: unknown) {
if (v === 1) return '是';
if (v === 0) return '否';
return '-';
}
const useStatusOptions = [
{ label: '使用中', value: 1 },
{ label: '停用', value: 0 },
];
const specialRubberOptions = [
{ label: '是', value: 1 },
{ label: '否', value: 0 },
];
const glueCategoryProps = {
api: loadTreeData,
params: { pcode: 'XSLMES_MATERIAL' },
resultField: '',
labelField: 'title',
valueField: 'key',
placeholder: '请选择胶料类别',
};
2026-04-08 16:53:25 +08:00
export const columns: BasicColumn[] = [
2026-05-20 15:30:42 +08:00
{ title: '胶料名称', align: 'center', width: 160, dataIndex: 'materialName' },
{ title: '胶料类别', align: 'center', width: 140, dataIndex: 'categoryId_dictText' },
{ title: '胶料别名', align: 'center', width: 140, dataIndex: 'aliasName' },
{ title: '胶料客户', align: 'center', width: 140, dataIndex: 'customerId_dictText' },
{ title: 'ERP编号', align: 'center', width: 140, dataIndex: 'erpCode' },
{ title: '终炼胶保质期(天)', align: 'center', width: 150, dataIndex: 'finalShelfLifeDays' },
{ title: '母炼胶保质期(天)', align: 'center', width: 150, dataIndex: 'masterShelfLifeDays' },
{ title: '最小停放时间(时)', align: 'center', width: 150, dataIndex: 'minStandingHours' },
{
title: '使用状态',
align: 'center',
width: 110,
dataIndex: 'enableFlag',
customRender: ({ text }) => useStatusText(text),
},
{
title: '是否为特种胶',
align: 'center',
width: 120,
dataIndex: 'isSpecialRubber',
customRender: ({ text }) => specialRubberText(text),
},
2026-04-08 16:53:25 +08:00
];
export const searchFormSchema: FormSchema[] = [
2026-05-20 15:30:42 +08:00
{ label: '胶料名称', field: 'materialName', component: 'Input', colProps: { span: 6 } },
2026-04-08 16:53:25 +08:00
{
2026-05-20 15:30:42 +08:00
label: '胶料类别',
2026-04-08 16:53:25 +08:00
field: 'categoryId',
2026-05-20 15:30:42 +08:00
component: 'ApiSelect',
componentProps: glueCategoryProps,
colProps: { span: 6 },
},
{
label: '胶料客户',
field: 'customerId',
2026-04-08 16:53:25 +08:00
component: 'JDictSelectTag',
2026-05-20 15:30:42 +08:00
componentProps: { dictCode: 'mes_xsl_customer,customer_name,id' },
colProps: { span: 6 },
},
{ label: 'ERP编号', field: 'erpCode', component: 'Input', colProps: { span: 6 } },
{
label: '使用状态',
field: 'enableFlag',
component: 'Select',
componentProps: { options: useStatusOptions },
colProps: { span: 6 },
},
{
label: '是否为特种胶',
field: 'isSpecialRubber',
component: 'Select',
componentProps: { options: specialRubberOptions },
2026-04-08 16:53:25 +08:00
colProps: { span: 6 },
},
];
export const formSchema: FormSchema[] = [
{ label: '', field: 'id', component: 'Input', show: false },
2026-05-20 15:30:42 +08:00
{ label: '胶料名称', field: 'materialName', component: 'Input', required: true },
2026-04-08 16:53:25 +08:00
{
2026-05-20 15:30:42 +08:00
label: '胶料类别',
2026-04-08 16:53:25 +08:00
field: 'categoryId',
2026-05-20 15:30:42 +08:00
component: 'ApiSelect',
2026-04-08 16:53:25 +08:00
required: true,
2026-05-20 15:30:42 +08:00
componentProps: glueCategoryProps,
2026-04-08 16:53:25 +08:00
},
2026-05-20 15:30:42 +08:00
{ label: '胶料别名', field: 'aliasName', component: 'Input' },
2026-04-08 16:53:25 +08:00
{
2026-05-20 15:30:42 +08:00
label: '胶料客户',
field: 'customerId',
2026-04-08 16:53:25 +08:00
component: 'JDictSelectTag',
2026-05-20 15:30:42 +08:00
componentProps: { dictCode: 'mes_xsl_customer,customer_name,id', placeholder: '请选择胶料客户' },
2026-04-08 16:53:25 +08:00
},
2026-05-20 15:30:42 +08:00
{ label: 'ERP编号', field: 'erpCode', component: 'Input' },
2026-04-08 16:53:25 +08:00
{
2026-05-20 15:30:42 +08:00
label: '终炼胶保质期(天)',
field: 'finalShelfLifeDays',
component: 'InputNumber',
componentProps: { min: 0, precision: 0 },
},
{
label: '母炼胶保质期(天)',
field: 'masterShelfLifeDays',
component: 'InputNumber',
componentProps: { min: 0, precision: 0 },
},
{
label: '最小停放时间(时)',
field: 'minStandingHours',
component: 'InputNumber',
componentProps: { min: 0, precision: 0 },
2026-04-08 16:53:25 +08:00
},
{
2026-05-20 15:30:42 +08:00
label: '使用状态',
2026-04-08 16:53:25 +08:00
field: 'enableFlag',
component: 'Select',
defaultValue: 1,
2026-05-20 15:30:42 +08:00
componentProps: { options: useStatusOptions },
},
{
label: '是否为特种胶',
field: 'isSpecialRubber',
component: 'Select',
defaultValue: 0,
componentProps: { options: specialRubberOptions },
2026-04-08 16:53:25 +08:00
},
];