From 6e6197efec5666d769cf83dfcece247a5c6e383e Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期三, 02 九月 2026 19:12:00 +0800
Subject: [PATCH] Merge branch 'dev_天津_潜宇塑胶' of http://114.132.189.42:9002/r/product-inventory-management into dev_天津_潜宇塑胶
---
src/views/productionManagement/workOrderManagement/index.vue | 83 ++++++++++++++++++++++++++++++++++++++++-
1 files changed, 81 insertions(+), 2 deletions(-)
diff --git a/src/views/productionManagement/workOrderManagement/index.vue b/src/views/productionManagement/workOrderManagement/index.vue
index 704bcbf..4a09b32 100644
--- a/src/views/productionManagement/workOrderManagement/index.vue
+++ b/src/views/productionManagement/workOrderManagement/index.vue
@@ -27,10 +27,16 @@
</div>
</div>
<div class="table_list">
+ <div style="margin-bottom: 10px; text-align: left;">
+ <el-button type="primary"
+ @click="handleBatchReport">涓�閿姤宸�</el-button>
+ </div>
<PIMTable rowKey="id"
:column="tableColumn"
:tableData="tableData"
:page="page"
+ :isSelection="true"
+ @selection-change="handleSelectionChange"
:tableLoading="tableLoading"
@pagination="pagination">
<template #completionStatus="{ row }">
@@ -409,6 +415,7 @@
]);
const tableData = ref([]);
const tableLoading = ref(false);
+ const selectedRows = ref([]);
const transferCardVisible = ref(false);
const transferCardData = ref([]);
const transferCardQrUrl = ref("");
@@ -686,8 +693,7 @@
toQuantity(planQuantity - completeQuantity)
);
reportForm.planQuantity = remainingQuantity;
- reportForm.quantity =
- row.quantity !== undefined && row.quantity !== null ? row.quantity : null;
+ reportForm.quantity = remainingQuantity;
reportForm.productProcessRouteItemId = row.productProcessRouteItemId;
reportForm.workOrderId = row.id;
reportForm.reportWork = row.reportWork;
@@ -824,6 +830,79 @@
reportForm.userName = user ? user.nickName : "";
};
+ // 琛ㄦ牸閫夋嫨鍙樺寲
+ const handleSelectionChange = selection => {
+ selectedRows.value = selection;
+ };
+
+ // 涓�閿姤宸ワ細鍕鹃�夋暟鎹悗锛岀敓浜у悎鏍兼暟閲忛粯璁ょ瓑浜庡緟鐢熶骇鏁伴噺锛岀洿鎺ユ彁浜�
+ const handleBatchReport = async () => {
+ if (selectedRows.value.length === 0) {
+ proxy.$modal.msgWarning("璇峰厛鍕鹃�夎鎶ュ伐鐨勫伐鍗�");
+ return;
+ }
+
+ // 杩囨护鍑哄彲鎶ュ伐鐨勫伐鍗曪細鏈畬宸ヤ笖寰呯敓浜ф暟閲� > 0
+ const validRows = selectedRows.value.filter(row => {
+ if (row.endOrder) return false;
+ const planQuantity = Number(row.planQuantity || 0);
+ const completeQuantity = Number(row.completeQuantity || 0);
+ return toQuantity(planQuantity - completeQuantity) > 0;
+ });
+
+ if (validRows.length === 0) {
+ proxy.$modal.msgWarning("鎵�閫夊伐鍗曞潎鏃犲緟鐢熶骇鏁伴噺锛屾棤娉曟姤宸�");
+ return;
+ }
+
+ const buildSubmitParams = (row, quantity) => ({
+ quantity,
+ scrapQty: 0,
+ userId: 329,
+ userName: "瀛欑珛鏉�",
+ productionOperationTaskId: row.id,
+ productProcessRouteItemId: row.productProcessRouteItemId,
+ reportWork: row.reportWork,
+ productMainId: row.productMainId,
+ productionOrderRoutingOperationId: row.productionOrderRoutingOperationId,
+ productionOrderId: row.productionOrderId,
+ workHour: row.type == 0 ? row.workHour || 0 : 0,
+ productionOperationParamList: [],
+ });
+
+ // 寰呯敓浜ф暟閲忚秴杩囦竴涓囨椂锛屾瘡娆″彧鎶� 5000锛屾媶鍒嗘垚澶氱瑪鎻愪氦
+ const tasks = [];
+ validRows.forEach(row => {
+ const planQuantity = Number(row.planQuantity || 0);
+ const completeQuantity = Number(row.completeQuantity || 0);
+ let remaining = Math.max(0, toQuantity(planQuantity - completeQuantity));
+ while (remaining > 10000) {
+ tasks.push(buildSubmitParams(row, 5000));
+ remaining = toQuantity(remaining - 5000);
+ }
+ if (remaining > 0) {
+ tasks.push(buildSubmitParams(row, remaining));
+ }
+ });
+
+ const results = await Promise.allSettled(
+ tasks.map(params => addProductMain(params))
+ );
+
+ const successCount = results.filter(r => r.status === "fulfilled").length;
+ const failCount = results.filter(r => r.status === "rejected").length;
+
+ if (failCount === 0) {
+ proxy.$modal.msgSuccess(`涓�閿姤宸ユ垚鍔燂紝鍏� ${successCount} 绗擿);
+ } else {
+ proxy.$modal.msgWarning(
+ `涓�閿姤宸ュ畬鎴愶細鎴愬姛 ${successCount} 绗旓紝澶辫触 ${failCount} 绗擿
+ );
+ }
+ selectedRows.value = [];
+ getList();
+ };
+
const getDictOptions = async dictType => {
if (!dictType) return [];
if (dictOptions.value[dictType]) return dictOptions.value[dictType];
--
Gitblit v1.9.3