From 13d4911b890817bfb586a95dfb827fda6e41cb9a Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期四, 15 一月 2026 10:54:42 +0800
Subject: [PATCH] 代码调整12

---
 src/views/procurementManagement/procurementLedger/index.vue |  175 +++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 113 insertions(+), 62 deletions(-)

diff --git a/src/views/procurementManagement/procurementLedger/index.vue b/src/views/procurementManagement/procurementLedger/index.vue
index 2877efd..a9f2802 100644
--- a/src/views/procurementManagement/procurementLedger/index.vue
+++ b/src/views/procurementManagement/procurementLedger/index.vue
@@ -39,7 +39,7 @@
     <div class="table_list">
       <div style="display: flex;justify-content: flex-end;margin-bottom: 20px;">
         <el-button type="primary" @click="openForm('add')">鏂板鍙拌处</el-button>
-        <el-button type="success" @click="openScanAddDialog">鎵爜鏂板</el-button>
+        <!-- <el-button type="success" @click="openScanAddDialog">鎵爜鏂板</el-button> -->
         <el-button @click="handleOut">瀵煎嚭</el-button>
         <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>
       </div>
@@ -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">
@@ -103,12 +103,10 @@
         <el-table-column
           label="閿�鍞悎鍚屽彿"
           prop="salesContractNo"
-          width="200"
           show-overflow-tooltip
         />
         <el-table-column
           label="渚涘簲鍟嗗悕绉�"
-          width="240"
           prop="supplierName"
           show-overflow-tooltip
         />
@@ -146,7 +144,7 @@
         <el-table-column
           fixed="right"
           label="鎿嶄綔"
-          min-width="150"
+          min-width="100"
           align="center"
         >
           <template #default="scope">
@@ -155,15 +153,14 @@
               type="primary"
               size="small"
               @click="openForm('edit', scope.row)"
-							:disabled="scope.row.receiptPaymentAmount>0 || scope.row.recorderName !== userStore.nickName"
               >缂栬緫</el-button
             >
             <el-button
               link
-              type="success"
+              type="primary"
               size="small"
-              @click="showQRCode(scope.row)"
-              >鐢熸垚浜岀淮鐮�</el-button
+              @click="downLoadFile(scope.row)"
+              >闄勪欢</el-button
             >
 
           </template>
@@ -202,20 +199,26 @@
             </el-form-item>
           </el-col>
           <el-col :span="12">
-            <el-form-item label="閿�鍞悎鍚屽彿锛�" prop="salesLedgerId">
-              <el-select
-                v-model="form.salesLedgerId"
-                placeholder="璇烽�夋嫨"
-                clearable
-                @change="salesLedgerChange"
-              >
-                <el-option
-                  v-for="item in salesContractList"
-                  :key="item.id"
-                  :label="item.salesContractNo"
-                  :value="item.id"
-                />
-              </el-select>
+            <el-form-item label="閿�鍞悎鍚屽彿锛�" prop="salesContractNo">
+              <el-input
+                  v-model="form.salesContractNo"
+                  placeholder="璇疯緭鍏�"
+                  clearable
+              />
+<!--              <el-select-->
+<!--                v-model="form.salesLedgerId"-->
+<!--                placeholder="璇烽�夋嫨"-->
+<!--								filterable-->
+<!--                clearable-->
+<!--                @change="salesLedgerChange"-->
+<!--              >-->
+<!--                <el-option-->
+<!--                  v-for="item in salesContractList"-->
+<!--                  :key="item.id"-->
+<!--                  :label="item.salesContractNo"-->
+<!--                  :value="item.id"-->
+<!--                />-->
+<!--              </el-select>-->
             </el-form-item>
           </el-col>
         </el-row>
@@ -225,6 +228,7 @@
               <el-select
                 v-model="form.supplierId"
                 placeholder="璇烽�夋嫨"
+								filterable
                 clearable
               >
                 <el-option
@@ -246,6 +250,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">
@@ -254,6 +282,7 @@
                 placeholder="璇烽�夋嫨"
                 clearable
                 disabled
+								filterable
               >
                 <el-option
                   v-for="item in userList"
@@ -267,24 +296,12 @@
           <el-col :span="12">
             <el-form-item label="褰曞叆鏃ユ湡锛�" prop="entryDate">
               <el-date-picker
-                disabled
                 style="width: 100%"
                 v-model="form.entryDate"
                 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="浠樻鏂瑰紡">
-              <el-input
-                v-model="form.paymentMethod"
-                placeholder="璇疯緭鍏�"
                 clearable
               />
             </el-form-item>
@@ -318,6 +335,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="taxRate" width="80" />
           <el-table-column
             label="鍚◣鍗曚环(鍏�)"
@@ -519,7 +537,7 @@
               label="涓嶅惈绋庢�讳环(鍏�)锛�"
               prop="taxExclusiveTotalPrice"
             >
-              <el-input 
+              <el-input
                 v-model="productForm.taxExclusiveTotalPrice"
                 @change="reverseMathNum('taxExclusiveTotalPrice')"
               />
@@ -539,6 +557,17 @@
               </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"
+								clearable
+								style="width: 100%"
+							/>
+						</el-form-item>
+					</el-col>
         </el-row>
       </el-form>
       <template #footer>
@@ -548,7 +577,7 @@
         </div>
       </template>
     </el-dialog>
