Main.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  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. <!--全局 和 楼栋-->
  18. <div class="totalContianer" v-if="pageLevel == 0 || pageLevel == 1 || pageLevel == 4">
  19. <div class="tlt">
  20. <h5>正在监测</h5>
  21. <BigRader :total-rs="totalRs"></BigRader>
  22. </div>
  23. <div class="trt">
  24. <h5>实时监测记录</h5>
  25. <Watching :total-rs="totalRs"></Watching>
  26. </div>
  27. </div>
  28. <!--楼层-->
  29. <div class="manageContainer" v-if="pageLevel==2">
  30. <div class="tlt">
  31. <h5></h5>
  32. <SmallRader :total-rs="totalRs"></SmallRader>
  33. </div>
  34. <div class="trt">
  35. <Loft></Loft>
  36. </div>
  37. </div>
  38. <div class="RoomContainer" v-if="pageLevel == 3">
  39. <div class="tlt">
  40. <h5></h5>
  41. <SmallRader :total-rs="totalRs"></SmallRader>
  42. </div>
  43. <div class="trt">
  44. <Room></Room>
  45. </div>
  46. </div>
  47. <!--<div class="DetctorContianer" v-if="pageLevel == 4">-->
  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 :wifi-rs="WifiRs"></WifiSign>
  62. </div>
  63. <Scan :scan-rs="ScanRs"></Scan>
  64. </div>
  65. <div class="mrt">
  66. <div class="cube" v-if="pageLevel == 0||pageLevel == 1||pageLevel == 4">
  67. <HistoryRecord :history-rs="historyRs"></HistoryRecord>
  68. </div>
  69. <div class="cube" v-if="pageLevel == 2||pageLevel == 3">
  70. <runTimeRecord :total-rs="totalRs"></runTimeRecord>
  71. </div>
  72. <div v-if="pageLevel != 4">
  73. <EquipInfo :equip-rs="equipRs"></EquipInfo>
  74. </div>
  75. <!--单个设备情况-->
  76. <div v-if="pageLevel == 4">
  77. <SingleEquipInfo :total-rs="totalRs"></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 {
  96. RegionDetInfolist,
  97. SingleDetInfolist,
  98. DetectorWifixyInfolist,
  99. RegionWifixyInfolist,
  100. Detector06GInfolist,
  101. LogWifiDetectedQueryByDetector,
  102. GetStaticinfo
  103. } from '../api/getApiRes.js'
  104. let qs = require('qs');
  105. export default {
  106. data() {
  107. return {
  108. loadingState: false,
  109. pageLevel: 0,//操作层级 默认0查 全部 层级
  110. regionId: 0,//默认查全部
  111. detectorId: 0,//无默认设备
  112. TotalPanel: true,//总控
  113. LoftPanel: false,//楼层
  114. managePanel: false,//区域
  115. RoomPanel: false,//房间
  116. DetctorPanel: false,//设备
  117. totalRs: [],
  118. WifiRs: [],
  119. ScanRs: [],
  120. historyRs: [],
  121. equipRs: [],
  122. // pageLevel: 1,//当前为楼层
  123. // pageLevel: 2,//当前为楼层区域
  124. // pageLevel: 3,//当前为房间
  125. // pageLevel: 4,//当前为单个设备
  126. }
  127. },
  128. mounted() {
  129. let that = this;
  130. that.loadingState = false;
  131. // 获取数据
  132. that.getDate();
  133. // 定时查询
  134. that.timer = setInterval(() => {
  135. that.getDate();
  136. }, 1115000);
  137. // let param = {
  138. // token: localStorage.token,
  139. // detectorId: 1,
  140. // regionId: this.regionId
  141. // };
  142. // let postdata = qs.stringify(param);
  143. // that.getDetector06GInfolist(postdata);
  144. },
  145. destroyed() {
  146. //页面销毁时清除定时器
  147. clearInterval(this.timer);
  148. //页面销毁时清除添加条数动画的定时器
  149. clearInterval(this.wordDisplay);
  150. },
  151. methods: {
  152. changPanel(level, btn) {
  153. let that = this;
  154. this.regionId = btn.Id ? btn.Id : 0;
  155. this.detectorId = btn.Id ? btn.Id : 0;
  156. if (btn == 0) {
  157. // 首页单独处理
  158. this.pageLevel = 0
  159. } else {
  160. this.pageLevel = parseInt(level);
  161. }
  162. that.getDate();
  163. },
  164. // 根据层级和地区ID调用不同的Ajax接口
  165. getDate() {
  166. let that = this;
  167. // 非设备层级
  168. if (that.pageLevel != 4) {
  169. let param = {
  170. token: localStorage.token,
  171. detectorId: 0,
  172. regionId: this.regionId,
  173. detidstr:0,
  174. bt: globaltime2String(globalBt2()[0]) + ' 00:00:01',//开始时间
  175. et: globaltime2String(globalBt2()[1]) + ' 23:59:59',//结束时间
  176. start: 1,//
  177. tableMax: 30,//
  178. };
  179. let postdata = qs.stringify(param);
  180. // wifi柱状图信息传入区域Id
  181. that.getRegionWifixyInfolist(postdata);
  182. // 区域检测实时记录
  183. that.getRegionDetInfolist(postdata);
  184. // 历史检测记录
  185. that.getLogWifiDetectedQueryByDetector(postdata);
  186. // 0-6G
  187. that.getDetector06GInfolist(postdata);
  188. that.getGetStaticinfo(postdata);
  189. } else {
  190. // 单个设备层级
  191. // todo
  192. let param = {
  193. token: localStorage.token,
  194. detectorId: this.detectorId,
  195. bt: globaltime2String(globalBt2()[0]) + ' 00:00:01',//开始时间
  196. et: globaltime2String(globalBt2()[1]) + ' 23:59:59',//结束时间
  197. start: 1,//
  198. tableMax: 10,//
  199. };
  200. let postdata = qs.stringify(param);
  201. // Wifi柱状图信息传入探测器Id
  202. that.getDetectorWifixyInfolist(postdata);
  203. // 单个设备检测实时记录
  204. that.getSingleDetInfolist(postdata);
  205. that.getDetector06GInfolist(postdata);
  206. // 历史检测记录
  207. that.getLogWifiDetectedQueryByDetector(postdata);
  208. }
  209. },
  210. getDetector06GInfolist(postdata) {
  211. let that = this;
  212. Detector06GInfolist(postdata).then(res => {
  213. let json = res;
  214. if (json.Code == 0) {
  215. that.ScanRs = json;
  216. } else {
  217. that.$message.error(json.Memo);
  218. }
  219. })
  220. },
  221. getRegionDetInfolist(postdata) {
  222. let that = this;
  223. RegionDetInfolist(postdata).then(res => {
  224. let json = res;
  225. if (json.Code == 0) {
  226. that.totalRs = json;
  227. } else {
  228. that.$message.error(json.Memo);
  229. }
  230. })
  231. },
  232. getGetStaticinfo(postdata) {
  233. let that = this;
  234. GetStaticinfo(postdata).then(res => {
  235. let json = res;
  236. if (json.Code == 0) {
  237. that.equipRs = json;
  238. } else {
  239. that.$message.error(json.Memo);
  240. }
  241. })
  242. },
  243. getSingleDetInfolist(postdata) {
  244. let that = this;
  245. SingleDetInfolist(postdata).then(res => {
  246. let json = res;
  247. if (json.Code == 0) {
  248. that.totalRs = json;
  249. } else {
  250. that.$message.error(json.Memo);
  251. }
  252. })
  253. },
  254. getLogWifiDetectedQueryByDetector(postdata) {
  255. let that = this;
  256. LogWifiDetectedQueryByDetector(postdata).then(res => {
  257. let json = res;
  258. if (json.Code == 0) {
  259. that.historyRs = json;
  260. } else {
  261. that.$message.error(json.Memo);
  262. }
  263. })
  264. },
  265. wordDisplay(word) {
  266. let index = 0;
  267. let that = this;
  268. setTimeout(function () {
  269. that.list.unshift(word[index]);
  270. index = index + 1;
  271. }, 300);
  272. },
  273. // Wifi柱状图信息传入探测器Id
  274. getDetectorWifixyInfolist(postdata) {
  275. let that = this;
  276. DetectorWifixyInfolist(postdata).then(res => {
  277. let json = res;
  278. if (json.Code == 0) {
  279. that.WifiRs = json;
  280. } else {
  281. that.$message.error(json.Memo);
  282. }
  283. })
  284. },
  285. // Wifi柱状图信息传入区域Id
  286. getRegionWifixyInfolist(postdata) {
  287. let that = this;
  288. RegionWifixyInfolist(postdata).then(res => {
  289. let json = res;
  290. if (json.Code == 0) {
  291. that.WifiRs = json;
  292. } else {
  293. that.$message.error(json.Memo);
  294. }
  295. })
  296. }
  297. },
  298. components: {
  299. Console,
  300. WifiSign,
  301. Scan,
  302. HistoryRecord,
  303. EquipInfo,
  304. runTimeRecord,
  305. SingleEquipInfo,
  306. BigRader,
  307. Watching,
  308. SmallRader,
  309. Loft,
  310. Room
  311. }
  312. }
  313. </script>
  314. <style scoped>
  315. @import "../assets/css/cube.css";
  316. ul, li {
  317. list-style: none;
  318. padding: 0;
  319. margin: 0;
  320. }
  321. em, s, i {
  322. font-style: normal;
  323. }
  324. .mainContainer {
  325. width: 100%;
  326. overflow: hidden;
  327. display: block;
  328. margin: 0 auto;
  329. }
  330. .mlt {
  331. width: 365px;
  332. float: left;
  333. overflow: hidden;
  334. margin-right: 10px;
  335. margin-left: 10px;
  336. }
  337. .mcenter {
  338. width: 976px;
  339. /*height: 906px;*/
  340. float: left;
  341. overflow: hidden;
  342. }
  343. .mrt {
  344. width: 452px;
  345. float: right;
  346. overflow: hidden;
  347. margin-right: 0;
  348. }
  349. .cube {
  350. width: 100%;
  351. overflow: hidden;
  352. display: block;
  353. margin: 0 auto;
  354. margin-bottom: 15px;
  355. }
  356. /*total */
  357. .other-people {
  358. width: 963px;
  359. height: 481px;
  360. margin-left: 0;
  361. overflow: hidden;
  362. background: #000F2A;
  363. }
  364. ul, li {
  365. list-style: none;
  366. padding: 0;
  367. margin: 0;
  368. }
  369. .totalContianer {
  370. width: 100%;
  371. overflow: hidden;
  372. display: block;
  373. margin: 0 auto;
  374. margin-top: 55px;
  375. }
  376. .totalContianer .tlt {
  377. width: 48%;
  378. float: left;
  379. padding-left: 10px;
  380. }
  381. .totalContianer .trt {
  382. width: 48%;
  383. float: right;
  384. padding-right: 20px;
  385. overflow: hidden;
  386. }
  387. .totalContianer h5 {
  388. width: 126px;
  389. height: 26px;
  390. line-height: 26px;
  391. text-align: center;
  392. color: #6DC1FF;
  393. font-size: 14px;
  394. margin: 0;
  395. margin-left: 33%;
  396. margin-bottom: 19px;
  397. background: url("../assets/img/main/title.png") top center no-repeat;
  398. background-size: 100% 100%;
  399. }
  400. .total .image-border2 {
  401. right: 0;
  402. }
  403. .total .image-border4 {
  404. right: 0;
  405. }
  406. .loftContainer .tlt {
  407. width: 48%;
  408. float: left;
  409. padding-left: 10px;
  410. }
  411. .loftContainer .trt {
  412. width: 48%;
  413. float: right;
  414. padding-right: 20px;
  415. overflow: hidden;
  416. }
  417. .loftContainer {
  418. width: 100%;
  419. overflow: hidden;
  420. display: block;
  421. margin: 0 auto;
  422. margin-top: 55px;
  423. }
  424. .RoomContainer .tlt {
  425. float: left;
  426. padding-left: 10px;
  427. margin-top: 60px;
  428. }
  429. .RoomContainer .trt {
  430. float: right;
  431. padding-right: 20px;
  432. overflow: hidden;
  433. margin-top: 30px;
  434. }
  435. .DetctorContianer {
  436. width: 100%;
  437. overflow: hidden;
  438. display: block;
  439. margin: 0 auto;
  440. margin-top: 55px;
  441. }
  442. .DetctorContianer .tlt {
  443. width: 48%;
  444. float: left;
  445. padding-left: 10px;
  446. }
  447. .DetctorContianer .trt {
  448. width: 48%;
  449. float: right;
  450. padding-right: 20px;
  451. overflow: hidden;
  452. }
  453. .DetctorContianer h5 {
  454. width: 126px;
  455. height: 26px;
  456. line-height: 26px;
  457. text-align: center;
  458. color: #6DC1FF;
  459. font-size: 14px;
  460. margin: 0;
  461. margin-left: 33%;
  462. margin-bottom: 19px;
  463. background: url("../assets/img/main/title.png") top center no-repeat;
  464. background-size: 100% 100%;
  465. }
  466. .manageContainer .tlt {
  467. float: left;
  468. padding-left: 10px;
  469. margin-top: 60px;
  470. }
  471. .manageContainer .trt {
  472. float: right;
  473. padding-right: 20px;
  474. overflow: hidden;
  475. margin-top: 30px;
  476. }
  477. .loftContainer h5 {
  478. width: 126px;
  479. height: 26px;
  480. line-height: 26px;
  481. text-align: center;
  482. color: #6DC1FF;
  483. font-size: 14px;
  484. margin: 0;
  485. margin-left: 33%;
  486. margin-bottom: 19px;
  487. background: url("../assets/img/main/title.png") top center no-repeat;
  488. background-size: 100% 100%;
  489. }
  490. </style>