diff --git a/src/components/echarts/MyEchart.vue b/src/components/echarts/MyEchart.vue index dd09e5ec..bd287a3e 100644 --- a/src/components/echarts/MyEchart.vue +++ b/src/components/echarts/MyEchart.vue @@ -70,6 +70,8 @@ const initChart = () => { const value = item.value === 3.14159 || item.value === 0.14159 ? '暂无数据' + : item.value === 0.14158 + ? 0 : Math.round(item.value * 100) / 100 // 处理特殊值 tips += `
${item.marker} @@ -154,7 +156,6 @@ const initChart = () => { if (params.seriesName == '暂态触发点') { emit('triggerPoint', params.data) } else { - emit('echartClick', params) } }) diff --git a/src/views/system/auth/department/popupPoint.vue b/src/views/system/auth/department/popupPoint.vue index 58d9046a..f46afdc2 100644 --- a/src/views/system/auth/department/popupPoint.vue +++ b/src/views/system/auth/department/popupPoint.vue @@ -9,15 +9,22 @@
+ + +
@@ -44,15 +51,22 @@
+ + +
@@ -98,6 +112,8 @@ const props = { value: 'id', children: 'children' } +const filterText = ref('') +const filterText1 = ref('') const getExpandedKeys = (originArr: treeData[]) => { let arr: string[] = [] const call = (originArr: treeData[]) => { @@ -194,7 +210,8 @@ const unbind = () => { } const open = (row: any) => { - + filterText.value = '' + filterText1.value = '' dialogVisible.value = true binData.deptId = row.id binData.deptType = row.type @@ -210,7 +227,52 @@ const submit = async () => { dialogVisible.value = false }) } - +watch(filterText, val => { + leftTree.value!.filter(val) +}) +watch(filterText1, val => { + rightTree.value!.filter(val) +}) +const filterNode = (value: string, data: any, node: any) => { + if (!value) return true + // return data.name.includes(value) + if (data.name) { + return chooseNode(value, data, node) + } +} +const filterNode1 = (value: string, data: any, node: any) => { + if (!value) return true + // return data.name.includes(value) + if (data.name) { + return chooseNode(value, data, node) + } +} +// 过滤父节点 / 子节点 (如果输入的参数是父节点且能匹配,则返回该节点以及其下的所有子节点;如果参数是子节点,则返回该节点的父节点。name是中文字符,enName是英文字符. +const chooseNode = (value: string, data: any, node: any) => { + if (data.name.indexOf(value) !== -1) { + return true + } + const level = node.level + // 如果传入的节点本身就是一级节点就不用校验了 + if (level === 1) { + return false + } + // 先取当前节点的父节点 + let parentData = node.parent + // 遍历当前节点的父节点 + let index = 0 + while (index < level - 1) { + // 如果匹配到直接返回,此处name值是中文字符,enName是英文字符。判断匹配中英文过滤 + if (parentData.data.name.indexOf(value) !== -1) { + return true + } + // 否则的话再往上一层做匹配 + parentData = parentData.parent + index++ + } + // 没匹配到返回false + return false +} defineExpose({ open })