Main.vue 16 KB

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