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/ProductStructureMainTop.vue |  224 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 223 insertions(+), 1 deletions(-)

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)
       }
     }
   }

--
Gitblit v1.9.3