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 SaleMainApi from '@/api/wms/saleMain' import * as SaleDetailApi from '@/api/wms/saleDetail' import { SaleDetail, SaleMain } from '../saleMain/saleMain.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 DeliverPlanMain = useCrudSchemas(reactive([ { 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: 'planDate', 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', } }, }, { label: '单据号', field: 'number', sort: 'custom', table: { width: 150, fixed: 'left' }, isForm: false, isSearch: true }, { label: '业务类型', field: 'businessType', sort: 'custom', isForm: false, table: { width: 150 }, }, { 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, }, { label: '创建者', field: 'creator', sort: 'custom', table: { width: 150 }, isForm: false, }, { label: '开始时间', field: 'beginTime', 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', } }, }, { label: '结束时间', field: 'endTime', 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', } }, }, { label: '状态', field: 'status', sort: 'custom', table: { width: 150 }, dictType: DICT_TYPE.PLAN_STATUS, dictClass: 'string', isSearch: true, form: { value: '1', componentProps: { disabled: true } } }, { label: '最后更新者', field: 'updater', 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', } }, isForm: false, }, { label: '是否可用', field: 'available', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isSearch: true, 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: 300, fixed: 'right' }, } ])) //表单校验 export const DeliverPlanMainRules = reactive({ customerCode: [ { required: true, message: '请选择客户代码', trigger: 'change' } ], available: [ { required: true, message: '请选择是否可用', trigger: 'change' } ], status: [ { required: true, message: '请选择状态', trigger: 'change' } ], businessType: [ { required: true, message: '请输入业务类型', trigger: 'blur' } ], }) /** * @returns {Array} 发货计划子表 */ export const DeliverPlanDetail = useCrudSchemas(reactive([ // { // label: '销售订单号', // field: 'soNumber', // sort: 'custom', // table: { // width: 150 // }, // tableForm:{ // isInpuFocusShow: true, // 开启查询弹窗 // searchListPlaceholder: '请选择销售订单号', // searchField: 'number', // searchTitle: '销售订单信息', // searchAllSchemas: SaleDetail.allSchemas, // searchPage: SaleDetailApi.getSaleDetailPage, // searchCondition: [{ // key: 'available', // value: 'TRUE', // isMainValue: false // }] // }, // form: { // // labelMessage: '信息提示说明!!!', // componentProps: { // isSearchList: true, // searchListPlaceholder: '请选择销售订单号', // searchField: 'number', // searchTitle: '销售订单信息', // searchAllSchemas: SaleDetail.allSchemas, // searchPage: SaleDetailApi.getSaleDetailPage, // searchCondition: [{ // key: 'available', // value: 'TRUE', // isMainValue: false // }] // } // } // }, // { // label: '销售订单行', // field: 'soLine', // sort: 'custom', // table: { // width: 150 // }, // tableForm: { // disabled: true // }, // form: { // componentProps: { // disabled: true // } // } // }, { label: '客户月台', field: 'customerDockCode', sort: 'custom', table: { width: 150 }, isTableForm: false, isForm: false, }, { label: '项目', field: 'project', sort: 'custom', table: { width: 150 }, isTableForm: false, isForm: false, }, { label: '单据号', field: 'number', sort: 'custom', table: { width: 150 }, 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: { componentProps: { isInpuFocusShow: true, searchListPlaceholder: '请选择物品代码', searchField: 'code', searchTitle: '物品基础信息', searchAllSchemas: Itembasic.allSchemas, searchPage: ItembasicApi.getItembasicPage, searchCondition: [{ key: 'available', value: 'TRUE', isMainValue: 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: 'creator', sort: 'custom', table: { width: 150 }, isTableForm: false, isForm: false, }, { label: '计划数量', field: 'planQty', 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: { disabled: true, type: 'Select' }, }, { 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', } }, isTableForm: false, isForm: false, }, { label: '最后更新者', field: 'updater', sort: 'custom', table: { width: 150 }, isTableForm: false, isForm: false, }, { 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 DeliverPlanDetailRules = reactive({ number: [ { required: true, message: '请输入单据号', trigger: 'blur' } ], itemCode: [ { required: true, message: '请选择物品代码', trigger: 'change' } ], available: [ { required: true, message: '请选择是否可用', trigger: 'change' } ], uom: [ { required: true, message: '请选择计量单位', trigger: 'change' } ], planQty: [ { required: true, message: '请输入计划数量', trigger: 'blur' } ], // soNumber: [ // { required: true, message: '请选择销售订单号', trigger: 'change' } // ], })