import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' import { string } from 'vue-types' const trueFalse = [{ label: '是', value: true }, { label: '否', value: false }] // 表单校验 export const DynamicRuleRules = reactive({ describe: [required] }) export const DynamicRule = useCrudSchemas(reactive([ { label: '编码', field: 'number', sort: 'custom', isSearch: true, isForm: false, }, { label: '描述', field: 'describe', sort: 'custom', isSearch: true }, { label: '操作', field: 'action', isForm: false, isDetail: false, table: { width: 150, fixed: 'right' } } ])) // 表单校验 export const InspectionStageRules = reactive({ dynamicModifyCode: [required], okTimes: [required], okTimeStage: [required], noOkTimes: [required], noOkTimeStage: [required], isStartStage: [required], skipInspection: [required], inspectionStringency: [required], }) export const InspectionStage = useCrudSchemas(reactive([ { label: '描述', field: 'describe', sort: 'custom', isSearch: true }, { label: 'OK次数', field: 'okTimes', sort: 'custom', isSearch: true, form: { component: 'InputNumber', value: 0 } }, { label: 'OK次数后的阶段', field: 'okTimeStage', sort: 'custom', isSearch: true, form: { component: 'InputNumber', value: 0 } }, { label: 'NOK次数', field: 'noOkTimes', sort: 'custom', isSearch: true, form: { component: 'InputNumber', value: 0 } }, { label: 'NOK次数后的阶段', field: 'noOkTimeStage', sort: 'custom', isSearch: true, form: { component: 'InputNumber', value: 0 } }, { label: '是否是起始阶段', field: 'isStartStage', sort: 'custom', isSearch: true, formatter: (_: Recordable, __: TableColumn, cellValue: boolean) => { return trueFalse.find((account) => account.value == cellValue)?.label }, form: { component: 'Switch', value:true } }, { label: '是否略过检验', field: 'skipInspection', sort: 'custom', isSearch: true, formatter: (_: Recordable, __: TableColumn, cellValue: boolean) => { return trueFalse.find((account) => account.value == cellValue)?.label }, form: { component: 'Switch', value:true } }, { label: '检验严格性', field: 'inspectionStringency', sort: 'custom', isSearch: true, dictType: DICT_TYPE.INSPECTION_SEVERITY, dictClass: 'string', // 默认都是字符串类型其他暂不考虑 form: { component: 'Select' }, }, { label: '操作', field: 'action', isForm: false, table: { width: 300, fixed: 'right' }, isTableForm: false, } ]))