From be65feb64970908c7f0a287faa7a53612686dd43 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期五, 14 十一月 2025 15:01:32 +0800
Subject: [PATCH] 销售台账、采购台账添加产品表单调整

---
 src/views/procurementManagement/procurementLedger/index.vue |  121 ++++++++++++++++++++++++---------------
 1 files changed, 74 insertions(+), 47 deletions(-)

diff --git a/src/views/procurementManagement/procurementLedger/index.vue b/src/views/procurementManagement/procurementLedger/index.vue
index b93ed18..6c7a136 100644
--- a/src/views/procurementManagement/procurementLedger/index.vue
+++ b/src/views/procurementManagement/procurementLedger/index.vue
@@ -53,7 +53,7 @@
         show-summary
         :summary-method="summarizeMainTable"
         @expand-change="expandChange"
-        height="calc(100vh - 18.5em)"
+        height="calc(100vh - 19em)"
       >
         <el-table-column align="center" type="selection" width="55" />
         <el-table-column type="expand">
@@ -246,6 +246,30 @@
             </el-form-item>
           </el-col>
         </el-row>
+				<el-row :gutter="30">
+					<el-col :span="12">
+						<el-form-item label="浠樻鏂瑰紡">
+							<el-input
+								v-model="form.paymentMethod"
+								placeholder="璇疯緭鍏�"
+								clearable
+							/>
+						</el-form-item>
+					</el-col>
+					<el-col :span="12">
+						<el-form-item label="绛捐鏃ユ湡锛�" prop="executionDate">
+							<el-date-picker
+								style="width: 100%"
+								v-model="form.executionDate"
+								value-format="YYYY-MM-DD"
+								format="YYYY-MM-DD"
+								type="date"
+								placeholder="璇烽�夋嫨"
+								clearable
+							/>
+						</el-form-item>
+					</el-col>
+				</el-row>
         <el-row :gutter="30">
           <el-col :span="12">
             <el-form-item label="褰曞叆浜猴細" prop="recorderId">
@@ -273,17 +297,6 @@
                 format="YYYY-MM-DD"
                 type="date"
                 placeholder="璇烽�夋嫨"
-                clearable
-              />
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row :gutter="30">
-          <el-col :span="12">
-            <el-form-item label="浠樻鏂瑰紡">
-              <el-input
-                v-model="form.paymentMethod"
-                placeholder="璇疯緭鍏�"
                 clearable
               />
             </el-form-item>
@@ -476,7 +489,7 @@
         </el-row>
         <el-row :gutter="30">
           <el-col :span="12">
-            <el-form-item label="鍚◣鍗曚环(鍏�)锛�" prop="taxInclusiveUnitPrice">
+            <el-form-item label="鍚◣/涓嶅惈绋庡崟浠�(鍏�)锛�" prop="taxInclusiveUnitPrice">
               <el-input-number
                 v-model="productForm.taxInclusiveUnitPrice"
                 :precision="2"
@@ -519,7 +532,7 @@
               label="涓嶅惈绋庢�讳环(鍏�)锛�"
               prop="taxExclusiveTotalPrice"
             >
-              <el-input 
+              <el-input
                 v-model="productForm.taxExclusiveTotalPrice"
                 @change="reverseMathNum('taxExclusiveTotalPrice')"
               />
@@ -559,7 +572,7 @@
         </div>
       </template>
     </el-dialog>
-    
+
     <!-- 浜岀淮鐮佹樉绀哄璇濇 -->
     <el-dialog
       v-model="qrCodeDialogVisible"
@@ -853,6 +866,7 @@
     supplierName: "",
     supplierId: "",
     paymentMethod: "",
+		executionDate: "",
   },
   rules: {
     purchaseContractNumber: [
@@ -860,6 +874,8 @@
     ],
     projectName: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
     supplierId: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+		entryDate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+		executionDate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
   },
 });
 const {  form, rules } = toRefs(data);
@@ -893,7 +909,7 @@
     taxInclusiveUnitPrice: [
       { required: true, message: "璇疯緭鍏�", trigger: "blur" },
     ],
