diff --git a/src/views/wms/basicDataManage/itemManage/relegate/relegateRequest/index.vue b/src/views/wms/basicDataManage/itemManage/relegate/relegateRequest/index.vue index e74f25d3f..a4f6f65f4 100644 --- a/src/views/wms/basicDataManage/itemManage/relegate/relegateRequest/index.vue +++ b/src/views/wms/basicDataManage/itemManage/relegate/relegateRequest/index.vue @@ -93,7 +93,8 @@ import TableHead from '@/components/TableHead/src/TableHead.vue' import ImportForm from '@/components/ImportForm/src/ImportForm.vue' import Detail from '@/components/Detail/src/Detail.vue' import { ProductreceiptRequestLabel,ProductreceiptRequestLabelRules } from '../../../../productionManage/productreceipt/productreceiptRequestMain/productreceiptRequestMain.data' - +import * as ProductionitemcodeSpareitemcodeApi from '@/api/wms/productionitemcodeSpareitemcode' + defineOptions({ name: 'RelegateRequestMain' }) const message = useMessage() // 消息弹窗 @@ -116,6 +117,7 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row) => if(val.length==0) return val.forEach(item=>{ const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...item})) + newRow['id'] = item['id'] newRow['itemCode'] = item['itemCode'] newRow['uom'] = item['uom'] newRow['qty'] = item['qty'] @@ -127,6 +129,31 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row) => newRow['inventoryStatus'] = item['inventoryStatus'] tableData.value.push(newRow) }) + let itemCodes = [] + val.forEach(item=>{ + if(!itemCodes.find(item1=>item1==item['itemCode'])){ + itemCodes.push(item['itemCode']) + } + }) + console.log('过滤之后的物料代码',itemCodes) + itemCodes.forEach(async (item)=>{ + let res = await ProductionitemcodeSpareitemcodeApi.getProductionitemcodeSpareitemcodeRelation({ + code:item, + available: 'TRUE', + pageSize: 20, + pageNo: 1, + by: 'ASC' + }) + if(res.list&&res.list.length>0){ + tableData.value.forEach(item1=>{ + if(item1['itemCode']==item){ + item1['downItemCode'] = res.list[0]['code'] + } + }) + } + console.log(res) + }) + } else if (formField == 'downItemCode') { // if(row['itemCode'] == val[0]['spareItemCode']){ // row['downItemCode'] = val[0]['productionItemCode'] //量产件 @@ -292,9 +319,9 @@ const isShowMainButton = (row, val) => { } // 列表-操作按钮 -const butttondata = (row, $index) => { - const findIndex = row['masterId'] ? tableObject.tableList.findIndex(item => item['masterId'] == row['masterId']) : -1 - if (findIndex > 0 && findIndex < $index) { +const butttondata = (row,$index) => { + const findIndex = row['masterId']?tableObject.tableList.findIndex(item=>item['masterId'] == row['masterId']):-1 + if(findIndex>-1&&findIndex<$index){ return [] } return [ @@ -387,6 +414,7 @@ const buttonTableClick = async (val, row) => { /** 添加/修改操作 */ const basicFormRef = ref() const openForm = (type: string, row?: any) => { + tableData.value = [] basicFormRef.value.open(type, row) } //为true表示子表数据中存在数量为0的数据