修改现场反馈问题

This commit is contained in:
GGJ
2024-10-10 10:46:10 +08:00
parent 0877ae5df0
commit facd4f55c5
12 changed files with 198 additions and 313 deletions

View File

@@ -64,7 +64,7 @@
v-bind="defaultAttribute"
:data="treeData"
show-overflow
:tree-config="{ transform: true, parentField: 'pid' }"
:tree-config="{ transform: true, parentField: 'uPid',rowField:'uId' }"
:scroll-y="{ enabled: true }"
>
<vxe-column field="name" align="left" title="电网拓扑" min-width="200" tree-node></vxe-column>
@@ -237,12 +237,12 @@ const tableStore = new TableStore({
method: 'POST',
column: [],
loadCallback: () => {
tableStore.table.data.forEach((item: any) => {
if (item.children.length > 0) {
item.id = item.children[0].pid
}
})
treeData.value = tree2List(tableStore.table.data)
// tableStore.table.data.forEach((item: any) => {
// if (item.children.length > 0) {
// item.id = item.children[0].pid
// }
// })
treeData.value = tree2List(tableStore.table.data, Math.random() * 1000)
treeDataCopy.value = JSON.parse(JSON.stringify(treeData.value))
setTimeout(() => {
tableRef.value.setAllTreeExpand(true)
@@ -255,15 +255,21 @@ tableStore.table.params.program = ''
tableStore.table.params.searchEvent = ''
tableStore.table.params.filterName = ''
provide('tableStore', tableStore)
const tree2List = (list: any) => {
const tree2List = (list: any, id: any) => {
//存储结果的数组
let arr: any = []
// 遍历 tree 数组
list.forEach((item: any) => {
item.uPid = id
item.uId = (Math.random() * 1000)
// 判断item是否存在children
if (!item.children) return arr.push(item)
// 函数递归对children数组进行tree2List的转换
const children = tree2List(item.children)
const children = tree2List(item.children, item.uId)
// 删除item的children属性
delete item.children
// 把item和children数组添加至结果数组
@@ -274,6 +280,7 @@ const tree2List = (list: any) => {
return arr
}
tableStore.table.params.searchValue = ''
tableStore.table.params.searchState = 0
onMounted(() => {