|
|
|
@ -445,6 +445,11 @@ |
|
|
|
height="350px" |
|
|
|
v-loading="editPoDetailLoading" |
|
|
|
style="width: 100%; margin-top: -10px;"> |
|
|
|
<el-table-column fixed="right" header-align="center" align="center" width="80" label="操作"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-link style="cursor: pointer" @click="deleteEditPoRow(scope.$index)">删除</el-link> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="orderRef1" label="PO号" header-align="center" align="center" width="120"/> |
|
|
|
<el-table-column prop="orderRef2" label="PO行号" header-align="center" align="center" width="80"/> |
|
|
|
<el-table-column prop="partNo" label="产品编码" header-align="center" align="left" min-width="120" show-overflow-tooltip/> |
|
|
|
@ -1106,7 +1111,7 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import { searchInspectionRequestHeaderList, queryPoPage, queryPoSupplierPage, queryPoSupplierOrderPage, saveInspectionRequest, deleteInspectionRequest, confirmInspectionRequest, applyChangeInspectionRequest, getInspectionRequestDetailSubList, updateInspectionRequest, downloadTemplate, previewUpload, batchSave, addInspectionDetails, editInspectionDetails } from '@/api/inspection/inspectionRequestHeader.js' |
|
|
|
import { searchInspectionRequestHeaderList, queryPoPage, queryPoSupplierPage, queryPoSupplierOrderPage, saveInspectionRequest, deleteInspectionRequest, confirmInspectionRequest, applyChangeInspectionRequest, getInspectionRequestDetailSubList, updateInspectionRequest, downloadTemplate, previewUpload, batchSave, addInspectionDetails, editInspectionDetails, deleteInspectionDetails } from '@/api/inspection/inspectionRequestHeader.js' |
|
|
|
import { searchSrmSupplierAddressList, createSrmSupplierAddress, updateSrmSupplierAddress, searchSrmSupplierList } from '@/api/srm/srmSupplier.js' |
|
|
|
import { getPermissionValue } from '@/api/sys/specialSecurity.js' |
|
|
|
import Chooselist from '@/views/modules/common/Chooselist_eam' |
|
|
|
@ -2265,7 +2270,7 @@ export default { |
|
|
|
this.editPoEditMode = true |
|
|
|
}, |
|
|
|
|
|
|
|
// 删除编辑PO明细中的某一行 |
|
|
|
// 删除编辑PO明细中的某一行(仅缓存,保存时一并提交) |
|
|
|
deleteEditPoRow (index) { |
|
|
|
this.$confirm('确定要删除这条PO明细吗?', '提示', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
@ -2273,6 +2278,7 @@ export default { |
|
|
|
type: 'warning' |
|
|
|
}).then(() => { |
|
|
|
const deletedRow = this.editPoDetailList[index] |
|
|
|
|
|
|
|
// 记录被删除的PO的key,用于保存时判断 |
|
|
|
const key = `${deletedRow.orderRef1 || ''}_${deletedRow.orderRef2 || ''}` |
|
|
|
|
|
|
|
@ -2286,8 +2292,9 @@ export default { |
|
|
|
this.deletedPoKeys.add(key) |
|
|
|
} |
|
|
|
|
|
|
|
// 从列表中移除该行(仅前端移除,不立即调用后端接口) |
|
|
|
this.editPoDetailList.splice(index, 1) |
|
|
|
this.$message.success('删除成功') |
|
|
|
this.$message.success('已标记删除,点击保存后生效') |
|
|
|
}).catch(() => { |
|
|
|
// 取消删除 |
|
|
|
}) |
|
|
|
@ -3442,10 +3449,24 @@ export default { |
|
|
|
'修改PO': modifiedPoItems |
|
|
|
}) |
|
|
|
|
|
|
|
// 执行顺序:1.修改 -> 2.新增 -> 3.更新基础信息 |
|
|
|
// 执行顺序:1.删除 -> 2.修改 -> 3.新增 -> 4.更新基础信息 |
|
|
|
let promiseChain = Promise.resolve() |
|
|
|
|
|
|
|
// 1. 如果有修改的PO,先调用 editInspectionDetails |
|
|
|
// 0. 如果有删除的PO,先调用 deleteInspectionDetails |
|
|
|
if (this.deletedPoKeys.size > 0) { |
|
|
|
const deletedItemNos = Array.from(this.deletedPoKeys).map(key => { |
|
|
|
const parts = key.split('_') |
|
|
|
return parts[1] || '' // 返回orderRef2作为itemNo |
|
|
|
}).filter(itemNo => itemNo) |
|
|
|
|
|
|
|
if (deletedItemNos.length > 0) { |
|
|
|
promiseChain = promiseChain.then(() => { |
|
|
|
return this.deletePoDetails(deletedItemNos) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 1. 如果有修改的PO,再调用 editInspectionDetails |
|
|
|
if (modifiedPoItems.length > 0) { |
|
|
|
promiseChain = promiseChain.then(() => { |
|
|
|
return this.editModifiedPoDetails(modifiedPoItems) |
|
|
|
@ -3533,6 +3554,30 @@ export default { |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 删除PO明细 |
|
|
|
deletePoDetails (itemNos) { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
const params = { |
|
|
|
requestNo: this.addFormData.requestNo, |
|
|
|
site: this.$store.state.user.site, |
|
|
|
itemNos: itemNos |
|
|
|
} |
|
|
|
|
|
|
|
console.log('=== 调用 deleteInspectionDetails ===', params) |
|
|
|
|
|
|
|
deleteInspectionDetails(params).then(({ data }) => { |
|
|
|
if (data && data.code === 0) { |
|
|
|
console.log('删除PO明细成功') |
|
|
|
resolve() |
|
|
|
} else { |
|
|
|
reject(new Error(data.msg || '删除PO明细失败')) |
|
|
|
} |
|
|
|
}).catch(error => { |
|
|
|
reject(error) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// Excel导入 |
|
|
|
importExcel () { |
|
|
|
this.uploadDialogVisible = true |
|
|
|
|