From 3362fc8656fb3587198beb71a56b5bf6525027cc Mon Sep 17 00:00:00 2001 From: 田源 <lastanimals@163.com> Date: 星期二, 19 三月 2024 11:29:56 +0800 Subject: [PATCH] 整合修改代码 --- Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue | 77 ++++++++++++++++---------------------- 1 files changed, 32 insertions(+), 45 deletions(-) diff --git a/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue b/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue index 07fbb4f..cbf8d76 100644 --- a/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue +++ b/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue @@ -4,7 +4,7 @@ <!-- 宸︿晶鑿滃崟--> <el-aside> <basic-container> - <div style="height: calc(100vh - 144px);!important;"> + <div ref="TreeBox" style="height: calc(100vh - 144px);!important;"> <div class="headerCon" style="display: flex; flex-wrap: wrap;margin-bottom: 5px"> <el-button v-if="permissionList.TreeAddStatus" plain size="small" type="primary" @click="TreeAdd">娣诲姞 </el-button> @@ -62,7 +62,6 @@ </el-tooltip> </template> </avue-tree> - <div style="height: 25px"></div> </div> </div> @@ -699,10 +698,26 @@ mounted() { this.type = this.tabOption.column[0] || {label: '鍩烘湰淇℃伅', prop: 'tab1'}; this.getAttr(); - document.addEventListener('click', this.handleGlobalClick); - }, - beforeDestroy() { - document.removeEventListener('click', this.handleGlobalClick); + // const treeEle = this.$refs.tree.$el; + const TreeBox = this.$refs.TreeBox; + // console.log(this.$refs.TreeBox) + // treeEle.addEventListener('click', (e) => { + // console.log('2') + // if (e.target.nodeName !== 'SPAN') { + // this.$refs.tree.setCurrentKey(null); + // this.nodeClickList = {}; + // this.TreeFlagCode = true; + // this.allButtons = false; + // } + // }, true) + TreeBox.addEventListener('click', (e) => { + if (e.target.nodeName !== 'SPAN') { + this.$refs.tree.setCurrentKey(null); + this.nodeClickList = {}; + this.TreeFlagCode = true; + this.allButtons = false; + } + }, true) }, computed: { ...mapGetters(["permission"]), @@ -789,26 +804,8 @@ created() { }, methods: { - handleGlobalClick(event) { - // 鍒ゆ柇鏄惁瀛樺湪鏍戣妭鐐瑰紩鐢ㄤ互鍙婂紩鐢ㄧ殑鍏冪礌鏄惁瀛樺湪 - if (this.$refs.tree && this.$refs.tree.$el) { - // 鍒ゆ柇鐐瑰嚮浜嬩欢鏄惁鍙戠敓鍦ㄦ爲鑺傜偣浠ュ鐨勫尯鍩� - const isOutsideTree = !this.$refs.tree.$el.contains(event.target); - if (isOutsideTree) { - this.clearNode(); - } - } - }, - clearNode(){ - // this.getAttr() - this.$refs.tree.setCurrentKey(null); - this.nodeClickList = {}; - this.TreeFlagCode = true; - this.allButtons = false; - }, // 鍒嗙被鎺堟潈瀵硅瘽妗嗘墦寮� - classifyAuthHandler(event) { - event.stopPropagation(); + classifyAuthHandler() { if (this.nodeClickList.oid === '' || this.nodeClickList.oid === undefined) { this.$message.warning('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒') return; @@ -817,8 +814,7 @@ this.classifyAuthVisible = true; }, // 鏁版嵁鎺堟潈瀵硅瘽妗嗘墦寮� - dataAuthHandler(event) { - event.stopPropagation(); + dataAuthHandler() { if (this.nodeClickList.oid === '' || this.nodeClickList.oid === undefined) { this.$message.warning('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒') return; @@ -826,8 +822,7 @@ // this.classifyData = this.nodeClickList; this.dataAuthVisible = true; }, - flowingDependHandler(event) { - event.stopPropagation(); + flowingDependHandler() { if (this.nodeClickList.length <= 0) { this.$message.warning('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒') return; @@ -844,13 +839,11 @@ }, // 鍏抽棴寮圭獥 /** 瀵煎叆 */ - ImportExcel(event) { - event.stopPropagation(); + ImportExcel() { this.ThemeImportVisible = true; }, /** 瀵煎嚭 */ - ExportExcel(event) { - event.stopPropagation(); + ExportExcel() { if (this.nodeClickList) { exportClassify({oid: this.nodeClickList.oid}).then(res => { func.downloadFileByBlobHandler(res); @@ -969,8 +962,7 @@ } }, //鏍戣妭鐐规坊鍔犳寜閽� - async TreeAdd(event) { - event.stopPropagation(); + async TreeAdd() { const loading = this.$loading({ lock: true, text: 'Loading', @@ -1030,8 +1022,7 @@ } }, //鏍戣妭鐐瑰垹闄ゆ寜閽� - TreeDel(event) { - event.stopPropagation(); + TreeDel() { this.$confirm('鏄惁鍒犻櫎褰撳墠閫夋嫨鐨勫垎绫伙紝灏嗕細鎶婂瓙鍒嗙被涓�骞跺垹闄わ紝濡傛灉瀛樺湪缂栫爜鏁版嵁灏嗕笉鑳借鍒犻櫎锛屾槸鍚︾户缁紵', '鎻愮ず', { confirmButtonText: '纭畾', cancelButtonText: '鍙栨秷', @@ -1087,8 +1078,7 @@ }); }, //淇敼鍥炲~ - TreeEdit(event) { - event.stopPropagation(); + TreeEdit() { if (Object.keys(this.nodeClickList).length < 1) { this.$message({ type: 'warning', @@ -1099,8 +1089,7 @@ } }, //鏍戝埛鏂� - async flushed(event) { - event.stopPropagation(); + async flushed() { await this.getAttr() this.$refs.tree.setCurrentKey(null); this.nodeClickList = {}; @@ -1109,8 +1098,7 @@ }, //鍚敤鍜屽仠鐢ㄩ兘鍏堝垽鏂姸鎬� //鍚敤 - async Enable(event) { - event.stopPropagation(); + async Enable() { if (Object.keys(this.nodeClickList).length < 1) { this.$message.warning('璇峰厛浠庢爲涓婇�夋嫨涓�鏉℃暟鎹�'); return; @@ -1150,8 +1138,7 @@ this.loading = false; } }, - async Deactivate(event) { - event.stopPropagation(); + async Deactivate() { if (Object.keys(this.nodeClickList).length < 1) { this.$message.warning('璇峰厛浠庢爲涓婇�夋嫨涓�鏉℃暟鎹�'); return; -- Gitblit v1.9.3