From fa9d138094e2ffabf7b053e73779d1204097ce75 Mon Sep 17 00:00:00 2001
From: zhaowei <zhaowei>
Date: 星期二, 11 二月 2025 11:49:46 +0800
Subject: [PATCH] 产品结构树: 1、实现文档功能的删除功能 设备结构树: 1、实现获取对应设备的已发送的NC程序列表 2、实现设备层级导入NC程序功能 3、实现设备关联的已发送NC程序功能的删除功能

---
 src/views/dnc/base/modules/ProductStructure/ProductStructureMainTop.vue |   96 +++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 78 insertions(+), 18 deletions(-)

diff --git a/src/views/dnc/base/modules/ProductStructure/ProductStructureMainTop.vue b/src/views/dnc/base/modules/ProductStructure/ProductStructureMainTop.vue
index d53279f..151b5d4 100644
--- a/src/views/dnc/base/modules/ProductStructure/ProductStructureMainTop.vue
+++ b/src/views/dnc/base/modules/ProductStructure/ProductStructureMainTop.vue
@@ -86,9 +86,7 @@
         }
       },
 
-      /**
-       * 鐐瑰嚮涓嬭浇鏃惰Е鍙戜笅杞藉綋鍓嶆枃妗�
-       */
+      // 涓嬭浇褰撳墠鍙抽敭閫変腑鏂囨。
       handleDownload() {
         const that = this
         const { docId, docName } = this.currentRightClickedTableRowInfo
@@ -109,14 +107,49 @@
           })
       },
 
+      // 鍒犻櫎褰撳墠鍙抽敭閫変腑鏂囨。
+      handleDelete() {
+        const { docId, param, attributionId } = this.currentRightClickedTableRowInfo
+        const that = this
+        that.$confirm({
+          title: '鎻愮ず',
+          content: `鍒犻櫎鍚庝笉鍙彇娑堬紝纭鍒犻櫎鍚楋紵`,
+          okText: '纭',
+          cancelText: '鍙栨秷',
+          onOk: () => {
+            dncApi.deleteDocumentApi(docId)
+              .then((res) => {
+                if (res.success) {
+                  that.$notification.success({
+                    message: '娑堟伅',
+                    description: res.message
+                  })
+                  that.reloadDocumentListData({ docClassCode: param, attributionId })
+                } else {
+                  that.$notification.warning({
+                    message: '娑堟伅',
+                    description: res.message
+                  })
+                }
+              })
+              .finally(() => {
+                that.$destroyAll()
+              })
+          },
+          onCancel: () => {
+            that.$destroyAll()
+          }
+        })
+      },
+
       /**
-       * 鐐瑰嚮鍑哄簱鏃惰Е鍙戝綋鍓嶆枃妗e嚭搴�
+       * 鍑哄簱褰撳墠鍙抽敭閫変腑鏂囨。
        * @param menuLabel
        */
       handlePull(menuLabel) {
         const that = this
         const { docId, docName, param, attributionId } = this.currentRightClickedTableRowInfo
-        this.$confirm({
+        that.$confirm({
           title: '鎻愮ず',
           content: `纭${menuLabel}鍚楋紵`,
           okText: '纭',
@@ -126,7 +159,7 @@
               .then(res => {
                 console.log('res------------------', res)
                 if (res.success) {
-                  this.reloadDocumentListData({ docClassCode: param, attributionId })
+                  that.reloadDocumentListData({ docClassCode: param, attributionId })
                   that.$notification.success({
                     message: '娑堟伅',
                     description: `${menuLabel}鎴愬姛`
@@ -144,18 +177,24 @@
                   description: err.message
                 })
               })
+              .finally(() => {
+                that.$destroyAll()
+              })
+          },
+          onCancel: () => {
+            that.$destroyAll()
           }
         })
       },
 
       /**
-       * 鐐瑰嚮鍙栨秷鍑哄簱鏃惰Е鍙戝綋鍓嶆枃妗e彇娑堝嚭搴�
+       * 鍙栨秷鍑哄簱褰撳墠鍙抽敭閫変腑鏂囨。
        * @param menuLabel
        */
       handleCancelPull(menuLabel) {
         const that = this
         const { docId, param, attributionId } = this.currentRightClickedTableRowInfo
-        this.$confirm({
+        that.$confirm({
           title: '鎻愮ず',
           content: `纭${menuLabel}鍚楋紵`,
           okText: '纭',
@@ -182,19 +221,24 @@
                   description: err.message
                 })
               })
+              .finally(() => {
+                that.$destroyAll()
+              })
+          },
+          onCancel() {
+            that.$destroyAll()
           }
         })
       },
 
