From b86d97b09d1aca57291004c1a2bc014f90702918 Mon Sep 17 00:00:00 2001 From: ludc Date: 星期五, 26 一月 2024 16:14:39 +0800 Subject: [PATCH] 提交代码 --- Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue | 80 +++++++++++++++++++++++++++++----------- 1 files changed, 58 insertions(+), 22 deletions(-) diff --git a/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue b/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue index 2e37a1b..c11e7a3 100644 --- a/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue +++ b/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue @@ -44,25 +44,25 @@ </el-button> </div> <!-- 宸︿晶鏍�--> - - <avue-tree ref="tree" v-model="CloneTreeAvueform" v-loading="loading" :data="CloneTreedata" - :defaultExpandAll="false" - :option="Treeoption" - class="classifyTree" - style="height: 690px" - @node-click="nodeClick" - > - <template slot-scope="{ node, data }" class="el-tree-node__label"> - <el-tooltip :content="$createElement('div', { domProps: { innerHTML: node.label } })" class="item" - effect="dark" - open-delay="500" - placement="right-start"> + <div style="height: calc(100vh - 242px);overflow: auto"> + <avue-tree ref="tree" v-model="CloneTreeAvueform" v-loading="loading" :data="CloneTreedata" + :defaultExpandAll="false" + :option="Treeoption" + class="classifyTree" + @node-click="nodeClick" + > + <template slot-scope="{ node, data }" class="el-tree-node__label"> + <el-tooltip :content="$createElement('div', { domProps: { innerHTML: node.label } })" class="item" + effect="dark" + open-delay="500" + placement="right-start"> <span style="font-size: 14px;"> {{ (node || {}).label }} </span> - </el-tooltip> - </template> - </avue-tree> + </el-tooltip> + </template> + </avue-tree> + </div> </div> <!-- 鏍戣妭鐐规坊鍔犲璇濇--> @@ -123,6 +123,7 @@ </el-dialog> <!-- 鍒嗙被鎺堟潈瀵硅瘽妗�--> <classify-auth-dialog + :TreeNode="TreeEditObj" :classifyData="classifyData" :visible.sync="classifyAuthVisible" ></classify-auth-dialog> @@ -512,6 +513,7 @@ Treedata: [], CloneTreedata: [], Treeoption: { + height:'auto', addBtn: false, editBtn: false, delBtn: false, @@ -708,7 +710,7 @@ }, treeStyle() { return { - height: this.btnAuthList.length > 0 ? '620px' : '785px', + height: this.allButtons ? '610px' : '690px', }; }, crudTreeOption() { @@ -778,7 +780,7 @@ this.$message.warning('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒') return; } - this.classifyData = this.nodeClickList; + // this.classifyData = this.nodeClickList; this.classifyAuthVisible = true; }, // 鏁版嵁鎺堟潈瀵硅瘽妗嗘墦寮� @@ -787,7 +789,7 @@ this.$message.warning('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒') return; } - this.classifyData = this.nodeClickList; + // this.classifyData = this.nodeClickList; this.dataAuthVisible = true; }, flowingDependHandler() { @@ -1151,6 +1153,10 @@ }, //鏍戠偣鍑讳簨浠� async nodeClick(data) { + const response = this.findTheTopLevelNode(data,this.Treedata) + this.classifyData = response; + // console.log(response) + // console.log('response',response.attributes.id) this.allButtons = true; getAuthButtonList({classifyId: data.oid, code: "classifyTree", authType: "classify_auth"}).then(res => { this.btnAuthList = res.data.data; @@ -1196,6 +1202,32 @@ } }, + // 閫掑綊鏌ユ壘椤跺眰鑺傜偣Id + findTheTopLevelNode(data,TreeData){ + if(data.parentId === ""){ + return data; + } + const parentNode = this.findParentNode(data.parentId, TreeData); + if (parentNode) { + return this.findTheTopLevelNode(parentNode, TreeData); // 缁х画鏌ユ壘鐖惰妭鐐� + } + }, + // 閫掑綊鏌ユ壘鍑烘潵澶氬眰鑺傜偣鐨勭埗鑺傜偣 + findParentNode(parentId, TreeData){ + for (const node of TreeData) { + if (node.oid === parentId) { + return node; + } + // 濡傛灉褰撳墠鑺傜偣杩樻湁瀛愯妭鐐癸紝缁х画鍘绘煡瀛愯妭鐐圭殑鐖惰妭鐐� + if (node.children) { + const parentNode = this.findParentNode(parentId, node.children); + if (parentNode) { + return parentNode; + } + } + } + return null; + }, async gridCode() { try { const res = await gridCodeClassifyTemplateAttr({ @@ -1471,9 +1503,9 @@ </script> <style lang="scss" scoped> -.el-container { - height: 100%; -} +//.el-container { +// height: 100%; +//} .el-aside { //height: calc(100% - 30px); @@ -1518,4 +1550,8 @@ .headerCon > .el-button:nth-child(9) { margin-left: 0; } +///deep/.el-scrollbar__bar.is-vertical{ +// width: 8px; +//} + </style> -- Gitblit v1.9.3