| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311 |
- <template>
- <div class="console">
- <div class="other-people">
- <div class="image-border image-border1"></div>
- <div class="image-border image-border2"></div>
- <div class="image-border image-border3"></div>
- <div class="image-border image-border4"></div>
- <div class="other-people-title">
- 控制台
- </div>
- <div class="lte_panel">
- <i class="el-icon-caret-left" @click="hidePanel" v-if="panelState == 0"></i>
- <i class="el-icon-caret-right" @click="showPanel" v-if="panelState == 1"></i>
- </div>
- <div class="cslist cubeContent">
- <div :class="[{'cstitle':true},{'active':cstitle}]" @click="ClickGetInfo(0,0)">
- 安全监控首页
- </div>
- <div class="loft cspart">
- <div class="lt_title">
- 楼层
- </div>
- <el-row :gutter="21">
- <el-col :span="8" v-for="(loft,i) in loftList">
- <div :class="[{'active':loftIndex == i+1 }]" @click="ClickGetInfo(1,i)">
- <div class="grid-content bg-purple"> {{loft.Name}}</div>
- </div>
- </el-col>
- </el-row>
- </div>
- <div class="manage cspart" v-show="manageList.length != 0">
- <div class="lt_title">
- 楼层管理区域
- </div>
- <el-row :gutter="21">
- <el-col :span="8" v-for="(manage,j) in manageList">
- <div :class="[{'active':manageIndex ==j+1 }]" @click="ClickGetInfo(2,j)">
- <div class="grid-content bg-purple">{{manage.Name}}</div>
- </div>
- </el-col>
- </el-row>
- </div>
- <div class="manage cspart" v-show="RoomList.length != 0">
- <div class="lt_title">
- 房间管理区域
- </div>
- <el-row :gutter="21">
- <el-col :span="8" v-for="(Room,j) in RoomList">
- <div :class="[{'active':RoomIndex ==j+1 }]" @click="ClickGetInfo(3,j)">
- <div class="grid-content bg-purple">{{Room.Name}}</div>
- </div>
- </el-col>
- </el-row>
- </div>
- <div class="equip cspart" v-show="equipList.length != 0">
- <div class="lt_title">
- SignalDigger设备
- </div>
- <el-row :gutter="21">
- <el-col :span="8" v-for="(equip,t) in equipList">
- <div :class="[{'active':equipIndex == t+1 }]" @click="ClickGetInfo(4,t)">
- <div class="grid-content bg-purple"> {{equip.Name}}</div>
- </div>
- </el-col>
- </el-row>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import {GetRegionAndDectorSelect} from '../api/getApiRes.js'
- let qs = require('qs');
- export default {
- data() {
- return {
- loftList: [],
- manageList: [],
- RoomList: [],
- equipList: [],
- FullChildlRs: [],
- loftIndex: 0,
- manageIndex: 0,
- RoomIndex: 0,
- equipIndex: 0,
- panelState: 0,
- cstitle: false,
- };
- },
- mounted() {
- this.getLoftList();
- },
- methods: {
- // 获取楼层信息
- ClickGetInfo(level, index) {
- // 切换到选中
- this.loftIndex = 0;
- this.manageIndex = 0;
- this.RoomIndex = 0;
- this.equipIndex = 0;
- this.cstitle = false;
- let thisBtn = {};
- switch (parseInt(level)) {
- case 0:
- this.cstitle = true;
- this.getLoftList();
- break;
- case 1:
- this.loftIndex = index + 1;
- thisBtn = this.loftList[index];
- break;
- case 2:
- this.manageIndex = index + 1;
- thisBtn = this.manageList[index];
- break;
- case 3:
- this.RoomIndex = index + 1;
- thisBtn = this.RoomList[index];
- break;
- case 4:
- this.equipIndex = index + 1;
- thisBtn = this.equipList[index];
- break;
- }
- this.$emit('refreshList', level, thisBtn);
- if (thisBtn) {
- this.showMyChild(level, thisBtn);
- this.thisShowPart(level, thisBtn);
- }
- },
- // 展示下层节点
- showMyChild(level, thisBtn) {
- let that = this;
- switch (parseInt(level)) {
- case 1:
- that.manageList = [];
- that.RoomIndex = 0;
- that.equipIndex = 0;
- that.RoomList = [];
- that.equipList = [];
- for (var i = 0; i < that.FullChildlRs.length; i++) {
- if (that.FullChildlRs[i].Id == thisBtn.Id) {
- that.manageList = that.FullChildlRs[i].ChildSelect;
- that.equipList = that.FullChildlRs[i].Detselect;
- }
- }
- break;
- case 2:
- that.RoomIndex = 0;
- that.equipIndex = 0;
- that.RoomList = [];
- that.equipList = [];
- for (var i = 0; i < that.FullChildlRs.length; i++) {
- for (var t = 0; t < that.FullChildlRs[i].ChildSelect.length; t++) {
- if (that.FullChildlRs[i].ChildSelect[t].Id == thisBtn.Id) {
- that.RoomList = that.FullChildlRs[i].ChildSelect[t].ChildSelect;
- that.equipList = that.FullChildlRs[i].ChildSelect[t].Detselect;
- }
- }
- }
- break;
- case 3:
- that.equipList = [];
- for (var i = 0; i < that.FullChildlRs.length; i++) {
- for (var t = 0; t < that.FullChildlRs[i].ChildSelect.length; t++) {
- for (var j = 0; j < that.FullChildlRs[i].ChildSelect[t].ChildSelect.length; j++) {
- if (that.FullChildlRs[i].ChildSelect[t].ChildSelect[j].Id == thisBtn.Id) {
- that.equipList = that.FullChildlRs[i].ChildSelect[t].ChildSelect[j].Detselect;
- }
- }
- }
- }
- break;
- case 4:
- that.RoomIndex = 0;
- break;
- }
- },
- thisShowPart(level, thisBtn) {
- },
- // 获取楼层信息
- getLoftList() {
- let that = this;
- let param = {
- 'token': localStorage.token,
- };
- let postdata = qs.stringify(param);
- GetRegionAndDectorSelect(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- if (!json.Region1Rs) {
- that.$message.error('区域列表为空,请先添加可用区域');
- return false
- }
- if (!json.DectectorRs) {
- that.$message.error('设备列表为空,请先添加可用设备');
- return false
- }
- that.loftList = json.Region1Rs;//所有1级
- that.manageList = json.Region2Rs;//所有2级
- that.RoomList = json.Region3Rs;//所有3级
- if (json.DectectorRs) {
- that.equipList = json.DectectorRs;//所有设备
- }
- that.FullChildlRs = json.FullChildlRs;//全部关系
- } else {
- if (json.Code == 1010) {
- that.$message.error(json.Memo + ',错误代码:' + json.Code);
- that.$router.push({path: '/login', query: {status: 1}});
- } else {
- that.$message.error(json.Memo + ',错误代码:' + json.Code);
- }
- }
- })
- },
- hidePanel() {
- this.panelState = 1;
- this.$emit('refresWidth', 1);
- },
- showPanel() {
- this.panelState = 0;
- this.$emit('refresWidth', 0);
- },
- }
- }
- </script>
- <style scoped>
- .console {
- float: left;
- color: #6DC1FF;
- }
- .other-people {
- width: 350px;
- min-height: 939px;
- margin-left: 0;
- }
- .cstitle {
- width: 314px;
- height: 45px;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- background: #0B2851;
- border: 1px solid #005EA2;
- line-height: 45px;
- margin-bottom: 26px;
- cursor: pointer;
- }
- .cspart {
- width: 314px;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- margin-bottom: 22px;
- }
- .lt_title {
- text-align: left;
- font-size: 14px;
- margin-bottom: 16px;
- }
- .cspart .bg-purple {
- height: 30px;
- background: rgba(27, 86, 200, 0.14);
- border: 1px solid #005EA2;
- line-height: 30px;
- margin-bottom: 9px;
- cursor: pointer;
- font-size: 12px;
- }
- .cspart .bg-purple:hover {
- background: #0162AA;
- border-color: #6DC1FF;
- color: #6DC1FF
- }
- .active {
- background: #0162AA;
- border-color: #6DC1FF;
- color: #6DC1FF
- }
- .bg-purple {
- overflow: hidden;
- }
- .lte_panel {
- position: relative;
- left: -15px;
- width: 10%;
- float: left;
- display: none;
- }
- /*响应式调整*/
- @media only screen and (max-width: 1600px) {
- .lte_panel {
- display: block;
- }
- }
- </style>
|