Main.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
  1. <template>
  2. <div class="mainContainer">
  3. <div :class="[{'mlt':consoleWidth == 0},{'mltShort':consoleWidth == 1}]">
  4. <Console @refreshList="changPanel" @refresWidth="changWidth"></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. <transition name="el-zoom-in-center">
  19. <div class="totalContianer" v-if="pageLevel == 0 || pageLevel == 1 || pageLevel == 4">
  20. <div class="tlt">
  21. <h5>正在监测</h5>
  22. <BigRader :total-rs="totalRs" :page-level="pageLevel"></BigRader>
  23. </div>
  24. <div class="trt">
  25. <h5>实时监测记录</h5>
  26. <Watching :total-rs="totalRs" :page-level="pageLevel"></Watching>
  27. </div>
  28. </div>
  29. </transition>
  30. <!--楼层-->
  31. <transition name="el-zoom-in-center">
  32. <div class="manageContainer" v-if="pageLevel==2">
  33. <div class="tlt">
  34. <h5></h5>
  35. <SmallRader :total-rs="totalRs"></SmallRader>
  36. </div>
  37. <div class="trt">
  38. <Loft :loft-points="loftPoints" :loft-map="loftMap" :loft-title="loftTitle"></Loft>
  39. </div>
  40. </div>
  41. </transition>
  42. <transition name="el-zoom-in-center">
  43. <div class="RoomContainer" v-if="pageLevel == 3">
  44. <div class="tlt">
  45. <h5></h5>
  46. <SmallRader :total-rs="totalRs"></SmallRader>
  47. </div>
  48. <div class="trt">
  49. <Room :loft-points="loftPoints" :loft-map="loftMap" :loft-title="loftTitle"></Room>
  50. </div>
  51. </div>
  52. </transition>
  53. </div>
  54. </div>
  55. </div>
  56. <div class="cube">
  57. <WifiSign :wifi-rs="WifiRs"></WifiSign>
  58. </div>
  59. <Scan :scan-rs="ScanRs"></Scan>
  60. </div>
  61. <div class="mrt">
  62. <transition name="el-zoom-in-center">
  63. <div class="cube" v-if="pageLevel == 0||pageLevel == 1||pageLevel == 4">
  64. <HistoryRecord :history-rs="historyRs"></HistoryRecord>
  65. </div>
  66. </transition>
  67. <transition name="el-zoom-in-center">
  68. <div class="cube" v-if="pageLevel == 2||pageLevel == 3">
  69. <runTimeRecord :total-rs="totalRs" :page-level="pageLevel"></runTimeRecord>
  70. </div>
  71. </transition>
  72. <transition name="el-zoom-in-center">
  73. <div v-if="pageLevel != 4">
  74. <EquipInfo :equip-rs="equipRs"></EquipInfo>
  75. </div>
  76. </transition>
  77. <!--单个设备情况-->
  78. <transition name="el-zoom-in-center">
  79. <div v-if="pageLevel == 4">
  80. <SingleEquipInfo :total-rs="totalRs"></SingleEquipInfo>
  81. </div>
  82. </transition>
  83. </div>
  84. </div>
  85. </template>
  86. <script>
  87. import Console from '@/components/Console.vue'
  88. import WifiSign from '@/components/WifiSign.vue'
  89. import Scan from '@/components/Scan.vue'
  90. import HistoryRecord from '@/components/HistoryRecord.vue'
  91. import EquipInfo from '@/components/EquipInfo.vue'
  92. import SingleEquipInfo from '@/components/SingleEquipInfo.vue'
  93. import runTimeRecord from '@/components/runTimeRecord.vue'
  94. import BigRader from '@/components/BigRader.vue'
  95. import SmallRader from '@/components/SmallRader.vue'
  96. import Watching from '@/components/Watching.vue'
  97. import Loft from '@/components/Loft.vue'
  98. import Room from '@/components/Room.vue'
  99. import {
  100. RegionDetInfolist,
  101. SingleDetInfolist,
  102. DetectorWifixyInfolist,
  103. RegionWifixyInfolist,
  104. Detector06GInfolist,
  105. LogWifiDetectedQueryByDetector,
  106. GetStaticinfo,
  107. LogFullDetectedQueryByDetector,
  108. RegionPictureGetByRegionId,
  109. GetRegiononeinfo,
  110. GetRegionplaneinfo,
  111. RegionDetDetaillist,
  112. SingleDetDetaillist,
  113. Region06GInfolist,
  114. } from '../api/getApiRes.js'
  115. let qs = require('qs');
  116. export default {
  117. data() {
  118. return {
  119. loadingState: false,
  120. pageLevel: 0,//操作层级 默认0查 全部 层级
  121. regionId: 0,//默认查全部
  122. detectorId: 0,//无默认设备
  123. TotalPanel: true,//总控
  124. LoftPanel: false,//楼层
  125. managePanel: false,//区域
  126. RoomPanel: false,//房间
  127. DetctorPanel: false,//设备
  128. totalRs: [],
  129. WifiRs: [],
  130. ScanRs: [],
  131. historyRs: [],
  132. equipRs: [],
  133. loftPoints: [],
  134. loftMap: '',
  135. loftTitle: '',
  136. consoleWidth: 0,
  137. BoolSafe: 0,
  138. autoTime: 3000,//定时刷新的时间间隔
  139. }
  140. },
  141. mounted() {
  142. let that = this;
  143. that.loadingState = false;
  144. localStorage.Start = 0;
  145. // 获取数据
  146. that.getDate();
  147. // 定时查询
  148. that.timer = window.setInterval(() => {
  149. that.getDate();
  150. }, that.autoTime);
  151. },
  152. destroyed() {
  153. //页面销毁时清除定时器
  154. window.clearInterval(this.timer);
  155. },
  156. methods: {
  157. // 改编宽度
  158. changWidth(state) {
  159. console.log(state);
  160. this.consoleWidth = state;
  161. },
  162. changPanel(level, btn) {
  163. let that = this;
  164. this.regionId = btn.Id ? btn.Id : 0;
  165. this.detectorId = btn.Id ? btn.Id : 0;
  166. if (btn == 0) {
  167. // 首页单独处理
  168. this.pageLevel = 0
  169. } else {
  170. this.pageLevel = parseInt(level);
  171. }
  172. that.getDate();
  173. },
  174. // 根据层级和地区ID调用不同的Ajax接口
  175. getDate() {
  176. let that = this;
  177. // 非设备层级
  178. if (that.pageLevel != 4) {
  179. let param = {
  180. token: localStorage.token,
  181. detectorId: 0,
  182. comid: 1,
  183. regionId: this.regionId,
  184. regionID: this.regionId,
  185. regionid: this.regionId,
  186. supregionid: 0,
  187. detidstr: 0,
  188. bt: globaltime2String(globalBt3(2)[0]) + ' 00:00:01',//开始时间
  189. et: globaltime2String(globalBt3(2)[1]) + ' 23:59:59',//结束时间
  190. start: 1,//
  191. tableMax: 10,//
  192. Start: localStorage.Start
  193. };
  194. let postdata = qs.stringify(param);
  195. // wifi柱状图信息传入区域Id
  196. that.getRegionWifixyInfolist(postdata);
  197. // 区域检测实时记录
  198. that.getRegionDetInfolist(postdata);
  199. // 历史检测记录
  200. // that.getLogWifiDetectedQueryByDetector(postdata);
  201. that.getRegionDetDetaillist(postdata);
  202. // 0-6G
  203. that.getRegion06GInfolist(postdata);
  204. that.getGetStaticinfo(postdata);
  205. // 楼层和房间层级有平面图的
  206. if (that.pageLevel == 2 || that.pageLevel == 3) {
  207. that.seeLoftMapAndPoints(postdata)
  208. }
  209. } else {
  210. // 单个设备层级
  211. // todo
  212. let param = {
  213. token: localStorage.token,
  214. detectorId: this.detectorId,
  215. bt: globaltime2String(globalBt3(2)[0]) + ' 00:00:01',//开始时间
  216. et: globaltime2String(globalBt3(2)[1]) + ' 23:59:59',//结束时间
  217. start: 1,//
  218. tableMax: 10,//
  219. Start: localStorage.Start
  220. };
  221. let postdata = qs.stringify(param);
  222. // Wifi柱状图信息传入探测器Id
  223. that.getDetectorWifixyInfolist(postdata);
  224. // 单个设备检测实时记录
  225. that.getSingleDetInfolist(postdata);
  226. that.getDetector06GInfolist(postdata);
  227. // 历史检测记录
  228. // that.getLogWifiDetectedQueryByDetector(postdata);
  229. that.getSingleDetDetaillist(postdata);
  230. }
  231. },
  232. getDetector06GInfolist(postdata) {
  233. let that = this;
  234. Detector06GInfolist(postdata).then(res => {
  235. let json = res;
  236. if (json.Code == 0) {
  237. that.ScanRs = json;
  238. } else {
  239. that.$message.error(json.Memo + ',错误代码:' + json.Code);
  240. }
  241. })
  242. },
  243. getRegion06GInfolist(postdata) {
  244. let that = this;
  245. Region06GInfolist(postdata).then(res => {
  246. let json = res;
  247. if (json.Code == 0) {
  248. that.ScanRs = json;
  249. } else {
  250. that.$message.error(json.Memo + ',错误代码:' + json.Code);
  251. }
  252. })
  253. },
  254. // 区域检测实时记录
  255. getRegionDetDetaillist(postdata) {
  256. let that = this;
  257. RegionDetDetaillist(postdata).then(res => {
  258. let json = res;
  259. if (json.Code == 0) {
  260. that.historyRs = json;
  261. // localStorage.Start = json.LastId;
  262. } else {
  263. that.$message.error(json.Memo + ',错误代码:' + json.Code);
  264. }
  265. })
  266. },
  267. // 单个设备检测实时记录
  268. getSingleDetDetaillist(postdata) {
  269. let that = this;
  270. SingleDetDetaillist(postdata).then(res => {
  271. let json = res;
  272. if (json.Code == 0) {
  273. that.historyRs = json;
  274. // localStorage.Start = json.LastId;
  275. } else {
  276. that.$message.error(json.Memo + ',错误代码:' + json.Code);
  277. }
  278. })
  279. },
  280. getRegionDetInfolist(postdata) {
  281. let that = this;
  282. RegionDetInfolist(postdata).then(res => {
  283. let json = res;
  284. if (json.Code == 0) {
  285. that.totalRs = json;
  286. localStorage.Start = json.LastId;
  287. } else {
  288. that.$message.error(json.Memo + ',错误代码:' + json.Code);
  289. }
  290. })
  291. },
  292. getGetStaticinfo(postdata) {
  293. let that = this;
  294. GetStaticinfo(postdata).then(res => {
  295. let json = res;
  296. if (json.Code == 0) {
  297. that.equipRs = json;
  298. } else {
  299. if (json.Code == 1010) {
  300. localStorage.usercode = '';
  301. localStorage.token = '';
  302. that.$router.push({path: '/login', query: {status: 1}});
  303. return false
  304. }
  305. that.$message.error(json.Memo + ',错误代码:' + json.Code);
  306. }
  307. })
  308. },
  309. getSingleDetInfolist(postdata) {
  310. let that = this;
  311. SingleDetInfolist(postdata).then(res => {
  312. let json = res;
  313. if (json.Code == 0) {
  314. that.totalRs = json;
  315. localStorage.Start = json.LastId;
  316. } else {
  317. that.$message.error(json.Memo + ',错误代码:' + json.Code);
  318. }
  319. })
  320. },
  321. getLogWifiDetectedQueryByDetector(postdata) {
  322. let that = this;
  323. LogWifiDetectedQueryByDetector(postdata).then(res => {
  324. let json = res;
  325. if (json.Code == 0) {
  326. that.historyRs = json;
  327. } else {
  328. that.$message.error(json.Memo + ',错误代码:' + json.Code);
  329. }
  330. })
  331. },
  332. getLogFullDetectedQueryByDetector(postdata) {
  333. let that = this;
  334. LogFullDetectedQueryByDetector(postdata).then(res => {
  335. let json = res;
  336. if (json.Code == 0) {
  337. that.historyRs = json;
  338. } else {
  339. that.$message.error(json.Memo + ',错误代码:' + json.Code);
  340. }
  341. })
  342. },
  343. // Wifi柱状图信息传入探测器Id
  344. getDetectorWifixyInfolist(postdata) {
  345. let that = this;
  346. DetectorWifixyInfolist(postdata).then(res => {
  347. let json = res;
  348. if (json.Code == 0) {
  349. that.WifiRs = json;
  350. } else {
  351. that.$message.error(json.Memo + ',错误代码:' + json.Code);
  352. }
  353. })
  354. },
  355. // Wifi柱状图信息传入区域Id
  356. getRegionWifixyInfolist(postdata) {
  357. let that = this;
  358. RegionWifixyInfolist(postdata).then(res => {
  359. let json = res;
  360. if (json.Code == 0) {
  361. that.WifiRs = json;
  362. } else {
  363. that.$message.error(json.Memo + ',错误代码:' + json.Code);
  364. }
  365. })
  366. },
  367. // 读取地图和点
  368. seeLoftMapAndPoints(postdata) {
  369. let that = this;
  370. // 平面图
  371. RegionPictureGetByRegionId(postdata).then(res => {
  372. let json = res;
  373. if (json.Code == 0) {
  374. that.loftMap = json.EncodeString;
  375. } else {
  376. that.$message.error(json.Memo + ',错误代码:' + json.Code);
  377. }
  378. });
  379. // 点
  380. GetRegionplaneinfo(postdata).then(res => {
  381. let json = res;
  382. if (json.Code == 0) {
  383. that.loftTitle = json.Rs.Region.Name;
  384. that.loftPoints = json.Rs.DetAndFindRs;
  385. } else {
  386. that.$message.error(json.Memo + ',错误代码:' + json.Code);
  387. }
  388. });
  389. }
  390. },
  391. components: {
  392. Console,
  393. WifiSign,
  394. Scan,
  395. HistoryRecord,
  396. EquipInfo,
  397. runTimeRecord,
  398. SingleEquipInfo,
  399. BigRader,
  400. Watching,
  401. SmallRader,
  402. Loft,
  403. Room
  404. }
  405. }
  406. </script>
  407. <style scoped>
  408. @import "../assets/css/cube.css";
  409. ul, li {
  410. list-style: none;
  411. padding: 0;
  412. margin: 0;
  413. }
  414. em, s, i {
  415. font-style: normal;
  416. }
  417. .mainContainer {
  418. width: 100%;
  419. overflow: hidden;
  420. display: block;
  421. margin: 0 auto;
  422. margin-top: 20px;
  423. }
  424. .mlt {
  425. width: 365px;
  426. float: left;
  427. overflow: hidden;
  428. margin-right: 15px;
  429. margin-left: 20px;
  430. }
  431. .mltShort {
  432. width: 20px;
  433. float: left;
  434. overflow: hidden;
  435. }
  436. .mcenter {
  437. width: 976px;
  438. /*height: 906px;*/
  439. float: left;
  440. overflow: hidden;
  441. }
  442. .mrt {
  443. width: 452px;
  444. float: right;
  445. overflow: hidden;
  446. margin-right: 0;
  447. }
  448. .cube {
  449. width: 100%;
  450. overflow: hidden;
  451. display: block;
  452. margin: 0 auto;
  453. margin-bottom: 15px;
  454. }
  455. /*total */
  456. .other-people {
  457. width: 963px;
  458. height: 481px;
  459. margin-left: 0;
  460. overflow: hidden;
  461. /*background: #000F2A;*/
  462. }
  463. ul, li {
  464. list-style: none;
  465. padding: 0;
  466. margin: 0;
  467. }
  468. .totalContianer {
  469. width: 100%;
  470. overflow: hidden;
  471. display: block;
  472. margin: 0 auto;
  473. margin-top: 55px;
  474. }
  475. .totalContianer .tlt {
  476. width: 48%;
  477. float: left;
  478. padding-left: 10px;
  479. }
  480. .totalContianer .trt {
  481. width: 48%;
  482. float: right;
  483. padding-right: 20px;
  484. overflow: hidden;
  485. }
  486. .totalContianer h5 {
  487. width: 126px;
  488. height: 26px;
  489. line-height: 26px;
  490. text-align: center;
  491. color: #6DC1FF;
  492. font-size: 14px;
  493. margin: 0;
  494. margin-left: 33%;
  495. margin-bottom: 19px;
  496. background: url("../assets/img/main/title.png") top center no-repeat;
  497. background-size: 100% 100%;
  498. }
  499. .total .image-border2 {
  500. right: 0;
  501. }
  502. .total .image-border4 {
  503. right: 0;
  504. }
  505. .loftContainer .tlt {
  506. width: 48%;
  507. float: left;
  508. padding-left: 10px;
  509. }
  510. .loftContainer .trt {
  511. width: 48%;
  512. float: right;
  513. padding-right: 20px;
  514. overflow: hidden;
  515. }
  516. .loftContainer {
  517. width: 100%;
  518. overflow: hidden;
  519. display: block;
  520. margin: 0 auto;
  521. margin-top: 55px;
  522. }
  523. .RoomContainer .tlt {
  524. float: left;
  525. padding-left: 10px;
  526. margin-top: 60px;
  527. }
  528. .RoomContainer .trt {
  529. float: right;
  530. padding-right: 20px;
  531. overflow: hidden;
  532. margin-top: 30px;
  533. }
  534. .DetctorContianer {
  535. width: 100%;
  536. overflow: hidden;
  537. display: block;
  538. margin: 0 auto;
  539. margin-top: 55px;
  540. }
  541. .DetctorContianer .tlt {
  542. width: 48%;
  543. float: left;
  544. padding-left: 10px;
  545. }
  546. .DetctorContianer .trt {
  547. width: 48%;
  548. float: right;
  549. padding-right: 20px;
  550. overflow: hidden;
  551. }
  552. .DetctorContianer h5 {
  553. width: 126px;
  554. height: 26px;
  555. line-height: 26px;
  556. text-align: center;
  557. color: #6DC1FF;
  558. font-size: 14px;
  559. margin: 0;
  560. margin-left: 33%;
  561. margin-bottom: 19px;
  562. background: url("../assets/img/main/title.png") top center no-repeat;
  563. background-size: 100% 100%;
  564. }
  565. .manageContainer .tlt {
  566. width: 242px;
  567. float: left;
  568. padding-left: 10px;
  569. margin-top: 60px;
  570. }
  571. .manageContainer .trt {
  572. float: right;
  573. padding-right: 20px;
  574. overflow: hidden;
  575. margin-top: 30px;
  576. }
  577. .loftContainer h5 {
  578. width: 126px;
  579. height: 26px;
  580. line-height: 26px;
  581. text-align: center;
  582. color: #6DC1FF;
  583. font-size: 14px;
  584. margin: 0;
  585. margin-left: 33%;
  586. margin-bottom: 19px;
  587. background: url("../assets/img/main/title.png") top center no-repeat;
  588. background-size: 100% 100%;
  589. }
  590. </style>