From 57bcf0bc0dad6758df94717963187d6b6122afaa Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期三, 22 四月 2026 17:23:08 +0800
Subject: [PATCH] 1

---
 src/views/collaborativeApproval/approvalProcess/components/approvalDia.vue |  162 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 161 insertions(+), 1 deletions(-)

diff --git a/src/views/collaborativeApproval/approvalProcess/components/approvalDia.vue b/src/views/collaborativeApproval/approvalProcess/components/approvalDia.vue
index 173a375..7ce5b4d 100644
--- a/src/views/collaborativeApproval/approvalProcess/components/approvalDia.vue
+++ b/src/views/collaborativeApproval/approvalProcess/components/approvalDia.vue
@@ -33,7 +33,7 @@
             </el-form-item>
           </el-col>
         </el-row>
-        <el-row v-if="!isQuotationApproval && !isPurchaseApproval">
+        <el-row v-if="!isQuotationApproval && !isPurchaseApproval && !isInboundApproval">
           <el-col :span="24">
             <el-form-item :label="props.approveType == 5 ? '閲囪喘鍚堝悓鍙凤細' : '瀹℃壒浜嬬敱锛�'"
                           prop="approveReason">
@@ -198,6 +198,39 @@
           </template>
         </el-skeleton>
       </div>
+      <!-- 鍏ュ簱瀹℃壒锛氬睍绀哄叆搴撹鎯� -->
+      <div v-if="isInboundApproval"
+           style="margin: 10px 0 18px;">
+        <el-divider content-position="left">鍏ュ簱璇︽儏</el-divider>
+        <el-skeleton :loading="stockInLoading"
+                     animated>
+          <template #template>
+            <el-skeleton-item variant="h3"
+                              style="width: 30%" />
+            <el-skeleton-item variant="text"
+                              style="width: 100%" />
+            <el-skeleton-item variant="text"
+                              style="width: 100%" />
+          </template>
+          <template #default>
+            <el-empty v-if="!currentStockInOrder || !Object.keys(currentStockInOrder).length"
+                      description="鏈煡璇㈠埌瀵瑰簲鍏ュ簱璇︽儏" />
+            <template v-else>
+              <el-descriptions :column="2"
+                               border>
+                <el-descriptions-item label="閿�鍞悎鍚屽彿">{{ currentStockInOrder.salesContractNo || "-" }}</el-descriptions-item>
+                <el-descriptions-item label="瀹㈡埛鍚嶇О">{{ currentStockInOrder.customerName || "-" }}</el-descriptions-item>
+                <el-descriptions-item label="椤圭洰鍚嶇О">{{ currentStockInOrder.projectName || "-" }}</el-descriptions-item>
+                <el-descriptions-item label="浜у搧鍚嶇О">{{ inboundProductSummary.productName }}</el-descriptions-item>
+                <el-descriptions-item label="瑙勬牸鍨嬪彿">{{ inboundProductSummary.specification }}</el-descriptions-item>
+                <el-descriptions-item label="鍗曚綅">{{ inboundProductSummary.unit }}</el-descriptions-item>
+                <el-descriptions-item label="鏁伴噺">{{ inboundProductSummary.quantity }}</el-descriptions-item>
+                <el-descriptions-item label="涓氬姟鍛�">{{ currentStockInOrder.salesman || "-" }}</el-descriptions-item>
+              </el-descriptions>
+            </template>
+          </template>
+        </el-skeleton>
+      </div>
       <el-form :model="{ activities }"
                ref="formRef"
                label-position="top">
@@ -288,6 +321,8 @@
   } from "vue";
   import {
     approveProcessDetails,
+    getStockInOrderInfo,
+    getStockInProductList,
     getDept,
     updateApproveNode,
   } from "@/api/collaborativeApproval/approvalProcess.js";
@@ -322,8 +357,97 @@
   const currentQuotation = ref({});
   const purchaseLoading = ref(false);
   const currentPurchase = ref({});
+  const stockInLoading = ref(false);
+  const currentStockInOrder = ref({});
+  const stockInProductList = ref([]);
   const isQuotationApproval = computed(() => Number(props.approveType) === 6);
   const isPurchaseApproval = computed(() => Number(props.approveType) === 5);
