From 998cff2189462a97cb8d6e1e7b9f88d9ecca524b Mon Sep 17 00:00:00 2001
From: heyujie <516346543@qq.com>
Date: 星期四, 14 七月 2022 14:34:36 +0800
Subject: [PATCH] add device clusterpwd change to authPwd
---
src/views/hashrate/CameraManage/CameraRules/components/RuleItem.vue | 73 ++++++++++++++++++++++++------------
1 files changed, 49 insertions(+), 24 deletions(-)
diff --git a/src/views/hashrate/CameraManage/CameraRules/components/RuleItem.vue b/src/views/hashrate/CameraManage/CameraRules/components/RuleItem.vue
index f385dce..f42c334 100644
--- a/src/views/hashrate/CameraManage/CameraRules/components/RuleItem.vue
+++ b/src/views/hashrate/CameraManage/CameraRules/components/RuleItem.vue
@@ -80,13 +80,14 @@
<div class="empty" @dragover="dragover($event)" @drop="drop" v-else>
<img src="/images/hashrate/鏈厤缃畻娉曠┖椤甸潰.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 +101,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 +192,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 +208,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() {
@@ -387,8 +402,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