648540858
2023-03-20 a000ed60625ef647d66a186a05bf5bed0e4de127
web_src/src/components/dialog/chooseChannelForCatalog.vue
@@ -38,7 +38,7 @@
import catalogEdit from './catalogEdit.vue'
export default {
    name: 'chooseChannelForCatalog',
    props: ['platformId', 'platformName', 'defaultCatalogId', 'catalogIdChange'],
    props: ['platformId', 'platformDeviceId', 'platformName', 'defaultCatalogId', 'catalogIdChange', 'treeType'],
    created() {
        this.chooseId = this.defaultCatalogId;
        this.defaultCatalogIdSign = this.defaultCatalogId;
@@ -82,13 +82,12 @@
            let that = this;
            this.$axios({
                    method:"get",
                    url:`/api/platform/catalog`,
                    url:`./api/platform/catalog`,
                    params: {
                        platformId: that.platformId,
                        parentId: parentId
                    }
                })
                .then((res)=> {
                }).then((res)=> {
                  if (res.data.code === 0) {
                    if (typeof(callback) === 'function') {
                      callback(res.data.data)
@@ -102,8 +101,9 @@
        },
        addCatalog: function (parentId, node){
          let that = this;
          console.log(this.treeType)
          // 打开添加弹窗
          that.$refs.catalogEdit.openDialog(false, null, null, parentId, ()=>{
          that.$refs.catalogEdit.openDialog(false, null, null, parentId, this.treeType, node.level, ()=>{
            node.loaded = false
            node.expand();
          });
@@ -134,13 +134,12 @@
        removeCatalog: function (id, node){
          this.$axios({
            method:"delete",
            url:`/api/platform/catalog/del`,
            url:`./api/platform/catalog/del`,
            params: {
              id: id,
              platformId: this.platformId,
            }
          })
            .then((res) => {
          }).then((res) => {
              if (res.data.code === 0) {
                console.log("移除成功")
                node.parent.loaded = false
@@ -157,13 +156,12 @@
        setDefaultCatalog: function (id){
          this.$axios({
            method:"post",
            url:`/api/platform/catalog/default/update`,
            url:`./api/platform/catalog/default/update`,
            params: {
              platformId: this.platformId,
              catalogId: id,
            }
          })
            .then((res)=> {
          }).then((res)=> {
              if (res.data.code === 0) {
                this.defaultCatalogIdSign = id;
              }
@@ -173,6 +171,7 @@
            });
        },
        loadNode: function(node, resolve){
          console.log("this.platformDeviceId: " + this.platformDeviceId)
          if (node.level === 0) {
            resolve([
              {
@@ -181,7 +180,7 @@
              type:  -1
              },{
                name: this.platformName,
                id:  this.platformId,
                id:   this.platformDeviceId,
                type:  0
              }
            ]);
@@ -202,7 +201,7 @@
                  onClick: () => {
                    this.$axios({
                      method:"delete",
                      url:"/api/platform/catalog/relation/del",
                      url:"./api/platform/catalog/relation/del",
                      data: data
                    }).then((res)=>{
                      console.log("移除成功")
@@ -300,6 +299,8 @@
        return false;
      },
      nodeClickHandler: function (data, node, tree){
          console.log(data)
          console.log(node)
       this.chooseId = data.id;
       this.chooseName = data.name;
       if (this.catalogIdChange)this.catalogIdChange(this.chooseId, this.chooseName);