import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' import * as CustomerApi from '@/api/wms/customer' import { Customer } from '@/views/wms/basicDataManage/customerManage/customer/customer.data' import * as CustomeritemApi from '@/api/wms/customeritem' import { Customeritem } from '@/views/wms/basicDataManage/customerManage/customeritem/customeritem.data' import * as QadCostcentreApi from '@/api/wms/qadCostcentre' import { QadCostcentre } from '@/views/wms/basicDataManage/subject/qadCostcentre/qadCostcentre.data' import { useUserStore } from '@/store/modules/user' const userStore = useUserStore() // 表单校验 export const Q1Rules = reactive({ customerCode: [required], costCode: [required], itemCode: [required], qty: [required], code: [required], priority: [required], claimAmount: [required], claimReason: [required], claimTime: [required], handleTime: [required] }) export const Q1 = useCrudSchemas( reactive([ { label: '通知单号', field: 'number', sort: 'custom', isForm: false, isSearch: true, table: { width: 150, fixed: 'left' } }, { 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: 'customerCode', sort: 'custom', table: { width: 150, fixed: 'left' }, form: { // labelMessage: '信息提示说明!!!', componentProps: { enterSearch: true, isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择客户代码', // 输入框占位文本 searchField: 'code', // 查询弹窗赋值字段 searchTitle: '客户信息', // 查询弹窗标题 searchAllSchemas: Customer.allSchemas, // 查询弹窗所需类 searchPage: CustomerApi.getCustomerPage, // 查询弹窗所需分页方法 searchCondition: [ { key: 'available', value: 'TRUE', isMainValue: false } ] } }, isSearch: true }, { label: '物料代码', field: 'itemCode', sort: 'custom', table: { width: 150 }, isSearch: true, form: { // labelMessage: '信息提示说明!!!', componentProps: { enterSearch: true, isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择物料代码', // 输入框占位文本 searchField: 'itemCode', // 查询弹窗赋值字段 searchTitle: '客户物料信息', // 查询弹窗标题 searchAllSchemas: Customeritem.allSchemas, // 查询弹窗所需类 searchPage: CustomeritemApi.getCustomeritemPage, // 查询弹窗所需分页方法 searchCondition: [ { key: 'available', value: 'TRUE', isMainValue: false }, { key: 'customerCode', value: 'customerCode', message: '请填写客户代码!', isMainValue: true } ], verificationParams: [ { key: 'itemCode', action: '==', value: '', isMainValue: false, isSearch: true, isFormModel: true } ] // 失去焦点校验参数 } } }, { label: '数量', field: 'qty', sort: 'custom', isTable: false, isSearch: false, table: { width: 150 }, form: { component: 'InputNumber', componentProps: { min: 0.01, precision: 2 } } }, { 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: '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: 'claimAmount', sort: 'custom', isTable: false, isSearch: false, table: { width: 150 }, form: { component: 'InputNumber', componentProps: { min: 0.01, precision: 2 } } }, { label: '成本中心', field: 'costCode', sort: 'custom', isSearch: false, isTable: false, form: { // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择成本中心代码', // 输入框占位文本 searchField: 'costcentreCode', // 查询弹窗赋值字段 searchTitle: '成本中心信息', // 查询弹窗标题 searchAllSchemas: QadCostcentre.allSchemas, // 查询弹窗所需类 searchPage: QadCostcentreApi.getQadCostcentrePage, // 查询弹窗所需分页方法 searchCondition: [ { key: 'available', value: 'TRUE', isMainValue: false } ] } } }, { label: '索赔原因', field: 'claimReason', sort: 'custom', dictType: DICT_TYPE.CLAIM_REASON, dictClass: 'string', isSearch: false, isTable: true, tableForm: { type: 'Select' } }, { label: '索赔日期', field: 'claimTime', 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')] } }, form: { component: 'DatePicker', componentProps: { type: 'datetime', valueFormat: 'x' } } }, { 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', 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', 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' } } ]) )