From f09bee24a56656f329ba51e7e95cc5f9bbc819a2 Mon Sep 17 00:00:00 2001 From: fengyuan_yang <1976974459@qq.com> Date: Thu, 30 Oct 2025 09:45:42 +0800 Subject: [PATCH] =?UTF-8?q?2025-10-30=20=E7=94=9F=E4=BA=A7=E6=B4=BE?= =?UTF-8?q?=E5=B7=A5=E5=8D=95=E5=88=97=E8=A1=A8=E6=94=AF=E6=8C=81=E6=8B=96?= =?UTF-8?q?=E6=8B=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../searchProductionDispatchList.vue | 65 +++++-------------- 1 file changed, 17 insertions(+), 48 deletions(-) diff --git a/src/views/modules/shopOrder/productionOrderScheduling/searchProductionDispatchList.vue b/src/views/modules/shopOrder/productionOrderScheduling/searchProductionDispatchList.vue index d2d48c7..d95ca79 100644 --- a/src/views/modules/shopOrder/productionOrderScheduling/searchProductionDispatchList.vue +++ b/src/views/modules/shopOrder/productionOrderScheduling/searchProductionDispatchList.vue @@ -95,6 +95,7 @@ { - console.log(` 位置${idx}: ${item.orderNo}-工序${item.itemNo} | SeqNo:${item.seqNo} | serial_number:${item.serialNumber}`); - }); - // 重新分配序号并保存到后端 this.reassignSerialNumbers(oldIndex, newIndex); }, @@ -1066,12 +1056,11 @@ export default { // 只更新序号发生变化的记录 if (item.serialNumber !== newSerialNumber) { - console.log(`更新序号: ${item.orderNo}-工序${item.itemNo}-SeqNo${item.seqNo} 从 ${item.serialNumber} 改为 ${newSerialNumber}`); updateList.push({ site: item.site, orderNo: item.orderNo, itemNo: item.itemNo, - scheduleSeqNo: item.seqNo, // 使用 seqNo(派工单号),而不是 sScheduledSeqNo + scheduleSeqNo: item.seqNo, resourceId: item.sResourceID, serialNumber: newSerialNumber, }); @@ -1079,40 +1068,27 @@ export default { }); }); - console.log('需要更新的记录数:', updateList.length); - console.log('更新列表:', updateList); - // 如果有需要更新的记录,调用后端接口 if (updateList.length > 0) { this.saveSortOrder(updateList); - } else { - console.log('没有需要更新的记录'); } }, /*保存排序到后端*/ saveSortOrder(updateList) { - console.log('调用后端接口,更新序号...'); - console.log('请求数据:', JSON.stringify(updateList, null, 2)); - batchUpdateSerialNumber(updateList).then(({data}) => { - console.log('后端响应:', data); - if (data.code === 0) { this.$message.success('排序保存成功'); - console.log('排序保存成功,准备刷新列表'); // 成功后刷新列表,并定位到拖拽的行 this.refreshAndLocate(); } else { - console.error('排序保存失败:', data.msg); this.$message.error(data.msg || '排序保存失败'); // 失败时重新加载数据 this.getData(); this.draggedItem = null; } }).catch(error => { - console.error('后端接口调用异常:', error); - this.$message.error('排序保存失败: ' + error.message); + this.$message.error('排序保存失败'); // 失败时重新加载数据 this.getData(); this.draggedItem = null; @@ -1121,17 +1097,11 @@ export default { /*刷新列表并定位到拖拽的行*/ refreshAndLocate() { - console.log('开始刷新列表并定位...'); - // 刷新数据,等待加载完成 this.getData().then(() => { - console.log('数据刷新完成,开始定位'); - // 等待DOM更新后定位 this.$nextTick(() => { if (this.draggedItem) { - console.log('查找拖拽项:', this.draggedItem); - // 在刷新后的数据中找到拖拽的项目 const targetIndex = this.dataList.findIndex(item => item.site === this.draggedItem.site && @@ -1140,11 +1110,8 @@ export default { item.seqNo === this.draggedItem.seqNo ); - console.log('找到目标行索引:', targetIndex); - if (targetIndex !== -1) { const targetItem = this.dataList[targetIndex]; - console.log('目标行信息:', targetItem.orderNo, '序号:', targetItem.serialNumber); // 找到目标行,设置为当前选中行 this.scheduleRow = targetItem; @@ -1163,12 +1130,9 @@ export default { // 触发行点击事件,高亮显示 rows[targetIndex].click(); - console.log('已定位到目标行'); } } }); - } else { - console.log('未找到目标行'); } // 清除拖拽记录 @@ -1176,7 +1140,6 @@ export default { } }); }).catch(error => { - console.error('刷新数据失败:', error); this.draggedItem = null; }); }, @@ -1224,13 +1187,19 @@ export default { _timestamp: new Date().getTime() }; return searchProductionDispatchList(searchDataWithTimestamp).then(({data}) => { - this.dataList = data.rows; - console.log('数据加载完成,共', data.rows.length, '条记录'); + // 先清空数据列表,强制表格重新渲染 + this.dataList = []; - // 打印前10条记录的序号(用于调试) - console.log('前10条记录的序号:'); - data.rows.slice(0, 10).forEach((item, idx) => { - console.log(` ${idx}: ${item.orderNo}-工序${item.itemNo} | SeqNo:${item.seqNo} | serial_number:${item.serialNumber} | S_ScheduledSeqNo:${item.sScheduledSeqNo}`); + // 在下一个tick中设置数据并清除排序 + this.$nextTick(() => { + this.dataList = data.rows; + + // 再等一个tick确保DOM更新完成 + this.$nextTick(() => { + if (this.$refs.dispatchTable) { + this.$refs.dispatchTable.clearSort(); + } + }); }); return data.rows;