From d7afcab6016f46fa5f40962a079d003ebdf9172b Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期日, 30 一月 2022 16:39:15 +0800
Subject: [PATCH] 优化媒体服务器配置展示界面

---
 web_src/src/components/dialog/chooseChannelForCatalog.vue |   48 +++++++++++++++++++-----------------------------
 1 files changed, 19 insertions(+), 29 deletions(-)

diff --git a/web_src/src/components/dialog/chooseChannelForCatalog.vue b/web_src/src/components/dialog/chooseChannelForCatalog.vue
index 4e4339f..6c7fdab 100644
--- a/web_src/src/components/dialog/chooseChannelForCatalog.vue
+++ b/web_src/src/components/dialog/chooseChannelForCatalog.vue
@@ -21,7 +21,7 @@
          <span v-if="node.data.type === 2" class="iconfont icon-zhibo"></span>
         <span style="padding-left: 1px">{{ node.label }}</span>
         <span>
-          <i style="margin-left: 5rem; color: #9d9d9d; padding-right: 20px" v-if="node.data.id === defaultCatalogId">榛樿</i>
+          <i style="margin-left: 5rem; color: #9d9d9d; padding-right: 20px" v-if="node.data.id === defaultCatalogIdSign">榛樿</i>
         </span>
       </span>
      </el-tree>
@@ -38,6 +38,8 @@
     name: 'chooseChannelForCatalog',
     props: ['platformId', 'platformName', 'defaultCatalogId', 'catalogIdChange'],
     created() {
+        this.chooseId = this.defaultCatalogId;
+        this.defaultCatalogIdSign = this.defaultCatalogId;
         this.initData();
         setTimeout(()=>{
           if (this.catalogIdChange)this.catalogIdChange(this.defaultCatalogId);
@@ -54,8 +56,9 @@
             children: 'children',
             isLeaf: 'leaf'
           },
+          defaultCatalogIdSign: null,
           chooseNode: null,
-          chooseId: this.defaultCatalogId,
+          chooseId: "",
           catalogTree: null,
           contextmenuShow: false
 
@@ -91,16 +94,6 @@
                     if (typeof(callback) === 'function') {
                       callback(res.data.data)
                     }
-                    //
-
-                    // if (typeof (this.$refs.tree.setCurrentKey) == "undefined") {
-                    //   this.$refs.tree.setCurrentKey(this.defaultCatalogId)
-                    //   let data = this.$refs.tree.getCurrentNode()
-                    //   if (data != null && data.id === this.defaultCatalogId) {
-                    //     this.currentCatalogChange(data, this.$refs.tree.getNode(data.id))
-                    //   }
-                    // }
-
                   }
                 })
                 .catch(function (error) {
@@ -126,18 +119,6 @@
             let node = this.$refs.tree.getNode(id);
             this.refreshCatalog(node);
           }
-          // if (nodeIds !== null) {
-          //   let refreshNode = {}
-          //   for (let i = 0; i < nodeIds.length; i++) {
-          //     let node = this.$refs.tree.getNode(nodeIds[i]);
-          //     refreshNode[node.parent.data.id] = node.parent
-          //   }
-          //   if (Object.values(refreshNode).length > 0) {
-          //     for (let j = 0; j < Object.values(refreshNode).length; j++) {
-          //       this.refreshCatalog(Object.values(refreshNode)[j]);
-          //     }
-          //   }
-          // }
         },
         editCatalog: function (data, node){
           let that = this;
@@ -154,6 +135,7 @@
             url:`/api/platform/catalog/del`,
             params: {
               id: id,
+              platformId: this.platformId,
             }
           })
             .then((res) => {
@@ -161,8 +143,8 @@
                 console.log("绉婚櫎鎴愬姛")
                 node.parent.loaded = false
                 node.parent.expand();
-                if(this.defaultCatalogId === id) {
-                  this.defaultCatalogId = this.platformId;
+                if (res.data.data) {
+                  this.defaultCatalogIdSign = res.data.data;
                 }
               }
             })
@@ -181,7 +163,7 @@
           })
             .then((res)=> {
               if (res.data.code === 0) {
-                this.defaultCatalogId = id;
+                this.defaultCatalogIdSign = id;
               }
             })
             .catch(function (error) {
@@ -261,13 +243,21 @@
                   disabled: node.level === 1,
                   divided: true,
                   onClick: () => {
-                    this.removeCatalog(data.id, node)
+                    this.$confirm('纭畾鍒犻櫎?', '鎻愮ず', {
+                      confirmButtonText: '纭畾',
+                      cancelButtonText: '鍙栨秷',
+                      type: 'warning'
+                    }).then(() => {
+                      this.removeCatalog(data.id, node)
+                    }).catch(() => {
+
+                    });
                   }
                 },
                 {
                   label: "璁句负榛樿",
                   icon: "el-icon-folder-checked",
-                  disabled: node.data.id === this.defaultCatalogId,
+                  disabled: node.data.id === this.defaultCatalogIdSign,
                   onClick: () => {
                     this.setDefaultCatalog(data.id)
                   },

--
Gitblit v1.8.0