From 9e7ed81d5fcfdc1489fc8a08edf5fe826dfe5fdc Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 25 五月 2026 16:54:43 +0800
Subject: [PATCH] 宝东 1.协同审批部门选择筛选去掉

---
 src/views/salesManagement/salesLedger/index.vue |  110 ++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 100 insertions(+), 10 deletions(-)

diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue
index 3d88828..de17401 100644
--- a/src/views/salesManagement/salesLedger/index.vue
+++ b/src/views/salesManagement/salesLedger/index.vue
@@ -158,6 +158,8 @@
               </el-table-column>
               <el-table-column label="鏁伴噺"
                                prop="quantity" />
+              <el-table-column label="姣忎欢鏁伴噺"
+                               prop="singleQuantity" />
               <el-table-column label="寰呭彂璐ф暟閲�"
                                prop="noQuantity" />
               <el-table-column label="绋庣巼(%)"
@@ -243,7 +245,7 @@
             <el-button link
                        type="primary"
                        @click="openForm('edit', scope.row)"
-                       :disabled="!scope.row.isEdit || scope.row.hasProductionRecord || !canEditLedger(scope.row)">缂栬緫
+                       :disabled="!canEditLedger(scope.row)">缂栬緫
             </el-button>
             <el-button link
                        type="primary"
@@ -287,10 +289,15 @@
           <el-col :span="12">
             <el-form-item label="閿�鍞悎鍚屽彿锛�"
                           prop="salesContractNo">
-              <el-input v-model="form.salesContractNo"
-                        placeholder="鑷姩鐢熸垚"
-                        clearable
-                        disabled />
+              <div style="display: flex; align-items: center; gap: 12px;width: 100%;">
+                <el-checkbox v-model="form.autoGenerateContractNo" v-if="operationType === 'add'">鑷姩鐢熸垚
+                </el-checkbox>
+                <el-input v-model="form.salesContractNo"
+                          :placeholder="form.autoGenerateContractNo ? '鑷姩鐢熸垚' : '璇疯緭鍏�'"
+                          clearable
+                          :disabled="form.autoGenerateContractNo" />
+
+              </div>
             </el-form-item>
           </el-col>
           <el-col :span="12">
@@ -443,6 +450,8 @@
                            prop="unit" />
           <el-table-column label="鏁伴噺"
                            prop="quantity" />
+          <el-table-column label="姣忎欢鏁伴噺"
+                           prop="singleQuantity" />
           <el-table-column label="绋庣巼(%)"
                            prop="taxRate" />
           <el-table-column label="鍚◣鍗曚环(鍏�)"
@@ -674,6 +683,30 @@
                                :precision="2"
                                @change="calculateFromQuantity"
                                style="width: 100%" />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="30">
+          <el-col :span="12">
+            <el-form-item label="姣忎欢鏁伴噺锛�"
+                          prop="singleQuantity">
+              <el-input-number :step="1"
+                               :min="1"
+                               v-model="productForm.singleQuantity"
+                               placeholder="璇疯緭鍏�"
+                               clearable
+                               :precision="0"
+                               @change="calculateFromSingleQuantity"
+                               style="width: 100%" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="鎬绘暟锛�"
+                          prop="totalQuantity">
+              <el-input v-model="productForm.totalQuantity"
+                        placeholder="鑷姩璁$畻"
+                        disabled
+                        style="width: 100%" />
             </el-form-item>
           </el-col>
         </el-row>
@@ -954,7 +987,7 @@
         </el-row>
         <el-row :gutter="30">
           <el-col :span="24">
-            <el-form-item label="鎵瑰彿锛�"
+            <el-form-item label="搴撳瓨锛�"
                           prop="batchNo">
               <el-table :data="deliveryForm.batchNoList"
                         border
@@ -964,6 +997,15 @@
                 <el-table-column label="鎵瑰彿"
                                  prop="batchNo"
                                  min-width="180" />
+                <el-table-column label="浜у搧澶х被"
+                                 prop="productName"
+                                 min-width="100" />
+                <el-table-column label="瑙勬牸鍨嬪彿"
+                                 prop="model"
+                                 min-width="100" />
+                <el-table-column label="鍗曚綅"
+                                 prop="unit"
+                                 min-width="100" />
                 <el-table-column label="搴撳瓨鏁伴噺"
                                  min-width="120"
                                  align="center">
