From 7e07d6e781f195995b27b82b4df66c3ffa391501 Mon Sep 17 00:00:00 2001
From: zhaowei <zhaowei>
Date: 星期五, 17 一月 2025 09:49:25 +0800
Subject: [PATCH] 1、产品结构树页面完成文档生命周期相关功能,待后续开发至文档版本列表时继续完善与生命周期功能的关联 2、删除导出文档或NC程序功能

---
 src/views/dnc/base/modules/ProductStructure/Document/OtherDocumentTableList.vue |   12 
 src/api/dnc.js                                                                  |   32 ++
 src/views/dnc/base/modules/ProductStructure/Document/DocumentInfo.vue           |    4 
 src/views/dnc/base/modules/ProductStructure/Document/DocumentModalForm.vue      |    1 
 src/views/dnc/base/modules/ProductStructure/ProductStructureMainTop.vue         |  224 ++++++++++++++++++++++
 src/views/dnc/common/TableContextMenu.vue                                       |   59 +++--
 src/views/dnc/base/modules/ProductStructure/ProductStructureTree.vue            |    2 
 src/views/dnc/base/modules/ProductStructure/ProductStructureTreeContextMenu.vue |   66 +++---
 src/views/dnc/base/modules/ProductStructure/Document/NcDocumentTableList.vue    |   12 
 src/views/dnc/common/ImportFileModal.vue                                        |   45 +++
 src/api/manage.js                                                               |  107 +++++++---
 11 files changed, 451 insertions(+), 113 deletions(-)

diff --git a/src/api/dnc.js b/src/api/dnc.js
index 165751b..0c55a47 100644
--- a/src/api/dnc.js
+++ b/src/api/dnc.js
@@ -1,13 +1,37 @@
-import { getAction, deleteAction, putAction, postAction, httpAction, uploadAction } from '@/api/manage'
+import {
+  getAction,
+  deleteAction,
+  putAction,
+  postAction,
+  httpAction,
+  uploadAction,
+  requestGetDownLoad,
+  downloadFile
+} from '@/api/manage'
 import querystring from 'querystring'
 
 export default {
   //-------------------------浜у搧缁撴瀯鏍�------------------------------------------------
   getProductStructureTreeApi: () => getAction('/nc/product/load/tree'),
 
-  // 瀵煎叆鏂囨。
-  importDocumentFromLocalApi: (params, formData) => {
+  // 瀵煎叆NC绋嬪簭/鏂囨。
+  importDocumentFromLocalApi: ({ params, formData }) => {
     const paramsStringify = querystring.stringify(params)
     return uploadAction(`/nc/doc/add?${paramsStringify}`, formData)
-  }
+  },
+
+  // 涓嬭浇鏂囨。
+  downloadDocumentApi: ({ id, docName }) => downloadFile(`/nc/doc/download/${id}`, docName),
+  // 鏂囨。鍑哄簱
+  documentOutboundApi: ({ id, docName }) => requestGetDownLoad(`/nc/doc/pull/${id}`, docName),
+  // 鏂囨。鍙栨秷鍑哄簱
+  documentCancelOutboundApi: id => putAction(`/nc/doc/cancel/pull/${id}`),
+  // 鏂囨。鍏ュ簱
+  documentVersionUpdateApi: ({ id, formData }) => uploadAction(`/nc/doc/push/${id}`, formData),
+  // 鏂囨。鍙戝竷
+  documentPublishApi: id => putAction(`/nc/doc/publish/${id}`),
+  // 鏂囨。閲嶆柊鍙戝竷
+  documentRepublishApi: id => putAction(`/nc/doc/republish/${id}`),
+  // 鏂囨。褰掓。
+  documentPigeonholeApi: id => putAction(`/nc/doc/pigeonhole/${id}`)
 }
\ No newline at end of file
diff --git a/src/api/manage.js b/src/api/manage.js
index f242f5c..dc790e6 100644
--- a/src/api/manage.js
+++ b/src/api/manage.js
@@ -13,52 +13,52 @@
 export default api
 
 //post
