From 6e1b96ef02d45d7be6f3c0117a212ba963098886 Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期四, 16 四月 2026 16:26:10 +0800
Subject: [PATCH] Merge branch 'dev_河南_鹤壁天沐玻璃厂' of http://114.132.189.42:9002/r/product-inventory-management into dev_河南_鹤壁天沐玻璃厂

---
 src/views/procurementManagement/procurementLedger/index.vue |  270 ++++++++++++++++++++++++++++-------------------------
 1 files changed, 142 insertions(+), 128 deletions(-)

diff --git a/src/views/procurementManagement/procurementLedger/index.vue b/src/views/procurementManagement/procurementLedger/index.vue
index 7167904..4479251 100644
--- a/src/views/procurementManagement/procurementLedger/index.vue
+++ b/src/views/procurementManagement/procurementLedger/index.vue
@@ -53,7 +53,9 @@
       <div style="display: flex;justify-content: flex-end;margin-bottom: 20px;">
         <el-button type="primary"
                    @click="openForm('add')">鏂板鍙拌处</el-button>
-        <el-button type="primary" plain @click="handleImport">瀵煎叆</el-button>
+        <el-button type="primary"
+                   plain
+                   @click="handleImport">瀵煎叆</el-button>
         <el-button @click="handleOut">瀵煎嚭</el-button>
         <el-button type="danger"
                    plain
@@ -94,7 +96,6 @@
                                prop="availableQuality" />
               <el-table-column label="閫�璐ф暟閲�"
                                prop="returnQuality" />
-                               
               <el-table-column label="绋庣巼(%)"
                                prop="taxRate" />
               <el-table-column label="鍚◣鍗曚环(鍏�)"
@@ -119,11 +120,11 @@
                          show-overflow-tooltip />
         <el-table-column label="閿�鍞悎鍚屽彿"
                          prop="salesContractNo"
-                          width="160"
+                         width="160"
                          show-overflow-tooltip />
         <el-table-column label="渚涘簲鍟嗗悕绉�"
                          prop="supplierName"
-                          width="160"
+                         width="160"
                          show-overflow-tooltip />
         <el-table-column label="椤圭洰鍚嶇О"
                          prop="projectName"
@@ -134,9 +135,8 @@
                          width="100"
                          show-overflow-tooltip>
           <template #default="scope">
-            <el-tag 
-              :type="getApprovalStatusType(scope.row.approvalStatus)"
-              size="small">
+            <el-tag :type="getApprovalStatusType(scope.row.approvalStatus)"
+                    size="small">
               {{ approvalStatusText[scope.row.approvalStatus] || '鏈煡鐘舵��' }}
             </el-tag>
           </template>
@@ -189,12 +189,12 @@
                   @pagination="paginationChange" />
     </div>
     <FormDialog v-model="dialogFormVisible"
-               :title="operationType === 'add' ? '鏂板閲囪喘鍙拌处椤甸潰' : '缂栬緫閲囪喘鍙拌处椤甸潰'"
-               :width="'70%'"
-               :operation-type="operationType"
-               @close="closeDia"
-               @confirm="submitForm"
-               @cancel="closeDia">
+                :title="operationType === 'add' ? '鏂板閲囪喘鍙拌处椤甸潰' : '缂栬緫閲囪喘鍙拌处椤甸潰'"
+                :width="'70%'"
+                :operation-type="operationType"
+                @close="closeDia"
+                @confirm="submitForm"
+                @cancel="closeDia">
       <el-form :model="form"
                label-width="140px"
                label-position="top"
@@ -236,7 +236,7 @@
                 <el-option v-for="item in supplierList"
                            :key="item.id"
                            :label="item.supplierName"
-													 :value="item.id" >{{item.supplierName + '---' + item.supplierType}}</el-option>
+                           :value="item.id">{{item.supplierName + '---' + item.supplierType}}</el-option>
               </el-select>
             </el-form-item>
           </el-col>
@@ -304,38 +304,33 @@
               <template #label>
                 <div style="display: flex; align-items: center; justify-content: space-between; width: 100%;">
                   <span>瀹℃壒浜洪�夋嫨锛�</span>
-                  <el-button type="primary" size="small" @click="addApproverNode" icon="Plus">鏂板鑺傜偣</el-button>
+                  <el-button type="primary"
+                             size="small"
+                             @click="addApproverNode"
+                             icon="Plus">鏂板鑺傜偣</el-button>
                 </div>
               </template>
               <div class="approver-nodes-container">
