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 SaleDetailApi from '@/api/wms/saleDetail' import { SaleDetailAndMain } from '@/views/wms/deliversettlementManage/deliverplan/saleMain/saleMain.data' import * as LocationApi from '@/api/wms/location' import { Location } from '@/views/wms/basicDataManage/factoryModeling/location/location.data' import * as CustomerdockApi from '@/api/wms/customerdock' import { Customerdock } from '@/views/wms/basicDataManage/customerManage/customerdock/customerdock.data' import * as getRequestsettingApi from '@/api/wms/requestsetting/index' // 获取自动提交自动通过自动执行,跳过任务直接删生成记录的默认值 const queryParams = { pageSize:10, pageNo:1, code:'DeliverRequest' } const data = await getRequestsettingApi.getRequestsettingPage(queryParams) const requestsettingData =data?.list[0]||{} // 表单校验 export const SaleShipmentMainRules = reactive({ customerCode: [ { required: true, message: '请选择客户代码', trigger: 'blur' } ], }) export const SaleShipmentMain = useCrudSchemas(reactive([ { label: '单据号', field: 'number', sort: 'custom', isSearch: true, isForm: false, table: { width: 200 }, }, { label: '状态', field: 'status', sort: 'custom', table: { width: 150 }, dictType: DICT_TYPE.REQUEST_STATUS, dictClass: 'string', isSearch: true, isForm:false, }, { label: '客户代码', field: 'customerCode', sort: 'custom', table: { width: 150 }, form: { // labelMessage: '信息提示说明!!!', componentProps: { enterSearch: true, isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择客户代码', // 输入框占位文本 searchField: 'code', // 查询弹窗赋值字段 searchTitle: '客户信息', // 查询弹窗标题 searchAllSchemas: Customer.allSchemas, // 查询弹窗所需类 searchPage: CustomerApi.getCustomerPage, // 查询弹窗所需分页方法 searchCondition: [{ key: 'available', value: 'TRUE', isMainValue: false }] } } }, { label: '发票时间', field: 'invoiceTime', sort: 'custom', table: { width: 180 }, formatter: dateFormatter, 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: 'siteId', sort: 'custom', hiddenInMain: true, }, { label: '业务类型', field: 'businessType', sort: 'custom', isForm: false, isTableForm: false, table: { width: 150 }, }, { label: '备注', field: 'remark', sort: 'custom', isForm: false, isTableForm: false, isTable: false }, { label: '部门', field: 'departmentCode', sort: 'custom', isForm: false, isTableForm: false, isTable: false }, { label: '自动提交', field: 'autoCommit', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isTable: false, isForm: false, sort: 'custom', table: { width: 150 }, form: { component: 'Switch', value: requestsettingData.autoCommit, componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE', disabled: true } } }, { label: '自动通过', field: 'autoAgree', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isTable: false, isForm: false, sort: 'custom', table: { width: 150 }, form: { component: 'Switch', value: requestsettingData.autoAgree, componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE', disabled: true } } }, { label: '自动执行', field: 'autoExecute', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isTable: false, isForm: false, sort: 'custom', table: { width: 150 }, form: { component: 'Switch', value: requestsettingData.autoExecute, componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE', disabled: true } } }, { label: '直接生成记录', field: 'directCreateRecord', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isForm: false, isTable: false, sort: 'custom', table: { width: 150 }, form: { component: 'Switch', value: requestsettingData.directCreateRecord, componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE', disabled: true } } }, { label: '创建时间', field: 'createTime', sort: 'custom', formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, 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, isTableForm: false, isTable: false }, { label: '操作', field: 'action', isDetail: false, isForm: false, table: { width: 250, fixed: 'right' }, hiddenInMain:true, isTableForm:false, } ])) // 表单校验 export const SaleShipmentDetailRules = reactive({ soLine: [ { required: true, message: '请选择订单行', trigger: 'blur' } ], fromLocationCode: [ { required: true, message: '请选择客户库位', trigger: 'blur' } ], batch: [ { required: true, message: '请输入批次', trigger: 'blur' } ], qty: [ { required: true, message: '请输入开票数量', trigger: 'blur' } ], }) export const SaleShipmentDetail = useCrudSchemas(reactive([ { label: '销售订单号', field: 'soNumber', sort: 'custom', table: { width: 200 }, tableForm: { type: 'Select', disabled: true }, form: { componentProps: { disabled: true } } }, { label: '销售订单行', field: 'soLine', sort: 'custom', table: { width: 150 }, tableForm:{ isInpuFocusShow: true, // 开启查询弹窗 searchListPlaceholder: '请选择销售订单行', searchField: 'lineNumber', searchTitle: '销售订单信息', searchAllSchemas: SaleDetailAndMain.allSchemas, searchPage: SaleDetailApi.getSaleDetailPage, searchCondition: [{ key: 'available', value: 'TRUE', isMainValue: false }, { key: 'customerCode', value: 'customerCode', isMainValue: true }] }, form: { // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, searchListPlaceholder: '请选择销售订单行', searchField: 'lineNumber', searchTitle: '销售订单信息', searchAllSchemas: SaleDetailAndMain.allSchemas, searchPage: SaleDetailApi.getSaleDetailPage, searchCondition: [{ key: 'available', value: 'TRUE', isMainValue: false }, { key: 'customerCode', value: 'customerCode', isMainValue: true }] } } }, { label: '物料代码', field: 'itemCode', sort: 'custom', tableForm: { type: 'Select', disabled: true }, form: { componentProps: { disabled: true } }, table: { width: 150 }, }, { label: '批次', field: 'batch', sort: 'custom', }, { label: '客户库位', field: 'fromLocationCode', tableForm:{ isInpuFocusShow: true, // 开启查询弹窗 searchListPlaceholder: '请选择客户库位代码', searchField: 'code', searchTitle: '库位基础信息', searchAllSchemas: Customerdock.allSchemas, searchPage: CustomerdockApi.getCustomerdockPage, searchCondition: [{ key: 'available', value: 'TRUE', isMainValue: false }, { key: 'customerCode', value: 'customerCode', message: '请填写客户代码!', isMainValue: true }] }, form: { componentProps: { isSearchList: true, searchListPlaceholder: '请选择客户库位代码', searchField: 'code', searchTitle: '库位基础信息', searchAllSchemas: Location.allSchemas, searchPage: LocationApi.selectConfigToLocation, searchCondition: [{ key: 'available', value: 'TRUE', isMainValue: false }, { key: 'customerCode', value: 'customerCode', message: '请填写客户代码!', isMainValue: true }] } }, }, { label: '从货主代码', field: 'fromOwnerCode', sort: 'custom', isForm: false, isTableForm: false, isTable: false, }, { label: '包装号', field: 'packingNumber', sort: 'custom', isForm: false, isTableForm: false, isTable: false, }, { label: '库存状态', field: 'inventoryStatus', // dictType: DICT_TYPE.INVENTORY_STATUS, // dictClass: 'string', isTable: false, sort: 'custom', table: { width: 150 }, isTableForm: false, hiddenInMain: true, isForm: false, }, { label: '物品名称', field: 'itemName', sort: 'custom', table: { width: 150 }, isForm: false, isTableForm: false }, { label: '物品描述1', field: 'itemName', sort: 'custom', table: { width: 150 }, isForm: false, isTableForm: false, isTable: false, }, { label: '物品描述2', field: 'itemName', sort: 'custom', table: { width: 150 }, isForm: false, isTableForm: false, isTable: false, }, { label: '项目代码', field: 'projectCode', sort: 'custom', isTableForm: false, hiddenInMain: true, }, { label: '开票数量', field: 'qty', sort: 'custom', table: { width: 150 }, }, { label: '计量单位', field: 'uom', dictType: DICT_TYPE.UOM, dictClass: 'string', isTable: true, sort: 'custom', table: { width: 150 }, tableForm: { type: 'Select', disabled: true }, form: { componentProps: { disabled: true } } }, { label: '备注', field: 'remark', sort: 'custom', isTable: false, isTableForm: false }, { label: '创建时间', field: 'createTime', sort: 'custom', formatter: dateFormatter, 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, isTableForm: false, isTable: false, }, { label: '操作', field: 'action', isDetail: false, isForm: false, hiddenInMain:true, isTableForm:false, } ]))