From f20a554bdb24e9dfde9dc6a69d78595944f61d15 Mon Sep 17 00:00:00 2001 From: mark <mark18340872469@163.com> Date: 星期二, 25 十月 2022 14:53:57 +0800 Subject: [PATCH] 设备管理 样式调整 --- src/views/hashrate/CameraManage/CameraRules/components/LinkageCameraBox.vue | 136 +++++++++++++++++++++++--------------------- 1 files changed, 71 insertions(+), 65 deletions(-) diff --git a/src/views/hashrate/CameraManage/CameraRules/components/LinkageCameraBox.vue b/src/views/hashrate/CameraManage/CameraRules/components/LinkageCameraBox.vue index 74bf857..7687185 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"> - <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(); @@ -120,11 +116,9 @@ //瀹炴椂銆佽疆璇㈠垏鎹� changePoll(row, index) { - if (!this.cameraArr[index].analytics) { - return; - } - //鍒ゆ柇鏄柊澧炶繕鏄洿鏂� + console.log(this.cameraArr[index]); + if ( this.cameraArr[index].cameraId && this.cameraArr[index].cameraId !== undefined @@ -172,7 +166,7 @@ }); } } - this.TreeDataPool.fetchTreeData(); + // this.TreeDataPool.fetchTreeData(); // this.PollData.statisticTaskInfo(); } }, @@ -183,14 +177,23 @@ }, 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, - dealWay: rsp.data.runType !== 1 ? true : false, + dealWay: rsp.data.runType == 1 ? true : false, camearInfo: { resolutionWidth: rsp.data.resolutionWidth, resolutionHeight: rsp.data.resolutionHeight, @@ -198,6 +201,9 @@ }); } }); + + this.cameraArr = arr; + this.$forceUpdate(); }, }, watch: { -- Gitblit v1.8.0