From 2ceb99a629b70a3d63154656b534dcc603af78e7 Mon Sep 17 00:00:00 2001
From: zhaowei <zhaowei>
Date: 星期五, 14 二月 2025 13:55:45 +0800
Subject: [PATCH] 1、调整产品和设备结构树权限配置分配用户时,admin只有在分配后或者有权限时才会被禁用

---
 src/views/dnc/common/ImportFileModal.vue |   77 ++++++++++++++++++++++++++++----------
 1 files changed, 56 insertions(+), 21 deletions(-)

diff --git a/src/views/dnc/common/ImportFileModal.vue b/src/views/dnc/common/ImportFileModal.vue
index 6dd4ce0..e9ae1a0 100644
--- a/src/views/dnc/common/ImportFileModal.vue
+++ b/src/views/dnc/common/ImportFileModal.vue
@@ -38,7 +38,9 @@
         fileList: [],
         uploadParams: {},
         uploading: false,
-        isUploadMultiple: true
+        isUploadMultiple: true,
+        currentDeviceDocClassCode: 'SEND',
+        currentTitleAfterClass: ''
       }
     },
     created() {
@@ -49,9 +51,10 @@
       /**
        * 鐐瑰嚮瀵煎叆鏂囨。鎴朜C绋嬪簭鏃惰Е鍙�
        * @param treeNodeInfo 鐐瑰嚮鏍戣妭鐐瑰彸閿彍鍗曞鍏ョ▼搴忔椂浼犲叆鏍戣妭鐐逛俊鎭�
-       * @param tableRowInfo 鐐瑰嚮琛ㄦ牸琛屽彸閿彍鍗曞鍏ョ▼搴忔椂浼犲叆琛屼俊鎭�
+       * @param tableRowInfo 鍙抽敭琛ㄦ牸琛屾椂浼犲叆琛屼俊鎭�
+       * @param modalTitle 寮圭獥鏍囬
        */
-      handleImport(treeNodeInfo, tableRowInfo) {
+      handleImport(treeNodeInfo, tableRowInfo, modalTitle) {
         this.isUploadMultiple = true
         let attributionId // 鏂囨。鎵�灞炲眰绾d
         let attributionType  // 鏂囨。鎵�灞炲眰绾х被鍨�
@@ -59,45 +62,49 @@
         if (treeNodeInfo) {
           attributionId = treeNodeInfo.treeKey
           attributionType = treeNodeInfo.type
+          docClassCode = treeNodeInfo.param
         } else {
           attributionId = tableRowInfo.attributionId
           attributionType = tableRowInfo.attributionType
+          docClassCode = tableRowInfo.param
         }
-        if (attributionType === 5 || attributionType === 6) docClassCode = 'NC'
-        else docClassCode = 'OTHER'
+        this.setModalTitle(modalTitle, docClassCode)
         this.uploadParams = Object.assign({}, { attributionId, attributionType, docClassCode })
+        console.log('uploadParams=====================', this.uploadParams)
         this.visible = true
       },
 
+      /**
+       * 鐐瑰嚮鏂囨。鐢熷懡鍛ㄦ湡鐨勫叆搴撴椂瑙﹀彂
+       * @param _
+       * @param tableRowInfo 鍙抽敭琛ㄦ牸琛屾椂浼犲叆琛屼俊鎭�
+       */
       handlePush(_, tableRowInfo) {
         this.isUploadMultiple = false
         console.log('tableRowInfo', tableRowInfo)
         this.uploadParams = Object.assign({}, {
-          id: tableRowInfo.docId,
+          docId: tableRowInfo.docId,
           attributionId: tableRowInfo.attributionId,
           docClassCode: tableRowInfo.param
         })
         this.visible = true
       },
 
-      handleRemove(file) {
-        const index = this.fileList.indexOf(file)
-        const newFileList = this.fileList.slice()
-        newFileList.splice(index, 1)
-        this.fileList = newFileList
-      },
-
+      /**
+       * 閫夋嫨濂芥枃浠剁偣鍑荤‘瀹氬悗
+       * @param file 鏂囦欢瀵硅薄
+       */
       beforeUpload(file) {
         if (this.isUploadMultiple) {
           if (!this.fileList.find(item => item.name === file.name)) this.fileList = [...this.fileList, file]
-        } else {
-          this.fileList.splice(0, 1, file)
         }
+        else this.fileList.splice(0, 1, file)
         return false
       },
 
+      // 鐐瑰嚮涓婁紶鑷虫湇鍔″櫒鎸夐挳鏃惰Е鍙�
       handleUpload() {
-        const { fileList, $notification, isUploadMultiple, uploadParams, $bus } = this
+        const { fileList, $notification, isUploadMultiple, uploadParams, $bus, handleModalClose } = this
         this.uploading = true
         let uploadedFileCount = 0
         let uploadSuccessFileCount = 0
@@ -114,7 +121,7 @@
             params = Object.assign({}, { params: uploadParams, formData })
           } else {
             apiMethod = dncApi.documentVersionUpdateApi
-            params = Object.assign({}, { id: uploadParams.id, formData })
+            params = Object.assign({}, { docId: uploadParams.docId, formData })
           }
           apiMethod(params)
             .then(res => {
@@ -144,8 +151,11 @@
               if (uploadedFileCount === fileList.length) {
                 // 鑷冲皯鏈変竴涓枃浠朵笂浼犳垚鍔熷悗灏遍渶瑕侀噸鏂板姞杞芥枃妗e垪琛�
                 if (uploadSuccessFileCount > 0) {
-                  $bus.$emit('importFileSuccess', uploadParams)
-                  if (!isUploadMultiple) this.visible = false //鏃犳硶杩炵画鍏ュ簱澶氫釜鐗堟湰鍥犳鍏ュ簱鎴愬姛鍚庡嵆鍙��鍑虹獥鍙�
+                  $bus.$emit('reloadDocumentListData', uploadParams)
+                  if (!isUploadMultiple) {
+                    $bus.$emit('reloadMainBottomTableData', 'documentVersion')
+                    handleModalClose() //鏃犳硶杩炵画鍏ュ簱澶氫釜鐗堟湰鍥犳鍏ュ簱鎴愬姛鍚庡嵆鍙��鍑虹獥鍙�
+                  }
                 }
                 this.uploading = false
               }
@@ -154,17 +164,42 @@
       },
 
       /**
-       * 鎺у埗鏂囦欢涓婁紶绐楀彛鍏抽棴骞舵竻绌烘枃浠跺垪琛�
+       * 鍒犻櫎鏂囦欢鍒楄〃椤规椂瑙﹀彂
+       * @param file 鏂囦欢瀵硅薄
        */
+      handleRemove(file) {
+        const index = this.fileList.indexOf(file)
+        const newFileList = this.fileList.slice()
+        newFileList.splice(index, 1)
+        this.fileList = newFileList
+      },
+
+      // 鎺у埗鏂囦欢涓婁紶绐楀彛鍏抽棴骞舵竻绌烘枃浠跺垪琛�
       handleModalClose() {
         this.visible = false
         this.fileList = []
       },
 
+      /**
+       * 璁剧疆寮圭獥鏍囬
+       * @param modalTitle 寮圭獥鏍囬
+       * @param docClassCode 鏂囨。绫诲瀷
+       */
+      setModalTitle(modalTitle, docClassCode) {
+        switch (docClassCode) {
+          case 'SEND':
+            this.title = modalTitle + '锛堝彂閫侊級'
+            break
+          case 'REC':
+            this.title = modalTitle + '锛堟帴鏀讹級'
+            break
+        }
+      },
+
       triggerCorrespondingMethod({ methodName, modalTitle, treeNodeInfo, tableRowInfo }) {
         if (this[methodName]) {
-          this[methodName](treeNodeInfo, tableRowInfo)
           this.title = modalTitle
+          this[methodName](treeNodeInfo, tableRowInfo, modalTitle)
         }
       }
     }

--
Gitblit v1.9.3