-    
+
     <!-- 浜岀淮鐮佹樉绀哄璇濇 -->
     <el-dialog
       v-model="qrCodeDialogVisible"
@@ -763,6 +792,7 @@
         </div>
       </template>
     </el-dialog>
+		<FileList ref="fileListRef" />
   </div>
 </template>
 
@@ -773,6 +803,7 @@
 import { Search } from "@element-plus/icons-vue";
 import { ElMessageBox } from "element-plus";
 import { userListNoPage } from "@/api/system/user.js";
+import FileList from "./fileList.vue";
 import {
   getSalesLedgerWithProducts,
   addOrUpdateSalesLedgerProduct,
@@ -828,12 +859,9 @@
     purchaseContractNumber: "", // 閲囪喘鍚堝悓缂栧彿
     salesContractNo: "", // 閿�鍞悎鍚岀紪鍙�
     projectName: "", // 椤圭洰鍚嶇О
-    entryDate: [
-      dayjs().format("YYYY-MM-DD"),
-      dayjs().add(1, "day").format("YYYY-MM-DD"),
-    ], // 褰曞叆鏃ユ湡
-    entryDateStart: dayjs().format("YYYY-MM-DD"),
-    entryDateEnd: dayjs().add(1, "day").format("YYYY-MM-DD"),
+    entryDate: null, // 褰曞叆鏃ユ湡
+    entryDateStart: undefined,
+    entryDateEnd: undefined,
   },
   form: {
     purchaseContractNumber: "",
@@ -845,6 +873,7 @@
     supplierName: "",
     supplierId: "",
     paymentMethod: "",
+		executionDate: "",
   },
   rules: {
     purchaseContractNumber: [
@@ -852,6 +881,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);
@@ -875,6 +906,7 @@
     taxInclusiveTotalPrice: "",
     taxExclusiveTotalPrice: "",
     invoiceType: "",
+		warnNum: "",
   },
   productRules: {
     productId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
@@ -885,6 +917,7 @@
       { required: true, message: "璇疯緭鍏�", trigger: "blur" },
     ],
     taxRate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+		warnNum: [{ required: false, message: "璇烽�夋嫨", trigger: "change" }],
     taxInclusiveTotalPrice: [
       { required: true, message: "璇疯緭鍏�", trigger: "blur" },
     ],
@@ -1067,9 +1100,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 = [];
@@ -1126,10 +1159,16 @@
   });
 };
 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) || "";
+    productForm.value.productId = 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);
@@ -1144,12 +1183,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瀛楃涓诧級
       }
     }
   }
@@ -1206,6 +1245,13 @@
     proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
     return;
   }
+  // 淇濊瘉鑷冲皯淇濈暀涓�鏉′骇鍝佷俊鎭�
+  const remainingCount =
+    productData.value.length - productSelectedRows.value.length;
+  if (remainingCount < 1) {
+    proxy.$modal.msgWarning("鑷冲皯淇濈暀涓�鏉′骇鍝佷俊鎭紝鏃犳硶鍏ㄩ儴鍒犻櫎");
+    return;
+  }
   if (operationType.value === "add") {
     productSelectedRows.value.forEach((selectedRow) => {
       const index = productData.value.findIndex(
@@ -1229,7 +1275,7 @@
         delProduct(ids).then((res) => {
           proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
           closeProductDia();
-          getSalesLedgerWithProducts({ id: currentId.value, type: 2 }).then(
+					getPurchaseById({ id: currentId.value, type: 2 }).then(
             (res) => {
               productData.value = res.productData;
             }
@@ -1334,29 +1380,29 @@
   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);
     }
   }
@@ -1380,6 +1426,11 @@
     productData.value = data;
   }
 };
+
+const fileListRef = ref(null)
+const downLoadFile = (row) => {
+	fileListRef.value.open(row.salesLedgerFiles)
+}
 
 // 鏄剧ず浜岀淮鐮�
 const showQRCode = async (row) => {
@@ -1412,7 +1463,7 @@
     proxy.$modal.msgWarning("浜岀淮鐮佹湭鐢熸垚");
     return;
   }
-  
+
   const a = document.createElement('a');
   a.href = qrCodeUrl.value;
   a.download = `閲囪喘鍚堝悓鍙蜂簩缁寸爜_${new Date().getTime()}.png`;
@@ -1472,7 +1523,7 @@
 // 瑙f瀽鎵爜鍐呭锛堟ā鎷熻В鏋愪簩缁寸爜鏁版嵁锛�
 const parseScanContent = (content) => {
   if (!content) return;
-  
+
   // 妯℃嫙瑙f瀽浜岀淮鐮佸唴瀹癸紝杩欓噷鍙互鏍规嵁瀹為檯闇�姹傝皟鏁磋В鏋愰�昏緫
   // 鍋囪鎵爜鍐呭鏍煎紡涓猴細鍚堝悓鍙穦渚涘簲鍟唡椤圭洰|閲戦|浠樻鏂瑰紡
   const parts = content.split('|');
@@ -1507,11 +1558,11 @@
         remark: scanAddForm.scanRemark,
         type: 2
       };
-      
+
       // 妯℃嫙鏂板鎴愬姛
       proxy.$modal.msgSuccess("鎵爜鏂板鎴愬姛锛�");
       closeScanAddDialog();
-      
+
       // 鍙互閫夋嫨鏄惁鍒锋柊鍒楄〃
       // getList();
     }

--
Gitblit v1.9.3