组织树tootip问题修复

This commit is contained in:
wuhongjian 2022-12-08 11:48:10 +08:00
parent 7a096d5dc1
commit 2b00dd9130
1 changed files with 45 additions and 38 deletions

View File

@ -39,7 +39,7 @@
fill="#0058e1" fill="#0058e1"
></path> ></path>
</svg> </svg>
<a-tooltip> <a-tooltip @mouseenter="showToolTip">
<template #title>{{ val.title }}</template> <template #title>{{ val.title }}</template>
<span class="name"> <span class="name">
{{ val.title }} {{ val.title }}
@ -88,7 +88,7 @@
fill="#0058e1" fill="#0058e1"
></path> ></path>
</svg> </svg>
<a-tooltip> <a-tooltip @mouseenter="showToolTip">
<template #title>{{ child.title }}</template> <template #title>{{ child.title }}</template>
<span class="name"> <span class="name">
{{ child.title }} {{ child.title }}
@ -128,11 +128,11 @@
title: 'name', title: 'name',
} }
const store = useStore() const store = useStore()
// //
const user = ref({ const user = ref({
deptName: store.getters['user/deptName'], deptName: store.getters['user/deptName'],
deptId: store.getters['user/deptId'], deptId: store.getters['user/deptId'],
}) })
const showKey = ref(0) const showKey = ref(0)
const treeData = ref([]) const treeData = ref([])
const init = () => { const init = () => {
@ -145,7 +145,7 @@
if (select === '123') { if (select === '123') {
select = '' select = ''
} }
console.log( console.log(
'获取url中的select=====================>', '获取url中的select=====================>',
router.currentRoute.value.query.select router.currentRoute.value.query.select
@ -186,33 +186,33 @@
return sortArr.indexOf(a.key) - sortArr.indexOf(b.key) return sortArr.indexOf(a.key) - sortArr.indexOf(b.key)
}) })
// //
// let deptId=user.value.deptId // let deptId=user.value.deptId
// treeData.value.forEach((child) => { // treeData.value.forEach((child) => {
// let childern=child.children // let childern=child.children
// childern.forEach((childs) => {// // childern.forEach((childs) => {//
// if(childs.key==deptId ){ // if(childs.key==deptId ){
// childs.show=true // childs.show=true
// child.show=true // child.show=true
// mybus.emit('paramsGetResources', [childs.key]) // mybus.emit('paramsGetResources', [childs.key])
// selectId.value =childs.key // selectId.value =childs.key
// } // }
// if(childs.children && childs.children.length>0){// // if(childs.children && childs.children.length>0){//
// let qu=childs.children // let qu=childs.children
// qu.forEach((qu) => { // qu.forEach((qu) => {
// if(qu.key==deptId ){ // if(qu.key==deptId ){
// qu.show=true // qu.show=true
// childs.show=true // childs.show=true
// child.show=true // child.show=true
// mybus.emit('paramsGetResources', [qu.key]) // mybus.emit('paramsGetResources', [qu.key])
// selectId.value = qu.key // selectId.value = qu.key
// } // }
// }) // })
// } // }
// }) // })
// }) // })
console.log('左侧树结构数据======================>', treeData.value) console.log('左侧树结构数据======================>', treeData.value)
showKey.value++ showKey.value++
}) })
} }
@ -222,7 +222,6 @@
}) })
// children // children
const generateChildren = (val, obj) => { const generateChildren = (val, obj) => {
if (val.dataList.length > 0) { if (val.dataList.length > 0) {
val.dataList.forEach((child) => { val.dataList.forEach((child) => {
let children = { let children = {
@ -232,14 +231,20 @@
total: child.deptCount, total: child.deptCount,
key: child.deptId, key: child.deptId,
} }
obj.children.push(children) obj.children.push(children)
}) })
} }
} }
const showToolTip = (e) => {
console.log('鼠标移入', e, e.target.clientWidth, e.target.scrollWidth)
debugger
if (e.target.clientWidth < 200) {
e.target.style.pointerEvents = 'none' //
}
}
// //
const generateChildren2 = (val, obj) => { const generateChildren2 = (val, obj) => {
if (val.dataList.length > 0) { if (val.dataList.length > 0) {
val.dataList.forEach((dis) => { val.dataList.forEach((dis) => {
let children = { let children = {
@ -259,7 +264,7 @@
select: false, select: false,
key: child.deptId, key: child.deptId,
} }
children.children.push(children2) children.children.push(children2)
}) })
} }
@ -382,6 +387,7 @@
showBottom, showBottom,
showDown, showDown,
selectId, selectId,
showToolTip,
} }
}, },
beforeUnmount() { beforeUnmount() {
@ -498,6 +504,7 @@
-webkit-line-clamp: 1; -webkit-line-clamp: 1;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
word-break: break-all; word-break: break-all;
max-width: 200px;
} }
} }
.up:hover { .up:hover {