-                <div
-                  v-for="(node, index) in approverNodes"
-                  :key="node.id"
-                  class="approver-node-item"
-                >
+                <div v-for="(node, index) in approverNodes"
+                     :key="node.id"
+                     class="approver-node-item">
                   <div class="approver-node-header">
                     <span class="approver-node-label">瀹℃壒鑺傜偣 {{ index + 1 }}</span>
-                    <el-button
-                      v-if="approverNodes.length > 1"
-                      type="danger"
-                      size="small"
-                      text
-                      @click="removeApproverNode(index)"
-                      icon="Delete"
-                    >鍒犻櫎</el-button>
+                    <el-button v-if="approverNodes.length > 1"
+                               type="danger"
+                               size="small"
+                               text
+                               @click="removeApproverNode(index)"
+                               icon="Delete">鍒犻櫎</el-button>
                   </div>
-                  <el-select
-                    v-model="node.userId"
-                    placeholder="璇烽�夋嫨瀹℃壒浜�"
-                    filterable
-                    style="width: 100%;"
-                  >
-                    <el-option
-                      v-for="user in userList"
-                      :key="user.userId"
-                      :label="user.nickName"
-                      :value="user.userId"
-                    />
+                  <el-select v-model="node.userId"
+                             placeholder="璇烽�夋嫨瀹℃壒浜�"
+                             filterable
+                             style="width: 100%;">
+                    <el-option v-for="user in userListApprove"
+                               :key="user.userId"
+                               :label="user.userName"
+                               :value="user.userId" />
                   </el-select>
                 </div>
               </div>
@@ -373,11 +368,10 @@
                          :value="item.templateName">
                 <div style="display: flex; justify-content: space-between; align-items: center;">
                   <span>{{ item.templateName }}</span>
-                  <el-icon 
-                    v-if="item.id"
-                    class="delete-icon"
-                    @click.stop="handleDeleteTemplate(item)"
-                    style="cursor: pointer; color: #f56c6c; font-size: 14px; margin-left: 8px;">
+                  <el-icon v-if="item.id"
+                           class="delete-icon"
+                           @click.stop="handleDeleteTemplate(item)"
+                           style="cursor: pointer; color: #f56c6c; font-size: 14px; margin-left: 8px;">
                     <Delete />
                   </el-icon>
                 </div>
@@ -493,28 +487,24 @@
       </el-form>
     </FormDialog>
     <!-- 瀵煎叆寮圭獥 -->
-    <FormDialog
-      v-model="importUpload.open"
-      :title="importUpload.title"
-      :width="'600px'"
-      @close="importUpload.open = false"
-      @confirm="submitImportFile"
-      @cancel="importUpload.open = false"
-    >
-      <el-upload
-        ref="importUploadRef"
-        :limit="1"
-        accept=".xlsx,.xls"
-        :action="importUpload.url"
-        :headers="importUpload.headers"
-        :before-upload="importUpload.beforeUpload"
-        :on-success="importUpload.onSuccess"
-        :on-error="importUpload.onError"
-        :on-progress="importUpload.onProgress"
-        :on-change="importUpload.onChange"
-        :auto-upload="false"
-        drag
-      >
+    <FormDialog v-model="importUpload.open"
+                :title="importUpload.title"
+                :width="'600px'"
+                @close="importUpload.open = false"
+                @confirm="submitImportFile"
+                @cancel="importUpload.open = false">
+      <el-upload ref="importUploadRef"
+                 :limit="1"
+                 accept=".xlsx,.xls"
+                 :action="importUpload.url"
+                 :headers="importUpload.headers"
+                 :before-upload="importUpload.beforeUpload"
+                 :on-success="importUpload.onSuccess"
+                 :on-error="importUpload.onError"
+                 :on-progress="importUpload.onProgress"
+                 :on-change="importUpload.onChange"
+                 :auto-upload="false"
+                 drag>
         <i class="el-icon-upload"></i>
         <div class="el-upload__text">
           灏嗘枃浠舵嫋鍒版澶勶紝鎴�<em>鐐瑰嚮涓婁紶</em>
@@ -522,18 +512,20 @@
         <template #tip>
           <div class="el-upload__tip">
             浠呮敮鎸� xls/xlsx锛屽ぇ灏忎笉瓒呰繃 10MB銆�
-            <el-button link type="primary" @click="downloadTemplate">涓嬭浇瀵煎叆妯℃澘</el-button>
+            <el-button link
+                       type="primary"
+                       @click="downloadTemplate">涓嬭浇瀵煎叆妯℃澘</el-button>
           </div>
         </template>
       </el-upload>
     </FormDialog>
     <FormDialog v-model="productFormVisible"
