import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' import * as InspectionQ1Api from '@/api/qms/inspectionQ1' import { Q1 } from '@/views/qms/inspectionQ1/inspectionQ1.data' import * as QadCostcentreApi from '@/api/wms/qadCostcentre' import { QadCostcentre } from '@/views/wms/basicDataManage/subject/qadCostcentre/qadCostcentre.data' import * as ItembasicApi from '@/api/wms/itembasic' import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data' import { useUserStore } from '@/store/modules/user' const userStore = useUserStore() // 表单校验 export const Q3Rules = reactive({ number: [required], itemCode: [required], qty: [required], code: [required], defectLocation: [required], defectType: [required], problemReason: [required], priority: [required], amount: [required], costCode: [required], handleTime: [required], available: [required], concurrencyStamp: [required] }) export const Q3 = useCrudSchemas( reactive([ { label: '通知单号', field: 'number', sort: 'custom', isSearch: true, isForm: false, table: { width: 150, fixed: 'left' } }, { label: 'q1通知单号', field: 'q1Number', sort: 'custom', table: { width: 150 }, form: { // labelMessage: '信息提示说明!!!', componentProps: { enterSearch: true, isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择Q1通知单', // 输入框占位文本 searchField: 'number', // 查询弹窗赋值字段 searchTitle: 'Q1通知单', // 查询弹窗标题 searchAllSchemas: Q1.allSchemas, // 查询弹窗所需类 searchPage: InspectionQ1Api.getQ1Page, // 查询弹窗所需分页方法 searchCondition: [ { key: 'available', value: 'TRUE', isMainValue: false } ] } }, isSearch: true }, { label: '状态', field: 'status', sort: 'custom', dictType: DICT_TYPE.PUBLISHE_STATUS, dictClass: 'string', isForm: false, isSearch: false, tableForm: { type: 'Select', disabled: true }, form: { componentProps: { disabled: true } } }, { label: '物料代码', field: 'itemCode', sort: 'custom', table: { width: 150 }, tableForm: { isInpuFocusShow: true, searchListPlaceholder: '请选择物料代码', // 输入框占位文本 searchField: 'code', // 查询弹窗赋值字段 searchTitle: '物料基础信息', // 查询弹窗标题 searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类 searchPage: ItembasicApi.getItembasicPage, // 查询弹窗所需分页方法 searchCondition: [ { key: 'available', value: 'TRUE', isMainValue: false } ] }, form: { // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择物料代码', // 输入框占位文本 searchField: 'code', // 查询弹窗赋值字段 searchTitle: '物料基础信息', // 查询弹窗标题 searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类 searchPage: ItembasicApi.getItembasicPage, // 查询弹窗所需分页方法 searchCondition: [ { key: 'available', value: 'TRUE', isMainValue: false } ] } } }, { label: '数量', field: 'qty', sort: 'custom', isTable: false, isSearch: false, table: { width: 150 }, form: { component: 'InputNumber' } }, { label: '单位', field: 'uom', sort: 'custom', dictType: DICT_TYPE.UOM, dictClass: 'string', isSearch: false, isTable: true, tableForm: { type: 'Select', disabled: true }, form: { componentProps: { disabled: true } } }, { label: '编码', field: 'code', sort: 'custom', dictType: DICT_TYPE.QMS_CODE, dictClass: 'string', isSearch: false, isTable: true, tableForm: { type: 'Select' } }, { label: '缺陷位置', field: 'defectLocation', sort: 'custom', dictType: DICT_TYPE.DEFECT_LOCATION, dictClass: 'string', isSearch: false, isTable: true, tableForm: { type: 'Select' } }, { label: '缺陷类型', field: 'defectType', sort: 'custom', dictType: DICT_TYPE.DEFECT_TYPE, dictClass: 'string', isSearch: false, isTable: true, tableForm: { type: 'Select' } }, { label: '问题原因', field: 'problemReason', sort: 'custom', dictType: DICT_TYPE.PROBLEM_REASON, dictClass: 'string', isSearch: false, isTable: true, tableForm: { type: 'Select' } }, { label: '优先级', field: 'priority', sort: 'custom', dictType: DICT_TYPE.QUALITY_NOTIFICATION_PRIORITY, dictClass: 'string', isSearch: false, isTable: true, tableForm: { type: 'Select' } }, { label: '负责用户', field: 'responUser', sort: 'custom', isSearch: false, isForm: true, form: { componentProps: { value: userStore.getUser.nickname, disabled: true } } }, { label: '金额', field: 'amount', sort: 'custom', isTable: false, isSearch: false, table: { width: 150 }, form: { component: 'InputNumber' } }, { label: '成本中心代码', field: 'costCode', sort: 'custom', isSearch: false, isTable: false, isForm: true, form: { // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择成本中心', // 输入框占位文本 searchField: 'costcentreCode', // 查询弹窗赋值字段 searchTitle: '成本中心信息', // 查询弹窗标题 searchAllSchemas: QadCostcentre.allSchemas, // 查询弹窗所需类 searchPage: QadCostcentreApi.getQadCostcentrePage, // 查询弹窗所需分页方法 searchCondition: [ { key: 'available', value: 'TRUE', isMainValue: false } ] } } }, { label: '处理时间', field: 'handleTime', sort: 'custom', formatter: dateFormatter, isSearch: false, isTable: 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: 'desc', sort: 'custom', isSearch: false, table: { width: '150' }, form: { component: 'Input', componentProps: { type: 'textarea' } } }, { label: '是否可用', field: 'available', sort: 'custom', isSearch: false, isForm: false }, { label: '创建时间', field: 'createTime', sort: 'custom', formatter: dateFormatter, isSearch: 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: 'action', isForm: false, table: { width: 150, fixed: 'right' } } ]) )