Main.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524
  1. <template>
  2. <div class="mainContainer">
  3. <div class="lt" v-show="showLeft">
  4. <div class="sum-title">
  5. 控制台
  6. </div>
  7. <div class="cube">
  8. <Region :region-list="regionList" @GetInfoClick="ClickGetInfo"></Region>
  9. </div>
  10. <div class="cube">
  11. <Detecter :detecter-list="detectorList"></Detecter>
  12. </div>
  13. <div class="cube">
  14. <Task :task-info="taskInfo" :task-result="taskResult" @GetScanClick="ClickGetScan"></Task>
  15. </div>
  16. </div>
  17. <div :class="[{'md':true},{'bigMd':!showLeft}]">
  18. <div class="cube">
  19. <signMap :sign-list="signList"></signMap>
  20. </div>
  21. <div class="cube">
  22. <WifiSign :wifi-rs="WifiRs"></WifiSign>
  23. </div>
  24. <div class="cube">
  25. <Scan :scan-rs="ScanRs"></Scan>
  26. </div>
  27. </div>
  28. <div class="rt">
  29. <div class="cube">
  30. <BigRader :total-rs="totalRs"></BigRader>
  31. </div>
  32. <transition name="el-zoom-in-center">
  33. <div class="cube">
  34. <HistoryRecord :history-rs="historyRs"></HistoryRecord>
  35. </div>
  36. </transition>
  37. <transition name="el-zoom-in-center">
  38. <div class="cube">
  39. <RunTimeRecord :runtime-rs="runtimeRs"></RunTimeRecord>
  40. </div>
  41. </transition>
  42. <transition name="el-zoom-in-center">
  43. <div class="cube">
  44. <DetctorRecord :detctor-rs="detctorRs"></DetctorRecord>
  45. </div>
  46. </transition>
  47. </div>
  48. <el-dialog title="扫描设备启动状态" :visible.sync="dialogScanVisible" width="30%">
  49. <el-table :data="scanGridData">
  50. <el-table-column property="Name" label="设备" align="center"></el-table-column>
  51. <el-table-column property="State" label="启动状态" align="center"></el-table-column>
  52. </el-table>
  53. <div slot="footer" class="dialog-footer">
  54. <el-button @click="dialogScanVisible = false" size="small" type="primary">关闭</el-button>
  55. </div>
  56. </el-dialog>
  57. </div>
  58. </template>
  59. <script>
  60. import signMap from '@/components/signMap.vue'
  61. import Region from '@/components/Region.vue'
  62. import Detecter from '@/components/Detecter.vue'
  63. import Task from '@/components/Task.vue'
  64. import WifiSign from '@/components/WifiSign.vue'
  65. import Scan from '@/components/Scan.vue'
  66. import HistoryRecord from '@/components/HistoryRecord.vue'
  67. import EquipInfo from '@/components/EquipInfo.vue'
  68. import RunTimeRecord from '@/components/RunTimeRecord.vue'
  69. import DetctorRecord from '@/components/DetcotrRecord.vue'
  70. import BigRader from '@/components/BigRader.vue'
  71. import {
  72. getLoftInfo,
  73. RegionList,
  74. DetectorList,
  75. Region06G,
  76. WifiChannel,
  77. MonitorArea,
  78. NetDevMonitor,
  79. WirelessMonitor,
  80. DevList,
  81. WirelessStatus,
  82. ScanStrategyList,
  83. WirelessStart,
  84. } from '../api/getApiRes.js'
  85. import {mapGetters, mapActions, mapState} from "vuex";
  86. import Global from "../Global"
  87. let qs = require('qs');
  88. export default {
  89. data() {
  90. return {
  91. CurrentRegionId: 0,
  92. WifiRs: {},
  93. ScanRs: {},
  94. signList: {
  95. title:'',
  96. Rs:null
  97. },
  98. totalRs: [],
  99. equipRs: [],
  100. dialogScanVisible: false,
  101. regionList: [],
  102. scanGridData: [],
  103. detectorList: [],
  104. showLeft: true,
  105. regionId: '',
  106. selectName: '',
  107. historyRs: {
  108. Title: '区域无线设备列表',
  109. Url: 'signEquip',
  110. Rs: [],
  111. }, runtimeRs: {
  112. Title: '实时监控详情',
  113. Url: 'record',
  114. Rs: [],
  115. },
  116. detctorRs: {
  117. Title: '探测设备工作监控',
  118. Url: 'equip',
  119. Rs: [],
  120. },
  121. taskInfo: {},
  122. taskResult: {}
  123. }
  124. },
  125. mounted() {
  126. this.init();
  127. this.showLeft = parseInt(this.$store.state.status.count) % 2 == 0;
  128. // 定时刷新
  129. this.timer = setInterval(() => {
  130. this.timerInfo();
  131. }, 5000);
  132. },
  133. beforeDestroy() {
  134. clearInterval(this.timer);
  135. },
  136. computed: {
  137. ...mapGetters({
  138. 'getCount': 'status/getCount'
  139. })
  140. },
  141. watch: {
  142. '$route': function (val) {
  143. if (val.path == '/') {
  144. this.init()
  145. } else {
  146. clearInterval(this.timer);
  147. }
  148. },
  149. '$store.state.status.count': function (val) {
  150. this.showLeft = parseInt(val) % 2 == 0
  151. },
  152. },
  153. methods: {
  154. timerInfo() {
  155. this.getDetectorList(this.CurrentRegionId);
  156. this.getRegion06G(this.CurrentRegionId);
  157. this.getWifiChannel(this.CurrentRegionId);
  158. this.getMonitorArea(this.CurrentRegionId);
  159. this.getNetDevMonitor(this.CurrentRegionId);
  160. this.getWirelessMonitor(this.CurrentRegionId);
  161. this.getDevList(this.CurrentRegionId);
  162. this.getWirelessStatus(this.CurrentRegionId);
  163. this.getScanStrategyList(this.CurrentRegionId);
  164. },
  165. init() {
  166. this.getDate();
  167. },
  168. getDate() {
  169. let that = this;
  170. let param = {
  171. token: localStorage.token,
  172. };
  173. let postdata = qs.stringify(param);
  174. that.regionList = [];
  175. RegionList(postdata).then(res => {
  176. let json = res;
  177. if (json.Code == 0) {
  178. that.regionList = json.Rs;
  179. // 默认加载第一个区域
  180. if (json.Rs) {
  181. this.CurrentRegionId = json.Rs[0].Id;
  182. this.signList.title = json.Rs[0].Name;
  183. this.getDetectorList(this.CurrentRegionId);
  184. this.getRegion06G(this.CurrentRegionId);
  185. this.getWifiChannel(this.CurrentRegionId);
  186. this.getMonitorArea(this.CurrentRegionId);
  187. this.getNetDevMonitor(this.CurrentRegionId);
  188. this.getWirelessMonitor(this.CurrentRegionId);
  189. this.getDevList(this.CurrentRegionId);
  190. this.getWirelessStatus(this.CurrentRegionId);
  191. this.getScanStrategyList(this.CurrentRegionId);
  192. }
  193. } else {
  194. that.$message.error(json.Memo);
  195. }
  196. })
  197. },
  198. getDetectorList(regionId) {
  199. let that = this;
  200. let param = {
  201. token: localStorage.token,
  202. regionId: regionId,
  203. };
  204. let postdata = qs.stringify(param);
  205. DetectorList(postdata).then(res => {
  206. let json = res;
  207. if (json.Code == 0) {
  208. that.detectorList = json.Rs
  209. } else {
  210. that.detectorList = [];
  211. that.$message.error(json.Memo);
  212. }
  213. })
  214. },
  215. // Wifi柱状图信息传入探测器Id
  216. getWifiChannel(Id) {
  217. let that = this;
  218. let param = {
  219. token: localStorage.token,
  220. id: Id,
  221. };
  222. let postdata = qs.stringify(param);
  223. WifiChannel(postdata).then(res => {
  224. let json = res;
  225. if (json.Code == 0) {
  226. that.WifiRs = json;
  227. } else {
  228. that.$message.error(json.Memo + ',错误代码:' + json.Code);
  229. }
  230. })
  231. },
  232. ClickGetInfo(Id, name) {
  233. this.selectName = name;
  234. this.signList.title = name;
  235. this.CurrentRegionId = Id;
  236. this.getDetectorList(Id);
  237. this.getRegion06G(Id);
  238. this.getWifiChannel(Id);
  239. this.getMonitorArea(Id);
  240. this.getNetDevMonitor(Id);
  241. this.getWirelessMonitor(Id);
  242. this.getDevList(Id);
  243. this.getWirelessStatus(Id);
  244. this.getScanStrategyList(Id);
  245. },
  246. ClickGetScan(Rs) {
  247. let that = this;
  248. Rs.regionId = that.CurrentRegionId;
  249. let params = Rs;
  250. WirelessStart(params).then(res => {
  251. let json = res;
  252. if (json.Code == 0) {
  253. that.showScanRresult(json.Rs)
  254. } else {
  255. that.$message.error(json.Memo);
  256. }
  257. })
  258. },
  259. showScanRresult(Rs) {
  260. let that = this;
  261. that.dialogScanVisible = true;
  262. that.scanGridData = Rs;
  263. },
  264. getRegion06G(id) {
  265. let that = this;
  266. let param = {
  267. token: localStorage.token,
  268. id: id,
  269. xCount: 200,
  270. };
  271. let postdata = qs.stringify(param);
  272. Region06G(postdata).then(res => {
  273. let json = res;
  274. if (json.Code == 0) {
  275. this.ScanRs = json;
  276. } else {
  277. this.ScanRs = {};
  278. that.$message.error(json.Memo);
  279. }
  280. })
  281. },
  282. getMonitorArea(id) {
  283. let that = this;
  284. let param = {
  285. token: localStorage.token,
  286. id: id,
  287. };
  288. let postdata = qs.stringify(param);
  289. MonitorArea(postdata).then(res => {
  290. let json = res;
  291. if (json.Code == 0) {
  292. if (!json.Rs.Data) {
  293. return false
  294. } else {
  295. that.signList.Rs = json.Rs;
  296. }
  297. } else {
  298. that.signList.Rs = {
  299. Data: []
  300. };
  301. that.$message.error(json.Memo);
  302. }
  303. })
  304. },
  305. getNetDevMonitor(id) {
  306. let that = this;
  307. let param = {
  308. token: localStorage.token,
  309. regionId: id,
  310. };
  311. let postdata = qs.stringify(param);
  312. NetDevMonitor(postdata).then(res => {
  313. let json = res;
  314. if (json.Code == 0) {
  315. this.runtimeRs.Rs = json.Rs;
  316. } else {
  317. this.runtimeRs.Rs = [];
  318. that.$message.error(json.Memo);
  319. }
  320. })
  321. },
  322. getWirelessMonitor(id) {
  323. let that = this;
  324. let param = {
  325. token: localStorage.token,
  326. regionId: id,
  327. };
  328. let postdata = qs.stringify(param);
  329. WirelessMonitor(postdata).then(res => {
  330. let json = res;
  331. if (json.Code == 0) {
  332. this.detctorRs.Rs = json.Rs;
  333. } else {
  334. this.detctorRs.Rs = [];
  335. that.$message.error(json.Memo);
  336. }
  337. })
  338. },
  339. getDevList(id) {
  340. let that = this;
  341. let param = {
  342. token: localStorage.token,
  343. regionId: id,
  344. limit: 6,
  345. };
  346. let postdata = qs.stringify(param);
  347. DevList(postdata).then(res => {
  348. let json = res;
  349. if (json.Code == 0) {
  350. this.historyRs.Rs = json.Rs.List;
  351. this.totalRs = json.Rs;
  352. } else {
  353. this.historyRs.Rs = [];
  354. this.totalRs = [];
  355. that.$message.error(json.Memo);
  356. }
  357. })
  358. },
  359. getScanStrategyList(id) {
  360. let that = this;
  361. let param = {
  362. token: localStorage.token,
  363. regionId: id,
  364. limit: 6,
  365. };
  366. let postdata = qs.stringify(param);
  367. ScanStrategyList(postdata).then(res => {
  368. let json = res;
  369. if (json.Code == 0) {
  370. this.taskInfo = json.Rs;
  371. } else {
  372. this.taskInfo = [];
  373. that.$message.error(json.Memo);
  374. }
  375. })
  376. },
  377. getWirelessStatus(id) {
  378. let that = this;
  379. let param = {
  380. token: localStorage.token,
  381. regionId: id,
  382. };
  383. let postdata = qs.stringify(param);
  384. WirelessStatus(postdata).then(res => {
  385. let json = res;
  386. if (json.Code == 0) {
  387. this.taskResult = json.Rs;
  388. } else {
  389. this.taskResult = {
  390. BeginAt: '',
  391. DataSize: '0',
  392. Duration: '',
  393. IsStop: false,
  394. };
  395. that.$message.error(json.Memo);
  396. }
  397. })
  398. }
  399. },
  400. components: {
  401. signMap,
  402. Region,
  403. Detecter,
  404. WifiSign,
  405. Scan,
  406. HistoryRecord,
  407. EquipInfo,
  408. RunTimeRecord,
  409. Task,
  410. BigRader,
  411. DetctorRecord,
  412. }
  413. }
  414. </script>
  415. <style scoped>
  416. @import "../assets/css/cube.css";
  417. @import "../assets/css/dialog.css";
  418. .mainContainer {
  419. width: 100%;
  420. overflow: hidden;
  421. display: block;
  422. margin: 0 auto;
  423. }
  424. .mainContainer .lt {
  425. width: 20%;
  426. float: left;
  427. border: 1px solid rgba(0, 147, 253, 0.24);
  428. overflow: hidden;
  429. padding-bottom: 10px;
  430. background: rgba(0, 130, 255, 0.05);
  431. margin-right: 10px;
  432. }
  433. .mainContainer .md {
  434. width: 52%;
  435. min-width: 660px;
  436. float: left;
  437. overflow: hidden;
  438. padding-bottom: 10px;
  439. margin-right: 10px;
  440. }
  441. .mainContainer .bigMd {
  442. width: 72.5%;
  443. }
  444. .bigMd /deep/ .histogram div {
  445. width: 100% !important;
  446. }
  447. .bigMd /deep/ .histogram canvas {
  448. width: 100% !important;
  449. }
  450. .bigMd /deep/ .ve-line div {
  451. width: 100% !important;
  452. }
  453. .bigMd /deep/ .ve-line canvas {
  454. width: 100% !important;
  455. }
  456. .mainContainer .md .cube {
  457. border: 1px solid rgba(0, 147, 253, 0.24);
  458. background: rgba(0, 130, 255, 0.05);
  459. margin-bottom: 5px;
  460. }
  461. .mainContainer .rt {
  462. width: 26.5%;
  463. float: right;
  464. }
  465. .rt .cube {
  466. border: 1px solid rgba(0, 147, 253, 0.24);
  467. background: rgba(0, 130, 255, 0.05);
  468. margin-bottom: 5px;
  469. }
  470. .sum-title {
  471. width: 150px;
  472. height: 36px;
  473. font-size: 16px;
  474. line-height: 36px;
  475. color: #6DC1FF;
  476. margin: 0 auto;
  477. text-align: center;
  478. background: url("../assets/img/main/tit.png") top center no-repeat;
  479. background-size: 100%;
  480. }
  481. .el-table {
  482. background-color: #061B44;
  483. color: #6DC1FF;
  484. }
  485. .el-table th, .el-table tr {
  486. background-color: #061B44;
  487. color: #6DC1FF;
  488. }
  489. /deep/ .el-table th, /deep/ .el-table tr {
  490. background-color: #061B44;
  491. color: #6DC1FF;
  492. }
  493. /deep/ .el-table td, /deep/ .el-table th.is-leaf {
  494. border-bottom: 1px solid #061B44;
  495. }
  496. /deep/ .el-table--border::after, /deep/ .el-table--group::after, /deep/ .el-table::before {
  497. background-color: #061B44;
  498. }
  499. /deep/ .el-dialog__title {
  500. color: #6DC1FF;
  501. }
  502. </style>