From aa802302cfe650e08806c8b87d5a8c5d3a79ffe1 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期二, 12 五月 2026 04:32:11 +0800
Subject: [PATCH] Merge branch 'dev_河南_鹤壁天沐玻璃厂' of http://114.132.189.42:9002/r/product-inventory-management into dev_河南_鹤壁天沐玻璃厂

---
 src/views/salesManagement/salesLedger/index.vue |  208 +++++++++++++++++++++++++++++++--------------------
 1 files changed, 125 insertions(+), 83 deletions(-)

diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue
index 083d3db..3914dd9 100644
--- a/src/views/salesManagement/salesLedger/index.vue
+++ b/src/views/salesManagement/salesLedger/index.vue
@@ -64,10 +64,14 @@
                        :value="1" />
             <el-option label="瀹℃壒涓�"
                        :value="2" />
-            <el-option label="瀹℃壒澶辫触"
+            <el-option label="瀹℃壒涓嶉�氳繃"
                        :value="3" />
-            <el-option label="宸插彂璐�"
+            <el-option label="瀹℃壒閫氳繃"
                        :value="4" />
+            <el-option label="宸插彂璐�"
+                       :value="5" />
+            <el-option label="閮ㄥ垎鍙戣揣"
+                       :value="6" />
           </el-select>
         </el-form-item>
         <el-form-item label="鍏ュ簱鐘舵�侊細">
@@ -118,8 +122,8 @@
             </el-button>
             <template #dropdown>
               <el-dropdown-menu>
-                <el-dropdown-item command="notShipped">鏈彂璐�</el-dropdown-item>
-                <el-dropdown-item command="shipped">宸插彂璐�</el-dropdown-item>
+                <el-dropdown-item command="notShipped">鏈嚭搴�</el-dropdown-item>
+                <el-dropdown-item command="shipped">宸插嚭搴�</el-dropdown-item>
               </el-dropdown-menu>
             </template>
           </el-dropdown>
@@ -158,7 +162,7 @@
                 style="width: 100%"
                 :summary-method="summarizeMainTable"
                 @expand-change="expandChange"
-                height="calc(100vh - 18.5em)">
+                height="calc(100vh - 22em)">
         <el-table-column align="center"
                          type="selection"
                          width="55"
@@ -238,6 +242,8 @@
                 <template #default="scope">
                   <el-tag v-if="scope.row.approveStatus === 1 && (!scope.row.shippingDate || !scope.row.shippingCarNumber)"
                           type="success">鍏呰冻</el-tag>
+                  <el-tag v-else-if="scope.row.approveStatus === 1 && scope.row.shippingDate && scope.row.shippingCarNumber"
+                          type="success">宸插嚭搴�</el-tag>
                   <el-tag v-else-if="scope.row.approveStatus === 0 && (scope.row.shippingDate || scope.row.shippingCarNumber)"
                           type="success">宸插嚭搴�</el-tag>
                   <el-tag v-else
@@ -369,6 +375,8 @@
                     type="primary">瀹℃壒閫氳繃</el-tag>
             <el-tag v-else-if="Number(scope.row.deliveryStatus) === 5"
                     type="success">宸插彂璐�</el-tag>
+            <el-tag v-else-if="Number(scope.row.deliveryStatus) === 6"
+                    type="warning">閮ㄥ垎鍙戣揣</el-tag>
             <el-tag v-else
                     type="info">-</el-tag>
           </template>
@@ -383,6 +391,8 @@
                     type="success">閮ㄥ垎鍏ュ簱</el-tag>
             <el-tag v-else-if="Number(scope.row.stockStatus) === 2"
                     type="success">宸插叆搴�</el-tag>
+            <el-tag v-else-if="Number(scope.row.stockStatus) === 3"
+                    type="warning">瀹℃壒涓�</el-tag>
             <el-tag v-else
                     type="info">-</el-tag>
           </template>
@@ -658,6 +668,36 @@
               <span v-else>{{ scope.row.thickness ?? "" }}</span>
             </template>
           </el-table-column>
