Merge branch 'bthg-dev' of http://192.168.34.160:8023/admin/zhgdyun into bthg-dev
This commit is contained in:
commit
aab8d920aa
@ -1000,7 +1000,7 @@ export default {
|
||||
propsList: {
|
||||
value: 'itemId',
|
||||
label: 'name',
|
||||
children: 'list',
|
||||
children: 'children',
|
||||
// checkStrictly: true,
|
||||
emitPath: false
|
||||
},
|
||||
@ -2182,6 +2182,21 @@ export default {
|
||||
pieChart.resize();
|
||||
});
|
||||
},
|
||||
recursion(array){
|
||||
// 递归 筛选出节点的id
|
||||
return array.map(item => {
|
||||
if (item.children && Array.isArray(item.children) && item.children.length > 0) {
|
||||
item.children = this.recursion(item.children);
|
||||
return {
|
||||
...item
|
||||
};
|
||||
}
|
||||
return {
|
||||
...item,
|
||||
children: null,
|
||||
};
|
||||
});
|
||||
},
|
||||
//获取摄像机列表
|
||||
getVideoItemList() {
|
||||
let data = {
|
||||
@ -2211,17 +2226,19 @@ export default {
|
||||
console.log('摄像头列表', res);
|
||||
if (res.code == 200) {
|
||||
this.videoList = res.result.videoList
|
||||
.filter(item => item.list.length > 0)
|
||||
.filter(item => item.children.length > 0)
|
||||
.map(item => {
|
||||
item.children = this.recursion(item.children);
|
||||
return {
|
||||
...item,
|
||||
itemId: item.id
|
||||
};
|
||||
});
|
||||
console.log(2112333, this.videoList)
|
||||
this.videoList.some(item => {
|
||||
if (item.list.length > 0) {
|
||||
this.videoId = item.list[0].itemId;
|
||||
this.getVideo(item.list[0].itemId);
|
||||
if (item.children.length > 0) {
|
||||
this.videoId = item.children[0].itemId;
|
||||
this.getVideo(item.children[0].itemId);
|
||||
return true;
|
||||
} else {
|
||||
this.videoId = '';
|
||||
@ -2231,14 +2248,35 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
fuzzySearchTree(treeData, keyword, key = "name", result = []) {
|
||||
for (const node of treeData) {
|
||||
const newNode = { ...node };
|
||||
// 检查当前节点是否匹配关键词
|
||||
if (node[key] && node[key].includes(keyword)) {
|
||||
console.log(777777777777, newNode);
|
||||
result.push(newNode);
|
||||
} else if (node.children && node.children.length > 0) {
|
||||
// 递归查询子节点
|
||||
const childrenResult = this.fuzzySearchTree(node.children, keyword, key, result);
|
||||
// if (childrenResult.length > 0) {
|
||||
// newNode.children = childrenResult;
|
||||
// // result.push(newNode);
|
||||
// }
|
||||
}
|
||||
}
|
||||
return result;
|
||||
},
|
||||
//选择的视频
|
||||
getVideo(val) {
|
||||
this.videoList.forEach(item => {
|
||||
const find = item.list.find(ele => ele.itemId == val);
|
||||
if (find) {
|
||||
this.selectList = [find];
|
||||
}
|
||||
});
|
||||
const searchResult = this.fuzzySearchTree(this.videoList, val, "itemId");
|
||||
console.log(88888, searchResult);
|
||||
this.selectList = searchResult;
|
||||
// this.videoList.forEach(item => {
|
||||
// const find = item.children.find(ele => ele.itemId == val);
|
||||
// if (find) {
|
||||
// this.selectList = [find];
|
||||
// }
|
||||
// });
|
||||
// for (let i = 0; i < this.videoList.length; i++) {
|
||||
// if (val == this.videoList[i].itemId) {
|
||||
// this.selectList = [this.videoList[i]];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user