From edef6ae8f59823258ce610c9074d32e698958b51 Mon Sep 17 00:00:00 2001 From: ZZJ <10913410+zzj2100@user.noreply.gitee.com> Date: 星期四, 28 七月 2022 15:30:44 +0800 Subject: [PATCH] 本地图片适配 --- src/views/hashrate/CameraManage/CameraRules/components/LinkageCameraBox.vue | 134 +++++++++++++++++++++++--------------------- 1 files changed, 69 insertions(+), 65 deletions(-) diff --git a/src/views/hashrate/CameraManage/CameraRules/components/LinkageCameraBox.vue b/src/views/hashrate/CameraManage/CameraRules/components/LinkageCameraBox.vue index 7990282..579333e 100644 --- a/src/views/hashrate/CameraManage/CameraRules/components/LinkageCameraBox.vue +++ b/src/views/hashrate/CameraManage/CameraRules/components/LinkageCameraBox.vue @@ -1,60 +1,56 @@ <template> - <div class="CameraBox"> - <div v-if="cameras"> - <div v-for="(camera, index) in cameraArr" :key="index" class="boxItem"> - <div class="header"> - <i class="iconfont"></i> - <div class="name">{{ camera.cameraName }}</div> - <el-switch - v-model="camera.analytics" - @change="pollEnable($event, index)" - active-color="#D4E3FA" - inactive-color="#E9EBEE" - :width="56" - > - </el-switch> - </div> - - <div class="body"> - <div class="row" v-if="camera.analytics"> - <div class="label">澶勭悊鏂瑰紡:</div> - <div - class="button pollingBtn" - :class="{ active: !camera.dealWay }" - @click="changePoll(false, index)" - > - 杞 - </div> - <div - class="button realtimeBtn" - :class="{ active: camera.dealWay }" - @click="changePoll(true, index)" - > - 瀹炴椂 - </div> - </div> - <div class="row"> - <div class="label">鍒嗚鲸鐜�:</div> - <div class="data"> - {{ - !camera.camearInfo.resolutionWidth || - !camera.camearInfo.resolutionHeight || - camera.camearInfo.resolutionWidth == 0 || - camera.camearInfo.resolutionHeight == 0 - ? "鏈満鍒嗚鲸鐜�" - : `${camera.camearInfo.resolutionWidth} * ${camera.camearInfo.resolutionHeight}` - }} - </div> - </div> - </div> + <div class="CameraBox" v-if="cameras"> + <div v-for="(camera, index) in cameraArr" :key="index" class="boxItem"> + <div class="header"> + <i class="iconfont"></i> + <div class="name">{{ camera.cameraName }}</div> + <el-switch + v-model="camera.analytics" + @change="pollEnable($event, index)" + active-color="#D4E3FA" + inactive-color="#E9EBEE" + :width="56" + > + </el-switch> </div> - <div class="footer"> - <div class="button addModel">娣诲姞鍒版ā鏉�</div> - <div class="button addRule" @click="addRule">娣诲姞鏂板満鏅�</div> + + <div class="body"> + <div class="row" v-if="camera.analytics"> + <div class="label">澶勭悊鏂瑰紡:</div> + <div + class="button pollingBtn" + :class="{ active: !camera.dealWay }" + @click="changePoll(false, index)" + > + 杞 + </div> + <div + class="button realtimeBtn" + :class="{ active: camera.dealWay }" + @click="changePoll(true, index)" + > + 瀹炴椂 + </div> + </div> + <div class="row"> + <div class="label">鍒嗚鲸鐜�:</div> + <div class="data"> + {{ + !camera.camearInfo.resolutionWidth || + !camera.camearInfo.resolutionHeight || + camera.camearInfo.resolutionWidth == 0 || + camera.camearInfo.resolutionHeight == 0 + ? "鏈満鍒嗚鲸鐜�" + : `${camera.camearInfo.resolutionWidth} * ${camera.camearInfo.resolutionHeight}` + }} + </div> + </div> </div> </div> - - <div class="empty" v-else>鏆傛湭鑾峰緱鎽勫儚鏈轰俊鎭�</div> + <div class="footer"> + <!-- <div class="button addModel">娣诲姞鍒版ā鏉�</div> --> + <div class="button addRule" @click="addRule">娣诲姞鏂板満鏅�</div> + </div> </div> </template> @@ -68,15 +64,16 @@ type: Array, }, }, - created() { - this.getCameraInfo(); - }, data() { return { cameraArr: [], }; }, + created() { + this.getCameraInfo(); + }, + computed: {}, methods: { //鏄惁杩涜瑙嗛鍒嗘瀽澶勭悊 pollEnable(row, index) { @@ -112,7 +109,6 @@ message: "閰嶇疆澶辫触", }); } - this.TreeDataPool.fetchTreeData(); }); } // this.PollData.statisticTaskInfo(); @@ -127,14 +123,10 @@ this.cameraArr[index].cameraId && this.cameraArr[index].cameraId !== undefined ) { - console.log(1); if (this.PollData.RealTimeSum < this.PollData.channelTotal) { if (row) { - console.log(2); this.cameraArr[index].dealWay = true; } else { - console.log(3); - this.cameraArr[index].dealWay = false; } changeRunType({ @@ -174,7 +166,7 @@ }); } } - this.TreeDataPool.fetchTreeData(); + // this.TreeDataPool.fetchTreeData(); // this.PollData.statisticTaskInfo(); } }, @@ -185,11 +177,19 @@ }, getCameraInfo() { - this.cameraArr = []; + if (this.cameras.length <= 0) { + return; + } + + let arr = []; + this.cameras.forEach(async (id) => { + if (!id) { + return; + } const rsp = await getCameraInfo(id); if (rsp.success) { - this.cameraArr.push({ + arr.push({ cameraId: rsp.data.id, cameraName: rsp.data.name ? rsp.data.name : "", analytics: rsp.data.runType !== -1 ? true : false, @@ -201,6 +201,9 @@ }); } }); + + this.cameraArr = arr; + this.$forceUpdate(); }, }, watch: { @@ -317,9 +320,10 @@ .footer { box-sizing: border-box; - padding: 10px; + padding: 5px; display: flex; align-items: center; + justify-content: center; border-top: 1px solid #e9ebee; .addModel { -- Gitblit v1.8.0