| | |
| | | } |
| | | |
| | | updateZTreeCheckNodes(checkedNodes) { |
| | | let _this = this |
| | | _this.selectedNodes = [] |
| | | if (!_this.multiple) { |
| | | _this.selectedNodes = [checkedNodes.id] |
| | | this.selectedNodes = [] |
| | | if (!this.multiple) { |
| | | this.selectedNodes = [checkedNodes.id] |
| | | return |
| | | } |
| | | |
| | | function nodeFilter(node: any) { |
| | | checkedNodes.forEach((node) => { |
| | | if (node.type === "4" && (node.selected || node.checked)) { |
| | | sessionStorage.setItem("cameraDevId", node.devId) |
| | | _this.selectedNodes.push(node.id) |
| | | this.selectedNodes.push(node.id) |
| | | } |
| | | if (node.children) { |
| | | node.children.forEach((n: any) => { |
| | | nodeFilter(n) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | checkedNodes.forEach((n: any) => { |
| | | nodeFilter(n) |
| | | }) |
| | | } |
| | | |
| | |
| | | return camera |
| | | } |
| | | |
| | | getCameraInfoById(id) { |
| | | getCameraInfoById(id: string) { |
| | | let camera = null |
| | | |
| | | function nodeFilter(node: any) { |
| | |
| | | |
| | | this.isFold(this.treeData) |
| | | this.isFold(this.gb28181Data) |
| | | this.selectedNodes = [] |
| | | this.selectedNode = {} |
| | | } |
| | | |
| | | reset() { |
| | | this.treeData = [] |
| | | this.gb28181Data = [] |
| | | |
| | | this.selectedNodes = [] |
| | | this.selectedNode = {} |
| | | } |
| | |
| | | if (this.searchFrom == "cluster") { |
| | | params.isPlatform = 1 |
| | | } |
| | | |
| | | const rsp: any = await getLocalCameraTree(params) |
| | | |
| | | if (rsp && rsp.success) { |
| | |
| | | this.setDropDisable(this.treeData) |
| | | this.treeDataPure = JSON.parse(JSON.stringify(this.treeData)) |
| | | this.isFold(this.treeData) |
| | | |
| | | // 清理没有权限管理的摄像机, 后端修复后删除 |
| | | let userInfo = JSON.parse(sessionStorage.getItem("userInfo")) |
| | | |
| | | // 管理员权限 |
| | | if (userInfo.username == "Administrator") { |
| | | return |
| | | } |
| | | |
| | | let checkedCameras = userInfo.email |
| | | |
| | | // basic 为子账户默认的空字段,表示可管理的摄像机目录为空 |
| | | if (checkedCameras == "basic") { |
| | | this.treeData = [] |
| | | } else { |
| | | let cameraIds = checkedCameras.split(",") |
| | | console.log("cameraIds", cameraIds) |
| | | this.removeNoAuthorizedNode(this.treeData, cameraIds) |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | async fetchTreeData() { |
| | | this.cameraParents = {} |
| | | if (this.openeds[0]) { |
| | | this.fetchLocalTree() |
| | | await this.fetchLocalTree() |
| | | } |
| | | if (this.openeds[1]) { |
| | | this.fetchGbTree() |
| | | await this.fetchGbTree() |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | removeNoAuthorizedNode(nodes: Array<any>, authList: Array<any>) { |
| | | for (let i = 0; i < nodes.length; ) { |
| | | if (nodes[i].children && nodes[i].children.length) { |
| | | this.removeNoAuthorizedNode(nodes[i].children, authList) |
| | | } |
| | | |
| | | if (nodes[i].type === "4") { |
| | | if (authList.indexOf(nodes[i].id) < 0) { |
| | | nodes.splice(i, 1) |
| | | continue |
| | | } |
| | | } else { |
| | | if (!nodes[i].children || !nodes[i].children.length) { |
| | | nodes.splice(i, 1) |
| | | continue |
| | | } |
| | | } |
| | | |
| | | i++ |
| | | } |
| | | } |
| | | |
| | | countCheckedNodes(nodes: Array<any>) { |
| | | let count = 0 |
| | | nodes.forEach((n) => { |