<template>
|
<div class="s-linkage-rules">
|
<!-- <div class="top">
|
<p style="text-align:left;margin-bottom: 14px;">
|
<b style="font-size: 14px;line-height: 18px;">场景</b>
|
</p>
|
<div class="clearfix" style="min-width:1570px;">
|
<div class="slide-scene">
|
<slide-scene :sceneData="tableRuleList"></slide-scene>
|
</div>
|
<div class="top-right">
|
<sysinfo
|
v-if="showSysInfo"
|
style="margin-top: -10px;"
|
:ShowLocalVedio="this.TreeDataPool.treeActiveName !== 'camera'"
|
:showRealPoll="this.TreeDataPool.treeActiveName == 'camera'"
|
/>
|
</div>
|
</div>
|
</div>-->
|
<div class="top">
|
<p class="task-css">
|
<b style="font-size: 14px; line-height: 18px">场景</b>
|
</p>
|
<div class="clearfix">
|
<slide-scene :sceneData="tableRuleList"></slide-scene>
|
<div class="top-right">
|
<sysinfo
|
v-if="showSysInfo"
|
style="margin-top: -10px"
|
:ShowLocalVedio="this.TreeDataPool.treeActiveName !== 'camera'"
|
:showRealPoll="this.TreeDataPool.treeActiveName == 'camera'"
|
/>
|
<!-- <sysinfo
|
:showRealPoll="cameraType === 'camera'"
|
:ShowLocalVedio="cameraType === 'dataStack'"
|
v-if="showSysInfo"
|
style="margin-top:-10px"
|
/>-->
|
</div>
|
</div>
|
</div>
|
<div class="bottom">
|
<div class="devide"></div>
|
<div class="bottom-right">
|
<div class="draw-and-time-box">
|
<div class="draw-box">
|
<p
|
style="
|
text-align: left;
|
padding: 10px 0px 0px 0px;
|
box-sizing: border-box;
|
"
|
>
|
<b style="font-size: 14px">查看区域</b>
|
</p>
|
<div class="img-box">
|
<span class="camera-tip" v-show="swipercanvasData.length == 0"
|
>暂无区域,请至少选择2个摄像机</span
|
>
|
<!-- swiper 展示 -->
|
<swiper
|
ref="swiper"
|
:options="swiperOption"
|
@slideChange="swiperSlideChange"
|
class="swiper-box-container2"
|
>
|
<swiper-slide
|
v-for="(data, index) in swipercanvasData"
|
:key="index"
|
>
|
<b
|
class="video-title"
|
style="font-size: 14px; margin-top: -10px"
|
>{{ data.name }}</b
|
>
|
<polygon-canvas
|
ref="canvas"
|
v-loading="loading"
|
element-loading-text="刷新中,请稍等..."
|
element-loading-background="rgba(0, 0, 0, 0.8)"
|
:divId="data.cameraId"
|
:isShowDrawArrow="true"
|
:isLink="true"
|
:disabled="false"
|
:loading="data.loading"
|
:snapshot_url="data.baseImg"
|
:canvasDataShow="data.canvasData"
|
:currentCameraId="data.cameraId"
|
@changeLoading="changeLoading"
|
@fromCanvas="getCanvasData"
|
@refresh="refresh"
|
></polygon-canvas>
|
</swiper-slide>
|
</swiper>
|
<div
|
class="swiper-local-prev"
|
v-show="swipercanvasData.length > 1"
|
>
|
<div class="icon-btn" slot="button-prev">
|
<i class="iconfont iconzuo"></i>
|
</div>
|
</div>
|
<div
|
class="swiper-local-next"
|
v-show="swipercanvasData.length > 1"
|
>
|
<div class="icon-btn" slot="button-next">
|
<i class="iconfont iconyou1"></i>
|
</div>
|
</div>
|
</div>
|
</div>
|
<div style="float: left; width: calc(10% - 90px); height: 100%"></div>
|
<div
|
class="time-box"
|
style="
|
width: calc(90% + 90px - 576px);
|
overflow-x: auto;
|
overflow-y: hidden;
|
"
|
>
|
<p style="text-align: left; padding: 10px; box-sizing: border-box">
|
<b style="font-size: 14px">时间规则</b>
|
</p>
|
<time-slider ref="timeSlider" :type="'link'" />
|
</div>
|
</div>
|
|
<!-- 场景规则 -->
|
<scene-rule
|
linkRule
|
:seletedCameras="Carmeras"
|
:tableRuleList="tableRuleList"
|
:onSaveScene="saveSceneRule"
|
@delete-rule="showRules"
|
v-loading="loadingRuleList"
|
></scene-rule>
|
</div>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import { saveLinkScene, getLinkSceneRule } from "@/api/scene";
|
|
import VideoRuleData from "@/Pool/VideoRuleData";
|
import polygonCanvas from "@/components/canvas";
|
import TimeSlider from "./TimeSlider";
|
//import Sysinfo from "./SystemInfo"
|
import Sysinfo from "@/components/subComponents/SystemInfo";
|
import SceneRule from "./SceneRule";
|
import SlideScene from "./scene/SlideScene";
|
|
export default {
|
components: {
|
TimeSlider,
|
polygonCanvas,
|
SceneRule,
|
Sysinfo,
|
SlideScene,
|
},
|
computed: {
|
selectedCameraIds() {
|
return this.TreeDataPool.selectedNodes;
|
},
|
},
|
data() {
|
return {
|
loading: false,
|
loadingRuleList: false,
|
Carmeras: [],
|
tasksTable: {},
|
swipercanvasData: [],
|
seqNumber: 0,
|
tableRuleList: [],
|
swiperIndex: 0,
|
swiperOption: {
|
grabCursor: true,
|
pagination: {
|
el: ".swiper-pagination",
|
type: "fraction",
|
},
|
navigation: {
|
nextEl: ".swiper-local-next",
|
prevEl: ".swiper-local-prev",
|
},
|
},
|
swiperTaskOption: {
|
slidesPerView: 4,
|
// spaceBetween: 10,
|
pagination: {
|
el: ".swiper-pagination",
|
clickable: true,
|
},
|
navigation: {
|
nextEl: ".next-border",
|
prevEl: ".pre-border",
|
},
|
},
|
showSysInfo: false,
|
requestSeq: "",
|
};
|
},
|
watch: {
|
Carmeras: {
|
handler(newVal, oldVal) {
|
this.setSwiperData();
|
},
|
deep: true,
|
},
|
},
|
|
methods: {
|
swiperSlideChange() {
|
this.swiperIndex = this.$refs.swiper.swiper.activeIndex;
|
},
|
initCameraData(type) {
|
this.$nextTick(() => {
|
this.Carmeras = [];
|
this.showSysInfo = true;
|
|
if (type === 1) {
|
this.selectedCameraIds.forEach((cid) => {
|
this.Carmeras.push(new VideoRuleData(cid, true));
|
});
|
} else {
|
this.selectedCameraIds.forEach((cid) => {
|
this.Carmeras.push(new VideoRuleData(cid));
|
});
|
}
|
|
this.$refs.timeSlider.activeTab = this.VideoManageData.TimeRules[0].id;
|
this.showRules();
|
});
|
},
|
setSwiperData() {
|
let swipers = [];
|
let carmeras = this.Carmeras;
|
for (let i = 0; i < carmeras.length; i++) {
|
swipers = swipers.concat({
|
cameraId: carmeras[i].cameraId,
|
name: carmeras[i].camearInfo.name,
|
baseImg: carmeras[i].baseImg ? carmeras[i].baseImg : undefined,
|
canvasData: carmeras[i].canvasData,
|
loading: carmeras[i].loading,
|
});
|
}
|
this.swipercanvasData = swipers;
|
},
|
refresh(url, id) {
|
this.swipercanvasData.forEach((data) => {
|
if (data.cameraId == id) {
|
data.baseImg = url;
|
}
|
});
|
//this.Camera.baseImg = url
|
},
|
getCanvasData() {},
|
newUid() {
|
let originStr = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
let originChar = "0123456789abcdef";
|
let len = originChar.length;
|
return originStr.replace(/x/g, function (match) {
|
return originChar.charAt(Math.floor(Math.random() * len));
|
});
|
},
|
showRules() {
|
this.tableRuleList = [];
|
|
if (this.selectedCameraIds.length > 0) {
|
this.loadingRuleList = true;
|
let seq = this.newUid();
|
this.requestSeq = seq;
|
|
getLinkSceneRule({ cameraIds: this.selectedCameraIds })
|
.then((rsp) => {
|
this.loadingRuleList = false;
|
if (rsp && rsp.success && seq === this.requestSeq) {
|
this.tableRuleList = rsp.data;
|
|
// 统一规则编辑的数据结构
|
for (let i = 0; i < this.tableRuleList.length; i++) {
|
this.tableRuleList[i].group_rules = this.tableRuleList[i].rules;
|
}
|
}
|
// this.TreeDataPool.fetchTreeData();
|
})
|
.catch(() => {
|
this.loadingRuleList = false;
|
});
|
}
|
},
|
|
saveSceneRule(groupRule) {
|
const payload = { ...groupRule };
|
if (!payload.rules) {
|
this.$message({
|
type: "warning",
|
message: "规则参数有误",
|
});
|
|
return;
|
}
|
|
payload.cameraIds = this.selectedCameraIds;
|
|
saveLinkScene(payload)
|
.then((rsp) => {
|
if (rsp && rsp.success) {
|
//this.Camera.update();
|
this.initCameraData();
|
// this.showRules();
|
this.$notify({
|
type: "success",
|
message: "任务保存成功!",
|
});
|
} else {
|
this.$notify({
|
type: "error",
|
message: rsp.data,
|
});
|
}
|
})
|
.catch((err) => {
|
this.$message({
|
type: "error",
|
message: "保存失败!",
|
});
|
});
|
},
|
changeLoading(params) {
|
this.loading = params;
|
},
|
},
|
};
|
</script>
|
<style lang="scss">
|
.s-linkage-rules {
|
width: 100%;
|
//height: 100%;
|
//padding: 13px 0 20px;
|
position: relative;
|
.devide {
|
height: 10px;
|
background: #e9ebf2;
|
}
|
.top {
|
width: 100%;
|
padding: 10px 20px;
|
box-sizing: border-box;
|
.swiper-box {
|
height: 100%;
|
float: left;
|
width: 46%;
|
margin-top: -10px;
|
position: relative;
|
}
|
.swiper-container {
|
position: initial;
|
min-width: 472px;
|
width: 86%;
|
}
|
.swiper-slide {
|
position: relative;
|
width: 100%;
|
.item-card {
|
height: 110px !important;
|
max-width: 126px;
|
width: 100%;
|
position: absolute;
|
left: 0px;
|
right: 0px;
|
bottom: 0px;
|
top: 0px;
|
margin: auto;
|
background: #ffffff;
|
border: 1px solid #e2e2e2;
|
box-shadow: 0 5px 12px 0 rgba(0, 0, 0, 0.07);
|
border-radius: 4px;
|
cursor: pointer;
|
.icon-xingzhuangcopy {
|
position: relative;
|
left: 0px;
|
right: 0px;
|
bottom: 0px;
|
top: 5px;
|
margin: auto;
|
color: #959699;
|
}
|
|
.mask {
|
position: absolute;
|
width: 100%;
|
height: 100%;
|
background: rgba(0, 0, 0, 0.65);
|
/* filter: blur(20px); */
|
backdrop-filter: blur(1px) brightness(100%);
|
display: none;
|
}
|
@media screen and(max-width: 1440px) {
|
max-width: 110px;
|
}
|
}
|
.item-card:hover {
|
.mask {
|
display: block;
|
}
|
}
|
}
|
.swiper-pre-border,
|
.swiper-next-border {
|
width: 40px;
|
height: 40px;
|
position: absolute;
|
background: #8888;
|
top: 35%;
|
z-index: 99;
|
border-radius: 4em;
|
outline: none;
|
.icon-btn {
|
color: rgb(255, 255, 255);
|
text-align: center;
|
line-height: 38px;
|
cursor: pointer;
|
}
|
}
|
.swiper-pre-border {
|
left: 10px;
|
}
|
.swiper-pre-border:hover {
|
background: #666;
|
}
|
.swiper-next-border {
|
right: 10px;
|
}
|
.swiper-next-border:hover {
|
background: #666;
|
}
|
.top-right {
|
float: right;
|
width: 54%;
|
height: 144px;
|
.card-box {
|
width: 54% !important;
|
}
|
.eCharts-box {
|
width: 45%;
|
canvas {
|
width: 98% !important;
|
}
|
}
|
}
|
.task-css {
|
text-align: left;
|
margin-bottom: 14px;
|
}
|
}
|
|
.bottom {
|
width: 100%;
|
margin-bottom: 20px;
|
.bottom-side {
|
height: 100%;
|
width: 250px;
|
float: left;
|
overflow: auto;
|
border-right: 1px solid #ccc;
|
border-bottom: 1px solid #ccc;
|
padding: 10px;
|
box-sizing: border-box;
|
.selectTask {
|
margin: 10px auto;
|
width: 140px;
|
padding: 10px;
|
box-sizing: border-box;
|
border: 1px solid #ccc;
|
position: relative;
|
.selectTaskDelete {
|
position: absolute;
|
right: 10px;
|
font-size: 18px;
|
cursor: pointer;
|
}
|
}
|
}
|
.bottom-right {
|
padding: 10px 20px 20px;
|
box-sizing: border-box;
|
.draw-and-time-box {
|
height: 410px;
|
width: 100%;
|
.draw-box,
|
.time-box {
|
float: left;
|
width: 50%;
|
height: 100%;
|
.img-box {
|
height: calc(100% - 32px);
|
width: 100%;
|
// padding: 5px;
|
box-sizing: border-box;
|
display: flex;
|
// justify-content: center;
|
// align-items: center;
|
position: relative;
|
overflow: hidden;
|
.refresh-btn {
|
position: absolute;
|
right: 10px;
|
top: 10px;
|
}
|
img {
|
width: 90%;
|
padding: 5px;
|
box-sizing: border-box;
|
}
|
.swiper-box-container2 {
|
width: 100%;
|
//padding: 8px 8px 0px 8px;
|
.el-card__body {
|
height: 100%;
|
padding: 0px;
|
}
|
height: calc(100% - 10px);
|
.info {
|
width: 100%;
|
height: 100%;
|
.info-left {
|
width: 50%;
|
height: 100%;
|
float: left;
|
img {
|
width: 100%;
|
}
|
}
|
.info-right {
|
width: 50%;
|
height: 100%;
|
float: left;
|
box-sizing: border-box;
|
padding: 10px;
|
p {
|
padding: 4px 0px;
|
}
|
.infoIcon {
|
height: 24px;
|
cursor: pointer;
|
i {
|
margin: 5px;
|
font-size: 22px;
|
}
|
}
|
}
|
}
|
}
|
.swiper-local-prev,
|
.swiper-local-next {
|
width: 40px;
|
height: 40px;
|
position: absolute;
|
background: #8888;
|
top: 40%;
|
z-index: 99;
|
border-radius: 4em;
|
outline: none;
|
.icon-btn {
|
color: rgb(255, 255, 255);
|
text-align: center;
|
line-height: 38px;
|
cursor: pointer;
|
}
|
}
|
.swiper-local-prev {
|
left: 10px;
|
}
|
.swiper-local-prev:hover {
|
background: #666;
|
}
|
.swiper-local-next {
|
left: 90%;
|
}
|
.swiper-local-next:hover {
|
background: #666;
|
}
|
.camera-tip {
|
position: relative;
|
width: 300px;
|
top: 40%;
|
left: 40%;
|
font-size: 12px;
|
color: #cccccc;
|
font-family: PingFangSC-Regular;
|
}
|
}
|
}
|
.draw-box {
|
width: 576px;
|
}
|
}
|
}
|
.bottom-right::-webkit-scrollbar {
|
width: 0 !important;
|
}
|
}
|
|
.add-btn {
|
color: #3d68e1;
|
margin-left: 10px;
|
font-size: 14px;
|
cursor: pointer;
|
}
|
.add-btn:hover {
|
color: #2249b4;
|
}
|
}
|
</style>
|
<style lang="scss" scoped>
|
.el-loading-spinner {
|
background: url("/images/cameraAccess/loading.gif") no-repeat;
|
top: 50%;
|
margin-top: -21px;
|
width: calc(100% - 260px) !important;
|
text-align: center;
|
position: absolute;
|
margin-left: 260px;
|
.el-loading-text {
|
color: #3d68e1;
|
margin: 3px 0;
|
font-size: 14px;
|
text-align: left;
|
margin-top: 22px !important;
|
padding-left: 30px;
|
}
|
}
|
</style>
|