From 2a79cb1757da192b8a302d45d527b2b083f30bc3 Mon Sep 17 00:00:00 2001
From: heyujie <516346543@qq.com>
Date: 星期四, 24 六月 2021 11:36:18 +0800
Subject: [PATCH] 标记编辑时回显
---
src/pages/cameraAccess/components/LinkageRule.vue | 103 ++++++++++++++++++++++++++++++---------------------
1 files changed, 60 insertions(+), 43 deletions(-)
diff --git a/src/pages/cameraAccess/components/LinkageRule.vue b/src/pages/cameraAccess/components/LinkageRule.vue
index afc9aad..490536a 100644
--- a/src/pages/cameraAccess/components/LinkageRule.vue
+++ b/src/pages/cameraAccess/components/LinkageRule.vue
@@ -17,8 +17,8 @@
/>
</div>
</div>
- </div> -->
- <div class="top" >
+ </div>-->
+ <div class="top">
<p class="task-css">
<b style="font-size: 14px; line-height: 18px;">鍦烘櫙</b>
</p>
@@ -36,7 +36,7 @@
:ShowLocalVedio="cameraType === 'dataStack'"
v-if="showSysInfo"
style="margin-top:-10px"
- /> -->
+ />-->
</div>
</div>
</div>
@@ -74,6 +74,7 @@
:currentCameraId="data.cameraId"
@changeLoading="changeLoading"
@fromCanvas="getCanvasData"
+ @refresh="refresh"
></polygon-canvas>
</swiper-slide>
</swiper>
@@ -108,6 +109,7 @@
:tableRuleList="tableRuleList"
:onSaveScene="saveSceneRule"
@delete-rule="showRules"
+ v-loading="loadingRuleList"
></scene-rule>
</div>
</div>
@@ -138,26 +140,13 @@
},
computed: {
selectedCameraIds() {
- let ids = [];
- if (this.TreeDataPool.treeActiveName == 'dataStack') {
- if (this.TreeDataPool.checkedLocalVedio.length > 0) {
- ids = this.TreeDataPool.checkedLocalVedio.map(i => {
- return i.id;
- })
-
- }
- } else {
- if (this.TreeDataPool.selectedNodes.length > 0) {
- ids = this.TreeDataPool.selectedNodes;
- }
- }
-
- return ids;
+ return this.TreeDataPool.selectedNodes;
}
},
data() {
return {
loading: false,
+ loadingRuleList: false,
Carmeras: [],
Camera: new VideoRuleData(),
tasksTable: {},
@@ -188,7 +177,8 @@
prevEl: ".pre-border"
}
},
- showSysInfo: false
+ showSysInfo: false,
+ requestSeq: ""
};
},
watch: {
@@ -207,17 +197,12 @@
initCameraData() {
this.$nextTick(() => {
this.Carmeras = [];
- this.loading = false;
- this.showSysInfo = true
- if (this.TreeDataPool.treeActiveName == 'dataStack') {
- this.TreeDataPool.checkedLocalVedio.forEach(camera => {
- this.Carmeras.push(new VideoRuleData(camera.id));
- });
- } else {
- this.TreeDataPool.selectedNodes.forEach(camera => {
- this.Carmeras.push(new VideoRuleData(camera));
- });
- }
+ this.showSysInfo = true;
+
+ this.selectedCameraIds.forEach(cid => {
+ this.Carmeras.push(new VideoRuleData(cid));
+ });
+
this.$refs.timeSlider.activeTab = this.VideoManageData.TimeRules[0].id;
this.showRules();
})
@@ -236,14 +221,36 @@
}
this.swipercanvasData = swipers;
},
+ refresh(url, id) {
+ this.swipercanvasData.forEach(data => {
+ if (data.cameraId == id) {
+ data.baseImg = url;
+ }
+ })
+ //this.Camera.baseImg = url
+ },
getCanvasData() { },
+ newUid() {
+
+ let originStr = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
+ let originChar = "0123456789abcdef";
+ let len = originChar.length;
+ return originStr.replace(/x/g, function (match) {
+ return originChar.charAt(Math.floor(Math.random() * len));
+ });
+ },
showRules() {
this.tableRuleList = [];
if (this.selectedCameraIds.length > 0) {
+ this.loadingRuleList = true;
+ let seq = this.newUid();
+ this.requestSeq = seq;
+
getLinkSceneRule({ cameraIds: this.selectedCameraIds }).then(
rsp => {
- if (rsp && rsp.success) {
+ this.loadingRuleList = false;
+ if (rsp && rsp.success && seq === this.requestSeq) {
this.tableRuleList = rsp.data;
@@ -254,19 +261,30 @@
}
// this.TreeDataPool.fetchTreeData();
}
- );
+ ).catch(() => {
+ this.loadingRuleList = false;
+ });
}
-
},
saveSceneRule(groupRule) {
const payload = { ...groupRule }
+ if (!payload.rules) {
+ this.$message({
+ type: "warning",
+ message: "瑙勫垯鍙傛暟鏈夎"
+ });
+
+ return
+ }
+
payload.cameraIds = this.selectedCameraIds;
saveLinkScene(payload).then(rsp => {
if (rsp && rsp.success) {
//this.Camera.update();
this.initCameraData();
+ // this.showRules();
this.$notify({
type: "success",
message: "浠诲姟淇濆瓨鎴愬姛锛�"
@@ -280,7 +298,7 @@
}).catch(err => {
this.$message({
type: "error",
- message: "淇濆瓨澶辫触锛�" + err.data
+ message: "淇濆瓨澶辫触锛�"
});
});
},
@@ -296,9 +314,9 @@
//height: 100%;
//padding: 13px 0 20px;
position: relative;
- .devide{
+ .devide {
height: 10px;
- background: #E9EBF2;
+ background: #e9ebf2;
}
.top {
width: 100%;
@@ -396,14 +414,14 @@
float: right;
width: 54%;
height: 144px;
- .card-box{
- width: 54%!important;
+ .card-box {
+ width: 54% !important;
}
- .eCharts-box{
+ .eCharts-box {
width: 45%;
- canvas{
- width: 98%!important;
- }
+ canvas {
+ width: 98% !important;
+ }
}
}
.task-css {
@@ -568,7 +586,6 @@
.add-btn:hover {
color: #2249b4;
}
-
}
</style>
<style lang="scss" scoped>
--
Gitblit v1.8.0