| | |
| | | refreshGB28181Tree, |
| | | updateCameraArea, |
| | | getCameraBaseImage |
| | | } from '@/api/area' |
| | | } from "@/api/area" |
| | | |
| | | import {getClusterDevList} from '@/api/clusterManage' |
| | | import { getClusterDevList } from "@/api/clusterManage" |
| | | |
| | | export default class TreeDataPool { |
| | | public openeds: Array<boolean> |
| | |
| | | public readonly: boolean |
| | | public gbReadonly: boolean |
| | | public multiple: boolean |
| | | public searchFrom: string = '' |
| | | public searchFrom: string = "" |
| | | public showTreeBox: boolean |
| | | public selectedNodes: Array<string> |
| | | public selectedNode: any |
| | |
| | | public clusterId: string |
| | | public devId: string |
| | | |
| | | // 记录摄像机所属的父节点名称 |
| | | public cameraParents: object |
| | | |
| | | constructor() { |
| | | this.openeds = [true, true, false] |
| | |
| | | this.treeDataPure = [] |
| | | this.gb28181DataPure = [] |
| | | this.clusterDataPure = [] |
| | | this.videoArr = [''] |
| | | this.videoArr = [""] |
| | | this.searchCamType = 0 |
| | | this.searchInput = '' |
| | | this.activeVideoIndex = '' |
| | | this.activeVideoId = '' |
| | | this.searchInput = "" |
| | | this.activeVideoIndex = "" |
| | | this.activeVideoId = "" |
| | | this.activeForceChoose = false |
| | | this.showTreeBox = true |
| | | this.readonly = true |
| | |
| | | this.multiple = false |
| | | this.selectedNodes = [] |
| | | this.selectedNode = {} |
| | | this.treeType = '' |
| | | this.treeType = "" |
| | | this.foldNodeList = {} |
| | | this.treeActiveName = 'camera' |
| | | this.treeActiveName = "camera" |
| | | this.searchLocalType = 0 |
| | | |
| | | //1:暂停状态;2:等待状态;3:置灰 |
| | | this.btnStaus = '3' |
| | | this.ctrlCameraId = '' |
| | | this.ctrlCameraName = '' |
| | | this.btnStaus = "3" |
| | | this.ctrlCameraId = "" |
| | | this.ctrlCameraName = "" |
| | | this.zTree = false |
| | | this.checkedTreeNode = [] |
| | | this.gb28181CheckedCount = 0 |
| | |
| | | this.cameraNameForBaseImage = "" |
| | | this.gb28181CameraBaseImage = "" |
| | | this.baseImageLoading = false |
| | | this.activeNode = '' |
| | | this.clusterId = '' |
| | | this.devId = '' |
| | | |
| | | |
| | | this.activeNode = "" |
| | | this.clusterId = "" |
| | | this.devId = "" |
| | | this.cameraParents = {} |
| | | } |
| | | |
| | | |
| | | setVideoArr(index: number, value: object, vue: any): void { |
| | | vue.$set(this.videoArr, index, value) |
| | |
| | | } |
| | | let _selected = this.selectedNodes |
| | | function nodeFilter(node: any) { |
| | | if (node.type === '4' && node.selected) { |
| | | if (node.type === "4" && node.selected) { |
| | | _selected.push(node.id) |
| | | sessionStorage.setItem('cameraDevId',node.devId) |
| | | sessionStorage.setItem("cameraDevId", node.devId) |
| | | } |
| | | if (node.children) { |
| | | node.children.forEach((n: any) => { |
| | |
| | | } |
| | | if (this.selectedNode.cameraType === 0) { |
| | | //摄像机树 |
| | | if (this.treeActiveName == 'camera') { |
| | | if (this.treeActiveName == "camera") { |
| | | this.treeData.forEach((n: any) => { |
| | | nodeFilter(n) |
| | | }) |
| | | } else if (this.treeActiveName == 'cluster') { |
| | | } else if (this.treeActiveName == "cluster") { |
| | | //集群树 |
| | | this.clusterData.forEach((n: any) => { |
| | | nodeFilter(n) |
| | |
| | | } |
| | | |
| | | function nodeFilter(node: any) { |
| | | if (node.type === '4' && (node.selected || node.checked)) { |
| | | sessionStorage.setItem("cameraDevId", node.devId); |
| | | if (node.type === "4" && (node.selected || node.checked)) { |
| | | sessionStorage.setItem("cameraDevId", node.devId) |
| | | _this.selectedNodes.push(node.id) |
| | | } |
| | | if (node.children) { |
| | |
| | | } |
| | | |
| | | getParent(id: string, isGB: boolean): string { |
| | | let parent = '0' |
| | | let parent = "0" |
| | | |
| | | function nodeFilter(node: Array<any>): any { |
| | | for (let i = 0; i < node.length; i++) { |
| | |
| | | } |
| | | |
| | | cleanTree(tree) { |
| | | if (tree === 'localTree') { |
| | | if (tree === "localTree") { |
| | | this.treeData = JSON.parse(JSON.stringify(this.treeDataPure)) |
| | | } |
| | | if (tree === 'gb28182Tree') { |
| | | if (tree === "gb28182Tree") { |
| | | this.gb28181Data = JSON.parse(JSON.stringify(this.gb28181DataPure)) |
| | | } |
| | | } |
| | |
| | | if (!node) { |
| | | return |
| | | } |
| | | node.forEach(n => { |
| | | node.forEach((n) => { |
| | | // vue-js-tree 默认展开,控制部分折叠. z-tree 默认折叠, 控制部分展开 |
| | | if (this.foldNodeList[n.id]) { |
| | | if (this.zTree) { |
| | |
| | | if (!node) { |
| | | return |
| | | } |
| | | node.forEach(n => { |
| | | node.forEach((n) => { |
| | | if (n.children && n.children.length > 0) { |
| | | this.setDropDisable(n.children) |
| | | } else { |
| | | if (n.type === '4') { |
| | | if (n.type === "4") { |
| | | n.dropDisabled = true |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | sortTreeData(node) { |
| | | sortTreeData(node, parentName = "") { |
| | | if (!node) { |
| | | return |
| | | } |
| | | node.sort(function (obj1: any, obj2: any) { |
| | | node.sort(function(obj1: any, obj2: any) { |
| | | var val1 = obj1.name |
| | | var val2 = obj2.name |
| | | if (val1 < val2) { |
| | |
| | | } |
| | | }) |
| | | |
| | | node.forEach(n => { |
| | | node.forEach((n) => { |
| | | if (n.children && n.children.length > 0) { |
| | | if (this.zTree) { |
| | | n.open = true |
| | | } |
| | | this.sortTreeData(n.children) |
| | | let pname = parentName === "" ? n.name : parentName + "/" + n.name |
| | | // console.log("pname", pname) |
| | | this.sortTreeData(n.children, pname) |
| | | } else { |
| | | if (n.type != "MENU") { |
| | | this.cameraParents[n.id] = parentName |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | async fetchLocalTree() { |
| | | let params: any = { |
| | | parentId:"", |
| | | parentId: "", |
| | | searchType: this.searchCamType, |
| | | cameraName: this.searchInput, |
| | | |
| | | cameraName: this.searchInput |
| | | |
| | | //isPlatform: 1 |
| | | } |
| | | if (this.searchFrom == 'cluster') { |
| | | if (this.searchFrom == "cluster") { |
| | | params.isPlatform = 1 |
| | | } |
| | | |
| | | |
| | | const rsp: any = await getLocalCameraTree(params) |
| | | |
| | | if (rsp && rsp.success) { |
| | | |
| | | this.treeData = rsp.data.treeMenu ? rsp.data.treeMenu : [] |
| | | if (this.treeData && this.treeData.length > 0) { |
| | | this.sortTreeData(this.treeData) |
| | | // console.log("cameraParents", this.cameraParents) |
| | | } |
| | | |
| | | // 设置禁止拖拽摄像机到摄像机节点 |
| | |
| | | } |
| | | |
| | | async fetchTreeData() { |
| | | this.cameraParents = {} |
| | | if (this.openeds[0]) { |
| | | this.fetchLocalTree() |
| | | } |
| | |
| | | async add(name: string, parent: string) { |
| | | await addAreaTreeData({ |
| | | name: name, |
| | | parentId: parent, |
| | | parentId: parent |
| | | }) |
| | | |
| | | this.fetchTreeData() |
| | |
| | | |
| | | async del(id: string) { |
| | | await delAreaTreeData({ |
| | | id: id, |
| | | id: id |
| | | }) |
| | | |
| | | this.fetchTreeData() |
| | |
| | | id: id, |
| | | name: name, |
| | | parentId: this.getParent(id, isGb), |
| | | alias: alias, |
| | | alias: alias |
| | | }) |
| | | |
| | | this.fetchTreeData() |
| | |
| | | |
| | | getAllChildrenNodes(treeNode, arr) { |
| | | for (var i = 0; i < treeNode.length; i++) { |
| | | var sonList = treeNode[i].children; |
| | | var sonList = treeNode[i].children |
| | | if (!sonList) { |
| | | if (treeNode[i].type == "camera") { |
| | | arr.push(treeNode[i]); |
| | | arr.push(treeNode[i]) |
| | | |
| | | if (treeNode[i].checked) { |
| | | this.gb28181CheckedCount += 1; |
| | | this.gb28181CheckedCount += 1 |
| | | } |
| | | } |
| | | } else { |
| | | this.getAllChildrenNodes(sonList, arr); |
| | | this.getAllChildrenNodes(sonList, arr) |
| | | } |
| | | } |
| | | return arr; |
| | | return arr |
| | | } |
| | | countChildrenNodes(treeNode) { |
| | | let arry = [] |
| | |
| | | fn = refreshGB28181Tree |
| | | } |
| | | const rsp: any = await fn({ |
| | | clusterId:this.clusterId, |
| | | devId:this.devId, |
| | | clusterId: this.clusterId, |
| | | devId: this.devId |
| | | }) |
| | | |
| | | if (rsp && rsp.success) { |
| | |
| | | } |
| | | |
| | | removeNoCheckedNode(nodes: Array<any>) { |
| | | for (let i = 0; i < nodes.length;) { |
| | | for (let i = 0; i < nodes.length; ) { |
| | | if (!nodes[i].checked) { |
| | | nodes.splice(i, 1) |
| | | continue |
| | |
| | | |
| | | countCheckedNodes(nodes: Array<any>) { |
| | | let count = 0 |
| | | nodes.forEach(n => { |
| | | nodes.forEach((n) => { |
| | | if (n.type == "camera") { |
| | | count++ |
| | | } |
| | |
| | | this.cameraNameForBaseImage = node.name |
| | | |
| | | try { |
| | | const rsp: any = await getCameraBaseImage({ |
| | | const rsp: any = await getCameraBaseImage({ |
| | | id: node.id, |
| | | clusterId: this.clusterId, |
| | | devId: this.devId, |
| | | devId: this.devId |
| | | }) |
| | | |
| | | if (rsp && rsp.data) { |