import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' import {PatternType} from "@/views/mes/patternType/patternType.data"; import * as PatternTypeApi from "@/api/mes/patternType"; import {validateInteger} from '@/utils/validator' // 表单校验 export const PatternRules = reactive({ code: [required], name: [required], partternName: [required], }) export const Pattern = useCrudSchemas(reactive([ { label: '删除时间', field: 'deleteTime', sort: 'custom', formatter: dateFormatter, isSearch: false, isTable: false, isForm: false, isDetail:false, search: { component: 'DatePicker', componentProps: { valueFormat: 'YYYY-MM-DD HH:mm:ss', type: 'daterange', defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] } }, form: { component: 'DatePicker', componentProps: { type: 'datetime', valueFormat: 'x' } }, }, { label: '主键', field: 'id', sort: 'custom', isSearch: false, isTable: false, isForm: false, isDetail:false, }, { label: '并发乐观锁', field: 'concurrencyStamp', sort: 'custom', isSearch: false, isTable: false, isForm: false, isDetail:false, form: { component: 'InputNumber', value: 0 }, }, { label: '创建时间', field: 'createTime', sort: 'custom', formatter: dateFormatter, isSearch: false, isTable: false, isForm: false, isDetail:false, search: { component: 'DatePicker', componentProps: { valueFormat: 'YYYY-MM-DD HH:mm:ss', type: 'daterange', defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] } }, isForm: false, }, { label: '删除用户名', field: 'deleter', sort: 'custom', isSearch: false, isTable: false, isForm: false, isDetail:false, }, { label: '位置ID', field: 'siteId', sort: 'custom', isSearch: false, isTable: false, isForm: false, isDetail:false, form: { component: 'InputNumber', value: 0 }, }, { label: '模具编码', field: 'code', sort: 'custom', isSearch: true, }, { label: '模具名称', field: 'name', sort: 'custom', isSearch: true, }, { label: '模具类型', field: 'partternName', sort: 'custom', isSearch: true, form: { componentProps: { isSearchList: true, // 开启查询弹窗 searchTitle: '模具类型', // 查询弹窗标题 searchAllSchemas: PatternType.allSchemas, // 查询弹窗所需类 searchField: 'name', // 查询弹窗赋值字段 searchPage: PatternTypeApi.getPatternTypePage, // 查询弹窗所需分页方法 multiple:true, searchCondition: [{ key: 'status', value: '1', action: '==', isSearch: true, isMainValue: false }] } } }, { label: '产品编码', field: 'productCode', sort: 'custom', isSearch: true, }, { label: '启用时间', field: 'dateUseStart', sort: 'custom', isSearch: true, search: { component: 'DatePicker', componentProps: { valueFormat: 'YYYY-MM-DD HH:mm:ss', type: 'daterange', defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] } }, formatter: dateFormatter, isForm: true, form: { component: 'DatePicker', componentProps: { valueFormat: 'YYYY-MM-DD HH:mm:ss', type: 'datetime', valueFormat: 'x' } }, }, { label: '停用时间', field: 'dateUseStop', sort: 'custom', isSearch: true, search: { component: 'DatePicker', componentProps: { valueFormat: 'YYYY-MM-DD HH:mm:ss', type: 'daterange', defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] } }, formatter: dateFormatter, isForm: true, form: { component: 'DatePicker', componentProps: { type: 'datetime', valueFormat: 'x' } }, }, { label: '模具来源', field: 'partternFrom', sort: 'custom', isSearch: true, }, { label: '模具去向', field: 'partternGo', sort: 'custom', isSearch: true, }, { label: '模具初始数量', field: 'initCout', sort: 'custom', isSearch: true, form: { component: 'InputNumber', componentProps: { min: 1 } }, }, { label: '有效期开始时间', field: 'effectStart', sort: 'custom', isSearch: true, search: { component: 'DatePicker', componentProps: { valueFormat: 'YYYY-MM-DD HH:mm:ss', type: 'daterange', defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] } }, formatter: dateFormatter, form: { component: 'DatePicker', componentProps: { type: 'datetime', valueFormat: 'x' } }, }, { label: '有效期结束时间', field: 'effectEnd', sort: 'custom', isSearch: true, search: { component: 'DatePicker', componentProps: { valueFormat: 'YYYY-MM-DD HH:mm:ss', type: 'daterange', defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] } }, formatter: dateFormatter, form: { component: 'DatePicker', componentProps: { type: 'datetime', valueFormat: 'x' } }, }, { label: '所属单位编码', field: 'factoryCode', sort: 'custom', isSearch: true, }, { label: '所属单位名称', field: 'factoryName', sort: 'custom', isSearch: true, }, { label: '所属单位类别', field: 'factoryType', sort: 'custom', isSearch: true, }, { label: '状态', field: 'status', sort: 'custom', dictType: DICT_TYPE.QUALIFY_STATUS, dictClass: 'string', isForm: true, isSearch: true, isTable: true, form: { component: 'Switch', value: '2', componentProps: { inactiveValue: '2', activeValue: '1' } }, }, { label: '操作', field: 'action', isForm: false, isDetail:false, table: { width: 150, fixed: 'right' } }, { label: '备注', field: 'remark', sort: 'custom', isSearch: false, isTable: false } ]))