| | |
| | | <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> |
| | |
| | | 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); |
| | |
| | | children: 'children', |
| | | isLeaf: 'leaf' |
| | | }, |
| | | defaultCatalogIdSign: null, |
| | | chooseNode: null, |
| | | chooseId: this.defaultCatalogId, |
| | | chooseId: "", |
| | | catalogTree: null, |
| | | contextmenuShow: false |
| | | |
| | |
| | | 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) { |
| | |
| | | node.loaded = false |
| | | node.expand(); |
| | | }, |
| | | refreshCatalogById: function (id, nodeIds) { |
| | | refreshCatalogById: function (id) { |
| | | if (id) { |
| | | console.log("refreshCatalogById: " + id) |
| | | let node = this.$refs.tree.getNode(id); |
| | | console.log(node) |
| | | 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){ |
| | |
| | | url:`/api/platform/catalog/del`, |
| | | params: { |
| | | id: id, |
| | | platformId: this.platformId, |
| | | } |
| | | }) |
| | | .then((res) => { |
| | |
| | | console.log("移除成功") |
| | | node.parent.loaded = false |
| | | node.parent.expand(); |
| | | if (res.data.data) { |
| | | this.defaultCatalogIdSign = res.data.data; |
| | | } |
| | | } |
| | | }) |
| | | .catch(function (error) { |
| | |
| | | }) |
| | | .then((res)=> { |
| | | if (res.data.code === 0) { |
| | | this.defaultCatalogId = id; |
| | | this.defaultCatalogIdSign = id; |
| | | } |
| | | }) |
| | | .catch(function (error) { |
| | |
| | | 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) |
| | | }, |