From 05d754bb09ba4aeddd60320d33d583d388434c2f Mon Sep 17 00:00:00 2001
From: ZZJ <zzjdsg2300@163.com>
Date: 星期一, 20 十二月 2021 15:38:45 +0800
Subject: [PATCH] 树形组件修改
---
src/pages/gb28181/index/App.vue | 1143 ++++++++++++++++++++++++++++-------------------------
src/components/giantTree/index.vue | 91 ++-
2 files changed, 657 insertions(+), 577 deletions(-)
diff --git a/src/components/giantTree/index.vue b/src/components/giantTree/index.vue
index d0a15dc..787f7a2 100644
--- a/src/components/giantTree/index.vue
+++ b/src/components/giantTree/index.vue
@@ -26,12 +26,20 @@
: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="70px"
+ >
<el-form-item label="鍚嶇О锛�" prop="name">
<el-input v-model="dialogForm.text"></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>
@@ -42,32 +50,32 @@
<script>
// import VJstree from "./jsTree";
-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,
@@ -75,6 +83,10 @@
default: function () {
return {};
},
+ },
+ clickType: {
+ type: String,
+ default: "",
},
},
data() {
@@ -84,15 +96,15 @@
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() {
@@ -108,7 +120,7 @@
if (newValue !== this.treeName) {
this.TreeDataPool.cleanTree(this.treeName);
}
- }
+ },
},
methods: {
handleCreated: function (ztreeObj) {
@@ -121,14 +133,16 @@
// 鎽勫儚鏈洪厤缃垏鎹㈡椂, 璁剧疆閫変腑鐘舵��
if (this.TreeDataPool.selectedNode.id) {
// 鍙栨秷鎵�鏈夊閫夌殑鑺傜偣,浠呬繚鐣欏綋鍓嶅崟閫夌殑鑺傜偣
- this.TreeDataPool.selectedNodes = [this.TreeDataPool.selectedNode.id]
+ this.TreeDataPool.selectedNodes = [this.TreeDataPool.selectedNode.id];
this.curNodeTid = this.TreeDataPool.selectedNode.tId;
//鎽勫儚鏈轰俊鎭洿鏂颁俊鎭悗锛屽鏋滆妭鐐逛綅缃湁鍙榯Id灏变笉鍑嗕簡,this.TreeDataPool.selectedNode姝ゆ椂杩樻槸鏃х殑淇℃伅
let ztreeNodes = ztreeObj.getNodes();
//var curNodeTid = '';
_this.findTidByIdFromArr(ztreeNodes);
this.TreeDataPool.selectedNode.tId = _this.curNodeTid;
- let node = this.ztreeObj.getNodeByTId(this.TreeDataPool.selectedNode.tId)
+ let node = this.ztreeObj.getNodeByTId(
+ this.TreeDataPool.selectedNode.tId
+ );
// 澶氶�夋椂, 閫変腑鍗曢�夊崟鍑荤殑鑺傜偣
if (this.TreeDataPool.multiple) {
@@ -136,7 +150,7 @@
this.ztreeObj.checkNode(node, true, false, false);
}
- this.ztreeObj.selectNode(node, false, true)
+ this.ztreeObj.selectNode(node, false, true);
}
},
@@ -152,7 +166,6 @@
this.findTidByIdFromArr(arr[i].children);
}
}
-
},
onDblClick(evt, treeId, item) {
if (item.type !== "4" || this.app !== "Camera") {
@@ -168,14 +181,18 @@
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;
}
@@ -193,14 +210,18 @@
}
}
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
);
- })
+ });
} else {
// this.TreeDataPool.setVideoArr(this.TreeDataPool.activeVideoIndex, undefined, this);
this.$nextTick(() => {
@@ -209,7 +230,7 @@
item,
this
);
- })
+ });
this.TreeDataPool.activeVideoIndex = nullVideoIndex;
}
},
@@ -223,7 +244,7 @@
this.dialogForm = {
text: "",
method: "add",
- node: node.id
+ node: node.id,
};
this.showDialogBox(event);
},
@@ -233,7 +254,7 @@
method: "edit",
node: node.id,
alias: node.alias,
- gb28181: this.gb28181
+ gb28181: this.gb28181,
};
this.showDialogBox(event);
},
@@ -242,7 +263,7 @@
},
submitForm() {
// 鎻愪氦鏂板鎴栬�呯紪杈戝尯鍩熻妭鐐硅〃鍗�
- this.$refs.dialogForm.validate(valid => {
+ this.$refs.dialogForm.validate((valid) => {
if (valid) {
if (this.dialogForm.method == "add") {
this.TreeDataPool.add(this.dialogForm.text, this.dialogForm.node);
@@ -272,6 +293,10 @@
this.showDialog = true;
},
itemClick(evt, treeId, treeNode) {
+ if (this.clickType == "multiple") {
+ evt.target.parentNode.parentNode.querySelector(".chk").click();
+ return;
+ }
this.TreeDataPool.selectedNode = treeNode;
this.TreeDataPool.treeType = this.treeName;
@@ -311,24 +336,24 @@
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, e) {
// 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>
diff --git a/src/pages/gb28181/index/App.vue b/src/pages/gb28181/index/App.vue
index e89e2fb..fb5223a 100644
--- a/src/pages/gb28181/index/App.vue
+++ b/src/pages/gb28181/index/App.vue
@@ -1,544 +1,599 @@
-<template>
- <div class="s-system-manage">
- <div class="s-basic-setting">
- <el-tabs
- id="e-basic-setting"
- v-model="activeName"
- v-loading="loading"
- :element-loading-text="loadingText"
- type="border-card"
- @tab-click="hanleTabClick"
- >
- <el-tab-pane label="鍥芥爣ID" name="gb28181">
- <div style="width: 775px">
- <!-- GB28181璁剧疆 -->
- <el-form
- :model="gb28181"
- :rules="rules"
- label-width="130px"
- class="alarmSetting"
- ref="gb28181"
- >
- <!-- <el-form-item label="鍥介檯鏈嶅姟鍣↖P" prop="ServerIp">
- <ip-input :ip="gb28181.ServerIp" @on-blur="gb28181.ServerIp = arguments[0]"></ip-input>
- </el-form-item>-->
-
- <div style="text-align: left;margin-bottom: 16px;">
- <el-radio-group v-model="gb28181.idType">
- <el-radio :label="0">杈撳叆宸叉湁ID</el-radio>
- <el-radio :label="1">鐢熸垚鏂扮殑ID</el-radio>
- </el-radio-group>
- </div>
-
- <el-form-item label="鎵�鍦ㄥ湴">
- <el-select
- v-model="locationCity.province"
- @change="changeProvince"
- size="small"
- placeholder="璇烽�夋嫨鐪佷唤"
- :disabled="gb28181.idType === 0"
- >
- <el-option
- v-for="item in locationCity.provinceOptions"
- :key="item.id"
- :label="item.name"
- size="small"
- :value="item.id"
- ></el-option>
- </el-select>
- <el-select
- class="ml10 mr10"
- v-model="locationCity.city"
- :disabled="!locationCity.province"
- @change="changeCity"
- size="small"
- placeholder="璇烽�夋嫨鍩庡競"
- >
- <el-option
- v-for="item in locationCity.cityOptions"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- ></el-option>
- </el-select>
- <el-select
- v-model="locationCity.county"
- :disabled="!locationCity.city"
- size="small"
- placeholder="璇烽�夋嫨鍖哄幙"
- >
- <el-option
- v-for="item in locationCity.countyOptions"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- ></el-option>
- </el-select>
- <el-button
- type="text"
- style="position: absolute"
- v-show="gb28181.idType === 1"
- @click="newGBID"
- >鐢熸垚ID</el-button>
- </el-form-item>
-
- <!-- <el-form-item label="鍥介檯鏈嶅姟鍣ㄧ鍙�" prop="GbServerPort">
- <el-input v-model.number="gb28181.ServerPort" placeholder="璇疯緭鍏�" size="small"></el-input>
- </el-form-item>-->
-
- <el-form-item label="鍥芥爣ID">
- <el-input
- v-model="gb28181.PublicId"
- placeholder="璇疯緭鍏�"
- size="small"
- :disabled="gb28181.idType === 1"
- ></el-input>
- </el-form-item>
-
- <el-form-item label="鍥芥爣绔彛" prop="GbServerPort">
- <el-input v-model.number="gb28181.GbServerPort" placeholder="璇疯緭鍏�" size="small"></el-input>
- </el-form-item>
-
- <el-form-item label="寮�鍚壌鏉�" style="text-align: left">
- <el-switch v-model="gb28181.IsAuth"></el-switch>
- </el-form-item>
-
- <el-form-item label="閴存潈瀵嗙爜">
- <el-input
- v-model="gb28181.Password"
- placeholder="璇疯緭鍏�"
- size="small"
- :disabled="!gb28181.IsAuth"
- ></el-input>
- </el-form-item>
-
- <el-form-item style="float: right">
- <el-button type="primary" @click="submitGB28281" size="small">淇濆瓨</el-button>
- </el-form-item>
- </el-form>
- </div>
- </el-tab-pane>
-
- <el-tab-pane label="鎺ュ叆骞冲彴鍒楄〃" name="subordinates">
- <el-table
- :data="subDevTable"
- border
- fit
- highlight-current-row
- style="width: 100%; color:#000"
- :header-cell-style="{ background: '#f8f8f8', color: '#222222', height:'30px' }"
- >
- <el-table-column type="index" label="搴忓彿" align="center" width="50"></el-table-column>
- <el-table-column prop="name" label="鍚嶇О" align="center"></el-table-column>
- <el-table-column prop="publicid" label="ID" align="center"></el-table-column>
- <el-table-column prop="ip" label="IP" align="center"></el-table-column>
- <el-table-column prop="status" label="鐘舵��" align="center">
- <template slot-scope="scope">
- <span
- :style="scope.row.alive ? `color:#047d19` : 'color:#f11a1a;' "
- >{{scope.row.alive ? "鍦ㄧ嚎": "绂荤嚎"}}</span>
- </template>
- </el-table-column>
- <el-table-column prop="corp" label="澶囨敞" align="center"></el-table-column>
- </el-table>
- </el-tab-pane>
- <el-tab-pane label="鍥芥爣鎽勫儚鏈�" name="cameras">
- <div style="text-align:left">
- <el-button type="primary" size="small" @click="updateCamerasFromVideosvr">鍒锋柊</el-button>
- </div>
- <div class="camera-title">
- <b>鍥芥爣鎽勫儚鏈洪厤缃�</b>
- <span>(鏈�澶氬嬀閫�500璺憚鍍忔満)</span>
- </div>
- <tree-menu
- ref="tree"
- app="gb28181"
- treeName="localTree"
- :node="TreeDataPool.treeData"
- :height="treeHeight"
- :setting="treeSettings"
- style="width:600px;min-height:500px"
- />
- <div class="base-image" v-loading="TreeDataPool.baseImageLoading">
- <span>{{TreeDataPool.cameraNameForBaseImage}}</span>
- <div class="camera-image" v-show="TreeDataPool.cameraNameForBaseImage.length">
- <img
- :src="'data:image/png;base64,' + TreeDataPool.gb28181CameraBaseImage"
- width="450px"
- alt
- />
- </div>
- </div>
- <el-divider></el-divider>
-
- <span class="camera-seleted-text">
- 宸查�夋嫨 (
- <b>{{TreeDataPool.gb28181CheckedCount}}</b>
- / {{TreeDataPool.gb28181ChildNodeCount}} ) 璺�
- </span>
-
- <el-button type="primary" size="small" @click="saveChecked">淇濆瓨</el-button>
- </el-tab-pane>
- </el-tabs>
- </div>
- </div>
-</template>
-
-<script>
-import {
- getGB28181Config,
- saveGB28181Config,
- getGb28181AreaList,
- newGb28181ID,
- getAllSubServer,
- saveGb28181CamTree
-} from './api'
-
-import TreeMenu from "@/components/giantTree/index";
-import { isPort, isIPv4 } from '@/scripts/validate'
-import bus from '@/plugin/bus'
-export default {
- name: 'Gb28181Setting',
- components: {
- TreeMenu
- },
- directives: {
- focus: {
- inserted: function (el) {
- el.querySelector('input').focus()
- }
- }
- },
-
- data() {
- return {
- activeName: "gb28181",
- treeHeight: 750,
- loading: false,
- loadingText: "",
- openeds: ['0'],
- gb28181: {},
- subDevTable: [],
- idType: 1,
- treeSettings: {
- check: {
- enable: true
- }
- },
- rules: {
- ip: [
- {
- required: true,
- message: '璇疯緭鍏P鍦板潃',
- trigger: 'change'
- },
- { validator: isIPv4, trigger: 'change' }
- ],
- ServerIp: [
- {
- required: true,
- message: '璇疯緭鍏P鍦板潃',
- trigger: 'change'
- },
- { validator: isIPv4, trigger: 'change' }
- ],
- ServerPort: [
- {
- required: true,
- message: '璇疯緭鍏ョ鍙�',
- trigger: 'change'
- },
- { validator: isPort, trigger: 'change' }
- ],
- GbServerPort: [
- {
- required: true,
- message: '璇疯緭鍏ョ鍙�',
- trigger: 'change'
- },
- { validator: isPort, trigger: 'change' }
- ]
- },
- locationCity: {
- province: '',
- city: '',
- county: '',
- provinceOptions: [],
- cityOptions: [],
- countyOptions: []
- }
- }
- },
- mounted() {
- this.TreeDataPool.multiple = true;
-
- // 璁板綍鐩綍鏄惁鎶樺彔
- let foldList = localStorage.getItem("ztree_fold_list")
- if (foldList) {
- this.TreeDataPool.foldNodeList = JSON.parse(foldList)
- }
-
- this.initGB28181Conf();
- },
- methods: {
- hanleTabClick(tab, event) {
- if (this.activeName == "subordinates") {
- getAllSubServer().then(rsp => {
- if (rsp && rsp.success) {
- this.subDevTable = rsp.data;
- }
- })
- } else if (this.activeName == "cameras") {
- this.getCamerasFromVideosvr();
- }
-
-
- },
- async getCamerasFromVideosvr() {
- this.loading = true;
- await this.TreeDataPool.fetchVideosvrCameras(false);
- this.loading = false;
- },
- async updateCamerasFromVideosvr() {
- this.loading = true;
- await this.TreeDataPool.fetchVideosvrCameras(true);
- this.loading = false;
- },
- saveChecked() {
- localStorage.setItem('ztree_fold_list', JSON.stringify(this.TreeDataPool.foldNodeList))
-
- if (this.TreeDataPool.gb28181CheckedCount > 500) {
- this.$message({
- type: "warning",
- message: "鏈�澶氫粎鏀寔閫夋嫨500璺憚鍍忔満. 璇烽噸鏂伴�夋嫨"
- })
-
- return;
- }
-
- this.loading = true;
-
- let treeData = this.TreeDataPool.newTreeByChecked(this.TreeDataPool.activeTreeData)
-
- saveGb28181CamTree({ checkedMenus: treeData }).then(rsp => {
- if (rsp && rsp.success) {
- this.$message({
- type: "success",
- message: "淇濆瓨鎴愬姛"
- })
- }
- this.loading = false;
- }).catch(err => {
- this.$message({
- type: "error",
- message: "淇濆瓨澶辫触"
- })
- this.loading = false;
- })
- },
- initGB28181Conf() {
- getGB28181Config().then(rsp => {
- if (rsp && rsp.success) {
- this.gb28181 = rsp.data
- //this.gb28181.idType = 0;
-
- this.$set(this.gb28181, 'idType', 0)
- this.$refs['gb28181'].resetFields();
- }
- })
- getGb28181AreaList().then(rsp => {
- if (rsp && rsp.success) {
- this.locationCity.provinceOptions = rsp.data
- }
- })
- },
- submitGB28281() {
- this.$refs['gb28181'].validate(valid => {
- if (valid) {
- saveGB28181Config(this.gb28181).then(rsp => {
- if (rsp && rsp.success) {
- this.$notify({
- type: 'success',
- message: 'GB28181璁剧疆淇濆瓨鎴愬姛'
- })
- }
- })
- } else {
- console.log('error submit!!')
- return false
- }
- })
- },
- changeProvince() {
- let pid = this.locationCity.province
- getGb28181AreaList({ parentId: pid }).then(rsp => {
- if (rsp && rsp.success) {
- this.locationCity.cityOptions = rsp.data
- this.locationCity.city = this.locationCity.cityOptions[0].id
- this.changeCity()
- }
- })
- },
- changeCity() {
- let pid = this.locationCity.city
- getGb28181AreaList({ parentId: pid }).then(rsp => {
- if (rsp && rsp.success) {
- this.locationCity.countyOptions = rsp.data
- this.locationCity.county = this.locationCity.countyOptions[0].id
- }
- })
- },
- newGBID() {
- let cCode = this.locationCity.county + ''
- newGb28181ID({ code: cCode }).then(rsp => {
- if (rsp && rsp.success) {
- this.gb28181.PublicId = rsp.data
- }
- })
- },
- menuOpen() {
-
- },
- menuClose() {
-
- },
- toOpenMenuList(e) {
- let t = e.clientY - this.$el.offsetTop + 30;
- let l = e.clientX - this.$el.offsetLeft;
-
- window.parent.postMessage({ source: location.href.split('/')[location.href.split('/').length - 1], trigger: 'contextmenu', menuT: t, menuL: l }, "*");
- return false;
- }
- }
-}
-</script>
-<style lang="scss">
-.s-system-manage {
- width: 100% !important;
- min-width: 1067px;
- height: 100%;
- box-sizing: border-box;
- padding: 10px;
- background-color: #f8f9fb;
- .s-system-manage-breadcrumb {
- height: 5%;
- box-sizing: border-box;
- border: 1px solid #e4e7ed;
- box-shadow: #e4e7ed 0px 0px 9px inset;
- box-shadow: #e4e7ed 0px 0px 9px inset;
- border-radius: 5px;
- }
-
- .el-tabs--border-card {
- border: 0px solid #dcdfe6;
- -webkit-box-shadow: none;
- box-shadow: none;
- .el-tabs__header {
- border: 0px solid #dcdfe6;
- .el-tabs__item {
- padding: 5px 50px;
- height: 50px;
- font-family: PingFangSC-Regular;
- font-size: 15px;
- color: #222222;
- text-align: center;
- border: 0px solid transparent;
- }
- .el-tabs__item:nth-child(2) {
- padding-left: 50px !important;
- }
- .el-tabs__item:last-child {
- padding-right: 50px !important;
- }
- .el-tabs__item.is-active {
- color: #3d68e1;
-
- // border-right-color: #fff;
- // border-left-color: #fff;
- }
- .el-tabs__item:not(.is-disabled):hover {
- color: #3d68e1;
- }
- }
- }
- .el-tabs__header {
- margin-bottom: 0;
- }
- .el-tabs__content {
- height: calc(100% - 64px);
- box-sizing: border-box;
- overflow-y: auto;
- padding: 20px 40px !important;
- background: #fff;
- .el-tab-pane {
- width: 100%;
- .s-title {
- text-align: left;
- padding: 15px 0px;
- font-size: 16px;
- }
- }
- }
-
- .s-table {
- border: 1px solid #e8e8e9;
- margin-top: 40px;
- }
-
- .ui-top-title {
- padding-bottom: 10px;
- /* border-bottom: 1px solid #ebebeb; */
- position: relative;
- text-align: left;
- padding-left: 15px;
- font-size: 16px;
- font-weight: bold;
- }
-
- .ui-top-title:before {
- content: " ";
- border-left: 4px solid #f53d3d;
- display: inline-block;
- height: 16px;
- position: absolute;
- top: 50%;
- left: 0;
- margin-top: -13px;
- }
-
- .el-button--text {
- color: #3d68e1;
- text-decoration: underline;
- }
-
- .camera-title {
- text-align: left;
- padding: 0px 10px;
- margin: 5px 0px;
- height: 33px;
- background-color: #e4e2e2;
- line-height: 33px;
- font-size: 14px;
- }
-
- .camera-seleted-text {
- margin-right: 20px;
-
- .b {
- color: #3d68e1;
- }
- }
-
- .base-image {
- position: absolute;
- top: 18%;
- left: 57%;
- width: 450px;
-
- .camera-image {
- background-color: black;
- height: 254px;
- }
- }
-}
-</style>
+<template>
+ <div class="s-system-manage">
+ <div class="s-basic-setting">
+ <el-tabs
+ id="e-basic-setting"
+ v-model="activeName"
+ v-loading="loading"
+ :element-loading-text="loadingText"
+ type="border-card"
+ @tab-click="hanleTabClick"
+ >
+ <el-tab-pane label="鍥芥爣ID" name="gb28181">
+ <div style="width: 775px">
+ <!-- GB28181璁剧疆 -->
+ <el-form
+ :model="gb28181"
+ :rules="rules"
+ label-width="130px"
+ class="alarmSetting"
+ ref="gb28181"
+ >
+ <!-- <el-form-item label="鍥介檯鏈嶅姟鍣↖P" prop="ServerIp">
+ <ip-input :ip="gb28181.ServerIp" @on-blur="gb28181.ServerIp = arguments[0]"></ip-input>
+ </el-form-item>-->
+
+ <div style="text-align: left; margin-bottom: 16px">
+ <el-radio-group v-model="gb28181.idType">
+ <el-radio :label="0">杈撳叆宸叉湁ID</el-radio>
+ <el-radio :label="1">鐢熸垚鏂扮殑ID</el-radio>
+ </el-radio-group>
+ </div>
+
+ <el-form-item label="鎵�鍦ㄥ湴">
+ <el-select
+ v-model="locationCity.province"
+ @change="changeProvince"
+ size="small"
+ placeholder="璇烽�夋嫨鐪佷唤"
+ :disabled="gb28181.idType === 0"
+ >
+ <el-option
+ v-for="item in locationCity.provinceOptions"
+ :key="item.id"
+ :label="item.name"
+ size="small"
+ :value="item.id"
+ ></el-option>
+ </el-select>
+ <el-select
+ class="ml10 mr10"
+ v-model="locationCity.city"
+ :disabled="!locationCity.province"
+ @change="changeCity"
+ size="small"
+ placeholder="璇烽�夋嫨鍩庡競"
+ >
+ <el-option
+ v-for="item in locationCity.cityOptions"
+ :key="item.id"
+ :label="item.name"
+ :value="item.id"
+ ></el-option>
+ </el-select>
+ <el-select
+ v-model="locationCity.county"
+ :disabled="!locationCity.city"
+ size="small"
+ placeholder="璇烽�夋嫨鍖哄幙"
+ >
+ <el-option
+ v-for="item in locationCity.countyOptions"
+ :key="item.id"
+ :label="item.name"
+ :value="item.id"
+ ></el-option>
+ </el-select>
+ <el-button
+ type="text"
+ style="position: absolute"
+ v-show="gb28181.idType === 1"
+ @click="newGBID"
+ >鐢熸垚ID</el-button
+ >
+ </el-form-item>
+
+ <!-- <el-form-item label="鍥介檯鏈嶅姟鍣ㄧ鍙�" prop="GbServerPort">
+ <el-input v-model.number="gb28181.ServerPort" placeholder="璇疯緭鍏�" size="small"></el-input>
+ </el-form-item>-->
+
+ <el-form-item label="鍥芥爣ID">
+ <el-input
+ v-model="gb28181.PublicId"
+ placeholder="璇疯緭鍏�"
+ size="small"
+ :disabled="gb28181.idType === 1"
+ ></el-input>
+ </el-form-item>
+
+ <el-form-item label="鍥芥爣绔彛" prop="GbServerPort">
+ <el-input
+ v-model.number="gb28181.GbServerPort"
+ placeholder="璇疯緭鍏�"
+ size="small"
+ ></el-input>
+ </el-form-item>
+
+ <el-form-item label="寮�鍚壌鏉�" style="text-align: left">
+ <el-switch v-model="gb28181.IsAuth"></el-switch>
+ </el-form-item>
+
+ <el-form-item label="閴存潈瀵嗙爜">
+ <el-input
+ v-model="gb28181.Password"
+ placeholder="璇疯緭鍏�"
+ size="small"
+ :disabled="!gb28181.IsAuth"
+ ></el-input>
+ </el-form-item>
+
+ <el-form-item style="float: right">
+ <el-button type="primary" @click="submitGB28281" size="small"
+ >淇濆瓨</el-button
+ >
+ </el-form-item>
+ </el-form>
+ </div>
+ </el-tab-pane>
+
+ <el-tab-pane label="鎺ュ叆骞冲彴鍒楄〃" name="subordinates">
+ <el-table
+ :data="subDevTable"
+ border
+ fit
+ highlight-current-row
+ style="width: 100%; color: #000"
+ :header-cell-style="{
+ background: '#f8f8f8',
+ color: '#222222',
+ height: '30px',
+ }"
+ >
+ <el-table-column
+ type="index"
+ label="搴忓彿"
+ align="center"
+ width="50"
+ ></el-table-column>
+ <el-table-column
+ prop="name"
+ label="鍚嶇О"
+ align="center"
+ ></el-table-column>
+ <el-table-column
+ prop="publicid"
+ label="ID"
+ align="center"
+ ></el-table-column>
+ <el-table-column
+ prop="ip"
+ label="IP"
+ align="center"
+ ></el-table-column>
+ <el-table-column prop="status" label="鐘舵��" align="center">
+ <template slot-scope="scope">
+ <span
+ :style="scope.row.alive ? `color:#047d19` : 'color:#f11a1a;'"
+ >{{ scope.row.alive ? "鍦ㄧ嚎" : "绂荤嚎" }}</span
+ >
+ </template>
+ </el-table-column>
+ <el-table-column
+ prop="corp"
+ label="澶囨敞"
+ align="center"
+ ></el-table-column>
+ </el-table>
+ </el-tab-pane>
+ <el-tab-pane label="鍥芥爣鎽勫儚鏈�" name="cameras">
+ <div style="text-align: left">
+ <el-button
+ type="primary"
+ size="small"
+ @click="updateCamerasFromVideosvr"
+ >鍒锋柊</el-button
+ >
+ </div>
+ <div class="camera-title">
+ <b>鍥芥爣鎽勫儚鏈洪厤缃�</b>
+ <span>(鏈�澶氬嬀閫�500璺憚鍍忔満)</span>
+ </div>
+ <tree-menu
+ ref="tree"
+ app="gb28181"
+ treeName="localTree"
+ :node="TreeDataPool.treeData"
+ :height="treeHeight"
+ :setting="treeSettings"
+ clickType="multiple"
+ style="width: 600px; min-height: 500px"
+ />
+ <div class="base-image" v-loading="TreeDataPool.baseImageLoading">
+ <span>{{ TreeDataPool.cameraNameForBaseImage }}</span>
+ <div
+ class="camera-image"
+ v-show="TreeDataPool.cameraNameForBaseImage.length"
+ >
+ <img
+ :src="
+ 'data:image/png;base64,' + TreeDataPool.gb28181CameraBaseImage
+ "
+ width="450px"
+ alt
+ />
+ </div>
+ </div>
+ <el-divider></el-divider>
+
+ <span class="camera-seleted-text">
+ 宸查�夋嫨 (
+ <b>{{ TreeDataPool.gb28181CheckedCount }}</b>
+ / {{ TreeDataPool.gb28181ChildNodeCount }} ) 璺�
+ </span>
+
+ <el-button type="primary" size="small" @click="saveChecked"
+ >淇濆瓨</el-button
+ >
+ </el-tab-pane>
+ </el-tabs>
+ </div>
+ </div>
+</template>
+
+<script>
+import {
+ getGB28181Config,
+ saveGB28181Config,
+ getGb28181AreaList,
+ newGb28181ID,
+ getAllSubServer,
+ saveGb28181CamTree,
+} from "./api";
+
+import TreeMenu from "@/components/giantTree/index";
+import { isPort, isIPv4 } from "@/scripts/validate";
+import bus from "@/plugin/bus";
+export default {
+ name: "Gb28181Setting",
+ components: {
+ TreeMenu,
+ },
+ directives: {
+ focus: {
+ inserted: function (el) {
+ el.querySelector("input").focus();
+ },
+ },
+ },
+
+ data() {
+ return {
+ activeName: "gb28181",
+ treeHeight: 750,
+ loading: false,
+ loadingText: "",
+ openeds: ["0"],
+ gb28181: {},
+ subDevTable: [],
+ idType: 1,
+ treeSettings: {
+ check: {
+ enable: true,
+ },
+ },
+ rules: {
+ ip: [
+ {
+ required: true,
+ message: "璇疯緭鍏P鍦板潃",
+ trigger: "change",
+ },
+ { validator: isIPv4, trigger: "change" },
+ ],
+ ServerIp: [
+ {
+ required: true,
+ message: "璇疯緭鍏P鍦板潃",
+ trigger: "change",
+ },
+ { validator: isIPv4, trigger: "change" },
+ ],
+ ServerPort: [
+ {
+ required: true,
+ message: "璇疯緭鍏ョ鍙�",
+ trigger: "change",
+ },
+ { validator: isPort, trigger: "change" },
+ ],
+ GbServerPort: [
+ {
+ required: true,
+ message: "璇疯緭鍏ョ鍙�",
+ trigger: "change",
+ },
+ { validator: isPort, trigger: "change" },
+ ],
+ },
+ locationCity: {
+ province: "",
+ city: "",
+ county: "",
+ provinceOptions: [],
+ cityOptions: [],
+ countyOptions: [],
+ },
+ };
+ },
+ mounted() {
+ this.TreeDataPool.multiple = true;
+
+ // 璁板綍鐩綍鏄惁鎶樺彔
+ let foldList = localStorage.getItem("ztree_fold_list");
+ if (foldList) {
+ this.TreeDataPool.foldNodeList = JSON.parse(foldList);
+ }
+
+ this.initGB28181Conf();
+ },
+ methods: {
+ hanleTabClick(tab, event) {
+ if (this.activeName == "subordinates") {
+ getAllSubServer().then((rsp) => {
+ if (rsp && rsp.success) {
+ this.subDevTable = rsp.data;
+ }
+ });
+ } else if (this.activeName == "cameras") {
+ this.getCamerasFromVideosvr();
+ }
+ },
+ async getCamerasFromVideosvr() {
+ this.loading = true;
+ await this.TreeDataPool.fetchVideosvrCameras(false);
+ this.loading = false;
+ },
+ async updateCamerasFromVideosvr() {
+ this.loading = true;
+ await this.TreeDataPool.fetchVideosvrCameras(true);
+ this.loading = false;
+ },
+ saveChecked() {
+ localStorage.setItem(
+ "ztree_fold_list",
+ JSON.stringify(this.TreeDataPool.foldNodeList)
+ );
+
+ if (this.TreeDataPool.gb28181CheckedCount > 500) {
+ this.$message({
+ type: "warning",
+ message: "鏈�澶氫粎鏀寔閫夋嫨500璺憚鍍忔満. 璇烽噸鏂伴�夋嫨",
+ });
+
+ return;
+ }
+
+ this.loading = true;
+
+ let treeData = this.TreeDataPool.newTreeByChecked(
+ this.TreeDataPool.activeTreeData
+ );
+
+ saveGb28181CamTree({ checkedMenus: treeData })
+ .then((rsp) => {
+ if (rsp && rsp.success) {
+ this.$message({
+ type: "success",
+ message: "淇濆瓨鎴愬姛",
+ });
+ }
+ this.loading = false;
+ })
+ .catch((err) => {
+ this.$message({
+ type: "error",
+ message: "淇濆瓨澶辫触",
+ });
+ this.loading = false;
+ });
+ },
+ initGB28181Conf() {
+ getGB28181Config().then((rsp) => {
+ if (rsp && rsp.success) {
+ this.gb28181 = rsp.data;
+ //this.gb28181.idType = 0;
+
+ this.$set(this.gb28181, "idType", 0);
+ this.$refs["gb28181"].resetFields();
+ }
+ });
+ getGb28181AreaList().then((rsp) => {
+ if (rsp && rsp.success) {
+ this.locationCity.provinceOptions = rsp.data;
+ }
+ });
+ },
+ submitGB28281() {
+ this.$refs["gb28181"].validate((valid) => {
+ if (valid) {
+ saveGB28181Config(this.gb28181).then((rsp) => {
+ if (rsp && rsp.success) {
+ this.$notify({
+ type: "success",
+ message: "GB28181璁剧疆淇濆瓨鎴愬姛",
+ });
+ }
+ });
+ } else {
+ console.log("error submit!!");
+ return false;
+ }
+ });
+ },
+ changeProvince() {
+ let pid = this.locationCity.province;
+ getGb28181AreaList({ parentId: pid }).then((rsp) => {
+ if (rsp && rsp.success) {
+ this.locationCity.cityOptions = rsp.data;
+ this.locationCity.city = this.locationCity.cityOptions[0].id;
+ this.changeCity();
+ }
+ });
+ },
+ changeCity() {
+ let pid = this.locationCity.city;
+ getGb28181AreaList({ parentId: pid }).then((rsp) => {
+ if (rsp && rsp.success) {
+ this.locationCity.countyOptions = rsp.data;
+ this.locationCity.county = this.locationCity.countyOptions[0].id;
+ }
+ });
+ },
+ newGBID() {
+ let cCode = this.locationCity.county + "";
+ newGb28181ID({ code: cCode }).then((rsp) => {
+ if (rsp && rsp.success) {
+ this.gb28181.PublicId = rsp.data;
+ }
+ });
+ },
+ menuOpen() {},
+ menuClose() {},
+ toOpenMenuList(e) {
+ let t = e.clientY - this.$el.offsetTop + 30;
+ let l = e.clientX - this.$el.offsetLeft;
+
+ window.parent.postMessage(
+ {
+ source: location.href.split("/")[location.href.split("/").length - 1],
+ trigger: "contextmenu",
+ menuT: t,
+ menuL: l,
+ },
+ "*"
+ );
+ return false;
+ },
+ },
+};
+</script>
+<style lang="scss">
+.s-system-manage {
+ width: 100% !important;
+ min-width: 1067px;
+ height: 100%;
+ box-sizing: border-box;
+ padding: 10px;
+ background-color: #f8f9fb;
+ .s-system-manage-breadcrumb {
+ height: 5%;
+ box-sizing: border-box;
+ border: 1px solid #e4e7ed;
+ box-shadow: #e4e7ed 0px 0px 9px inset;
+ box-shadow: #e4e7ed 0px 0px 9px inset;
+ border-radius: 5px;
+ }
+
+ .el-tabs--border-card {
+ border: 0px solid #dcdfe6;
+ -webkit-box-shadow: none;
+ box-shadow: none;
+ .el-tabs__header {
+ border: 0px solid #dcdfe6;
+ .el-tabs__item {
+ padding: 5px 50px;
+ height: 50px;
+ font-family: PingFangSC-Regular;
+ font-size: 15px;
+ color: #222222;
+ text-align: center;
+ border: 0px solid transparent;
+ }
+ .el-tabs__item:nth-child(2) {
+ padding-left: 50px !important;
+ }
+ .el-tabs__item:last-child {
+ padding-right: 50px !important;
+ }
+ .el-tabs__item.is-active {
+ color: #3d68e1;
+
+ // border-right-color: #fff;
+ // border-left-color: #fff;
+ }
+ .el-tabs__item:not(.is-disabled):hover {
+ color: #3d68e1;
+ }
+ }
+ }
+ .el-tabs__header {
+ margin-bottom: 0;
+ }
+ .el-tabs__content {
+ height: calc(100% - 64px);
+ box-sizing: border-box;
+ overflow-y: auto;
+ padding: 20px 40px !important;
+ background: #fff;
+ .el-tab-pane {
+ width: 100%;
+ .s-title {
+ text-align: left;
+ padding: 15px 0px;
+ font-size: 16px;
+ }
+ }
+ }
+
+ .s-table {
+ border: 1px solid #e8e8e9;
+ margin-top: 40px;
+ }
+
+ .ui-top-title {
+ padding-bottom: 10px;
+ /* border-bottom: 1px solid #ebebeb; */
+ position: relative;
+ text-align: left;
+ padding-left: 15px;
+ font-size: 16px;
+ font-weight: bold;
+ }
+
+ .ui-top-title:before {
+ content: " ";
+ border-left: 4px solid #f53d3d;
+ display: inline-block;
+ height: 16px;
+ position: absolute;
+ top: 50%;
+ left: 0;
+ margin-top: -13px;
+ }
+
+ .el-button--text {
+ color: #3d68e1;
+ text-decoration: underline;
+ }
+
+ .camera-title {
+ text-align: left;
+ padding: 0px 10px;
+ margin: 5px 0px;
+ height: 33px;
+ background-color: #e4e2e2;
+ line-height: 33px;
+ font-size: 14px;
+ }
+
+ .camera-seleted-text {
+ margin-right: 20px;
+
+ .b {
+ color: #3d68e1;
+ }
+ }
+
+ .base-image {
+ position: absolute;
+ top: 18%;
+ left: 57%;
+ width: 450px;
+
+ .camera-image {
+ background-color: black;
+ height: 254px;
+ }
+ }
+}
+</style>
--
Gitblit v1.8.0