From b50f9aa8c466a084d63701237ca64589ac06d870 Mon Sep 17 00:00:00 2001 From: qiankanghui Date: Thu, 3 Sep 2026 11:12:47 +0800 Subject: [PATCH] =?UTF-8?q?fix(quality):=20=E4=BF=AE=E5=A4=8D=E8=B4=A8?= =?UTF-8?q?=E9=87=8F=E9=97=AE=E9=A2=98PO=E5=85=B3=E8=81=94=E8=A1=A8?= =?UTF-8?q?=E6=A0=BC=E5=AD=97=E6=AE=B5=E6=98=A0=E5=B0=84=E5=92=8C=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=8B=BE=E9=80=89=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将表格列prop从poNo改为orderRef1以匹配正确的数据字段 - 添加已关联PO的自动勾选逻辑,在表格初始化后自动选中已绑定的行 - 新增isRowLinked方法判断PO列表中的行是否已关联到当前质量问题 - 修改handleSavePo方法中poNo字段映射,使用row.orderNo作为真实的PO号 - 添加注释说明后端数据结构和全量覆盖策略的实现细节 --- .../quality/com_qualityIssuePoList.vue | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/views/modules/quality/com_qualityIssuePoList.vue b/src/views/modules/quality/com_qualityIssuePoList.vue index 7f3afbb..c2b23e8 100644 --- a/src/views/modules/quality/com_qualityIssuePoList.vue +++ b/src/views/modules/quality/com_qualityIssuePoList.vue @@ -14,7 +14,7 @@ :height="tableHeight" :header-cell-style="{ textAlign: 'center' }"> @@ -332,6 +332,12 @@ export default { this.$nextTick(() => { if (this.$refs.availablePoTable) { this.$refs.availablePoTable.clearSelection() + // 将已关联到当前质量问题的PO自动勾选 + this.availablePoList.forEach(row => { + if (this.isRowLinked(row)) { + this.$refs.availablePoTable.toggleRowSelection(row, true) + } + }) } }) if (this.availablePoList.length === 0) { @@ -350,12 +356,26 @@ export default { }) }, + // 判断可用PO列表中的某行是否已关联到当前质量问题 + // 后端 getAvailablePoList 返回的真实 PO 号为 orderNo,而 srm_quality_issue_po 中存的 poNo 实际就是 orderNo + isRowLinked(row) { + if (!row || !this.issuePoList || this.issuePoList.length === 0) { + return false + } + return this.issuePoList.some(item => + item.poNo === row.orderNo && String(item.itemNo) === String(row.itemNo) + ) + }, + // 选择行变化 handleSelectionChange(selection) { this.selectedPoRows = selection }, // 保存选中的PO + // 后端 bindIssuePo 采用"全量覆盖"策略(先 deleteByIssueNo 再 batchInsert), + // 因此前端需将弹窗中当前勾选的所有 PO 全量提交,不能过滤已关联的行, + // 否则后端会把未提交的旧关联一并删除。 handleSavePo() { if (this.selectedPoRows.length === 0) { this.$message.warning('请至少选择一条PO记录') @@ -376,8 +396,9 @@ export default { return } + // 后端 DTO 中 poNo 字段实际存的是真实 PO 号(前端 row.orderNo),row.poNo 仅用于展示 const poList = this.selectedPoRows.map(row => ({ - poNo: row.poNo, + poNo: row.orderNo, itemNo: row.itemNo, partNo: row.partNo, qty: row.qty