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({ itemCode: [{ required: true, message: '请选择物料代码', trigger: 'change' }], customerCode: [{ required: true, message: '请选择客户代码', trigger: 'change' }], qty: [{ required: true, message: '请输入数量', trigger: 'change' }], claimAmount: [{ required: true, message: '请输入索赔金额', trigger: 'change' }], code: [{ required: true, message: '请选择缺陷代码', trigger: 'change' }], priority: [{ required: true, message: '请选择优先级', trigger: 'change' }], costCode: [{ required: true, message: '请选择选择成本中心代码', trigger: 'change' }], claimTime: [{ required: true, message: '请选择选择索赔日期', trigger: 'change' }], handleTime: [{ required: true, message: '请选择选择处理时间', trigger: 'change' }], claimReason: [{ required: true, message: '请选择选择索赔原因', trigger: 'change' }] }) export const Q1 = useCrudSchemas( reactive([ { label: '通知单号', field: 'number', sort: 'custom', isForm: false, isSearch: true, table: { width: 150, fixed: 'left' } }, { 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 } ], verificationParams: [ { key: 'itemCode', action: '==', value: '', isMainValue: false, isSearch: true, isFormModel: true } ] // 失去焦点校验参数 } } }, { label: '物料名称', field: 'itemName', sort: 'custom', dictClass: 'string', isSearch: false, isTable: true, tableForm: { disabled: true }, form: { componentProps: { disabled: true } } }, { label: '客户代码', field: 'customerCode', sort: 'custom', dictClass: 'string', isSearch: false, isTable: true, tableForm: { disabled: true }, form: { component: 'Select', componentProps: { options: [], optionsAlias: { labelField: 'customerCode', valueField: 'customerCode' }, filterable: true } } }, { label: '客户名称', field: 'customerName', sort: 'custom', dictClass: 'string', isSearch: false, isTable: true, tableForm: { disabled: true }, form: { componentProps: { disabled: true } } }, { label: '数量', field: 'qty', sort: 'custom', isTable: true, isSearch: false, table: { width: 150 }, form: { component: 'InputNumber', componentProps: { min: 0, 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: 'standardCostPrice', sort: 'custom', isSearch: false, table: { width: 150 }, form: { component: 'InputNumber', componentProps: { min: 0, precision: 6, disabled: true } } }, { label: '索赔金额', field: 'claimAmount', sort: 'custom', isTable: false, isSearch: false, table: { width: 150 }, form: { component: 'InputNumber', componentProps: { min: 0, precision: 2 } } }, { label: '缺陷编码', field: 'code', sort: 'custom', dictType: DICT_TYPE.QMS_Q1_CODE, dictClass: 'string', isSearch: false, isTable: true, table: { width: 180 }, tableForm: { type: 'Select' } }, { label: '优先级', field: 'priority', sort: 'custom', dictType: DICT_TYPE.QUALITY_NOTIFICATION_PRIORITY, dictClass: 'string', isSearch: false, isTable: false, tableForm: { type: 'Select' } }, { label: '成本中心代码', field: 'costCode', sort: 'custom', isSearch: false, isTable: false, form: { // labelMessage: '信息提示说明!!!', componentProps: { enterSearch: true, isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择成本中心代码', // 输入框占位文本 searchField: 'costcentreCode', // 查询弹窗赋值字段 searchTitle: '成本中心信息', // 查询弹窗标题 searchAllSchemas: QadCostcentre.allSchemas, // 查询弹窗所需类 searchPage: QadCostcentreApi.getQadCostcentrePage, // 查询弹窗所需分页方法 searchCondition: [ { key: 'available', value: 'TRUE', isMainValue: false } ], verificationParams: [ { key: 'costcentreCode', action: '==', value: '', isMainValue: false, isSearch: true, isFormModel: true } ] // 失去焦点校验参数 } } }, { label: '索赔原因', field: 'claimReason', sort: 'custom', dictType: DICT_TYPE.CLAIM_REASON, dictClass: 'string', isSearch: false, isTable: false, tableForm: { type: 'Select' } }, { label: '索赔日期', field: 'claimTime', isSearch: false, isTable: true, table: { width: 180 }, formatter: dateFormatter, 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' } } }, { label: '负责用户', field: 'responUser', sort: 'custom', isSearch: false, isForm: true, form: { componentProps: { value: userStore.getUser.nickname, disabled: true } } }, { label: '处理时间', field: 'handleTime', isSearch: false, isTable: false, table: { width: 180 }, formatter: dateFormatter, 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' } } }, { 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: '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: false, isForm: false, isTable: false, isDetail: false, dictClass: 'string', // 默认都是字符串类型其他暂不考虑 search: { value: 'TRUE' }, form: { component: 'Switch', value: 'TRUE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } }, table: { width: 110 } }, { label: '创建时间', field: 'createTime', isForm: false, table: { width: 180 }, formatter: dateFormatter, 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' } }, 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')] } } }, { label: '创建者', field: 'creator', table: { width: 130 }, isForm: false, isTable: true }, { label: '操作', field: 'action', isForm: false, isDetail: false, table: { width: 150, fixed: 'right' } } ]) )