-               :title="productOperationType === 'add' ? '鏂板浜у搧' : '缂栬緫浜у搧'"
-               :width="'40%'"
-               :operation-type="productOperationType"
-               @close="closeProductDia"
-               @confirm="submitProduct"
-               @cancel="closeProductDia">
+                :title="productOperationType === 'add' ? '鏂板浜у搧' : '缂栬緫浜у搧'"
+                :width="'40%'"
+                :operation-type="productOperationType"
+                @close="closeProductDia"
+                @confirm="submitProduct"
+                @cancel="closeProductDia">
       <el-form :model="productForm"
                label-width="140px"
                label-position="top"
@@ -694,11 +686,9 @@
         </el-row>
       </el-form>
     </FormDialog>
-    <FileListDialog 
-      ref="fileListRef" 
-      v-model="fileListDialogVisible"
-      title="闄勪欢鍒楄〃"
-    />
+    <FileListDialog ref="fileListRef"
+                    v-model="fileListDialogVisible"
+                    title="闄勪欢鍒楄〃" />
   </div>
 </template>
 
@@ -716,8 +706,10 @@
   import { Search, Delete } from "@element-plus/icons-vue";
   import { ElMessageBox, ElMessage } from "element-plus";
   import { userListNoPage } from "@/api/system/user.js";
-  import FormDialog from '@/components/Dialog/FormDialog.vue';
-  import FileListDialog from '@/components/Dialog/FileListDialog.vue';
+  import { approveUserList } from "@/api/collaborativeApproval/approvalProcess.js";
+
+  import FormDialog from "@/components/Dialog/FormDialog.vue";
+  import FileListDialog from "@/components/Dialog/FileListDialog.vue";
   import {
     getSalesLedgerWithProducts,
     addOrUpdateSalesLedgerProduct,
@@ -748,6 +740,7 @@
   const productSelectedRows = ref([]);
   const modelOptions = ref([]);
   const userList = ref([]);
+  const userListApprove = ref([]);
   const productOptions = ref([]);
   const salesContractList = ref([]);
   const supplierList = ref([]);
@@ -770,7 +763,7 @@
   const addApproverNode = () => {
     approverNodes.value.push({ id: nextApproverId++, userId: null });
   };
-  const removeApproverNode = (index) => {
+  const removeApproverNode = index => {
     approverNodes.value.splice(index, 1);
   };
 
@@ -783,12 +776,12 @@
   };
 
   // 鑾峰彇瀹℃壒鐘舵�佹爣绛剧被鍨�
-  const getApprovalStatusType = (status) => {
+  const getApprovalStatusType = status => {
     const typeMap = {
-      1: "info",      // 寰呭鏍� - 鐏拌壊
-      2: "warning",   // 瀹℃壒涓� - 姗欒壊
-      3: "success",   // 瀹℃壒閫氳繃 - 缁胯壊
-      4: "danger",    // 瀹℃壒澶辫触 - 绾㈣壊
+      1: "info", // 寰呭鏍� - 鐏拌壊
+      2: "warning", // 瀹℃壒涓� - 姗欒壊
+      3: "success", // 瀹℃壒閫氳繃 - 缁胯壊
+      4: "danger", // 瀹℃壒澶辫触 - 绾㈣壊
     };
     return typeMap[status] || "";
   };
@@ -870,7 +863,8 @@
         form.value.paymentMethod = matchedTemplate.paymentMethod;
       }
       // 妯℃澘鏁版嵁涓殑浜у搧瀛楁鏄� productList锛岄渶瑕佽浆鎹负 productData
-      productData.value = matchedTemplate.productList || matchedTemplate.productData || [];
+      productData.value =
+        matchedTemplate.productList || matchedTemplate.productData || [];
     } else {
       // 鏈尮閰嶅埌宸叉湁妯℃澘锛岃涓烘柊妯℃澘
       currentTemplateId.value = null;
@@ -1004,7 +998,7 @@
     url: import.meta.env.VITE_APP_BASE_API + "/purchase/ledger/import",
     headers: { Authorization: "Bearer " + getToken() },
     isUploading: false,
-    beforeUpload: (file) => {
+    beforeUpload: file => {
       const isExcel = file.name.endsWith(".xlsx") || file.name.endsWith(".xls");
       const isLt10M = file.size / 1024 / 1024 < 10;
       if (!isExcel) {
@@ -1053,7 +1047,11 @@
 
   // 涓嬭浇瀵煎叆妯℃澘锛堝鍚庣璺緞涓嶅悓锛屽彲鍦ㄦ澶勮皟鏁达級
   const downloadTemplate = () => {
-    proxy.download("/purchase/ledger/exportTemplate", {}, "閲囪喘鍙拌处瀵煎叆妯℃澘.xlsx");
+    proxy.download(
+      "/purchase/ledger/exportTemplate",
+      {},
+      "閲囪喘鍙拌处瀵煎叆妯℃澘.xlsx"
+    );
   };
 
   const submitImportFile = () => {
@@ -1118,8 +1116,8 @@
     // 妫�鏌ユ槸鍚︽湁浜у搧鏁版嵁
     if (!productData.value || productData.value.length === 0) {
       ElMessage({
-        message: '璇峰厛娣诲姞浜у搧淇℃伅',
-        type: 'warning',
+        message: "璇峰厛娣诲姞浜у搧淇℃伅",
+        type: "warning",
       });
       return;
     }
@@ -1130,7 +1128,7 @@
         .filter(node => node.userId)
         .map(node => node.userId)
         .join(",");
-      
+
       let params = {
         productData: proxy.HaveJson(productData.value),
         supplierId: form.value.supplierId,
@@ -1140,7 +1138,12 @@
         approveUserIds: approveUserIds,
         templateName: templateName.value.trim(),
       };
-      console.log("template params ===>", params, "currentTemplateId:", currentTemplateId.value);
+      console.log(
+        "template params ===>",
+        params,
+        "currentTemplateId:",
+        currentTemplateId.value
+      );
 
       // 濡傛灉 currentTemplateId 鏈夊�硷紝璇存槑褰撳墠鏄�滅紪杈戝凡鏈夋ā鏉库�� 鈫� 璋冪敤鏇存柊鎺ュ彛
       // 鍚﹀垯涓衡�滄柊寤烘ā鏉库�� 鈫� 璋冪敤鏂板鎺ュ彛
@@ -1279,7 +1282,7 @@
         return;
       }
     }
-    
+
     await getTemplateList();
     operationType.value = type;
     form.value = {};
@@ -1298,7 +1301,9 @@
         getSalesNo(),
         getOptions(),
       ]);
-
+      approveUserList({ approveType: 5 }).then(res => {
+        userListApprove.value = res.data;
+      });
       userList.value = userRes.data || [];
       salesContractList.value = salesRes || [];
       // 渚涘簲鍟嗚繃婊ゅ嚭isWhite=0 鐨勬暟鎹�
@@ -1334,7 +1339,7 @@
             const approverIds = purchaseRes.approveUserIds.split(",");
             approverNodes.value = approverIds.map((id, index) => ({
               id: index + 1,
-              userId: Number(id)
+              userId: Number(id),
             }));
             nextApproverId = approverIds.length + 1;
           }
