修改测试bug
This commit is contained in:
@@ -1,86 +1,121 @@
|
|||||||
<template>
|
<template>
|
||||||
<Tree ref="treRef" :width="width" :data="tree" @changePointType="changePointType" />
|
<Tree ref="treRef" :width="width" :data="tree" default-expand-all @changePointType="changePointType" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, nextTick } from 'vue'
|
import { ref, nextTick, onMounted, defineProps } from 'vue'
|
||||||
import Tree from '../point.vue'
|
import Tree from '../point.vue'
|
||||||
import { getLineTree } from '@/api/cs-device-boot/csLedger'
|
import { getLineTree } from '@/api/cs-device-boot/csLedger'
|
||||||
import { useConfig } from '@/stores/config'
|
import { useConfig } from '@/stores/config'
|
||||||
|
import { getTemplateByDept } from '@/api/harmonic-boot/luckyexcel'
|
||||||
|
import { useDictData } from '@/stores/dictData'
|
||||||
|
// const props = defineProps(['template'])
|
||||||
|
interface Props {
|
||||||
|
template?: boolean
|
||||||
|
|
||||||
|
}
|
||||||
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
template: false,
|
||||||
|
|
||||||
|
})
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'govern/deviceTree'
|
name: 'govern/deviceTree'
|
||||||
})
|
})
|
||||||
const emit = defineEmits(['init', 'checkChange', 'pointTypeChange'])
|
|
||||||
|
const emit = defineEmits(['init', 'checkChange', 'pointTypeChange', 'Policy'])
|
||||||
const config = useConfig()
|
const config = useConfig()
|
||||||
const tree = ref()
|
const tree = ref()
|
||||||
|
const dictData = useDictData()
|
||||||
const treRef = ref()
|
const treRef = ref()
|
||||||
const width = ref('')
|
const width = ref('')
|
||||||
const changePointType = (val: any, obj: any) => {
|
|
||||||
emit('pointTypeChange', val, obj)
|
|
||||||
}
|
|
||||||
getLineTree().then(res => {
|
|
||||||
let arr1: any[] = []
|
|
||||||
let arr2: any[] = []
|
|
||||||
//治理设备
|
const info = () => {
|
||||||
res.data.map((item: any) => {
|
getLineTree().then(res => {
|
||||||
if (item.name == '治理设备') {
|
let arr1: any[] = []
|
||||||
item.children.forEach((item: any) => {
|
let arr2: any[] = []
|
||||||
item.icon = 'el-icon-HomeFilled'
|
//治理设备
|
||||||
item.color = config.getColorVal('elementUiPrimary')
|
res.data.map((item: any) => {
|
||||||
item.children.forEach((item2: any) => {
|
if (item.name == '治理设备') {
|
||||||
item2.icon = 'el-icon-List'
|
item.children.forEach((item: any) => {
|
||||||
item2.color = config.getColorVal('elementUiPrimary')
|
item.icon = 'el-icon-HomeFilled'
|
||||||
item2.children.forEach((item3: any) => {
|
item.color = config.getColorVal('elementUiPrimary')
|
||||||
item3.icon = 'el-icon-Platform'
|
item.children.forEach((item2: any) => {
|
||||||
item3.color =
|
item2.icon = 'el-icon-List'
|
||||||
item3.comFlag === 2 ? config.getColorVal('elementUiPrimary') : '#e26257 !important'
|
item2.color = config.getColorVal('elementUiPrimary')
|
||||||
item3.children.forEach((item4: any) => {
|
item2.children.forEach((item3: any) => {
|
||||||
item4.icon = 'el-icon-Platform'
|
item3.icon = 'el-icon-Platform'
|
||||||
item4.color =
|
item3.color =
|
||||||
item4.comFlag === 2 ? config.getColorVal('elementUiPrimary') : '#e26257 !important'
|
item3.comFlag === 2 ? config.getColorVal('elementUiPrimary') : '#e26257 !important'
|
||||||
// item4.color = '#e26257 !important'
|
item3.children.forEach((item4: any) => {
|
||||||
arr1.push(item4)
|
item4.icon = 'el-icon-Platform'
|
||||||
|
item4.color =
|
||||||
|
item4.comFlag === 2 ? config.getColorVal('elementUiPrimary') : '#e26257 !important'
|
||||||
|
// item4.color = '#e26257 !important'
|
||||||
|
arr1.push(item4)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
} else if (item.name == '便携式设备') {
|
||||||
} else if (item.name == '便携式设备') {
|
item.children.forEach((item: any) => {
|
||||||
item.children.forEach((item: any) => {
|
item.icon = 'el-icon-Platform'
|
||||||
item.icon = 'el-icon-Platform'
|
item.color = config.getColorVal('elementUiPrimary')
|
||||||
item.color = config.getColorVal('elementUiPrimary')
|
item.color = item.comFlag === 2 ? config.getColorVal('elementUiPrimary') : '#e26257 !important'
|
||||||
item.color = item.comFlag === 2 ? config.getColorVal('elementUiPrimary') : '#e26257 !important'
|
item.children.forEach((item2: any) => {
|
||||||
item.children.forEach((item2: any) => {
|
item2.icon = 'el-icon-Platform'
|
||||||
item2.icon = 'el-icon-Platform'
|
item2.color = item2.comFlag === 2 ? config.getColorVal('elementUiPrimary') : '#e26257 !important'
|
||||||
item2.color = item2.comFlag === 2 ? config.getColorVal('elementUiPrimary') : '#e26257 !important'
|
arr2.push(item2)
|
||||||
arr2.push(item2)
|
})
|
||||||
})
|
})
|
||||||
})
|
}
|
||||||
}
|
})
|
||||||
})
|
tree.value = res.data
|
||||||
tree.value = res.data
|
nextTick(() => {
|
||||||
nextTick(() => {
|
if (arr1.length) {
|
||||||
if (arr1.length) {
|
//初始化选中
|
||||||
//初始化选中
|
treRef.value.treeRef1.setCurrentKey(arr1[0].id)
|
||||||
treRef.value.treeRef1.setCurrentKey(arr1[0].id)
|
// 注册父组件事件
|
||||||
// 注册父组件事件
|
emit('init', {
|
||||||
emit('init', {
|
level: 2,
|
||||||
level: 2,
|
...arr1[0]
|
||||||
...arr1[0]
|
})
|
||||||
})
|
}
|
||||||
}
|
// if (arr2.length) {
|
||||||
// if (arr2.length) {
|
// //初始化选中
|
||||||
// //初始化选中
|
// treRef.value.treeRef2.setCurrentKey(arr2[0].id)
|
||||||
// treRef.value.treeRef2.setCurrentKey(arr2[0].id)
|
// // 注册父组件事件
|
||||||
// // 注册父组件事件
|
// emit('init', {
|
||||||
// emit('init', {
|
// level: 2,
|
||||||
// level: 2,
|
// ...arr2[0]
|
||||||
// ...arr2[0]
|
// })
|
||||||
// })
|
// }
|
||||||
// }
|
else {
|
||||||
else {
|
|
||||||
|
|
||||||
emit('init',arr2[0])
|
emit('init', arr2[0])
|
||||||
}
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
const changePointType = (val: any, obj: any) => {
|
||||||
|
emit('pointTypeChange', val, obj)
|
||||||
|
}
|
||||||
|
if (props.template) {
|
||||||
|
getTemplateByDept({ id: dictData.state.area[0].id }).then((res: any) => {
|
||||||
|
emit('Policy', res.data)
|
||||||
|
info()
|
||||||
|
|
||||||
|
}).catch(err => {
|
||||||
|
info()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
info()
|
||||||
|
}
|
||||||
|
onMounted(() => {
|
||||||
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -136,6 +136,8 @@ const emit = defineEmits(['init', 'checkChange', 'nodeChange', 'editNode', 'getC
|
|||||||
const config = useConfig()
|
const config = useConfig()
|
||||||
const tree = ref()
|
const tree = ref()
|
||||||
const treRef = ref()
|
const treRef = ref()
|
||||||
|
const id = ref(null)
|
||||||
|
const treeData = ref({})
|
||||||
//获取方案树形数据
|
//获取方案树形数据
|
||||||
const getTreeList = () => {
|
const getTreeList = () => {
|
||||||
getSchemeTree().then(res => {
|
getSchemeTree().then(res => {
|
||||||
@@ -152,11 +154,13 @@ const getTreeList = () => {
|
|||||||
tree.value = res.data
|
tree.value = res.data
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
if (arr.length) {
|
if (arr.length) {
|
||||||
treRef.value.setCurrentKey(arr[0].id)
|
|
||||||
|
treRef.value.setCurrentKey(id.value || arr[0].id)
|
||||||
|
let list= id.value ? arr.find((item: any) => item.id == id.value) : arr[0]
|
||||||
// 注册父组件事件
|
// 注册父组件事件
|
||||||
emit('init', {
|
emit('init', {
|
||||||
level: 2,
|
level: 2,
|
||||||
...arr[0]
|
...list
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
emit('init')
|
emit('init')
|
||||||
@@ -238,9 +242,13 @@ const del = (node: Node, data: any) => {
|
|||||||
const cancelDel = () => { }
|
const cancelDel = () => { }
|
||||||
const clickNode = (e: anyObj) => {
|
const clickNode = (e: anyObj) => {
|
||||||
e.children ? (planId.value = e.id) : (planId.value = e.pid)
|
e.children ? (planId.value = e.id) : (planId.value = e.pid)
|
||||||
|
id.value = e.id
|
||||||
|
|
||||||
emit('nodeChange', e)
|
emit('nodeChange', e)
|
||||||
}
|
}
|
||||||
const setCheckedNode = (e: anyObj) => {
|
const setCheckedNode = (e: anyObj) => {
|
||||||
|
console.log("🚀 ~ setCheckedNode ~ e:", e)
|
||||||
|
id.value=e
|
||||||
treRef.value.setCurrentKey(e)
|
treRef.value.setCurrentKey(e)
|
||||||
}
|
}
|
||||||
watch(
|
watch(
|
||||||
|
|||||||
@@ -244,11 +244,15 @@ const historyDevId: any = ref('')
|
|||||||
const chartTitle: any = ref('')
|
const chartTitle: any = ref('')
|
||||||
//点击测试项切换树节点
|
//点击测试项切换树节点
|
||||||
const handleClickTabs = async () => {
|
const handleClickTabs = async () => {
|
||||||
|
searchForm.value.index = [indexOptions.value[0].id]
|
||||||
historyDevId.value = activeName.value
|
historyDevId.value = activeName.value
|
||||||
schemeTreeRef.value.setCheckedNode(activeName.value)
|
schemeTreeRef.value.setCheckedNode(activeName.value)
|
||||||
await init(true)
|
setTimeout(() => {
|
||||||
|
init(true)
|
||||||
|
}, 100);
|
||||||
}
|
}
|
||||||
const nodeClick = async (e: anyObj) => {
|
const nodeClick = async (e: anyObj) => {
|
||||||
|
console.log("🚀 ~ nodeClick ~ e:", e)
|
||||||
loading.value = true
|
loading.value = true
|
||||||
deviceData.value = []
|
deviceData.value = []
|
||||||
historyDevId.value = e.children && e.children.length != 0 ? e.children[0].id : e.id
|
historyDevId.value = e.children && e.children.length != 0 ? e.children[0].id : e.id
|
||||||
@@ -274,7 +278,7 @@ const nodeClick = async (e: anyObj) => {
|
|||||||
schemeTreeRef.value.getPlanData(deviceData.value)
|
schemeTreeRef.value.getPlanData(deviceData.value)
|
||||||
await setTimeout(() => {
|
await setTimeout(() => {
|
||||||
init(true)
|
init(true)
|
||||||
}, 500);
|
}, 100);
|
||||||
|
|
||||||
loading.value = false
|
loading.value = false
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
<div class="default-main" :style="height">
|
<div class="default-main" :style="height">
|
||||||
<splitpanes style="height: 100%" class="default-theme" id="navigation-splitpanes">
|
<splitpanes style="height: 100%" class="default-theme" id="navigation-splitpanes">
|
||||||
<pane :size="size">
|
<pane :size="size">
|
||||||
<PointTree :default-expand-all="false" @node-click="handleNodeClick" @init="handleNodeClick">
|
<PointTree :default-expand-all="false" template @node-click="handleNodeClick" @init="handleNodeClick"
|
||||||
|
@Policy="stencil">
|
||||||
</PointTree>
|
</PointTree>
|
||||||
</pane>
|
</pane>
|
||||||
<pane style="background: #fff" :style="height">
|
<pane style="background: #fff" :style="height">
|
||||||
@@ -104,14 +105,21 @@ onMounted(() => {
|
|||||||
size.value = Math.round((180 / dom.offsetHeight) * 100)
|
size.value = Math.round((180 / dom.offsetHeight) * 100)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
getTemplateByDept({ id: dictData.state.area[0].id }).then((res: any) => {
|
|
||||||
templatePolicy.value = res.data
|
|
||||||
Template.value = res.data[0]
|
|
||||||
reportForm.value = res.data[0]?.reportForm
|
|
||||||
|
|
||||||
})
|
// getTemplateByDept({ id: dictData.state.area[0].id }).then((res: any) => {
|
||||||
|
// templatePolicy.value = res.data
|
||||||
|
|
||||||
|
|
||||||
|
// })
|
||||||
|
|
||||||
|
const stencil=(val: any) => {
|
||||||
|
console.log("🚀 ~ Policy ~ val:", val)
|
||||||
|
templatePolicy.value =val
|
||||||
|
Template.value =val[0]
|
||||||
|
reportForm.value =val[0]?.reportForm
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
const changetype = (val: any) => {
|
const changetype = (val: any) => {
|
||||||
reportForm.value = val.reportForm
|
reportForm.value = val.reportForm
|
||||||
}
|
}
|
||||||
@@ -122,7 +130,7 @@ const handleNodeClick = (data: any, node: any) => {
|
|||||||
dotList.value = data
|
dotList.value = data
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
tableStore.index()
|
tableStore.index()
|
||||||
},500)
|
}, 500)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user