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.

146 lines
2.9 KiB

1 year ago
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
1 year ago
import {getSamplingScheme} from '@/api/qms/sampleCode/index'
1 year ago
import {validateNum} from "@/utils/validator";
1 year ago
// 表单校验
export const SampleCodeRules = reactive({
code: [required],
1 year ago
batchLowLimiting: [{ validator:validateNum, message: '请输入整数', trigger: 'blur'}],
12 months ago
batchUpperLimiting: [{ required:true, message: '该项为必填', trigger: 'blur'}, { validator:validateNum, message: '请输入整数', trigger: 'blur'}],
s1: [{ required }],
s2: [{ required }],
s3: [{ required }],
s4: [{ required }],
g1: [{ required }],
g2: [{ required }],
g3: [{ required }]
1 year ago
})
1 year ago
const samplingSchemeList = await getSamplingScheme()
1 year ago
export const SampleCode = useCrudSchemas(reactive<CrudSchema[]>([
{
11 months ago
label: '采样方案编码',
1 year ago
field: 'code',
sort: 'custom',
isSearch: true,
1 year ago
form: {
component: 'Select',
componentProps: {
options: samplingSchemeList,
optionsAlias: {
11 months ago
labelField: 'code',
1 year ago
valueField: 'code'
},
}
},
table: {
width: 175,
fixed: 'left'
1 year ago
}
1 year ago
},
{
label: '批量下限',
1 year ago
field: 'batchLowLimiting',
1 year ago
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: 'createTime',
sort: 'custom',
formatter: dateFormatter,
isForm: false,
1 year ago
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',
}
},
1 year ago
table: {
width: 175
}
1 year ago
},
{
label: '是否可用',
field: 'available',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
table: {
width: 110
}
},
1 year ago
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))