@@ -1412,8 +1417,10 @@
           proxy.$modal.msgError("璇蜂负鎵�鏈夊鎵硅妭鐐归�夋嫨瀹℃壒浜猴紒");
           return;
         }
-        const approveUserIds = approverNodes.value.map(node => node.userId).join(",");
-        
+        const approveUserIds = approverNodes.value
+          .map(node => node.userId)
+          .join(",");
+
         if (productData.value.length > 0) {
           // 鏂板鏃讹紝闇�瑕佷粠姣忎釜浜у搧瀵硅薄涓垹闄� id 瀛楁
           let processedProductData = productData.value;
@@ -1470,17 +1477,17 @@
     productForm.value = {};
     proxy.resetForm("productFormRef");
     productFormVisible.value = true;
-    
+
     // 鍏堣幏鍙栦骇鍝侀�夐」锛岀‘淇濇暟鎹姞杞藉畬鎴�
     await getProductOptions();
-    
+
     // 绛夊緟 DOM 鏇存柊
     await nextTick();
-    
+
     if (type === "edit") {
       // 澶嶅埗琛屾暟鎹�
       productForm.value = { ...row };
-      
+
       // 濡傛灉鏄粠妯℃澘鍔犺浇鐨勬暟鎹紝鍙兘娌℃湁 productId 鍜� productModelId
       // 闇�瑕佹牴鎹� productCategory 鍜� specificationModel 鏉ユ煡鎵惧搴旂殑 ID
       if (!productForm.value.productId && productForm.value.productCategory) {
@@ -1491,25 +1498,34 @@
               return nodes[i].value;
             }
             if (nodes[i].children && nodes[i].children.length > 0) {
-              const found = findProductIdByCategory(nodes[i].children, categoryName);
+              const found = findProductIdByCategory(
+                nodes[i].children,
+                categoryName
+              );
               if (found) return found;
             }
           }
           return null;
         };
