refactor(svg): 优化 SVG相关组件功能
- 修改 LeftTree 组件,添加 default-expand-all 属性以展开所有节点
- 更新 configureView 组件,增加对负值的颜色处理
-改进 chartView 组件,添加节点点击事件的条件判断
| | |
| | | <template> |
| | | <div class="tree"> |
| | | <el-tree :data="nodeOptions" :props="{ label: 'label', children: 'children' }" :expand-on-click-node="false" |
| | | :filter-node-method="filterNode" ref="nodeTreeRef" node-key="id" highlight-current |
| | | :filter-node-method="filterNode" ref="nodeTreeRef" node-key="id" highlight-current default-expand-all |
| | | :default-expanded-keys="defaultExpandedKeys" @node-click="nodeClick" accordion> |
| | | <template #default="{ node, data }"> |
| | | <span class="item" style="" :title="node.label"> |
| | |
| | | if (tagValue.tagCode.startsWith("old") || tagValue.tagCode.startsWith("seven") || tagValue.tagCode.startsWith("out")) { |
| | | // 获取 el下的g标签下的text标签,赋值为value |
| | | let svgTextElement = el.querySelector("g").querySelector("text"); |
| | | console.log("svgTextElement::",svgTextElement) |
| | | // console.log("svgTextElement::",svgTextElement) |
| | | svgTextElement.textContent = value; |
| | | }else { |
| | | if (parseFloat(value) > 0) { |
| | | el.setAttribute("fill", "rgb(0,234,136)") |
| | | }else if (parseFloat(value) < 0) { |
| | | el.setAttribute("fill", "#FFFD36FF") |
| | | }else { |
| | | el.setAttribute("fill", "rgb(255,82,96)") |
| | | } |
| | |
| | | const ConfigureChartViewRef = ref() |
| | | /** 节点单击事件 */ |
| | | function handleNodeClick(data) { |
| | | console.log("nodeClickData::",data.nodeCategory) |
| | | if (data.nodeCategory !== "0") { |
| | | return |
| | | } |
| | | queryParams.value.nodeId = data.id |
| | | queryParams.value.nodeName = data.label |
| | | if (!data.id) { |