import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter,dateFormatter2 } from '@/utils/formatTime' import * as CustomerApi from '@/api/wms/customer' import { Customer } from '@/views/wms/basicDataManage/customerManage/customer/customer.data' import * as PackageunitApi from '@/api/wms/packageunit' import { Packageunit } from '@/views/wms/basicDataManage/itemManage/packageunit/packageunit.data' import * as ItembasicApi from '@/api/wms/itembasic' import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data' const { t } = useI18n() // 国际化 /** * @returns {Array} 销售订单主表 */ export const SaleMain = useCrudSchemas(reactive([ { label: '单据号', field: 'number', sort: 'custom', table: { width: 180, fixed: 'left' }, isForm: false, isSearch: true, }, { label: '客户代码', field: 'customerCode', sort: 'custom', table: { width: 150 }, isSearch: true, form: { // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择客户代码', // 输入框占位文本 searchField: 'code', // 查询弹窗赋值字段 searchTitle: '客户信息', // 查询弹窗标题 searchAllSchemas: Customer.allSchemas, // 查询弹窗所需类 searchPage: CustomerApi.getCustomerPage, // 查询弹窗所需分页方法 searchCondition: [{ key: 'available', value: 'TRUE', isMainValue: false }] } } }, { label: '订单类型', field: 'type', dictType: DICT_TYPE.SALE_ORDER_TYPE, dictClass: 'string', isSearch: true, isTable: true, sort: 'custom', table: { width: 150 }, }, { label: '订单日期', field: 'orderDate', formatter: dateFormatter2, detail: { dateFormat: 'YYYY-MM-DD' }, sort: 'custom', table: { width: 180 }, form: { component: 'DatePicker', componentProps: { style: {width: '100%'}, type: 'date', dateFormat: 'YYYY-MM-DD', valueFormat: 'x', } }, }, { label: '截止日期', field: 'dueDate', formatter: dateFormatter2, detail: { dateFormat: 'YYYY-MM-DD' }, sort: 'custom', table: { width: 180 }, form: { component: 'DatePicker', componentProps: { style: {width: '100%'}, type: 'date', dateFormat: 'YYYY-MM-DD', valueFormat: 'x', } }, }, { label: '版本', field: 'version', sort: 'custom', table: { width: 150 }, }, { label: '税率', field: 'taxRate', sort: 'custom', table: { width: 150 }, form: { component: 'InputNumber', componentProps: { min: 0 } } }, { label: '联系人姓名', field: 'contactName', sort: 'custom', table: { width: 150 }, }, { label: '联系人电话', field: 'contactPhone', sort: 'custom', table: { width: 150 }, }, { label: '联系人电子邮件', field: 'contactEmail', sort: 'custom', table: { width: 150 }, }, { label: '业务类型', field: 'businessType', sort: 'custom', table: { width: 150 }, form: { value: 'Deliver', componentProps: { disabled: true } }, isForm: false }, { label: '备注', field: 'remark', sort: 'custom', table: { width: 150 }, isTable: false, }, { label: '创建时间', field: 'createTime', formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, sort: 'custom', table: { width: 180 }, form: { component: 'DatePicker', componentProps: { type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x', } }, isForm: false, 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', sort: 'custom', table: { width: 150 }, isForm: false, }, { label: '最后更新时间', field: 'updateTime', formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, sort: 'custom', table: { width: 180 }, form: { component: 'DatePicker', componentProps: { type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x', } }, isTable: false, isForm: false, isTableForm:false }, { label: '最后更新者', field: 'updater', sort: 'custom', table: { width: 150 }, isTable:false, isForm: false, isTableForm: false }, { label: '当前阶段', field: 'currentStage', sort: 'custom', table: { width: 150 }, }, { label: '是否可用', field: 'available', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isSearch: false, isTable: true, sort: 'custom', table: { width: 150 }, form: { component: 'Switch', value: 'TRUE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } } }, // { // label: '操作', // field: 'action', // isDetail: false, // isForm: false, // table: { // width: 150, // fixed: 'right' // } // } ])) //表单校验 export const SaleMainRules = reactive({ customerCode: [ { required: true, message: '请选择客户代码', trigger: 'change' } ], type: [ { required: true, message: '请选择订单类型', trigger: 'change' } ], orderDate: [ { required: true, message: '请输入订单日期', trigger: 'change' } ], taxRate: [ { required: true, message: '请输入税率', trigger: 'blur' } ], version: [ { max: 50, message: '不得超过50个字符', trigger: 'blur' } ], contactName: [ { max: 50, message: '不得超过50个字符', trigger: 'blur' } ], contactPhone: [ { max: 50, message: '不得超过50个字符', trigger: 'blur' }, // { validator:validateHanset, message: '请输入正确的手机号', trigger: 'blur'} ], contactEmail: [ { max: 50, message: '不得超过50个字符', trigger: 'blur' }, // { validator:validateEmail, message: '请输入正确的手机号', trigger: 'blur'} ], remark: [ { max: 50, message: '不得超过50个字符', trigger: 'blur' } ], currentStage: [ { max: 50, message: '不得超过50个字符', trigger: 'blur' } ], available: [ { required: true, message: '请选择是否可用', trigger: 'change' } ], }) /** * @returns {Array} 销售订单子表 */ export const SaleDetail = useCrudSchemas(reactive([ { label: '行号', field: 'lineNumber', sort: 'custom', table: { width: 150 }, }, { label: '项目代码', field: 'projectCode', sort: 'custom', table: { width: 150 }, isForm: false, isTableForm: false, }, { label: '包装数量', field: 'packQty', sort: 'custom', table: { width: 150 }, form: { component: 'InputNumber', componentProps: { min: 1, precision: 6 } }, tableForm: { type: 'InputNumber', min: 1, precision: 6 } }, { label: '包装规格', field: 'packUnit', sort: 'custom', table: { width: 150 }, tableForm:{ isInpuFocusShow: true, // 开启查询弹窗 searchListPlaceholder: '请选择包装规格代码', searchField: 'code', searchTitle: '包装规格信息', searchAllSchemas: Packageunit.allSchemas, // 查询弹窗所需类 searchPage: PackageunitApi.getPackageunitPage, // 查询弹窗所需分页方法 }, form: { // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择包装规格代码', // 输入框占位文本 searchField: 'code', // 查询弹窗赋值字段 searchTitle: '包装规格信息', // 查询弹窗标题 searchAllSchemas: Packageunit.allSchemas, // 查询弹窗所需类 searchPage: PackageunitApi.getPackageunitPage, // 查询弹窗所需分页方法 } } }, { label: '客户计量数量', field: 'customerPackQty', sort: 'custom', table: { width: 150 }, form: { component: 'InputNumber', componentProps: { min: 1, precision: 6 } }, tableForm: { type: 'InputNumber', min: 1, precision: 6 } }, { label: '客户计量单位', field: 'customerPackUnit', dictType: DICT_TYPE.UOM, dictClass: 'string', isTable: true, sort: 'custom', table: { width: 150 }, tableForm: { type: 'Select' } }, { label: '转换率', field: 'convertRate', sort: 'custom', table: { width: 150 }, form: { component: 'InputNumber', componentProps: { min: 1, precision: 6 } }, tableForm: { type: 'InputNumber', min: 1, precision: 6 } }, { label: '已发货数量', field: 'shippedQty', sort: 'custom', table: { width: 150 }, form: { component: 'InputNumber', componentProps: { min: 1, precision: 6 } }, tableForm: { type: 'InputNumber', min: 1, precision: 6 } }, { label: '已收货数量', field: 'receivedQty', sort: 'custom', table: { width: 150 }, form: { component: 'InputNumber', componentProps: { min: 1, precision: 6 } }, tableForm: { type: 'InputNumber', min: 1, precision: 6 } }, { label: '已退货数量', field: 'returnedQty', sort: 'custom', table: { width: 150 }, form: { component: 'InputNumber', componentProps: { min: 1, precision: 6 } }, tableForm: { type: 'InputNumber', min: 1, precision: 6 } }, { label: '已结算数量', field: 'settleQty', sort: 'custom', table: { width: 150 }, form: { component: 'InputNumber', componentProps: { min: 1, precision: 6 } }, tableForm: { type: 'InputNumber', min: 1, precision: 6 } }, { label: '单价', field: 'singlePrice', sort: 'custom', table: { width: 150 }, form: { component: 'InputNumber', componentProps: { min: 1, precision: 6 } }, tableForm: { type: 'InputNumber', min: 1, precision: 6 } }, { label: '金额', field: 'amount', sort: 'custom', table: { width: 150 }, form: { component: 'InputNumber', componentProps: { min: 1, precision: 6 } }, tableForm: { type: 'InputNumber', min: 1, precision: 6 } }, { label: '单据号', field: 'number', sort: 'custom', table: { width: 180 }, isTableForm: false, 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: 'itemDesc1', sort: 'custom', hiddenSearchHigh:true, table: { width: 150 }, hiddenInMain: true, isTableForm:false, isForm:false }, { label: '备注', field: 'remark', sort: 'custom', table: { width: 150 }, }, { label: '创建时间', field: 'createTime', formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, sort: 'custom', table: { width: 180 }, form: { component: 'DatePicker', componentProps: { type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x', } }, isTableForm: false, isForm: false }, { label: '创建者', field: 'creater', sort: 'custom', table: { width: 150 }, isTableForm: false, isForm: false }, { label: '订单数量', field: 'orderQty', sort: 'custom', table: { width: 150 }, form: { component: 'InputNumber', componentProps: { min: 1, precision: 6 } }, tableForm: { type: 'InputNumber', min: 1, precision: 6 } }, { label: '计量单位', field: 'uom', dictType: DICT_TYPE.UOM, dictClass: 'string', isTable: true, sort: 'custom', table: { width: 150 }, tableForm: { type: 'Select' } }, { label: '是否可用', field: 'available', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isTable: true, sort: 'custom', table: { width: 150 }, form: { component: 'Switch', value: 'TRUE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } }, isTableForm: false }, { label: '操作', field: 'action', isDetail: false, isForm: false , table: { width: 150, fixed: 'right' }, isTableForm:false, } ])) //表单校验 export const SaleDetailRules = reactive({ lineNumber: [ { required: true, message: '请输入行号', trigger: 'blur' }, { max: 50, message: '不得超过50个字符', trigger: 'blur' } ], packQty: [ { required: true, message: '请输入包装数量', trigger: 'blur' } ], packUnit: [ { required: true, message: '请选择包装规格', trigger: 'change' } ], convertRate: [ { required: true, message: '请输入转换率', trigger: 'blur' } ], available: [ { required: true, message: '请选择是否可用', trigger: 'change' } ], uom: [ { required: true, message: '请选择计量单位', trigger: 'change' } ], planQty: [ { required: true, message: '请输入计划数量', trigger: 'blur' } ], number: [ { required: true, message: '请输入单据号', trigger: 'blur' } ], itemCode: [ { required: true, message: '请选择品番', trigger: 'change' } ], remark: [ { max: 50, message: '不得超过50个字符', trigger: 'blur' } ], }) /** * @returns {Array} 销售订单主子表合并数据 */ export const SaleDetailAndMain = useCrudSchemas(reactive([ { label: '销售订单号', field: 'number', sort: 'custom', table: { width: 180 }, }, { label: '销售订单行', field: 'lineNumber', sort: 'custom', table: { width: 150 }, }, { 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: 'batch', sort: 'custom', }, { label: '客户库位', field: 'fromLocationCode', sort: 'custom', isSearch: true, isTableForm: true, table: { width: 150 }, }, { label: '数量', field: 'orderQty', sort: 'custom', table: { width: 150 }, form: { component: 'InputNumber', componentProps: { min: 1, precision: 6 } }, tableForm: { type: 'InputNumber', min: 1, precision: 6 } }, { label: '计量单位', field: 'uom', dictType: DICT_TYPE.UOM, dictClass: 'string', isTable: true, sort: 'custom', table: { width: 150 }, tableForm: { type: 'Select' } }, { label: '已结算数量', field: 'settleQty', sort: 'custom', table: { width: 150 }, form: { component: 'InputNumber', componentProps: { min: 1, precision: 6 } }, tableForm: { type: 'InputNumber', min: 1, precision: 6 } }, ]))