From 61167e460b5273b05a23854742e3e450e656cd08 Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期一, 18 七月 2022 16:08:14 +0800
Subject: [PATCH] 修复国标摄像机配置相关的bug
---
src/api/pollConfig.ts | 34
src/components/canvas/index.vue | 514 ++++++---------
src/components/wasmPlayer/index.vue | 472 ++++++--------
src/pages/cameraAccess/components/CameraInfo.vue | 432 +++++--------
src/pages/cameraAccess/components/SeparateRules.vue | 379 +++++------
5 files changed, 761 insertions(+), 1,070 deletions(-)
diff --git a/src/api/pollConfig.ts b/src/api/pollConfig.ts
index 0abd33b..477f98e 100644
--- a/src/api/pollConfig.ts
+++ b/src/api/pollConfig.ts
@@ -1,36 +1,40 @@
-import request from "@/scripts/httpRequest";
-import qs from "qs";
+import request from "@/scripts/httpRequest"
+import qs from "qs"
export const getPollConfig = () => {
return request({
url: "/data/api-v/pollConfig/getPollConfig",
method: "get"
- });
-};
+ })
+}
export const changeRunType = (params: any) => {
+ let apiUrl = "/data/api-v/camera/changeRunType"
+ if (params.isGb) {
+ apiUrl = "/data/api-v/gb28181/camera/changeRunType"
+ }
return request({
- url: "/data/api-v/camera/changeRunType",
+ url: apiUrl,
method: "post",
data: params
- });
-};
+ })
+}
export const updatePollEnable = (params: any) => {
return request({
url: "/data/api-v/pollConfig/updateEnable",
method: "post",
data: params
- });
-};
+ })
+}
export const updatePollPeriod = (params: any) => {
return request({
url: "/data/api-v/pollConfig/savePollPeriod",
method: "post",
data: qs.stringify(params)
- });
-};
+ })
+}
export const getCamerasByServer = (query: any) => {
return request({
@@ -38,7 +42,7 @@
method: "get",
params: query
})
-};
+}
export const statisticRunInfo = (query: any) => {
return request({
@@ -46,12 +50,12 @@
method: "get",
params: query
})
-};
+}
export const updateChannelCount = (params: any) => {
return request({
url: "/data/api-v/pollConfig/updateChannelCount",
method: "post",
data: params
- });
-};
+ })
+}
diff --git a/src/components/canvas/index.vue b/src/components/canvas/index.vue
index a34a12d..89beb49 100644
--- a/src/components/canvas/index.vue
+++ b/src/components/canvas/index.vue
@@ -1,33 +1,21 @@
<template>
- <div
- class="s-cavas"
- :style="{ width: canvasWidth + 'px', height: canvasHeight + 'px' }"
- >
+ <div class="s-cavas" :style="{ width: canvasWidth + 'px', height: canvasHeight + 'px' }">
<canvas
ref="myCanvas"
:width="canvasWidth"
:height="canvasHeight"
- :style="`background:url(${canvasBg}) center / ${canvasWidth}px ${canvasHeight}px no-repeat; background-size: contain;`"
+ :style="
+ `background:url(${canvasBg}) center / ${canvasWidth}px ${canvasHeight}px no-repeat; background-size: contain;`
+ "
></canvas>
- <el-tooltip
- content="鍒锋柊搴曞浘"
- placement="bottom"
- popper-class="atooltip"
- v-if="isShowRefresh"
- >
+ <el-tooltip content="鍒锋柊搴曞浘" placement="bottom" popper-class="atooltip" v-if="isShowRefresh">
<span class="iconfont icongengxin" @click="refresh"></span>
</el-tooltip>
<p class="tip" :style="disabled ? `display:block;` : `display:none;`">
鎵归噺閰嶇疆鏂瑰紡涓嶅厑璁哥粯鍒跺尯鍩燂紝璇烽�夋嫨鎽勫儚鏈鸿繘琛屽尯鍩熺粯鍒�
</p>
- <el-dialog
- title
- :visible.sync="visible"
- width="1150px"
- append-to-body
- :before-close="cancelFunc"
- >
+ <el-dialog title :visible.sync="visible" width="1150px" append-to-body :before-close="cancelFunc">
<canvas-dialog
ref="bigCanvas"
:canvasDataToChild="canvasData"
@@ -36,98 +24,96 @@
></canvas-dialog>
<span slot="footer" class="dialog-footer">
<el-button @click="cancelFunc" size="small">鍙� 娑�</el-button>
- <el-button type="primary" @click="handleOk" size="small"
- >纭� 瀹�</el-button
- >
+ <el-button type="primary" @click="handleOk" size="small">纭� 瀹�</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
-import canvasDialog from "./Dialog";
-import { updateSnapshot } from "@/api/camera";
+import canvasDialog from "./Dialog"
+import { updateSnapshot } from "@/api/camera"
export default {
name: "myCanvas",
components: {
- canvasDialog,
+ canvasDialog
},
props: {
divId: {
default: "my-canvas",
- type: String,
+ type: String
},
isGB28181: {
default: false,
- type: Boolean,
+ type: Boolean
},
isShowRefresh: {
default: true,
- type: Boolean,
+ type: Boolean
},
sourceType: {
default: 1,
- type: Number,
+ type: Number
},
isShowDrawArrow: {
default: false,
- type: Boolean,
+ type: Boolean
},
disabled: {
default: false,
- type: Boolean,
+ type: Boolean
},
canvasDataShow: {
default: () => {
- return { line: [], rect: [], arrow: [], polygon: [] };
+ return { line: [], rect: [], arrow: [], polygon: [] }
},
- type: Object,
+ type: Object
},
currentCameraId: {
type: String,
- default: "",
+ default: ""
},
snapshot_url: {
type: String,
- default: "",
+ default: ""
},
isLink: {
type: Boolean,
- default: false,
+ default: false
},
loading: {
type: Boolean,
- default: false,
+ default: false
},
canvasWidth: {
type: Number,
- default: 576,
+ default: 576
},
canvasHeight: {
type: Number,
- default: 324,
+ default: 324
},
showProportion: {
type: Number,
- default: 1.666,
- },
+ default: 1.666
+ }
},
computed: {
canvasBg() {
if (this.snapshot_url) {
// 鏁版嵁鏍堣嚜鍔ㄤ笂浼犲鐞�
if (this.snapshot_url.indexOf("/opt/vasystem") == 0) {
- return this.snapshot_url.replace("/opt/vasystem", "");
+ return this.snapshot_url.replace("/opt/vasystem", "")
}
if (this.sourceType == 2) {
- return `${this.snapshot_url}`;
+ return `${this.snapshot_url}`
} else {
- return `/httpImage/${this.snapshot_url}`;
+ return `/httpImage/${this.snapshot_url}`
}
} else {
- return this.blackImg;
+ return this.blackImg
}
- },
+ }
},
data() {
return {
@@ -136,7 +122,7 @@
line: [],
rect: [],
arrow: [],
- polygon: [],
+ polygon: []
}, // 鏈�缁堣緭鍑虹殑鐢诲竷鍧愭爣鏁版嵁
canvasPic: new Image(), // 鎾ら攢鐢ㄧ殑鍥剧墖
canvasHistory: [], // 鍘嗗彶鏁版嵁锛屼互渚涙挙閿�浣跨敤
@@ -144,234 +130,172 @@
c: null,
ctx: null,
visible: false,
- baseImg: undefined,
+ baseImg: undefined
//showProportion: 1.666
- };
+ }
},
watch: {
loading: {
handler(newVal, oldVal) {
// console.log(newVal,'loading')
if (newVal) {
- this.baseImg = "";
- this.refresh();
+ this.baseImg = ""
+ this.refresh()
}
},
- deep: true,
+ deep: true
},
canvasDataShow: {
handler(newVal, oldVal) {
// console.log(newVal, "canvasDataShow newVal");
- this.canvasData.line = newVal.line;
- this.canvasData.rect = newVal.rect;
- this.canvasData.arrow = newVal.arrow;
- this.canvasData.polygon = newVal.polygon;
- this.clickSelect(this.canvasData);
+ this.canvasData.line = newVal.line
+ this.canvasData.rect = newVal.rect
+ this.canvasData.arrow = newVal.arrow
+ this.canvasData.polygon = newVal.polygon
+ this.clickSelect(this.canvasData)
},
- deep: true,
- },
+ deep: true
+ }
},
mounted() {
this.$nextTick(() => {
// this.c = document.querySelector("#" + this.divId);
- this.c = this.$refs.myCanvas;
- this.ctx = this.c.getContext("2d");
- this.canvasData = JSON.parse(JSON.stringify(this.canvasDataShow));
- this.clickSelect(this.canvasData);
- });
+ this.c = this.$refs.myCanvas
+ this.ctx = this.c.getContext("2d")
+ this.canvasData = JSON.parse(JSON.stringify(this.canvasDataShow))
+ this.clickSelect(this.canvasData)
+ })
},
methods: {
// 鑾峰彇canvas搴曞浘
async getCanvasPic() {
- if (TreeDataPool.selectedNode.type == "MENU") {
- return;
+ if (this.TreeDataPool.selectedNode.type == "MENU") {
+ return
}
// this.$emit('changeBaseImg',this.currentCameraId)
- this.$emit("changeLoading", true);
+ this.$emit("changeLoading", true)
if (this.currentCameraId) {
- let _this = this;
+ let _this = this
await updateSnapshot(this.currentCameraId, this.isGB28181)
.then((res) => {
if (res.data.cameraId === _this.currentCameraId) {
- this.baseImg = res.data.snapshotUrl;
- this.$emit(
- "refresh",
- res.data.snapshotUrl,
- _this.currentCameraId
- );
- this.$forceUpdate();
+ this.baseImg = res.data.snapshotUrl
+ this.$emit("refresh", res.data.snapshotUrl, _this.currentCameraId)
+ this.$forceUpdate()
this.$notify({
type: "success",
- message: "搴曞浘宸插埛鏂�",
- });
+ message: "搴曞浘宸插埛鏂�"
+ })
}
})
.catch((err) => {
this.$notify({
type: "error",
- message: "搴曞浘鍒锋柊澶辫触",
- });
- });
- this.$emit("changeLoading", false);
+ message: "搴曞浘鍒锋柊澶辫触"
+ })
+ })
+ this.$emit("changeLoading", false)
}
},
showModal() {
// console.log(this.canvasData, "鐐瑰嚮缁樺埗鐨勬椂鍊欎紶閫掕繃鍘荤殑鏁版嵁");
- this.visible = true;
+ this.visible = true
this.$nextTick(() => {
// this.$refs.bigCanvas.delCursor = {}
- });
+ })
},
cancelFunc() {
- this.visible = false;
- this.$refs.bigCanvas.cancel();
+ this.visible = false
+ this.$refs.bigCanvas.cancel()
// console.log("鍏抽棴浜�");
},
handleOk() {
// 鍒ゆ柇鍥惧舰鐨勫悕瀛楁槸鍚﹂噸澶�
// console.log("ok");
- this.$refs.bigCanvas.changeType("0");
- let repeatName = this.isRepeat();
+ this.$refs.bigCanvas.changeType("0")
+ let repeatName = this.isRepeat()
if (repeatName !== "") {
this.$notify({
type: "error",
- message: repeatName + "鍥惧舰鍚嶇О閲嶅锛岃鏇存锛�",
- });
- return;
+ message: repeatName + "鍥惧舰鍚嶇О閲嶅锛岃鏇存锛�"
+ })
+ return
}
this.$notify({
type: "success",
- message: "宸蹭繚瀛樼粯鍒讹紒",
- });
+ message: "宸蹭繚瀛樼粯鍒讹紒"
+ })
// 姣忔淇濆瓨鍏抽棴妯℃�佺獥鏃堕兘瑕佹妸妯℃�佺獥鐨勬暟鎹啓鍒扮埗缁勪欢閲屾潵
- this.canvasData = this.$refs.bigCanvas.canvasData;
+ this.canvasData = this.$refs.bigCanvas.canvasData
// 椤轰究鐢╁埌鏇村灞傚幓
- this.$emit("fromCanvas", this.$refs.bigCanvas.canvasData);
+ this.$emit("fromCanvas", this.$refs.bigCanvas.canvasData)
// console.log("浣犲ソ", this.canvasData);
- this.clickSelect(this.canvasData);
- this.visible = false;
+ this.clickSelect(this.canvasData)
+ this.visible = false
},
// 鍥炴樉cavas鏁版嵁
// 鐐瑰嚮閫変腑鍙樿壊 灏嗗綋鍓嶉〉闈㈡墍鏈夎矾寰勯噸缁樺垽鏂綋鍓嶉紶鏍囩殑鍧愭爣鍦ㄥ摢涓浘褰㈠唴 濡傛灉涓嶄紶鍧愭爣鍙傛暟灏辨槸鍥炴樉鐨勬柟娉�
clickSelect(e) {
- this.ctx.clearRect(0, 0, this.c.width, this.c.height);
- let _this = this; // 闆嗗悎涓亶鍘嗛渶瑕佸皢this杞瓨涓�涓嬩娇鐢�
- _this.canvasData.line.forEach(function (v, i) {
- _this.ctx.strokeStyle = "yellow";
- _this.ctx.beginPath();
- _this.ctx.moveTo(
- v.location[0].x / _this.showProportion,
- v.location[0].y / _this.showProportion
- );
- _this.ctx.lineTo(
- v.location[1].x / _this.showProportion,
- v.location[1].y / _this.showProportion
- );
- _this.ctx.stroke();
- _this.showRemarks(
- v.location[0].x / _this.showProportion,
- v.location[0].y / _this.showProportion,
- v.name
- );
- _this.c.style.cursor = "default";
+ this.ctx.clearRect(0, 0, this.c.width, this.c.height)
+ let _this = this // 闆嗗悎涓亶鍘嗛渶瑕佸皢this杞瓨涓�涓嬩娇鐢�
+ _this.canvasData.line.forEach(function(v, i) {
+ _this.ctx.strokeStyle = "yellow"
+ _this.ctx.beginPath()
+ _this.ctx.moveTo(v.location[0].x / _this.showProportion, v.location[0].y / _this.showProportion)
+ _this.ctx.lineTo(v.location[1].x / _this.showProportion, v.location[1].y / _this.showProportion)
+ _this.ctx.stroke()
+ _this.showRemarks(v.location[0].x / _this.showProportion, v.location[0].y / _this.showProportion, v.name)
+ _this.c.style.cursor = "default"
if (e && _this.ctx.isPointInStroke(e.offsetX, e.offsetY)) {
// 濡傛灉浼犲叆浜嗕簨浠跺潗鏍囷紝灏辩敤isPointInStroke鍒ゆ柇涓�涓�
// 濡傛灉褰撳墠鐜瑕嗙洊浜嗚鍧愭爣锛屽氨灏嗗浘褰㈢殑index鏀惧埌鏁扮粍閲�
// 褰撻紶鏍囩Щ鍏ヤ箣鍚庡皢褰撳墠鐨勬ā寮忓垏鎹负閫変腑妯″紡
- _this.type = "0";
- _this.delCursor.type = "1";
- _this.delCursor.index = i;
+ _this.type = "0"
+ _this.delCursor.type = "1"
+ _this.delCursor.index = i
// 灏嗗綋鍓嶅厓绱犳爣绾�
- _this.ctx.strokeStyle = "red";
- _this.ctx.beginPath();
- _this.ctx.moveTo(
- v.location[0].x / _this.showProportion,
- v.location[0].y / _this.showProportion
- );
- _this.ctx.lineTo(
- v.location[1].x / _this.showProportion,
- v.location[1].y / _this.showProportion
- );
- _this.ctx.stroke();
- _this.showRemarks(
- v.location[0].x / _this.showProportion,
- v.location[0].y / _this.showProportion,
- v.name
- );
- _this.c.style.cursor = "pointer";
+ _this.ctx.strokeStyle = "red"
+ _this.ctx.beginPath()
+ _this.ctx.moveTo(v.location[0].x / _this.showProportion, v.location[0].y / _this.showProportion)
+ _this.ctx.lineTo(v.location[1].x / _this.showProportion, v.location[1].y / _this.showProportion)
+ _this.ctx.stroke()
+ _this.showRemarks(v.location[0].x / _this.showProportion, v.location[0].y / _this.showProportion, v.name)
+ _this.c.style.cursor = "pointer"
}
- });
- _this.canvasData.rect.forEach(function (v, i) {
- _this.ctx.strokeStyle = "yellow";
- _this.ctx.beginPath();
- _this.ctx.moveTo(
- v.location[0].x / _this.showProportion,
- v.location[0].y / _this.showProportion
- );
- _this.ctx.lineTo(
- v.location[1].x / _this.showProportion,
- v.location[1].y / _this.showProportion
- );
- _this.ctx.lineTo(
- v.location[2].x / _this.showProportion,
- v.location[2].y / _this.showProportion
- );
- _this.ctx.lineTo(
- v.location[3].x / _this.showProportion,
- v.location[3].y / _this.showProportion
- );
- _this.ctx.lineTo(
- v.location[0].x / _this.showProportion,
- v.location[0].y / _this.showProportion
- );
- _this.ctx.stroke();
- _this.showRemarks(
- v.location[0].x / _this.showProportion,
- v.location[0].y / _this.showProportion,
- v.name
- );
- _this.c.style.cursor = "default";
+ })
+ _this.canvasData.rect.forEach(function(v, i) {
+ _this.ctx.strokeStyle = "yellow"
+ _this.ctx.beginPath()
+ _this.ctx.moveTo(v.location[0].x / _this.showProportion, v.location[0].y / _this.showProportion)
+ _this.ctx.lineTo(v.location[1].x / _this.showProportion, v.location[1].y / _this.showProportion)
+ _this.ctx.lineTo(v.location[2].x / _this.showProportion, v.location[2].y / _this.showProportion)
+ _this.ctx.lineTo(v.location[3].x / _this.showProportion, v.location[3].y / _this.showProportion)
+ _this.ctx.lineTo(v.location[0].x / _this.showProportion, v.location[0].y / _this.showProportion)
+ _this.ctx.stroke()
+ _this.showRemarks(v.location[0].x / _this.showProportion, v.location[0].y / _this.showProportion, v.name)
+ _this.c.style.cursor = "default"
if (e && _this.ctx.isPointInPath(e.offsetX, e.offsetY)) {
// 濡傛灉浼犲叆浜嗕簨浠跺潗鏍囷紝灏辩敤isPointInStroke鍒ゆ柇涓�涓�
// 褰撻紶鏍囩Щ鍏ヤ箣鍚庡皢褰撳墠鐨勬ā寮忓垏鎹负閫変腑妯″紡
- _this.type = "0";
- _this.delCursor.type = "2";
- _this.delCursor.index = i;
+ _this.type = "0"
+ _this.delCursor.type = "2"
+ _this.delCursor.index = i
// 灏嗗綋鍓嶅厓绱犳爣绾�
- _this.ctx.strokeStyle = "red";
- _this.ctx.beginPath();
- _this.ctx.moveTo(
- v.location[0].x / _this.showProportion,
- v.location[0].y / _this.showProportion
- );
- _this.ctx.lineTo(
- v.location[1].x / _this.showProportion,
- v.location[1].y / _this.showProportion
- );
- _this.ctx.lineTo(
- v.location[2].x / _this.showProportion,
- v.location[2].y / _this.showProportion
- );
- _this.ctx.lineTo(
- v.location[3].x / _this.showProportion,
- v.location[3].y / _this.showProportion
- );
- _this.ctx.lineTo(
- v.location[0].x / _this.showProportion,
- v.location[0].y / _this.showProportion
- );
- _this.ctx.stroke();
- _this.showRemarks(
- v.location[0].x / _this.showProportion,
- v.location[0].y / _this.showProportion,
- v.name
- );
- _this.c.style.cursor = "pointer";
+ _this.ctx.strokeStyle = "red"
+ _this.ctx.beginPath()
+ _this.ctx.moveTo(v.location[0].x / _this.showProportion, v.location[0].y / _this.showProportion)
+ _this.ctx.lineTo(v.location[1].x / _this.showProportion, v.location[1].y / _this.showProportion)
+ _this.ctx.lineTo(v.location[2].x / _this.showProportion, v.location[2].y / _this.showProportion)
+ _this.ctx.lineTo(v.location[3].x / _this.showProportion, v.location[3].y / _this.showProportion)
+ _this.ctx.lineTo(v.location[0].x / _this.showProportion, v.location[0].y / _this.showProportion)
+ _this.ctx.stroke()
+ _this.showRemarks(v.location[0].x / _this.showProportion, v.location[0].y / _this.showProportion, v.name)
+ _this.c.style.cursor = "pointer"
}
- });
- _this.canvasData.arrow.forEach(function (v, i) {
- _this.ctx.strokeStyle = "yellow";
+ })
+ _this.canvasData.arrow.forEach(function(v, i) {
+ _this.ctx.strokeStyle = "yellow"
// _this.ctx.beginPath()
// _this.ctx.moveTo(v.location[0].x / 2, v.location[0].y / 2)
// _this.ctx.lineTo(v.location[1].x / 2, v.location[1].y / 2)
@@ -385,22 +309,18 @@
20,
30,
"yellow"
- ); // 缁樺埗鏂规硶
- _this.showRemarks(
- v.location[0].x / _this.showProportion,
- v.location[0].y / _this.showProportion,
- v.name
- );
- _this.c.style.cursor = "default";
+ ) // 缁樺埗鏂规硶
+ _this.showRemarks(v.location[0].x / _this.showProportion, v.location[0].y / _this.showProportion, v.name)
+ _this.c.style.cursor = "default"
if (e && _this.ctx.isPointInStroke(e.offsetX, e.offsetY)) {
// 濡傛灉浼犲叆浜嗕簨浠跺潗鏍囷紝灏辩敤isPointInStroke鍒ゆ柇涓�涓�
// 濡傛灉褰撳墠鐜瑕嗙洊浜嗚鍧愭爣锛屽氨灏嗗浘褰㈢殑index鏀惧埌鏁扮粍閲�
// 褰撻紶鏍囩Щ鍏ヤ箣鍚庡皢褰撳墠鐨勬ā寮忓垏鎹负閫変腑妯″紡
- _this.type = "0";
- _this.delCursor.type = "4";
- _this.delCursor.index = i;
+ _this.type = "0"
+ _this.delCursor.type = "4"
+ _this.delCursor.index = i
// 灏嗗綋鍓嶅厓绱犳爣绾�
- _this.ctx.strokeStyle = "red";
+ _this.ctx.strokeStyle = "red"
// _this.ctx.beginPath()
// _this.ctx.moveTo(v.location[0].x / _this.showProportion, v.location[0].y / _this.showProportion)
// _this.ctx.lineTo(v.location[1].x / _this.showProportion, v.location[1].y / _this.showProportion)
@@ -414,78 +334,62 @@
20,
30,
"red"
- ); // 缁樺埗鏂规硶
- _this.showRemarks(
- v.location[0].x / _this.showProportion,
- v.location[0].y / _this.showProportion,
- v.name
- );
- _this.c.style.cursor = "pointer";
+ ) // 缁樺埗鏂规硶
+ _this.showRemarks(v.location[0].x / _this.showProportion, v.location[0].y / _this.showProportion, v.name)
+ _this.c.style.cursor = "pointer"
}
- });
- _this.canvasData.polygon.forEach(function (v, i) {
+ })
+ _this.canvasData.polygon.forEach(function(v, i) {
if (v.location.length === 0) {
- return;
+ return
}
- _this.ctx.strokeStyle = "yellow";
- _this.ctx.beginPath();
- _this.ctx.moveTo(
- v.location[0].x / _this.showProportion,
- v.location[0].y / _this.showProportion
- );
+ _this.ctx.strokeStyle = "yellow"
+ _this.ctx.beginPath()
+ _this.ctx.moveTo(v.location[0].x / _this.showProportion, v.location[0].y / _this.showProportion)
for (let i = 1; i < v.location.length; i++) {
- _this.ctx.lineTo(
- v.location[i].x / _this.showProportion,
- v.location[i].y / _this.showProportion
- );
+ _this.ctx.lineTo(v.location[i].x / _this.showProportion, v.location[i].y / _this.showProportion)
}
- _this.ctx.closePath();
- _this.ctx.stroke();
+ _this.ctx.closePath()
+ _this.ctx.stroke()
_this.showRemarks(
v.location[v.location.length - 1].x / _this.showProportion,
v.location[v.location.length - 1].y / _this.showProportion,
v.name
- );
- _this.c.style.cursor = "default";
+ )
+ _this.c.style.cursor = "default"
if (e && _this.ctx.isPointInPath(e.offsetX, e.offsetY)) {
// 濡傛灉浼犲叆浜嗕簨浠跺潗鏍囷紝灏辩敤isPointInStroke鍒ゆ柇涓�涓�
// 濡傛灉褰撳墠鐜瑕嗙洊浜嗚鍧愭爣锛屽氨灏嗗浘褰㈢殑index鏀惧埌鏁扮粍閲�
// 褰撻紶鏍囩Щ鍏ヤ箣鍚庡皢褰撳墠鐨勬ā寮忓垏鎹负閫変腑妯″紡
- _this.type = "0";
- _this.delCursor.type = "5";
- _this.delCursor.index = i;
+ _this.type = "0"
+ _this.delCursor.type = "5"
+ _this.delCursor.index = i
// 灏嗗綋鍓嶅厓绱犳爣绾�
- _this.ctx.strokeStyle = "red";
- _this.ctx.beginPath();
- _this.ctx.moveTo(
- v.location[0].x / _this.showProportion,
- v.location[0].y / _this.showProportion
- );
+ _this.ctx.strokeStyle = "red"
+ _this.ctx.beginPath()
+ _this.ctx.moveTo(v.location[0].x / _this.showProportion, v.location[0].y / _this.showProportion)
for (let i = 1; i < v.location.length; i++) {
- _this.ctx.lineTo(
- v.location[i].x / _this.showProportion,
- v.location[i].y / _this.showProportion
- );
+ _this.ctx.lineTo(v.location[i].x / _this.showProportion, v.location[i].y / _this.showProportion)
}
- _this.ctx.closePath();
- _this.ctx.stroke();
+ _this.ctx.closePath()
+ _this.ctx.stroke()
_this.showRemarks(
v.location[v.location.length - 1].x / _this.showProportion,
v.location[v.location.length - 1].y / _this.showProportion,
v.name
- );
- _this.c.style.cursor = "pointer";
+ )
+ _this.c.style.cursor = "pointer"
}
- });
+ })
},
// 鍥炴樉鍥惧舰澶囨敞
showRemarks(x, y, remarks) {
- this.ctx.moveTo(x, y - 10); // 鍥犱负鏀惧ぇ涔嬪悗鏄痽-20锛屾墍浠ョ缉灏忕増鐨勪负y-10
- this.ctx.fillStyle = "green"; // 璁剧疆濉厖棰滆壊涓虹豢鑹�
- this.ctx.font = '10px "寰蒋闆呴粦"'; // 璁剧疆瀛椾綋
- this.ctx.textBaseline = "bottom"; // 璁剧疆瀛椾綋搴曠嚎瀵归綈缁樺埗鍩虹嚎
- this.ctx.textAlign = "left"; // 璁剧疆瀛椾綋瀵归綈鐨勬柟寮�
- this.ctx.fillText(remarks, x, y - 10); // 濉厖鏂囧瓧
+ this.ctx.moveTo(x, y - 10) // 鍥犱负鏀惧ぇ涔嬪悗鏄痽-20锛屾墍浠ョ缉灏忕増鐨勪负y-10
+ this.ctx.fillStyle = "green" // 璁剧疆濉厖棰滆壊涓虹豢鑹�
+ this.ctx.font = '10px "寰蒋闆呴粦"' // 璁剧疆瀛椾綋
+ this.ctx.textBaseline = "bottom" // 璁剧疆瀛椾綋搴曠嚎瀵归綈缁樺埗鍩虹嚎
+ this.ctx.textAlign = "left" // 璁剧疆瀛椾綋瀵归綈鐨勬柟寮�
+ this.ctx.fillText(remarks, x, y - 10) // 濉厖鏂囧瓧
},
// 绠ご缁樺埗鍑芥暟
drawArrow(ctx, fromX, fromY, toX, toY, theta, headlen, width, color) {
@@ -496,86 +400,86 @@
// headlen锛氫笁瑙掓枩杈归暱搴�
// width锛氱澶寸嚎瀹藉害
// color锛氱澶撮鑹�
- theta = typeof theta !== "undefined" ? theta : 30;
- headlen = typeof theta !== "undefined" ? headlen : 10;
- width = typeof width !== "undefined" ? width : 1;
- color = typeof color !== "undefined" ? color : "yellow";
+ theta = typeof theta !== "undefined" ? theta : 30
+ headlen = typeof theta !== "undefined" ? headlen : 10
+ width = typeof width !== "undefined" ? width : 1
+ color = typeof color !== "undefined" ? color : "yellow"
// 璁$畻鍚勮搴﹀拰瀵瑰簲鐨凱2,P3鍧愭爣
- let angle = (Math.atan2(fromY - toY, fromX - toX) * 180) / Math.PI;
- let angle1 = ((angle + theta) * Math.PI) / 180;
- let angle2 = ((angle - theta) * Math.PI) / 180;
- let topX = headlen * Math.cos(angle1);
- let topY = headlen * Math.sin(angle1);
- let botX = headlen * Math.cos(angle2);
- let botY = headlen * Math.sin(angle2);
+ let angle = (Math.atan2(fromY - toY, fromX - toX) * 180) / Math.PI
+ let angle1 = ((angle + theta) * Math.PI) / 180
+ let angle2 = ((angle - theta) * Math.PI) / 180
+ let topX = headlen * Math.cos(angle1)
+ let topY = headlen * Math.sin(angle1)
+ let botX = headlen * Math.cos(angle2)
+ let botY = headlen * Math.sin(angle2)
- ctx.save();
- ctx.beginPath();
- let arrowX = fromX - topX;
- let arrowY = fromY - topY;
- ctx.moveTo(arrowX, arrowY);
- ctx.moveTo(fromX, fromY);
- ctx.lineTo(toX, toY);
- arrowX = toX + topX;
- arrowY = toY + topY;
- ctx.moveTo(arrowX, arrowY);
- ctx.lineTo(toX, toY);
- arrowX = toX + botX;
- arrowY = toY + botY;
- ctx.lineTo(arrowX, arrowY);
- ctx.strokeStyle = color;
- ctx.lineWidth = width;
- ctx.stroke();
- ctx.restore();
+ ctx.save()
+ ctx.beginPath()
+ let arrowX = fromX - topX
+ let arrowY = fromY - topY
+ ctx.moveTo(arrowX, arrowY)
+ ctx.moveTo(fromX, fromY)
+ ctx.lineTo(toX, toY)
+ arrowX = toX + topX
+ arrowY = toY + topY
+ ctx.moveTo(arrowX, arrowY)
+ ctx.lineTo(toX, toY)
+ arrowX = toX + botX
+ arrowY = toY + botY
+ ctx.lineTo(arrowX, arrowY)
+ ctx.strokeStyle = color
+ ctx.lineWidth = width
+ ctx.stroke()
+ ctx.restore()
},
async refresh() {
// console.log(this.loading,'鍒锋柊搴曞浘',this.snapshot_url)
if (!this.currentCameraId) {
- return false;
+ return false
}
// await this.$emit('changeLoading', true)
- this.getCanvasPic();
+ this.getCanvasPic()
},
// 鍒ゆ柇鍥惧舰鍚嶇О鏄惁閲嶅
isRepeat() {
- let _this = this; // 闆嗗悎涓亶鍘嗛渶瑕佸皢this杞瓨涓�涓嬩娇鐢�
- let nameArray = [];
+ let _this = this // 闆嗗悎涓亶鍘嗛渶瑕佸皢this杞瓨涓�涓嬩娇鐢�
+ let nameArray = []
for (const v of _this.$refs.bigCanvas.canvasData.line) {
for (const item of nameArray) {
if (v.name === item) {
- return v.name;
+ return v.name
}
}
- nameArray.push(v.name);
+ nameArray.push(v.name)
}
for (const v of _this.$refs.bigCanvas.canvasData.arrow) {
for (const item of nameArray) {
if (v.name === item) {
- return v.name;
+ return v.name
}
}
- nameArray.push(v.name);
+ nameArray.push(v.name)
}
for (const v of _this.$refs.bigCanvas.canvasData.rect) {
for (const item of nameArray) {
if (v.name === item) {
- return v.name;
+ return v.name
}
}
- nameArray.push(v.name);
+ nameArray.push(v.name)
}
for (const v of _this.$refs.bigCanvas.canvasData.polygon) {
for (const item of nameArray) {
if (v.name === item) {
- return v.name;
+ return v.name
}
}
- nameArray.push(v.name);
+ nameArray.push(v.name)
}
- return "";
- },
- },
-};
+ return ""
+ }
+ }
+}
</script>
<style lang="scss" scoped>
canvas {
diff --git a/src/components/wasmPlayer/index.vue b/src/components/wasmPlayer/index.vue
index aab90e2..ece0f02 100644
--- a/src/components/wasmPlayer/index.vue
+++ b/src/components/wasmPlayer/index.vue
@@ -1,12 +1,6 @@
<template>
<div class="video-player">
- <canvas
- v-show="showArea"
- id="area-canvas"
- ref="areaCanvas"
- width="960"
- height="540"
- ></canvas>
+ <canvas v-show="showArea" id="area-canvas" ref="areaCanvas" width="960" height="540"></canvas>
<div class="container" id="videoPlayer">
<div class="canvasDiv">
<div
@@ -14,12 +8,7 @@
element-loading-background="rgba(0, 0, 0, 0.8)"
style="position: unset !important"
></div>
- <canvas
- ref="playCanvas"
- id="paly-canvas"
- width="960"
- height="540"
- ></canvas>
+ <canvas ref="playCanvas" id="paly-canvas" width="960" height="540"></canvas>
</div>
<transition name="fade">
@@ -29,31 +18,16 @@
</transition>
<!-- 鎺у埗鏉� -->
- <section
- class="jsmodern-video-panel"
- :style="{ display: isStream ? 'none' : 'block' }"
- >
+ <section class="jsmodern-video-panel" :style="{ display: isStream ? 'none' : 'block' }">
<!-- 鎾斁/鏆傚仠 -->
- <b
- :class="
- playerStatus == 0 ? 'jsmodern-video-play' : 'jsmodern-video-pause'
- "
- @click="playVideo"
- ></b>
+ <b :class="playerStatus == 0 ? 'jsmodern-video-play' : 'jsmodern-video-pause'" @click="playVideo"></b>
<!-- 鏃堕棿 -->
- <span class="jsmodern-video-start" ref="timeLabel"
- >00:00:00/00:00:00</span
- >
+ <span class="jsmodern-video-start" ref="timeLabel">00:00:00/00:00:00</span>
<!-- 杩涘害鏉� -->
<div>
- <input
- class="jsmodern-video-linebox"
- ref="timeTrack"
- type="range"
- value="0"
- />
+ <input class="jsmodern-video-linebox" ref="timeTrack" type="range" value="0" />
</div>
<!-- 澹伴煶 -->
@@ -64,25 +38,15 @@
</div> -->
<!-- 鍏ㄥ睆 -->
- <b
- class="jsmodern-video-fullin"
- @click="fullScreen"
- :disable="false"
- ></b>
+ <b class="jsmodern-video-fullin" @click="fullScreen" :disable="false"></b>
<!-- 涓嬭浇 -->
- <i
- class="el-icon-download jsmodern-video-download"
- @click="downLoad"
- v-show="!isStream"
- ></i>
+ <i class="el-icon-download jsmodern-video-download" @click="downLoad" v-show="!isStream"></i>
</section>
<!-- 澶ф挱鏀炬寜閽� -->
<div v-show="!isStream">
- <span class="video-btn" v-show="playerStatus == 0" @click="playVideo"
- ><img src="./wasm/img/bo1.png"
- /></span>
+ <span class="video-btn" v-show="playerStatus == 0" @click="playVideo"><img src="./wasm/img/bo1.png"/></span>
<!-- 涓婁竴涓� -->
<span class="video-prve" v-show="showPrev">
@@ -109,80 +73,77 @@
/*
2021.09.22 娣诲姞澶氫釜褰曞儚鍦板潃鐨勫鐞�, 涓庡綍鍍忔ā鍧楃害瀹�, 鐢� || 鍒嗗壊澶氫釜瑙嗛鍦板潃, 鍓嶇澶勭悊鎾斁.
*/
-import { Player } from "./wasm/player";
-import VideoRuleData from "@/Pool/VideoRuleData";
-import { getAllPolygon } from "@/api/polygon";
+import { Player } from "./wasm/player"
+import VideoRuleData from "@/Pool/VideoRuleData"
+import { getAllPolygon } from "@/api/polygon"
export default {
name: "CameraPlayer",
props: {
videoUrl: {
type: String,
// default: "ws://192.168.1.182:10101/ws"
- default: `${location.protocol === "https" ? "wss" : "ws"}://${
- location.host
- }/ws`,
+ default: `${location.protocol === "https" ? "wss" : "ws"}://${location.host}/ws`
},
cameraName: {
type: String,
- default: "",
+ default: ""
},
cameraID: {
type: String,
- default: "C4668FD0-3CAE-C31F-C21E-28B7001243C4",
+ default: "C4668FD0-3CAE-C31F-C21E-28B7001243C4"
},
rtspUrl: {
type: String,
- default:
- "rtsp://admin:a1234567@192.168.1.201:554/h264/ch1/main/av_stream",
+ default: "rtsp://admin:a1234567@192.168.1.201:554/h264/ch1/main/av_stream"
},
isRunning: {
type: Boolean,
- default: false,
+ default: false
},
isGb: {
type: Boolean,
- default: false,
+ default: false
},
showArea: {
type: Boolean,
- default: false,
+ default: false
},
isStream: {
type: Boolean,
- default: true,
+ default: true
},
autoPlay: {
type: Boolean,
- default: false,
+ default: false
},
preload: {
type: Boolean,
- default: true,
- },
+ default: true
+ }
},
computed: {
poster() {
- return "/images/player/player_poster.gif?t=" + Math.random();
+ return "/images/player/player_poster.gif?t=" + Math.random()
},
showPrev() {
- return this.playerIndex - 1 >= 0;
+ return this.playerIndex - 1 >= 0
},
showNext() {
- return this.playerIndex + 1 < this.videoUrls.length;
- },
+ return this.playerIndex + 1 < this.videoUrls.length
+ }
},
data() {
return {
player: null,
playerId: 0,
- Camera: new VideoRuleData(this.isGb),
+ Camera: new VideoRuleData(this.cameraID, this.isGb),
showCanvas: true,
canvasData: {
line: [],
rect: [], // {id:'uuid', name: '鐭╁舰1', location: [{ x: 20, y: 30 }, { x: 20, y: 60 }, { x: 100, y: 60 }, { x: 100, y: 30 }] }
arrow: [],
- polygon: [],
+ polygon: []
},
//showProportion: 3.2,
//showProportionY: 3.58,
@@ -202,111 +163,90 @@
videoLoading: false,
loadUrl: "",
isFullScreen: false,
- fullScreenNotice: false,
- };
+ fullScreenNotice: false
+ }
},
watch: {
- rtspUrl: function (newVal, oldVal) {
+ rtspUrl: function(newVal, oldVal) {
if (newVal !== oldVal) {
if (this.player) {
- this.player.stop();
- !!this.algoDataSocket && this.algoDataSocket.close();
+ this.player.stop()
+ !!this.algoDataSocket && this.algoDataSocket.close()
}
this.$nextTick(() => {
- this.playVideo();
- });
+ this.playVideo()
+ })
}
},
- videoUrl: function (newVal, oldVal) {
+ videoUrl: function(newVal, oldVal) {
if (newVal !== oldVal) {
if (this.player) {
- this.player.stop();
+ this.player.stop()
}
this.$nextTick(() => {
- this.player.preloadFlag = 0;
- this.playVideo();
- });
+ this.player.preloadFlag = 0
+ this.playVideo()
+ })
}
- },
+ }
},
mounted() {
- this.player = new Player();
- this.player.preload = this.preload;
- this.player.statusCallback = this.setPlayerStatus;
+ this.player = new Player()
+ this.player.preload = this.preload
+ this.player.statusCallback = this.setPlayerStatus
if (this.isStream) {
- this.playVideo();
+ this.playVideo()
this.$nextTick(() => {
- this.canvas = this.$refs.areaCanvas;
- this.ctx = this.canvas.getContext("2d");
- this.ctx.lineWidth = 1;
- this.initArea();
- });
+ this.canvas = this.$refs.areaCanvas
+ this.ctx = this.canvas.getContext("2d")
+ this.ctx.lineWidth = 1
+ this.initArea()
+ })
} else {
// 褰曞儚URL澶勭悊, 鍙兘瀛樺湪澶氫釜褰曞儚鍦板潃
if (this.videoUrl === "") {
- this.playerStatus = -1;
- return;
+ this.playerStatus = -1
+ return
}
- this.videoUrls = this.videoUrl.split("||");
+ this.videoUrls = this.videoUrl.split("||")
if (this.autoPlay || this.preload) {
- this.playVideo();
+ this.playVideo()
}
}
},
beforeDestroy() {
- this.player.stop();
+ this.player.stop()
},
methods: {
// 鍥炴樉cavas鏁版嵁
// 鐐瑰嚮閫変腑鍙樿壊 灏嗗綋鍓嶉〉闈㈡墍鏈夎矾寰勯噸缁樺垽鏂綋鍓嶉紶鏍囩殑鍧愭爣鍦ㄥ摢涓浘褰㈠唴 濡傛灉涓嶄紶鍧愭爣鍙傛暟灏辨槸鍥炴樉鐨勬柟娉�
clickSelect(e) {
- this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
- let _this = this; // 闆嗗悎涓亶鍘嗛渶瑕佸皢this杞瓨涓�涓嬩娇鐢�
- _this.canvasData.line.forEach(function (v, i) {
- _this.ctx.strokeStyle = "yellow";
- _this.ctx.beginPath();
- _this.ctx.moveTo(
- v.location[0].x / _this.showProportion,
- v.location[0].y / _this.showProportion
- );
- _this.ctx.lineTo(
- v.location[1].x / _this.showProportion,
- v.location[1].y / _this.showProportion
- );
- _this.ctx.stroke();
- _this.canvas.style.cursor = "default";
- });
- _this.canvasData.rect.forEach(function (v, i) {
- _this.ctx.strokeStyle = "yellow";
- _this.ctx.beginPath();
- _this.ctx.moveTo(
- v.location[0].x / _this.showProportion,
- v.location[0].y / _this.showProportion
- );
- _this.ctx.lineTo(
- v.location[1].x / _this.showProportion,
- v.location[1].y / _this.showProportion
- );
- _this.ctx.lineTo(
- v.location[2].x / _this.showProportion,
- v.location[2].y / _this.showProportion
- );
- _this.ctx.lineTo(
- v.location[3].x / _this.showProportion,
- v.location[3].y / _this.showProportion
- );
- _this.ctx.lineTo(
- v.location[0].x / _this.showProportion,
- v.location[0].y / _this.showProportion
- );
- _this.ctx.stroke();
- _this.canvas.style.cursor = "default";
- });
- _this.canvasData.arrow.forEach(function (v, i) {
- _this.ctx.strokeStyle = "yellow";
+ this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height)
+ let _this = this // 闆嗗悎涓亶鍘嗛渶瑕佸皢this杞瓨涓�涓嬩娇鐢�
+ _this.canvasData.line.forEach(function(v, i) {
+ _this.ctx.strokeStyle = "yellow"
+ _this.ctx.beginPath()
+ _this.ctx.moveTo(v.location[0].x / _this.showProportion, v.location[0].y / _this.showProportion)
+ _this.ctx.lineTo(v.location[1].x / _this.showProportion, v.location[1].y / _this.showProportion)
+ _this.ctx.stroke()
+ _this.canvas.style.cursor = "default"
+ })
+ _this.canvasData.rect.forEach(function(v, i) {
+ _this.ctx.strokeStyle = "yellow"
+ _this.ctx.beginPath()
+ _this.ctx.moveTo(v.location[0].x / _this.showProportion, v.location[0].y / _this.showProportion)
+ _this.ctx.lineTo(v.location[1].x / _this.showProportion, v.location[1].y / _this.showProportion)
+ _this.ctx.lineTo(v.location[2].x / _this.showProportion, v.location[2].y / _this.showProportion)
+ _this.ctx.lineTo(v.location[3].x / _this.showProportion, v.location[3].y / _this.showProportion)
+ _this.ctx.lineTo(v.location[0].x / _this.showProportion, v.location[0].y / _this.showProportion)
+ _this.ctx.stroke()
+ _this.canvas.style.cursor = "default"
+ })
+ _this.canvasData.arrow.forEach(function(v, i) {
+ _this.ctx.strokeStyle = "yellow"
_this.drawArrow(
_this.ctx,
v.location[0].x / _this.showProportion,
@@ -316,44 +256,28 @@
20,
30,
"yellow"
- );
- _this.canvas.style.cursor = "default";
- });
- _this.canvasData.polygon.forEach(function (v, i) {
+ )
+ _this.canvas.style.cursor = "default"
+ })
+ _this.canvasData.polygon.forEach(function(v, i) {
if (v.location && v.location.length === 0) {
- return;
+ return
}
- _this.ctx.strokeStyle = "yellow";
- _this.ctx.beginPath();
- _this.ctx.moveTo(
- v.location[0].x / _this.showProportion,
- v.location[0].y / _this.showProportionY
- );
+ _this.ctx.strokeStyle = "yellow"
+ _this.ctx.beginPath()
+ _this.ctx.moveTo(v.location[0].x / _this.showProportion, v.location[0].y / _this.showProportionY)
for (let i = 1; i < v.location.length; i++) {
- _this.ctx.lineTo(
- v.location[i].x / _this.showProportion,
- v.location[i].y / _this.showProportionY
- );
+ _this.ctx.lineTo(v.location[i].x / _this.showProportion, v.location[i].y / _this.showProportionY)
}
- _this.ctx.closePath();
- _this.ctx.stroke();
- _this.canvas.style.cursor = "default";
- });
+ _this.ctx.closePath()
+ _this.ctx.stroke()
+ _this.canvas.style.cursor = "default"
+ })
},
// 绠ご缁樺埗鍑芥暟
- drawArrow(
- ctx,
- fromX,
- fromY,
- toX,
- toY,
- theta = 30,
- headlen = 10,
- width = 1,
- color = "yellow"
- ) {
+ drawArrow(ctx, fromX, fromY, toX, toY, theta = 30, headlen = 10, width = 1, color = "yellow") {
// ctx锛欳anvas缁樺浘鐜
// fromX, fromY锛氳捣鐐瑰潗鏍囷紙涔熷彲浠ユ崲鎴恜1锛屽彧涓嶈繃瀹冩槸涓�涓暟缁勶級
// toX, toY锛氱粓鐐瑰潗鏍� (涔熷彲浠ユ崲鎴恜2锛屽彧涓嶈繃瀹冩槸涓�涓暟缁�)
@@ -366,110 +290,110 @@
// width = typeof width !== "undefined" ? width : 1;
// color = typeof color !== "undefined" ? color : "yellow";
// 璁$畻鍚勮搴﹀拰瀵瑰簲鐨凱2,P3鍧愭爣
- let angle = (Math.atan2(fromY - toY, fromX - toX) * 180) / Math.PI;
- let angle1 = ((angle + theta) * Math.PI) / 180;
- let angle2 = ((angle - theta) * Math.PI) / 180;
- let topX = headlen * Math.cos(angle1);
- let topY = headlen * Math.sin(angle1);
- let botX = headlen * Math.cos(angle2);
- let botY = headlen * Math.sin(angle2);
+ let angle = (Math.atan2(fromY - toY, fromX - toX) * 180) / Math.PI
+ let angle1 = ((angle + theta) * Math.PI) / 180
+ let angle2 = ((angle - theta) * Math.PI) / 180
+ let topX = headlen * Math.cos(angle1)
+ let topY = headlen * Math.sin(angle1)
+ let botX = headlen * Math.cos(angle2)
+ let botY = headlen * Math.sin(angle2)
- ctx.save();
- ctx.beginPath();
- let arrowX = fromX - topX;
- let arrowY = fromY - topY;
- ctx.moveTo(arrowX, arrowY);
- ctx.moveTo(fromX, fromY);
- ctx.lineTo(toX, toY);
- arrowX = toX + topX;
- arrowY = toY + topY;
- ctx.moveTo(arrowX, arrowY);
- ctx.lineTo(toX, toY);
- arrowX = toX + botX;
- arrowY = toY + botY;
- ctx.lineTo(arrowX, arrowY);
- ctx.strokeStyle = color;
- ctx.lineWidth = width;
- ctx.stroke();
- ctx.restore();
+ ctx.save()
+ ctx.beginPath()
+ let arrowX = fromX - topX
+ let arrowY = fromY - topY
+ ctx.moveTo(arrowX, arrowY)
+ ctx.moveTo(fromX, fromY)
+ ctx.lineTo(toX, toY)
+ arrowX = toX + topX
+ arrowY = toY + topY
+ ctx.moveTo(arrowX, arrowY)
+ ctx.lineTo(toX, toY)
+ arrowX = toX + botX
+ arrowY = toY + botY
+ ctx.lineTo(arrowX, arrowY)
+ ctx.strokeStyle = color
+ ctx.lineWidth = width
+ ctx.stroke()
+ ctx.restore()
},
// 鍥炴樉鍥惧舰澶囨敞
showRemarks(x, y, remarks) {
- this.ctx.moveTo(x, y - 10); // 鍥犱负鏀惧ぇ涔嬪悗鏄痽-20锛屾墍浠ョ缉灏忕増鐨勪负y-10
- this.ctx.fillStyle = "green"; // 璁剧疆濉厖棰滆壊涓虹豢鑹�
- this.ctx.font = '10px "寰蒋闆呴粦"'; // 璁剧疆瀛椾綋
- this.ctx.textBaseline = "bottom"; // 璁剧疆瀛椾綋搴曠嚎瀵归綈缁樺埗鍩虹嚎
- this.ctx.textAlign = "left"; // 璁剧疆瀛椾綋瀵归綈鐨勬柟寮�
- this.ctx.fillText(remarks, x, y - 10); // 濉厖鏂囧瓧
+ this.ctx.moveTo(x, y - 10) // 鍥犱负鏀惧ぇ涔嬪悗鏄痽-20锛屾墍浠ョ缉灏忕増鐨勪负y-10
+ this.ctx.fillStyle = "green" // 璁剧疆濉厖棰滆壊涓虹豢鑹�
+ this.ctx.font = '10px "寰蒋闆呴粦"' // 璁剧疆瀛椾綋
+ this.ctx.textBaseline = "bottom" // 璁剧疆瀛椾綋搴曠嚎瀵归綈缁樺埗鍩虹嚎
+ this.ctx.textAlign = "left" // 璁剧疆瀛椾綋瀵归綈鐨勬柟寮�
+ this.ctx.fillText(remarks, x, y - 10) // 濉厖鏂囧瓧
},
getCanvasData(data) {
- let polyon = { ...data };
- polyon.camera_id = this.Camera.cameraId;
+ let polyon = { ...data }
+ polyon.camera_id = this.Camera.cameraId
savePolygon(polyon).then((rsp) => {
- this.Camera.getPolygon();
- this.Camera.getCameraTask();
- });
+ this.Camera.getPolygon()
+ this.Camera.getCameraTask()
+ })
},
setWidthHeight() {
- this.canvasWidth = this.$refs.videoPlayer.offsetWidth;
- this.canvasHeight = this.$refs.videoPlayer.offsetHeight;
+ this.canvasWidth = this.$refs.videoPlayer.offsetWidth
+ this.canvasHeight = this.$refs.videoPlayer.offsetHeight
},
async initArea() {
if (!this.showCanvas) {
- return;
+ return
}
const res = await getAllPolygon({
- cameraId: this.TreeDataPool.selectedNode.id,
- });
- this.canvasData.line = res.data.line;
- this.canvasData.rect = res.data.rect;
- this.canvasData.arrow = res.data.arrow;
- this.canvasData.polygon = res.data.polygon;
- this.clickSelect(this.canvasData);
+ cameraId: this.TreeDataPool.selectedNode.id
+ })
+ this.canvasData.line = res.data.line
+ this.canvasData.rect = res.data.rect
+ this.canvasData.arrow = res.data.arrow
+ this.canvasData.polygon = res.data.polygon
+ this.clickSelect(this.canvasData)
},
initAlgoDataWebScoket() {
if (typeof WebSocket === "undefined") {
- console.log("error,鎮ㄧ殑娴忚鍣ㄤ笉鏀寔socket");
+ console.log("error,鎮ㄧ殑娴忚鍣ㄤ笉鏀寔socket")
} else {
- this.algoDataSocket = new WebSocket();
+ this.algoDataSocket = new WebSocket()
this.algoDataSocket.onopen = () => {
- console.log("socket杩炴帴鎴愬姛");
- };
+ console.log("socket杩炴帴鎴愬姛")
+ }
this.algoDataSocket.onerror = () => {
- console.log("杩炴帴閿欒");
- };
+ console.log("杩炴帴閿欒")
+ }
this.algoDataSocket.onmessage = (msg) => {
- console.log(msg);
- };
+ console.log(msg)
+ }
}
},
playVideo() {
if (this.isStream && this.rtspUrl == "") {
- return;
+ return
}
- let payload = "";
- let url = "";
+ let payload = ""
+ let url = ""
if (this.isStream) {
if (this.cameraID == "") {
- this.cameraID = this.getUuid();
+ this.cameraID = this.getUuid()
}
payload = JSON.stringify({
cameraID: this.cameraID,
rtspUrl: this.rtspUrl,
isRunning: this.isRunning,
- isGb28181: this.isGb,
- });
+ isGb28181: this.isGb
+ })
- url = this.videoUrl;
+ url = this.videoUrl
} else {
- url = "/httpImage/" + this.videoUrls[this.playerIndex];
+ url = "/httpImage/" + this.videoUrls[this.playerIndex]
}
- this.videoLoading = true;
+ this.videoLoading = true
if (this.player.hPlayer == 0) {
this.player.play(
url,
@@ -479,48 +403,48 @@
this.$refs.timeLabel,
payload,
() => {
- this.videoLoading = false;
+ this.videoLoading = false
}
- );
+ )
} else if (this.player.PlayOrPause == 0) {
- this.player.resume();
- this.videoLoading = false;
+ this.player.resume()
+ this.videoLoading = false
} else {
- this.player.pause();
- this.videoLoading = false;
+ this.player.pause()
+ this.videoLoading = false
}
- this.playerStatus = this.player.PlayOrPause;
+ this.playerStatus = this.player.PlayOrPause
- this.loadUrl = url;
+ this.loadUrl = url
},
setPlayerStatus(stat) {
- this.videoLoading = false;
+ this.videoLoading = false
// 鎺у埗鍔犺浇鍚庣殑鎾斁鎸夐挳鐘舵�侊紝瀹炴椂娴佷负鑷姩鎾斁锛岃棰戜负preload
- this.playerStatus = this.isStream ? 1 : 0;
+ this.playerStatus = this.isStream ? 1 : 0
},
stopVideo() {
- if (this.player.hPlayer == 0) return;
+ if (this.player.hPlayer == 0) return
- this.player.stop();
+ this.player.stop()
},
fullScreen() {
if (!this.isFullScreen) {
- this.player.fullscreen();
+ this.player.fullscreen()
} else {
- this.player.exitfullscreen();
+ this.player.exitfullscreen()
}
- this.isFullScreen = !this.isFullScreen;
+ this.isFullScreen = !this.isFullScreen
},
async downLoad() {
if (!this.loadUrl) {
this.$notify.info({
title: "娑堟伅",
- message: "涓嬭浇澶辫触锛屾棤鏁堢殑瑙嗛鍦板潃",
- });
- return;
+ message: "涓嬭浇澶辫触锛屾棤鏁堢殑瑙嗛鍦板潃"
+ })
+ return
}
if (this.isFullScreen) {
@@ -530,29 +454,29 @@
p.appendChild(txt);
p.classList.add("downloadNotice");
screen.appendChild(p); */
- this.fullScreenNotice = true;
+ this.fullScreenNotice = true
setTimeout(() => {
- this.fullScreenNotice = false;
- }, 2000);
+ this.fullScreenNotice = false
+ }, 2000)
} else {
this.$notify.info({
title: "娑堟伅",
- message: `璧勬簮涓嬭浇涓�,璇风◢鍚�...`,
- });
+ message: `璧勬簮涓嬭浇涓�,璇风◢鍚�...`
+ })
}
- let url = "http://" + window.location.host + this.loadUrl;
+ let url = "http://" + window.location.host + this.loadUrl
// let url = "http://localhost:8080/httpImage/192.168.20.189:6700/283,2f49bf283ad7?collection=2021-09-28-DSVAD010120190703-video"
- let name = url.substring(url.lastIndexOf("/") + 1);
- let responsePromise = await fetch(url);
- let blob = await responsePromise.blob();
- let objectURL = window.URL.createObjectURL(blob);
- let a = document.createElement("a");
- a.href = objectURL;
- a.download = name;
- a.click();
- a.remove();
+ let name = url.substring(url.lastIndexOf("/") + 1)
+ let responsePromise = await fetch(url)
+ let blob = await responsePromise.blob()
+ let objectURL = window.URL.createObjectURL(blob)
+ let a = document.createElement("a")
+ a.href = objectURL
+ a.download = name
+ a.click()
+ a.remove()
/* let url = 'http:/'+this.loadUrl.substring(10)
let link = document.createElement("a"); //鍒涘缓a鏍囩
let name = url.substring(url.lastIndexOf("/") + 1)
@@ -564,18 +488,18 @@
},
playPrev() {
- this.playerIndex--;
- this.player.stop();
- this.playVideo();
+ this.playerIndex--
+ this.player.stop()
+ this.playVideo()
},
playNext() {
- this.playerIndex++;
- this.player.stop();
- this.playVideo();
- },
- },
-};
+ this.playerIndex++
+ this.player.stop()
+ this.playVideo()
+ }
+ }
+}
</script>
<style lang="scss">
diff --git a/src/pages/cameraAccess/components/CameraInfo.vue b/src/pages/cameraAccess/components/CameraInfo.vue
index 00b0eda..4b886b0 100644
--- a/src/pages/cameraAccess/components/CameraInfo.vue
+++ b/src/pages/cameraAccess/components/CameraInfo.vue
@@ -4,32 +4,17 @@
<el-row>
<el-col :span="9">
<el-form-item label="RTSP鍦板潃" :span="11" prop="rtsp">
- <el-input
- v-model="form.rtsp"
- placeholder="rtsp://"
- :disabled="isDisabled"
- size="small"
- ></el-input>
+ <el-input v-model="form.rtsp" placeholder="rtsp://" :disabled="isDisabled" size="small"></el-input>
</el-form-item>
</el-col>
<el-col :span="9" :offset="1">
<el-form-item label="鍧愭爣" style="width: 100%">
<label slot="label">鍧愭爣</label>
<el-col :span="11">
- <el-input
- v-model="form.latitude"
- placeholder="缁忓害"
- :disabled="isDisabled"
- size="small"
- ></el-input>
+ <el-input v-model="form.latitude" placeholder="缁忓害" :disabled="isDisabled" size="small"></el-input>
</el-col>
<el-col :span="11" :offset="2">
- <el-input
- v-model="form.longitude"
- placeholder="绾害"
- :disabled="isDisabled"
- size="small"
- ></el-input>
+ <el-input v-model="form.longitude" placeholder="绾害" :disabled="isDisabled" size="small"></el-input>
</el-col>
</el-form-item>
</el-col>
@@ -37,22 +22,12 @@
<el-row>
<el-col :span="9">
<el-form-item label="璁惧鍚嶇О" style="width: 100%" prop="name">
- <el-input
- v-model="form.name"
- placeholder="璇疯緭鍏ヨ澶囧悕绉�"
- :disabled="isDisabled"
- size="small"
- ></el-input>
+ <el-input v-model="form.name" placeholder="璇疯緭鍏ヨ澶囧悕绉�" :disabled="isDisabled" size="small"></el-input>
</el-form-item>
</el-col>
<el-col :span="9" :offset="1">
<el-form-item label="璁惧鍦板潃" style="width: 100%" prop="addr">
- <el-input
- v-model="form.addr"
- placeholder="璇疯緭鍏ュ湴鍧�鎻忚堪"
- :disabled="isDisabled"
- size="small"
- ></el-input>
+ <el-input v-model="form.addr" placeholder="璇疯緭鍏ュ湴鍧�鎻忚堪" :disabled="isDisabled" size="small"></el-input>
</el-form-item>
</el-col>
</el-row>
@@ -112,39 +87,20 @@
<el-row v-show="isGb28182">
<el-col :span="9">
<el-form-item label="璁惧鍒悕" style="width: 100%" prop="alias">
- <el-input
- v-model="form.alias"
- placeholder="璇疯緭鍏ヨ澶囧埆鍚�"
- size="small"
- ></el-input>
+ <el-input v-model="form.alias" placeholder="璇疯緭鍏ヨ澶囧埆鍚�" size="small"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<!-- 娣诲姞浼犳劅鍣� -->
- <CameraInfoEditor
- ref="cameraEditor"
- :Carmeras="form"
- :sensors="sensors"
- ></CameraInfoEditor>
+ <CameraInfoEditor ref="cameraEditor" :Carmeras="form" :sensors="sensors"></CameraInfoEditor>
</el-row>
<el-row style="padding-top: 15px">
<el-col :span="19" style="text-align: right">
- <el-button
- size="small"
- type="primary"
- @click="onSubmit('addForm')"
- :disabled="conDisabled"
- >淇濆瓨</el-button
- >
- <el-button
- type="danger"
- size="small"
- @click="deleteCamera"
- v-if="!isAdd"
- :disabled="isDisabled"
+ <el-button size="small" type="primary" @click="onSubmit('addForm')" :disabled="conDisabled">淇濆瓨</el-button>
+ <el-button type="danger" size="small" @click="deleteCamera" v-if="!isAdd" :disabled="isDisabled"
>鍒犻櫎鎽勫儚鏈�</el-button
>
</el-col>
@@ -154,13 +110,7 @@
<input v-model="form.areaid" type="hidden" />
<el-row>
<el-col :span="12" style="text-align: right">
- <el-button
- size="small"
- type="primary"
- @click="cameraConnet"
- :disabled="conDisabled"
- >杩炴帴娴嬭瘯</el-button
- >
+ <el-button size="small" type="primary" @click="cameraConnet" :disabled="conDisabled">杩炴帴娴嬭瘯</el-button>
</el-col>
</el-row>
<el-row style="padding: 15px 0">
@@ -181,18 +131,9 @@
:rtspUrl="videoItem.rtsp"
:isRunning="false"
:showArea="false"
- v-if="
- videoItem !== '' &&
- videoItem !== undefined &&
- videoItem !== null &&
- visibilityState
- "
+ v-if="videoItem !== '' && videoItem !== undefined && videoItem !== null && visibilityState"
></wasm-player>
- <video
- v-else
- poster="/images/cameraAccess/video-poster.png"
- preload="none"
- ></video>
+ <video v-else poster="/images/cameraAccess/video-poster.png" preload="none"></video>
</el-col>
<!-- 绯荤粺杩愯淇℃伅 -->
@@ -214,10 +155,7 @@
:style="`width:80%;height:174px;position: relative;left: -12px;`"
v-if="PollData.barCharts && PollData.barCharts.length !== 0"
>
- <eChartsBar
- ref="cpuMeneryCharts"
- :xAxisData="PollData.barCharts"
- ></eChartsBar>
+ <eChartsBar ref="cpuMeneryCharts" :xAxisData="PollData.barCharts"></eChartsBar>
</div>
</div>
</el-col>
@@ -226,21 +164,15 @@
</div>
</template>
<script>
-import {
- createCamera,
- updateCameraInfo,
- getCameraInfo,
- getGB28181CameraInfo,
- delCamera,
-} from "@/api/camera";
-import { getSoundList } from "@/api/event";
+import { createCamera, updateCameraInfo, getCameraInfo, getGB28181CameraInfo, delCamera } from "@/api/camera"
+import { getSoundList } from "@/api/event"
-import WasmPlayer from "@/components/wasmPlayer";
-import CameraPlayer from "@/components/player";
-import eChartsBar from "@/components/subComponents/eChartsBar";
+import WasmPlayer from "@/components/wasmPlayer"
+import CameraPlayer from "@/components/player"
+import eChartsBar from "@/components/subComponents/eChartsBar"
-import InfoCard from "./infoCard";
-import CameraInfoEditor from "./CameraInfoEditor";
+import InfoCard from "./infoCard"
+import CameraInfoEditor from "./CameraInfoEditor"
export default {
name: "CameraInfo",
@@ -249,15 +181,15 @@
WasmPlayer,
InfoCard,
eChartsBar,
- CameraInfoEditor,
+ CameraInfoEditor
},
props: {
cameraList: {
default: () => {
- return [];
+ return []
},
- type: Array,
- },
+ type: Array
+ }
},
data() {
return {
@@ -272,103 +204,95 @@
isAdd: false,
addParentId: "",
rules: {
- name: [
- { required: true, message: "璁惧鍚嶇О涓嶈兘涓虹┖", trigger: "blur" },
- ],
- rtsp: [
- { required: true, message: "RTSP鍦板潃涓嶈兘涓虹┖", trigger: "blur" },
- ],
- addr: [
- { required: true, message: "璁惧鍦板潃涓嶈兘涓虹┖", trigger: "blur" },
- ],
+ name: [{ required: true, message: "璁惧鍚嶇О涓嶈兘涓虹┖", trigger: "blur" }],
+ rtsp: [{ required: true, message: "RTSP鍦板潃涓嶈兘涓虹┖", trigger: "blur" }],
+ addr: [{ required: true, message: "璁惧鍦板潃涓嶈兘涓虹┖", trigger: "blur" }]
},
resolutionList: [],
//浼犳劅鍣ㄥ垪琛�
sensors: [],
- voice: null,
- };
+ voice: null
+ }
},
computed: {
isSelected() {
- return this.TreeDataPool.selectedNode.type !== "4";
+ return this.TreeDataPool.selectedNode.type !== "4"
},
isGb28182() {
- return this.TreeDataPool.selectedNode.cameraType === 1;
+ return this.TreeDataPool.selectedNode.cameraType === 1
},
isDisabled() {
if (this.isGb28182) {
- return true;
+ return true
}
- return this.isAdd ? false : this.TreeDataPool.selectedNode.type !== "4";
+ return this.isAdd ? false : this.TreeDataPool.selectedNode.type !== "4"
},
conDisabled() {
- return this.isAdd ? false : this.TreeDataPool.selectedNode.type !== "4";
- },
+ return this.isAdd ? false : this.TreeDataPool.selectedNode.type !== "4"
+ }
},
mounted() {
- this.initFormData();
+ this.initFormData()
document.addEventListener("visibilitychange", () => {
- this.visibilitychange();
- });
- this.getSounds();
+ this.visibilitychange()
+ })
+ this.getSounds()
this.eventAudio.addEventListener("ended", () => {
- this.togglePlay = true;
- });
+ this.togglePlay = true
+ })
},
methods: {
getSounds() {
getSoundList()
.then((res) => {
if (res.success) {
- this.soundList = res.data;
+ this.soundList = res.data
}
})
- .catch((e) => console.log(e));
+ .catch((e) => console.log(e))
},
selSound(sound) {
- this.soundPath = sound.path;
- this.form.voiceId = sound.id;
- this.togglePlay = true;
- this.eventAudio.pause();
+ this.soundPath = sound.path
+ this.form.voiceId = sound.id
+ this.togglePlay = true
+ this.eventAudio.pause()
// this.eventAudio.
},
togglePlayer() {
if (!this.soundPath) {
this.$notify({
type: "info",
- message: "璇峰厛閫夋嫨涓�涓0闊�!",
- });
- return false;
+ message: "璇峰厛閫夋嫨涓�涓0闊�!"
+ })
+ return false
}
- this.eventAudio.src = this.soundPath;
+ this.eventAudio.src = this.soundPath
if (this.togglePlay) {
- this.eventAudio.play();
- this.togglePlay = false;
+ this.eventAudio.play()
+ this.togglePlay = false
} else {
- this.eventAudio.pause();
- this.togglePlay = true;
+ this.eventAudio.pause()
+ this.togglePlay = true
}
// this.togglePlay = !this.togglePlay
},
visibilitychange() {
switch (document.visibilityState) {
case "hidden":
- this.visibilityState = false;
- break;
+ this.visibilityState = false
+ break
case "visible":
- this.visibilityState = true;
- break;
+ this.visibilityState = true
+ break
}
},
selectCamera(node) {
- this.isAdd = false;
- this.videoItem = null;
- this.$refs.addForm.resetFields();
- this.voice = null;
-
- console.log(node);
+ this.isAdd = false
+ this.videoItem = null
+ this.$refs.addForm.resetFields()
+ this.voice = null
// this.initFormData();
// this.$refs.addForm.clearValidate();
@@ -380,197 +304,176 @@
// console.log(res, '鑾峰彇鎽勫儚鏈轰俊鎭�')
if (res.data.resolutions) {
let list = res.data.resolutions.map((i) => {
- let obj = {};
+ let obj = {}
if (i.width == 0 && i.height == 0) {
- obj.label = "鏈満鍒嗚鲸鐜�";
- obj.value = "0*0";
+ obj.label = "鏈満鍒嗚鲸鐜�"
+ obj.value = "0*0"
} else {
- obj.label = i.width + "*" + i.height;
- obj.value = i.width + "*" + i.height;
+ obj.label = i.width + "*" + i.height
+ obj.value = i.width + "*" + i.height
}
- return obj;
- });
- this.resolutionList = list;
- this.sensors = res.data.sensors;
- console.log(list);
+ return obj
+ })
+ this.resolutionList = list
+ this.sensors = res.data.sensors
}
this.$nextTick(() => {
- this.initFormData();
- Object.assign(this.form, res.data);
+ this.initFormData()
+ Object.assign(this.form, res.data)
this.soundList.forEach((element) => {
if (this.form.voiceId == element.id) {
- this.voice = element;
+ this.voice = element
}
- });
+ })
if (this.form.run_type !== -1) {
- this.form.isAI = true;
+ this.form.isAI = true
} else {
- this.form.isAI = false;
+ this.form.isAI = false
}
- this.form.resolution =
- this.form.resolution_width +
- "*" +
- this.form.resolution_height;
- });
+ this.form.resolution = this.form.resolution_width + "*" + this.form.resolution_height
+ })
}
- });
+ })
} else {
getCameraInfo(node.id).then((res) => {
if (res.success) {
// console.log(res, '鑾峰彇鎽勫儚鏈轰俊鎭�')
if (res.data.resolutions) {
let list = res.data.resolutions.map((i) => {
- let obj = {};
+ let obj = {}
if (i.width == 0 && i.height == 0) {
- obj.label = "鏈満鍒嗚鲸鐜�";
- obj.value = "0*0";
+ obj.label = "鏈満鍒嗚鲸鐜�"
+ obj.value = "0*0"
} else {
- obj.label = i.width + "*" + i.height;
- obj.value = i.width + "*" + i.height;
+ obj.label = i.width + "*" + i.height
+ obj.value = i.width + "*" + i.height
}
- return obj;
- });
- this.resolutionList = list;
- this.sensors = res.data.sensors;
- console.log(list);
+ return obj
+ })
+ this.resolutionList = list
+ this.sensors = res.data.sensors
}
this.$nextTick(() => {
- this.initFormData();
- Object.assign(this.form, res.data);
+ this.initFormData()
+ Object.assign(this.form, res.data)
this.soundList.forEach((element) => {
if (this.form.voiceId == element.id) {
- this.voice = element;
+ this.voice = element
}
- });
+ })
if (this.form.run_type !== -1) {
- this.form.isAI = true;
+ this.form.isAI = true
} else {
- this.form.isAI = false;
+ this.form.isAI = false
}
- this.form.resolution =
- this.form.resolution_width +
- "*" +
- this.form.resolution_height;
- });
+ this.form.resolution = this.form.resolution_width + "*" + this.form.resolution_height
+ })
}
- });
+ })
}
}
},
// 淇濆瓨
onSubmit(formName) {
- let list = this.$refs.cameraEditor.getResult();
+ let list = this.$refs.cameraEditor.getResult()
this.$refs[formName].validate(async (valid) => {
if (valid) {
- const isRequire = this.verifyRequrie();
- if (!isRequire) return false;
+ const isRequire = this.verifyRequrie()
+ if (!isRequire) return false
- this.form.latitude = Number.isNaN(parseFloat(this.form.latitude))
- ? 0
- : parseFloat(this.form.latitude);
- this.form.longitude = Number.isNaN(parseFloat(this.form.longitude))
- ? 0
- : parseFloat(this.form.longitude);
- this.form.sensors = list;
- this.form.resolution_width = Number(
- this.form.resolution.split("*")[0]
- );
- this.form.resolution_height = Number(
- this.form.resolution.split("*")[1]
- );
- let _this = this;
+ this.form.latitude = Number.isNaN(parseFloat(this.form.latitude)) ? 0 : parseFloat(this.form.latitude)
+ this.form.longitude = Number.isNaN(parseFloat(this.form.longitude)) ? 0 : parseFloat(this.form.longitude)
+ this.form.sensors = list
+ this.form.resolution_width = Number(this.form.resolution.split("*")[0])
+ this.form.resolution_height = Number(this.form.resolution.split("*")[1])
+ let _this = this
// 鏇存柊
if (this.form.id !== "") {
- this.form.areaid = this.TreeDataPool.getParent(
- this.form.id,
- this.isGb28182
- );
- console.log(this.TreeDataPool.selectedNode);
+ this.form.areaid = this.TreeDataPool.getParent(this.form.id, this.isGb28182)
updateCameraInfo(this.form)
.then((rsp) => {
if (rsp.success) {
this.$notify({
type: "success",
- message: "鎽勫儚鏈轰俊鎭慨鏀规垚鍔燂紒",
- });
- this.TreeDataPool.fetchTreeData();
- console.log(this.TreeDataPool.selectedNode);
+ message: "鎽勫儚鏈轰俊鎭慨鏀规垚鍔燂紒"
+ })
+ this.TreeDataPool.fetchTreeData()
//_this.$root.$children[0].$refs['leftTree'].$refs.tree.ztreeObj.checkNode(_this.TreeDataPool.selectedNode, true, false, false);
//閫変腑淇敼鍚庣殑鑺傜偣
- let { evt, treeId } =
- _this.$root.$children[0].$refs["leftTree"].$refs.tree;
- console.log(evt, treeId);
+ // let { evt, treeId } =
+ // _this.$root.$children[0].$refs["leftTree"].$refs.tree;
+ // console.log(evt, treeId);
// this.$nextTick(()=>{
//_this.$root.$children[0].$refs['leftTree'].$refs.tree.handleCreated()
// })
} else {
- this.selectCamera(this.TreeDataPool.selectedNode);
+ this.selectCamera(this.TreeDataPool.selectedNode)
this.$notify({
type: "error",
- message: "鎽勫儚鏈轰俊鎭慨鏀瑰け璐ワ紒",
- });
+ message: "鎽勫儚鏈轰俊鎭慨鏀瑰け璐ワ紒"
+ })
}
})
.catch((err) => {
this.$notify({
type: "error",
- message: err.msg,
- });
- });
+ message: err.msg
+ })
+ })
} else {
- this.form.areaid = this.addParentId;
+ this.form.areaid = this.addParentId
createCamera(this.form)
.then((rsp) => {
if (rsp.success) {
this.$notify({
type: "success",
- message: "鎽勫儚鏈烘坊鍔犳垚鍔燂紒",
- });
- this.TreeDataPool.selectedNode = rsp.data;
- this.TreeDataPool.fetchTreeData();
+ message: "鎽勫儚鏈烘坊鍔犳垚鍔燂紒"
+ })
+ this.TreeDataPool.selectedNode = rsp.data
+ this.TreeDataPool.fetchTreeData()
// 鍚庣杩斿洖缁撴灉涓�0锛屾煡璇㈠悗涓�4
- this.TreeDataPool.selectedNode.type = "4";
- this.selectCamera(this.TreeDataPool.selectedNode);
+ this.TreeDataPool.selectedNode.type = "4"
+ this.selectCamera(this.TreeDataPool.selectedNode)
} else {
this.$notify({
type: "error",
- message: "鎽勫儚鏈烘坊鍔犲け璐ワ紒",
- });
+ message: "鎽勫儚鏈烘坊鍔犲け璐ワ紒"
+ })
}
})
.catch((err) => {
this.$notify({
type: "error",
- message: err.msg,
- });
- });
+ message: err.msg
+ })
+ })
}
}
- });
+ })
},
// 杩炴帴娴嬭瘯
cameraConnet() {
- this.videoItem = null;
+ this.videoItem = null
this.$nextTick(() => {
this.videoItem = {
name: this.form.name,
rtsp: this.form.rtsp,
id: this.form.id,
isRunning: this.form.run_enable,
- cameraType: this.form.type,
- };
- });
+ cameraType: this.form.type
+ }
+ })
},
// * 楠岃瘉蹇呴�夐」
verifyRequrie() {
if (this.isGb28182) {
- return true;
+ return true
}
// const rtspReg = /^(rtsp:\/\/)([a-zA-Z0-9_]+):([a-zA-Z0-9_]+)@(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?):([0-9]|[1-9]\d{1,3}|[1-5]\d{4}|6[0-4]\d{4}|65[0-4]\d{2}|655[0-2]\d|6553[0-5])(\/)([a-zA-Z0-9_/]+)$/;
// !rtspReg.test(this.form.rtsp
@@ -578,36 +481,36 @@
if (this.form.rtsp === "") {
this.$notify({
type: "warning",
- message: "璇疯緭鍏ユ纭殑rtsp鍦板潃",
- });
- return false;
+ message: "璇疯緭鍏ユ纭殑rtsp鍦板潃"
+ })
+ return false
}
- return true;
+ return true
},
// 鍒犻櫎鎽勫儚鏈�
deleteCamera() {
this.$confirm("鏄惁鍒犻櫎姝ゆ憚鍍忔満锛�", {
center: true,
cancelButtonClass: "comfirm-class-cancle",
- confirmButtonClass: "comfirm-class-sure",
+ confirmButtonClass: "comfirm-class-sure"
}).then(() => {
delCamera(this.form.id).then((res) => {
if (res.success) {
- this.initFormData();
+ this.initFormData()
this.$notify({
type: "success",
- message: "鍒犻櫎鎴愬姛锛�",
- });
- this.TreeDataPool.fetchTreeData();
- this.TreeDataPool.selectedNode = {};
+ message: "鍒犻櫎鎴愬姛锛�"
+ })
+ this.TreeDataPool.fetchTreeData()
+ this.TreeDataPool.selectedNode = {}
} else {
this.$notify({
type: "error",
- message: "鍒犻櫎澶辫触锛�",
- });
+ message: "鍒犻櫎澶辫触锛�"
+ })
}
- });
- });
+ })
+ })
},
// 娓呯┖杈撳叆妗�
initFormData() {
@@ -629,32 +532,31 @@
password: "",
resolution: "",
voiceId: "",
- voiceEnable: false,
- };
+ voiceEnable: false
+ }
},
// 娣诲姞璁惧
addDevice(node) {
- console.log("1111");
- this.isAdd = true;
- this.addParentId = node;
+ this.isAdd = true
+ this.addParentId = node
this.resolutionList = [
{
label: "鏈満鍒嗚鲸鐜�",
- value: "0*0",
+ value: "0*0"
},
{
label: "1920*1080",
- value: "1920*1080",
+ value: "1920*1080"
},
{
label: "2688*1520",
- value: "2688*1520",
- },
- ];
- this.initFormData();
- },
- },
-};
+ value: "2688*1520"
+ }
+ ]
+ this.initFormData()
+ }
+ }
+}
</script>
<style lang="scss">
@@ -706,4 +608,4 @@
height: 450px;
}
}
-</style>
\ No newline at end of file
+</style>
diff --git a/src/pages/cameraAccess/components/SeparateRules.vue b/src/pages/cameraAccess/components/SeparateRules.vue
index fe51cc4..a733795 100644
--- a/src/pages/cameraAccess/components/SeparateRules.vue
+++ b/src/pages/cameraAccess/components/SeparateRules.vue
@@ -15,11 +15,7 @@
</span>
</div>
- <div
- v-if="Camera.analytics && isShowPolling === 'show'"
- class="flex-box"
- v-show="cameraType === 'camera'"
- >
+ <div v-if="Camera.analytics && isShowPolling === 'show'" class="flex-box" v-show="cameraType === 'camera'">
<span class="label">澶勭悊鏂瑰紡</span>
<toggle-button
:value="Camera.dealWay"
@@ -28,29 +24,20 @@
:color="{
checked: '#3D68E1',
unchecked: '#FF7733',
- disabled: '#CCCCCC',
+ disabled: '#CCCCCC'
}"
:sync="true"
@change="changePoll"
/>
</div>
- <div
- v-if="Camera.analytics"
- class="flex-box"
- v-show="cameraType === 'camera'"
- >
+ <div v-if="Camera.analytics" class="flex-box" v-show="cameraType === 'camera'">
<span class="label">澶勭悊鐘舵��: {{ camStatus }}</span>
</div>
- <div
- v-if="Camera.analytics"
- class="flex-box"
- v-show="cameraType === 'camera'"
- >
+ <div v-if="Camera.analytics" class="flex-box" v-show="cameraType === 'camera'">
<span class="label"
>鍒嗚鲸鐜�:
{{
- Camera.camearInfo.resolution_width == 0 ||
- Camera.camearInfo.resolution_height == 0
+ Camera.camearInfo.resolution_width == 0 || Camera.camearInfo.resolution_height == 0
? "鏈満鍒嗚鲸鐜�"
: `${Camera.camearInfo.resolution_width} * ${Camera.camearInfo.resolution_height}`
}}</span
@@ -64,12 +51,7 @@
<div v-if="Camera.analytics" class="flex-box">
<span class="label">绠楁硶蹇�熼�氶亾</span>
<div class="channel flex-box">
- <el-tooltip
- effect="dark"
- content="澶嶅埗姝ゆ憚鍍忔満绠楁硶瑙勫垯"
- placement="bottom"
- popper-class="atooltip"
- >
+ <el-tooltip effect="dark" content="澶嶅埗姝ゆ憚鍍忔満绠楁硶瑙勫垯" placement="bottom" popper-class="atooltip">
<span
style="color: #3d68e1; cursor: pointer; font-size: 23px"
@click="ctrlC"
@@ -79,9 +61,7 @@
<el-tooltip
effect="dark"
:content="
- !TreeDataPool.ctrlCameraId
- ? '绮樿创绠楁硶瑙勫垯'
- : `绮樿创绠楁硶瑙勫垯锛屾潵婧愶細${TreeDataPool.ctrlCameraName}`
+ !TreeDataPool.ctrlCameraId ? '绮樿创绠楁硶瑙勫垯' : `绮樿创绠楁硶瑙勫垯锛屾潵婧愶細${TreeDataPool.ctrlCameraName}`
"
placement="bottom"
popper-class="atooltip"
@@ -128,19 +108,13 @@
<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"
- >
+ <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
+ Camera.camearInfo.alias ? Camera.camearInfo.alias : Camera.camearInfo.name
}}</b>
</div>
<div class="img-box">
@@ -176,16 +150,9 @@
class="swiper-box-container2"
style="width: 100%"
>
- <swiper-slide
- v-for="(data, index) in swipercanvasData"
- :key="index"
- >
+ <swiper-slide v-for="(data, index) in swipercanvasData" :key="index">
<div>
- <b
- class="video-title"
- style="font-size: 14px; margin-top: -10px"
- >{{ data.name }}</b
- >
+ <b class="video-title" style="font-size: 14px; margin-top: -10px">{{ data.name }}</b>
<polygon-canvas
class="cavas"
ref="canvas"
@@ -209,20 +176,12 @@
</div>
</swiper-slide>
</swiper>
- <div
- class="swiper-local-prev"
- v-show="swipercanvasData.length > 1"
- @click="prevClick"
- >
+ <div class="swiper-local-prev" v-show="swipercanvasData.length > 1" @click="prevClick">
<div class="icon-btn" slot="button-prev">
<i class="iconfont iconzuo"></i>
</div>
</div>
- <div
- class="swiper-local-next"
- v-show="swipercanvasData.length > 1"
- @click="nextClick"
- >
+ <div class="swiper-local-next" v-show="swipercanvasData.length > 1" @click="nextClick">
<div class="icon-btn" slot="button-next">
<i class="iconfont iconyou1"></i>
</div>
@@ -260,21 +219,22 @@
</template>
<script>
-import { savePolygon } from "@/api/polygon";
+import { savePolygon } from "@/api/polygon"
-import { pasteRules } from "@/api/task";
-import { getCameraInfo } from "@/api/camera";
-import { saveCameraScene } from "@/api/scene";
+import { pasteRules } from "@/api/task"
+import { getCameraInfo } from "@/api/camera"
+import { getGB28181CameraInfo } from "@/api/camera"
+import { saveCameraScene } from "@/api/scene"
-import { changeRunType } from "@/api/pollConfig";
-import { findAllFileByStackId } from "@/api/localVedio";
-import VideoRuleData from "@/Pool/VideoRuleData";
+import { changeRunType } from "@/api/pollConfig"
+import { findAllFileByStackId } from "@/api/localVedio"
+import VideoRuleData from "@/Pool/VideoRuleData"
-import TimeSlider from "./TimeSlider";
-import polygonCanvas from "@/components/canvas";
-import Sysinfo from "@/components/subComponents/SystemInfo";
-import SceneRule from "./SceneRule";
-import SlideScene from "./scene/SlideScene";
+import TimeSlider from "./TimeSlider"
+import polygonCanvas from "@/components/canvas"
+import Sysinfo from "@/components/subComponents/SystemInfo"
+import SceneRule from "./SceneRule"
+import SlideScene from "./scene/SlideScene"
export default {
components: {
@@ -282,21 +242,19 @@
polygonCanvas,
Sysinfo,
SceneRule,
- SlideScene,
+ SlideScene
},
directives: {
focus: {
- inserted: function (el) {
- el.querySelector("input").focus();
- },
- },
+ inserted: function(el) {
+ el.querySelector("input").focus()
+ }
+ }
},
computed: {
cameraType() {
- return this.TreeDataPool.treeActiveName === "camera"
- ? "camera"
- : "dataStack";
- },
+ return this.TreeDataPool.treeActiveName === "camera" ? "camera" : "dataStack"
+ }
},
data() {
return {
@@ -310,12 +268,12 @@
grabCursor: true,
pagination: {
el: ".swiper-pagination",
- type: "fraction",
+ type: "fraction"
},
navigation: {
nextEl: ".swiper-local-next",
- prevEl: ".swiper-local-prev",
- },
+ prevEl: ".swiper-local-prev"
+ }
},
tableRuleList: [],
camStatus: "",
@@ -328,336 +286,335 @@
swiperIndex: 0,
swipercanvasData: [],
stackFilesPage: 1,
- stackFilesSize: 5,
- };
+ stackFilesSize: 5
+ }
},
mounted() {
- this.PollData.statistics();
+ this.PollData.statistics()
},
watch: {
"Camera.cameraId": {
handler(n, o) {
if (n) {
if (this.TreeDataPool.treeActiveName == "dataStack") {
- this.stackFilesPage = 1;
- this.stackFilesSize = 5;
- this.stackId = n;
+ this.stackFilesPage = 1
+ this.stackFilesSize = 5
+ this.stackId = n
if (this.stackId) {
- this.swipercanvasData = [];
- this.getStackFiles();
+ this.swipercanvasData = []
+ this.getStackFiles()
}
}
}
- },
- },
+ }
+ }
},
methods: {
getStatus() {
- getCameraInfo(this.Camera.cameraId).then((res) => {
+ let refreshCameraInfo = getCameraInfo
+ if (this.Camera.gb28181) {
+ refreshCameraInfo = getGB28181CameraInfo
+ }
+ refreshCameraInfo(this.Camera.cameraId).then((res) => {
if (res.success) {
switch (res.data.status) {
case 0:
- this.camStatus = "鏈厤瑙勫垯";
- return;
+ this.camStatus = "鏈厤瑙勫垯"
+ return
case 1:
- this.camStatus = "绛夊緟杞澶勭悊";
- return;
+ this.camStatus = "绛夊緟杞澶勭悊"
+ return
case 2:
- this.camStatus = "姝e湪鎵ц鍒嗘瀽澶勭悊";
- return;
+ this.camStatus = "姝e湪鎵ц鍒嗘瀽澶勭悊"
+ return
case -1:
- this.camStatus = "鍏朵粬鎯呭喌瀵艰嚧鏈鐞�";
- return;
+ this.camStatus = "鍏朵粬鎯呭喌瀵艰嚧鏈鐞�"
+ return
case -2:
- this.camStatus = "鏁呴殰瀵艰嚧鏈鐞�";
- return;
+ this.camStatus = "鏁呴殰瀵艰嚧鏈鐞�"
+ return
}
}
- });
+ })
},
prevClick() {
if (this.swiperIndex == 0) {
if (this.stackFilesPage > 1) {
- this.stackFilesPage--;
- this.getStackFiles(true);
+ this.stackFilesPage--
+ this.getStackFiles(true)
} else {
this.$message({
type: "info",
- message: "褰撳墠宸叉槸绗竴椤�",
- });
+ message: "褰撳墠宸叉槸绗竴椤�"
+ })
}
}
},
nextClick() {
if (this.swiperIndex == this.swipercanvasData.length - 1) {
- this.stackFilesPage++;
- this.getStackFiles(true);
+ this.stackFilesPage++
+ this.getStackFiles(true)
}
},
getStackFiles(onClick = false) {
- this.getStackFileLoading = true;
- let _this = this;
+ this.getStackFileLoading = true
+ let _this = this
findAllFileByStackId({
name: "",
stackId: this.stackId,
page: this.stackFilesPage,
size: this.stackFilesSize,
- type: 0,
+ type: 0
})
.then((res) => {
if (res && res.success) {
if (res.data.dataList.length > 0) {
- this.swipercanvasData = [];
+ this.swipercanvasData = []
this.swipercanvasData = res.data.dataList.map((item) => {
return {
name: item.name,
stackId: item.stack_id,
baseImg:
- item.type == 2
- ? `/files/${item.path.substr(
- item.path.lastIndexOf("/") + 1
- )}`
- : item.snapshot_url,
+ item.type == 2 ? `/files/${item.path.substr(item.path.lastIndexOf("/") + 1)}` : item.snapshot_url,
type: item.type,
id: item.id,
- loading: false,
- };
- });
- this.swiperIndex = 0;
- this.$refs.swiper.swiper.activeIndex = 0;
+ loading: false
+ }
+ })
+ this.swiperIndex = 0
+ this.$refs.swiper.swiper.activeIndex = 0
} else {
if (onClick) {
this.$message({
type: "warning",
- message: "宸叉棤鏇村鏁版嵁!",
- });
+ message: "宸叉棤鏇村鏁版嵁!"
+ })
}
}
} else {
this.$message({
type: "error",
- message: "鏁版嵁璇锋眰澶辫触,璇风◢鍚庨噸璇�!",
- });
+ message: "鏁版嵁璇锋眰澶辫触,璇风◢鍚庨噸璇�!"
+ })
}
- this.getStackFileLoading = false;
+ this.getStackFileLoading = false
})
.catch((e) => {
- this.getStackFileLoading = false;
- });
+ this.getStackFileLoading = false
+ })
},
swiperSlideChange() {
- this.swiperIndex = this.$refs.swiper.swiper.activeIndex;
+ this.swiperIndex = this.$refs.swiper.swiper.activeIndex
},
drawBaseImg() {
if (!this.Camera.cameraId) {
this.$notify({
type: "warning",
- message: "璇峰厛閫夋嫨鎽勫儚鏈�",
- });
- return;
+ message: "璇峰厛閫夋嫨鎽勫儚鏈�"
+ })
+ return
}
if (Array.isArray(this.$refs.canvas)) {
if (this.$refs.canvas.length > 0) {
- this.$refs.canvas[0].showModal();
+ this.$refs.canvas[0].showModal()
}
} else {
- this.$refs.canvas.showModal();
+ this.$refs.canvas.showModal()
}
},
getCanvasData(data) {
- let polyon = { ...data };
- polyon.camera_id = this.Camera.cameraId;
+ let polyon = { ...data }
+ polyon.camera_id = this.Camera.cameraId
savePolygon(polyon).then((rsp) => {
- this.Camera.getPolygon();
+ this.Camera.getPolygon()
//this.Camera.getCameraTask();
- });
+ })
},
refresh(url) {
- this.Camera.baseImg = url;
+ this.Camera.baseImg = url
},
// 鍒濆鍖栨憚鍍忔満淇℃伅锛岀埗缁勪欢璋冪敤
async initCameraData(id, type) {
- this.Camera = new VideoRuleData();
+ this.Camera = new VideoRuleData()
if (id && id !== "") {
- this.loading = false;
- this.Camera.cameraId = id;
- this.Camera.gb28181 = type === 1;
+ this.loading = false
+ this.Camera.cameraId = id
+ this.Camera.gb28181 = type === 1
if (type === 1) {
- await this.Camera.update(true);
+ await this.Camera.update(true)
} else {
- await this.Camera.update();
+ await this.Camera.update()
}
}
- this.$refs.timeSlider.activeTab = this.VideoManageData.TimeRules[0].id;
- this.showSysInfo = true;
+ this.$refs.timeSlider.activeTab = this.VideoManageData.TimeRules[0].id
+ this.showSysInfo = true
// 鍒ゆ柇姝e湪鎵ц瀹炴椂鎴栬�呰疆璇换鍔�
this.PollData.CameraList.forEach((element) => {
if (element.id === this.Camera.cameraId) {
- this.runType = element.run_type;
+ this.runType = element.run_type
}
- });
+ })
},
saveSceneRule(groupRule) {
- const payload = { ...groupRule };
- payload.cameraIds = [this.Camera.cameraId];
- let _this = this;
+ const payload = { ...groupRule }
+ payload.cameraIds = [this.Camera.cameraId]
+ let _this = this
saveCameraScene(payload).then((rsp) => {
if (rsp && rsp.success) {
- this.Camera.update();
+ this.Camera.update()
this.$notify({
type: "success",
- message: "绛栫暐淇濆瓨鎴愬姛锛�",
- });
+ message: "绛栫暐淇濆瓨鎴愬姛锛�"
+ })
//鍒锋柊宸︿晶鏍�
- _this.$root.$children[0].$children[0].querySearchAsync("camera");
+ _this.$root.$children[0].$children[0].querySearchAsync("camera")
}
- });
+ })
},
delScenRule() {
- this.Camera.update();
+ this.Camera.update()
},
changeLoading(params) {
- this.loading = params;
+ this.loading = params
},
//鏄惁杩涜瑙嗛鍒嗘瀽澶勭悊
pollEnable(row) {
- let val = 0;
+ let val = 0
if (row) {
if (this.PollData.RealTimeSum < this.PollData.channelTotal) {
- this.Camera.dealWay = true;
- val = 1;
+ this.Camera.dealWay = true
+ val = 1
} else {
- this.Camera.dealWay = false;
- val = 0;
+ this.Camera.dealWay = false
+ val = 0
}
} else {
- this.Camera.dealWay = false;
- val = -1;
+ this.Camera.dealWay = false
+ val = -1
}
if (this.Camera.cameraId && this.Camera.cameraId !== undefined) {
changeRunType({
camera_ids: [this.Camera.cameraId],
run_type: val,
+ isGb: this.Camera.gb28181
}).then((rsp) => {
- this.getStatus();
+ this.getStatus()
if (rsp && rsp.success) {
this.$notify({
type: "success",
- message: "閰嶇疆鎴愬姛",
- });
+ message: "閰嶇疆鎴愬姛"
+ })
} else {
this.$notify({
type: "error",
- message: "閰嶇疆澶辫触",
- });
+ message: "閰嶇疆澶辫触"
+ })
}
- this.TreeDataPool.fetchTreeData();
- });
+ this.TreeDataPool.fetchTreeData()
+ })
}
- this.PollData.statisticTaskInfo();
+ this.PollData.statisticTaskInfo()
},
//瀹炴椂銆佽疆璇㈠垏鎹�
changePoll(row) {
//鍒ゆ柇鏄柊澧炶繕鏄洿鏂�
- debugger;
if (this.Camera.cameraId && this.Camera.cameraId !== undefined) {
if (this.PollData.RealTimeSum < this.PollData.channelTotal) {
if (row.value) {
- this.Camera.dealWay = true;
+ this.Camera.dealWay = true
} else {
- this.Camera.dealWay = false;
+ this.Camera.dealWay = false
}
- debugger;
changeRunType({
camera_ids: [this.Camera.cameraId],
run_type: this.Camera.dealWay ? 1 : 0,
+ isGb: this.Camera.gb28181
}).then((rsp) => {
if (rsp && rsp.success) {
this.$notify({
type: "success",
- message: "閰嶇疆鎴愬姛",
- });
+ message: "閰嶇疆鎴愬姛"
+ })
} else {
this.$notify({
type: "error",
- message: "閰嶇疆澶辫触",
- });
+ message: "閰嶇疆澶辫触"
+ })
}
- });
+ })
} else {
if (this.Camera.dealWay) {
- this.Camera.dealWay = false;
- debugger;
+ this.Camera.dealWay = false
changeRunType({
camera_ids: [this.Camera.cameraId],
- run_type: this.Camera.dealWay ? 1 : 0,
+ run_type: this.Camera.dealWay ? 1 : 0
}).then((rsp) => {
if (rsp && rsp.success) {
this.$notify({
type: "success",
- message: "閰嶇疆鎴愬姛",
- });
+ message: "閰嶇疆鎴愬姛"
+ })
} else {
this.$notify({
type: "error",
- message: "閰嶇疆澶辫触",
- });
+ message: "閰嶇疆澶辫触"
+ })
}
- });
+ })
}
}
- this.TreeDataPool.fetchTreeData();
- this.PollData.statisticTaskInfo();
+ this.TreeDataPool.fetchTreeData()
+ this.PollData.statisticTaskInfo()
}
},
//澶嶅埗
ctrlC() {
- this.TreeDataPool.ctrlCameraId = this.Camera.cameraId;
- this.TreeDataPool.ctrlCameraName = this.Camera.cameraName;
+ this.TreeDataPool.ctrlCameraId = this.Camera.cameraId
+ this.TreeDataPool.ctrlCameraName = this.Camera.cameraName
this.$notify({
type: "success",
- message: "澶嶅埗绠楁硶鎴愬姛锛�",
- });
+ message: "澶嶅埗绠楁硶鎴愬姛锛�"
+ })
},
ctrlV() {
if (this.Camera.cameraId === this.TreeDataPool.ctrlCameraId) {
this.$notify({
type: "warning",
- message: "涓嶈兘绮樿创鏈憚鍍忔満鐨勭畻娉曞埌鏈憚鍍忔満锛�",
- });
- return false;
+ message: "涓嶈兘绮樿创鏈憚鍍忔満鐨勭畻娉曞埌鏈憚鍍忔満锛�"
+ })
+ return false
}
pasteRules({
sourceId: this.TreeDataPool.ctrlCameraId,
- targetIds: [this.Camera.cameraId],
+ targetIds: [this.Camera.cameraId]
})
.then((res) => {
if (res && res.success) {
this.$notify({
type: "success",
- message: "绮樿创绠楁硶鎴愬姛锛�",
- });
- this.initCameraData(this.Camera.cameraId);
+ message: "绮樿创绠楁硶鎴愬姛锛�"
+ })
+ this.initCameraData(this.Camera.cameraId)
} else {
this.$notify({
type: "error",
- message: "绮樿创绠楁硶澶辫触锛�",
- });
+ message: "绮樿创绠楁硶澶辫触锛�"
+ })
}
})
.catch((err) => {
this.$notify({
type: "error",
- message: "绮樿创绠楁硶澶辫触锛�",
- });
- });
- },
- },
-};
+ message: "绮樿创绠楁硶澶辫触锛�"
+ })
+ })
+ }
+ }
+}
</script>
<style lang="scss">
.el-message--info .el-message__content {
--
Gitblit v1.8.0