From 9f16b5c553b479ea12fe368a7ecc748872ea8b98 Mon Sep 17 00:00:00 2001 From: zxl <763096477@qq.com> Date: 星期四, 12 六月 2025 11:11:27 +0800 Subject: [PATCH] 修改配置文件 --- web_src/src/components/dialog/chooseChannelForCatalog.vue | 61 +++++++++++++++++++----------- 1 files changed, 38 insertions(+), 23 deletions(-) diff --git a/web_src/src/components/dialog/chooseChannelForCatalog.vue b/web_src/src/components/dialog/chooseChannelForCatalog.vue old mode 100644 new mode 100755 index 6c7fdab..ae79e64 --- a/web_src/src/components/dialog/chooseChannelForCatalog.vue +++ b/web_src/src/components/dialog/chooseChannelForCatalog.vue @@ -7,26 +7,28 @@ empty-text="鏈煡鑺傜偣" node-key="id" default-expand-all - :highlight-current="true" + :highlight-current="false" :expand-on-click-node="false" :props="props" :load="loadNode" @node-contextmenu="contextmenuEventHandler" + @node-click="nodeClickHandler" lazy> <span class="custom-tree-node" slot-scope="{ node, data }" style="width: 100%"> - <el-radio v-if="node.data.type === 0" style="margin-right: 0" v-model="chooseId" :label="node.data.id">{{''}}</el-radio> + <el-radio v-if="node.data.type === 0 || node.data.type === -1" style="margin-right: 0" v-model="chooseId" :label="node.data.id">{{''}}</el-radio> + <span v-if="node.data.type === -1 && node.level === 1" style="font-size: 12px" class="iconfont icon-ziyuan"></span> <span v-if="node.data.type === 0 && node.level === 1" class="el-icon-s-home"></span> <span v-if="node.data.type === 0 && node.level > 1" class="el-icon-folder-opened"></span> <span v-if="node.data.type === 1" class="iconfont icon-shexiangtou"></span> <span v-if="node.data.type === 2" class="iconfont icon-zhibo"></span> - <span style="padding-left: 1px">{{ node.label }}</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 === defaultCatalogIdSign">榛樿</i> </span> </span> </el-tree> </div> - <catalogEdit ref="catalogEdit" :platformId="platformId"></catalogEdit> + <catalogEdit ref="catalogEdit" :platformId="platformId" :platformDeviceId="platformDeviceId"></catalogEdit> </div> </template> @@ -36,13 +38,13 @@ import catalogEdit from './catalogEdit.vue' export default { name: 'chooseChannelForCatalog', - props: ['platformId', 'platformName', 'defaultCatalogId', 'catalogIdChange'], + props: ['platformId', 'platformDeviceId', 'platformName', 'defaultCatalogId', 'catalogIdChange'], created() { this.chooseId = this.defaultCatalogId; this.defaultCatalogIdSign = this.defaultCatalogId; this.initData(); setTimeout(()=>{ - if (this.catalogIdChange)this.catalogIdChange(this.defaultCatalogId); + if (this.catalogIdChange)this.catalogIdChange(this.defaultCatalogId, this.platformName); }, 100) }, @@ -59,6 +61,7 @@ defaultCatalogIdSign: null, chooseNode: null, chooseId: "", + chooseName: "", catalogTree: null, contextmenuShow: false @@ -68,10 +71,6 @@ platformId(newData, oldData){ console.log(newData) this.initData() - }, - chooseId(newData, oldData){ - console.log("鍙戦�侊細 " + newData) - if (this.catalogIdChange)this.catalogIdChange(newData); }, }, methods: { @@ -88,8 +87,7 @@ platformId: that.platformId, parentId: parentId } - }) - .then((res)=> { + }).then((res)=> { if (res.data.code === 0) { if (typeof(callback) === 'function') { callback(res.data.data) @@ -103,8 +101,10 @@ }, addCatalog: function (parentId, node){ let that = this; + console.log(this.platformId) + console.log(parentId) // 鎵撳紑娣诲姞寮圭獥 - that.$refs.catalogEdit.openDialog(false, null, null, parentId, ()=>{ + that.$refs.catalogEdit.openDialog(false, null, null, parentId, node.level, ()=>{ node.loaded = false node.expand(); }); @@ -123,9 +123,12 @@ editCatalog: function (data, node){ let that = this; // 鎵撳紑娣诲姞寮圭獥 - that.$refs.catalogEdit.openDialog(true, data.id, data.name, data.parentId, (data)=>{ + that.$refs.catalogEdit.openDialog(true, data.id, data.name, data.parentId, (newData)=>{ node.parent.loaded = false node.parent.expand(); + if (data.id === this.chooseId && newData.name !== data.name) { + if (this.catalogIdChange)this.catalogIdChange(this.chooseId, newData.name); + } }); }, @@ -137,8 +140,7 @@ id: id, platformId: this.platformId, } - }) - .then((res) => { + }).then((res) => { if (res.data.code === 0) { console.log("绉婚櫎鎴愬姛") node.parent.loaded = false @@ -160,8 +162,7 @@ platformId: this.platformId, catalogId: id, } - }) - .then((res)=> { + }).then((res)=> { if (res.data.code === 0) { this.defaultCatalogIdSign = id; } @@ -171,12 +172,19 @@ }); }, loadNode: function(node, resolve){ + console.log("this.platformDeviceId锛� " + this.platformDeviceId) if (node.level === 0) { - resolve([{ - name: this.platformName, - id: this.platformId, - type: 0 - }]); + resolve([ + { + name: "鏈垎閰�", + id: null, + type: -1 + },{ + name: this.platformName, + id: this.platformDeviceId, + type: 0 + } + ]); } if (node.level >= 1){ this.getCatalog(node.data.id, resolve) @@ -291,6 +299,13 @@ 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); + } } }; </script> -- Gitblit v1.8.0