From fe44869e3ab926c3e1065145337b79eb6e2fb2cd Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期一, 01 六月 2026 14:00:14 +0800
Subject: [PATCH] feat(shipping): 1.发货的时候需要填出库批号,选入库批号 2.可以按批号,批量入库 3.销售退货将发货单号改成出库批号

---
 src/views/officeProcessAutomation/ApproveManage/approve-list/useApproveList.js |   99 +++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 78 insertions(+), 21 deletions(-)

diff --git a/src/views/officeProcessAutomation/ApproveManage/approve-list/useApproveList.js b/src/views/officeProcessAutomation/ApproveManage/approve-list/useApproveList.js
index 3f0e99c..e6ec8a0 100644
--- a/src/views/officeProcessAutomation/ApproveManage/approve-list/useApproveList.js
+++ b/src/views/officeProcessAutomation/ApproveManage/approve-list/useApproveList.js
@@ -86,6 +86,11 @@
   const approveOpinion = ref("");
   const approveSubmitting = ref(false);
 
+  /** 鎶ヤ环/閲囪喘/鍙戣揣璇︽儏鍔犺浇鐘舵�� */
+  const quotationLoading = ref(false);
+  const purchaseLoading = ref(false);
+  const deliveryLoading = ref(false);
+
   /** 宸梾/璐圭敤鎶ラ攢涓撶敤璇︽儏銆佸鎵瑰脊绐� */
   const reimburseDialog = reactive({
     visible: false,
@@ -294,31 +299,53 @@
     }
     
     detailRow.value = { ...row };
+    const bizType = Number(row.businessType);
     // 鎶ヤ环瀹℃壒锛氱敤瀹℃壒浜嬬敱瀛楁鎵胯浇鐨�"鎶ヤ环鍗曞彿"鍘绘煡鎶ヤ环鍒楄〃
-    if (row.businessType === 6) {
+    if (bizType === 6) {
       const quotationNo = row?.quotationNo;
       if (quotationNo) {
-        const res = await getQuotationList({ quotationNo });
-        const records = res?.data?.records || [];
-        detailData.value = records[0] || {};
+        quotationLoading.value = true;
+        try {
+          const res = await getQuotationList({ quotationNo });
+          const records = res?.data?.records || [];
+          detailData.value = records[0] || {};
+        } finally {
+          quotationLoading.value = false;
+        }
+      } else {
+        detailData.value = {};
       }
     }
     
     // 閲囪喘瀹℃壒锛氱敤瀹℃壒浜嬬敱瀛楁鎵胯浇鐨�"閲囪喘鍚堝悓鍙�"鍘绘煡閲囪喘璇︽儏
-    else if (row.businessType === 5) {
+    else if (bizType === 5) {
       const purchaseContractNumber = row?.purchaseContractNumber;
       if (purchaseContractNumber) {
-        const res = await getPurchaseByCode({ purchaseContractNumber });
-        detailData.value = res || {};
+        purchaseLoading.value = true;
+        try {
+          const res = await getPurchaseByCode({ purchaseContractNumber });
+          detailData.value = res || {};
+        } finally {
+          purchaseLoading.value = false;
+        }
+      } else {
+        detailData.value = {};
       }
     }
     
     // 鍙戣揣瀹℃壒锛氱敤瀹℃壒浜嬬敱瀛楁鎵胯浇鐨�"鍙戣揣鍗曞彿"鍘绘煡鍙戣揣璇︽儏
-    else if (row.businessType === 7) {
+    else if (bizType === 7) {
       const shippingNo = row?.shippingNo;
       if (shippingNo) {
-        const res = await getDeliveryDetailByShippingNo({ shippingNo });
-        detailData.value = res?.data || res || {};
+        deliveryLoading.value = true;
+        try {
+          const res = await getDeliveryDetailByShippingNo({ shippingNo });
+          detailData.value = res?.data || res || {};
+        } finally {
+          deliveryLoading.value = false;
+        }
+      } else {
+        detailData.value = {};
       }
     }
     
@@ -339,31 +366,53 @@
     }
     approveDialog.row = { ...row };
     approveOpinion.value = "";
+    const bizType = Number(row.businessType);
     // 鎶ヤ环瀹℃壒锛氱敤瀹℃壒浜嬬敱瀛楁鎵胯浇鐨�"鎶ヤ环鍗曞彿"鍘绘煡鎶ヤ环鍒楄〃
-    if (row.businessType === 6) {
+    if (bizType === 6) {
       const quotationNo = row?.quotationNo;
       if (quotationNo) {
-        const res = await getQuotationList({ quotationNo });
-        const records = res?.data?.records || [];
-        detailData.value = records[0] || {};
+        quotationLoading.value = true;
+        try {
+          const res = await getQuotationList({ quotationNo });
+          const records = res?.data?.records || [];
+          detailData.value = records[0] || {};
+        } finally {
+          quotationLoading.value = false;
+        }
+      } else {
+        detailData.value = {};
       }
     }
 
     // 閲囪喘瀹℃壒锛氱敤瀹℃壒浜嬬敱瀛楁鎵胯浇鐨�"閲囪喘鍚堝悓鍙�"鍘绘煡閲囪喘璇︽儏
-    else if (row.businessType === 5) {
+    else if (bizType === 5) {
       const purchaseContractNumber = row?.purchaseContractNumber;
       if (purchaseContractNumber) {
-        const res = await getPurchaseByCode({ purchaseContractNumber });
-        detailData.value = res || {};
+        purchaseLoading.value = true;
+        try {
+          const res = await getPurchaseByCode({ purchaseContractNumber });
+          detailData.value = res || {};
+        } finally {
+          purchaseLoading.value = false;
+        }
+      } else {
+        detailData.value = {};
       }
     }
 
     // 鍙戣揣瀹℃壒锛氱敤瀹℃壒浜嬬敱瀛楁鎵胯浇鐨�"鍙戣揣鍗曞彿"鍘绘煡鍙戣揣璇︽儏
-    else if (row.businessType === 7) {
+    else if (bizType === 7) {
       const shippingNo = row?.shippingNo;
       if (shippingNo) {
-        const res = await getDeliveryDetailByShippingNo({ shippingNo });
-        detailData.value = res?.data || res || {};
+        deliveryLoading.value = true;
+        try {
+          const res = await getDeliveryDetailByShippingNo({ shippingNo });
+          detailData.value = res?.data || res || {};
+        } finally {
+          deliveryLoading.value = false;
+        }
+      } else {
+        detailData.value = {};
       }
     }
 
@@ -615,8 +664,13 @@
     if (approveSubmitting.value) return { ok: false };
     approveSubmitting.value = true;
     try {
+      // 鍙戣揣瀹℃壒鏃朵紶閫掑嚭搴撴壒鍙�
+      const extraData = {};
+      if (Number(row.businessType) === 7 && detailData.value?.shippingInfo?.outboundBatches) {
+        extraData.outboundBatches = detailData.value.shippingInfo.outboundBatches;
+      }
       await approveApprovalInstance(
-        buildApproveInstanceDto(row, result, approveOpinion.value)
+        buildApproveInstanceDto(row, result, approveOpinion.value, extraData)
       );
       approveDialog.visible = false;
       await fetchApprovalList();
@@ -658,6 +712,9 @@
     detailDialog,
     detailRow,
     detailData,
+    quotationLoading,
+    purchaseLoading,
+    deliveryLoading,
     reimburseDialog,
     approveDialog,
     approveOpinion,

--
Gitblit v1.9.3