You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
181 lines
4.1 KiB
181 lines
4.1 KiB
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
|
|
import { dateFormatter } from '@/utils/formatTime'
|
|
import { getSamplingScheme } from '@/api/qms/samplingProcess'
|
|
import { validateInteger, validateTwoNum } from '@/utils/validator'
|
|
|
|
// 表单校验
|
|
export const SamplingProcessRules = reactive({
|
|
sampleType: [required],
|
|
evaluationMode: [required],
|
|
description: [required],
|
|
sampleQty: [
|
|
{ required: true, message: '该项为必填项', trigger: 'blur' },
|
|
{ validator: validateTwoNum, message: '小数点后最多2位', trigger: 'blur' }
|
|
],
|
|
sampleProgCode: [{ required: true, message: '该项为必填项', trigger: 'blur' }],
|
|
inspectionQty: [
|
|
required,
|
|
{ validator: validateInteger, message: '请输入正确的整数', trigger: 'blur' }
|
|
]
|
|
})
|
|
const samplingSchemeList = await getSamplingScheme()
|
|
export const SamplingProcess = useCrudSchemas(
|
|
reactive<CrudSchema[]>([
|
|
{
|
|
label: '编码',
|
|
field: 'code',
|
|
sort: 'custom',
|
|
isSearch: true,
|
|
isForm: false,
|
|
table: {
|
|
width: 175,
|
|
fixed: 'left'
|
|
}
|
|
},
|
|
{
|
|
label: '描述',
|
|
field: 'description',
|
|
sort: 'custom',
|
|
isSearch: true
|
|
},
|
|
{
|
|
label: '取样类型',
|
|
field: 'sampleType',
|
|
sort: 'custom',
|
|
dictType: DICT_TYPE.SAMPLING_TYPE,
|
|
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
|
isSearch: true,
|
|
form: {
|
|
component: 'Select'
|
|
}
|
|
},
|
|
{
|
|
label: '评估模式',
|
|
field: 'evaluationMode',
|
|
sort: 'custom',
|
|
dictType: DICT_TYPE.EVALUATION_MODE,
|
|
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
|
form: {
|
|
component: 'Select'
|
|
}
|
|
},
|
|
{
|
|
label: '样品份数',
|
|
field: 'sampleQty',
|
|
sort: 'custom'
|
|
},
|
|
{
|
|
label: '采样方案编码',
|
|
field: 'sampleProgCode',
|
|
sort: 'custom',
|
|
form: {
|
|
component: 'Select',
|
|
componentProps: {
|
|
options: samplingSchemeList,
|
|
optionsAlias: {
|
|
labelField: 'description',
|
|
valueField: 'code'
|
|
}
|
|
}
|
|
}
|
|
},
|
|
|
|
{
|
|
label: '是否可用',
|
|
field: 'available',
|
|
sort: 'custom',
|
|
dictType: DICT_TYPE.TRUE_FALSE,
|
|
isSearch: true,
|
|
isForm: false,
|
|
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
|
search: {
|
|
value: 'TRUE'
|
|
},
|
|
form: {
|
|
component: 'Switch',
|
|
value: 'TRUE',
|
|
componentProps: {
|
|
inactiveValue: 'FALSE',
|
|
activeValue: 'TRUE'
|
|
}
|
|
},
|
|
table: {
|
|
width: 110
|
|
}
|
|
},
|
|
{
|
|
label: '创建时间',
|
|
field: 'createTime',
|
|
isForm: false,
|
|
table: {
|
|
width: 180
|
|
},
|
|
formatter: dateFormatter,
|
|
detail: {
|
|
dateFormat: 'YYYY-MM-DD HH:mm:ss'
|
|
},
|
|
form: {
|
|
component: 'DatePicker',
|
|
componentProps: {
|
|
style: { width: '100%' },
|
|
type: 'datetime',
|
|
dateFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
valueFormat: 'x'
|
|
}
|
|
}
|
|
},
|
|
{
|
|
label: '创建者',
|
|
field: 'creator',
|
|
table: {
|
|
width: 130
|
|
},
|
|
isForm: false,
|
|
isTable: true
|
|
},
|
|
{
|
|
label: '最后更新时间',
|
|
field: 'updateTime',
|
|
sort: 'custom',
|
|
isDetail: true,
|
|
isForm: false,
|
|
isTable: false,
|
|
formatter: dateFormatter,
|
|
detail: {
|
|
dateFormat: 'YYYY-MM-DD HH:mm:ss'
|
|
},
|
|
table: {
|
|
width: 180
|
|
},
|
|
form: {
|
|
component: 'DatePicker',
|
|
componentProps: {
|
|
style: { width: '100%' },
|
|
type: 'datetime',
|
|
dateFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
valueFormat: 'x'
|
|
}
|
|
}
|
|
},
|
|
{
|
|
label: '最后更新者',
|
|
field: 'updater',
|
|
isDetail: true,
|
|
isForm: false,
|
|
isTable: false,
|
|
table: {
|
|
width: 150
|
|
}
|
|
},
|
|
{
|
|
label: '操作',
|
|
field: 'action',
|
|
isForm: false,
|
|
isDetail: false,
|
|
table: {
|
|
width: 150,
|
|
fixed: 'right'
|
|
}
|
|
}
|
|
])
|
|
)
|
|
|