+  const isInboundApproval = computed(() => Number(props.approveType) === 9);
+  const inboundProductSummary = computed(() => {
+    if (!stockInProductList.value.length) {
+      return {
+        productName: "-",
+        specification: "-",
+        unit: "-",
+        quantity: "-",
+      };
+    }
+    const pickUniqueJoin = key => {
+      const values = stockInProductList.value
+        .map(item => item[key])
+        .filter(v => v !== undefined && v !== null && v !== "" && v !== "-");
+      const uniqueValues = [...new Set(values)];
+      return uniqueValues.length ? uniqueValues.join("銆�") : "-";
+    };
+    let hasNumericQuantity = false;
+    const quantityTotal = stockInProductList.value.reduce((sum, item) => {
+      const raw = item.quantityDisplay;
+      const num = Number(raw);
+      if (Number.isFinite(num)) {
+        hasNumericQuantity = true;
+        return sum + num;
+      }
+      return sum;
+    }, 0);
+    return {
+      productName: pickUniqueJoin("productNameDisplay"),
+      specification: pickUniqueJoin("specificationDisplay"),
+      unit: pickUniqueJoin("unitDisplay"),
+      quantity: hasNumericQuantity ? String(quantityTotal) : "-",
+    };
+  });
+
+  const getFirstValidValue = (item, keys) => {
+    for (const key of keys) {
+      const value = item?.[key];
+      if (value !== undefined && value !== null && value !== "") {
+        return value;
+      }
+    }
+    return "-";
+  };
+
+  const formatStockInProductItem = item => {
+    const unitPrice = getFirstValidValue(item, [
+      "unitPrice",
+      "taxInclusiveUnitPrice",
+      "price",
+      "purchasePrice",
+      "inPrice",
+    ]);
+    const amount = getFirstValidValue(item, [
+      "amount",
+      "totalPrice",
+      "taxInclusiveTotalPrice",
+      "totalAmount",
+      "subtotal",
+    ]);
+    return {
+      ...item,
+      productNameDisplay: getFirstValidValue(item, [
+        "productName",
+        "productCategory",
+        "materialName",
+        "name",
+      ]),
+      specificationDisplay: getFirstValidValue(item, [
+        "specificationModel",
+        "specification",
+        "model",
+      ]),
+      unitDisplay: getFirstValidValue(item, ["unit"]),
+      quantityDisplay: getFirstValidValue(item, [
+        "quantity",
+        "stockedQuantity",
+        "inboundQuantity",
+        "stockInQuantity",
+        "num",
+      ]),
+      priceDisplay:
+        unitPrice === "-" ? "-" : `楼${Number(unitPrice || 0).toFixed(2)}`,
+      amountDisplay: amount === "-" ? "-" : `楼${Number(amount || 0).toFixed(2)}`,
+    };
+  };
 
   const data = reactive({
     form: {
@@ -364,6 +488,8 @@
     dialogFormVisible.value = true;
     currentQuotation.value = {};
     currentPurchase.value = {};
+    currentStockInOrder.value = {};
+    stockInProductList.value = [];
     approveUserList({ approveType: props.approveType }).then(res => {
       userList.value = res.data;
     });
@@ -430,6 +556,37 @@
       }
     }
 
+    // 鍏ュ簱瀹℃壒锛氶�氳繃娴佺▼缂栧彿鏌ヨ鍏ュ簱璇︽儏涓庢槑缁�
+    if (isInboundApproval.value) {
+      const approveId = row?.approveId;
+      if (approveId) {
+        stockInLoading.value = true;
+        Promise.all([
+          getStockInOrderInfo({ approveId }),
+          getStockInProductList({ approveId }),
+        ])
+          .then(([orderRes, productRes]) => {
+            currentStockInOrder.value = orderRes?.data?.orderInfo || {};
+            const list = productRes?.data;
+            const rawList = Array.isArray(list)
+              ? list
+              : Array.isArray(list?.records)
+              ? list.records
+              : [];
+            stockInProductList.value = rawList.map(item =>
+              formatStockInProductItem(item)
+            );
+          })
+          .catch(err => {
+            console.error("鏌ヨ鍏ュ簱璇︽儏澶辫触:", err);
+            proxy.$modal.msgError("鏌ヨ鍏ュ簱璇︽儏澶辫触");
+          })
+          .finally(() => {
+            stockInLoading.value = false;
+          });
+      }
+    }
+
     approveProcessDetails(row.approveId).then(res => {
       activities.value = res.data;
       // 澧炲姞isApproval瀛楁
@@ -485,6 +642,9 @@
     currentQuotation.value = {};
     purchaseLoading.value = false;
     currentPurchase.value = {};
+    stockInLoading.value = false;
+    currentStockInOrder.value = {};
+    stockInProductList.value = [];
     emit("close");
   };
   defineExpose({

--
Gitblit v1.9.3