Main.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  1. <template>
  2. <div class="mainContainer">
  3. <div class="mlt">
  4. <Console @refreshList="changPanel"></Console>
  5. </div>
  6. <div class="mcenter">
  7. <div class="cube">
  8. <div class="total">
  9. <div class="other-people">
  10. <div class="image-border image-border1"></div>
  11. <div class="image-border image-border2"></div>
  12. <div class="image-border image-border3"></div>
  13. <div class="image-border image-border4"></div>
  14. <div class="other-people-title">
  15. 实时监测
  16. </div>
  17. <div class="totalContianer" v-if="TotalPanel || LoftPanel">
  18. <div class="tlt">
  19. <h5>正在监测</h5>
  20. <BigRader :total-rs="totalRs"></BigRader>
  21. </div>
  22. <div class="trt">
  23. <h5>实时监测记录</h5>
  24. <Watching :total-rs="totalRs"></Watching>
  25. </div>
  26. </div>
  27. <!--</div>-->
  28. <!--</div>-->
  29. <!--<div class="manageContainer" v-if="managePanel">-->
  30. <!--<div class="tlt">-->
  31. <!--<h5></h5>-->
  32. <!--<SmallRader :strs="totalRs"></SmallRader>-->
  33. <!--</div>-->
  34. <!--<div class="trt">-->
  35. <!--<Loft></Loft>-->
  36. <!--</div>-->
  37. <!--</div>-->
  38. <!--<div class="RoomContainer" v-if="RoomPanel">-->
  39. <!--<div class="tlt">-->
  40. <!--<h5></h5>-->
  41. <!--<SmallRader :strs="totalRs"></SmallRader>-->
  42. <!--</div>-->
  43. <!--<div class="trt">-->
  44. <!--<Room></Room>-->
  45. <!--</div>-->
  46. <!--</div>-->
  47. <!--<div class="DetctorContianer" v-if="DetctorPanel">-->
  48. <!--<div class="tlt">-->
  49. <!--<h5>正在监测</h5>-->
  50. <!--<BigRader :total-rs="totalRs"></BigRader>-->
  51. <!--</div>-->
  52. <!--<div class="trt">-->
  53. <!--<h5>实时监测记录</h5>-->
  54. <!--<Watching :total-rs="totalRs"></Watching>-->
  55. <!--</div>-->
  56. <!--</div>-->
  57. </div>
  58. </div>
  59. </div>
  60. <div class="cube">
  61. <WifiSign></WifiSign>
  62. </div>
  63. <Scan></Scan>
  64. </div>
  65. <div class="mrt">
  66. <div class="cube" v-if="pageLevel == 0||pageLevel == 4">
  67. <HistoryRecord></HistoryRecord>
  68. </div>
  69. <div class="cube" v-if="pageLevel == 1||pageLevel == 2||pageLevel == 3">
  70. <runTimeRecord></runTimeRecord>
  71. </div>
  72. <div v-if="pageLevel != 4">
  73. <EquipInfo></EquipInfo>
  74. </div>
  75. <!--单个设备情况-->
  76. <div v-if="pageLevel == 4">
  77. <SingleEquipInfo></SingleEquipInfo>
  78. </div>
  79. </div>
  80. </div>
  81. </template>
  82. <script>
  83. import Console from '@/components/Console.vue'
  84. import WifiSign from '@/components/WifiSign.vue'
  85. import Scan from '@/components/Scan.vue'
  86. import HistoryRecord from '@/components/HistoryRecord.vue'
  87. import EquipInfo from '@/components/EquipInfo.vue'
  88. import SingleEquipInfo from '@/components/SingleEquipInfo.vue'
  89. import runTimeRecord from '@/components/runTimeRecord.vue'
  90. import BigRader from '@/components/BigRader.vue'
  91. import SmallRader from '@/components/SmallRader.vue'
  92. import Watching from '@/components/Watching.vue'
  93. import Loft from '@/components/Loft.vue'
  94. import Room from '@/components/Room.vue'
  95. import {RegionDetInfolist} from '../api/getApiRes.js'
  96. let qs = require('qs');
  97. export default {
  98. data() {
  99. return {
  100. loadingState: false,
  101. pageLevel: 0,//操作层级 默认0查 全部 层级
  102. regionId: 0,//默认查全部
  103. TotalPanel: true,//总控
  104. LoftPanel: false,//楼层
  105. managePanel: false,//区域
  106. RoomPanel: false,//房间
  107. DetctorPanel: false,//设备
  108. totalRs: [],
  109. // pageLevel: 1,//当前为楼层
  110. // pageLevel: 2,//当前为楼层区域
  111. // pageLevel: 3,//当前为房间
  112. // pageLevel: 4,//当前为单个设备
  113. }
  114. },
  115. mounted() {
  116. let that = this;
  117. that.loadingState = false;
  118. // 获取数据
  119. that.getDate();
  120. // 定时查询
  121. that.timer = setInterval(() => {
  122. that.getDate();
  123. }, 2800);
  124. },
  125. destroyed() {
  126. //页面销毁时清除定时器
  127. clearInterval(this.timer);
  128. //页面销毁时清除添加条数动画的定时器
  129. clearInterval(this.wordDisplay);
  130. },
  131. methods: {
  132. changPanel(level, btn) {
  133. let that = this;
  134. this.regionId = btn.Id ? btn.Id : 0;
  135. if (btn == 0) {
  136. // 首页单独处理
  137. this.pageLevel = 0
  138. } else {
  139. this.pageLevel = parseInt(level);
  140. }
  141. that.getDate();
  142. },
  143. // 根据层级和地区ID调用不同的Ajax接口
  144. getDate() {
  145. let that = this;
  146. if(that.pageLevel != 4){
  147. // 非设备层级
  148. let param = {
  149. token: localStorage.token,
  150. regionId: this.regionId
  151. };
  152. let postdata = qs.stringify(param);
  153. that.getRegionDetInfolist(postdata);
  154. }else{
  155. // 单个设备层级
  156. // todo
  157. }
  158. },
  159. getRegionDetInfolist(postdata) {
  160. let that = this;
  161. RegionDetInfolist(postdata).then(res => {
  162. let json = res;
  163. if (json.Code == 0) {
  164. that.totalRs = json;
  165. } else {
  166. that.$message.error(json.Memo);
  167. }
  168. })
  169. },
  170. wordDisplay(word) {
  171. let index = 0;
  172. let that = this;
  173. setTimeout(function () {
  174. that.list.unshift(word[index]);
  175. index = index + 1;
  176. }, 300);
  177. }
  178. },
  179. components: {
  180. Console,
  181. WifiSign,
  182. Scan,
  183. HistoryRecord,
  184. EquipInfo,
  185. runTimeRecord,
  186. SingleEquipInfo,
  187. BigRader,
  188. Watching,
  189. SmallRader,
  190. Loft,
  191. Room
  192. }
  193. }
  194. </script>
  195. <style scoped>
  196. @import "../assets/css/cube.css";
  197. ul, li {
  198. list-style: none;
  199. padding: 0;
  200. margin: 0;
  201. }
  202. em, s, i {
  203. font-style: normal;
  204. }
  205. .mainContainer {
  206. width: 100%;
  207. overflow: hidden;
  208. display: block;
  209. margin: 0 auto;
  210. }
  211. .mlt {
  212. width: 365px;
  213. float: left;
  214. overflow: hidden;
  215. margin-right: 10px;
  216. }
  217. .mcenter {
  218. width: 976px;
  219. /*height: 906px;*/
  220. float: left;
  221. overflow: hidden;
  222. }
  223. .mrt {
  224. width: 452px;
  225. float: right;
  226. overflow: hidden;
  227. margin-right: 0;
  228. }
  229. .cube {
  230. width: 100%;
  231. overflow: hidden;
  232. display: block;
  233. margin: 0 auto;
  234. margin-bottom: 5px;
  235. }
  236. /*total */
  237. .other-people {
  238. width: 963px;
  239. height: 481px;
  240. margin-left: 0;
  241. overflow: hidden;
  242. background: #000F2A;
  243. }
  244. ul, li {
  245. list-style: none;
  246. padding: 0;
  247. margin: 0;
  248. }
  249. .totalContianer {
  250. width: 100%;
  251. overflow: hidden;
  252. display: block;
  253. margin: 0 auto;
  254. margin-top: 55px;
  255. }
  256. .totalContianer .tlt {
  257. width: 48%;
  258. float: left;
  259. padding-left: 10px;
  260. }
  261. .totalContianer .trt {
  262. width: 48%;
  263. float: right;
  264. padding-right: 20px;
  265. overflow: hidden;
  266. }
  267. .totalContianer h5 {
  268. width: 126px;
  269. height: 26px;
  270. line-height: 26px;
  271. text-align: center;
  272. color: #6DC1FF;
  273. font-size: 14px;
  274. margin: 0;
  275. margin-left: 33%;
  276. margin-bottom: 19px;
  277. background: url("../assets/img/main/title.png") top center no-repeat;
  278. background-size: 100% 100%;
  279. }
  280. .total .image-border2 {
  281. right: 0;
  282. }
  283. .total .image-border4 {
  284. right: 0;
  285. }
  286. .loftContainer .tlt {
  287. width: 48%;
  288. float: left;
  289. padding-left: 10px;
  290. }
  291. .loftContainer .trt {
  292. width: 48%;
  293. float: right;
  294. padding-right: 20px;
  295. overflow: hidden;
  296. }
  297. .loftContainer {
  298. width: 100%;
  299. overflow: hidden;
  300. display: block;
  301. margin: 0 auto;
  302. margin-top: 55px;
  303. }
  304. .RoomContainer .tlt {
  305. float: left;
  306. padding-left: 10px;
  307. margin-top: 60px;
  308. }
  309. .RoomContainer .trt {
  310. float: right;
  311. padding-right: 20px;
  312. overflow: hidden;
  313. margin-top: 30px;
  314. }
  315. .DetctorContianer {
  316. width: 100%;
  317. overflow: hidden;
  318. display: block;
  319. margin: 0 auto;
  320. margin-top: 55px;
  321. }
  322. .DetctorContianer .tlt {
  323. width: 48%;
  324. float: left;
  325. padding-left: 10px;
  326. }
  327. .DetctorContianer .trt {
  328. width: 48%;
  329. float: right;
  330. padding-right: 20px;
  331. overflow: hidden;
  332. }
  333. .DetctorContianer h5 {
  334. width: 126px;
  335. height: 26px;
  336. line-height: 26px;
  337. text-align: center;
  338. color: #6DC1FF;
  339. font-size: 14px;
  340. margin: 0;
  341. margin-left: 33%;
  342. margin-bottom: 19px;
  343. background: url("../assets/img/main/title.png") top center no-repeat;
  344. background-size: 100% 100%;
  345. }
  346. .manageContainer .tlt {
  347. float: left;
  348. padding-left: 10px;
  349. margin-top: 60px;
  350. }
  351. .manageContainer .trt {
  352. float: right;
  353. padding-right: 20px;
  354. overflow: hidden;
  355. margin-top: 30px;
  356. }
  357. .loftContainer h5 {
  358. width: 126px;
  359. height: 26px;
  360. line-height: 26px;
  361. text-align: center;
  362. color: #6DC1FF;
  363. font-size: 14px;
  364. margin: 0;
  365. margin-left: 33%;
  366. margin-bottom: 19px;
  367. background: url("../assets/img/main/title.png") top center no-repeat;
  368. background-size: 100% 100%;
  369. }
  370. </style>