<template>
|
<div class="CameraManage">
|
<div class="cluster">
|
<div class="title">集群选择</div>
|
<el-select v-model="cluster" placeholder="请选择">
|
<el-option
|
v-for="item in clusterArr"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
>
|
</el-option>
|
</el-select>
|
</div>
|
<div class="content">
|
<CameraLeft :appName="'Camera'" ref="left"></CameraLeft>
|
<div class="right">
|
<div class="tabs">
|
<div
|
class="tab"
|
:class="{ active: activeTab === '信息维护' }"
|
@click="activeTab = '信息维护'"
|
>
|
信息维护
|
</div>
|
<div
|
class="tab"
|
:class="{ active: activeTab === '场景配置' }"
|
@click="activeTab = '场景配置'"
|
>
|
场景配置
|
</div>
|
</div>
|
|
<CameraInfo
|
ref="cameraInfo"
|
v-if="activeTab === '信息维护'"
|
></CameraInfo>
|
</div>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import CameraLeft from "@/views/hashrate/components/CameraLeft";
|
import CameraInfo from "@/views/hashrate/components/CameraInfo";
|
|
import bus from "@/plugin/bus";
|
export default {
|
components: {
|
CameraLeft,
|
CameraInfo,
|
},
|
|
data() {
|
return {
|
activeTab: "信息维护",
|
clusterArr: [
|
{
|
value: 0,
|
label: "集群一",
|
},
|
{
|
value: 1,
|
label: "集群二",
|
},
|
],
|
cluster: "",
|
activeName: "camera-info",
|
buttonAuthority: sessionStorage.getItem("buttonAuthoritys") || [],
|
intervalTimer: null,
|
leftWith: 0,
|
screenHeight: 0,
|
};
|
},
|
destroyed() {
|
this.TreeDataPool.readonly = true;
|
},
|
computed: {
|
isAdmin() {
|
if (
|
sessionStorage.getItem("userInfo") &&
|
sessionStorage.getItem("userInfo") !== ""
|
) {
|
let loginName = JSON.parse(sessionStorage.getItem("userInfo")).username;
|
return loginName === "superadmin" || loginName === "basic";
|
}
|
|
return false;
|
},
|
firstLabeName() {
|
return this.TreeDataPool.treeActiveName === "camera"
|
? "摄像机信息"
|
: "数据栈信息";
|
},
|
},
|
watch: {
|
// 数据栈不显示联动规则,防止在选中联动规则tab中切换到数据栈
|
"TreeDataPool.treeActiveName": function (val) {
|
if (val === "dataStack" && this.activeName === "linkage-rule") {
|
this.activeName = "camera-info";
|
}
|
},
|
"TreeDataPool.selectedNode": function (node) {
|
console.log("00000000000000");
|
if (this.activeName == "camera-info") {
|
console.log("111111111111111");
|
if (this.TreeDataPool.treeActiveName == "camera") {
|
console.log("2222222222222");
|
this.$refs.cameraInfo.selectCamera(node);
|
}
|
} else if (this.activeName === "separate-rule") {
|
this.$refs.sepRule.Camera = {};
|
this.$refs.sepRule.initCameraData(node.id);
|
}
|
},
|
"TreeDataPool.selectedNodes": {
|
handler(nodes) {
|
if (this.activeName == "linkage-rule") {
|
this.$refs.linkRule.initCameraData();
|
}
|
},
|
deep: true,
|
},
|
"DataStackPool.selectedDir": {
|
handler(node, oldNode) {
|
if (this.TreeDataPool.treeActiveName !== "dataStack") {
|
return;
|
}
|
this.$nextTick(() => {
|
if (this.activeName == "camera-info") {
|
this.$refs.dataStackInfo.selectDir(node);
|
} else if (this.activeName == "separate-rule" && node.length !== 0) {
|
this.$refs.sepRule.initCameraData(node.id);
|
}
|
});
|
},
|
deep: true,
|
},
|
},
|
created() {
|
this.PollData.statistics();
|
this.TreeDataPool.readonly = false;
|
|
if (this.TreeDataPool.treeActiveName == "camera") {
|
if (this.isShow("cameraAccess:cameraInfo")) {
|
this.activeName = "camera-info";
|
} else if (this.isShow("cameraAccess:selfRule")) {
|
this.activeName = "separate-rule";
|
} else if (this.isShow("cameraAccess:linkRule")) {
|
this.activeName = "linkage-rule";
|
}
|
} else {
|
if (this.isShow("dataStack:cameraInfo")) {
|
this.activeName = "camera-info";
|
} else if (this.isShow("dataStack:selfRule")) {
|
this.activeName = "separate-rule";
|
}
|
}
|
|
// this.TreeDataPool.readonly = true;
|
//this.TreeDataPool.gbReadonly = true;
|
this.TreeDataPool.multiple = false;
|
this.TreeDataPool.selectedNode = "";
|
this.selectedNodes = [];
|
this.VideoManageData.init();
|
},
|
beforeDestroy() {
|
clearInterval(this.intervalTimer);
|
//this.TreeDataPool.treeActiveName = "camera";
|
},
|
mounted() {
|
this.$nextTick(() => {
|
bus.$on("addCameraOnTree", (node) => {
|
this.handAddDevice(node);
|
});
|
bus.$on("addDirOnTree", (node) => {
|
this.handAddDIr(node);
|
});
|
this.TreeDataPool.clean();
|
});
|
|
let _this = this;
|
_this.PollData.statisticTaskInfo();
|
this.intervalTimer = setInterval(() => {
|
_this.PollData.statisticTaskInfo();
|
}, 10000);
|
},
|
methods: {
|
isShow(authority) {
|
return (
|
this.isAdmin || this.buttonAuthority.indexOf("," + authority + ",") > -1
|
);
|
},
|
handAddDevice(node) {
|
let _this = this;
|
setTimeout(() => {
|
_this.$refs.cameraInfo.addDevice(node);
|
_this.activeName = "camera-info";
|
}, 100);
|
},
|
handAddDIr(node) {
|
let _this = this;
|
setTimeout(() => {
|
_this.$refs.dataStackInfo.addDir(node);
|
_this.activeName = "camera-info";
|
}, 100);
|
},
|
handleClick(tab, event) {
|
console.log(this.TreeDataPool);
|
this.TreeDataPool.multiple = tab.name === "linkage-rule";
|
if (tab.name === "camera-info") {
|
if (this.TreeDataPool.treeActiveName == "camera") {
|
this.$refs.cameraInfo.selectCamera(this.TreeDataPool.selectedNode);
|
} else if (this.TreeDataPool.treeActiveName == "dataStack") {
|
this.$refs.dataStackInfo.selectDir(this.DataStackPool.selectedDir);
|
}
|
} else if (tab.name === "separate-rule") {
|
if (this.TreeDataPool.treeActiveName == "camera") {
|
this.$refs.sepRule.initCameraData(this.TreeDataPool.selectedNode.id);
|
} else if (this.TreeDataPool.treeActiveName == "dataStack") {
|
this.$refs.sepRule.initCameraData(this.DataStackPool.selectedDir.id);
|
}
|
} else if (this.activeName == "linkage-rule") {
|
this.$refs.linkRule.initCameraData();
|
} else if (this.activeName == "poll-setting") {
|
this.$nextTick(() => {
|
this.$refs.pullSetting.initLineChart();
|
});
|
}
|
},
|
},
|
};
|
</script>
|
|
<style lang="scss" scoped>
|
.CameraManage {
|
.cluster {
|
display: flex;
|
align-items: center;
|
box-sizing: border-box;
|
margin-bottom: 24px;
|
padding: 10px;
|
height: 72px;
|
background-color: #fff;
|
|
.title {
|
box-sizing: border-box;
|
padding-left: 10px;
|
margin-right: 40px;
|
height: 22px;
|
font-size: 16px;
|
font-weight: 700;
|
border-left: 4px solid #0065ff;
|
}
|
|
.el-select {
|
width: 272px;
|
height: 32px;
|
line-height: 32px;
|
|
::v-deep input:focus {
|
border-color: #0065ff;
|
}
|
|
::v-deep .el-input.is-focus .el-input__inner {
|
border-color: #0065ff;
|
}
|
|
::v-deep input {
|
border-radius: 0;
|
height: 32px;
|
}
|
|
::v-deep .el-icon-arrow-up {
|
line-height: 32px;
|
}
|
}
|
}
|
|
.content {
|
margin-bottom: 60px;
|
display: flex;
|
align-items: stretch;
|
.CameraLeft {
|
margin-right: 24px;
|
width: 292px;
|
}
|
|
.right {
|
flex: 1;
|
|
.tabs {
|
display: flex;
|
margin-bottom: 24px;
|
height: 42px;
|
background-color: #fff;
|
|
.tab {
|
width: 104px;
|
height: 42px;
|
text-align: center;
|
line-height: 42px;
|
border-bottom: 2px solid #fff;
|
color: #666;
|
cursor: pointer;
|
|
&.active {
|
color: #0065ff;
|
border-color: #0065ff;
|
}
|
}
|
}
|
}
|
}
|
}
|
</style>
|