-        
-        const productId = findProductIdByCategory(productOptions.value, productForm.value.productCategory);
+
+        const productId = findProductIdByCategory(
+          productOptions.value,
+          productForm.value.productCategory
+        );
         if (productId) {
           productForm.value.productId = productId;
           // 鑾峰彇鍨嬪彿鍒楄〃骞剁瓑寰呭畬鎴�
           const modelRes = await modelList({ id: productId });
           modelOptions.value = modelRes;
-          
+
           // 绛夊緟 DOM 鏇存柊
           await nextTick();
-          
+
           // 鏍规嵁 specificationModel 鏌ユ壘 productModelId
-          if (productForm.value.specificationModel && modelOptions.value.length > 0) {
+          if (
+            productForm.value.specificationModel &&
+            modelOptions.value.length > 0
+          ) {
             const modelItem = modelOptions.value.find(
               item => item.model === productForm.value.specificationModel
             );
@@ -1523,15 +1539,15 @@
       } else if (productForm.value.productId) {
         // 濡傛灉鏈� productId锛屾甯稿姞杞藉瀷鍙峰垪琛�
         await getModels(productForm.value.productId);
-        
+
         // 绛夊緟 DOM 鏇存柊
         await nextTick();
-        
+
         if (productForm.value.productModelId) {
           getProductModel(productForm.value.productModelId);
         }
       }
-      
+
       // 鏈�鍚庡啀绛夊緟涓�娆� DOM 鏇存柊锛岀‘淇濇墍鏈夋暟鎹兘宸茶缃�
       await nextTick();
     }
@@ -1654,11 +1670,9 @@
           delProduct(ids).then(res => {
             proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
             closeProductDia();
-            getPurchaseById({ id: currentId.value, type: 2 }).then(
-              res => {
-                productData.value = res.productData;
-              }
-            );
+            getPurchaseById({ id: currentId.value, type: 2 }).then(res => {
+              productData.value = res.productData;
+            });
           });
         })
         .catch(() => {
@@ -1866,12 +1880,12 @@
   };
 
   // 鍒犻櫎妯℃澘
-  const handleDeleteTemplate = async (item) => {
+  const handleDeleteTemplate = async item => {
     if (!item.id) {
       proxy.$modal.msgWarning("鏃犳硶鍒犻櫎璇ユā鏉�");
       return;
     }
-    
+
     try {
       await ElMessageBox.confirm(
         `纭畾瑕佸垹闄ゆā鏉�"${item.templateName}"鍚楋紵`,
@@ -1882,7 +1896,7 @@
           type: "warning",
         }
       );
-      
+
       const res = await delPurchaseTemplate([item.id]);
       if (res && res.code === 200) {
         ElMessage({
@@ -1935,7 +1949,7 @@
     display: flex;
     align-items: center;
   }
-  
+
   // 瀹℃壒浜鸿妭鐐瑰鍣ㄦ牱寮�
   .approver-nodes-container {
     display: flex;
@@ -1946,7 +1960,7 @@
     border-radius: 4px;
     border: 1px solid #e4e7ed;
   }
-  
+
   .approver-node-item {
     flex: 0 0 calc(33.333% - 12px);
     min-width: 200px;
@@ -1955,38 +1969,38 @@
     border-radius: 4px;
     border: 1px solid #dcdfe6;
     transition: all 0.3s;
-    
+
     &:hover {
       border-color: #409eff;
       box-shadow: 0 2px 8px rgba(64, 158, 255, 0.1);
     }
   }
-  
+
   .approver-node-header {
     display: flex;
     justify-content: space-between;
     align-items: center;
     margin-bottom: 8px;
   }
-  
+
   .approver-node-label {
     font-size: 13px;
     font-weight: 500;
     color: #606266;
   }
-  
+
   @media (max-width: 1200px) {
     .approver-node-item {
       flex: 0 0 calc(50% - 8px);
     }
   }
-  
+
   @media (max-width: 768px) {
     .approver-node-item {
       flex: 0 0 100%;
     }
   }
-  
+
   // 鍒犻櫎鍥炬爣鏍峰紡
   .delete-icon {
     transition: all 0.3s;

--
Gitblit v1.9.3