-export function postAction(url,parameter) {
-  let sign = signMd5Utils.getSign(url, parameter);
+export function postAction(url, parameter) {
+  let sign = signMd5Utils.getSign(url, parameter)
   //灏嗙鍚嶅拰鏃堕棿鎴筹紝娣诲姞鍦ㄨ姹傛帴鍙� Header
   // update-begin--author:taoyan---date:20220421--for: VUEN-410銆愮鍚嶆敼閫犮�� X-TIMESTAMP鐗垫壇
-  let signHeader = {"X-Sign": sign,"X-TIMESTAMP": signMd5Utils.getTimestamp()};
+  let signHeader = { 'X-Sign': sign, 'X-TIMESTAMP': signMd5Utils.getTimestamp() }
   // update-end--author:taoyan---date:20220421--for: VUEN-410銆愮鍚嶆敼閫犮�� X-TIMESTAMP鐗垫壇
 
   return axios({
     url: url,
-    method:'post' ,
+    method: 'post',
     data: parameter,
     headers: signHeader
   })
 }
 
 //post method= {post | put}
-export function httpAction(url,parameter,method) {
-  let sign = signMd5Utils.getSign(url, parameter);
+export function httpAction(url, parameter, method) {
+  let sign = signMd5Utils.getSign(url, parameter)
   //灏嗙鍚嶅拰鏃堕棿鎴筹紝娣诲姞鍦ㄨ姹傛帴鍙� Header
   // update-begin--author:taoyan---date:20220421--for: VUEN-410銆愮鍚嶆敼閫犮�� X-TIMESTAMP鐗垫壇
-  let signHeader = {"X-Sign": sign,"X-TIMESTAMP": signMd5Utils.getTimestamp()};
+  let signHeader = { 'X-Sign': sign, 'X-TIMESTAMP': signMd5Utils.getTimestamp() }
   // update-end--author:taoyan---date:20220421--for: VUEN-410銆愮鍚嶆敼閫犮�� X-TIMESTAMP鐗垫壇
 
   return axios({
     url: url,
-    method:method ,
+    method: method,
     data: parameter,
     headers: signHeader
   })
 }
 
 //put
-export function putAction(url,parameter) {
+export function putAction(url, parameter) {
   return axios({
     url: url,
-    method:'put',
+    method: 'put',
     data: parameter
   })
 }
 
 //get
-export function getAction(url,parameter) {
-  let sign = signMd5Utils.getSign(url, parameter);
+export function getAction(url, parameter) {
+  let sign = signMd5Utils.getSign(url, parameter)
   //灏嗙鍚嶅拰鏃堕棿鎴筹紝娣诲姞鍦ㄨ姹傛帴鍙� Header
   // update-begin--author:taoyan---date:20220421--for: VUEN-410銆愮鍚嶆敼閫犮�� X-TIMESTAMP鐗垫壇
-  let signHeader = {"X-Sign": sign,"X-TIMESTAMP": signMd5Utils.getTimestamp()};
+  let signHeader = { 'X-Sign': sign, 'X-TIMESTAMP': signMd5Utils.getTimestamp() }
   // update-end--author:taoyan---date:20220421--for: VUEN-410銆愮鍚嶆敼閫犮�� X-TIMESTAMP鐗垫壇
 
   return axios({
@@ -70,7 +70,7 @@
 }
 
 //deleteAction
-export function deleteAction(url,parameter) {
+export function deleteAction(url, parameter) {
   return axios({
     url: url,
     method: 'delete',
@@ -113,9 +113,9 @@
   // url = url + '?' + query;
   return axios({
     url: url,
-    method:'put',
+    method: 'put',
     data: parameter,
-    params:params
+    params: params
   })
 }
 
@@ -143,15 +143,15 @@
  * @param parameter
  * @returns {*}
  */
-export function downFile(url,parameter, method='get'){
-  if(method=='get'){
+export function downFile(url, parameter, method = 'get') {
+  if (method == 'get') {
     return axios({
       url: url,
       params: parameter,
-      method: method ,
+      method: method,
       responseType: 'blob'
     })
-  }else{
+  } else {
     return axios({
       url: url,
       method: method,
@@ -192,19 +192,60 @@
 }
 
 /**
+ * 涓嬭浇鏂囦欢
+ * @param url 鏂囦欢璺緞
+ * @param fileName 鏂囦欢鍚�
+ * @returns {*}
+ */
+export function requestGetDownLoad(url, fileName) {
+  return new Promise((resolve, reject) => {
+    axios({
+      method: 'GET',
+      url: url,
+      headers: {
+        'Access-Control-Expose-Headers': 'content-disposition'
+      },
+      responseType: 'blob' //浜岃繘鍒舵祦
+    }).then(data => {
+      if (data.type === 'application/json') {
+        let reader = new FileReader()
+        reader.readAsText(data, 'utf-8')
+        reader.onload = (e) => {
+          JSON.parse(reader.result)
+          resolve(JSON.parse(reader.result))
+        }
+      } else {
+        let blob = new Blob([data])
+        if (window.navigator.msSaveOrOpenBlob) {
+          navigator.msSaveBlob(blob, fileName)
+        } else {
+          let a = document.createElement('a')
+          a.download = fileName
+          a.href = window.URL.createObjectURL(blob)
+          a.click()
+          resolve({ success: true })
+        }
+      }
+    }).catch(error => {
+      reject(error)
+    })
+  })
+}
+
+/**
  * 鏂囦欢涓婁紶 鐢ㄤ簬瀵屾枃鏈笂浼犲浘鐗�
  * @param url
  * @param parameter
  * @returns {*}
  */
-export function uploadAction(url,parameter){
+export function uploadAction(url, parameter) {
   return axios({
     url: url,
     data: parameter,
-    method:'post' ,
+    method: 'post',
     headers: {
-      'Content-Type': 'multipart/form-data',  // 鏂囦欢涓婁紶
-    },
+      'Content-Type': 'multipart/form-data'  // 鏂囦欢涓婁紶
+    }
   })
 }
 
@@ -214,17 +255,17 @@
  * @param subStr
  * @returns {*}
  */
-export function getFileAccessHttpUrl(avatar,subStr) {
-  if(!subStr) subStr = 'http'
+export function getFileAccessHttpUrl(avatar, subStr) {
+  if (!subStr) subStr = 'http'
   try {
-    if(avatar && avatar.startsWith(subStr)){
-      return avatar;
-    }else{
-      if(avatar &&銆�avatar.length>0 && avatar.indexOf('[')==-1){
-        return window._CONFIG['staticDomainURL'] + "/" + avatar;
+    if (avatar && avatar.startsWith(subStr)) {
+      return avatar
+    } else {
+      if (avatar && avatar.length > 0 && avatar.indexOf('[') == -1) {
+        return window._CONFIG['staticDomainURL'] + '/' + avatar
       }
     }
-  }catch(err){
-   return;
+  } catch (err) {
+    return
   }
 }
diff --git a/src/views/dnc/base/modules/ProductStructure/Document/DocumentInfo.vue b/src/views/dnc/base/modules/ProductStructure/Document/DocumentInfo.vue
index d100d67..95743e5 100644
--- a/src/views/dnc/base/modules/ProductStructure/Document/DocumentInfo.vue
+++ b/src/views/dnc/base/modules/ProductStructure/Document/DocumentInfo.vue
@@ -4,9 +4,9 @@
     <a-descriptions-item label="浠g爜鐗堟湰">{{currentLevelDetails.docAlias}}</a-descriptions-item>
     <a-descriptions-item label="璁惧缂栧彿	">{{currentLevelDetails.docCode}}</a-descriptions-item>
     <a-descriptions-item label="鏂囨。鍚庣紑">{{currentLevelDetails.docSuffix}}</a-descriptions-item>
-    <a-descriptions-item label="鏂囨。鐘舵��">{{currentLevelDetails.docStatus}}</a-descriptions-item>
+    <a-descriptions-item label="鏂囨。鐘舵��">{{currentLevelDetails.docStatus_dictText}}</a-descriptions-item>
     <a-descriptions-item label="绯荤粺鎸囧畾鐗堟湰">{{currentLevelDetails.publishVersion}}</a-descriptions-item>
-    <a-descriptions-item label="鍑哄簱鐘舵��">{{currentLevelDetails.pullStatus}}</a-descriptions-item>
+    <a-descriptions-item label="鍑哄簱鐘舵��">{{currentLevelDetails.pullStatus_dictText}}</a-descriptions-item>
     <a-descriptions-item label="鍑哄簱浜�" :span="2">{{currentLevelDetails.pullUser}}</a-descriptions-item>
     <a-descriptions-item label="鎻忚堪" :span="3">{{currentLevelDetails.description}}</a-descriptions-item>
   </a-descriptions>
diff --git a/src/views/dnc/base/modules/ProductStructure/Document/DocumentModalForm.vue b/src/views/dnc/base/modules/ProductStructure/Document/DocumentModalForm.vue
index d279d9b..05c8692 100644
--- a/src/views/dnc/base/modules/ProductStructure/Document/DocumentModalForm.vue
+++ b/src/views/dnc/base/modules/ProductStructure/Document/DocumentModalForm.vue
@@ -61,7 +61,6 @@
           ],
         },
         url: {
-          add: '/mdc/mdcPartProcessInfo/add',
           edit: '/mdc/mdcPartProcessInfo/edit'
         }
       }
diff --git a/src/views/dnc/base/modules/ProductStructure/Document/NcDocumentTableList.vue b/src/views/dnc/base/modules/ProductStructure/Document/NcDocumentTableList.vue
index 42cb9ee..f2f401a 100644
--- a/src/views/dnc/base/modules/ProductStructure/Document/NcDocumentTableList.vue
+++ b/src/views/dnc/base/modules/ProductStructure/Document/NcDocumentTableList.vue
@@ -45,8 +45,8 @@
           },
           { title: '鏂囦欢鍚嶇О', dataIndex: 'docName', align: 'center' },
           { title: '浠g爜鐗堟湰', dataIndex: 'docAlias', align: 'center' },
-          { title: '鍑哄簱鐘舵��', dataIndex: 'pullStatus', align: 'center' },
-          { title: '鐘�  鎬�', dataIndex: 'docStatus', align: 'center' },
+          { title: '鍑哄簱鐘舵��', dataIndex: 'pullStatus_dictText', align: 'center' },
+          { title: '鐘�  鎬�', dataIndex: 'docStatus_dictText', align: 'center' },
           { title: '绯荤粺鎸囧畾鐗堟湰', dataIndex: 'publishVersion', align: 'center' },
           { title: '涓婁紶鏃堕棿', dataIndex: 'createTime', align: 'center' }
         ],
@@ -77,9 +77,9 @@
         this.loading = true
         getAction(this.url.list + `/${this.ipagination.current}/${this.ipagination.pageSize}`, params).then((res) => {
           if (res.success) {
-            this.dataSource = res.page.records
-            if (res.page.total) {
-              this.ipagination.total = res.page.total
+            this.dataSource = res.result.records
+            if (res.result.total) {
+              this.ipagination.total = res.result.total
             } else {
               this.ipagination.total = 0
             }
@@ -96,7 +96,7 @@
           on: {
             contextmenu: event => {
               event.preventDefault()
-              this.$emit('handleTableContextMenuOpen', { ...record, param: 'document' })
+              this.$emit('handleTableContextMenuOpen', { ...record, param: 'NC' })
             },
             click: () => {
               this.$bus.$emit('sendCurrentLevelInfo', record)
diff --git a/src/views/dnc/base/modules/ProductStructure/Document/OtherDocumentTableList.vue b/src/views/dnc/base/modules/ProductStructure/Document/OtherDocumentTableList.vue
index b21d552..5c71c42 100644
--- a/src/views/dnc/base/modules/ProductStructure/Document/OtherDocumentTableList.vue
+++ b/src/views/dnc/base/modules/ProductStructure/Document/OtherDocumentTableList.vue
@@ -42,8 +42,8 @@
           },
           { title: '鏂囦欢鍚嶇О', dataIndex: 'docName', align: 'center' },
           { title: '璁惧缂栧彿', dataIndex: 'docCode', align: 'center' },
-          { title: '鍑哄簱鐘舵��', dataIndex: 'pullStatus', align: 'center' },
-          { title: '鐘�  鎬�', dataIndex: 'docStatus', align: 'center' },
+          { title: '鍑哄簱鐘舵��', dataIndex: 'pullStatus_dictText', align: 'center' },
+          { title: '鐘�  鎬�', dataIndex: 'docStatus_dictText', align: 'center' },
           { title: '绯荤粺鎸囧畾鐗堟湰', dataIndex: 'publishVersion', align: 'center' },
           { title: '涓婁紶鏃堕棿', dataIndex: 'createTime', align: 'center' }
         ],
@@ -74,9 +74,9 @@
         this.loading = true
         getAction(this.url.list + `/${this.ipagination.current}/${this.ipagination.pageSize}`, params).then((res) => {
           if (res.success) {
-            this.dataSource = res.page.records
-            if (res.page.total) {
-              this.ipagination.total = res.page.total
+            this.dataSource = res.result.records
+            if (res.result.total) {
+              this.ipagination.total = res.result.total
             } else {
               this.ipagination.total = 0
             }
@@ -93,7 +93,7 @@
           on: {
             contextmenu: event => {
               event.preventDefault()
-              this.$emit('handleTableContextMenuOpen', { ...record, param: 'document' })
+              this.$emit('handleTableContextMenuOpen', { ...record, param: 'OTHER' })
             },
             click: () => {
               this.$bus.$emit('sendCurrentLevelInfo', record)
diff --git a/src/views/dnc/base/modules/ProductStructure/ProductStructureMainTop.vue b/src/views/dnc/base/modules/ProductStructure/ProductStructureMainTop.vue
index 3d1233e..3619a9b 100644
--- a/src/views/dnc/base/modules/ProductStructure/ProductStructureMainTop.vue
+++ b/src/views/dnc/base/modules/ProductStructure/ProductStructureMainTop.vue
@@ -16,6 +16,7 @@
 </template>
 
 <script>
+  import dncApi from '@/api/dnc'
   import NcDocumentTableList from './Document/NcDocumentTableList'
   import OtherDocumentTableList from './Document/OtherDocumentTableList'
   import TableContextMenu from '../../../common/TableContextMenu'
@@ -34,6 +35,7 @@
     created() {
       this.$bus.$on('sendCurrentTreeNodeInfo', this.receiveCurrentTreeNodeInfo)
       this.$bus.$on('importFileSuccess', this.reloadDocumentListData)
+      this.$bus.$on('tableMenuItemMethodTrigger', this.triggerCorrespondingMethod)
     },
     methods: {
       /**
@@ -42,6 +44,7 @@
        */
       handleTableContextMenuOpen(record) {
         this.currentRightClickedTableRowInfo = Object.assign({}, record)
+        console.log('currentRightClickedTableRowInfo', this.currentRightClickedTableRowInfo)
         this.$refs.tableContextMenuRef.currentMenuLevel = record.param
         this.$refs.tableContextMenuRef.menuStyle.top = event.clientY + 'px'
         this.$refs.tableContextMenuRef.menuStyle.left = event.clientX + 'px'
@@ -69,7 +72,7 @@
       },
 
       /**
-       * 涓婁紶鏂囦欢鎴愬姛鍚庤Е鍙�
+       * 鏂囨。浠ュ強NC绋嬪簭瀵煎叆/鍑哄簱/鍏ュ簱鎴愬姛鍚庤Е鍙戦噸鏂板姞杞芥枃妗e垪琛�
        * @param docClassCode 鏂囨。绫诲埆
        * @param attributionId 鑺傜偣Id
        */
@@ -84,11 +87,230 @@
       },
 
       /**
+       * 鐐瑰嚮涓嬭浇鏃惰Е鍙戜笅杞藉綋鍓嶆枃妗�
+       */
+      handleDownload() {
+        const that = this
+        const { docId, docName } = this.currentRightClickedTableRowInfo
+        dncApi.downloadDocumentApi({ id: docId, docName })
+          .then(res => {
+            if (res && !res.success) {
+              that.$notification.error({
+                message: '娑堟伅',
+                description: res.message
+              })
+            }
+          })
+          .catch(err => {
+            that.$notification.error({
+              message: '娑堟伅',
+              description: err.message
+            })
+          })
+      },
+
+      /**
+       * 鐐瑰嚮鍑哄簱鏃惰Е鍙戝綋鍓嶆枃妗e嚭搴�
+       * @param menuLabel
+       */
+      handlePull(menuLabel) {
+        const that = this
+        const { docId, docName, param, attributionId } = this.currentRightClickedTableRowInfo
+        this.$confirm({
+          title: '鎻愮ず',
+          content: `纭${menuLabel}鍚楋紵`,
+          okText: '纭',
+          cancelText: '鍙栨秷',
+          onOk: () => {
+            dncApi.documentOutboundApi({ id: docId, docName })
+              .then(res => {
+                console.log('res------------------', res)
+                if (res.success) {
+                  this.reloadDocumentListData({ docClassCode: param, attributionId })
+                  that.$notification.success({
+                    message: '娑堟伅',
+                    description: `${menuLabel}鎴愬姛`
+                  })
+                } else {
+                  that.$notification.error({
+                    message: '娑堟伅',
+                    description: res.message
+                  })
+                }
+              })
+              .catch(err => {
+                that.$notification.error({
+                  message: '娑堟伅',
+                  description: err.message
+                })
+              })
+          }
+        })
+      },
+
+      /**
+       * 鐐瑰嚮鍙栨秷鍑哄簱鏃惰Е鍙戝綋鍓嶆枃妗e彇娑堝嚭搴�
+       * @param menuLabel
+       */
+      handleCancelPull(menuLabel) {
+        const that = this
+        const { docId, param, attributionId } = this.currentRightClickedTableRowInfo
+        this.$confirm({
+          title: '鎻愮ず',
+          content: `纭${menuLabel}鍚楋紵`,
+          okText: '纭',
+          cancelText: '鍙栨秷',
+          onOk: () => {
+            dncApi.documentCancelOutboundApi(docId)
+              .then(res => {
+                if (res.success) {
+                  this.reloadDocumentListData({ docClassCode: param, attributionId })
+                  that.$notification.success({
+                    message: '娑堟伅',
+                    description: res.message
+                  })
+                } else {
+                  that.$notification.error({
+                    message: '娑堟伅',
+                    description: res.message
+                  })
+                }
+              })
+              .catch(err => {
+                that.$notification.error({
+                  message: '娑堟伅',
+                  description: err.message
+                })
+              })
+          }
+        })
+      },
+
+
+      /**
+       * 鐐瑰嚮鍙戝竷鏃惰Е鍙戝綋鍓嶆枃妗e彂甯�
+       * @param menuLabel
+       */
+      handlePublish(menuLabel) {
+        const that = this
+        const { docId, param, attributionId } = this.currentRightClickedTableRowInfo
+        this.$confirm({
+          title: '鎻愮ず',
+          content: `纭${menuLabel}鍚楋紵`,
+          okText: '纭',
+          cancelText: '鍙栨秷',
+          onOk: () => {
+            dncApi.documentPublishApi(docId)
+              .then(res => {
+                if (res.success) {
+                  this.reloadDocumentListData({ docClassCode: param, attributionId })
+                  that.$notification.success({
+                    message: '娑堟伅',
+                    description: res.message
+                  })
+                } else {
+                  that.$notification.error({
+                    message: '娑堟伅',
+                    description: res.message
+                  })
+                }
+              })
+              .catch(err => {
+                that.$notification.error({
+                  message: '娑堟伅',
+                  description: err.message
+                })
+              })
+          }
+        })
+      },
+
+      /**
+       * 鐐瑰嚮閲嶆柊鍙戝竷鏃惰Е鍙戝綋鍓嶆枃妗i噸鏂板彂甯冮��鍥炰笂涓�鐗堟湰
+       * @param menuLabel
+       */
+      handleRepublish(menuLabel) {
+        const that = this
+        const { docId, param, attributionId } = this.currentRightClickedTableRowInfo
+        this.$confirm({
+          title: '鎻愮ず',
+          content: `纭${menuLabel}鍚楋紵`,
+          okText: '纭',
+          cancelText: '鍙栨秷',
+          onOk: () => {
+            dncApi.documentRepublishApi(docId)
+              .then(res => {
+                if (res.success) {
+                  this.reloadDocumentListData({ docClassCode: param, attributionId })
+                  that.$notification.success({
+                    message: '娑堟伅',
+                    description: res.message
+                  })
+                } else {
+                  that.$notification.error({
+                    message: '娑堟伅',
+                    description: res.message
+                  })
+                }
+              })
+              .catch(err => {
+                that.$notification.error({
+                  message: '娑堟伅',
+                  description: err.message
+                })
+              })
+          }
+        })
+      },
+
+      /**
+       * 鐐瑰嚮褰掓。鏃惰Е鍙戝綋鍓嶆枃妗e綊妗d笖鍚庣画鏃犳硶缁х画鍙戝竷鎴栧綊妗�
+       * @param menuLabel
+       */
+      handlePigeonhole(menuLabel) {
+        const that = this
+        const { docId, param, attributionId } = this.currentRightClickedTableRowInfo
+        this.$confirm({
+          title: '鎻愮ず',
+          content: `${menuLabel}鍚庝笉鍙彇娑堬紝纭${menuLabel}鍚楋紵`,
+          okText: '纭',
+          cancelText: '鍙栨秷',
+          onOk: () => {
+            dncApi.documentPigeonholeApi(docId)
+              .then(res => {
+                if (res.success) {
+                  this.reloadDocumentListData({ docClassCode: param, attributionId })
+                  that.$notification.success({
+                    message: '娑堟伅',
+                    description: res.message
+                  })
+                } else {
+                  that.$notification.error({
+                    message: '娑堟伅',
+                    description: res.message
+                  })
+                }
+              })
+              .catch(err => {
+                that.$notification.error({
+                  message: '娑堟伅',
+                  description: err.message
+                })
+              })
+          }
+        })
+      },
+
+      /**
        * 鎺у埗鍙抽敭鑿滃崟鐐瑰嚮鍏抽棴
        */
       handleMenuClose() {
         this.$refs.tableContextMenuRef.menuVisible = false
         document.body.removeEventListener('click', this.handleMenuClose)
+      },
+
+      triggerCorrespondingMethod({ methodName, modalTitle }) {
+        if (this[methodName]) this[methodName](modalTitle)
       }
     }
   }
diff --git a/src/views/dnc/base/modules/ProductStructure/ProductStructureTree.vue b/src/views/dnc/base/modules/ProductStructure/ProductStructureTree.vue
index fc006c1..2930dd4 100644
--- a/src/views/dnc/base/modules/ProductStructure/ProductStructureTree.vue
+++ b/src/views/dnc/base/modules/ProductStructure/ProductStructureTree.vue
@@ -15,7 +15,7 @@
               <a-icon type="bars"/>
             </a-button>
           </a-dropdown>
-          <a-button type="primary"
+          <a-button type="primary" v-has="'product_add'"
                     @click="$refs.productModalFormRef.triggerCorrespondingMethod({modalTitle:'娣诲姞浜у搧',methodName:'handleProductAdd'})">
             <a-icon type="plus"></a-icon>
             浜у搧
diff --git a/src/views/dnc/base/modules/ProductStructure/ProductStructureTreeContextMenu.vue b/src/views/dnc/base/modules/ProductStructure/ProductStructureTreeContextMenu.vue
index f7116e7..f8c9010 100644
--- a/src/views/dnc/base/modules/ProductStructure/ProductStructureTreeContextMenu.vue
+++ b/src/views/dnc/base/modules/ProductStructure/ProductStructureTreeContextMenu.vue
@@ -29,51 +29,51 @@
         defaultContextMenuList: {
           //浜у搧
           product: [
-            { show: true, label: '娣诲姞浜у搧', code: 'product_add', icon: 'plus', isCommonMethod: false },
-            { show: true, label: '娣诲姞閮ㄤ欢', code: 'product_add_child', icon: 'plus', isCommonMethod: false },
-            { show: true, label: '缂栬緫浜у搧淇℃伅', code: 'product_edit', icon: 'edit', isCommonMethod: false },
-            { show: false, label: '瀵煎嚭鏂囨。', code: 'product_export', icon: 'export', isCommonMethod: true },
-            { show: true, label: '瀵煎叆鍏朵粬鏂囨。', code: 'product_import', icon: 'import', isCommonMethod: true },
-            { show: true, label: '鍒犻櫎', code: 'product_delete', icon: 'delete', isCommonMethod: true },
-            { show: true, label: '鏉冮檺閰嶇疆', code: 'public_assign_permission', icon: 'idcard', isCommonMethod: true }
+            { label: '娣诲姞浜у搧', code: 'product_add', icon: 'plus', isCommonMethod: false },
+            { label: '娣诲姞閮ㄤ欢', code: 'product_add_child', icon: 'plus', isCommonMethod: false },
+            { label: '缂栬緫浜у搧淇℃伅', code: 'product_edit', icon: 'edit', isCommonMethod: false },
+            // {  label: '瀵煎嚭鏂囨。', code: 'product_export', icon: 'export', isCommonMethod: true },
+            { label: '瀵煎叆鍏朵粬鏂囨。', code: 'product_import', icon: 'import', isCommonMethod: true },
+            { label: '鍒犻櫎', code: 'product_delete', icon: 'delete', isCommonMethod: true },
+            { label: '鏉冮檺閰嶇疆', code: 'public_assign_permission', icon: 'idcard', isCommonMethod: true }
           ],
           //閮ㄤ欢
           component: [
-            { show: true, label: '娣诲姞瀛愰儴浠�', code: 'component_add', icon: 'plus', isCommonMethod: false },
-            { show: true, label: '娣诲姞闆朵欢', code: 'component_add_child', icon: 'plus', isCommonMethod: false },
-            { show: true, label: '鍒涘缓宸ュ簭', code: 'component_add_relative', icon: 'plus', isCommonMethod: false },
-            { show: true, label: '缂栬緫閮ㄤ欢淇℃伅', code: 'component_edit', icon: 'edit', isCommonMethod: false },
-            { show: false, label: '瀵煎嚭鏂囨。', code: 'component_export', icon: 'export', isCommonMethod: true },
-            { show: true, label: '瀵煎叆鍏朵粬鏂囨。', code: 'component_import', icon: 'import', isCommonMethod: true },
-            { show: true, label: '鍒犻櫎', code: 'component_delete', icon: 'delete', isCommonMethod: true },
-            { show: true, label: '鏉冮檺閰嶇疆', code: 'public_assign_permission', icon: 'idcard', isCommonMethod: true }
+            { label: '娣诲姞瀛愰儴浠�', code: 'component_add', icon: 'plus', isCommonMethod: false },
+            { label: '娣诲姞闆朵欢', code: 'component_add_child', icon: 'plus', isCommonMethod: false },
+            { label: '鍒涘缓宸ュ簭', code: 'component_add_relative', icon: 'plus', isCommonMethod: false },
+            { label: '缂栬緫閮ㄤ欢淇℃伅', code: 'component_edit', icon: 'edit', isCommonMethod: false },
+            // {  label: '瀵煎嚭鏂囨。', code: 'component_export', icon: 'export', isCommonMethod: true },
+            { label: '瀵煎叆鍏朵粬鏂囨。', code: 'component_import', icon: 'import', isCommonMethod: true },
+            { label: '鍒犻櫎', code: 'component_delete', icon: 'delete', isCommonMethod: true },
+            { label: '鏉冮檺閰嶇疆', code: 'public_assign_permission', icon: 'idcard', isCommonMethod: true }
           ],
           //闆朵欢
           part: [
-            { show: true, label: '娣诲姞闆朵欢', code: 'parts_add', icon: 'plus', isCommonMethod: false },
-            { show: true, label: '鍒涘缓宸ュ簭', code: 'parts_add_relative', icon: 'plus', isCommonMethod: false },
-            { show: true, label: '缂栬緫闆朵欢淇℃伅', code: 'parts_edit', icon: 'edit', isCommonMethod: false },
-            { show: false, label: '瀵煎嚭鏂囨。', code: 'parts_export', icon: 'export', isCommonMethod: true },
-            { show: true, label: '瀵煎叆鍏朵粬鏂囨。', code: 'parts_import', icon: 'import', isCommonMethod: true },
-            { show: true, label: '鍒犻櫎', code: 'parts_delete', icon: 'delete', isCommonMethod: true },
-            { show: true, label: '鏉冮檺閰嶇疆', code: 'public_assign_permission', icon: 'idcard', isCommonMethod: true }
+            { label: '娣诲姞闆朵欢', code: 'parts_add', icon: 'plus', isCommonMethod: false },
+            { label: '鍒涘缓宸ュ簭', code: 'parts_add_relative', icon: 'plus', isCommonMethod: false },
+            { label: '缂栬緫闆朵欢淇℃伅', code: 'parts_edit', icon: 'edit', isCommonMethod: false },
+            // {  label: '瀵煎嚭鏂囨。', code: 'parts_export', icon: 'export', isCommonMethod: true },
+            { label: '瀵煎叆鍏朵粬鏂囨。', code: 'parts_import', icon: 'import', isCommonMethod: true },
+            { label: '鍒犻櫎', code: 'parts_delete', icon: 'delete', isCommonMethod: true },
+            { label: '鏉冮檺閰嶇疆', code: 'public_assign_permission', icon: 'idcard', isCommonMethod: true }
           ],
           //宸ュ簭
           process: [
-            { show: true, label: '鍒涘缓宸ュ簭', code: 'process_add', icon: 'plus', isCommonMethod: false },
-            { show: true, label: '鍒涘缓宸ユ', code: 'process_add_child', icon: 'plus', isCommonMethod: false },
-            { show: true, label: '缂栬緫宸ュ簭淇℃伅', code: 'process_edit', icon: 'edit', isCommonMethod: false },
-            { show: true, label: '鍒犻櫎', code: 'process_delete', icon: 'delete', isCommonMethod: true },
-            { show: false, label: '瀵煎嚭NC绋嬪簭', code: 'process_export', icon: 'import', isCommonMethod: true },
-            { show: true, label: '瀵煎叆NC绋嬪簭', code: 'process_import', icon: 'export', isCommonMethod: true }
+            { label: '鍒涘缓宸ュ簭', code: 'process_add', icon: 'plus', isCommonMethod: false },
+            { label: '鍒涘缓宸ユ', code: 'process_add_child', icon: 'plus', isCommonMethod: false },
+            { label: '缂栬緫宸ュ簭淇℃伅', code: 'process_edit', icon: 'edit', isCommonMethod: false },
+            { label: '鍒犻櫎', code: 'process_delete', icon: 'delete', isCommonMethod: true },
+            // {  label: '瀵煎嚭NC绋嬪簭', code: 'process_export', icon: 'import', isCommonMethod: true },
+            { label: '瀵煎叆NC绋嬪簭', code: 'process_import', icon: 'export', isCommonMethod: true }
           ],
           //宸ユ
           processStep: [
-            { show: true, label: '鍒涘缓宸ユ', code: 'processStep_add', icon: 'plus', isCommonMethod: false },
-            { show: true, label: '缂栬緫宸ユ淇℃伅', code: 'processStep_edit', icon: 'edit', isCommonMethod: false },
-            { show: true, label: '鍒犻櫎', code: 'processStep_delete', icon: 'delete', isCommonMethod: true },
-            { show: false, label: '瀵煎嚭NC绋嬪簭', code: 'processStep_export', icon: 'import', isCommonMethod: true },
-            { show: true, label: '瀵煎叆NC绋嬪簭', code: 'processStep_import', icon: 'export', isCommonMethod: true }
+            { label: '鍒涘缓宸ユ', code: 'processStep_add', icon: 'plus', isCommonMethod: false },
+            { label: '缂栬緫宸ユ淇℃伅', code: 'processStep_edit', icon: 'edit', isCommonMethod: false },
+            { label: '鍒犻櫎', code: 'processStep_delete', icon: 'delete', isCommonMethod: true },
+            // {  label: '瀵煎嚭NC绋嬪簭', code: 'processStep_export', icon: 'import', isCommonMethod: true },
+            { label: '瀵煎叆NC绋嬪簭', code: 'processStep_import', icon: 'export', isCommonMethod: true }
           ]
         }
       }
diff --git a/src/views/dnc/common/ImportFileModal.vue b/src/views/dnc/common/ImportFileModal.vue
index 653ad41..6dd4ce0 100644
--- a/src/views/dnc/common/ImportFileModal.vue
+++ b/src/views/dnc/common/ImportFileModal.vue
@@ -37,7 +37,8 @@
         title: '',
         fileList: [],
         uploadParams: {},
-        uploading: false
+        uploading: false,
+        isUploadMultiple: true
       }
     },
     created() {
@@ -51,6 +52,7 @@
        * @param tableRowInfo 鐐瑰嚮琛ㄦ牸琛屽彸閿彍鍗曞鍏ョ▼搴忔椂浼犲叆琛屼俊鎭�
        */
       handleImport(treeNodeInfo, tableRowInfo) {
+        this.isUploadMultiple = true
         let attributionId // 鏂囨。鎵�灞炲眰绾d
         let attributionType  // 鏂囨。鎵�灞炲眰绾х被鍨�
         let docClassCode // 鏂囨。绫诲瀷
@@ -67,6 +69,17 @@
         this.visible = true
       },
 
+      handlePush(_, tableRowInfo) {
+        this.isUploadMultiple = false
+        console.log('tableRowInfo', tableRowInfo)
+        this.uploadParams = Object.assign({}, {
+          id: tableRowInfo.docId,
+          attributionId: tableRowInfo.attributionId,
+          docClassCode: tableRowInfo.param
+        })
+        this.visible = true
+      },
+
       handleRemove(file) {
         const index = this.fileList.indexOf(file)
         const newFileList = this.fileList.slice()
@@ -75,24 +88,40 @@
       },
 
       beforeUpload(file) {
-        if (!this.fileList.find(item => item.name === file.name)) this.fileList = [...this.fileList, 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)
+        }
         return false
       },
 
       handleUpload() {
-        const { fileList, $notification } = this
+        const { fileList, $notification, isUploadMultiple, uploadParams, $bus } = this
         this.uploading = true
         let uploadedFileCount = 0
         let uploadSuccessFileCount = 0
+        let apiMethod
+        let params
+
         fileList.forEach((file, index) => {
           const formData = new FormData()
           formData.append('file', file)
           file.status = 'uploading'
-          dncApi.importDocumentFromLocalApi(this.uploadParams, formData)
+          // 鐩墠鏍规嵁鏄惁涓婁紶澶氫釜鏂囦欢鍒ゆ柇涓や釜鍔熻兘锛岃嫢鍚庣画澧炲姞鍔熻兘鎴栬皟鏁撮渶姹傚垯璋冩暣鍒ゆ柇鏉′欢
+          if (isUploadMultiple) {
+            apiMethod = dncApi.importDocumentFromLocalApi
+            params = Object.assign({}, { params: uploadParams, formData })
+          } else {
+            apiMethod = dncApi.documentVersionUpdateApi
+            params = Object.assign({}, { id: uploadParams.id, formData })
+          }
+          apiMethod(params)
             .then(res => {
               if (res.success) {
                 file.status = 'done'
                 uploadSuccessFileCount++
+                console.log('uploadSuccessFileCount++', uploadSuccessFileCount)
                 $notification.success({
                   message: '娑堟伅',
                   description: res.message
@@ -111,8 +140,13 @@
             .finally(() => {
               uploadedFileCount++
               fileList.splice(index, 1, file)
+              // 褰撴枃浠跺叏閮ㄤ笂浼犲畬鎴愬悗
               if (uploadedFileCount === fileList.length) {
-                if (uploadSuccessFileCount > 0) this.$bus.$emit('importFileSuccess', this.uploadParams)
+                // 鑷冲皯鏈変竴涓枃浠朵笂浼犳垚鍔熷悗灏遍渶瑕侀噸鏂板姞杞芥枃妗e垪琛�
+                if (uploadSuccessFileCount > 0) {
+                  $bus.$emit('importFileSuccess', uploadParams)
+                  if (!isUploadMultiple) this.visible = false //鏃犳硶杩炵画鍏ュ簱澶氫釜鐗堟湰鍥犳鍏ュ簱鎴愬姛鍚庡嵆鍙��鍑虹獥鍙�
+                }
                 this.uploading = false
               }
             })
@@ -131,7 +165,6 @@
         if (this[methodName]) {
           this[methodName](treeNodeInfo, tableRowInfo)
           this.title = modalTitle
-
         }
       }
     }
diff --git a/src/views/dnc/common/TableContextMenu.vue b/src/views/dnc/common/TableContextMenu.vue
index e7aa417..7890110 100644
--- a/src/views/dnc/common/TableContextMenu.vue
+++ b/src/views/dnc/common/TableContextMenu.vue
@@ -1,7 +1,7 @@
 <template>
   <a-menu :style="menuStyle" @click="menuItemClick" v-if="menuVisible" mode="vertical">
-    <template v-for="menuItem in defaultContextMenuList[currentMenuLevel]">
-      <a-menu-item :key="menuItem.code" v-if="menuItem.show&&menuItem.subMenu.length===0">
+    <template v-for="menuItem in defaultContextMenuList[tableRowInfo.param]">
+      <a-menu-item :key="menuItem.code" v-has="menuItem.code" v-if="menuItem.subMenu.length===0">
         <a-icon :type="menuItem.icon"/>
         {{menuItem.label}}
       </a-menu-item>
@@ -9,7 +9,7 @@
       <a-sub-menu v-if="menuItem.subMenu.length>0">
         <span slot="title"><a-icon :type="menuItem.icon"/><span>{{menuItem.label}}</span></span>
 
-        <a-menu-item v-for="subMenuItem in menuItem.subMenu" :key="subMenuItem.code" v-if="subMenuItem.show"
+        <a-menu-item v-for="subMenuItem in menuItem.subMenu" :key="subMenuItem.code" v-has="subMenuItem.code"
                      style="height: 32px;line-height: 32px">
           <a-icon :type="subMenuItem.icon"/>
           {{subMenuItem.label}}
@@ -41,11 +41,10 @@
         },
         currentMenuLevel: '',
         defaultContextMenuList: {
-          //鏂囨。
-          document: [
+          //NC鏂囨。
+          NC: [
             { label: '缂栬緫鏂囨。淇℃伅', code: 'document_edit', subMenu: [], icon: 'edit', isCommonMethod: false },
             { label: '鎸囨淳鍒拌澶�', code: 'document_assign', subMenu: [], icon: 'cluster', isCommonMethod: false },
-            { label: '瀵煎嚭NC绋嬪簭', code: 'document_export', subMenu: [], icon: 'export', isCommonMethod: true },
             { label: '瀵煎叆NC绋嬪簭', code: 'document_import', subMenu: [], icon: 'import', isCommonMethod: true },
             { label: '涓嬭浇', code: 'document_download', subMenu: [], icon: 'download', isCommonMethod: true },
             { label: '鍒犻櫎', code: 'document_delete', subMenu: [], icon: 'delete', isCommonMethod: true },
@@ -53,12 +52,31 @@
             {
               label: '鐢熷懡鍛ㄦ湡',
               subMenu: [
-                { label: '鍑哄簱', code: 'document_pull', icon: 'export', isCommonMethod: false },
-                { label: '鍙栨秷鍑哄簱', code: 'document_cancel_pull', icon: 'stop', isCommonMethod: false },
+                { label: '鍑哄簱', code: 'document_pull', icon: 'export', isCommonMethod: true },
+                { label: '鍙栨秷鍑哄簱', code: 'document_cancel_pull', icon: 'stop', isCommonMethod: true },
                 { label: '鍏ュ簱', code: 'document_push', icon: 'import', isCommonMethod: true },
-                { label: '鍙戝竷', code: 'document_publish', icon: 'flag', isCommonMethod: false },
-                { label: '閲嶆柊鍙戝竷', code: 'document_republish', icon: 'reload', isCommonMethod: false },
-                { label: '褰掓。', code: 'document_pigeonhole', icon: 'database', isCommonMethod: false }
+                { label: '鍙戝竷', code: 'document_publish', icon: 'flag', isCommonMethod: true },
+                { label: '閲嶆柊鍙戝竷', code: 'document_republish', icon: 'reload', isCommonMethod: true },
+                { label: '褰掓。', code: 'document_pigeonhole', icon: 'database', isCommonMethod: true }
+              ],
+              icon: 'hourglass'
+            }
+          ],
+          OTHER: [
+            { label: '缂栬緫鏂囨。淇℃伅', code: 'document_edit', subMenu: [], icon: 'edit', isCommonMethod: false },
+            { label: '瀵煎叆鏂囨。', code: 'document_import', subMenu: [], icon: 'import', isCommonMethod: true },
+            { label: '涓嬭浇', code: 'document_download', subMenu: [], icon: 'download', isCommonMethod: true },
+            { label: '鍒犻櫎', code: 'document_delete', subMenu: [], icon: 'delete', isCommonMethod: true },
+            { label: '鎵归噺鍒犻櫎', code: 'document_batch_remove', subMenu: [], icon: 'delete', isCommonMethod: false },
+            {
+              label: '鐢熷懡鍛ㄦ湡',
+              subMenu: [
+                { label: '鍑哄簱', code: 'document_pull', icon: 'export', isCommonMethod: true },
+                { label: '鍙栨秷鍑哄簱', code: 'document_cancel_pull', icon: 'stop', isCommonMethod: true },
+                { label: '鍏ュ簱', code: 'document_push', icon: 'import', isCommonMethod: true },
+                { label: '鍙戝竷', code: 'document_publish', icon: 'flag', isCommonMethod: true },
+                { label: '閲嶆柊鍙戝竷', code: 'document_republish', icon: 'reload', isCommonMethod: true },
+                { label: '褰掓。', code: 'document_pigeonhole', icon: 'database', isCommonMethod: true }
               ],
               icon: 'hourglass'
             }
@@ -71,16 +89,19 @@
         }
       }
     },
-    computed: {
-      getCurrentDocumentType() {
-        if (this.tableRowInfo.attributionType === 5 || this.tableRowInfo.attributionType === 6) return 'NC'
-        else return 'OTHER'
-      }
-    },
     methods: {
       menuItemClick({ item, key }) {
         const menuKeyArray = key.split('_')
-        const isCommonMethod = this.defaultContextMenuList[this.currentMenuLevel].find(item => item.code === key).isCommonMethod
+        const menuArrayItem = this.defaultContextMenuList[this.tableRowInfo.param].find(item => item.code === key)
+        const subMenuArrayItem = this.defaultContextMenuList[this.tableRowInfo.param].find(item => item.subMenu.length > 0).subMenu.find(item => item.code === key)
+        let isCommonMethod, modalTitle
+        if (menuArrayItem) {
+          isCommonMethod = menuArrayItem.isCommonMethod
+          modalTitle = menuArrayItem.label
+        } else {
+          isCommonMethod = subMenuArrayItem.isCommonMethod
+          modalTitle = subMenuArrayItem.label
+        }
         let methodName
         // 鍒ゆ柇鏄惁涓哄叕鍏辨柟娉曪紝濡傛灉涓哄叕鍏辨柟娉曞垯鎴彇涓撴湁灞炴�roduct/component/part/process绛夊瓧娈�
         if (isCommonMethod) {
@@ -90,8 +111,6 @@
           // product_add => handleProcessAdd 瑙﹀彂瀵瑰簲缁勪欢浜嬩欢
           methodName = 'handle' + menuKeyArray.map(item => item[0].toUpperCase() + item.slice(1)).join('')
         }
-        const modalTitle = this.defaultContextMenuList[this.currentMenuLevel].find(item => item.code === key).label
-        console.log('methodName---------------------------------------', methodName)
         console.log('tableRowInfo---------------------------------------', this.tableRowInfo)
         this.$bus.$emit('tableMenuItemMethodTrigger', {
           methodName,

--
Gitblit v1.9.3