From 0a251e40e30e7c8a96d71b3b9b6c459d4dfa4b22 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期三, 08 七月 2026 23:04:45 +0800
Subject: [PATCH] 暂存

---
 src/views/procurementManagement/procurementLedger/index.vue |  134 +++++++++++++++++++++++++-------------------
 1 files changed, 76 insertions(+), 58 deletions(-)

diff --git a/src/views/procurementManagement/procurementLedger/index.vue b/src/views/procurementManagement/procurementLedger/index.vue
index 6b6ab77..c0978ef 100644
--- a/src/views/procurementManagement/procurementLedger/index.vue
+++ b/src/views/procurementManagement/procurementLedger/index.vue
@@ -208,7 +208,7 @@
           <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" />
           <el-table-column label="鍗曚綅" prop="unit" width="70" />
           <el-table-column label="鏁伴噺" prop="quantity" width="70" />
-          <el-table-column label="搴撳瓨棰勮鏁伴噺" prop="warnNum" width="120" show-overflow-tooltip />
+<!--          <el-table-column label="搴撳瓨棰勮鏁伴噺" prop="warnNum" width="120" show-overflow-tooltip />-->
           <el-table-column label="绋庣巼(%)" prop="taxRate" width="80" />
           <el-table-column label="鍚◣鍗曚环(鍏�)" prop="taxInclusiveUnitPrice" :formatter="formattedNumber" width="150" />
           <el-table-column label="鍚◣鎬讳环(鍏�)" prop="taxInclusiveTotalPrice" :formatter="formattedNumber" width="150" />
@@ -310,7 +310,7 @@
         <el-row :gutter="30">
           <el-col :span="12">
             <el-form-item label="鍚◣鍗曚环(鍏�)锛�" prop="taxInclusiveUnitPrice">
-              <el-input-number v-model="productForm.taxInclusiveUnitPrice" :precision="2" :step="0.1" :min="0" clearable
+              <el-input-number v-model="productForm.taxInclusiveUnitPrice" :precision="6" :step="0.000001" :min="0" clearable
                 style="width: 100%" @change="mathNum" />
             </el-form-item>
           </el-col>
@@ -324,13 +324,13 @@
         <el-row :gutter="30">
           <el-col :span="12">
             <el-form-item label="鍚◣鎬讳环(鍏�)锛�" prop="taxInclusiveTotalPrice">
-              <el-input-number v-model="productForm.taxInclusiveTotalPrice" :precision="2" :step="0.1" :min="0"
+              <el-input-number v-model="productForm.taxInclusiveTotalPrice" :precision="6" :step="0.000001" :min="0"
                 clearable style="width: 100%" @change="reverseMathNum('taxInclusiveTotalPrice')" />
             </el-form-item>
           </el-col>
           <el-col :span="12">
             <el-form-item label="涓嶅惈绋庢�讳环(鍏�)锛�" prop="taxExclusiveTotalPrice">
-              <el-input-number v-model="productForm.taxExclusiveTotalPrice" :precision="2" :step="0.1" :min="0"
+              <el-input-number v-model="productForm.taxExclusiveTotalPrice" :precision="6" :step="0.000001" :min="0"
                 clearable style="width: 100%" @change="reverseMathNum('taxExclusiveTotalPrice')" />
             </el-form-item>
           </el-col>
@@ -344,14 +344,12 @@
               </el-select>
             </el-form-item>
           </el-col>
-          <el-col :span="12">
-            <el-form-item label="搴撳瓨棰勮鏁伴噺锛�" prop="warnNum">
-              <el-input-number v-model="productForm.warnNum" :precision="2" :step="0.1" :min="0" clearable
-                style="width: 100%" />
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row :gutter="30">
+<!--          <el-col :span="12">-->
+<!--            <el-form-item label="搴撳瓨棰勮鏁伴噺锛�" prop="warnNum">-->
+<!--              <el-input-number v-model="productForm.warnNum" :precision="2" :step="0.1" :min="0" clearable-->
+<!--                style="width: 100%" />-->
+<!--            </el-form-item>-->
+<!--          </el-col>-->
           <el-col :span="12">
             <el-form-item label="鏄惁璐ㄦ锛�" prop="isChecked">
               <el-radio-group v-model="productForm.isChecked">
@@ -361,6 +359,16 @@
             </el-form-item>
           </el-col>
         </el-row>