-    taxRate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+    // taxRate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
 		warnNum: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
     taxInclusiveTotalPrice: [
       { required: true, message: "璇疯緭鍏�", trigger: "blur" },
@@ -901,7 +917,7 @@
     taxExclusiveTotalPrice: [
       { required: true, message: "璇疯緭鍏�", trigger: "blur" },
     ],
-    invoiceType: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+    // invoiceType: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
   },
 });
 const { productForm, productRules } = toRefs(productFormData);
@@ -1077,9 +1093,9 @@
 // 绉婚櫎鏂囦欢
 function handleRemove(file) {
   console.log("handleRemove", file.id);
-  if (file.size > 1024 * 1024 * 10) { 
+  if (file.size > 1024 * 1024 * 10) {
     // 浠呭墠绔竻鐞嗭紝涓嶈皟鐢ㄥ垹闄ゆ帴鍙e拰鎻愮ず
-    return; 
+    return;
   }
   if (operationType.value === "edit") {
     let ids = [];
@@ -1136,10 +1152,15 @@
   });
 };
 const getModels = (value) => {
-  productForm.value.productCategory = findNodeById(productOptions.value, value);
-  modelList({ id: value }).then((res) => {
-    modelOptions.value = res;
-  });
+  if (value) {
+    productForm.value.productCategory = findNodeById(productOptions.value, value) || "";
+    modelList({ id: value }).then((res) => {
+      modelOptions.value = res;
+    });
+  } else {
+    productForm.value.productCategory = "";
+    modelOptions.value = [];
+  }
 };
 const getProductModel = (value) => {
   const index = modelOptions.value.findIndex((item) => item.id === value);
@@ -1154,12 +1175,12 @@
 const findNodeById = (nodes, productId) => {
   for (let i = 0; i < nodes.length; i++) {
     if (nodes[i].value === productId) {
-      return nodes[i].label; // 鎵惧埌鑺傜偣锛岃繑鍥炶鑺傜偣
+      return nodes[i].label; // 鎵惧埌鑺傜偣锛岃繑鍥炶鑺傜偣鐨刲abel
     }
     if (nodes[i].children && nodes[i].children.length > 0) {
       const foundNode = findNodeById(nodes[i].children, productId);
       if (foundNode) {
-        return foundNode.label; // 鍦ㄥ瓙鑺傜偣涓壘鍒帮紝杩斿洖璇ヨ妭鐐�
+        return foundNode; // 鍦ㄥ瓙鑺傜偣涓壘鍒帮紝鐩存帴杩斿洖锛堝凡缁忔槸label瀛楃涓诧級
       }
     }
   }
@@ -1309,10 +1330,10 @@
   return `${year}-${month}-${day}`;
 }
 const mathNum = () => {
-	if (!productForm.value.taxRate) {
-		proxy.$modal.msgWarning("璇峰厛閫夋嫨绋庣巼");
-		return;
-	}
+	// if (!productForm.value.taxRate) {
+	// 	proxy.$modal.msgWarning("璇峰厛閫夋嫨绋庣巼");
+	// 	return;
+	// }
   if (!productForm.value.taxInclusiveUnitPrice) {
     return;
   }
@@ -1325,48 +1346,54 @@
       productForm.value.taxInclusiveUnitPrice,
       productForm.value.quantity
     );
-  if (productForm.value.taxRate) {
     // 涓嶅惈绋庢�讳环璁$畻
     productForm.value.taxExclusiveTotalPrice =
       proxy.calculateTaxExclusiveTotalPrice(
         productForm.value.taxInclusiveTotalPrice,
         productForm.value.taxRate
       );
-  }
+  // if (productForm.value.taxRate) {
+  //   // 涓嶅惈绋庢�讳环璁$畻
+  //   productForm.value.taxExclusiveTotalPrice =
+  //     proxy.calculateTaxExclusiveTotalPrice(
+  //       productForm.value.taxInclusiveTotalPrice,
+  //       productForm.value.taxRate
+  //     );
+  // }
 };
 const reverseMathNum = (field) => {
-	if (!productForm.value.taxRate) {
-		proxy.$modal.msgWarning("璇峰厛閫夋嫨绋庣巼");
-		return;
-	}
-  const taxRate = Number(productForm.value.taxRate);
-  if (!taxRate) return;
+	// if (!productForm.value.taxRate) {
+	// 	proxy.$modal.msgWarning("璇峰厛閫夋嫨绋庣巼");
+	// 	return;
+	// }
+  const taxRate = productForm.value.taxRate?Number(productForm.value.taxRate):0;
+  // if (!taxRate) return;
   if (field === 'taxInclusiveTotalPrice') {
     // 宸茬煡鍚◣鎬讳环鍜屾暟閲忥紝鍙嶇畻鍚◣鍗曚环
     if (productForm.value.quantity) {
-      productForm.value.taxInclusiveUnitPrice = 
+      productForm.value.taxInclusiveUnitPrice =
         (Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.quantity)).toFixed(2);
     }
     // 宸茬煡鍚◣鎬讳环鍜屽惈绋庡崟浠凤紝鍙嶇畻鏁伴噺
     else if (productForm.value.taxInclusiveUnitPrice) {
-      productForm.value.quantity = 
+      productForm.value.quantity =
         (Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.taxInclusiveUnitPrice)).toFixed(2);
     }
     // 鍙嶇畻涓嶅惈绋庢�讳环