+          <el-table-column label="妤煎眰缂栧彿"
+                           prop="floorCode"
+                           min-width="250"
+                           show-overflow-tooltip>
+            <template #default="scope">
+              <el-input v-if="scope.row.__editing"
+                        v-model="scope.row.floorCode"
+                        placeholder="璇疯緭鍏�"
+                        clearable
+                        style="width: 100%" />
+              <span v-else>{{ scope.row.floorCode ?? "" }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column label="鍚◣鍗曚环(鍏�)"
+                           prop="taxInclusiveUnitPrice"
+                           min-width="160">
+            <template #default="scope">
+              <el-input-number v-if="scope.row.__editing"
+                               :step="0.01"
+                               :min="0"
+                               :precision="2"
+                               style="width: 100%"
+                               v-model="scope.row.taxInclusiveUnitPrice"
+                               placeholder="璇疯緭鍏�"
+                               clearable
+                               @change="() => handleInlineUnitPriceChange(scope.row)"
+                               @input="() => handleInlineUnitPriceChange(scope.row)" />
+              <span v-else>{{ formattedNumber(null, null, scope.row.taxInclusiveUnitPrice) }}</span>
+            </template>
+          </el-table-column>
           <el-table-column label="瀹�(mm)"
                            prop="width"
                            min-width="160">
@@ -694,23 +734,6 @@
               <span v-else>{{ scope.row.height ?? "" }}</span>
             </template>
           </el-table-column>
-          <el-table-column label="缁撶畻鍗曠墖闈㈢Н(銕�)"
-                           prop="settlePieceArea"
-                           min-width="200">
-            <template #default="scope">
-              <el-input-number v-if="scope.row.__editing"
-                               controls-position="right"
-                               v-model="scope.row.settlePieceArea"
-                               :min="0"
-                               :step="1"
-                               :precision="4"
-                               style="width: 100%"
-                               placeholder="璇疯緭鍏�"
-                               clearable
-                               @change="() => handleInlineSettleAreaChange(scope.row)" />
-              <span v-else>{{ scope.row.settlePieceArea ? Number(scope.row.settlePieceArea).toFixed(4) : "" }}</span>
-            </template>
-          </el-table-column>
           <el-table-column label="鏁伴噺"
                            prop="quantity"
                            min-width="150">
@@ -729,6 +752,23 @@
               <span v-else>{{ scope.row.quantity ?? "" }}</span>
             </template>
           </el-table-column>
+          <el-table-column label="缁撶畻鍗曠墖闈㈢Н(銕�)"
+                           prop="settlePieceArea"
+                           min-width="200">
+            <template #default="scope">
+              <el-input-number v-if="scope.row.__editing"
+                               controls-position="right"
+                               v-model="scope.row.settlePieceArea"
+                               :min="0"
+                               :step="1"
+                               :precision="4"
+                               style="width: 100%"
+                               placeholder="璇疯緭鍏�"
+                               clearable
+                               @change="() => handleInlineSettleAreaChange(scope.row)" />
+              <span v-else>{{ scope.row.settlePieceArea ? Number(scope.row.settlePieceArea).toFixed(4) : "" }}</span>
+            </template>
+          </el-table-column>
           <el-table-column label="闈㈢Н(m虏)"
                            prop="actualTotalArea"
                            min-width="200">
@@ -742,23 +782,6 @@
                                style="width: 100%"
                                placeholder="鑷姩璁$畻" />
               <span v-else>{{ scope.row.actualTotalArea ? Number(scope.row.actualTotalArea).toFixed(4) : "" }}</span>
-            </template>
-          </el-table-column>
-          <el-table-column label="鍚◣鍗曚环(鍏�)"
-                           prop="taxInclusiveUnitPrice"
-                           min-width="160">
-            <template #default="scope">
-              <el-input-number v-if="scope.row.__editing"
-                               :step="0.01"
-                               :min="0"
-                               :precision="2"
-                               style="width: 100%"
-                               v-model="scope.row.taxInclusiveUnitPrice"
-                               placeholder="璇疯緭鍏�"
-                               clearable
-                               @change="() => handleInlineUnitPriceChange(scope.row)"
-                               @input="() => handleInlineUnitPriceChange(scope.row)" />
-              <span v-else>{{ formattedNumber(null, null, scope.row.taxInclusiveUnitPrice) }}</span>
             </template>
           </el-table-column>
           <el-table-column label="绋庣巼(%)"
@@ -793,6 +816,19 @@
                            prop="taxExclusiveTotalPrice"
                            :formatter="formattedNumber"
                            min-width="120" />
+          <el-table-column label="鍔犲伐瑕佹眰"
+                           prop="processRequirement"
+                           min-width="160"
+                           show-overflow-tooltip>
+            <template #default="scope">
+              <el-input v-if="scope.row.__editing"
+                        v-model="scope.row.processRequirement"
+                        placeholder="璇疯緭鍏�"
+                        clearable
+                        style="width: 100%" />
+              <span v-else>{{ scope.row.processRequirement ?? "" }}</span>
+            </template>
+          </el-table-column>     
           <el-table-column label="鍙戠エ绫诲瀷"
                            prop="invoiceType"
                            min-width="120">
@@ -810,19 +846,6 @@
               <span v-else>{{ scope.row.invoiceType ?? "" }}</span>
             </template>
           </el-table-column>
-          <el-table-column label="鍔犲伐瑕佹眰"
-                           prop="processRequirement"
-                           min-width="160"
-                           show-overflow-tooltip>
-            <template #default="scope">
-              <el-input v-if="scope.row.__editing"
-                        v-model="scope.row.processRequirement"
-                        placeholder="璇疯緭鍏�"
-                        clearable
-                        style="width: 100%" />
-              <span v-else>{{ scope.row.processRequirement ?? "" }}</span>
-            </template>
-          </el-table-column>
           <el-table-column label="澶囨敞"
                            prop="remark"
                            min-width="140"
@@ -834,19 +857,6 @@
                         clearable
                         style="width: 100%" />
               <span v-else>{{ scope.row.remark ?? "" }}</span>
-            </template>
-          </el-table-column>
-          <el-table-column label="妤煎眰缂栧彿"
-                           prop="floorCode"
-                           min-width="250"
-                           show-overflow-tooltip>
-            <template #default="scope">
-              <el-input v-if="scope.row.__editing"
-                        v-model="scope.row.floorCode"
-                        placeholder="璇疯緭鍏�"
-                        clearable
-                        style="width: 100%" />
-              <span v-else>{{ scope.row.floorCode ?? "" }}</span>
             </template>
           </el-table-column>
           <el-table-column label="閲嶇"
@@ -1999,7 +2009,7 @@
       entryDate: null, // 褰曞叆鏃ユ湡
       entryDateStart: undefined,
       entryDateEnd: undefined,
-      deliveryStatus: undefined, // 鍙戣揣鐘舵�侊細1鏈彂璐� 2瀹℃壒涓� 3瀹℃壒澶辫触 4宸插彂璐�
+      deliveryStatus: undefined, // 鍙戣揣鐘舵�侊細1鏈彂璐� 2瀹℃壒涓� 3瀹℃壒涓嶉�氳繃 4瀹℃壒閫氳繃 5宸插彂璐� 6閮ㄥ垎鍙戣揣
       stockStatus: undefined, // 鍏ュ簱鐘舵�侊細0鏈叆搴� 1閮ㄥ垎鍏ュ簱 2宸插叆搴�
     },
     form: {
@@ -2212,10 +2222,17 @@
       row.thickness !== null && row.thickness !== undefined && row.thickness !== ""
         ? Number(row.thickness)
         : null;
+    copied.floorCode = row?.floorCode ?? row?.floor_code ?? "";
 
-    // 澶嶅埗鏂板缓浠呭甫鍑轰骇鍝佸ぇ绫讳笌瑙勬牸鍨嬪彿锛屽叾浠栨暟瀛楀瓧娈靛叏閮ㄧ暀绌猴紝閬垮厤鍑虹幇 0.00
+    const srcUnit = row?.taxInclusiveUnitPrice;
+    const unitNum =
+      srcUnit !== null && srcUnit !== undefined && srcUnit !== ""
+        ? Number(srcUnit)
+        : NaN;
+    copied.taxInclusiveUnitPrice = Number.isFinite(unitNum) ? unitNum : null;
+
+    // 澶嶅埗鏂板缓甯﹀嚭锛氫骇鍝佸ぇ绫汇�佽鏍煎瀷鍙枫�佸帤搴︺�佹ゼ灞傜紪鍙枫�佸崟浠凤紱鍏朵綑鏁伴噺/闈㈢Н/鎬讳环绛夌暀绌猴紝閬垮厤鍑虹幇 0.00
     copied.quantity = null;
-    copied.taxInclusiveUnitPrice = null;
     copied.taxInclusiveTotalPrice = null;
     copied.taxExclusiveTotalPrice = null;
     copied.width = null;
@@ -2908,7 +2925,15 @@
     notShipped: "/sales/ledger/salesHistory/notShippingImport",
     shipped: "/sales/ledger/salesHistory/shippingImport",
   };
