Main.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  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. </div>
  49. </template>
  50. <script>
  51. import signMap from '@/components/signMap.vue'
  52. import Region from '@/components/Region.vue'
  53. import Detecter from '@/components/Detecter.vue'
  54. import Task from '@/components/Task.vue'
  55. import WifiSign from '@/components/WifiSign.vue'
  56. import Scan from '@/components/Scan.vue'
  57. import HistoryRecord from '@/components/HistoryRecord.vue'
  58. import EquipInfo from '@/components/EquipInfo.vue'
  59. import RunTimeRecord from '@/components/RunTimeRecord.vue'
  60. import DetctorRecord from '@/components/DetcotrRecord.vue'
  61. import BigRader from '@/components/BigRader.vue'
  62. import {
  63. getLoftInfo,
  64. RegionList,
  65. DetectorList,
  66. Region06G,
  67. WifiChannel,
  68. MonitorArea,
  69. NetDevMonitor,
  70. WirelessMonitor,
  71. DevList,
  72. WirelessStatus,
  73. ScanStrategyList,
  74. WirelessStart,
  75. } from '../api/getApiRes.js'
  76. import {mapGetters, mapActions, mapState} from "vuex";
  77. import Global from "../Global"
  78. let qs = require('qs');
  79. export default {
  80. data() {
  81. return {
  82. CurrentRegionId:0,
  83. WifiRs: {},
  84. ScanRs: {},
  85. signList: {},
  86. totalRs: [],
  87. equipRs: [],
  88. regionList: [],
  89. detectorList: [],
  90. showLeft: true,
  91. regionId: '',
  92. historyRs: {
  93. Title: '区域无线设备列表',
  94. Url: 'signEquip',
  95. Rs: [],
  96. }, runtimeRs: {
  97. Title: '实时监控详情',
  98. Url: 'record',
  99. Rs: [],
  100. },
  101. detctorRs: {
  102. Title: '探测设备工作监控',
  103. Url: 'equip',
  104. Rs: [],
  105. },
  106. taskInfo:{},
  107. taskResult:{}
  108. }
  109. },
  110. mounted() {
  111. this.init();
  112. this.showLeft = parseInt(this.$store.state.status.count) % 2 == 0
  113. },
  114. computed: {
  115. ...mapGetters({
  116. 'getCount': 'status/getCount'
  117. })
  118. },
  119. watch: {
  120. '$route': function (val) {
  121. if (val.path == '/') {
  122. this.init()
  123. }
  124. },
  125. '$store.state.status.count': function (val) {
  126. this.showLeft = parseInt(val) % 2 == 0
  127. },
  128. },
  129. methods: {
  130. init() {
  131. this.getDate();
  132. },
  133. getDate() {
  134. let that = this;
  135. let param = {
  136. token: localStorage.token,
  137. };
  138. let postdata = qs.stringify(param);
  139. that.regionList = [];
  140. RegionList(postdata).then(res => {
  141. let json = res;
  142. if (json.Code == 0) {
  143. that.regionList = json.Rs;
  144. // 默认加载第一个区域
  145. if (json.Rs) {
  146. this.CurrentRegionId = json.Rs[0].Id;
  147. this.getDetectorList(json.Rs[0].Id);
  148. this.getRegion06G(json.Rs[0].Id);
  149. this.getWifiChannel(json.Rs[0].Id);
  150. this.getMonitorArea(json.Rs[0].Id);
  151. this.getNetDevMonitor(json.Rs[0].Id);
  152. this.getWirelessMonitor(json.Rs[0].Id);
  153. this.getDevList(json.Rs[0].Id);
  154. this.getWirelessStatus(json.Rs[0].Id);
  155. this.getScanStrategyList(json.Rs[0].Id);
  156. }
  157. } else {
  158. that.$message.error(json.Memo);
  159. }
  160. })
  161. },
  162. getDetectorList(regionId) {
  163. let that = this;
  164. let param = {
  165. token: localStorage.token,
  166. regionId: regionId,
  167. };
  168. let postdata = qs.stringify(param);
  169. that.detectorList = [];
  170. DetectorList(postdata).then(res => {
  171. let json = res;
  172. if (json.Code == 0) {
  173. that.detectorList = json.Rs
  174. } else {
  175. that.$message.error(json.Memo);
  176. }
  177. })
  178. },
  179. // Wifi柱状图信息传入探测器Id
  180. getWifiChannel(Id) {
  181. let that = this;
  182. let param = {
  183. token: localStorage.token,
  184. id: Id,
  185. };
  186. let postdata = qs.stringify(param);
  187. WifiChannel(postdata).then(res => {
  188. let json = res;
  189. if (json.Code == 0) {
  190. that.WifiRs = json;
  191. } else {
  192. that.$message.error(json.Memo + ',错误代码:' + json.Code);
  193. }
  194. })
  195. },
  196. ClickGetInfo(Id) {
  197. this.CurrentRegionId = Id;
  198. this.getDetectorList(Id);
  199. this.getRegion06G(Id);
  200. this.getWifiChannel(Id);
  201. this.getMonitorArea(Id);
  202. this.getNetDevMonitor(Id);
  203. this.getWirelessMonitor(Id);
  204. this.getDevList(Id);
  205. this.getWirelessStatus(Id);
  206. this.getScanStrategyList(Id);
  207. },
  208. ClickGetScan(Rs){
  209. let that = this;
  210. Rs.regionId = that.CurrentRegionId;
  211. let postdata = qs.stringify(Rs);
  212. WirelessStart(postdata).then(res => {
  213. let json = res;
  214. if (json.Code == 0) {
  215. that.$message({
  216. showClose: true,
  217. message: '开始扫描!',
  218. type: 'success'
  219. });
  220. } else {
  221. that.$message.error(json.Memo);
  222. }
  223. })
  224. },
  225. getRegion06G(id) {
  226. let that = this;
  227. let param = {
  228. token: localStorage.token,
  229. id: id,
  230. xCount: 200,
  231. };
  232. let postdata = qs.stringify(param);
  233. Region06G(postdata).then(res => {
  234. let json = res;
  235. if (json.Code == 0) {
  236. this.ScanRs = json;
  237. } else {
  238. this.ScanRs = {};
  239. that.$message.error(json.Memo);
  240. }
  241. })
  242. },
  243. getMonitorArea(id) {
  244. let that = this;
  245. let param = {
  246. token: localStorage.token,
  247. id: id,
  248. };
  249. let postdata = qs.stringify(param);
  250. MonitorArea(postdata).then(res => {
  251. let json = res;
  252. if (json.Code == 0) {
  253. this.signList = json;
  254. } else {
  255. this.signList = {};
  256. that.$message.error(json.Memo);
  257. }
  258. })
  259. },
  260. getNetDevMonitor(id) {
  261. let that = this;
  262. let param = {
  263. token: localStorage.token,
  264. regionId: id,
  265. };
  266. let postdata = qs.stringify(param);
  267. NetDevMonitor(postdata).then(res => {
  268. let json = res;
  269. if (json.Code == 0) {
  270. this.runtimeRs.Rs = json.Rs;
  271. } else {
  272. this.runtimeRs.Rs = [];
  273. that.$message.error(json.Memo);
  274. }
  275. })
  276. },
  277. getWirelessMonitor(id) {
  278. let that = this;
  279. let param = {
  280. token: localStorage.token,
  281. regionId: id,
  282. };
  283. let postdata = qs.stringify(param);
  284. WirelessMonitor(postdata).then(res => {
  285. let json = res;
  286. if (json.Code == 0) {
  287. this.detctorRs.Rs = json.Rs;
  288. } else {
  289. this.detctorRs.Rs = [];
  290. that.$message.error(json.Memo);
  291. }
  292. })
  293. },
  294. getDevList(id) {
  295. let that = this;
  296. let param = {
  297. token: localStorage.token,
  298. regionId: id,
  299. limit: 6,
  300. };
  301. let postdata = qs.stringify(param);
  302. DevList(postdata).then(res => {
  303. let json = res;
  304. if (json.Code == 0) {
  305. this.historyRs.Rs = json.Rs.List;
  306. this.totalRs = json.Rs;
  307. } else {
  308. this.historyRs.Rs = [];
  309. this.totalRs = [];
  310. that.$message.error(json.Memo);
  311. }
  312. })
  313. },
  314. getScanStrategyList(id) {
  315. let that = this;
  316. let param = {
  317. token: localStorage.token,
  318. regionId: id,
  319. limit: 6,
  320. };
  321. let postdata = qs.stringify(param);
  322. ScanStrategyList(postdata).then(res => {
  323. let json = res;
  324. if (json.Code == 0) {
  325. json.Rs.push({
  326. Id: 0,
  327. Name: '自定义扫描'
  328. });
  329. // todo
  330. // this.taskInfo = json.Rs;
  331. } else {
  332. this.taskInfo = [];
  333. that.$message.error(json.Memo);
  334. }
  335. })
  336. },
  337. getWirelessStatus(id) {
  338. let that = this;
  339. let param = {
  340. token: localStorage.token,
  341. regionId: id,
  342. };
  343. let postdata = qs.stringify(param);
  344. WirelessStatus(postdata).then(res => {
  345. let json = res;
  346. if (json.Code == 0) {
  347. this.taskResult = json.Rs;
  348. } else {
  349. this.taskResult = {
  350. BeginAt:'',
  351. DataSize:'0',
  352. Duration:'',
  353. IsStop:false,
  354. };
  355. that.$message.error(json.Memo);
  356. }
  357. })
  358. }
  359. },
  360. components: {
  361. signMap,
  362. Region,
  363. Detecter,
  364. WifiSign,
  365. Scan,
  366. HistoryRecord,
  367. EquipInfo,
  368. RunTimeRecord,
  369. Task,
  370. BigRader,
  371. DetctorRecord,
  372. }
  373. }
  374. </script>
  375. <style scoped>
  376. @import "../assets/css/cube.css";
  377. .mainContainer {
  378. width: 100%;
  379. overflow: hidden;
  380. display: block;
  381. margin: 0 auto;
  382. }
  383. .mainContainer .lt {
  384. width: 20%;
  385. float: left;
  386. border: 1px solid rgba(0, 147, 253, 0.24);
  387. overflow: hidden;
  388. padding-bottom: 10px;
  389. background: rgba(0, 130, 255, 0.05);
  390. margin-right: 10px;
  391. }
  392. .mainContainer .md {
  393. width: 52%;
  394. float: left;
  395. overflow: hidden;
  396. padding-bottom: 10px;
  397. margin-right: 10px;
  398. }
  399. .mainContainer .bigMd {
  400. width: 72.5%;
  401. }
  402. .bigMd /deep/ .histogram div {
  403. width: 100% !important;
  404. }
  405. .bigMd /deep/ .histogram canvas {
  406. width: 100% !important;
  407. }
  408. .bigMd /deep/ .ve-line div {
  409. width: 100% !important;
  410. }
  411. .bigMd /deep/ .ve-line canvas {
  412. width: 100% !important;
  413. }
  414. .mainContainer .md .cube {
  415. border: 1px solid rgba(0, 147, 253, 0.24);
  416. background: rgba(0, 130, 255, 0.05);
  417. margin-bottom: 5px;
  418. }
  419. .mainContainer .rt {
  420. width: 26.5%;
  421. float: right;
  422. }
  423. .rt .cube {
  424. border: 1px solid rgba(0, 147, 253, 0.24);
  425. background: rgba(0, 130, 255, 0.05);
  426. margin-bottom: 5px;
  427. }
  428. .sum-title {
  429. width: 150px;
  430. height: 36px;
  431. font-size: 16px;
  432. line-height: 36px;
  433. color: #6DC1FF;
  434. margin: 0 auto;
  435. text-align: center;
  436. background: url("../assets/img/main/tit.png") top center no-repeat;
  437. background-size: 100%;
  438. }
  439. </style>