From 907a3504a77873a8e762adc2f684222c8946adec Mon Sep 17 00:00:00 2001 From: zhangzengfei <zhangzengfei@smartai.com> Date: 星期三, 10 八月 2022 21:18:54 +0800 Subject: [PATCH] 添加实时监控,调整树的滚动条 --- src/views/hashrate/HashManage/components/EquipmentForm.vue | 127 ++++++++++++++++-------------------------- 1 files changed, 48 insertions(+), 79 deletions(-) diff --git a/src/views/hashrate/HashManage/components/EquipmentForm.vue b/src/views/hashrate/HashManage/components/EquipmentForm.vue index bbf7174..a4b41d5 100644 --- a/src/views/hashrate/HashManage/components/EquipmentForm.vue +++ b/src/views/hashrate/HashManage/components/EquipmentForm.vue @@ -1,8 +1,6 @@ <template> <div class="EquipmentForm"> - <div class="back"> - <span class="iconfont" @click="hiddenList"></span>{{ name }} - </div> + <div class="back"><span class="iconfont" @click="hiddenList"></span>{{ name }}</div> <div class="header"> <div class="search"> <el-input v-model="searchInput" placeholder="璇疯緭鍏ュ唴瀹�"></el-input> @@ -29,34 +27,14 @@ :fit="true" :stripe="true" > - <el-table-column - label="搴忓彿" - type="index" - align="center" - width="80" - ></el-table-column> - <el-table-column - label="鎽勫儚鏈哄悕绉�" - align="center" - show-overflow-tooltip - > + <el-table-column label="搴忓彿" type="index" align="center" width="80"></el-table-column> + <el-table-column label="鎽勫儚鏈哄悕绉�" align="center" show-overflow-tooltip> <template slot-scope="scope"> - <span>{{ - scope.row.alias !== "" ? scope.row.alias : scope.row.name - }}</span> + <span>{{ scope.row.alias !== "" ? scope.row.alias : scope.row.name }}</span> </template> </el-table-column> - <el-table-column - label="鎽勫儚鏈哄湴鍧�" - prop="addr" - align="center" - show-overflow-tooltip - ></el-table-column> - <el-table-column - label="鎽勫儚鏈篒P" - prop="ip" - align="center" - ></el-table-column> + <el-table-column label="鎽勫儚鏈哄湴鍧�" prop="addr" align="center" show-overflow-tooltip></el-table-column> + <el-table-column label="鎽勫儚鏈篒P" prop="ip" align="center"></el-table-column> <el-table-column label="鎽勫儚鏈虹被鍨�" align="center"> <template slot-scope="scope"> <span>{{ scope.row.runType | cameraType }}</span> @@ -64,9 +42,7 @@ </el-table-column> <el-table-column label="鎵ц绠楁硶" align="center" show-overflow-tooltip> <template slot-scope="scope"> - <span v-if="scope.row.tasks != null">{{ - scope.row.tasks | taskList - }}</span> + <span v-if="scope.row.tasks != null">{{ scope.row.tasks | taskList }}</span> <span v-else>-</span> </template> </el-table-column> @@ -92,7 +68,7 @@ :color="{ checked: '#4D88FF', unchecked: '#FF7733', - disabled: '#CCCCCC', + disabled: '#CCCCCC' }" :sync="true" @change="pollSwitch(scope.row)" @@ -115,29 +91,25 @@ </div> </div> - <SettingBox - v-if="showSettingBox" - @close="showSettingBox = false" - :id="id" - ></SettingBox> + <SettingBox v-if="showSettingBox" @close="showSettingBox = false" :id="id"></SettingBox> </div> </template> <script> -import SettingBox from "./SettingBox"; -import { getCameraByPage } from "@/api/clusterManage"; -import { changeRunType } from "@/api/pollConfig"; +import SettingBox from "./SettingBox" +import { getCameraByPage } from "@/api/clusterManage" +import { changeRunType } from "@/api/pollConfig" export default { props: { id: {}, - name: {}, + name: {} }, components: { - SettingBox, + SettingBox }, created() { - this.getDevice(); + this.getDevice() }, data() { return { @@ -146,8 +118,8 @@ dataList: [], page: 1, size: 10, - total: 100, - }; + total: 100 + } }, methods: { async getDevice() { @@ -155,79 +127,76 @@ deviceId: this.id, inputText: this.searchInput, page: this.page, - size: this.size, - }); + size: this.size + }) if (res && res.success) { - this.dataList = res.data.lists; - this.total = res.data.total; + this.dataList = res.data.lists + this.total = res.data.total } // 鏍规嵁rtsp 鎻愬彇ip鍦板潃 - const ipReg = /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/; + const ipReg = /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/ this.dataList.forEach((cam) => { // 鍥芥爣鎽勫儚鏈轰笉鏄剧ずip if (cam.type === 1) { - cam.ip = "-"; - return; + cam.ip = "-" + return } - let ip = ipReg.exec(cam.rtsp); + let ip = ipReg.exec(cam.rtsp) if (ip.length > 0) { - cam.ip = ip[0]; + cam.ip = ip[0] } - }); + }) }, handleSizeChange(size) { - this.size = size; - this.getDevice(); + this.size = size + this.getDevice() }, refrash(page) { - this.page = page; - this.getDevice(); + this.page = page + this.getDevice() }, hiddenList() { - this.$emit("hiddenList"); + this.$emit("hiddenList") }, pollSwitch(row) { - row.runType = row.runType ^ 1; + row.runType = row.runType ^ 1 changeRunType({ camera_ids: [row.id], run_type: row.runType ^ 1, - clusterId: row.clusterId, + clusterId: row.clusterId }).then((rsp) => { if (rsp && rsp.success) { this.$notify({ type: "success", - message: "閰嶇疆鎴愬姛", - }); + message: "閰嶇疆鎴愬姛" + }) } else { this.$notify({ type: "error", - message: "閰嶇疆澶辫触", - }); + message: "閰嶇疆澶辫触" + }) } // this.PollData.fetchPollList(); - }); - }, + }) + } }, filters: { cameraType(type) { - return type === -1 ? "鐩戞帶鎽勫儚鏈�" : "AI鎽勫儚鏈�"; + return type === -1 ? "鐩戞帶鎽勫儚鏈�" : "AI鎽勫儚鏈�" }, taskList(tasks) { return tasks - .filter((task) => { - return task.hasRule; - }) .map((task) => { - return task.taskname; + return task.taskname }) - .join(","); + .join(",") }, switchText(type) { - return type ? "宸插紑鍚�" : "鏈紑鍚�"; - }, - }, -}; + return type ? "宸插紑鍚�" : "鏈紑鍚�" + } + } +} </script> <style lang="scss" scoped> @@ -459,4 +428,4 @@ } } } -</style> \ No newline at end of file +</style> -- Gitblit v1.8.0