-
       /**
-       * 鐐瑰嚮鍙戝竷鏃惰Е鍙戝綋鍓嶆枃妗e彂甯�
+       * 鍙戝竷褰撳墠鍙抽敭閫変腑鏂囨。
        * @param menuLabel
        */
       handlePublish(menuLabel) {
         const that = this
         const { docId, param, attributionId } = this.currentRightClickedTableRowInfo
-        this.$confirm({
+        that.$confirm({
           title: '鎻愮ず',
           content: `纭${menuLabel}鍚楋紵`,
           okText: '纭',
@@ -222,18 +266,24 @@
                   description: err.message
                 })
               })
+              .finally(() => {
+                that.$destroyAll()
+              })
+          },
+          onCancel() {
+            that.$destroyAll()
           }
         })
       },
 
       /**
-       * 鐐瑰嚮閲嶆柊鍙戝竷鏃惰Е鍙戝綋鍓嶆枃妗i噸鏂板彂甯冮��鍥炰笂涓�鐗堟湰
+       * 閲嶆柊鍙戝竷褰撳墠鍙抽敭閫変腑鏂囨。骞堕噸鏂板彂甯冮��鍥炰笂涓�鏂囨。鐗堟湰
        * @param menuLabel
        */
       handleRepublish(menuLabel) {
         const that = this
         const { docId, param, attributionId } = this.currentRightClickedTableRowInfo
-        this.$confirm({
+        that.$confirm({
           title: '鎻愮ず',
           content: `纭${menuLabel}鍚楋紵`,
           okText: '纭',
@@ -260,18 +310,24 @@
                   description: err.message
                 })
               })
+              .finally(() => {
+                that.$destroyAll()
+              })
+          },
+          onCancel() {
+            that.$destroyAll()
           }
         })
       },
 
       /**
-       * 鐐瑰嚮褰掓。鏃惰Е鍙戝綋鍓嶆枃妗e綊妗d笖鍚庣画鏃犳硶缁х画鍙戝竷鎴栧綊妗�
+       * 閲嶅綊妗e綋鍓嶅彸閿�変腑鏂囨。涓斿悗缁棤娉曠户缁彂甯冩垨褰掓。
        * @param menuLabel
        */
       handlePigeonhole(menuLabel) {
         const that = this
         const { docId, param, attributionId } = this.currentRightClickedTableRowInfo
-        this.$confirm({
+        that.$confirm({
           title: '鎻愮ず',
           content: `${menuLabel}鍚庝笉鍙彇娑堬紝纭${menuLabel}鍚楋紵`,
           okText: '纭',
@@ -298,13 +354,17 @@
                   description: err.message
                 })
               })
+              .finally(() => {
+                that.$destroyAll()
+              })
+          },
+          onCancel() {
+            that.$destroyAll()
           }
         })
       },
 
-      /**
-       * 鎺у埗鍙抽敭鑿滃崟鐐瑰嚮鍏抽棴
-       */
+      // 鎺у埗鍙抽敭鑿滃崟鍏抽棴
       handleMenuClose() {
         this.$refs.tableContextMenuRef.menuVisible = false
         document.body.removeEventListener('click', this.handleMenuClose)

--
Gitblit v1.9.3