| | |
| | | </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> |
| | |
| | | |
| | | <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(); |
| | |
| | | }, |
| | | 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) => { |
| | | saveLinkScene(this.rule).then((rsp) => { |
| | | if (rsp && rsp.success) { |
| | | this.$notify({ |
| | | type: "success", |
| | | message: "任务保存成功!", |
| | | }); |
| | | this.backToOrigin(); |
| | | } else { |
| | | this.$notify({ |
| | | type: "error", |
| | | message: rsp.data, |
| | | }); |
| | | } |
| | | }) |
| | | .catch((err) => { |
| | | this.$message({ |
| | | type: "error", |
| | | message: "保存失败!", |
| | | }); |
| | | } |
| | | }, |
| | | 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() { |
| | |
| | | } |
| | | |
| | | .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; |