From 3e4904fda5c78cfd8b40fa925fd2970b01850224 Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期五, 19 八月 2022 22:21:30 +0800
Subject: [PATCH] 添加摄像机权限
---
src/views/personalCenter/components/SubAccount.vue | 450 ++++++++++---------
src/views/personalCenter/components/Content.vue | 45 -
src/views/search/components/giantTree/index.vue | 239 ++++------
src/views/manageCenter/index.vue | 37 +
src/views/personalCenter/components/LeftMenu.vue | 30
src/components/CameraLeft.vue | 447 +++++++-----------
src/views/hashrate/CameraManage/index.vue | 3
src/components/IndexHeader.vue | 17
src/Pool/TreeData.ts | 76 ++
src/Pool/VideoPhotoData.ts | 12
src/components/giantTree/index.vue | 24
11 files changed, 678 insertions(+), 702 deletions(-)
diff --git a/src/Pool/TreeData.ts b/src/Pool/TreeData.ts
index 16b1ca3..7598c5b 100644
--- a/src/Pool/TreeData.ts
+++ b/src/Pool/TreeData.ts
@@ -166,27 +166,17 @@
}
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)
})
}
@@ -218,7 +208,7 @@
return camera
}
- getCameraInfoById(id) {
+ getCameraInfoById(id: string) {
let camera = null
function nodeFilter(node: any) {
@@ -278,6 +268,14 @@
this.isFold(this.treeData)
this.isFold(this.gb28181Data)
+ this.selectedNodes = []
+ this.selectedNode = {}
+ }
+
+ reset() {
+ this.treeData = []
+ this.gb28181Data = []
+
this.selectedNodes = []
this.selectedNode = {}
}
@@ -368,7 +366,6 @@
if (this.searchFrom == "cluster") {
params.isPlatform = 1
}
-
const rsp: any = await getLocalCameraTree(params)
if (rsp && rsp.success) {
@@ -382,6 +379,25 @@
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)
+ }
}
}
@@ -421,10 +437,10 @@
async fetchTreeData() {
this.cameraParents = {}
if (this.openeds[0]) {
- this.fetchLocalTree()
+ await this.fetchLocalTree()
}
if (this.openeds[1]) {
- this.fetchGbTree()
+ await this.fetchGbTree()
}
}
@@ -531,6 +547,28 @@
}
}
+ 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) => {
diff --git a/src/Pool/VideoPhotoData.ts b/src/Pool/VideoPhotoData.ts
index 9400544..82d42f5 100644
--- a/src/Pool/VideoPhotoData.ts
+++ b/src/Pool/VideoPhotoData.ts
@@ -84,9 +84,19 @@
warningFlag: this.warningFlag,
tabs: this.queryTabs,
tasks: this.queryTasks,
- treeNodes: this.treeNodes,
dataSource: "camera"
}
+
+ // 鏍规嵁鏉冮檺鎺у埗鎽勫儚鏈�
+ let userInfo = JSON.parse(sessionStorage.getItem("userInfo"))
+ // 鏈�夋嫨鎽勫儚鏈哄苟涓斾笉鏄鐞嗗憳
+ if (!this.treeNodes.length && userInfo.username != "Administrator") {
+ let checkedCameras = userInfo.email
+
+ this.treeNodes = checkedCameras.split(",")
+ }
+ param.treeNodes = this.treeNodes
+
if (this.searchFrom == "cluster") {
param.isAll = true
}
diff --git a/src/components/CameraLeft.vue b/src/components/CameraLeft.vue
index 76f3cbb..d601e66 100644
--- a/src/components/CameraLeft.vue
+++ b/src/components/CameraLeft.vue
@@ -2,22 +2,9 @@
<transition name="slideLeft">
<div class="CameraLeft">
<div class="tree">
- <div
- class="left-tree-box"
- v-show="TreeDataPool.showTreeBox"
- v-loading="menuLoading"
- >
- <el-tabs
- v-model="TreeDataPool.treeActiveName"
- type="border-card"
- @tab-click="handleClick"
- >
- <el-tab-pane
- label="鎽勫儚鏈�"
- name="camera"
- :style="`height:${height - 56}px;`"
- v-if="showCam"
- >
+ <div class="left-tree-box" v-show="TreeDataPool.showTreeBox" v-loading="menuLoading">
+ <el-tabs v-model="TreeDataPool.treeActiveName" type="border-card" @tab-click="handleClick">
+ <el-tab-pane label="鎽勫儚鏈�" name="camera" :style="`height:${height - 56}px;`" v-if="showCam">
<el-menu
:default-openeds="openeds"
background-color="#fff"
@@ -30,11 +17,7 @@
@close="menuClose"
>
<li class="navTopSelect">
- <el-select
- v-model="TreeDataPool.searchCamType"
- placeholder="璇烽�夋嫨"
- @change="searchAreaData"
- >
+ <el-select v-model="TreeDataPool.searchCamType" placeholder="璇烽�夋嫨" @change="searchAreaData">
<el-option
v-for="item in searchTypeOptions"
:key="item.value"
@@ -48,11 +31,7 @@
clearable
@input="querySearchAsync('camera')"
>
- <i
- class="iconfont searchIcon"
- style="color: #dcdfe6"
- slot="suffix"
- @click="searchAreaData"
+ <i class="iconfont searchIcon" style="color: #dcdfe6" slot="suffix" @click="searchAreaData"
></i
>
</el-input>
@@ -68,11 +47,7 @@
</li>
<div class="tree-edit area-add" v-show="!TreeDataPool.readonly">
- <el-tooltip
- content="娣诲姞鍖哄煙"
- placement="bottom"
- popper-class="atooltip"
- >
+ <el-tooltip content="娣诲姞鍖哄煙" placement="bottom" popper-class="atooltip">
<button @click="addNode($event)">
<i class="iconfont"></i>
</button>
@@ -80,39 +55,21 @@
</div>
<!-- 娣诲姞璁惧鍥炬爣 -->
- <div
- class="tree-edit camera-add"
- v-show="!TreeDataPool.readonly"
- >
- <el-tooltip
- content="娣诲姞璁惧"
- placement="bottom"
- popper-class="atooltip"
- >
+ <div class="tree-edit camera-add" v-show="!TreeDataPool.readonly">
+ <el-tooltip content="娣诲姞璁惧" placement="bottom" popper-class="atooltip">
<button @click="addCamera('0')">
<!-- <i class="el-icon-video-camera"></i> -->
- <span class="iconfont" style="font-size: 14px"
- ></span
- >
+ <span class="iconfont" style="font-size: 14px"></span>
</button>
</el-tooltip>
</div>
<!-- 瀵煎叆璁惧 -->
- <div
- class="tree-edit import-btn"
- v-show="!TreeDataPool.readonly"
- >
- <el-tooltip
- content="瀵煎叆璁惧"
- placement="bottom"
- popper-class="atooltip"
- >
+ <div class="tree-edit import-btn" v-show="!TreeDataPool.readonly">
+ <el-tooltip content="瀵煎叆璁惧" placement="bottom" popper-class="atooltip">
<button @click="importCameras('0')">
<!-- <i class="el-icon-video-camera"></i> -->
- <span class="iconfont" style="font-size: 16px"
- ></span
- >
+ <span class="iconfont" style="font-size: 16px"></span>
</button>
</el-tooltip>
</div>
@@ -129,9 +86,7 @@
<el-submenu index="0">
<template slot="title">
<!-- <i class="iconfont iconjiankongshexiangji"></i> -->
- <span class="iconfont closeIcon" v-if="openeds[0] === '0'"
- ></span
- >
+ <span class="iconfont closeIcon" v-if="openeds[0] === '0'"></span>
<span class="iconfont openIcon" v-else></span>
<span class="iconfont cameraIcon"></span>
<b class="tree-font">鎽勫儚鏈�</b>
@@ -151,9 +106,7 @@
<el-submenu index="1">
<template slot="title">
<!-- <i class="iconfont iconjiankongshexiangji"></i> -->
- <span class="iconfont closeIcon" v-if="openeds[0] === '1'"
- ></span
- >
+ <span class="iconfont closeIcon" v-if="openeds[0] === '1'"></span>
<span class="iconfont openIcon" v-else></span>
<span class="iconfont cameraIcon"></span>
<b class="tree-font">GB28181</b>
@@ -170,16 +123,8 @@
</div>-->
<div class="tree-edit gb-lock" v-show="showLock">
<button @click="gbLockSwitch">
- <i
- v-if="TreeDataPool.gbReadonly"
- class="el-icon-lock"
- style="font-size: 16px"
- ></i>
- <i
- v-else
- class="el-icon-unlock"
- style="font-size: 16px"
- ></i>
+ <i v-if="TreeDataPool.gbReadonly" class="el-icon-lock" style="font-size: 16px"></i>
+ <i v-else class="el-icon-unlock" style="font-size: 16px"></i>
</button>
</div>
<el-menu-item-group class="item-group">
@@ -198,9 +143,7 @@
<el-submenu index="2">
<template slot="title">
<!-- <i class="iconfont iconjiankongshexiangji"></i> -->
- <span class="iconfont closeIcon" v-if="openeds[0] === '2'"
- ></span
- >
+ <span class="iconfont closeIcon" v-if="openeds[0] === '2'"></span>
<span class="iconfont openIcon" v-else></span>
<span class="iconfont cameraIcon"></span>
<b class="tree-font">鍥剧墖</b>
@@ -208,21 +151,12 @@
</el-submenu>
</el-menu>
</el-tab-pane>
- <el-tab-pane
- label="闆嗙兢"
- name="cluster"
- :style="`height:${height - 56}px;`"
- v-if="showCluster"
- >
+ <el-tab-pane label="闆嗙兢" name="cluster" :style="`height:${height - 56}px;`" v-if="showCluster">
<div class="local-vedio-area">
<!-- 鎼滅储 -->
<div class="navTopSelect">
<div class="search-input flex-box">
- <el-select
- v-model="TreeDataPool.searchCamType"
- placeholder="璇烽�夋嫨"
- @change="searchClusterData"
- >
+ <el-select v-model="TreeDataPool.searchCamType" placeholder="璇烽�夋嫨" @change="searchClusterData">
<el-option
v-for="item in searchTypeOptions"
:key="item.value"
@@ -230,9 +164,7 @@
:value="item.value"
></el-option>
</el-select>
- <span
- style="display: inline-block; padding: 0px 3px"
- ></span>
+ <span style="display: inline-block; padding: 0px 3px"></span>
<el-input
v-model="TreeDataPool.searchInput"
placeholder="鎼滅储"
@@ -248,18 +180,9 @@
</el-input>
</div>
</div>
- <div
- class="top-menu"
- style="margin: 0 0 10px; text-align: left"
- >
- <span
- class="iconfont iconjiqun"
- style="font-size: 20px"
- ></span>
- <span
- style="font-size: 14px; margin-left: 5px; font-weight: 600"
- >{{ clusterName }}</span
- >
+ <div class="top-menu" style="margin: 0 0 10px; text-align: left">
+ <span class="iconfont iconjiqun" style="font-size: 20px"></span>
+ <span style="font-size: 14px; margin-left: 5px; font-weight: 600">{{ clusterName }}</span>
</div>
<div class="cluster-list">
<tree-menu
@@ -270,6 +193,7 @@
:height="height"
@addDevice="addCamera"
@import="importCameras"
+ style="width:400px"
/>
</div>
</div>
@@ -322,15 +246,8 @@
<!-- 鏈湴瑙嗛婧愬垪琛� -->
<div class="dev-vedio-list">
<!-- 娣诲姞鏂囦欢澶瑰浘鏍� -->
- <div
- class="tree-edit area-add"
- v-show="!DataStackPool.readonly"
- >
- <el-tooltip
- content="娣诲姞鏂囦欢澶�"
- placement="bottom"
- popper-class="atooltip"
- >
+ <div class="tree-edit area-add" v-show="!DataStackPool.readonly">
+ <el-tooltip content="娣诲姞鏂囦欢澶�" placement="bottom" popper-class="atooltip">
<button @click="addDir($event)">
<i class="iconfont iconhebingxingzhuang"></i>
</button>
@@ -344,15 +261,10 @@
<i v-else class="el-icon-unlock"></i>
</button>
</div>
- <LocalVedioList
- :dataList="TreeDataPool.localVedioList"
- ></LocalVedioList>
+ <LocalVedioList :dataList="TreeDataPool.localVedioList"></LocalVedioList>
</div>
</div>
- <file-upload
- v-show="fileUploadBox"
- @close="fileUploadBox = false"
- />
+ <file-upload v-show="fileUploadBox" @close="fileUploadBox = false" />
</el-tab-pane>
</el-tabs>
@@ -376,90 +288,86 @@
</template>
<script>
-import { changeEnable, deleteLocalFile, updateStatus } from "@/api/localVedio";
+import { changeEnable, deleteLocalFile, updateStatus } from "@/api/localVedio"
-import { createCamera } from "@/api/camera";
+import { createCamera } from "@/api/camera"
-import bus from "@/plugin/bus";
+import bus from "@/plugin/bus"
// import TreeMenu from "@/components/treeMenu/index";
-import TreeMenu from "@/components/giantTree/index";
-import LocalVedioList from "@/components/subComponents/LocalVedioList";
-import FileUpload from "@/components/subComponents/FileUpload/index";
-import XLSX from "xlsx";
-import { findCluster } from "@/api/clusterManage";
+import TreeMenu from "@/components/giantTree/index"
+import LocalVedioList from "@/components/subComponents/LocalVedioList"
+import FileUpload from "@/components/subComponents/FileUpload/index"
+import XLSX from "xlsx"
+import { findCluster } from "@/api/clusterManage"
export default {
components: {
TreeMenu,
LocalVedioList,
- FileUpload,
+ FileUpload
},
props: {
appName: {
type: String,
- default: "Video",
+ default: "Video"
},
edit: {
type: Boolean,
- default: false,
+ default: false
},
height: {
type: Number,
- default: 0,
- },
+ default: 0
+ }
},
computed: {
showTab() {
- return true;
+ return true
},
showCam() {
return (
this.appName === "Camera" ||
this.appName === "Cluster" ||
- (this.appName === "Search" &&
- (this.buttonAuthority.indexOf("search:camera") >= 0 || this.isAdmin))
- );
+ (this.appName === "Search" && (this.buttonAuthority.indexOf("search:camera") >= 0 || this.isAdmin))
+ )
},
showCluster() {
- return this.appName === "Cluster";
+ return this.appName === "Cluster"
},
// 鏁版嵁鏍堥厤缃繀椤绘樉绀恒�� 妫�绱㈤�氳繃鏉冮檺鎺у埗鏄剧ず, 鏈畨瑁呮暟鎹爤涔熶笉鏄剧ず
showDataStack() {
if (this.appName === "DataStack") {
- return true;
+ return true
}
if (this.appName === "Search") {
// 鏈畨瑁呮暟鎹爤閰嶇疆
if (this.installedApps.indexOf("dataStack") >= 0) {
if (this.isAdmin) {
- return true;
+ return true
}
if (this.buttonAuthority.indexOf("search:stack") >= 0) {
- return true;
+ return true
}
}
}
- return false;
+ return false
},
showLock() {
- return this.edit;
+ return this.edit
},
isAdmin() {
//鍚庨棬
- if (
- sessionStorage.getItem("userInfo") &&
- sessionStorage.getItem("userInfo") !== ""
- ) {
- let loginName = JSON.parse(sessionStorage.getItem("userInfo")).username;
- return loginName === "superadmin" || loginName === "basic";
+ if (sessionStorage.getItem("userInfo") && sessionStorage.getItem("userInfo") !== "") {
+ let loginName = JSON.parse(sessionStorage.getItem("userInfo")).username
+ return loginName === "superadmin" || loginName === "basic"
}
- return true;
- },
+ return true
+ }
},
data() {
return {
@@ -467,25 +375,24 @@
dataStack: "videoMonitor:dataStack",
buttonAuthority: sessionStorage.getItem("buttonAuthoritys") || [],
installedApps: sessionStorage.getItem("apps") || [],
- loginName:
- JSON.parse(sessionStorage.getItem("userInfo")).username || "鐢ㄦ埛鍚�",
+ loginName: JSON.parse(sessionStorage.getItem("userInfo")).username || "鐢ㄦ埛鍚�",
searchTypeOptions: [
{
value: 0,
- label: "鍏ㄩ儴鎽勫儚鏈�",
+ label: "鍏ㄩ儴鎽勫儚鏈�"
},
{
value: 1,
- label: "鍒嗘瀽鎽勫儚鏈�",
+ label: "鍒嗘瀽鎽勫儚鏈�"
},
{
value: 2,
- label: "鐩戞帶鎽勫儚鏈�",
+ label: "鐩戞帶鎽勫儚鏈�"
},
{
value: 3,
- label: "鑱斿姩鎽勫儚鏈�",
- },
+ label: "鑱斿姩鎽勫儚鏈�"
+ }
],
timeout: null,
fileUploadBox: false,
@@ -493,258 +400,252 @@
importAreaId: "",
menuLoading: false,
clusterName: "",
- cluster: "",
- };
+ cluster: ""
+ }
},
created() {
if (this.showCam) {
- this.TreeDataPool.treeActiveName = "camera";
+ this.TreeDataPool.treeActiveName = "camera"
// this.TreeDataPool.fetchTreeData();
} else {
- this.TreeDataPool.treeActiveName = "dataStack";
- this.DataStackPool.fetchFiles();
+ this.TreeDataPool.treeActiveName = "dataStack"
+ this.DataStackPool.fetchFiles()
}
if (this.showCluster) {
- this.TreeDataPool.treeActiveName = "cluster";
- this.TreeDataPool.fetchClusterTree();
+ this.TreeDataPool.treeActiveName = "cluster"
+ this.TreeDataPool.fetchClusterTree()
findCluster().then((res) => {
if (res.success) {
- this.clusterName = res.data.clusterName;
+ this.clusterName = res.data.clusterName
}
- });
+ })
}
},
methods: {
searchAreaData() {
- this.TreeDataPool.fetchTreeData();
+ this.TreeDataPool.fetchTreeData()
},
searchDataStack() {
- this.DataStackPool.fetchFiles();
+ this.DataStackPool.fetchFiles()
},
searchClusterData() {
- this.TreeDataPool.fetchClusterTree();
+ this.TreeDataPool.fetchClusterTree()
},
lockSwitch() {
- this.TreeDataPool.readonly = !this.TreeDataPool.readonly;
+ this.TreeDataPool.readonly = !this.TreeDataPool.readonly
},
gbLockSwitch() {
- this.TreeDataPool.gbReadonly = !this.TreeDataPool.gbReadonly;
+ this.TreeDataPool.gbReadonly = !this.TreeDataPool.gbReadonly
},
dataStackLockSwitch() {
- this.DataStackPool.readonly = !this.DataStackPool.readonly;
+ this.DataStackPool.readonly = !this.DataStackPool.readonly
},
closeTree() {
- this.TreeDataPool.showTreeBox = false;
- bus.$emit("refreshCompareImg");
+ this.TreeDataPool.showTreeBox = false
+ bus.$emit("refreshCompareImg")
},
addNode(event) {
- this.$refs.tree.addNode(event, { id: 0 });
+ this.$refs.tree.addNode(event, { id: 0 })
},
addCamera(node) {
- bus.$emit("addCameraOnTree", node);
+ bus.$emit("addCameraOnTree", node)
},
addDir(node) {
- bus.$emit("addDirOnTree", node);
+ bus.$emit("addDirOnTree", node)
},
menuOpen(index) {
- this.$set(this.openeds, 0, index);
- this.TreeDataPool.openeds[index] = true;
+ this.$set(this.openeds, 0, index)
+ this.TreeDataPool.openeds[index] = true
},
menuClose(index) {
- this.$set(this.openeds, 0, "");
- this.TreeDataPool.openeds[index] = false;
+ this.$set(this.openeds, 0, "")
+ this.TreeDataPool.openeds[index] = false
},
refreshGB() {
// 闃叉閲嶅鍒锋柊
if (this.loadingGBTree) {
- return;
+ return
}
// 鍥芥爣鎽勫儚鏈烘暟鎹槸鍥芥爣鏈嶅姟鍒嗘壒鎺ㄩ�佺殑锛岃姹傚埛鏂板垪琛ㄥ悗锛岄渶瑕佺瓑寰呯害1鍒嗛挓鐨勬椂闂村悗绔墠鑳藉悓姝ュ畬鏁版嵁銆�
- this.TreeDataPool.refreshGB28181();
- this.loadingGBTree = true;
+ this.TreeDataPool.refreshGB28181()
+ this.loadingGBTree = true
setTimeout(() => {
- this.TreeDataPool.fetchGbTree();
- this.loadingGBTree = false;
- }, 1000 * 60);
+ this.TreeDataPool.fetchGbTree()
+ this.loadingGBTree = false
+ }, 1000 * 60)
},
querySearchAsync(type) {
- clearTimeout(this.timeout);
+ clearTimeout(this.timeout)
this.timeout = setTimeout(() => {
if (type === "camera") {
- this.TreeDataPool.fetchTreeData();
+ this.TreeDataPool.fetchTreeData()
}
if (type === "cluster") {
- this.TreeDataPool.fetchClusterTree();
+ this.TreeDataPool.fetchClusterTree()
}
if (type === "dir") {
- this.DataStackPool.fetchFiles();
+ this.DataStackPool.fetchFiles()
}
- }, 500);
+ }, 500)
},
handleClick(event) {
if (event.name == "dataStack") {
- this.DataStackPool.fetchFiles();
- this.DataStackPool.clean();
- this.TreeDataPool.clean();
+ this.DataStackPool.fetchFiles()
+ this.DataStackPool.clean()
+ this.TreeDataPool.clean()
}
- this.TreeDataPool.treeActiveName = event.name;
- console.log("褰撳墠婵�娲籲ame锛�", this.TreeDataPool.treeActiveName);
+ this.TreeDataPool.treeActiveName = event.name
},
async changeEnable() {
if (this.PollData.localVideo === 0) {
this.$notify({
title: "澶辫触",
type: "warning",
- message: "寮�鍚湰鍦版暟鎹棰戝垎鏋愬鐞嗭紝闇�鍏堜负鏈湴鏁版嵁鎵嬪姩璁剧疆绠楀姏璧勬簮锛�",
- });
- return false;
+ message: "寮�鍚湰鍦版暟鎹棰戝垎鏋愬鐞嗭紝闇�鍏堜负鏈湴鏁版嵁鎵嬪姩璁剧疆绠楀姏璧勬簮锛�"
+ })
+ return false
}
let res = await changeEnable({
- enable: this.TreeDataPool.vedioAnaliyseSwitch,
- });
+ enable: this.TreeDataPool.vedioAnaliyseSwitch
+ })
if (res && res.success) {
- console.log(res, "鍒囨崲鏈湴鏂囦欢鍒嗘瀽寮�鍏�");
+ console.log(res, "鍒囨崲鏈湴鏂囦欢鍒嗘瀽寮�鍏�")
}
},
getCheckedFiles() {
let list1 = this.TreeDataPool.localVedioList.filter((i) => {
- return i.checkStatus;
- });
- return list1;
+ return i.checkStatus
+ })
+ return list1
},
async stopVedio(status) {
// let list1 = this.getCheckedFiles();
if (this.TreeDataPool.checkedLocalVedio.length == 0) {
this.$notify({
type: "warning",
- message: "璇峰厛閫夋嫨闇�瑕佸仠姝㈢殑瑙嗛锛�",
- });
+ message: "璇峰厛閫夋嫨闇�瑕佸仠姝㈢殑瑙嗛锛�"
+ })
// this.$notify({
// type:"info",
// message:"璇峰厛閫夋嫨闇�瑕佸仠姝㈢殑瑙嗛锛�"
// })
- return false;
+ return false
}
let res = await updateStatus({
ids: this.TreeDataPool.checkedLocalVedio.map((i) => {
- return i.id;
+ return i.id
}),
- status: status,
- });
+ status: status
+ })
if (res && res.success) {
- console.log(res, "寮�鍚殏鍋滃弬鏁�");
+ console.log(res, "寮�鍚殏鍋滃弬鏁�")
}
},
async deleteLocalFiles() {
- let list1 = this.getCheckedFiles();
- console.log(list1, "宸插嬀閫夌殑瑙嗛");
+ let list1 = this.getCheckedFiles()
+ console.log(list1, "宸插嬀閫夌殑瑙嗛")
if (list1.length == 0) {
- return false;
+ return false
}
let res = await deleteLocalFile({
ids: list1.map((i) => {
- return i.id;
- }),
- });
+ return i.id
+ })
+ })
if (res && res.success) {
this.$notify({
type: "success",
- message: "鍒犻櫎鎴愬姛锛侊紒",
- });
+ message: "鍒犻櫎鎴愬姛锛侊紒"
+ })
} else {
this.$notify({
type: "error",
- message: "鍒犻櫎澶辫触锛�",
- });
+ message: "鍒犻櫎澶辫触锛�"
+ })
}
},
refrash(current, pageSize) {
- this.TreeDataPool.localCurrentPage = current;
+ this.TreeDataPool.localCurrentPage = current
},
importCameras(area) {
- this.importAreaId = area;
- this.$refs["import-btn"].click();
+ this.importAreaId = area
+ this.$refs["import-btn"].click()
},
async uploadFile(params) {
- const _file = params.file;
- const fileReader = new FileReader();
+ const _file = params.file
+ const fileReader = new FileReader()
fileReader.onload = (ev) => {
- this.menuLoading = true;
+ this.menuLoading = true
try {
- const data = ev.target.result;
+ const data = ev.target.result
const workbook = XLSX.read(data, {
- type: "binary",
- });
+ type: "binary"
+ })
for (let sheet in workbook.Sheets) {
//寰幆璇诲彇姣忎釜鏂囦欢
- const sheetArray = XLSX.utils.sheet_to_json(workbook.Sheets[sheet]);
+ const sheetArray = XLSX.utils.sheet_to_json(workbook.Sheets[sheet])
//鑻ュ綋鍓峴heet娌℃湁鏁版嵁锛屽垯continue
if (sheetArray.length == 0) {
- continue;
+ continue
}
- let succeed = 0;
- let failed = 0;
- let promiseArr = [];
+ let succeed = 0
+ let failed = 0
+ let promiseArr = []
for (let item in sheetArray) {
- let camera = this.newCamera();
- camera.areaid = this.importAreaId;
- camera.name = String(sheetArray[item].name);
- camera.rtsp = String(sheetArray[item].rtsp);
- camera.addr = String(sheetArray[item].addr);
+ let camera = this.newCamera()
+ camera.areaid = this.importAreaId
+ camera.name = String(sheetArray[item].name)
+ camera.rtsp = String(sheetArray[item].rtsp)
+ camera.addr = String(sheetArray[item].addr)
let tem = {
camera: camera,
- sensors: camera.sensors,
- };
- tem.camera.clusterId = this.TreeDataPool.clusterId;
- tem.camera.devId = this.TreeDataPool.devId;
- tem.camera.parentUserId = "";
- tem.camera.enable = false;
- delete tem.camera.sensors;
+ sensors: camera.sensors
+ }
+ tem.camera.clusterId = this.TreeDataPool.clusterId
+ tem.camera.devId = this.TreeDataPool.devId
+ tem.camera.parentUserId = ""
+ tem.camera.enable = false
+ delete tem.camera.sensors
- promiseArr.push(createCamera(tem));
+ promiseArr.push(createCamera(tem))
}
- let _this = this;
+ let _this = this
Promise.allSettled(promiseArr)
.then((res) => {
res.forEach((item) => {
if (item.status === "fulfilled") {
- succeed++;
+ succeed++
} else {
- failed++;
+ failed++
}
- });
- _this.menuLoading = false;
+ })
+ _this.menuLoading = false
_this.$message({
type: "success",
- message:
- "鎿嶄綔瀹屾垚, 瀵煎叆鎴愬姛:" +
- succeed +
- "涓� 澶辫触:" +
- failed +
- "涓�",
- });
- _this.TreeDataPool.fetchTreeData();
+ message: "鎿嶄綔瀹屾垚, 瀵煎叆鎴愬姛:" + succeed + "涓� 澶辫触:" + failed + "涓�"
+ })
+ _this.TreeDataPool.fetchTreeData()
})
.catch((e) => {
- console.log(e);
- });
+ console.log(e)
+ })
}
} catch (e) {
- this.menuLoading = false;
- this.$message.warning("鏂囦欢绫诲瀷涓嶆纭紒");
+ this.menuLoading = false
+ this.$message.warning("鏂囦欢绫诲瀷涓嶆纭紒")
}
- };
- fileReader.readAsBinaryString(_file);
+ }
+ fileReader.readAsBinaryString(_file)
},
exceed() {
- this.$message.error("鏈�澶氬彧鑳戒笂浼�1涓獂ls鏂囦欢");
+ this.$message.error("鏈�澶氬彧鑳戒笂浼�1涓獂ls鏂囦欢")
},
//鍒犻櫎鏂囦欢
remove() {},
@@ -760,11 +661,11 @@
run_type: -1,
username: "",
password: "",
- sensors: [],
- };
- },
- },
-};
+ sensors: []
+ }
+ }
+ }
+}
</script>
<style lang="scss" scoped>
@@ -1069,4 +970,4 @@
.flex-box {
display: flex;
}
-</style>
\ No newline at end of file
+</style>
diff --git a/src/components/IndexHeader.vue b/src/components/IndexHeader.vue
index 65a8d61..42dde17 100644
--- a/src/components/IndexHeader.vue
+++ b/src/components/IndexHeader.vue
@@ -7,12 +7,12 @@
<img class="logo" src="/images/index/LOGO.png" alt="" />
</router-link>
<div class="title" @click="$router.push('/')">鏅烘収璁惧绠$悊骞冲彴</div>
- <div class="label" @click="$router.push('/')">棣栭〉</div>
+ <!-- <div class="label" @click="$router.push('/')">棣栭〉</div> -->
<!-- <div class="label">浜戞湇鍔�</div> -->
<div class="label" @click="$router.push('/manageCenter')">绠$悊涓績</div>
<div class="label" @click="$router.push('/dataView')">鏁版嵁鍒嗘瀽</div>
<!-- <div class="label" @click="dataView">鏁版嵁鍒嗘瀽</div> -->
- <div class="label" @click="$router.push('/product')">搴旂敤鍟嗗煄</div>
+ <!-- <div class="label" @click="$router.push('/product')">搴旂敤鍟嗗煄</div> -->
</div>
<!-- 宸︿晶 -->
@@ -71,7 +71,7 @@
<div class="content"><span class="iconfont"></span> 宸插疄鍚嶈璇�</div>
</li>
- <li>
+ <li v-show="false">
<div class="label" @click="jump(0)">璁㈠崟绠$悊</div>
</li>
@@ -83,7 +83,7 @@
<div class="label">鏈娑堟伅</div>
</li> -->
- <li>
+ <li v-show="false">
<div class="label" @click="jump(0, 1)">鏈敮浠樿鍗�</div>
</li>
@@ -456,7 +456,7 @@
top: 64px;
padding: 0 20px;
width: 240px;
- height: 327px;
+ // height: 327px;
background-color: #fff;
box-shadow: 0px 4px 12px rgba(96, 100, 106, 0.12);
border-radius: 4px;
@@ -468,7 +468,7 @@
}
ul {
- height: 200px;
+ // height: 200px;
border-top: 1px solid #e9ebee;
border-bottom: 1px solid #e9ebee;
@@ -508,8 +508,9 @@
}
.logOut {
- margin-top: 20px;
- font-size: 16px;
+ // margin-top: 20px;
+ line-height: 40px;
+ font-size: 14px;
color: #3d3d3d;
cursor: pointer;
diff --git a/src/components/giantTree/index.vue b/src/components/giantTree/index.vue
index 686c1ea..1f2ba05 100644
--- a/src/components/giantTree/index.vue
+++ b/src/components/giantTree/index.vue
@@ -42,10 +42,10 @@
<div class="empty" v-if="!node.length">鏆傛棤鎽勫儚鏈烘暟鎹�,璇锋坊鍔犳憚鍍忔満!</div>
<div class="dialog-box-bg" v-show="showDialog" @click="hideDialogBox"></div>
<div class="dialog-box" v-show="showDialog">
- <el-card :body-style="{ padding: '10px' }">
+ <el-card :body-style="{ padding: '5px' }">
<el-form :model="dialogForm" size="mini" :rules="rules" ref="dialogForm" label-width="70px">
<el-form-item label="鍚嶇О锛�" prop="name">
- <el-input v-model="dialogForm.text" oninput="if(value.length>10)value=value.slice(0,10)"></el-input>
+ <el-input v-model="dialogForm.text" oninput="if(value.length>20)value=value.slice(0,20)"></el-input>
</el-form-item>
<div class="text-center pb-2">
<el-button size="mini" type="primary" @click="submitForm">淇濆瓨</el-button>
@@ -302,7 +302,6 @@
this.showDialog = true
},
itemClick(evt, treeId, treeNode) {
- console.log("click")
this.TreeDataPool.selectedNode = treeNode
this.TreeDataPool.activeNode = treeNode
this.TreeDataPool.treeType = this.treeName
@@ -361,6 +360,23 @@
},
showCameraPic(nodeId) {
this.TreeDataPool.showBaseImage(nodeId)
+ },
+ updateNodes(ids) {
+ // 鍙栨秷鎵�鏈夐�変腑鐘舵��
+ this.ztreeObj.checkAllNodes(false)
+
+ // nodes 杞暟缁�
+ let treeNodes = this.ztreeObj.getNodes()
+ let nodeArry = this.ztreeObj.transformToArray(treeNodes)
+
+ // 鍒ゆ柇鏄惁琚�変腑
+ for (let i = 0; i < nodeArry.length; i++) {
+ if (ids.indexOf(nodeArry[i].id) > -1) {
+ this.ztreeObj.checkNode(nodeArry[i], true, false, false)
+ }
+ }
+ let checkedNodes = this.ztreeObj.getCheckedNodes(true)
+ this.TreeDataPool.updateZTreeCheckNodes(checkedNodes)
}
}
}
@@ -373,7 +389,7 @@
top: 415px;
left: 43px;
position: fixed;
- width: 220px;
+ width: 260px;
z-index: 3;
}
.dialog-box-bg {
diff --git a/src/views/hashrate/CameraManage/index.vue b/src/views/hashrate/CameraManage/index.vue
index 8f55d57..3921bab 100644
--- a/src/views/hashrate/CameraManage/index.vue
+++ b/src/views/hashrate/CameraManage/index.vue
@@ -51,7 +51,6 @@
cluster: "",
clusterData: [],
intervalTimer: null,
- leftWith: 0,
screenHeight: 0
}
},
@@ -145,7 +144,6 @@
},
methods: {
TextWidthChange(e) {
- console.log(1212)
let odivParent = e.currentTarget.parentNode //鑾峰彇鐩爣鐖跺厓绱�
let dx = e.clientX //褰撲綘绗竴娆″崟鍑荤殑鏃跺�欙紝瀛樺偍x杞寸殑鍧愭爣銆�
let dw = odivParent.offsetWidth //瀛樺偍榛樿鐨刣iv鐨勫搴︺��
@@ -161,6 +159,7 @@
odivParent.style.width = this.pdfWidth - odivParent.offsetLeft + "px"
}
}
+
document.onmouseup = (e) => {
document.onmousemove = null
document.onmouseup = null
diff --git a/src/views/manageCenter/index.vue b/src/views/manageCenter/index.vue
index cdb76cc..f72fe0a 100644
--- a/src/views/manageCenter/index.vue
+++ b/src/views/manageCenter/index.vue
@@ -250,7 +250,7 @@
if (this.warningChecked == 0 || this.warningTotal == 0) {
return 0
}
- return parseInt(this.warningChecked / this.warningTotal) * 100 + "%"
+ return parseInt((this.warningChecked / this.warningTotal) * 100) + "%"
}
},
data() {
@@ -457,17 +457,18 @@
solvedTotal: 0,
warningTotal: 0,
warningChecked: 0,
- warningSolved: 0
+ warningSolved: 0,
+ authorizedCameras: []
}
},
created() {
this.getInfo()
},
- mounted() {
+ async mounted() {
+ await this.getCameras()
this.searchHandler()
this.initBar()
this.initPie()
- this.getCameras()
},
methods: {
async getCameras() {
@@ -481,9 +482,32 @@
let camereReq = await getLocalCameraTree({ clusterId: clusterId })
if (camereReq && camereReq.success) {
this.cameraTree = camereReq.data.treeMenu
- let tmpTree = JSON.parse(JSON.stringify(camereReq.data.treeMenu))
+
+ // 娓呯悊娌℃湁鏉冮檺绠$悊鐨勬憚鍍忔満, 鍚庣淇鍚庡垹闄�
+ let userInfo = JSON.parse(sessionStorage.getItem("userInfo"))
+
+ // 绠$悊鍛樻潈闄�
+ if (userInfo.username == "Administrator") {
+ return
+ }
+
+ let checkedCameras = userInfo.email
+
+ // basic 涓哄瓙璐︽埛榛樿鐨勭┖瀛楁,琛ㄧず鍙鐞嗙殑鎽勫儚鏈虹洰褰曚负绌�
+ if (checkedCameras == "basic") {
+ this.cameraTree = []
+ } else {
+ let cameraIds = checkedCameras.split(",")
+ this.authorizedCameras = cameraIds
+ this.TreeDataPool.removeNoAuthorizedNode(this.cameraTree, cameraIds)
+ }
+
+ let tmpTree = JSON.parse(JSON.stringify(this.cameraTree))
+
for (let i = 0; i < tmpTree.length; i++) this.clearNode(tmpTree[i])
this.menuTree = tmpTree
+
+ console.log(this.cameraTree)
}
},
clearNode(tree) {
@@ -504,7 +528,7 @@
let orgNodeIds = []
if (this.selectedOrg == "") {
- return orgNodeIds
+ return this.authorizedCameras
}
function findNode(node) {
@@ -567,6 +591,7 @@
let decodeResult = JSON.parse(decodeString)
decodeResult = []
if (decodeResult) {
+ console.log("decodeResult", decodeResult)
decodeResult.forEach((element) => {
this.solvedTotal = this.solvedTotal + element.doc_count
this.tableDataList.push({ date: element.key_as_string, count: element.doc_count })
diff --git a/src/views/personalCenter/components/Content.vue b/src/views/personalCenter/components/Content.vue
index dd146b5..c7ced9c 100644
--- a/src/views/personalCenter/components/Content.vue
+++ b/src/views/personalCenter/components/Content.vue
@@ -3,64 +3,55 @@
<div class="heart">
<LeftMenu @mChange="mChange"> </LeftMenu>
<div class="right-content">
- <SubAccount v-if="activeIndex == 2"></SubAccount>
- <BasicInfo v-if="activeIndex == 1" @gotolist="gotolist"></BasicInfo>
- <OrderMng v-if="activeIndex == 0"></OrderMng>
+ <SubAccount v-if="activeIndex == 'subAccount'"></SubAccount>
+ <BasicInfo v-if="activeIndex == 'baseInfo'" @gotolist="gotolist"></BasicInfo>
+ <OrderMng v-if="activeIndex == 'order'"></OrderMng>
</div>
</div>
</div>
</template>
<script>
-import SubAccount from "./SubAccount";
-import LeftMenu from "./LeftMenu";
-import BasicInfo from "./BasicInfo";
-import OrderMng from "./OrderMng";
+import SubAccount from "./SubAccount"
+import LeftMenu from "./LeftMenu"
+import BasicInfo from "./BasicInfo"
+import OrderMng from "./OrderMng"
export default {
- created() {
- window._AMapSecurityConfig = {
- securityJsCode: "768ab79bdc4075aa082bc070c53bb3c4",
- };
- if (this.$route.query && this.$route.query.id) {
- this.activeIndex = this.$route.query.id;
- }
- },
- mounted() {},
components: {
SubAccount, //琛ㄦ牸
LeftMenu,
BasicInfo,
- OrderMng,
+ OrderMng
},
data() {
return {
map: null,
AMap: null,
- activeIndex: 0,
+ activeIndex: "baseInfo",
nodes: [],
isShowCard: false,
isFull: false, //鏄惁鍏ㄥ睆
zoom: 4, //鍦板浘绾у埆
center: [116.06157, 39.66157], //鍦板浘涓績
activeNode: null, //閫変腑鐨勫湴鍥捐妭鐐�
- geocoder: {},
- };
+ geocoder: {}
+ }
},
methods: {
//鍏抽棴璁惧璇︽儏寮瑰眰
closeCard() {
- this.isShowCard = false;
+ this.isShowCard = false
},
mChange(i) {
- this.activeIndex = i;
+ this.activeIndex = i
},
gotolist() {
- this.mChange(4);
- },
- },
-};
+ this.mChange(4)
+ }
+ }
+}
</script>
<style scoped lang="scss">
@@ -90,4 +81,4 @@
width: 1036px;
}
}
-</style>
\ No newline at end of file
+</style>
diff --git a/src/views/personalCenter/components/LeftMenu.vue b/src/views/personalCenter/components/LeftMenu.vue
index 2670f4f..d2badd2 100644
--- a/src/views/personalCenter/components/LeftMenu.vue
+++ b/src/views/personalCenter/components/LeftMenu.vue
@@ -8,10 +8,10 @@
<div class="menu-list">
<div
class="item"
- @click="pickMenu(index)"
v-for="(item, index) in menuList"
:key="index"
:class="index == activeIndex ? 'active-item' : ''"
+ @click="pickMenu(index, item.tab)"
>
<span class="iconfont"></span>
<span class="item-name"> {{ item.name }}</span>
@@ -23,31 +23,31 @@
<script>
export default {
created() {
- this.userInfo = JSON.parse(sessionStorage.getItem("userInfo"));
+ this.userInfo = JSON.parse(sessionStorage.getItem("userInfo"))
if (this.$route.query && this.$route.query.id) {
- this.activeIndex = this.$route.query.id;
+ this.activeIndex = this.$route.query.id
}
},
data() {
return {
menuList: [
// { name: "璐︽埛鎬昏" },
- { name: "璁㈠崟绠$悊" },
+ // { name: "璁㈠崟绠$悊" },
// { name: "娑堟伅涓績" },
- { name: "鍩烘湰璧勬枡" },
- { name: "瀛愯处鎴风鐞�" },
+ { name: "鍩烘湰璧勬枡", tab: "baseInfo" },
+ { name: "瀛愯处鎴风鐞�", tab: "subAccount" }
],
userInfo: null,
- activeIndex: 0,
- };
+ activeIndex: 0
+ }
},
methods: {
- pickMenu(i) {
- this.activeIndex = i;
- this.$emit("mChange", i);
- },
- },
-};
+ pickMenu(idx, tab) {
+ this.activeIndex = idx
+ this.$emit("mChange", tab)
+ }
+ }
+}
</script>
<style scoped lang="scss">
@@ -94,4 +94,4 @@
}
}
}
-</style>
\ No newline at end of file
+</style>
diff --git a/src/views/personalCenter/components/SubAccount.vue b/src/views/personalCenter/components/SubAccount.vue
index 996cc34..95b6f3d 100644
--- a/src/views/personalCenter/components/SubAccount.vue
+++ b/src/views/personalCenter/components/SubAccount.vue
@@ -10,17 +10,8 @@
<div class="cluster">
鎺堟潈鏃堕暱
- <el-select
- @change="findUserList"
- v-model="timeLength"
- placeholder="璇烽�夋嫨"
- >
- <el-option
- v-for="item in durationArr"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
+ <el-select @change="findUserList" v-model="timeLength" placeholder="璇烽�夋嫨">
+ <el-option v-for="item in durationArr" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
</div>
@@ -52,40 +43,31 @@
:default-sort="{ prop: 'createTime', order: 'descending' }"
>
<el-table-column label="搴忓彿" width="55" class-name="index">
- <template slot-scope="scope">{{
- scope.$index + 1 + (page - 1) * size
- }}</template>
+ <template slot-scope="scope">{{ scope.$index + 1 + (page - 1) * size }}</template>
</el-table-column>
<!-- <el-table-column
prop="trueName"
label="濮撳悕"
show-overflow-tooltip
></el-table-column> -->
- <el-table-column
- prop="username"
- label="鐢ㄦ埛鍚�"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- prop="phoneNum"
- label="鎵嬫満鍙�"
- show-overflow-tooltip
- ></el-table-column>
+ <el-table-column prop="username" label="鐢ㄦ埛鍚�" show-overflow-tooltip></el-table-column>
+ <el-table-column prop="phoneNum" label="鎵嬫満鍙�" show-overflow-tooltip></el-table-column>
<el-table-column prop="userType" label="鐢ㄦ埛绫诲瀷">
<template slot-scope="scope">
<span>{{ scope.row.userType == 1 ? "涓汉" : "鍏徃" }}</span>
</template>
</el-table-column>
- <el-table-column prop="authDuration" label="鎺堟潈鏃堕暱">
+ <!-- <el-table-column prop="authDuration" label="鎺堟潈鏃堕暱">
<template slot-scope="scope">
<span>{{ scope.row.authDuration + " 骞�" }} </span>
</template>
- </el-table-column>
+ </el-table-column> -->
<!-- <el-table-column prop="authDuration" label="鎺堟潈鏃堕暱">
</el-table-column> -->
- <el-table-column prop="dataNames" label="鏉冮檺"> </el-table-column>
+ <el-table-column prop="dataNames" label="鍏徃"> </el-table-column>
+ <el-table-column prop="companyName" label="閮ㄩ棬" show-overflow-tooltip></el-table-column>
<el-table-column label="鐘舵��">
<template slot-scope="scope">
@@ -96,9 +78,7 @@
<el-table-column label="鎿嶄綔">
<template slot-scope="scope">
- <span class="iconfont option" @click="editUser(scope.row)"
- >缂栬緫</span
- >
+ <span class="iconfont option" @click="editUser(scope.row)">缂栬緫</span>
</template>
</el-table-column>
</el-table>
@@ -132,6 +112,7 @@
<el-form-item label="鐢ㄦ埛鍚�" prop="username">
<el-input v-model="ruleForm.username" style="width: 350px"></el-input>
</el-form-item>
+ <!-- <el-form-item label="瀵嗙爜" prop="password" v-show="!isEditing"> -->
<el-form-item label="瀵嗙爜" prop="password">
<el-input v-model="ruleForm.password" style="width: 350px"></el-input>
</el-form-item>
@@ -141,48 +122,38 @@
>
</el-form-item> -->
<el-form-item label="鐢ㄦ埛绫诲瀷" prop="userType">
- <el-radio v-model="ruleForm.userType" :label="1">涓汉</el-radio>
- <el-radio v-model="ruleForm.userType" :label="2">鍏徃</el-radio>
+ <el-radio v-model="ruleForm.userType" :label="1">鏈湴</el-radio>
+ <el-radio v-model="ruleForm.userType" :label="2">OA璐︽埛</el-radio>
</el-form-item>
+
<el-form-item label="濮撳悕" prop="trueName">
<el-input v-model="ruleForm.trueName" style="width: 350px"></el-input>
</el-form-item>
- <el-form-item label="閭">
- <el-input v-model="ruleForm.email" style="width: 350px"></el-input>
+
+ <el-form-item label="鎵嬫満鍙�">
+ <el-input v-model="ruleForm.phoneNum" style="width: 350px"></el-input>
</el-form-item>
- <el-form-item label="琛屼笟">
- <el-select
- v-model="ruleForm.industryId"
- placeholder="璇烽�夋嫨琛屼笟"
- style="width: 350px"
- >
- <el-option
- v-for="(item, index) in industrys"
- :label="item.name"
- :value="item.id"
- :key="index"
- ></el-option>
+ <el-form-item label="閮ㄩ棬">
+ <el-input v-model="ruleForm.companyName" style="width: 350px"></el-input>
+ </el-form-item>
+
+ <!-- <el-form-item label="琛屼笟">
+ <el-select v-model="ruleForm.industryId" placeholder="璇烽�夋嫨琛屼笟" style="width: 350px">
+ <el-option v-for="(item, index) in industrys" :label="item.name" :value="item.id" :key="index"></el-option>
</el-select>
</el-form-item>
<el-form-item label="鍦板尯">
- <el-cascader
- v-model="ruleForm.address"
- :props="options"
- style="width: 350px"
- ></el-cascader>
- </el-form-item>
- <el-form-item label="鎺堟潈鏃堕暱">
- <el-select
- v-model="ruleForm.authDuration"
- style="width: 350px"
- placeholder="璇烽�夋嫨鎺堟潈鏃堕暱"
- >
+ <el-cascader v-model="ruleForm.address" :props="options" style="width: 350px"></el-cascader>
+ </el-form-item> -->
+
+ <!-- <el-form-item label="鎺堟潈鏃堕暱">
+ <el-select v-model="ruleForm.authDuration" style="width: 350px" placeholder="璇烽�夋嫨鎺堟潈鏃堕暱">
<el-option label="涓�骞�" :value="1"></el-option>
<el-option label="涓ゅ勾" :value="2"></el-option>
<el-option label="涓夊勾" :value="3"></el-option>
</el-select>
- </el-form-item>
+ </el-form-item> -->
<el-form-item label="鐢ㄦ埛鏉冮檺" prop="menuIds" class="user-tree">
<div class="tree-box">
@@ -210,14 +181,28 @@
:props="defaultProp"
:default-checked-keys="checkedData"
check-on-click-node
+ @check-change="selectDevice"
>
</el-tree>
+ </div>
+ <div class="tree-box">
+ <div class="t">鎽勫儚鏈烘潈闄�</div>
+ <tree-menu
+ ref="ztreeMenus"
+ app="Camera"
+ treeName="localTree"
+ :node="TreeDataPool.treeData"
+ :height="treeHeight"
+ :setting="treeSettings"
+ style="width:330px;max-height:440px"
+ />
</div>
</el-form-item>
</el-form>
<div class="right">
<div class="button searchBtn" @click="saveSubUser">淇濆瓨</div>
<div class="button resetBtn" @click="resetUser">閲嶇疆</div>
+ <div class="button resetBtn" style="margin-left:20px" @click="goback">杩斿洖</div>
</div>
</div>
<div class="sub-account" v-else-if="isShowRelate">
@@ -225,24 +210,24 @@
<span class="iconfont"></span>
<span>鍏宠仈瀛愯处鎴�</span>
</div>
- <Steps
- :titleList="['鍏宠仈瀛愯处鍙蜂俊鎭�', '鏉冮檺璁剧疆', '瀹屾垚']"
- :activeIndex="activeIndex"
- ></Steps>
+ <Steps :titleList="['鍏宠仈瀛愯处鍙蜂俊鎭�', '鏉冮檺璁剧疆', '瀹屾垚']" :activeIndex="activeIndex"></Steps>
<StepsCard @goback="goback" @goto="goto"></StepsCard>
</div>
</template>
<script>
-import { findUserList, saveSubUser, getMenu, getDataTree } from "@/api/user";
-import { getAreas, getDic } from "@/api/login";
+import { findUserList, saveSubUser, getMenu, getDataTree } from "@/api/user"
+import { getAreas, getDic } from "@/api/login"
-import Steps from "./Steps";
-import StepsCard from "./StepCard";
+import Steps from "./Steps"
+import StepsCard from "./StepCard"
+import TreeMenu from "@/components/giantTree/index"
+
export default {
components: {
Steps,
StepsCard,
+ TreeMenu
},
data() {
const validateTree = (rule, value, callback) => {
@@ -252,44 +237,48 @@
this.ruleForm.menuIds.length > 0 &&
this.ruleForm.dataIds.length > 0
) {
- callback();
+ callback()
} else {
- callback(new Error("璇烽�夎彍鍗曟潈闄愬拰鏁版嵁鏉冮檺"));
+ callback(new Error("璇烽�夎彍鍗曟潈闄愬拰鏁版嵁鏉冮檺"))
}
- };
+ }
return {
- searchTime: [
- this.$moment().format("YYYY-MM-DD 00:00:00"),
- this.$moment().format("YYYY-MM-DD HH:mm:ss"),
- ], //鎼滅储鏃堕棿
+ searchTime: [this.$moment().format("YYYY-MM-DD 00:00:00"), this.$moment().format("YYYY-MM-DD HH:mm:ss")], //鎼滅储鏃堕棿
page: 1,
size: 10, //鍒嗛〉鐩稿叧
inputText: "", //杈撳叆妗嗗唴瀹�
activeStep: 0,
activeIndex: 0,
industrys: [],
- total: 0, //鎬绘暟
+ total: 0, //鎬绘暟,
+ treeHeight: 750,
+ treeData: [],
+ treeSettings: {
+ check: {
+ enable: true
+ }
+ },
options: {
lazy: true,
lazyLoad(node, resolve) {
// 鎳掑姞杞借妭鐐圭渷甯傛暟鎹�
- const { level } = node;
- let nodes;
+ const { level } = node
+ let nodes
getAreas({ parentId: level == 0 ? 0 : node.value })
.then((json) => {
- nodes = json.data.list;
+ nodes = json.data.list
nodes = nodes.map((item) => ({
value: item.id,
label: item.name,
level: item.level,
- leaf: level >= 1,
- }));
- resolve(nodes);
+ leaf: level >= 1
+ }))
+ resolve(nodes)
})
.catch((err) => {
- console.log(err);
- });
- },
+ console.log(err)
+ })
+ }
},
dataList: [],
isShowAdd: false, //鏄惁灞曠ず鏂板寮圭獥
@@ -300,16 +289,16 @@
durationArr: [
{
value: 1,
- label: "1骞�",
+ label: "1骞�"
},
{
value: 2,
- label: "2骞�",
+ label: "2骞�"
},
{
value: 3,
- label: "3骞�",
- },
+ label: "3骞�"
+ }
], //鎵�灞為泦缇や笅鎷夋
timeLength: null, //閫変腑鐨勬巿鏉冩椂闀�
showQuit: false, //灞曠ず閫�鍑洪泦缇ょ殑寮圭獥
@@ -323,26 +312,24 @@
userType: "",
password: "",
trueName: "",
- email: "",
+ companyName: "",
+ phoneNum: "",
+ email: "basic",
isChangePwd: false,
industryId: "",
address: [],
- authDuration: 1,
+ authDuration: 3,
areaId: "",
provinceId: "",
menuIds: [],
- dataIds: [],
+ dataIds: []
},
rules: {
- username: [
- { required: true, message: "璇疯緭鍏ョ敤鎴峰悕", trigger: "blur" },
- ],
- password: [{ required: true, message: "璇疯緭鍏ュ瘑鐮�", trigger: "blur" }],
- userType: [
- { required: true, message: "璇烽�夋嫨鐢ㄦ埛绫诲瀷", trigger: "blur" },
- ],
+ username: [{ required: true, message: "璇疯緭鍏ョ敤鎴峰悕", trigger: "blur" }],
+ // password: [{ required: true, message: "璇疯緭鍏ュ瘑鐮�", trigger: "blur" }],
+ userType: [{ required: true, message: "璇烽�夋嫨鐢ㄦ埛绫诲瀷", trigger: "blur" }],
trueName: [{ required: true, message: "璇疯緭鍏ュ鍚�", trigger: "blur" }],
- menuIds: [{ validator: validateTree, trigger: "blur" }],
+ menuIds: [{ validator: validateTree, trigger: "blur" }]
},
sysMenus: [],
DataTree: [],
@@ -350,52 +337,87 @@
curEditId: "",
defaultProp: {
children: "children",
- label: "name",
- },
- };
+ label: "name"
+ }
+ }
},
created() {
- this.userInfo = JSON.parse(sessionStorage.getItem("userInfo"));
- this.findUserList();
- this.getIndustrys();
- this.fetchSysMenus();
- this.fetchDataTree();
+ this.userInfo = JSON.parse(sessionStorage.getItem("userInfo"))
+ this.findUserList()
+ this.getIndustrys()
+ this.fetchSysMenus()
+ this.fetchDataTree()
+ },
+ mounted() {
+ this.TreeDataPool.reset()
+ this.TreeDataPool.multiple = true
},
methods: {
fetchDataTree() {
getDataTree({ userId: this.userInfo.id }).then((res) => {
- this.DataTree = res.data.dataTree;
- });
+ this.DataTree = res.data.dataTree
+ })
},
fetchSysMenus() {
getMenu().then((rsp) => {
if (rsp && rsp.success) {
- this.sysMenus = rsp.data.menus;
+ this.sysMenus = rsp.data.menus
// this.userMenus = [];
}
- });
+ })
+ },
+ selectDevice(node, checked, hasChildren) {
+ if (checked) {
+ sessionStorage.setItem("clusterId", node.id)
+ this.TreeDataPool.fetchTreeData()
+ this.treeData = this.TreeDataPool.treeData
+ } else {
+ this.treeData = []
+ this.TreeDataPool.reset()
+ }
},
addSubCount() {
- this.isShowAdd = true;
- this.resetUser();
+ this.isShowAdd = true
+ this.resetUser()
},
- editUser(row) {
- this.isShowAdd = true;
- this.isEditing = true;
- this.ruleForm.id = row.id;
- this.ruleForm.username = row.username;
- this.ruleForm.userType = row.userType;
- this.ruleForm.password = row.password;
- this.ruleForm.trueName = row.trueName;
- this.ruleForm.email = row.email;
- this.ruleForm.isChangePwd = row.isChangePwd;
- this.ruleForm.industryId = row.industryId;
- this.ruleForm.areaId = row.areaId;
- this.ruleForm.address = [row.provinceId, row.areaId];
- this.ruleForm.provinceId = row.provinceId;
- this.ruleForm.authDuration = row.authDuration;
- this.checkedMenu = row.menuIds;
- this.checkedData = row.dataIds;
+ async editUser(row) {
+ this.isShowAdd = true
+ this.isEditing = true
+ this.ruleForm.id = row.id
+ this.ruleForm.username = row.username
+ this.ruleForm.userType = row.userType
+ this.ruleForm.password = row.password
+ this.ruleForm.trueName = row.trueName
+ this.ruleForm.companyName = row.companyName
+ this.ruleForm.phoneNum = row.phoneNum
+ this.ruleForm.email = row.email
+ this.ruleForm.isChangePwd = row.isChangePwd
+ this.ruleForm.industryId = row.industryId
+ this.ruleForm.areaId = row.areaId
+ this.ruleForm.address = [row.provinceId, row.areaId]
+ this.ruleForm.provinceId = row.provinceId
+ this.ruleForm.authDuration = row.authDuration
+ this.checkedMenu = row.menuIds
+ this.checkedData = row.dataIds
+
+ // 鏌ヨ褰撳墠鐢ㄦ埛鏉冮檺涓嬫墍鏈夊彲绠$悊鐨勬憚鍍忔満
+ if (row.dataIds) {
+ sessionStorage.setItem("clusterId", row.dataIds[0])
+ await this.TreeDataPool.fetchTreeData()
+ }
+ // 鐢╡mail瀛楁鏆傛椂浠f浛鎽勫儚鏈洪泦鍚堝瓧娈�
+ let checkedCameras = row.email
+
+ // basic 涓哄瓙璐︽埛榛樿鐨勭┖瀛楁,琛ㄧず鍙鐞嗙殑鎽勫儚鏈虹洰褰曚负绌�
+ if (checkedCameras == "basic") {
+ return
+ }
+
+ // 鍙嶉�夋憚鍍忔満
+ if (checkedCameras.length) {
+ let cameraIds = checkedCameras.split(",")
+ this.$refs.ztreeMenus.updateNodes(cameraIds)
+ }
},
resetUser() {
this.ruleForm = {
@@ -404,30 +426,33 @@
userType: "",
password: "",
trueName: "",
+ companyName: "",
+ phoneNum: "",
email: "",
isChangePwd: false,
address: [],
industryId: "",
areaId: "",
provinceId: "",
- authDuration: 1,
- };
+ authDuration: 1
+ }
this.$nextTick(() => {
- this.$refs.treeMenus.setCheckedKeys([]);
- this.$refs.treeData.setCheckedKeys([]);
- });
+ this.$refs.treeMenus.setCheckedKeys([])
+ this.$refs.treeData.setCheckedKeys([])
+ })
},
async getIndustrys() {
- let res = await getDic();
+ let res = await getDic()
if (res.success) {
- this.industrys = res.data.dics;
+ this.industrys = res.data.dics
} else {
- console.log("鏌ヨ琛屼笟鍒楄〃澶辫触锛�");
+ console.log("鏌ヨ琛屼笟鍒楄〃澶辫触锛�")
}
},
saveSubUser() {
- this.ruleForm.menuIds = this.$refs.treeMenus.getCheckedKeys();
- this.ruleForm.dataIds = this.$refs.treeData.getCheckedKeys();
+ let _this = this
+ this.ruleForm.menuIds = this.$refs.treeMenus.getCheckedKeys()
+ this.ruleForm.dataIds = this.$refs.treeData.getCheckedKeys()
this.$refs["ruleForm"].validate((valid) => {
if (valid) {
let json = {
@@ -437,73 +462,87 @@
isChangePwd: this.ruleForm.isChangePwd,
userType: this.ruleForm.userType,
trueName: this.ruleForm.trueName,
- email: this.ruleForm.email,
+ companyName: this.ruleForm.companyName,
+ phoneNum: this.ruleForm.phoneNum,
industryId: this.ruleForm.industryId,
- areaId:
- this.ruleForm.address.length == 2 ? this.ruleForm.address[1] : "",
+ areaId: this.ruleForm.address.length == 2 ? this.ruleForm.address[1] : "",
authDuration: this.ruleForm.authDuration,
menuIds: this.ruleForm.menuIds,
- dataIds: this.ruleForm.dataIds,
- };
+ dataIds: this.ruleForm.dataIds
+ }
+
+ // 鑾峰彇瀛愯处鎴烽�変腑鐨勬憚鍍忔満鍒楄〃
+ let cameraIds = this.TreeDataPool.selectedNodes
+ if (cameraIds.length == 0) {
+ json.email = "basic"
+ } else {
+ json.email = cameraIds.join(",")
+ }
+
+ // 缂栬緫涓嶆彁浜ゅ瘑鐮�
+ if (this.isEditing) {
+ // delete json.password
+ }
if (typeof json.areaId === "string") {
- delete json.areaId;
+ delete json.areaId
}
if (typeof json.authDuration === "string") {
- delete json.authDuration;
+ delete json.authDuration
}
+ // return
saveSubUser(json)
.then((res) => {
if (res.success) {
- this.$notify.success(res.data);
- this.isShowAdd = false;
- this.isEditing = false;
- this.findUserList();
+ this.$notify.success(res.data)
+ this.isShowAdd = false
+ this.isEditing = false
+ this.findUserList()
} else {
- this.$notify.error(res.msg);
+ this.$notify.error(res.msg)
}
})
.catch((err) => {
- this.$notify.error(err.data.msg);
- });
+ this.$notify.error(err.data.msg)
+ })
} else {
- return false;
+ return false
}
- });
+ })
},
findUserList() {
findUserList({
inputText: this.inputText,
page: this.page,
size: this.size,
- authDuration: this.timeLength,
+ authDuration: this.timeLength
})
.then((res) => {
if (res.success) {
- this.dataList = res.data.dataList;
- this.total = res.data.total;
+ this.dataList = res.data.dataList
+ this.total = res.data.total
} else {
- this.$notify.error("鍔犺浇瀛愯处鎴峰垪琛ㄥけ璐�");
+ this.$notify.error("鍔犺浇瀛愯处鎴峰垪琛ㄥけ璐�")
}
})
.catch((e) => {
- this.$notify.error(e.msg);
- });
+ this.$notify.error(e.msg)
+ })
},
goback() {
- this.isShowAdd = false;
- this.isEditing = false;
- this.isShowRelate = false;
- this.activeIndex = 0;
+ this.isShowAdd = false
+ this.isEditing = false
+ this.isShowRelate = false
+ this.activeIndex = 0
},
goto(i) {
- this.activeIndex = i;
+ this.activeIndex = i
},
reset() {
- this.inputText = "";
- this.timeLength = null;
+ this.inputText = ""
+ this.timeLength = null
},
// 璺冲埌璁惧璇︽儏
checkDetail(row) {
@@ -513,9 +552,9 @@
id: row.devId,
ip: row.devIp,
port: row.serverPort,
- ndid: row.id,
- },
- });
+ ndid: row.id
+ }
+ })
},
// 璺冲埌绠楁硶璇︽儏
@@ -525,9 +564,9 @@
query: {
id: row.devId,
ip: row.devIp,
- port: row.serverPort,
- },
- });
+ port: row.serverPort
+ }
+ })
},
// 鏌ヨ鍒楄〃
@@ -535,68 +574,65 @@
save() {},
//鍒嗛〉鍔熻兘
handleSizeChange(size) {
- this.size = size;
- this.findUserList();
+ this.size = size
+ this.findUserList()
},
//鍒嗛〉鍔熻兘
refrash(page) {
- this.page = page;
- this.findUserList();
+ this.page = page
+ this.findUserList()
},
//瑙g粦鎸夐挳
Untying(row) {
- console.log(row);
- this.unbindId = row.id;
- this.isShowUnbind = true;
+ console.log(row)
+ this.unbindId = row.id
+ this.isShowUnbind = true
},
//鑾峰緱榛樿鏃堕棿
getDateInit() {
// 瑕佹眰 榛樿涓�涓湀
- const end = new Date();
- const start = new Date();
- const nowDate = new Date();
- nowDate.setHours(0);
- nowDate.setMinutes(0);
- nowDate.setSeconds(0);
- nowDate.setMilliseconds(0);
- start.setTime(nowDate.getTime() - 3600 * 1000 * 24 * 30);
- end.setTime(nowDate.getTime() + 3600 * 1000 * 24 - 1);
- return [
- this.$moment(start).format("YYYY-MM-DD HH:mm:ss"),
- this.$moment(end).format("YYYY-MM-DD HH:mm:ss"),
- ];
+ const end = new Date()
+ const start = new Date()
+ const nowDate = new Date()
+ nowDate.setHours(0)
+ nowDate.setMinutes(0)
+ nowDate.setSeconds(0)
+ nowDate.setMilliseconds(0)
+ start.setTime(nowDate.getTime() - 3600 * 1000 * 24 * 30)
+ end.setTime(nowDate.getTime() + 3600 * 1000 * 24 - 1)
+ return [this.$moment(start).format("YYYY-MM-DD HH:mm:ss"), this.$moment(end).format("YYYY-MM-DD HH:mm:ss")]
},
// 鍏抽棴瑙g粦寮圭獥
closeUnbindBox() {
- this.isShowUnbind = false;
+ this.isShowUnbind = false
},
//瑙g粦鎴愬姛鍥炶皟
reflash() {
- this.isShowUnbind = false;
+ this.isShowUnbind = false
},
clearSearch() {
- this.searchTime = this.getDateInit();
- this.inputText = "";
+ this.searchTime = this.getDateInit()
+ this.inputText = ""
},
//閫�鍑洪泦缇�
quitCluster(equipment) {
- this.activeEquipment = equipment;
- this.showQuit = true;
+ this.activeEquipment = equipment
+ this.showQuit = true
},
//鍔犲叆闆嗙兢
joinCluster(equipment) {
- this.activeEquipment = equipment;
- this.showJoin = true;
- },
- },
-};
+ this.activeEquipment = equipment
+ this.showJoin = true
+ }
+ }
+}
</script>
<style scoped lang="scss">
@@ -885,7 +921,7 @@
}
</style>
-<style >
+<style>
.el-date-table td.start-date span,
.el-date-table td.end-date span {
background-color: #0065ff;
diff --git a/src/views/search/components/giantTree/index.vue b/src/views/search/components/giantTree/index.vue
index faf2f4c..de20cb0 100644
--- a/src/views/search/components/giantTree/index.vue
+++ b/src/views/search/components/giantTree/index.vue
@@ -20,29 +20,14 @@
@onShowPic="showCameraPic"
/>
<div class="dialog-box-bg" v-show="showDialog" @click="hideDialogBox"></div>
- <div
- class="dialog-box"
- v-show="showDialog"
- :style="{ left: clientX + 'px', top: clientY + 'px' }"
- >
+ <div class="dialog-box" v-show="showDialog" :style="{ left: clientX + 'px', top: clientY + 'px' }">
<el-card :body-style="{ padding: '10px' }">
- <el-form
- :model="dialogForm"
- size="mini"
- :rules="rules"
- ref="dialogForm"
- label-width="70px"
- >
+ <el-form :model="dialogForm" size="mini" :rules="rules" ref="dialogForm" label-width="10px">
<el-form-item label="鍚嶇О锛�" prop="name">
- <el-input
- v-model="dialogForm.text"
- oninput="if(value.length>10)value=value.slice(0,10)"
- ></el-input>
+ <el-input v-model="dialogForm.text" oninput="if(value.length>20)value=value.slice(0,20)"></el-input>
</el-form-item>
<div class="text-center pb-2">
- <el-button size="mini" type="primary" @click="submitForm"
- >淇濆瓨</el-button
- >
+ <el-button size="mini" type="primary" @click="submitForm">淇濆瓨</el-button>
<el-button size="mini" @click="hideDialogBox">鍙栨秷</el-button>
</div>
</el-form>
@@ -52,40 +37,40 @@
</template>
<script>
-import ZTree from "./zTree/ztree";
+import ZTree from "./zTree/ztree"
export default {
name: "GiantTreeMenu",
components: {
- ZTree,
+ ZTree
},
props: {
app: {
type: String,
- default: "Video",
+ default: "Video"
},
node: {
- type: Array,
+ type: Array
},
treeName: {
type: String,
- default: "",
+ default: ""
},
gb28181: {
type: Boolean,
- default: false,
+ default: false
},
height: {
type: Number,
- default: 0,
+ default: 0
},
setting: {
type: Object,
require: false,
- default: function () {
- return {};
- },
- },
+ default: function() {
+ return {}
+ }
+ }
},
data() {
return {
@@ -93,154 +78,128 @@
clientX: 0,
clientY: 0,
dialogForm: {
- text: "",
+ text: ""
},
rules: {
text: [
{ required: true, message: "璇疯緭鍏ヨ妭鐐瑰悕绉�", trigger: "change" },
- { min: 2, max: 10, message: "闀垮害鍦�2鍒�10涓瓧", trigger: "change" },
- ],
+ { min: 2, max: 10, message: "闀垮害鍦�2鍒�10涓瓧", trigger: "change" }
+ ]
},
- curNodeTid: "",
- };
+ curNodeTid: ""
+ }
},
created() {
- this.TreeDataPool.zTree = true;
+ this.TreeDataPool.zTree = true
this.TreeDataPool.activeVideoIndex = sessionStorage.activeIndexVideo
? Number(sessionStorage.activeIndexVideo)
- : this.TreeDataPool.activeVideoIndex;
+ : this.TreeDataPool.activeVideoIndex
},
watch: {
- "TreeDataPool.treeType": function (newValue) {
+ "TreeDataPool.treeType": function(newValue) {
if (newValue !== this.treeName) {
- this.TreeDataPool.cleanTree(this.treeName);
+ this.TreeDataPool.cleanTree(this.treeName)
}
- },
+ }
},
methods: {
- handleCreated: function (ztreeObj) {
- let _this = this;
- this.ztreeObj = ztreeObj;
- ztreeObj.expandAll(true);
+ handleCreated: function(ztreeObj) {
+ let _this = this
+ this.ztreeObj = ztreeObj
+ ztreeObj.expandAll(true)
// onCreated 涓搷浣渮treeObj瀵硅薄灞曞紑绗竴涓妭鐐�
// ztreeObj.expandNode(ztreeObj.getNodes()[0], true);
// 鎽勫儚鏈洪厤缃垏鎹㈡椂, 璁剧疆閫変腑鐘舵��
if (this.TreeDataPool.selectedNode.id) {
// 鍙栨秷鎵�鏈夊閫夌殑鑺傜偣,浠呬繚鐣欏綋鍓嶅崟閫夌殑鑺傜偣
- this.TreeDataPool.selectedNodes = [this.TreeDataPool.selectedNode.id];
- this.curNodeTid = this.TreeDataPool.selectedNode.tId;
+ this.TreeDataPool.selectedNodes = [this.TreeDataPool.selectedNode.id]
+ this.curNodeTid = this.TreeDataPool.selectedNode.tId
//鎽勫儚鏈轰俊鎭洿鏂颁俊鎭悗锛屽鏋滆妭鐐逛綅缃湁鍙榯Id灏变笉鍑嗕簡,this.TreeDataPool.selectedNode姝ゆ椂杩樻槸鏃х殑淇℃伅
- let ztreeNodes = ztreeObj.getNodes();
+ let ztreeNodes = ztreeObj.getNodes()
//var curNodeTid = '';
- _this.findTidByIdFromArr(ztreeNodes);
- this.TreeDataPool.selectedNode.tId = _this.curNodeTid;
- let node = this.ztreeObj.getNodeByTId(
- this.TreeDataPool.selectedNode.tId
- );
+ _this.findTidByIdFromArr(ztreeNodes)
+ this.TreeDataPool.selectedNode.tId = _this.curNodeTid
+ let node = this.ztreeObj.getNodeByTId(this.TreeDataPool.selectedNode.tId)
// 澶氶�夋椂, 閫変腑鍗曢�夊崟鍑荤殑鑺傜偣
if (this.TreeDataPool.multiple) {
- this.ztreeObj.checkAllNodes(false);
- this.ztreeObj.checkNode(node, true, false, false);
+ this.ztreeObj.checkAllNodes(false)
+ this.ztreeObj.checkNode(node, true, false, false)
}
- this.ztreeObj.selectNode(node, false, true);
+ this.ztreeObj.selectNode(node, false, true)
}
},
findTidByIdFromArr(arr) {
- let len = arr.length;
- let _this = this;
+ let len = arr.length
+ let _this = this
for (var i = 0; i < len; i++) {
if (arr[i].id == this.TreeDataPool.selectedNode.id) {
- _this.curNodeTid = arr[i].tId;
- break;
+ _this.curNodeTid = arr[i].tId
+ break
}
if (arr[i].children) {
- this.findTidByIdFromArr(arr[i].children);
+ this.findTidByIdFromArr(arr[i].children)
}
}
},
onDblClick(evt, treeId, item) {
if (item.type !== "4" || this.app !== "Camera") {
- return;
+ return
}
- this.TreeDataPool.activeVideoId = item.id;
- let videoArr = this.TreeDataPool.videoArr;
- let nullVideoIndex = "";
+ this.TreeDataPool.activeVideoId = item.id
+ let videoArr = this.TreeDataPool.videoArr
+ let nullVideoIndex = ""
if (
this.TreeDataPool.activeForceChoose &&
this.TreeDataPool.activeVideoIndex !== "" &&
this.TreeDataPool.activeVideoIndex <= videoArr.length - 1
) {
- this.TreeDataPool.setVideoArr(
- this.TreeDataPool.activeVideoIndex,
- undefined,
- this
- );
+ this.TreeDataPool.setVideoArr(this.TreeDataPool.activeVideoIndex, undefined, this)
this.$nextTick(() => {
- this.TreeDataPool.setVideoArr(
- this.TreeDataPool.activeVideoIndex,
- item,
- this
- );
- });
- return;
+ this.TreeDataPool.setVideoArr(this.TreeDataPool.activeVideoIndex, item, this)
+ })
+ return
}
for (let i = 0; i < videoArr.length; i++) {
// eslint-disable-next-line
- if (
- videoArr[i] === "" ||
- videoArr[i] === undefined ||
- videoArr[i] === null
- ) {
- nullVideoIndex = i;
- break;
+ if (videoArr[i] === "" || videoArr[i] === undefined || videoArr[i] === null) {
+ nullVideoIndex = i
+ break
} else {
- nullVideoIndex = "";
+ nullVideoIndex = ""
}
}
if (nullVideoIndex === "") {
- this.TreeDataPool.setVideoArr(
- this.TreeDataPool.activeVideoIndex,
- undefined,
- this
- );
+ this.TreeDataPool.setVideoArr(this.TreeDataPool.activeVideoIndex, undefined, this)
this.$nextTick(() => {
- this.TreeDataPool.setVideoArr(
- this.TreeDataPool.activeVideoIndex,
- item,
- this
- );
- });
+ this.TreeDataPool.setVideoArr(this.TreeDataPool.activeVideoIndex, item, this)
+ })
} else {
// this.TreeDataPool.setVideoArr(this.TreeDataPool.activeVideoIndex, undefined, this);
this.$nextTick(() => {
- this.TreeDataPool.setVideoArr(
- this.TreeDataPool.activeVideoIndex,
- item,
- this
- );
- });
- this.TreeDataPool.activeVideoIndex = nullVideoIndex;
+ this.TreeDataPool.setVideoArr(this.TreeDataPool.activeVideoIndex, item, this)
+ })
+ this.TreeDataPool.activeVideoIndex = nullVideoIndex
}
},
addCamera(node) {
- this.$emit("addDevice", node);
+ this.$emit("addDevice", node)
},
importCameras(node) {
- this.$emit("import", node);
+ this.$emit("import", node)
},
addNode(node) {
this.dialogForm = {
text: "",
method: "add",
- node: node.id,
- };
- this.showDialogBox(event);
+ node: node.id
+ }
+ this.showDialogBox(event)
},
editNode(node) {
this.dialogForm = {
@@ -248,56 +207,56 @@
method: "edit",
node: node.id,
alias: node.alias,
- gb28181: this.gb28181,
- };
- this.showDialogBox(event);
+ gb28181: this.gb28181
+ }
+ this.showDialogBox(event)
},
delNode(node) {
- this.TreeDataPool.del(node.id);
+ this.TreeDataPool.del(node.id)
},
submitForm() {
// 鎻愪氦鏂板鎴栬�呯紪杈戝尯鍩熻妭鐐硅〃鍗�
this.$refs.dialogForm.validate((valid) => {
if (valid) {
if (this.dialogForm.method == "add") {
- this.TreeDataPool.add(this.dialogForm.text, this.dialogForm.node);
+ this.TreeDataPool.add(this.dialogForm.text, this.dialogForm.node)
} else if (this.dialogForm.method == "edit") {
this.TreeDataPool.update(
this.dialogForm.text,
this.dialogForm.node,
this.gb28181 ? this.dialogForm.text : "",
this.dialogForm.gb28181
- );
+ )
}
} else {
- return false;
+ return false
}
- });
- this.hideDialogBox();
+ })
+ this.hideDialogBox()
},
hideDialogBox() {
- this.showDialog = false;
- this.dialogForm = { text: "" };
+ this.showDialog = false
+ this.dialogForm = { text: "" }
},
showDialogBox(event) {
- let { offsetY = 0 } = event;
+ let { offsetY = 0 } = event
// this.clientX = clientX - 120;
- this.clientX = 50;
- this.clientY = offsetY;
- this.showDialog = true;
+ this.clientX = 50
+ this.clientY = offsetY
+ this.showDialog = true
},
itemClick(evt, treeId, treeNode) {
- this.TreeDataPool.selectedNode = treeNode;
- this.TreeDataPool.treeType = this.treeName;
+ this.TreeDataPool.selectedNode = treeNode
+ this.TreeDataPool.treeType = this.treeName
// 澶氶��
if (this.TreeDataPool.multiple) {
// 鍗曞嚮鏌愪竴涓妭鐐规枃瀛楁椂 鍙栨秷鎵�鏈夊嬀閫夌姸鎬� 鐒跺悗閫変腑鑷韩
- this.ztreeObj.checkAllNodes(false);
- this.ztreeObj.checkNode(treeNode, true, false, false);
+ this.ztreeObj.checkAllNodes(false)
+ this.ztreeObj.checkNode(treeNode, true, false, false)
}
- this.TreeDataPool.updateZTreeCheckNodes([treeNode]);
+ this.TreeDataPool.updateZTreeCheckNodes([treeNode])
},
// itemClick(treeNode) {
// this.TreeDataPool.selectedNode = treeNode;
@@ -313,36 +272,36 @@
// this.TreeDataPool.updateZTreeCheckNodes([treeNode]);
// },
itemCheck(evt, treeId, treeNode) {
- this.TreeDataPool.selectedNode = treeNode;
- this.TreeDataPool.treeType = this.treeName;
+ this.TreeDataPool.selectedNode = treeNode
+ this.TreeDataPool.treeType = this.treeName
// 澶氶��
// this.ztreeObj.checkNode(treeNode, true, false, false);
- let checkedNodes = this.ztreeObj.getCheckedNodes(true);
- this.TreeDataPool.updateZTreeCheckNodes(checkedNodes);
+ let checkedNodes = this.ztreeObj.getCheckedNodes(true)
+ this.TreeDataPool.updateZTreeCheckNodes(checkedNodes)
// 瀹炴椂缁熻閫変腑涓暟
- this.TreeDataPool.countCheckedNodes(checkedNodes);
+ this.TreeDataPool.countCheckedNodes(checkedNodes)
// 淇濆瓨涓�浠芥暟鎹�
- this.TreeDataPool.activeTreeData = this.ztreeObj.getNodes();
+ this.TreeDataPool.activeTreeData = this.ztreeObj.getNodes()
},
//灞曞紑
itemExpand(e, id, node) {
- delete this.TreeDataPool.foldNodeList[node.id];
+ delete this.TreeDataPool.foldNodeList[node.id]
},
// 鎶樺彔
itemCollapse(e, id, node) {
- this.TreeDataPool.foldNodeList[node.id] = true;
+ this.TreeDataPool.foldNodeList[node.id] = true
},
dropNode(node, item, draggedItem) {
// console.log('dropNode', node, item, draggedItem);
- this.TreeDataPool.dropNode(draggedItem.id, item.id);
+ this.TreeDataPool.dropNode(draggedItem.id, item.id)
},
showCameraPic(nodeId) {
- this.TreeDataPool.showBaseImage(nodeId);
- },
- },
-};
+ this.TreeDataPool.showBaseImage(nodeId)
+ }
+ }
+}
</script>
<style lang="scss" scoped>
.dialog-box {
--
Gitblit v1.8.0