From 7a2b07ad2b0715c6e2dffb5102cd1d1c05c28d6a Mon Sep 17 00:00:00 2001
From: mark <mark18340872469@163.com>
Date: 星期四, 29 九月 2022 11:14:20 +0800
Subject: [PATCH] 点位信息 all
---
src/views/hashrate/CameraManage/CameraRules/components/RuleItem.vue | 133 +++++++++++++++++++++++++++++++++++++++-----
1 files changed, 118 insertions(+), 15 deletions(-)
diff --git a/src/views/hashrate/CameraManage/CameraRules/components/RuleItem.vue b/src/views/hashrate/CameraManage/CameraRules/components/RuleItem.vue
index 8ef23dc..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>
@@ -30,7 +39,11 @@
:key="index"
>
<div class="relation" v-if="item.rule_with_pre">
- <el-select v-model="item.rule_with_pre" placeholder="閫夊叧绯�">
+ <el-select
+ v-model="item.rule_with_pre"
+ placeholder="閫夊叧绯�"
+ @change="update"
+ >
<el-option
v-for="item in sdkConnects"
:value="item.value"
@@ -39,14 +52,24 @@
:key="item.id"
></el-option>
</el-select>
+ <div>
+ <el-checkbox
+ v-show="
+ item.rule_with_pre == '=>' || item.rule_with_pre == '!=>'
+ "
+ v-model="item.is_save_anyhow"
+ @change="update"
+ >淇濆瓨杩囩▼鏁版嵁</el-checkbox
+ >
+ </div>
</div>
<div class="imgBox">
<img :src="item.icon_blob" alt="" />
<div class="mask">
<div class="mask_del">
- <i class="iconfont"></i>
+ <i class="iconfont" @click="delSdk(index)"></i>
</div>
- <div class="mask_edit">
+ <div class="mask_edit" @click="editSdk(index)">
<i class="iconfont"></i>
</div>
</div>
@@ -64,19 +87,20 @@
</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>
- <div class="button submit">淇濆瓨</div>
+ <div class="button submit" @click="save">淇濆瓨</div>
</div>
</div>
</div>
@@ -86,16 +110,18 @@
<script>
import bus from "@/plugin/bus";
-import { logout } from "@/api/login";
+import { saveLinkScene, saveCameraScene, deleteCameraScene } from "@/api/scene";
+
export default {
props: {
rule: {},
+ ruleType: {},
+ cameraId: {},
},
created() {
- this.originRule = JSON.parse(JSON.stringify(this.rule));
this.getSdkConnection();
bus.$on("addSdk", () => {
- if (this.rule.rules.length < 4) {
+ if (this.rule.rules && this.rule.rules.length < 4) {
this.showAddBox = true;
}
});
@@ -132,7 +158,6 @@
},
],
showAddBox: false,
- originRule: {},
};
},
computed: {
@@ -173,8 +198,70 @@
edit() {
this.$emit("edit");
},
+ delSdk(index) {
+ this.rule.rules.splice(index, 1);
+
+ if (this.rule.rules.length == 1) {
+ this.rule.rules[0].rule_with_pre = "";
+ }
+
+ this.update();
+
+ console.log(this.rule.rules);
+ },
backToOrigin() {
- this.$emit("backToOrigin", this.originRule);
+ this.$emit("backToOrigin");
+ },
+ editSdk(index) {
+ this.$emit("editSdk", index);
+ },
+ save() {
+ if (this.ruleType === "separate") {
+ this.rule.cameraIds = [this.cameraId];
+ saveCameraScene(this.rule).then((rsp) => {
+ if (rsp && rsp.success) {
+ this.$notify({
+ type: "success",
+ message: "绛栫暐淇濆瓨鎴愬姛锛�",
+ });
+ this.backToOrigin();
+ }
+ });
+ } else {
+ 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() {
+ this.$forceUpdate();
},
},
};
@@ -214,6 +301,7 @@
.desItem {
margin-top: 7px;
+ font-size: 13px;
.iconfont {
margin-right: 10px;
font-size: 16px;
@@ -324,7 +412,17 @@
}
.control {
+ position: relative;
width: 128px;
+
+ .close {
+ position: absolute;
+ top: 12px;
+ right: 15px;
+ font-size: 12px;
+ color: #e34d59;
+ cursor: pointer;
+ }
.btns {
display: flex;
@@ -376,5 +474,10 @@
margin: 10px 0 10px 20px;
border-right: 1px solid #e9ebee;
}
+
+ .el-checkbox {
+ margin-top: 5px;
+ margin-left: 10px;
+ }
}
</style>
\ No newline at end of file
--
Gitblit v1.8.0