| | |
| | | } |
| | | |
| | | 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) => { |
| | |
| | | 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 |
| | | } |
| | |
| | | <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" |
| | |
| | | @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" |
| | |
| | | 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> |
| | |
| | | </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> |
| | |
| | | </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> |
| | |
| | | <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> |
| | |
| | | <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> |
| | |
| | | </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"> |
| | |
| | | <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> |
| | |
| | | </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" |
| | |
| | | :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="搜索" |
| | |
| | | </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 |
| | |
| | | :height="height" |
| | | @addDevice="addCamera" |
| | | @import="importCameras" |
| | | style="width:400px" |
| | | /> |
| | | </div> |
| | | </div> |
| | |
| | | <!-- 本地视频源列表 --> |
| | | <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> |
| | |
| | | <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> |
| | | |
| | |
| | | </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 { |
| | |
| | | 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, |
| | |
| | | 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("当前激活name:", 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]) |
| | | //若当前sheet没有数据,则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个xls文件"); |
| | | this.$message.error("最多只能上传1个xls文件") |
| | | }, |
| | | //删除文件 |
| | | remove() {}, |
| | |
| | | run_type: -1, |
| | | username: "", |
| | | password: "", |
| | | sensors: [], |
| | | }; |
| | | }, |
| | | }, |
| | | }; |
| | | sensors: [] |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | |
| | | .flex-box { |
| | | display: flex; |
| | | } |
| | | </style> |
| | | </style> |
| | |
| | | <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> |
| | | |
| | | <!-- 左侧 --> |
| | |
| | | <div class="content"><span class="iconfont"></span> 已实名认证</div> |
| | | </li> |
| | | |
| | | <li> |
| | | <li v-show="false"> |
| | | <div class="label" @click="jump(0)">订单管理</div> |
| | | </li> |
| | | |
| | |
| | | <div class="label">未读消息</div> |
| | | </li> --> |
| | | |
| | | <li> |
| | | <li v-show="false"> |
| | | <div class="label" @click="jump(0, 1)">未支付订单</div> |
| | | </li> |
| | | |
| | |
| | | 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; |
| | |
| | | } |
| | | |
| | | ul { |
| | | height: 200px; |
| | | // height: 200px; |
| | | border-top: 1px solid #e9ebee; |
| | | border-bottom: 1px solid #e9ebee; |
| | | |
| | |
| | | } |
| | | |
| | | .logOut { |
| | | margin-top: 20px; |
| | | font-size: 16px; |
| | | // margin-top: 20px; |
| | | line-height: 40px; |
| | | font-size: 14px; |
| | | color: #3d3d3d; |
| | | cursor: pointer; |
| | | |
| | |
| | | <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> |
| | |
| | | this.showDialog = true |
| | | }, |
| | | itemClick(evt, treeId, treeNode) { |
| | | console.log("click") |
| | | this.TreeDataPool.selectedNode = treeNode |
| | | this.TreeDataPool.activeNode = treeNode |
| | | this.TreeDataPool.treeType = this.treeName |
| | |
| | | }, |
| | | 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) |
| | | } |
| | | } |
| | | } |
| | |
| | | top: 415px; |
| | | left: 43px; |
| | | position: fixed; |
| | | width: 220px; |
| | | width: 260px; |
| | | z-index: 3; |
| | | } |
| | | .dialog-box-bg { |
| | |
| | | cluster: "", |
| | | clusterData: [], |
| | | intervalTimer: null, |
| | | leftWith: 0, |
| | | screenHeight: 0 |
| | | } |
| | | }, |
| | |
| | | }, |
| | | methods: { |
| | | TextWidthChange(e) { |
| | | console.log(1212) |
| | | let odivParent = e.currentTarget.parentNode //获取目标父元素 |
| | | let dx = e.clientX //当你第一次单击的时候,存储x轴的坐标。 |
| | | let dw = odivParent.offsetWidth //存储默认的div的宽度。 |
| | |
| | | odivParent.style.width = this.pdfWidth - odivParent.offsetLeft + "px" |
| | | } |
| | | } |
| | | |
| | | document.onmouseup = (e) => { |
| | | document.onmousemove = null |
| | | document.onmouseup = null |
| | |
| | | if (this.warningChecked == 0 || this.warningTotal == 0) { |
| | | return 0 |
| | | } |
| | | return parseInt(this.warningChecked / this.warningTotal) * 100 + "%" |
| | | return parseInt((this.warningChecked / this.warningTotal) * 100) + "%" |
| | | } |
| | | }, |
| | | data() { |
| | |
| | | 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() { |
| | |
| | | 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) { |
| | |
| | | let orgNodeIds = [] |
| | | |
| | | if (this.selectedOrg == "") { |
| | | return orgNodeIds |
| | | return this.authorizedCameras |
| | | } |
| | | |
| | | function findNode(node) { |
| | |
| | | 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 }) |
| | |
| | | <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"> |
| | |
| | | width: 1036px; |
| | | } |
| | | } |
| | | </style> |
| | | </style> |
| | |
| | | <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>
|
| | |
| | | <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">
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | </style> |
| | | </style>
|
| | |
| | | |
| | | <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> |
| | |
| | | :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"> |
| | |
| | | |
| | | <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> |
| | |
| | | <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> |
| | |
| | | > |
| | | </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"> |
| | |
| | | :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"> |
| | |
| | | <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) => { |
| | |
| | | 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, //是否展示新增弹窗 |
| | |
| | | durationArr: [ |
| | | { |
| | | value: 1, |
| | | label: "1年", |
| | | label: "1年" |
| | | }, |
| | | { |
| | | value: 2, |
| | | label: "2年", |
| | | label: "2年" |
| | | }, |
| | | { |
| | | value: 3, |
| | | label: "3年", |
| | | }, |
| | | label: "3年" |
| | | } |
| | | ], //所属集群下拉框 |
| | | timeLength: null, //选中的授权时长 |
| | | showQuit: false, //展示退出集群的弹窗 |
| | |
| | | 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: [], |
| | |
| | | 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() |
| | | } |
| | | // 用email字段暂时代替摄像机集合字段 |
| | | let checkedCameras = row.email |
| | | |
| | | // basic 为子账户默认的空字段,表示可管理的摄像机目录为空 |
| | | if (checkedCameras == "basic") { |
| | | return |
| | | } |
| | | |
| | | // 反选摄像机 |
| | | if (checkedCameras.length) { |
| | | let cameraIds = checkedCameras.split(",") |
| | | this.$refs.ztreeMenus.updateNodes(cameraIds) |
| | | } |
| | | }, |
| | | resetUser() { |
| | | this.ruleForm = { |
| | |
| | | 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 = { |
| | |
| | | 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) { |
| | |
| | | id: row.devId, |
| | | ip: row.devIp, |
| | | port: row.serverPort, |
| | | ndid: row.id, |
| | | }, |
| | | }); |
| | | ndid: row.id |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | // 跳到算法详情 |
| | |
| | | query: { |
| | | id: row.devId, |
| | | ip: row.devIp, |
| | | port: row.serverPort, |
| | | }, |
| | | }); |
| | | port: row.serverPort |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | // 查询列表 |
| | |
| | | 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() |
| | | }, |
| | | |
| | | //解绑按钮 |
| | | 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")] |
| | | }, |
| | | |
| | | // 关闭解绑弹窗 |
| | | closeUnbindBox() { |
| | | this.isShowUnbind = false; |
| | | this.isShowUnbind = false |
| | | }, |
| | | |
| | | //解绑成功回调 |
| | | 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"> |
| | |
| | | } |
| | | </style> |
| | | |
| | | <style > |
| | | <style> |
| | | .el-date-table td.start-date span, |
| | | .el-date-table td.end-date span { |
| | | background-color: #0065ff; |
| | |
| | | @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> |
| | |
| | | </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 { |
| | |
| | | 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 中操作ztreeObj对象展开第一个节点 |
| | | // 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 |
| | | //摄像机信息更新信息后,如果节点位置有变tId就不准了,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 = { |
| | |
| | | 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; |
| | |
| | | // 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 { |