+<!--        <el-row :gutter="30">
+          <el-col :span="12">
+            <el-form-item label="鏄惁璐ㄦ锛�" prop="isChecked">
+              <el-radio-group v-model="productForm.isChecked">
+                <el-radio label="鏄�" :value="true" />
+                <el-radio label="鍚�" :value="false" />
+              </el-radio-group>
+            </el-form-item>
+          </el-col>
+        </el-row>-->
       </el-form>
     </FormDialog>
     <FileList v-if="fileListDialogVisible" v-model:visible="fileListDialogVisible" record-type="purchase_ledger"
@@ -437,6 +445,7 @@
 import { modelList, productTreeList } from "@/api/basicData/product.js";
 import dayjs from "dayjs";
 import FileUpload from "@/components/AttachmentUpload/file/index.vue";
+import { tableAmountFormatter, formatDecimal, buildAmountSummaryFormat } from '@/utils/numberFormat';
 
 const userStore = useUserStore();
 
@@ -619,7 +628,7 @@
   },
   rules: {
     purchaseContractNumber: [
-      { required: false, message: "璇疯緭鍏�", trigger: "blur" },
+      { required: true, message: "璇疯緭鍏�", trigger: "blur" },
     ],
     projectName: [
       { required: true, message: "璇疯緭鍏ラ」鐩悕绉�", trigger: "blur" },
@@ -632,13 +641,6 @@
 const { form, rules } = toRefs(data);
 const { form: searchForm } = useFormData({
   ...data.searchForm,
-  // 璁剧疆褰曞叆鏃ユ湡鑼冨洿涓哄綋澶�
-  entryDate: [
-    dayjs().startOf("day").format("YYYY-MM-DD"),
-    dayjs().endOf("day").format("YYYY-MM-DD"),
-  ],
-  entryDateStart: dayjs().startOf("day").format("YYYY-MM-DD"),
-  entryDateEnd: dayjs().endOf("day").format("YYYY-MM-DD"),
 });
 
 // 浜у搧琛ㄥ崟寮规鏁版嵁
@@ -671,7 +673,7 @@
       { required: true, message: "璇疯緭鍏�", trigger: "blur" },
     ],
     taxRate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
-    warnNum: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+    // warnNum: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
     taxInclusiveTotalPrice: [
       { required: true, message: "璇疯緭鍏�", trigger: "blur" },
     ],
@@ -770,9 +772,7 @@
   handleQuery();
 };
 
-const formattedNumber = (row, column, cellValue) => {
-  return parseFloat(cellValue).toFixed(2);
-};
+const formattedNumber = tableAmountFormatter;
 // 鏌ヨ鍒楄〃
 /** 鎼滅储鎸夐挳鎿嶄綔 */
 const handleQuery = () => {
@@ -890,10 +890,19 @@
       "futureTickets",
       "futureTicketsAmount",
     ],