-    productForm.value.taxExclusiveTotalPrice = 
+    productForm.value.taxExclusiveTotalPrice =
       (Number(productForm.value.taxInclusiveTotalPrice) / (1 + taxRate / 100)).toFixed(2);
   } else if (field === 'taxExclusiveTotalPrice') {
     // 鍙嶇畻鍚◣鎬讳环
-    productForm.value.taxInclusiveTotalPrice = 
+    productForm.value.taxInclusiveTotalPrice =
       (Number(productForm.value.taxExclusiveTotalPrice) * (1 + taxRate / 100)).toFixed(2);
     // 宸茬煡鏁伴噺锛屽弽绠楀惈绋庡崟浠�
     if (productForm.value.quantity) {
-      productForm.value.taxInclusiveUnitPrice = 
+      productForm.value.taxInclusiveUnitPrice =
         (Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.quantity)).toFixed(2);
     }
     // 宸茬煡鍚◣鍗曚环锛屽弽绠楁暟閲�
     else if (productForm.value.taxInclusiveUnitPrice) {
-      productForm.value.quantity = 
+      productForm.value.quantity =
         (Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.taxInclusiveUnitPrice)).toFixed(2);
     }
   }
@@ -1422,7 +1449,7 @@
     proxy.$modal.msgWarning("浜岀淮鐮佹湭鐢熸垚");
     return;
   }
-  
+
   const a = document.createElement('a');
   a.href = qrCodeUrl.value;
   a.download = `閲囪喘鍚堝悓鍙蜂簩缁寸爜_${new Date().getTime()}.png`;
@@ -1482,7 +1509,7 @@
 // 瑙f瀽鎵爜鍐呭锛堟ā鎷熻В鏋愪簩缁寸爜鏁版嵁锛�
 const parseScanContent = (content) => {
   if (!content) return;
-  
+
   // 妯℃嫙瑙f瀽浜岀淮鐮佸唴瀹癸紝杩欓噷鍙互鏍规嵁瀹為檯闇�姹傝皟鏁磋В鏋愰�昏緫
   // 鍋囪鎵爜鍐呭鏍煎紡涓猴細鍚堝悓鍙穦渚涘簲鍟唡椤圭洰|閲戦|浠樻鏂瑰紡
   const parts = content.split('|');
@@ -1517,11 +1544,11 @@
         remark: scanAddForm.scanRemark,
         type: 2
       };
-      
+
       // 妯℃嫙鏂板鎴愬姛
       proxy.$modal.msgSuccess("鎵爜鏂板鎴愬姛锛�");
       closeScanAddDialog();
-      
+
       // 鍙互閫夋嫨鏄惁鍒锋柊鍒楄〃
       // getList();
     }

--
Gitblit v1.9.3