修改树层级

This commit is contained in:
GGJ
2024-02-29 09:37:03 +08:00
parent e910584460
commit 8f9bd8fef5
3 changed files with 81 additions and 10 deletions

View File

@@ -45,15 +45,28 @@ const formData = ref({
loadType: null, loadType: null,
manufacturer: null, manufacturer: null,
serverName: 'event-boot', serverName: 'event-boot',
statisticalType: classificationData[0].id, statisticalType: classificationData[2].id,
scale: null scale: null
}) })
const loadData = () => { const loadData = (val: string) => {
let obj = classificationData.find(function (i) {
return i.id === formData.value.statisticalType
})
let form = JSON.parse(JSON.stringify(formData.value)) let form = JSON.parse(JSON.stringify(formData.value))
form.statisticalType = classificationData.find((item: any) => item.id == form.statisticalType) form.statisticalType = classificationData.find((item: any) => item.id == form.statisticalType)
let nodeKey = '' let nodeKey = ''
getTerminalTreeForFive(form).then(res => { getTerminalTreeForFive(form).then(res => {
console.log(res) console.log(res)
if (obj.code == 'Power_Network') {
res.data = [
{
name: '电网拓扑',
level: -1,
id: 0,
children: res.data
}
]
}
res.data.forEach((item: any) => { res.data.forEach((item: any) => {
item.icon = 'fa-solid fa-synagogue' item.icon = 'fa-solid fa-synagogue'
item.color = config.getColorVal('elementUiPrimary') item.color = config.getColorVal('elementUiPrimary')

View File

@@ -1,11 +1,66 @@
<template> <template>
<div class="default-main" :style="height">
<div> 监测点报告</div> <splitpanes style="height: 100%" class="default-theme" id="navigation-splitpanes">
<pane :size="size">
<PointTree
:default-expand-all="false"
:default-expanded-keys="monitoringPoint.state.lineId ? [monitoringPoint.state.lineId] : []"
:current-node-key="monitoringPoint.state.lineId"
@node-click="handleNodeClick"
@init="handleNodeClick"
></PointTree>
</pane>
<pane style="background: #fff" :style="height">
<!-- <div :style="height"></div> -->
<TableHeader date-picker :show-search="false">
<template v-slot:select>
<el-form-item label=" 模板策略">
<el-select v-model="value" placeholder="请选择" @change="changeFn" clearable>
<el-option
v-for="item in templatePolicy"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</template>
<template #operation>
<el-button icon="el-icon-Download" type="primary" @click="exportEvent">生成报告</el-button>
</template>
</TableHeader>
</pane>
</splitpanes>
</div>
</template> </template>
<script setup lang='ts'> <script setup lang="ts">
import { ref, reactive } from 'vue' import { onMounted, ref } from 'vue'
</script> import 'splitpanes/dist/splitpanes.css'
<style lang="scss" scoped> import { Splitpanes, Pane } from 'splitpanes'
import PointTree from '@/components/tree/pms/pointTree.vue'
import TableHeader from '@/components/table/header/index.vue'
import { mainHeight } from '@/utils/layout'
import { useMonitoringPoint } from '@/stores/monitoringPoint'
const monitoringPoint = useMonitoringPoint()
const height = mainHeight(20)
const size = ref(0)
const templatePolicy = ref([])
onMounted(() => {
const dom = document.getElementById('navigation-splitpanes')
if (dom) {
size.value = Math.round((280 / dom.offsetHeight) * 100)
}
})
const handleNodeClick = (data: any, node: any) => {
if (data.level === 6) {
monitoringPoint.setValue('lineId', data.id)
}
}
const exportEvent = () => {}
</script>
<style lang="scss">
.splitpanes.default-theme .splitpanes__pane {
background: #eaeef1;
}
</style> </style>

View File

@@ -142,7 +142,7 @@ import TableStore from '@/utils/tableStore'
import TableHeader from '@/components/table/header/index.vue' import TableHeader from '@/components/table/header/index.vue'
import { useDictData } from '@/stores/dictData' import { useDictData } from '@/stores/dictData'
import { getAreaReport, getList, selectReleation } from '@/api/event-boot/report.ts' import { getAreaReport, getList, selectReleation } from '@/api/event-boot/report.ts'
import { ElMessage } from 'element-plus'
defineOptions({ defineOptions({
name: 'TransientReport/regionalreports' name: 'TransientReport/regionalreports'
}) })
@@ -244,10 +244,13 @@ const exportEvent = () => {
formInline.value.powerFlag = 2 formInline.value.powerFlag = 2
formInline.value.waveType = tableStore.table.params.waveType formInline.value.waveType = tableStore.table.params.waveType
formInline.value.interval = tableStore.table.params.timeFlag formInline.value.interval = tableStore.table.params.timeFlag
ElMessage('生成报告中,请稍等!')
getAreaReport(formInline.value).then(res => { getAreaReport(formInline.value).then(res => {
let blob = new Blob([res], { let blob = new Blob([res], {
type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document;charset=UTF-8' type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document;charset=UTF-8'
}) })
const url = window.URL.createObjectURL(blob) const url = window.URL.createObjectURL(blob)
const link = document.createElement('a') // 创建a标签 const link = document.createElement('a') // 创建a标签
link.href = url link.href = url