Task.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  1. <template>
  2. <div class="Task">
  3. <div class="other-people">
  4. <div class="other-people-title">
  5. <div class="image-border image-border1"></div>
  6. <div class="image-border image-border2"></div>
  7. <div class="image-border image-border3"></div>
  8. <div class="image-border image-border4"></div>
  9. 扫描控制
  10. </div>
  11. </div>
  12. <div class="regionList">
  13. <el-row>
  14. <el-col :span="24">
  15. <el-col :span="6"><em class="label">扫描策略</em></el-col>
  16. <el-col :span="18">
  17. <el-select v-model="scan.tactics" placeholder="请选择" @change="getScanStrategyDetail">
  18. <el-option
  19. v-for="item in tactics_options"
  20. :key="item.Id"
  21. :label="item.Name"
  22. :value="item.Id">
  23. </el-option>
  24. </el-select>
  25. </el-col>
  26. </el-col>
  27. <el-col :span="24">
  28. <el-col :span="6"><em class="label">无线协议</em></el-col>
  29. <el-col :span="18">
  30. <el-select v-model="scan.agreement" multiple placeholder="请选择">
  31. <el-option
  32. v-for="item in agreement_options"
  33. :key="item.value"
  34. :label="item.label"
  35. :value="item.value">
  36. </el-option>
  37. </el-select>
  38. </el-col>
  39. </el-col>
  40. <el-col :span="24" v-if="scopeState">
  41. <el-col :span="6"><em class="label">起始频率</em></el-col>
  42. <el-col :span="18">
  43. <el-input v-model="scan.begin" type="number" placeholder="单位100K"></el-input>
  44. </el-col>
  45. </el-col>
  46. <el-col :span="24" v-if="scopeState">
  47. <el-col :span="6"><em class="label">截止频率</em></el-col>
  48. <el-col :span="18">
  49. <el-input v-model="scan.end" placeholder="单位100K"></el-input>
  50. </el-col>
  51. </el-col>
  52. <el-col :span="24">
  53. <el-col :span="6"><em class="label">扫描距离</em></el-col>
  54. <el-col :span="18">
  55. <el-select v-model="scan.distance" placeholder="请选择">
  56. <el-option
  57. v-for="item in distance_options"
  58. :key="item.value"
  59. :label="item.label"
  60. :value="item.value">
  61. </el-option>
  62. </el-select>
  63. </el-col>
  64. </el-col>
  65. <el-col :span="24">
  66. <el-col :span="12">
  67. <em class="label_checked" @click="turnRecord">
  68. <img src="../assets/img/main/true.png" height="15" width="15" v-if="recordState"/>
  69. <img src="../assets/img/main/false.png" height="15" width="15" v-else/>
  70. 信号录制
  71. </em></el-col>
  72. <el-col :span="12">
  73. <el-button type="primary" plain size="small" @click="startScan">开始扫描</el-button>
  74. </el-col>
  75. </el-col>
  76. <ul class="scan_detail">
  77. <li>
  78. <em>运行状态: </em>
  79. <span>{{taskText.IsStop |filterIsStop }}</span>
  80. </li>
  81. <li>
  82. <em>开始时间: </em>
  83. <span>{{taskText.BeginAt|filterBeginAt }}</span>
  84. </li>
  85. <li>
  86. <em>持续时间: </em>
  87. <span>{{taskText.Duration |filterDuration}}</span>
  88. </li>
  89. <li>
  90. <em>数据大小: </em>
  91. <span>{{parseFloat(taskText.DataSize /1024).toFixed(2)}} MB</span>
  92. </li>
  93. </ul>
  94. </el-row>
  95. </div>
  96. </div>
  97. </template>
  98. <script>
  99. import Global from "../Global"
  100. import {
  101. ScanStrategyDetail,
  102. } from '../api/getApiRes.js'
  103. let qs = require('qs');
  104. export default {
  105. data() {
  106. return {
  107. items: [{
  108. state: 1
  109. }],
  110. scopeState: false,
  111. isRecording: 1,
  112. recordState: true,
  113. scan: {
  114. tactics: 0,
  115. agreement: [],
  116. begin: 0,
  117. end: 0,
  118. distance: 1,
  119. cycle: 0,
  120. },
  121. tactics_options: [
  122. {
  123. Id: 0,
  124. Name: '自定义扫描'
  125. }
  126. ],
  127. taskText: {
  128. BeginAt: '',
  129. DataSize: '0',
  130. Duration: '',
  131. IsStop: false,
  132. },
  133. agreement_options: WirelessType(),
  134. distance_options: WirelessRange(),
  135. value: ''
  136. }
  137. },
  138. props: ['taskInfo', 'taskResult'],
  139. watch: {
  140. taskResult: {
  141. handler(newName, oldName) {
  142. this.taskText.BeginAt = newName.BeginAt;
  143. this.taskText.DataSize = newName.DataSize;
  144. this.taskText.Duration = newName.Duration;
  145. this.taskText.IsStop = newName.IsStop;
  146. },
  147. deep: true,
  148. immediate: true
  149. },
  150. taskInfo: {
  151. handler(newName, oldName) {
  152. if (!newName.length) return false;
  153. this.tactics_options = [
  154. {
  155. Id: 0,
  156. Name: '自定义扫描'
  157. }
  158. ];
  159. for (var i = 0; i < newName.length; i++) {
  160. this.tactics_options.push(newName[i]);
  161. }
  162. },
  163. deep: true,
  164. immediate: true
  165. },
  166. scan: {
  167. handler(newName, oldName) {
  168. if (parseInt(newName.begin) > 6000) {
  169. this.$notify.error({
  170. title: '错误',
  171. message: '起始频率不能大于6000'
  172. });
  173. return false
  174. }
  175. if (parseInt(newName.begin) < 0) {
  176. this.$notify.error({
  177. title: '错误',
  178. message: '起始频率不能小于0'
  179. });
  180. return false
  181. }
  182. if (parseInt(newName.end) > 6000) {
  183. this.$notify.error({
  184. title: '错误',
  185. message: '截止频率不能大于6000'
  186. });
  187. return false
  188. }
  189. if (parseInt(newName.end) < 0) {
  190. this.$notify.error({
  191. title: '错误',
  192. message: '截止频率不能小于0'
  193. });
  194. return false
  195. }
  196. if (parseInt(newName.end) < parseInt(newName.begin)) {
  197. this.$notify.error({
  198. title: '错误',
  199. message: '截止频率不能小于起始频率'
  200. });
  201. return false
  202. }
  203. // 0-6G现实范围
  204. if (newName.agreement.indexOf(13) > -1) {
  205. this.scopeState = true
  206. } else {
  207. this.scopeState = false
  208. }
  209. },
  210. deep: true,
  211. immediate: true
  212. }
  213. },
  214. methods: {
  215. turnRecord(){
  216. console.log(123);
  217. this.recordState = !this.recordState
  218. },
  219. // 扫描开始
  220. startScan() {
  221. let that = this;
  222. let freq06G = [];
  223. let signalList = [];
  224. let token = localStorage.token;
  225. if (that.scan.begin > 0) {
  226. freq06G = [
  227. {
  228. begin: parseInt(that.scan.begin),
  229. end: parseInt(that.scan.end)
  230. }
  231. ]
  232. }
  233. if (that.scan.agreement.length == 0) {
  234. that.$message({
  235. showClose: true,
  236. message: '无线协议不能为空!',
  237. type: 'error'
  238. });
  239. return false
  240. }
  241. for (var i = 0; i < that.scan.agreement.length; i++) {
  242. signalList[i] = {
  243. "range": that.scan.distance,
  244. "type": that.scan.agreement[i]
  245. }
  246. }
  247. let Rs = {
  248. freq06G: freq06G,
  249. isRecording: this.recordState,
  250. signalList: signalList,
  251. token: token
  252. };
  253. this.$emit('GetScanClick', Rs);//触发事件
  254. },
  255. getScanStrategyDetail() {
  256. let that = this;
  257. let param = {
  258. token: localStorage.token,
  259. id: this.scan.tactics
  260. };
  261. let postdata = qs.stringify(param);
  262. ScanStrategyDetail(postdata).then(res => {
  263. let json = res;
  264. if (json.Code == 0) {
  265. // 无线协议
  266. that.scan.agreement = [];
  267. let row = '';
  268. for (var i = 0; i < json.Rs.Value.SignalList.length; i++) {
  269. row = json.Rs.Value.SignalList[i];
  270. that.scan.agreement.push(row.Type)
  271. }
  272. // 起始频率 与 截止频率
  273. if (json.Rs.Value.Freq06G[0]) {
  274. that.scan.begin = json.Rs.Value.Freq06G[0].Begin;
  275. that.scan.end = json.Rs.Value.Freq06G[0].End;
  276. }
  277. // 扫描距离
  278. that.scan.distance = json.Rs.Value.SignalList[0].Range;
  279. // 是否录制
  280. console.log(json.Rs.Value.IsRecording);
  281. that.recordState = json.Rs.Value.IsRecording;
  282. } else {
  283. that.$message.error(json.Memo);
  284. }
  285. })
  286. }
  287. },
  288. filters: {
  289. filterIsStop: function (value) {
  290. if (!value) {
  291. return "扫描中"
  292. } else {
  293. return "已停止";
  294. }
  295. },
  296. filterBeginAt: function (value) {
  297. if (!value) {
  298. return "未开始"
  299. } else {
  300. return filterTimeToString(value);
  301. }
  302. },
  303. filterDuration: function (value) {
  304. if (!value) {
  305. return "未开始"
  306. } else {
  307. return filterTimeToShortString(value);
  308. }
  309. },
  310. }
  311. }
  312. </script>
  313. <style scoped>
  314. .Task {
  315. width: 100%;
  316. overflow: hidden;
  317. display: block;
  318. margin: 0 auto;
  319. margin-top: 20px;
  320. }
  321. .regionList {
  322. width: 100%;
  323. height: 433px;
  324. overflow: hidden;
  325. display: block;
  326. margin: 0 auto;
  327. margin-top: 20px;
  328. color: #6DC1FF;
  329. overflow-y: scroll;
  330. }
  331. .regionList::-webkit-scrollbar { /*滚动条整体样式*/
  332. width: 5px; /*高宽分别对应横竖滚动条的尺寸*/
  333. height: 1px;
  334. }
  335. .regionList::-webkit-scrollbar-thumb { /*滚动条里面小方块*/
  336. border-radius: 5px;
  337. -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  338. background: #6DC1FF;
  339. }
  340. .regionList::-webkit-scrollbar-track { /*滚动条里面轨道*/
  341. -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  342. border-radius: 5px;
  343. background: #6DC1FF;
  344. }
  345. .regionList .label {
  346. width: 100%;
  347. overflow: hidden;
  348. display: block;
  349. margin: 0 auto;
  350. line-height: 40px;
  351. text-align: right;
  352. color: #fff;
  353. font-size: 14px;
  354. }
  355. .regionList /deep/ .el-input__inner {
  356. background-color: rgba(0, 130, 255, 0.05);
  357. border: 1px solid #6DC1FF;
  358. color: #fff;
  359. }
  360. /deep/ .el-col {
  361. margin-bottom: 6px;
  362. }
  363. .label_checked {
  364. width: 50%;
  365. float: left;
  366. margin-left: 45px;
  367. line-height: 40px;
  368. color: #fff;
  369. font-size: 14px;
  370. cursor: pointer;
  371. }
  372. .regionList button {
  373. float: right;
  374. margin-right: 25px;
  375. }
  376. .label_text {
  377. width: 100%;
  378. overflow: hidden;
  379. display: block;
  380. margin: 0 auto;
  381. line-height: 40px;
  382. text-align: left;
  383. text-indent: 10px;
  384. }
  385. /deep/ .el-input {
  386. border-radius: 0;
  387. width: 180px;
  388. }
  389. /deep/ .el-checkbox__input.is-checked + .el-checkbox__label {
  390. color: #fff;
  391. }
  392. /deep/ .el-button {
  393. background-color: rgba(0, 130, 255, 0.05);
  394. border: 1px solid #6DC1FF;
  395. margin-right: 45px !important;
  396. }
  397. /deep/ .label_checked {
  398. margin-left: 35px;
  399. }
  400. .scan_detail {
  401. width: 80%;
  402. overflow: hidden;
  403. display: block;
  404. margin: 0 auto;
  405. font-size: 14px;
  406. }
  407. .scan_detail li {
  408. text-align: left;
  409. color: #fff;
  410. margin-bottom: 3px;
  411. }
  412. /deep/ .el-tag.el-tag--info {
  413. float: left;
  414. }
  415. </style>