-
+  const HISTORY_IMPORT_TEMPLATE_URL_MAP = {
+    notShipped: "/sales/ledger/salesHistory/notShippingImportTemplate",
+    shipped: "/sales/ledger/salesHistory/shippingImportTemplate",
+  };
+  const HISTORY_IMPORT_TEMPLATE_FILE_NAME_MAP = {
+    notShipped: "閿�鍞彂璐у巻鍙叉暟鎹鍏ユā鏉�-鏈彂璐�.xlsx",
+    shipped: "閿�鍞彂璐у巻鍙叉暟鎹鍏ユā鏉�-宸插彂璐�.xlsx",
+  };
+  const currentImportCommand = ref("default");
   const changeDaterange = value => {
     if (value) {
       searchForm.entryDateStart = dayjs(value[0]).format("YYYY-MM-DD");
@@ -3875,18 +3900,29 @@
   };
   // 瀵煎叆
   const handleImport = () => {
+    currentImportCommand.value = "default";
     openImportDialog("瀵煎叆閿�鍞彴璐�", "/sales/ledger/import");
   };
   // 鍘嗗彶杩佺Щ
   const handleHistoryImportCommand = command => {
     const url = HISTORY_IMPORT_URL_MAP[command];
     if (!url) return;
-    const title = command === "shipped" ? "鍘嗗彶杩佺Щ-宸插彂璐�" : "鍘嗗彶杩佺Щ-鏈彂璐�";
+    currentImportCommand.value = command;
+    const title = command === "shipped" ? "鍘嗗彶杩佺Щ-宸插嚭搴�" : "鍘嗗彶杩佺Щ-鏈嚭搴�";
     openImportDialog(title, url);
   };
 
   // 涓嬭浇瀵煎叆妯℃澘
   const downloadTemplate = () => {
+    const command = currentImportCommand.value;
+    if (command && command !== "default") {
+      const templateUrl = HISTORY_IMPORT_TEMPLATE_URL_MAP[command];
+      const fileName = HISTORY_IMPORT_TEMPLATE_FILE_NAME_MAP[command];
+      if (templateUrl) {
+        proxy.download(templateUrl, {}, fileName || "閿�鍞彂璐у巻鍙叉暟鎹鍏ユā鏉�.xlsx");
+        return;
+      }
+    }
     proxy.download("/sales/ledger/exportTemplate", {}, "閿�鍞彴璐﹀鍏ユā鏉�.xlsx");
   };
   const onClose = () => {
@@ -4481,15 +4517,15 @@
       return false;
     }
 
-    // 濡傛灉鍚庣杩斿洖浜嗗彴璐︾骇鍙戣揣鐘舵�侊紙deliveryStatus锛�
-    // 1=宸插彂璐э紝鍒欑姝㈠啀娆″彂璐�
+    // 鍙拌处绾у彂璐х姸鎬侊紙deliveryStatus锛夛細2瀹℃壒涓��5宸插彂璐� 鏃朵笉鍙啀鍙戣捣鏈鍙戣揣锛�6閮ㄥ垎鍙戣揣浠嶅彲鎸夋槑缁嗙户缁彂
     const deliveryStatus = row.deliveryStatus;
     if (
       deliveryStatus !== null &&
       deliveryStatus !== undefined &&
       String(deliveryStatus).trim() !== ""
     ) {
-      if (Number(deliveryStatus) === 1) return false;
+      const ds = Number(deliveryStatus);
+      if (ds === 2 || ds === 5) return false;
     }
 
     // 鑾峰彇鍙戣揣鐘舵��
@@ -4545,12 +4581,16 @@
       return;
     }
 