@@ -1072,6 +1114,7 @@
     },
     form: {
       salesContractNo: "",
+      autoGenerateContractNo: true,
       salesman: "",
       customerId: "",
       entryPerson: "",
@@ -1080,7 +1123,6 @@
       maintenanceTime: "",
       productData: [],
       executionDate: "",
-      hasProductionRecord: false,
     },
     rules: {
       salesman: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
@@ -1103,6 +1145,8 @@
       specificationModel: "",
       unit: "",
       quantity: "",
+      singleQuantity: 1,
+      totalQuantity: "",
       taxInclusiveUnitPrice: "",
       taxRate: "",
       taxInclusiveTotalPrice: "",
@@ -1590,6 +1634,8 @@
       form.value.entryDate = getCurrentDate();
       // 绛捐鏃ユ湡榛樿涓哄綋澶�
       form.value.executionDate = getCurrentDate();
+      // 榛樿鑷姩鐢熸垚閿�鍞悎鍚屽彿
+      form.value.autoGenerateContractNo = true;
     } else {
       currentId.value = row.id;
       getSalesLedgerWithProducts({ id: row.id, type: 1 }).then(res => {
@@ -1597,6 +1643,8 @@
         form.value.entryPerson = Number(res.entryPerson);
         productData.value = form.value.productData;
         fileList.value = form.value.storageBlobVOs;
+        // 缂栬緫鏃惰缃嚜鍔ㄧ敓鎴愪负false锛屽厑璁告墜鍔ㄤ慨鏀�
+        form.value.autoGenerateContractNo = false;
       });
     }
     // let userAll = await userStore.getInfo()
@@ -1708,6 +1756,8 @@
         taxExclusiveTotalPrice: taxExclusiveTotalPrice,
         invoiceType: "澧炴櫘绁�",
         isProduction: true,
+        productId: p.productId,
+        productModelId: p.productModelId
       };
     });
 
@@ -1731,6 +1781,9 @@
         }
         form.value.storageBlobDTOs = fileList;
         form.value.type = 1;
+        if (form.value.autoGenerateContractNo) {
+          form.value.salesContractNo = '';
+        }
         addOrUpdateSalesLedger(form.value).then(res => {
           proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
           closeDia();
@@ -1764,6 +1817,12 @@
     if (type === "edit") {
       productForm.value = { ...row };
       productIndex.value = index;
+      // 濡傛灉娌℃湁 totalQuantity锛岃嚜鍔ㄨ绠楋細鎬绘暟 = 姣忎欢鏁伴噺 * 鏁伴噺
+      if (!productForm.value.totalQuantity && productForm.value.quantity) {
+        const singleQuantity = parseInt(productForm.value.singleQuantity) || 1;
+        const quantity = parseFloat(productForm.value.quantity);
+        productForm.value.totalQuantity = (quantity * singleQuantity).toFixed(0);
+      }
       // 缂栬緫鏃舵牴鎹骇鍝佸ぇ绫诲悕绉板弽鏌� tree 鑺傜偣 id锛屽苟鍔犺浇瑙勬牸鍨嬪彿鍒楄〃
       try {
         const options =
@@ -2445,6 +2504,10 @@
         );
     }
 
+    // 璁$畻鎬绘暟 = 姣忎欢鏁伴噺 * 鏁伴噺
+    const singleQuantity = parseInt(productForm.value.singleQuantity) || 1;
+    productForm.value.totalQuantity = (quantity * singleQuantity).toFixed(0);
+
     isCalculating.value = false;
   };
 
@@ -2478,6 +2541,10 @@
       inclusiveTotalPrice / quantity
     ).toFixed(2);
 
+    // 璁$畻鎬绘暟 = 姣忎欢鏁伴噺 * 鏁伴噺
+    const singleQuantity = parseInt(productForm.value.singleQuantity) || 1;
+    productForm.value.totalQuantity = (quantity * singleQuantity).toFixed(0);
+
     isCalculating.value = false;
   };
 
@@ -2498,7 +2565,7 @@
 
     isCalculating.value = true;
 
-    // 璁$畻鍚◣鎬讳环
+    // 璁$畻鍚◣鎬讳环 = 鍗曚环 * 鏁伴噺
     productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2);
 
     // 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
@@ -2509,6 +2576,10 @@
           productForm.value.taxRate
         );
     }
+
+    // 璁$畻鎬绘暟 = 姣忎欢鏁伴噺 * 鏁伴噺
+    const singleQuantity = parseInt(productForm.value.singleQuantity) || 1;
+    productForm.value.totalQuantity = (quantity * singleQuantity).toFixed(0);
 
     isCalculating.value = false;
   };
@@ -2530,7 +2601,7 @@
 
     isCalculating.value = true;
 
-    // 璁$畻鍚◣鎬讳环
+    // 璁$畻鍚◣鎬讳环 = 鍗曚环 * 鏁伴噺
     productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2);
 
     // 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
@@ -2541,6 +2612,25 @@
           productForm.value.taxRate
         );
     }
+
+    isCalculating.value = false;
+  };
+
+  // 鏍规嵁姣忎欢鏁伴噺鍙樺寲璁$畻鎬绘暟
+  const calculateFromSingleQuantity = () => {
+    if (isCalculating.value) return;
+
+    const quantity = parseFloat(productForm.value.quantity);
+
+    if (!quantity || quantity <= 0) {
+      return;
+    }
+
+    isCalculating.value = true;
+
+    // 璁$畻鎬绘暟 = 姣忎欢鏁伴噺 * 鏁伴噺
+    const singleQuantity = parseInt(productForm.value.singleQuantity) || 1;
+    productForm.value.totalQuantity = (quantity * singleQuantity).toFixed(0);
 
     isCalculating.value = false;
   };
@@ -3041,4 +3131,4 @@
       page-break-after: avoid;
     }
   }
-</style>
+</style>
\ No newline at end of file

--
Gitblit v1.9.3