From 658915facb9ec5a5ad83abceb4d64dccac15e631 Mon Sep 17 00:00:00 2001
From: ZZJ <zzjdsg2300@163.com>
Date: 星期二, 29 三月 2022 14:52:46 +0800
Subject: [PATCH] 摄像机管理
---
src/views/hashrate/CameraManage/CameraRules/components/RuleItem.vue | 86 ++++++++++++++++++++++++++++++++++++++----
1 files changed, 77 insertions(+), 9 deletions(-)
diff --git a/src/views/hashrate/CameraManage/CameraRules/components/RuleItem.vue b/src/views/hashrate/CameraManage/CameraRules/components/RuleItem.vue
index 8ef23dc..f385dce 100644
--- a/src/views/hashrate/CameraManage/CameraRules/components/RuleItem.vue
+++ b/src/views/hashrate/CameraManage/CameraRules/components/RuleItem.vue
@@ -30,7 +30,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 +43,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>
@@ -76,7 +90,7 @@
<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 +100,17 @@
<script>
import bus from "@/plugin/bus";
-import { logout } from "@/api/login";
+import { saveLinkScene, saveCameraScene } from "@/api/scene";
+
export default {
props: {
rule: {},
+ ruleType: {},
},
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 +147,6 @@
},
],
showAddBox: false,
- originRule: {},
};
},
computed: {
@@ -173,8 +187,57 @@
edit() {
this.$emit("edit");
},
+ delSdk(index) {
+ this.rule.rules.splice(index, 1);
+
+ if (this.rule.rules[index]) {
+ this.rule.rules[index].rule_with_pre = "";
+ }
+
+ 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.rule.cameraId];
+ saveCameraScene(this.rule).then((rsp) => {
+ if (rsp && rsp.success) {
+ this.$notify({
+ type: "success",
+ message: "绛栫暐淇濆瓨鎴愬姛锛�",
+ });
+ }
+ });
+ } 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: "淇濆瓨澶辫触锛�",
+ });
+ });
+ }
+ },
+ update() {
+ this.$forceUpdate();
},
},
};
@@ -376,5 +439,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