-    // 鍙厑璁搞�愭湭鍙戣揣/瀹℃壒澶辫触銆戣繘鍏ュ彂璐ф祦绋�
+    // 鍏佽锛�1鏈彂璐с��3瀹℃壒涓嶉�氳繃銆�4瀹℃壒閫氳繃銆�6閮ㄥ垎鍙戣揣锛涗笉鍏佽锛�2瀹℃壒涓��5宸插彂璐�
     const statusItem = selectedRows.value[0].deliveryStatus;
+    const ledgerAllowsDelivery = s =>
+      [1, 3, 4, 6].includes(Number(s));
     let isTrue = true;
     selectedRows.value.forEach(row => {
-      if (row.deliveryStatus != 1 && row.deliveryStatus != 3) {
-        proxy.$modal.msgWarning("浠呮湭鍙戣揣鎴栧鎵瑰け璐ョ殑鍙拌处鍙互鍙戣揣");
+      if (!ledgerAllowsDelivery(row.deliveryStatus)) {
+        proxy.$modal.msgWarning(
+          "浠呮湭鍙戣揣銆佸鎵逛笉閫氳繃銆佸鎵归�氳繃鎴栭儴鍒嗗彂璐х殑鍙拌处鍙互鍙戣揣"
+        );
         isTrue = false;
         return;
       }
@@ -4587,9 +4627,9 @@
       return;
     }
 
-    // 宸插彂璐у彴璐︼細寮圭獥鎻愰啋锛屼笉鑳藉啀娆″彂璐э紙4 瑙嗕负宸插彂璐э級
+    // 宸插叏閮ㄥ彂璐э紙5锛夌殑鍙拌处锛氬脊绐楁彁閱掞紝涓嶈兘鍐嶆鍙戣揣
     const shippedLedgers = selectedRows.value.filter(
-      r => Number(r.deliveryStatus) === 4
+      r => Number(r.deliveryStatus) === 5
     );
     if (shippedLedgers.length === selectedRows.value.length) {
       try {
@@ -4646,9 +4686,9 @@
     try {
       const targets = [];
       for (const ledger of selectedRows.value) {
-        //濡傛灉宸茬粡鏄�滃鎵逛腑(2)鈥濇垨鈥滃凡鍙戣揣(4)鈥濓紝鍒欒烦杩囷紝涓嶅厑璁搁噸澶嶆搷浣�
+        // 瀹℃壒涓�(2)銆佸凡鍏ㄩ儴鍙戣揣(5) 璺宠繃锛涢儴鍒嗗彂璐�(6) 绛変粛鏀堕泦鍙彂鏄庣粏
         const status = Number(ledger.deliveryStatus);
-        if (status === 2 || status === 4) {
+        if (status === 2 || status === 5) {
           console.warn(
             `鍙拌处缂栧彿 ${ledger.salesContractNo} 鐘舵�佷负 ${status}锛岃烦杩囧彂璐
           );
@@ -4704,10 +4744,11 @@
 
   // 鎵撳紑鍙戣揣寮规锛堝崟鏉★級
   const openDeliveryForm = async row => {
-    // 鍙厑璁搞�愭湭鍙戣揣/瀹℃壒澶辫触銆戝彂璐э紱宸插彂璐�/瀹℃壒涓笉鍏佽
     const status = Number(row.deliveryStatus);
-    if (status !== 1 && status !== 3) {
-      proxy.$modal.msgWarning("鍙湁鍙戣揣鐘舵�佷负鏈彂璐ф垨瀹℃壒澶辫触鐨勮褰曟墠鍙互鍙戣揣");
+    if (![1, 3, 4, 6].includes(status)) {
+      proxy.$modal.msgWarning(
+        "鍙湁鍙戣揣鐘舵�佷负鏈彂璐с�佸鎵逛笉閫氳繃銆佸鎵归�氳繃鎴栭儴鍒嗗彂璐х殑璁板綍鎵嶅彲浠ュ彂璐�"
+      );
       return;
     }
 
@@ -4770,6 +4811,7 @@
         const run = async () => {
           for (const salesLedgerId of uniqueLedgerIds) {
             await addShippingInfo({
+              scanOutbound:  false,
               salesLedgerId,
               type: deliveryForm.value.type,
               approveUserIds,

--
Gitblit v1.9.3