Console.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. <template>
  2. <div class="console">
  3. <div class="other-people">
  4. <div class="image-border image-border1"></div>
  5. <div class="image-border image-border2"></div>
  6. <div class="image-border image-border3"></div>
  7. <div class="image-border image-border4"></div>
  8. <div class="other-people-title">
  9. 控制台
  10. </div>
  11. <div class="lte_panel">
  12. <i class="el-icon-caret-left" @click="hidePanel" v-if="panelState == 0"></i>
  13. <i class="el-icon-caret-right" @click="showPanel" v-if="panelState == 1"></i>
  14. </div>
  15. <div class="cslist cubeContent">
  16. <div :class="[{'cstitle':true},{'active':cstitle}]" @click="ClickGetInfo(0,0)">
  17. 安全监控首页
  18. </div>
  19. <div class="loft cspart">
  20. <div class="lt_title">
  21. 楼层
  22. </div>
  23. <el-row :gutter="21">
  24. <el-col :span="8" v-for="(loft,i) in loftList">
  25. <div :class="[{'active':loftIndex == i+1 }]" @click="ClickGetInfo(1,i)">
  26. <div class="grid-content bg-purple"> {{loft.Name}}</div>
  27. </div>
  28. </el-col>
  29. </el-row>
  30. </div>
  31. <div class="manage cspart" v-show="manageList.length != 0">
  32. <div class="lt_title">
  33. 楼层管理区域
  34. </div>
  35. <el-row :gutter="21">
  36. <el-col :span="8" v-for="(manage,j) in manageList">
  37. <div :class="[{'active':manageIndex ==j+1 }]" @click="ClickGetInfo(2,j)">
  38. <div class="grid-content bg-purple">{{manage.Name}}</div>
  39. </div>
  40. </el-col>
  41. </el-row>
  42. </div>
  43. <div class="manage cspart" v-show="RoomList.length != 0">
  44. <div class="lt_title">
  45. 房间管理区域
  46. </div>
  47. <el-row :gutter="21">
  48. <el-col :span="8" v-for="(Room,j) in RoomList">
  49. <div :class="[{'active':RoomIndex ==j+1 }]" @click="ClickGetInfo(3,j)">
  50. <div class="grid-content bg-purple">{{Room.Name}}</div>
  51. </div>
  52. </el-col>
  53. </el-row>
  54. </div>
  55. <div class="equip cspart" v-show="equipList.length != 0">
  56. <div class="lt_title">
  57. SignalDigger设备
  58. </div>
  59. <el-row :gutter="21">
  60. <el-col :span="8" v-for="(equip,t) in equipList">
  61. <div :class="[{'active':equipIndex == t+1 }]" @click="ClickGetInfo(4,t)">
  62. <div class="grid-content bg-purple"> {{equip.Name}}</div>
  63. </div>
  64. </el-col>
  65. </el-row>
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. </template>
  71. <script>
  72. import {GetRegionAndDectorSelect} from '../api/getApiRes.js'
  73. let qs = require('qs');
  74. export default {
  75. data() {
  76. return {
  77. loftList: [],
  78. manageList: [],
  79. RoomList: [],
  80. equipList: [],
  81. FullChildlRs: [],
  82. loftIndex: 0,
  83. manageIndex: 0,
  84. RoomIndex: 0,
  85. equipIndex: 0,
  86. panelState: 0,
  87. cstitle: false,
  88. };
  89. },
  90. mounted() {
  91. this.getLoftList();
  92. },
  93. methods: {
  94. // 获取楼层信息
  95. ClickGetInfo(level, index) {
  96. // 切换到选中
  97. this.loftIndex = 0;
  98. this.manageIndex = 0;
  99. this.RoomIndex = 0;
  100. this.equipIndex = 0;
  101. this.cstitle = false;
  102. let thisBtn = {};
  103. switch (parseInt(level)) {
  104. case 0:
  105. this.cstitle = true;
  106. this.getLoftList();
  107. break;
  108. case 1:
  109. this.loftIndex = index + 1;
  110. thisBtn = this.loftList[index];
  111. break;
  112. case 2:
  113. this.manageIndex = index + 1;
  114. thisBtn = this.manageList[index];
  115. break;
  116. case 3:
  117. this.RoomIndex = index + 1;
  118. thisBtn = this.RoomList[index];
  119. break;
  120. case 4:
  121. this.equipIndex = index + 1;
  122. thisBtn = this.equipList[index];
  123. break;
  124. }
  125. this.$emit('refreshList', level, thisBtn);
  126. if (thisBtn) {
  127. this.showMyChild(level, thisBtn);
  128. this.thisShowPart(level, thisBtn);
  129. }
  130. },
  131. // 展示下层节点
  132. showMyChild(level, thisBtn) {
  133. let that = this;
  134. switch (parseInt(level)) {
  135. case 1:
  136. that.manageList = [];
  137. that.RoomIndex = 0;
  138. that.equipIndex = 0;
  139. that.RoomList = [];
  140. that.equipList = [];
  141. for (var i = 0; i < that.FullChildlRs.length; i++) {
  142. if (that.FullChildlRs[i].Id == thisBtn.Id) {
  143. that.manageList = that.FullChildlRs[i].ChildSelect;
  144. that.equipList = that.FullChildlRs[i].Detselect;
  145. }
  146. }
  147. break;
  148. case 2:
  149. that.RoomIndex = 0;
  150. that.equipIndex = 0;
  151. that.RoomList = [];
  152. that.equipList = [];
  153. for (var i = 0; i < that.FullChildlRs.length; i++) {
  154. for (var t = 0; t < that.FullChildlRs[i].ChildSelect.length; t++) {
  155. if (that.FullChildlRs[i].ChildSelect[t].Id == thisBtn.Id) {
  156. that.RoomList = that.FullChildlRs[i].ChildSelect[t].ChildSelect;
  157. that.equipList = that.FullChildlRs[i].ChildSelect[t].Detselect;
  158. }
  159. }
  160. }
  161. break;
  162. case 3:
  163. that.equipList = [];
  164. for (var i = 0; i < that.FullChildlRs.length; i++) {
  165. for (var t = 0; t < that.FullChildlRs[i].ChildSelect.length; t++) {
  166. for (var j = 0; j < that.FullChildlRs[i].ChildSelect[t].ChildSelect.length; j++) {
  167. if (that.FullChildlRs[i].ChildSelect[t].ChildSelect[j].Id == thisBtn.Id) {
  168. that.equipList = that.FullChildlRs[i].ChildSelect[t].ChildSelect[j].Detselect;
  169. }
  170. }
  171. }
  172. }
  173. break;
  174. case 4:
  175. that.RoomIndex = 0;
  176. break;
  177. }
  178. },
  179. thisShowPart(level, thisBtn) {
  180. },
  181. // 获取楼层信息
  182. getLoftList() {
  183. let that = this;
  184. let param = {
  185. 'token': localStorage.token,
  186. };
  187. let postdata = qs.stringify(param);
  188. GetRegionAndDectorSelect(postdata).then(res => {
  189. let json = res;
  190. if (json.Code == 0) {
  191. if (!json.Region1Rs) {
  192. that.$message.error('区域列表为空,请先添加可用区域');
  193. return false
  194. }
  195. if (!json.DectectorRs) {
  196. that.$message.error('设备列表为空,请先添加可用设备');
  197. return false
  198. }
  199. that.loftList = json.Region1Rs;//所有1级
  200. that.manageList = json.Region2Rs;//所有2级
  201. that.RoomList = json.Region3Rs;//所有3级
  202. if (json.DectectorRs) {
  203. that.equipList = json.DectectorRs;//所有设备
  204. }
  205. that.FullChildlRs = json.FullChildlRs;//全部关系
  206. } else {
  207. if (json.Code == 1010) {
  208. that.$message.error(json.Memo + ',错误代码:' + json.Code);
  209. that.$router.push({path: '/login', query: {status: 1}});
  210. } else {
  211. that.$message.error(json.Memo + ',错误代码:' + json.Code);
  212. }
  213. }
  214. })
  215. },
  216. hidePanel() {
  217. this.panelState = 1;
  218. this.$emit('refresWidth', 1);
  219. },
  220. showPanel() {
  221. this.panelState = 0;
  222. this.$emit('refresWidth', 0);
  223. },
  224. }
  225. }
  226. </script>
  227. <style scoped>
  228. .console {
  229. float: left;
  230. color: #6DC1FF;
  231. }
  232. .other-people {
  233. width: 350px;
  234. min-height: 939px;
  235. margin-left: 0;
  236. }
  237. .cstitle {
  238. width: 314px;
  239. height: 45px;
  240. overflow: hidden;
  241. display: block;
  242. margin: 0 auto;
  243. background: #0B2851;
  244. border: 1px solid #005EA2;
  245. line-height: 45px;
  246. margin-bottom: 26px;
  247. cursor: pointer;
  248. }
  249. .cspart {
  250. width: 314px;
  251. overflow: hidden;
  252. display: block;
  253. margin: 0 auto;
  254. margin-bottom: 22px;
  255. }
  256. .lt_title {
  257. text-align: left;
  258. font-size: 14px;
  259. margin-bottom: 16px;
  260. }
  261. .cspart .bg-purple {
  262. height: 30px;
  263. background: rgba(27, 86, 200, 0.14);
  264. border: 1px solid #005EA2;
  265. line-height: 30px;
  266. margin-bottom: 9px;
  267. cursor: pointer;
  268. font-size: 12px;
  269. }
  270. .cspart .bg-purple:hover {
  271. background: #0162AA;
  272. border-color: #6DC1FF;
  273. color: #6DC1FF
  274. }
  275. .active {
  276. background: #0162AA;
  277. border-color: #6DC1FF;
  278. color: #6DC1FF
  279. }
  280. .bg-purple {
  281. overflow: hidden;
  282. }
  283. .lte_panel {
  284. position: relative;
  285. left: -15px;
  286. width: 10%;
  287. float: left;
  288. display: none;
  289. }
  290. /*响应式调整*/
  291. @media only screen and (max-width: 1600px) {
  292. .lte_panel {
  293. display: block;
  294. }
  295. }
  296. </style>