import { BasicColumn, FormSchema } from '/@/components/Table'; import { JVxeColumn, JVxeTypes } from '/@/components/jeecg/JVxeTable/types'; import { checkStdName } from './MesXslRubberQuickTestStd.api'; const numProps = { style: { width: '100%' }, precision: 6 }; export const columns: BasicColumn[] = [ { title: '实验标准名称', align: 'center', dataIndex: 'stdName', width: 180 }, { title: '实验方法', align: 'center', dataIndex: 'testMethodName', width: 160 }, { title: '密炼机类型', align: 'center', dataIndex: 'mixerType_dictText', width: 110 }, { title: '胶料名称', align: 'center', dataIndex: 'rubberMaterialName', width: 140 }, { title: '发行编号', align: 'center', dataIndex: 'issueNumber', width: 120 }, { title: '发行日期', align: 'center', dataIndex: 'issueDate', width: 110 }, { title: '发行部门', align: 'center', dataIndex: 'issueDeptName', width: 140 }, { title: '启用状态', align: 'center', dataIndex: 'enableStatus_dictText', width: 90 }, { title: '审核状态', align: 'center', dataIndex: 'auditStatus_dictText', width: 90 }, { 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), }, ]; export const searchFormSchema: FormSchema[] = [ { label: '实验标准名称', field: 'stdName', component: 'Input', colProps: { span: 6 } }, { label: '实验方法', field: 'testMethodId', component: 'JSearchSelect', componentProps: { dict: 'mes_xsl_rubber_quick_test_method,method_name,id', async: true, placeholder: '请选择实验方法', }, colProps: { span: 6 }, }, { label: '密炼机类型', field: 'mixerType', component: 'JDictSelectTag', componentProps: { dictCode: 'xslmes_rubber_quick_test_mixer_type', placeholder: '请选择密炼机类型' }, colProps: { span: 6 }, }, { label: '胶料名称', field: 'rubberMaterialId', component: 'JDictSelectTag', componentProps: { dictCode: 'mes_material,material_name,id', placeholder: '请选择胶料信息' }, colProps: { span: 6 }, }, { label: '启用状态', field: 'enableStatus', component: 'JDictSelectTag', componentProps: { dictCode: 'xslmes_rubber_quick_test_std_enable_status' }, colProps: { span: 6 }, }, ]; export const formSchema: FormSchema[] = [ { label: '', field: 'id', component: 'Input', show: false }, { label: '', field: 'testMethodId', component: 'Input', show: false }, { label: '', field: 'rubberMaterialId', component: 'Input', show: false }, { label: '', field: 'psCompileId', component: 'Input', show: false }, { label: '', field: 'issueDeptId', component: 'Input', show: false }, { label: '', field: 'enableStatus', component: 'Input', show: false }, { label: '', field: 'auditStatus', component: 'Input', show: false }, { label: '实验标准名称', field: 'stdName', component: 'Input', required: true, 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 checkStdName({ stdName: v, dataId: model?.id }); return Promise.resolve(); } catch (e: any) { const msg = e?.response?.data?.message || e?.message || '实验标准名称已存在'; return Promise.reject(msg); } }, trigger: ['blur', 'change'], }, ], }, { label: '实验方法', field: 'testMethodName', component: 'Input', slot: 'testMethodPicker', required: true, dynamicRules: () => [{ required: true, message: '请选择实验方法' }], }, { label: '密炼机类型', field: 'mixerType', component: 'JDictSelectTag', required: true, componentProps: { dictCode: 'xslmes_rubber_quick_test_mixer_type', placeholder: '请选择密炼机类型' }, }, { label: '胶料名称', field: 'rubberMaterialName', component: 'Input', slot: 'rubberMaterialPicker', required: true, dynamicRules: () => [{ required: true, message: '请选择胶料信息' }], }, { label: '发行编号', field: 'issueNumber', component: 'Input', slot: 'issueNumberPicker', }, { label: '发行日期', field: 'issueDate', component: 'DatePicker', componentProps: { valueFormat: 'YYYY-MM-DD', style: { width: '100%' } }, }, { label: '发行部门', field: 'issueDeptName', component: 'Input', slot: 'issueDeptPicker', }, ]; export const lineJVxeColumns: JVxeColumn[] = [ { title: '', key: 'dataPointId', type: JVxeTypes.hidden }, { title: '数据点', key: 'pointName', type: JVxeTypes.normal, width: 180, disabled: true }, { title: '下限值', key: 'lowerLimit', type: JVxeTypes.inputNumber, width: 110, componentProps: numProps, }, { title: '下警告值', key: 'lowerWarn', type: JVxeTypes.inputNumber, width: 110, componentProps: numProps, }, { title: '目标值', key: 'targetValue', type: JVxeTypes.inputNumber, width: 110, componentProps: numProps, }, { title: '上警告值', key: 'upperWarn', type: JVxeTypes.inputNumber, width: 110, componentProps: numProps, }, { title: '上限值', key: 'upperLimit', type: JVxeTypes.inputNumber, width: 110, componentProps: numProps, }, ];