From c746bd5e7640a2e7d0c29134d23ee266d8e68a52 Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期四, 04 八月 2022 14:49:16 +0800
Subject: [PATCH] 添加告警推送页面
---
src/views/hashrate/CameraManage/CameraRules/components/RuleItem.vue | 93 ++++++++++++++++++++++++++++++++--------------
1 files changed, 64 insertions(+), 29 deletions(-)
diff --git a/src/views/hashrate/CameraManage/CameraRules/components/RuleItem.vue b/src/views/hashrate/CameraManage/CameraRules/components/RuleItem.vue
index f385dce..8e3b6b2 100644
--- a/src/views/hashrate/CameraManage/CameraRules/components/RuleItem.vue
+++ b/src/views/hashrate/CameraManage/CameraRules/components/RuleItem.vue
@@ -9,13 +9,22 @@
</div>
<div class="des">
<div class="desItem">
- <i class="iconfont"></i>{{ eventName }}
+ <i class="iconfont"></i>绛夌骇: {{ eventName }}
</div>
<div class="desItem">
- <i class="iconfont"></i>{{ timeName }}
+ <i class="iconfont"></i>鏃堕棿: {{ timeName }}
</div>
- <div class="desItem" v-if="rule.desc">
- <i class="iconfont"></i>{{ rule.desc }}
+ <div class="desItem">
+ <i class="iconfont"></i>鎻忚堪:
+ {{ rule.desc ? rule.desc : "-" }}
+ </div>
+ <div class="desItem" v-if="rule.voice && rule.voice.name">
+ <i class="iconfont"></i>澹伴煶:
+ {{ rule.voice.name }}
+ </div>
+
+ <div class="desItem" v-else>
+ <i class="iconfont"></i>澹伴煶: -
</div>
</div>
</div>
@@ -78,15 +87,16 @@
</template>
<div class="empty" @dragover="dragover($event)" @drop="drop" v-else>
- <img src="/images/hashrate/鏈厤缃畻娉曠┖椤甸潰.png" alt="" />
+ <img src="/images/hashrate/unSdk.png" alt="" />
<div class="des">
- 鏆傛湭閰嶇疆绛栫暐锛岀偣鍑讳笂鏂规搷浣滈潰鏉挎寜閽紝浠庢搷浣滈潰鏉挎嫋鍒扮畻娉曞埌姝ゅ锛屽嵆鍙厤缃�
+ 鏆傛湭閰嶇疆绛栫暐锛岀偣鍑讳笂鏂规搷浣滈潰鏉挎寜閽紝浠庢搷浣滈潰鏉挎嫋鍔ㄧ畻娉曞埌姝ゅ锛屽嵆鍙厤缃�
</div>
</div>
</div>
</div>
<div class="control">
<div class="title">鍦烘櫙鎿嶄綔</div>
+ <span class="close iconfont" @click="deleteRule"></span>
<div class="content">
<div class="btns">
<div class="button cancel" @click="backToOrigin">鍙栨秷</div>
@@ -100,12 +110,13 @@
<script>
import bus from "@/plugin/bus";
-import { saveLinkScene, saveCameraScene } from "@/api/scene";
+import { saveLinkScene, saveCameraScene, deleteCameraScene } from "@/api/scene";
export default {
props: {
rule: {},
ruleType: {},
+ cameraId: {},
},
created() {
this.getSdkConnection();
@@ -190,9 +201,11 @@
delSdk(index) {
this.rule.rules.splice(index, 1);
- if (this.rule.rules[index]) {
- this.rule.rules[index].rule_with_pre = "";
+ if (this.rule.rules.length == 1) {
+ this.rule.rules[0].rule_with_pre = "";
}
+
+ this.update();
console.log(this.rule.rules);
},
@@ -204,36 +217,47 @@
},
save() {
if (this.ruleType === "separate") {
- this.rule.cameraIds = [this.rule.cameraId];
+ this.rule.cameraIds = [this.cameraId];
saveCameraScene(this.rule).then((rsp) => {
if (rsp && rsp.success) {
this.$notify({
type: "success",
message: "绛栫暐淇濆瓨鎴愬姛锛�",
});
+ this.backToOrigin();
}
});
} else {
- saveLinkScene(this.rule)
- .then((rsp) => {
- if (rsp && rsp.success) {
- this.$notify({
- type: "success",
- message: "浠诲姟淇濆瓨鎴愬姛锛�",
- });
- } else {
- this.$notify({
- type: "error",
- message: rsp.data,
- });
- }
- })
- .catch((err) => {
- this.$message({
- type: "error",
- message: "淇濆瓨澶辫触锛�",
+ delete this.rule.camera_polygons;
+ saveLinkScene(this.rule).then((rsp) => {
+ if (rsp && rsp.success) {
+ this.$notify({
+ type: "success",
+ message: "浠诲姟淇濆瓨鎴愬姛锛�",
});
- });
+ this.backToOrigin();
+ } else {
+ this.$notify({
+ type: "error",
+ message: rsp.data,
+ });
+ }
+ });
+ }
+ },
+ async deleteRule() {
+ if (!this.rule.id) {
+ console.log("87878");
+ this.backToOrigin();
+ return;
+ }
+ const res = await deleteCameraScene(this.rule.id);
+ if (res && res.success) {
+ this.$notify({
+ type: "success",
+ message: "鍒犻櫎鎴愬姛",
+ });
+ this.$emit("deletRule");
}
},
update() {
@@ -277,6 +301,7 @@
.desItem {
margin-top: 7px;
+ font-size: 13px;
.iconfont {
margin-right: 10px;
font-size: 16px;
@@ -387,8 +412,18 @@
}
.control {
+ position: relative;
width: 128px;
+ .close {
+ position: absolute;
+ top: 12px;
+ right: 15px;
+ font-size: 12px;
+ color: #e34d59;
+ cursor: pointer;
+ }
+
.btns {
display: flex;
margin-top: 68px;
--
Gitblit v1.8.0