新增MES厂家信息模块,包括数据库表、权限设置、服务层、控制器及前端组件,支持厂家类别、有效状态的字典管理及名称唯一性校验。
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||
import { checkManufacturerName } from './MesXslManufacturer.api';
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
{ title: '厂家类别', align: 'center', dataIndex: 'manufacturerCategory_dictText', width: 120 },
|
||||
{ title: '厂家名称', align: 'center', dataIndex: 'manufacturerName', width: 200 },
|
||||
{ title: '是否有效', align: 'center', dataIndex: 'validStatus_dictText', width: 100 },
|
||||
{ title: '创建人', align: 'center', dataIndex: 'createBy', width: 100 },
|
||||
{
|
||||
title: '创建时间',
|
||||
align: 'center',
|
||||
dataIndex: 'createTime',
|
||||
width: 165,
|
||||
customRender: ({ text }) => (!text ? '' : String(text).length > 19 ? String(text).substring(0, 19) : text),
|
||||
},
|
||||
{ title: '租户ID', align: 'center', dataIndex: 'tenantId', width: 90, defaultHidden: true },
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{
|
||||
label: '厂家类别',
|
||||
field: 'manufacturerCategory',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'xslmes_manufacturer_category' },
|
||||
colProps: { span: 8 },
|
||||
},
|
||||
{ label: '厂家名称', field: 'manufacturerName', component: 'Input', colProps: { span: 8 } },
|
||||
{
|
||||
label: '是否有效',
|
||||
field: 'validStatus',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'xslmes_manufacturer_valid' },
|
||||
colProps: { span: 8 },
|
||||
},
|
||||
];
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
{ label: '', field: 'id', component: 'Input', show: false },
|
||||
{
|
||||
label: '厂家类别',
|
||||
field: 'manufacturerCategory',
|
||||
required: true,
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'xslmes_manufacturer_category', placeholder: '请选择' },
|
||||
},
|
||||
{
|
||||
label: '厂家名称',
|
||||
field: 'manufacturerName',
|
||||
component: 'Input',
|
||||
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 checkManufacturerName({ manufacturerName: v, dataId: model?.id });
|
||||
return Promise.resolve();
|
||||
} catch (e: any) {
|
||||
const msg = e?.response?.data?.message || e?.message || '厂家名称不能重复';
|
||||
return Promise.reject(msg);
|
||||
}
|
||||
},
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: '是否有效',
|
||||
field: 'validStatus',
|
||||
required: true,
|
||||
defaultValue: '0',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'xslmes_manufacturer_valid', placeholder: '请选择' },
|
||||
},
|
||||
];
|
||||
Reference in New Issue
Block a user