-    {
-      ticketsNum: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
-      futureTickets: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
-    }
+    buildAmountSummaryFormat(
+      [
+        "taxInclusiveUnitPrice",
+        "taxInclusiveTotalPrice",
+        "taxExclusiveTotalPrice",
+        "ticketsAmount",
+        "futureTicketsAmount",
+      ],
+      {
+        ticketsNum: { noDecimal: true },
+        futureTickets: { noDecimal: true },
+      }
+    )
   );
 };
 const paginationChange = obj => {
@@ -956,15 +965,27 @@
 };
 // 涓昏〃鍚堣鏂规硶
 const summarizeMainTable = param => {
-  return proxy.summarizeTable(param, ["contractAmount"]);
+  return proxy.summarizeTable(
+    param,
+    ["contractAmount"],
+    buildAmountSummaryFormat(["contractAmount"])
+  );
 };
 // 瀛愯〃鍚堣鏂规硶
 const summarizeProTable = param => {
-  return proxy.summarizeTable(param, [
-    "taxInclusiveUnitPrice",
-    "taxInclusiveTotalPrice",
-    "taxExclusiveTotalPrice",
-  ]);
+  return proxy.summarizeTable(
+    param,
+    [
+      "taxInclusiveUnitPrice",
+      "taxInclusiveTotalPrice",
+      "taxExclusiveTotalPrice",
+    ],
+    buildAmountSummaryFormat([
+      "taxInclusiveUnitPrice",
+      "taxInclusiveTotalPrice",
+      "taxExclusiveTotalPrice",
+    ])
+  );
 };
 // 鎵撳紑寮规
 const openForm = async (type, row) => {
@@ -1006,7 +1027,18 @@
 
     form.value.entryDate = getCurrentDate();
 
-    if (type === "edit" && row?.id) {
+    if (type === "add") {
+      // 鏂板鏃剁敓鎴愰噰璐悎鍚屽彿
+      try {
+        const purchaseNoRes = await createPurchaseNo();
+        if (purchaseNoRes?.data) {
+          form.value.purchaseContractNumber = purchaseNoRes.data;
+        }
+      } catch (error) {
+        console.error("鐢熸垚閲囪喘鍚堝悓鍙峰け璐�:", error);
+        proxy.$modal.msgWarning("鐢熸垚閲囪喘鍚堝悓鍙峰け璐�");
+      }
+    } else if (type === "edit" && row?.id) {
       // 缂栬緫鏃跺姞杞芥暟鎹�
       currentId.value = row.id;
       try {
@@ -1086,7 +1118,7 @@
 
 // 鎻愪氦琛ㄥ崟
 const submitForm = () => {
-  proxy.$refs["formRef"].validate(async valid => {
+  proxy.$refs["formRef"].validate(valid => {
     if (valid) {
       if (productData.value.length > 0) {
         // 鏂板鏃讹紝闇�瑕佷粠姣忎釜浜у搧瀵硅薄涓垹闄� id 瀛楁
@@ -1114,20 +1146,6 @@
       const submitData = { ...form.value };
       if (operationType.value === "add") {
         delete submitData.id;
-      }
-
-      // 濡傛灉閲囪喘鍚堝悓鍙蜂负绌猴紝鍒欐牴鎹綍鍏ユ棩鏈熻嚜鍔ㄧ敓鎴�
-      if (!submitData.purchaseContractNumber) {
-        try {
-          const purchaseNoRes = await createPurchaseNo(submitData.entryDate);
-          if (purchaseNoRes?.data) {
-            submitData.purchaseContractNumber = purchaseNoRes.data;
-          }
-        } catch (error) {
-          console.error("鐢熸垚閲囪喘鍚堝悓鍙峰け璐�:", error);
-          proxy.$modal.msgWarning("鐢熸垚閲囪喘鍚堝悓鍙峰け璐�");
-          return;
-        }
       }
 
       addOrEditPurchase(submitData).then(res => {
@@ -1476,10 +1494,10 @@
   if (field === "taxInclusiveTotalPrice") {
     // 宸茬煡鍚◣鎬讳环鍜屾暟閲忥紝鍙嶇畻鍚◣鍗曚环
     if (productForm.value.quantity) {
-      productForm.value.taxInclusiveUnitPrice = (
+      productForm.value.taxInclusiveUnitPrice = formatDecimal(
         Number(productForm.value.taxInclusiveTotalPrice) /
         Number(productForm.value.quantity)
-      ).toFixed(2);
+      );
       // 纭繚缁撴灉涓嶄负璐熸暟
       if (Number(productForm.value.taxInclusiveUnitPrice) < 0) {
         productForm.value.taxInclusiveUnitPrice = "0";
@@ -1497,30 +1515,30 @@
       }
     }
     // 鍙嶇畻涓嶅惈绋庢�讳环
-    productForm.value.taxExclusiveTotalPrice = (
+    productForm.value.taxExclusiveTotalPrice = formatDecimal(
       Number(productForm.value.taxInclusiveTotalPrice) /
       (1 + taxRate / 100)
-    ).toFixed(2);
+    );
     // 纭繚缁撴灉涓嶄负璐熸暟
     if (Number(productForm.value.taxExclusiveTotalPrice) < 0) {
       productForm.value.taxExclusiveTotalPrice = "0";
     }
   } else if (field === "taxExclusiveTotalPrice") {
     // 鍙嶇畻鍚◣鎬讳环
-    productForm.value.taxInclusiveTotalPrice = (
+    productForm.value.taxInclusiveTotalPrice = formatDecimal(
       Number(productForm.value.taxExclusiveTotalPrice) *
       (1 + taxRate / 100)
-    ).toFixed(2);
+    );
     // 纭繚缁撴灉涓嶄负璐熸暟
     if (Number(productForm.value.taxInclusiveTotalPrice) < 0) {
       productForm.value.taxInclusiveTotalPrice = "0";
     }
     // 宸茬煡鏁伴噺锛屽弽绠楀惈绋庡崟浠�
     if (productForm.value.quantity) {
-      productForm.value.taxInclusiveUnitPrice = (
+      productForm.value.taxInclusiveUnitPrice = formatDecimal(
         Number(productForm.value.taxInclusiveTotalPrice) /
         Number(productForm.value.quantity)
-      ).toFixed(2);
+      );
       // 纭繚缁撴灉涓嶄负璐熸暟
       if (Number(productForm.value.taxInclusiveUnitPrice) < 0) {
         productForm.value.taxInclusiveUnitPrice = "0";

--
Gitblit v1.9.3