<template>
|
<div class="CameraBox">
|
<div v-if="camera.cameraId">
|
<div class="header">
|
<i class="iconfont"></i>
|
<div class="name">{{ camera.cameraName }}</div>
|
<el-switch
|
v-model="camera.analytics"
|
@change="pollEnable"
|
active-color="#D4E3FA"
|
inactive-color="#E9EBEE"
|
:width="56"
|
>
|
</el-switch>
|
</div>
|
|
<div class="body">
|
<div class="row" v-if="camera.analytics">
|
<div class="label">处理方式:</div>
|
<div
|
class="button pollingBtn"
|
:class="{ active: !camera.dealWay }"
|
@click="changePoll(false)"
|
>
|
轮询
|
</div>
|
<div
|
class="button realtimeBtn"
|
:class="{ active: camera.dealWay }"
|
@click="changePoll(true)"
|
>
|
实时
|
</div>
|
</div>
|
<div class="row">
|
<div class="label">分辨率:</div>
|
<div class="data">
|
{{
|
camera.camearInfo.resolutionWidth == 0 ||
|
camera.camearInfo.resolutionHeight == 0 ||
|
!camera.camearInfo.resolutionHeight ||
|
!camera.camearInfo.resolutionWidth
|
? "本机分辨率"
|
: `${camera.camearInfo.resolutionWidth} * ${camera.camearInfo.resolutionHeight}`
|
}}
|
</div>
|
</div>
|
</div>
|
|
<div class="footer">
|
<!-- <div class="button addModel">添加到模板</div> -->
|
<div class="button addRule" @click="addRule">添加新场景</div>
|
</div>
|
</div>
|
|
<div class="empty" v-else>暂未获得摄像机信息</div>
|
</div>
|
</template>
|
|
<script>
|
import { changeRunType } from "@/api/pollConfig";
|
|
export default {
|
props: {
|
camera: {
|
type: Object,
|
},
|
},
|
|
data() {
|
return {};
|
},
|
methods: {
|
//是否进行视频分析处理
|
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.TreeDataPool.fetchTreeData();
|
});
|
}
|
// this.PollData.statisticTaskInfo();
|
},
|
|
//实时、轮询切换
|
changePoll(row) {
|
if (!this.camera.analytics) {
|
return;
|
}
|
|
//判断是新增还是更新
|
if (this.camera.cameraId && this.camera.cameraId !== undefined) {
|
if (this.PollData.RealTimeSum < this.PollData.channelTotal) {
|
if (row) {
|
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();
|
}
|
},
|
|
// 显示新增弹窗
|
addRule() {
|
this.$emit("addSeparateRule");
|
},
|
},
|
};
|
</script>
|
|
<style lang="scss" scoped>
|
.CameraBox {
|
width: 236px;
|
height: 198px;
|
border-radius: 5px;
|
background-color: #fff;
|
filter: drop-shadow(0px 2px 16px rgba(0, 43, 106, 0.25));
|
|
.header {
|
display: flex;
|
box-sizing: border-box;
|
padding: 0 10px;
|
height: 44px;
|
background: #f0f5fa;
|
align-items: center;
|
|
i {
|
font-size: 18px;
|
margin-right: 6px;
|
color: #0065ff;
|
}
|
|
.name {
|
width: 136px;
|
font-size: 14px;
|
color: #5f5f5f;
|
}
|
|
.el-switch ::v-deep {
|
height: 24px;
|
.el-switch__core {
|
height: 24px;
|
border-radius: 16px;
|
}
|
.el-switch__core::after {
|
margin-top: 2px;
|
margin-left: 3px;
|
width: 16px;
|
height: 16px;
|
background: #999999;
|
}
|
}
|
.el-switch.is-checked ::v-deep {
|
.el-switch__core::after {
|
margin-left: -20px;
|
|
background-color: #0065ff;
|
}
|
}
|
}
|
|
.body {
|
box-sizing: border-box;
|
padding: 0 10px 20px 10px;
|
border-bottom: 1px solid #e9ebee;
|
.row {
|
margin-top: 20px;
|
display: flex;
|
align-items: center;
|
|
.label {
|
width: 70px;
|
font-size: 12px;
|
color: #666;
|
}
|
|
.button {
|
position: relative;
|
width: 73px;
|
height: 24px;
|
text-align: center;
|
border: 1px solid #c0c5cc;
|
font-size: 12px;
|
color: #999;
|
border-radius: 5px;
|
line-height: 24px;
|
|
&.pollingBtn {
|
&.active {
|
z-index: 1;
|
background: #ff6a00;
|
border: 1px solid #ff6a00;
|
color: #fff;
|
}
|
}
|
|
&.realtimeBtn {
|
margin-left: -5px;
|
background-color: #fff;
|
|
&.active {
|
z-index: 1;
|
background: #0065ff;
|
border: 1px solid #0065ff;
|
color: #fff;
|
}
|
}
|
}
|
}
|
}
|
|
.footer {
|
box-sizing: border-box;
|
padding: 10px;
|
display: flex;
|
align-items: center;
|
|
.addModel {
|
margin-right: 10px;
|
width: 102px;
|
height: 32px;
|
text-align: center;
|
line-height: 32px;
|
border: 1px solid #0065ff;
|
color: #0065ff;
|
}
|
|
.addRule {
|
width: 102px;
|
height: 32px;
|
text-align: center;
|
line-height: 32px;
|
border: 1px solid #0065ff;
|
background-color: #0065ff;
|
color: #fff;
|
}
|
}
|
}
|
|
.empty {
|
box-sizing: border-box;
|
padding-top: 80px;
|
text-align: center;
|
color: #ccc;
|
}
|
</style>
|