<template>
|
<div class="s-separate-rules">
|
<div class="ai">
|
<div class="check-area">
|
<el-row class="mt5">
|
<el-col :span="24">
|
<div class="ai-select">
|
<div style="float:left;" v-show="cameraType === 'camera'">
|
<span>
|
<span class="label">视频分析处理</span>
|
<el-switch
|
style="margin-left: 10px;"
|
v-model="Camera.analytics"
|
@change="pollEnable"
|
:disabled="!Camera.cameraId"
|
></el-switch>
|
</span>
|
</div>
|
|
<div
|
v-if="Camera.analytics"
|
style="float:left;margin-left: 5%;"
|
class="flex-box"
|
v-show="cameraType === 'camera'"
|
>
|
<span class="label" style="margin-right:10px;line-height: 22px;">处理方式</span>
|
<toggle-button
|
:value="Camera.dealWay"
|
:width="60"
|
:labels="{checked: '实时', unchecked: '轮询'}"
|
:color="{checked: '#3D68E1', unchecked: '#FF7733', disabled: '#CCCCCC'}"
|
:sync="true"
|
@change="changePoll"
|
/>
|
</div>
|
|
<div
|
v-if="Camera.analytics"
|
style="float:left;margin-left:5%;"
|
class="flex-box"
|
v-show="cameraType === 'camera'"
|
>
|
<span class="label" style="line-height:25px">分辨率</span>
|
<el-select
|
v-model="Camera.selectResolution"
|
placeholder="请选择"
|
size="mini"
|
style="width: 134px;height: 30px;
|
margin-left:10px;position: relative;bottom: 3px;"
|
>
|
<el-option
|
v-for="item in Camera.resolutionOption"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
></el-option>
|
</el-select>
|
</div>
|
|
<div v-if="Camera.analytics" style="float:left;margin-left:5%;" class="flex-box">
|
<span class="label" style="line-height:22px">智能计算节点: {{ Camera.runServerName}}</span>
|
</div>
|
|
<div
|
v-if="Camera.analytics"
|
style="float:left;margin-left: 5%;line-height: 22px;"
|
class="flex-box"
|
>
|
<span style="float:left;">算法快速通道</span>
|
<div class="flex-box" style="float: left;
|
margin-left: 5px;">
|
<el-tooltip
|
effect="dark"
|
content="复制此摄像机算法规则"
|
placement="bottom"
|
popper-class="atooltip"
|
>
|
<span
|
style="color:#3D68E1;cursor: pointer;font-size:23px;"
|
@click="ctrlC"
|
class="iconfont iconfuzhiguize"
|
></span>
|
</el-tooltip>
|
<el-tooltip
|
effect="dark"
|
:content="!TreeDataPool.ctrlCameraId?'粘贴算法规则':`粘贴算法规则,来源:${TreeDataPool.ctrlCameraName}`"
|
placement="bottom"
|
popper-class="atooltip"
|
>
|
<span
|
:style="!TreeDataPool.ctrlCameraId?'cursor: not-allowed;font-size:23px;':'color:#3D68E1;font-size:23px;cursor: pointer;'"
|
@click="ctrlV"
|
class="iconfont iconniantie ml5"
|
></span>
|
</el-tooltip>
|
</div>
|
</div>
|
</div>
|
</el-col>
|
</el-row>
|
</div>
|
</div>
|
|
<div
|
style="width: calc(100% + 76px);position: absolute;left: -38px;top:38px;height: 10px;background-color: #E9EBF2;"
|
></div>
|
|
<div class="top" style="top:60px;">
|
<p class="task-css">
|
<b style="font-size: 14px; line-height: 18px;">场景</b>
|
</p>
|
<div>
|
<slide-scene :sceneData="Camera.rules"></slide-scene>
|
<div class="top-right">
|
<sysinfo
|
:showRealPoll="cameraType === 'camera'"
|
:ShowLocalVedio="cameraType === 'dataStack'"
|
v-if="showSysInfo"
|
style="margin-left: 25px;margin-top:-10px"
|
/>
|
</div>
|
</div>
|
|
<!-- <swiper :options="swiperOption" class="swiper-box-container">
|
|
<swiper-slide v-for="(item, index) in 10" :key="index">
|
<div class="item-card">
|
<p style="color: #0066EB;padding-top: 20px;">
|
<b>{{ item }}</b>
|
</p>
|
</div>
|
</swiper-slide>
|
</swiper>
|
<div class="swiper-pre-border" >
|
<div class="icon-btn" slot="button-prev">
|
<i class="iconfont iconzuo"></i>
|
</div>
|
</div>
|
<div class="swiper-next-border" >
|
<div class="icon-btn" slot="button-next">
|
<i class="iconfont iconyou1"></i>
|
</div>
|
</div>-->
|
<!-- <swiper :options="swiperOption" class="swiper-box-container">
|
<span class="task-tip" v-show="Camera.rules.length == 0 ">暂无场景,请开始创建</span>
|
<swiper-slide v-for="(item, index) in Camera.rules" :key="index">
|
<div class="item-card">
|
<p style="color: #0066EB;padding-top: 20px;">
|
<b>{{ item.scene_name }}</b>
|
</p>
|
</div>
|
</swiper-slide>
|
</swiper>
|
<div class="swiper-pre-border" v-show="Camera.rules.length > 4 ">
|
<div class="icon-btn" slot="button-prev">
|
<i class="iconfont iconzuo"></i>
|
</div>
|
</div>
|
<div class="swiper-next-border" v-show="Camera.rules.length > 4 ">
|
<div class="icon-btn" slot="button-next">
|
<i class="iconfont iconyou1"></i>
|
</div>
|
</div>-->
|
|
<!-- 系统信息 -->
|
</div>
|
|
<div class="bottom" style="top:254px;">
|
<div
|
style="width: calc(100% + 100px);height: 10px;background-color: #E9EBF2;position:relative;left:-40px"
|
></div>
|
<div class="bottom-right">
|
<div class="draw-and-time-box">
|
<div class="draw-box">
|
<div class="draw-box-title">
|
<b style="font-size: 14px">绘制区域</b>
|
<span
|
class="el-dropdown-link"
|
@click="drawBaseImg"
|
style="position: relative;top: 5px; cursor:pointer"
|
>
|
<i class="iconfont iconbianji1" style="font-size: 28px; "></i>
|
</span>
|
</div>
|
<div style="width:590px;height:16px;">
|
<b
|
style="font-size:14px"
|
>{{ Camera.camearInfo.alias ? Camera.camearInfo.alias: Camera.camearInfo.name }}</b>
|
</div>
|
<div class="img-box">
|
<polygon-canvas
|
class="cavas"
|
ref="canvas"
|
v-if="showCanvas"
|
v-loading="loading"
|
element-loading-text="刷新中,请稍等..."
|
element-loading-background="rgba(0, 0, 0, 0.8)"
|
:isShowDrawArrow="false"
|
:disabled="false"
|
:snapshot_url="Camera.baseImg"
|
:canvasDataShow="Camera.canvasData"
|
:currentCameraId="Camera.cameraId"
|
:loading="Camera.loading"
|
:canvasWidth="canvasWidth"
|
:canvasHeight="canvasHeight"
|
@fromCanvas="getCanvasData"
|
@changeLoading="changeLoading"
|
@refresh="refresh"
|
></polygon-canvas>
|
</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="'sep'" />
|
</div>
|
</div>
|
|
<!-- 场景规则 -->
|
<scene-rule
|
:seletedCameras="[Camera]"
|
:tableRuleList="Camera.rules"
|
:onSaveScene="saveSceneRule"
|
@delete-rule="delScenRule"
|
></scene-rule>
|
</div>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
//import { timeSilderData } from "@/mockData/timeSilder";
|
import { savePolygon } from "@/api/polygon";
|
|
import {
|
pasteRules
|
} from '@/api/task';
|
|
import {
|
getAllTemplate,
|
saveCameraScene,
|
getCameraSceneRule,
|
} from '@/api/scene'
|
|
import { changeRunType } from "@/api/pollConfig";
|
|
import VideoRuleData from "@/Pool/VideoRuleData";
|
|
import TimeSlider from "./TimeSlider";
|
import polygonCanvas from "@/components/canvas";
|
import Sysinfo from "./SystemInfo";
|
|
import SceneRule from "./SceneRule";
|
import SlideScene from "./scene/SlideScene";
|
|
export default {
|
components: {
|
TimeSlider,
|
polygonCanvas,
|
Sysinfo,
|
SceneRule,
|
SlideScene
|
},
|
directives: {
|
focus: {
|
inserted: function (el) {
|
el.querySelector('input').focus()
|
}
|
}
|
},
|
computed: {
|
cameraType() {
|
return this.TreeDataPool.treeActiveName === 'camera' ? "camera" : "dataStack"
|
}
|
},
|
data() {
|
return {
|
mockSceneData: [],
|
loading: false,
|
Camera: new VideoRuleData(),
|
runType: -1,
|
swiperOption: {
|
slidesPerView: 5,
|
spaceBetween: 8,
|
pagination: {
|
el: ".swiper-pagination",
|
clickable: true
|
},
|
navigation: {
|
nextEl: ".swiper-next-border",
|
prevEl: ".swiper-pre-border"
|
}
|
},
|
tableRuleList: [],
|
|
cameraId: "",
|
activeTaskIndex: 0,
|
activeTaskId: "",
|
booleanValue: false,
|
showSysInfo: false,
|
showCanvas: true,
|
canvasWidth: 576,
|
canvasHeight: 324
|
};
|
},
|
mounted() {
|
this.mockAsync()
|
},
|
|
methods: {
|
mockAsync() {
|
setTimeout(() => {
|
this.mockSceneData = [
|
{ scenename: "name1", id: 1, icon: ["iconrenlianjiance", "icongetijingzhi"] },
|
{ scenename: "name2", id: 2, icon: ["iconchouyan-copy"] },
|
{
|
scenename: "name3",
|
id: 3,
|
icon: [
|
"iconrenshukouzhao",
|
"iconchouyan-copy",
|
"iconrenlianjiance",
|
"icongetijingzhi"
|
]
|
},
|
{
|
scenename: "name4",
|
id: 4,
|
icon: ["iconchouyan-copy", "iconrenlianjiance", "icongetijingzhi"]
|
},
|
{ scenename: "name5", id: 5, icon: ["icongetijingzhi"] },
|
{ scenename: "name6", id: 6, icon: ["iconrenshukouzhao", "icongetijingzhi"] },
|
{ scenename: "name7", id: 7, icon: ["iconrenlianjiance"] }
|
];
|
}, 3000)
|
},
|
drawBaseImg() {
|
this.$refs.canvas.showModal();
|
},
|
getCanvasData(data) {
|
let polyon = { ...data };
|
polyon.camera_id = this.Camera.cameraId;
|
savePolygon(polyon).then(rsp => {
|
this.Camera.getPolygon();
|
this.Camera.getCameraTask();
|
});
|
},
|
refresh(url) {
|
this.Camera.baseImg = url
|
},
|
// 初始化摄像机信息,父组件调用
|
async initCameraData(id) {
|
this.Camera = new VideoRuleData();
|
|
if (id && id !== "") {
|
this.loading = false;
|
this.Camera.cameraId = id;
|
await this.Camera.update();
|
}
|
|
this.$refs.timeSlider.activeTab = this.VideoManageData.TimeRules[0].id;
|
this.showSysInfo = true
|
// 判断正在执行实时或者轮询任务
|
this.PollData.CameraList.forEach(element => {
|
if (element.id === this.Camera.cameraId) {
|
this.runType = element.run_type;
|
}
|
})
|
|
},
|
saveSceneRule(groupRule) {
|
const payload = { ...groupRule }
|
payload.cameraIds = [this.Camera.cameraId];
|
saveCameraScene(payload).then(rsp => {
|
if (rsp && rsp.success) {
|
this.Camera.update();
|
this.$notify({
|
type: "success",
|
message: "策略保存成功!"
|
});
|
}
|
});
|
},
|
delScenRule() {
|
this.Camera.update();
|
},
|
changeLoading(params) {
|
this.loading = params
|
// console.log(this.loading,'changeLoading',params)
|
},
|
//是否进行视频分析处理
|
pollEnable(row) {
|
let val = 0
|
if (row) {
|
if (this.PollData.RealTimeSum < this.PollData.channelTotal) {
|
this.Camera.dealWay = true
|
val = 1
|
} else {
|
this.Camera.dealWay = false
|
val = 0
|
}
|
} else {
|
this.Camera.dealWay = false
|
val = -1
|
}
|
if (this.Camera.cameraId && this.Camera.cameraId !== undefined) {
|
changeRunType({ camera_ids: [this.Camera.cameraId], run_type: val }).then(
|
rsp => {
|
if (rsp && rsp.success) {
|
this.$notify({
|
type: "success",
|
message: "配置成功"
|
});
|
} else {
|
this.$notify({
|
type: "error",
|
message: "配置失败"
|
});
|
}
|
// this.selectCamera(this.TreeDataPool.selectedNode)
|
}
|
);
|
}
|
this.TreeDataPool.fetchTreeData();
|
this.PollData.statisticTaskInfo();
|
},
|
//实时、轮询切换
|
changePoll(row) {
|
//判断是新增还是更新
|
if (this.Camera.cameraId && this.Camera.cameraId !== undefined) {
|
if (this.PollData.RealTimeSum < this.PollData.channelTotal) {
|
if (row.value) {
|
this.Camera.dealWay = true
|
} else {
|
this.Camera.dealWay = false
|
}
|
changeRunType({ camera_ids: [this.Camera.cameraId], run_type: this.Camera.dealWay ? 1 : 0 }).then(
|
rsp => {
|
if (rsp && rsp.success) {
|
this.$notify({
|
type: "success",
|
message: "配置成功"
|
});
|
} else {
|
this.$notify({
|
type: "error",
|
message: "配置失败"
|
});
|
}
|
}
|
);
|
} else {
|
if (this.Camera.dealWay) {
|
this.Camera.dealWay = false
|
changeRunType({ camera_ids: [this.Camera.cameraId], run_type: this.Camera.dealWay ? 1 : 0 }).then(
|
rsp => {
|
if (rsp && rsp.success) {
|
this.$notify({
|
type: "success",
|
message: "配置成功"
|
});
|
} else {
|
this.$notify({
|
type: "error",
|
message: "配置失败"
|
});
|
}
|
}
|
);
|
}
|
}
|
this.TreeDataPool.fetchTreeData();
|
this.PollData.statisticTaskInfo();
|
}
|
},
|
//复制
|
ctrlC() {
|
this.TreeDataPool.ctrlCameraId = this.Camera.cameraId;
|
this.TreeDataPool.ctrlCameraName = this.Camera.cameraName;
|
this.$notify({
|
type: "success",
|
message: "复制算法成功!"
|
})
|
},
|
ctrlV() {
|
if (this.Camera.cameraId === this.TreeDataPool.ctrlCameraId) {
|
this.$notify({
|
type: "warning",
|
message: "不能粘贴本摄像机的算法到本摄像机!"
|
})
|
return false;
|
}
|
pasteRules({
|
sourceId: this.TreeDataPool.ctrlCameraId,
|
targetIds: [this.Camera.cameraId]
|
}).then((res) => {
|
// console.log(res,'复制算法')
|
if (res && res.success) {
|
this.$notify({
|
type: "success",
|
message: "粘贴算法成功!"
|
})
|
this.initCameraData(this.Camera.cameraId)
|
} else {
|
this.$notify({
|
type: "error",
|
message: "粘贴算法失败!"
|
})
|
}
|
}).catch(err => {
|
// console.log(err,'复制算法报错!')
|
this.$notify({
|
type: "error",
|
message: "粘贴算法失败!"
|
})
|
})
|
},
|
}
|
};
|
</script>
|
<style lang="scss">
|
.s-separate-rules {
|
width: 100%;
|
height: 100%;
|
position: relative;
|
.ai {
|
width: calc(100% + 76px);
|
height: 38px;
|
position: absolute;
|
left: -38px;
|
.check-area {
|
width: 100%;
|
height: 100%;
|
float: left;
|
overflow: auto;
|
padding: 0 38px;
|
-webkit-box-sizing: border-box;
|
box-sizing: border-box;
|
}
|
}
|
.top {
|
width: 100%;
|
height: 174px;
|
position: relative;
|
top: 60px;
|
.swiper-box {
|
height: 100%;
|
float: left;
|
width: 48%;
|
margin-top: -10px;
|
position: relative;
|
}
|
.swiper-container {
|
position: initial;
|
min-width: 472px;
|
width: 80%;
|
|
// height: 124px;
|
}
|
.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: 1280px) {
|
// max-width: 110px;
|
// }
|
@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: 52%;
|
height: 144px;
|
}
|
.task-css {
|
text-align: left;
|
margin-bottom: 14px;
|
}
|
}
|
.bottom {
|
width: 100%;
|
height: calc(100% - 234px);
|
position: absolute;
|
top: 234px;
|
.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 {
|
width: calc(100% + 30px);
|
height: 100%;
|
float: left;
|
overflow: auto;
|
padding: 10px 0px;
|
box-sizing: border-box;
|
.draw-and-time-box {
|
height: 400px;
|
width: 100%;
|
//min-width: 1150px;
|
.draw-box,
|
.time-box {
|
float: left;
|
height: 100%;
|
.img-box {
|
height: calc(100% - 32px);
|
//width: 90%;
|
// 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-container {
|
margin-top: -10px;
|
text-align: left;
|
padding: 0px 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;
|
}
|
}
|
}
|
}
|
}
|
.pre-border,
|
.next-border {
|
width: 40px;
|
height: 40px;
|
position: absolute;
|
background: #8888;
|
top: 34%;
|
z-index: 99;
|
border-radius: 4em;
|
outline: none;
|
.icon-btn {
|
color: rgb(255, 255, 255);
|
text-align: center;
|
line-height: 38px;
|
cursor: pointer;
|
}
|
}
|
.pre-border {
|
left: -9px;
|
}
|
.pre-border:hover {
|
background: #666;
|
}
|
.next-border {
|
right: 10px;
|
}
|
.next-border:hover {
|
background: #666;
|
}
|
}
|
}
|
.draw-box {
|
width: 576px;
|
}
|
.draw-box-title {
|
text-align: left;
|
margin-top: -3px;
|
.btn-css {
|
position: relative;
|
left: 514px;
|
margin-bottom: 3px;
|
}
|
}
|
}
|
}
|
.bottom-right::-webkit-scrollbar {
|
width: 0 !important;
|
}
|
}
|
|
.add-btn {
|
color: #3d68e1;
|
margin-left: 10px;
|
font-size: 14px;
|
cursor: pointer;
|
}
|
.add-btn:hover {
|
color: #2249b4;
|
}
|
.nocamera-css {
|
cursor: not-allowed;
|
color: #3d68e1;
|
margin-left: 10px;
|
font-size: 14px;
|
}
|
.task-tip {
|
font-family: PingFangSC-Regular;
|
font-size: 12px;
|
color: #cccccc;
|
margin-top: 10%;
|
margin-left: 38%;
|
}
|
|
.marker {
|
display: inline-block;
|
width: 8px;
|
height: 8px;
|
border-radius: 10px;
|
margin-right: 7px;
|
background: #3d68e1;
|
}
|
.loadingClass {
|
text-align: center;
|
}
|
.el-loading-spinner-div {
|
}
|
}
|
</style>
|
<style lang="scss" scoped>
|
.el-dropdown-menu {
|
width: 200px;
|
.el-dropdown-menu__item {
|
overflow: hidden;
|
white-space: nowrap;
|
text-overflow: ellipsis;
|
}
|
}
|
.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>
|