Browse Source

fix:修改树查询问题

temp
zhaohy 3 months ago
parent
commit
f21e8d48a6
  1. 31
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/notificationManagement/linkPeople/index.vue
  2. 2
      hx-ai-intelligent/src/view/alarmManagement/equipmentAlarm/look.vue

31
hx-ai-intelligent/src/view/alarmManagement/alarmSettings/notificationManagement/linkPeople/index.vue

@ -70,7 +70,7 @@
import { http } from '/nerv-lib/util';
//
const dataList: TreeProps['treeData'] = [];
let dataList: TreeProps['treeData'] = [];
const generateList = (data: TreeProps['treeData']) => {
for (let i = 0; i < data.length; i++) {
const node = data[i];
@ -80,23 +80,28 @@
generateList(node.children);
}
}
console.log(dataList, '数据');
};
const getParentKey = (
key: string | number,
tree: TreeProps['treeData'],
): string | number | undefined => {
let parentKey;
for (let i = 0; i < tree.length; i++) {
const node = tree[i];
parents: (string | number)[] = [],
): (string | number)[] | undefined => {
for (const node of tree) {
if (node.children) {
if (node.children.some((item) => item.key === key)) {
parentKey = node.key;
} else if (getParentKey(key, node.children)) {
parentKey = getParentKey(key, node.children);
//
return [...parents, node.key];
}
//
const result = getParentKey(key, node.children, [...parents, node.key]);
if (result) {
return result;
}
}
}
return parentKey;
return undefined;
};
export default defineComponent({
setup(props, { emit }) {
@ -172,6 +177,7 @@
getDepartList({ orgId: orgId.value }).then((res) => {
deptTreeData.value = res;
selectedKeys.value = [orgId.value];
dataList = [];
generateList(deptTreeData.value);
});
};
@ -304,7 +310,12 @@
return null;
})
.filter((item, i, self) => item && self.indexOf(item) === i);
expandedKeys.value = expanded;
console.log(expanded, '数据1111');
let selctky = [];
expanded.forEach((item) => {
selctky.push(...item);
});
expandedKeys.value = selctky;
searchValue.value = value;
autoExpandParent.value = true;
});

2
hx-ai-intelligent/src/view/alarmManagement/equipmentAlarm/look.vue

@ -128,7 +128,7 @@
},
formatter: function (params: any) {
let res =
params[0].marker + ' ' + params[0].seriesName + ' : ' + params[0].data + 'V';
params[0].marker + ' ' + params[0].seriesName + ' : ' + params[0].data + 'V';
return res;
},
},

Loading…
Cancel
Save