diff --git a/src/components/TableForm/src/TableForm.vue b/src/components/TableForm/src/TableForm.vue index eec0dcf8c..4cb4f8d1c 100644 --- a/src/components/TableForm/src/TableForm.vue +++ b/src/components/TableForm/src/TableForm.vue @@ -86,7 +86,7 @@ > @@ -123,11 +123,11 @@ > - + - + - + - + - + - + - + - + item.isShowTableFormSearch) // 传递给父类 @@ -627,11 +626,21 @@ const handleTableSelect = (row, column, event) => { // 某个item是否禁用 const itemIsDisabled = (colum, row) => { - return ( - Boolean(colum.tableForm?.disabled) || - Boolean(row.disabled) || - Boolean(row['disabled_' + colum.field]) - ) + console.log(row['disabled_' + colum.field]) + if (row['disabled_' + colum.field] === true || row['disabled_' + colum.field] === false) { + return Boolean(row['disabled_' + colum.field]) + } + else if (!row['disabled_' + colum.field] && (colum.tableForm?.disabled === true || colum.tableForm?.disabled === false)) { + return Boolean(colum.tableForm?.disabled) + }else { + return Boolean(row.disabled) + } + + // return ( + // Boolean(colum.tableForm?.disabled) || + // Boolean(row.disabled) || + // Boolean(row['disabled_' + colum.field]) + // ) } // const { t } = useI18n() // 国际化 @@ -762,6 +771,14 @@ const isFullscreen = ref(false) const reloadFullscreen = (fullscreen)=>{ isFullscreen.value = fullscreen } +// 显示输入框类型 +const getFormItemType = (row, headerItem) => { + if (headerItem.field&&row[headerItem.field + 'FormItemType'] != undefined) { + return row[headerItem.field + 'FormItemType'] + } else { + return headerItem?.tableForm?.type ? headerItem?.tableForm?.type :'' + } +} // setup 语法糖 抛出方法 defineExpose({ TableBaseComponents_Ref, diff --git a/src/views/wms/moveManage/inventorymove/inventorymoveRequestMainMOVE/index.vue b/src/views/wms/moveManage/inventorymove/inventorymoveRequestMainMOVE/index.vue index 08cf1488b..d12d63457 100644 --- a/src/views/wms/moveManage/inventorymove/inventorymoveRequestMainMOVE/index.vue +++ b/src/views/wms/moveManage/inventorymove/inventorymoveRequestMainMOVE/index.vue @@ -106,7 +106,6 @@ routeName.value = route.name const tableColumns = ref([...InventorymoveRequestMain.allSchemas.tableColumns,...InventorymoveRequestDetail.allSchemas.tableMainColumns]) const businessType = ref() -console.log(99 , routeName.value) const fromInventoryStatus = ref() const toInventoryStatus = ref() const importFileName = ref() @@ -123,7 +122,6 @@ if ( routeName.value == 'InventorymoveRequestMain') { businessType.value = 'Move' importFileName.value = '库存移动申请' } -console.log(99 , businessType.value) @@ -299,7 +297,6 @@ const getDefaultToLocationCode = async ()=>{ } }) let res = await LocationApi.selectBusinessTypeToLocation(params) - console.log('res',res) if(res&&res.list.length>0){ tableData.value.forEach(item=>{ if(!item['toLocationCode']){ @@ -308,9 +305,11 @@ const getDefaultToLocationCode = async ()=>{ }) } } +let fromManagementPrecision = ref('') +let toManagementPrecision = ref('') // 查询页面返回 const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { - nextTick(() => { + nextTick(async() => { if (type == 'tableForm') { if(formField == 'fromPackingNumber'){ val = val.filter(item=>!tableData.value.find(item1=>item1['itemCode']==item['itemCode']&&item1['fromBatch']==item['batch']&&item1['fromPackingNumber']==item['packingNumber']&&item1['fromLocationCode']==item['locationCode']&&item1['fromInventoryStatus']==item['inventoryStatus'])) @@ -328,6 +327,28 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => newRow['toInventoryStatus'] = item['inventoryStatus']//库存移动申请 tableData.value.push(newRow) }) + }else if (formField == 'toLocationCode') { + row[formField] = val[0][searchField] + await ruleApi.getManagementPrecision({ + itemCodes: [row['itemCode']], + locationCode:row['fromLocationCode'] + }).then((res) => { + fromManagementPrecision.value = res[0].ManagementPrecision + }) + await ruleApi.getManagementPrecision({ + itemCodes: [row['itemCode']], + locationCode: val[0][searchField] + }).then((res) => { + toManagementPrecision.value = res[0].ManagementPrecision + }) + if (fromManagementPrecision.value == 'BY_QUANTITY' && toManagementPrecision.value == 'BY_BATCH') { + row['fromBatchFormItemType'] = 'FormDate' + row['disabled_fromBatch'] = false + } else { + row['fromBatchFormItemType'] = '' + row['disabled_fromBatch'] = true + row['fromBatch'] ='' + } } else { row[formField] = val[0][searchField] } @@ -354,8 +375,8 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => }) } // 查询页面返回——详情 -const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { - nextTick(() => { +const searchTableSuccessDetail = (formField, searchField, val, formRef) => { + nextTick(async() => { const setV = {} if(formField == 'fromPackingNumber') { setV['fromPackingNumber'] = val[0]['packingNumber'] @@ -366,7 +387,37 @@ const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { setV['fromLocationCode'] = val[0]['locationCode'] setV['uom'] = val[0]['uom'] setV['toInventoryStatus'] = val[0]['inventoryStatus'] //库存移动申请InventorymoveRequestMain - + } else if (formField == 'toLocationCode') { + setV[formField] = val[0][searchField] + await ruleApi.getManagementPrecision({ + itemCodes: [formRef.formModel.itemCode], + locationCode:formRef.formModel.fromLocationCode + }).then((res) => { + fromManagementPrecision.value = res[0].ManagementPrecision + }) + await ruleApi.getManagementPrecision({ + itemCodes: [formRef.formModel.itemCode], + locationCode: val[0][searchField] + }).then((res) => { + toManagementPrecision.value = res[0].ManagementPrecision + }) + if (fromManagementPrecision.value == 'BY_QUANTITY' && toManagementPrecision.value == 'BY_BATCH') { + const obj =ref(InventorymoveRequestDetail.allSchemas.formSchema.find(item => (item.field == 'fromBatch'))) + obj.value.component= 'DatePicker' + obj.value.componentProps.disabled= false + obj.value.componentProps.type= 'date' + obj.value.componentProps.valueFormat= 'YYYYMMDD' + obj.value.componentProps.format = 'YYYYMMDD' + InventorymoveRequestDetailRules.fromBatch[0].required = true + } else { + const obj =ref(InventorymoveRequestDetail.allSchemas.formSchema.find(item => (item.field == 'fromBatch'))) + obj.value.component= 'Input' + obj.value.componentProps={ + disabled : true + } + setV['fromBatch'] ='' + InventorymoveRequestDetailRules.fromBatch[0].required = false + } } else { setV[formField] = val[0][searchField] } @@ -457,7 +508,6 @@ const buttonTableClick = async (val, row) => { buttonBaseClick('refresh',null) }).catch(err => { tableObject.loading = false - console.log(err) }) } else if (val == 'mainReAdd') { // 重新添加 await message.confirm('确认要重新添加吗?') @@ -468,7 +518,6 @@ const buttonTableClick = async (val, row) => { buttonBaseClick('refresh',null) }).catch(err => { tableObject.loading = false - console.log(err) }) } else if (val == 'mainSubmit') { // 提交审批 await message.confirm('确认要提交审批吗?') @@ -479,7 +528,6 @@ const buttonTableClick = async (val, row) => { buttonBaseClick('refresh',null) }).catch(err => { tableObject.loading = false - console.log(err) }) } else if (val == 'mainTurnDown') { // 驳回 await message.confirm('确认要驳回吗?') @@ -490,7 +538,6 @@ const buttonTableClick = async (val, row) => { buttonBaseClick('refresh',null) }).catch(err => { tableObject.loading = false - console.log(err) }) } else if (val == 'mainApprove') { // 审批通过 await message.confirm('确认要审批通过吗?') @@ -501,7 +548,6 @@ const buttonTableClick = async (val, row) => { buttonBaseClick('refresh',null) }).catch(err => { tableObject.loading = false - console.log(err) }) } else if (val == 'mainHandle') { // 处理 await message.confirm('确认要处理吗?') @@ -512,7 +558,6 @@ const buttonTableClick = async (val, row) => { buttonBaseClick('refresh',null) }).catch(err => { tableObject.loading = false - console.log(err) }) } else if (val == 'edit') { // 编辑 openForm('update', row) @@ -531,20 +576,50 @@ const openForm =async (type: string, row?: number) => { /** * 详情 新增/编辑事件 */ -const detailOpenForm = (type, row) => { - if(InventorymoveRequestDetail.allSchemas.formSchema.find(item => (item.field == 'fromPackingNumber'))?.componentProps?.searchCondition.find(item => (item.key == 'warehouseCode')) == undefined){ - InventorymoveRequestDetail.allSchemas.formSchema.find(item => (item.field == 'fromPackingNumber'))?.componentProps?.searchCondition.push({ - key: 'warehouseCode', - value: fromWarehouseCodeMain.value, - isMainValue: false - }) - } else { - InventorymoveRequestDetail.allSchemas.formSchema.find(item => (item.field == 'fromPackingNumber'))?.componentProps?.searchCondition.find(item => { - if (item.key == 'warehouseCode') { - item.value = fromWarehouseCodeMain.value - } - }) +const detailOpenForm =async (type, row) => { + if(InventorymoveRequestDetail.allSchemas.formSchema.find(item => (item.field == 'fromPackingNumber'))?.componentProps?.searchCondition.find(item => (item.key == 'warehouseCode')) == undefined){ + InventorymoveRequestDetail.allSchemas.formSchema.find(item => (item.field == 'fromPackingNumber'))?.componentProps?.searchCondition.push({ + key: 'warehouseCode', + value: fromWarehouseCodeMain.value, + isMainValue: false + }) + } else { + InventorymoveRequestDetail.allSchemas.formSchema.find(item => (item.field == 'fromPackingNumber'))?.componentProps?.searchCondition.find(item => { + if (item.key == 'warehouseCode') { + item.value = fromWarehouseCodeMain.value } + }) + } + if (type == 'update') { + await ruleApi.getManagementPrecision({ + itemCodes: [row['itemCode']], + locationCode:row['fromLocationCode'] + }).then((res) => { + fromManagementPrecision.value = res[0].ManagementPrecision + }) + await ruleApi.getManagementPrecision({ + itemCodes: [row['itemCode']], + locationCode: row['toLocationCode'] + }).then((res) => { + toManagementPrecision.value = res[0].ManagementPrecision + }) + if (fromManagementPrecision.value == 'BY_QUANTITY' && toManagementPrecision.value == 'BY_BATCH') { + const obj =ref(InventorymoveRequestDetail.allSchemas.formSchema.find(item => (item.field == 'fromBatch'))) + obj.value.component= 'DatePicker' + obj.value.componentProps.disabled= false + obj.value.componentProps.type= 'date' + obj.value.componentProps.valueFormat= 'YYYYMMDD' + obj.value.componentProps.format= 'YYYYMMDD' + InventorymoveRequestDetailRules.fromBatch[0].required = true + } else { + const obj =ref(InventorymoveRequestDetail.allSchemas.formSchema.find(item => (item.field == 'fromBatch'))) + obj.value.component= 'Input' + obj.value.componentProps={ + disabled : true + } + InventorymoveRequestDetailRules.fromBatch[0].required = false + } + } } const fromWarehouseCodeMain = ref() @@ -629,11 +704,16 @@ const submitForm = async (formType, submitData) => { message.warning('从库位和到库位不能相同') return } + let batchList = tableData.value.filter(item=>item.fromBatchFormItemType&&item.fromBatchFormItemType == 'FormDate') + let noBatch = batchList.some(item => !item.fromBatch) + if(noBatch){ + message.warning('请选择从批次') + return + } data.subList = tableData.value // 拼接子表数据参数 let isExist = false tableData.value.forEach(item => { let rs = tableData.value.filter(filterItem => (filterItem.fromPackingNumber&&filterItem.fromPackingNumber == item.fromPackingNumber) ) - console.log(rs,5666); if(rs.length > 1) isExist = true }) if (isExist) { @@ -643,7 +723,6 @@ const submitForm = async (formType, submitData) => { } flag.value = false data.subList.forEach(item => { - console.log(556565,item); if(fromInventoryStatus.value){ //item.fromInventoryStatus = fromInventoryStatus.value item.toInventoryStatus = toInventoryStatus.value diff --git a/src/views/wms/moveManage/inventorymove/inventorymoveRequestMainMOVE/inventorymoveRequestMain.data.ts b/src/views/wms/moveManage/inventorymove/inventorymoveRequestMainMOVE/inventorymoveRequestMain.data.ts index c06a05d67..bf6454003 100644 --- a/src/views/wms/moveManage/inventorymove/inventorymoveRequestMainMOVE/inventorymoveRequestMain.data.ts +++ b/src/views/wms/moveManage/inventorymove/inventorymoveRequestMainMOVE/inventorymoveRequestMain.data.ts @@ -566,7 +566,7 @@ export const InventorymoveRequestDetail = useCrudSchemas(reactive( componentProps: { style: {width: '100%'}, type: 'date', - dateFormat: 'YYYY-MM-DD', + format: 'YYYY-MM-DD', valueFormat: 'x', } }, @@ -583,14 +583,24 @@ export const InventorymoveRequestDetail = useCrudSchemas(reactive( table: { width: 150 }, + isTable:false, tableForm: { - disabled: true + disabled: true, + placeholder: '请选择从批次', + valueFormat: 'YYYYMMDD', + format: 'YYYYMMDD', }, form: { + component: 'Input', componentProps: { - disabled: true + disabled:true + // style: { width: '100%' }, + // type: 'date', + // placeholder: '请选择从批次', + // format: 'YYYYMMDD', + // valueFormat: 'YYYYMMDD', } - } + }, }, { label: '到批次', @@ -963,6 +973,9 @@ export const InventorymoveRequestDetailRules = reactive({ fromLocationCode: [ { required: true, message: '请选择从库位代码', trigger: 'change' } ], + fromBatch: [ + { required: false, message: '请选择批次码', trigger: 'change' } + ], // fromPackingNumber: [ // { required: true, message: '请选择从包装号', trigger: 'change' } // ],