import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' import {getSamplingScheme} from '@/api/qms/sampleCode/index' // 表单校验 export const SampleCodeRules = reactive({ code: [required], batchUpperLimiting: [required], available: [required], }) const samplingSchemeList = await getSamplingScheme() export const SampleCode = useCrudSchemas(reactive([ { label: 'id', field: 'id', sort: 'custom', isTable: false, isForm: false, }, { label: '采样方案编码', field: 'code', sort: 'custom', isSearch: true, form: { component: 'Select', componentProps: { options: samplingSchemeList, optionsAlias: { labelField: 'description', valueField: 'code' }, } } }, { label: '批量下限', field: 'batchLowLimiting', sort: 'custom', isSearch: true, form: { component: 'InputNumber', value: 0 }, }, { label: '批量上限', field: 'batchUpperLimiting', sort: 'custom', isSearch: true, form: { component: 'InputNumber', value: 0 }, }, { label: 's1', field: 's1', sort: 'custom', }, { label: 's2', field: 's2', sort: 'custom', }, { label: 's3', field: 's3', sort: 'custom', }, { label: 's4', field: 's4', sort: 'custom', }, { label: 'g1', field: 'g1', sort: 'custom', }, { label: 'g2', field: 'g2', sort: 'custom', }, { label: 'g3', field: 'g3', sort: 'custom', }, { label: '是否可用', field: 'available', sort: 'custom', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', // 默认都是字符串类型其他暂不考虑 form: { component: 'Select' }, }, { label: '创建时间', field: 'createTime', sort: 'custom', formatter: dateFormatter, isForm: false, }, { label: '操作', field: 'action', isForm: false, table: { width: 150, fixed: 'right' } } ]))