WifiSign.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. <template>
  2. <div class="content">
  3. <div class="tabs">
  4. <ul>
  5. <li v-for="(tab,i) in tabs" @click="goTab(tab.url)" :class="{'active':tabIndex == i}">
  6. {{tab.name}}
  7. </li>
  8. </ul>
  9. </div>
  10. <div class="panel">
  11. <div class="panel-body">
  12. <div class=" panel_control">
  13. <el-row :gutter="20">
  14. <el-col :span="4">
  15. <em>探测器:</em>
  16. <el-select v-model="panel.detidstr">
  17. <el-option
  18. v-for="item in panel.detOptions"
  19. :key="item.Id"
  20. :label="item.Name"
  21. :value="item.Id">
  22. </el-option>
  23. </el-select>
  24. </el-col>
  25. <el-col :span="4">
  26. <em>被检Mac:</em>
  27. <el-input v-model="panel.detectedmac" placeholder="请输入被检测设备Mac"></el-input>
  28. </el-col>
  29. <el-col :span="6">
  30. <em>检测时间:</em>
  31. <el-date-picker
  32. v-model="panel.time1"
  33. type="daterange"
  34. range-separator="至"
  35. start-placeholder="开始日期"
  36. end-placeholder="结束日期">
  37. </el-date-picker>
  38. </el-col>
  39. <el-col :span="4">
  40. <el-button size="small" type="primary" @click="query">查询</el-button>
  41. </el-col>
  42. </el-row>
  43. </div>
  44. </div>
  45. </div>
  46. <el-table
  47. :data="tableData"
  48. is-horizontal-resize
  49. :default-sort="{prop: 'date', order: 'descending'}"
  50. v-loading="loading" element-loading-background="rgba(0, 0, 0, 0.8)"
  51. class=""
  52. stripe
  53. >
  54. <el-table-column
  55. prop="Id"
  56. label="记录"
  57. >
  58. </el-table-column>
  59. <el-table-column
  60. prop="DetectorId"
  61. label="探测设备ID"
  62. width="120"
  63. >
  64. </el-table-column>
  65. <el-table-column
  66. prop="Macstr"
  67. label="Mac地址"
  68. >
  69. </el-table-column>
  70. <el-table-column
  71. prop="ProduceCom"
  72. label="品牌"
  73. >
  74. </el-table-column>
  75. <el-table-column
  76. prop="Path"
  77. label="位置"
  78. >
  79. </el-table-column>
  80. <el-table-column
  81. prop="SignalIntensity"
  82. label="信号强度"
  83. width="120"
  84. >
  85. </el-table-column>
  86. <el-table-column
  87. prop="EditTime"
  88. label="检测时间"
  89. :formatter="filterFmtDate"
  90. width="180">
  91. </el-table-column>
  92. <el-table-column
  93. prop="DangerLevel"
  94. label="危险等级"
  95. width="120"
  96. >
  97. <template slot-scope="scope">
  98. <span class="yellow" v-if="scope.row.DangerLevel == -1">危险</span>
  99. <span v-if="scope.row.DangerLevel != -1">安全</span>
  100. </template>
  101. </el-table-column>
  102. </el-table>
  103. <br>
  104. <el-pagination
  105. background
  106. :total="pageination.total"
  107. :page-size="pageination.pageItem"
  108. @current-change="pageChange"
  109. ></el-pagination>
  110. </div>
  111. </template>
  112. <script>
  113. import Global from '../Global.js'
  114. import {LogWifiDetectedQueryByDetector, GetRegionAndDectorSelect} from '../api/getApiRes.js'
  115. let qs = require('qs');
  116. export default {
  117. data() {
  118. return {
  119. tabIndex: 1,
  120. tabs: [
  121. {name: '手机信号记录', url: 'phoneSign'},
  122. {name: 'WiFi信号记录', url: 'wifiSign'},
  123. // {name: '0-6G扫描记录', url: 'GSign'},
  124. ],
  125. // panel 配置项目
  126. panel: {
  127. usercode: '',
  128. username: '',
  129. compname: '',
  130. keyword: '',
  131. USERCODE: '',
  132. detectedmac: '',
  133. taskstatus: 99,
  134. options: [
  135. {value: 99, label: '全部'},
  136. {value: 1, label: '进行中'},
  137. {value: 2, label: '已完成'},
  138. ],
  139. detOptions: [],
  140. detidstr: 0,
  141. time1: globalBt2(),
  142. },
  143. pageination: {
  144. pageItem: 10,
  145. pageoptions: pageOptions(),
  146. total: 300,
  147. pageIndex: 1,
  148. },
  149. draw: 1,
  150. start: 0,
  151. recordsTotal: 0,
  152. tableData: [],
  153. allTableData: [],
  154. limit: '10',
  155. multipleSort: false,
  156. loading: true,
  157. fileList: [],
  158. multipleSelection: [],
  159. detectedmac: '',
  160. }
  161. },
  162. mounted() {
  163. this.getTableQuery();
  164. },
  165. methods: {
  166. getDetOption() {
  167. let param = {
  168. 'token': localStorage.token,
  169. };
  170. let postdata = qs.stringify(param);
  171. GetRegionAndDectorSelect(postdata).then(res => {
  172. let json = res;
  173. if (json.Code == 0) {
  174. console.log(json);
  175. this.panel.detOptions = json.DectectorRs;//所有设备
  176. this.panel.detOptions.unshift({Id: 0, Name: '全部'});
  177. } else {
  178. that.$message.error(json.Memo);
  179. }
  180. })
  181. },
  182. // 跳转tab页面
  183. goTab(url) {
  184. this.$router.push({path: url});
  185. },
  186. // 查询按钮
  187. query() {
  188. this.getTableQuery();
  189. this.$message.success('查询完毕');
  190. },
  191. // 页面数据查询
  192. getTableQuery() {
  193. // 获取探测器列表
  194. this.getDetOption();
  195. let that = this;
  196. that.loading = true;
  197. let param = {
  198. token: localStorage.token,
  199. detectorId: that.panel.detidstr,//探测器id列表
  200. detectedmac: that.panel.detectedmac,//被检测设备Mac
  201. bt: globaltime2String(that.panel.time1[0]) + ' 00:00:01',//开始时间
  202. et: globaltime2String(that.panel.time1[1]) + ' 23:59:59',//结束时间
  203. start: 1,//
  204. tableMax: 300,//
  205. };
  206. let postdata = qs.stringify(param);
  207. LogWifiDetectedQueryByDetector(postdata).then(res => {
  208. let json = res;
  209. if (json.Code == 0) {
  210. that.loading = false;
  211. if (json.Rs) {
  212. that.allTableData = json.Rs;
  213. that.recordsTotal = json.Rs.length;
  214. } else {
  215. that.allTableData = [];
  216. that.recordsTotal = 0;
  217. }
  218. // 设置分页数据
  219. that.setPaginations();
  220. } else {
  221. that.$message.error(json.Memo);
  222. }
  223. })
  224. },
  225. // 导出excel
  226. btnExpAll() {
  227. let that = this;
  228. let url = headapi + '?ctl=ajax&mod=czgl&act=czcx_excel';//获取
  229. let bt = globaltime2String(that.panel.time1[0]);
  230. let et = globaltime2String(that.panel.time1[1]);
  231. let usercode = that.panel.usercode;
  232. window.location = url + '&bt=' + bt + '&et=' + et + '&usercode=' + usercode;
  233. },
  234. // 设置分页数据
  235. setPaginations() {
  236. // 分页属性
  237. let that = this;
  238. that.pageination.total = that.recordsTotal;
  239. // 默认分页
  240. that.tableData = that.allTableData.filter((item, index) => {
  241. return index < that.pageination.pageItem;
  242. });
  243. },
  244. // 每页显示数量
  245. handleSizeChange() {
  246. let that = this;
  247. that.tableData = that.allTableData.filter((item, index) => {
  248. return index < that.pageination.pageItem;
  249. });
  250. that.draw = that.pageination.pageItem;
  251. that.getTableQuery();
  252. },
  253. // 翻页
  254. pageChange(pageIndex) {
  255. let that = this;
  256. // 获取当前页
  257. let index = that.pageination.pageItem * (pageIndex - 1);
  258. // 数据总数
  259. let nums = that.pageination.pageItem * pageIndex;
  260. // 容器
  261. let tables = [];
  262. for (var i = index; i < nums; i++) {
  263. if (that.allTableData[i]) {
  264. tables.push(that.allTableData[i])
  265. }
  266. this.tableData = tables;
  267. }
  268. that.start = index * that.draw;
  269. that.getTableQuery();
  270. },
  271. // 自动排序
  272. sortChange(params) {
  273. console.log(params)
  274. },
  275. // 过滤时间
  276. filterFmtDate(value, row, column) {
  277. let that = this;
  278. return globalfmtDate(column, 10);
  279. },
  280. // 过滤金额
  281. filterMoney(value, row, column) {
  282. let that = this;
  283. return parseFloat(column).toFixed(2);
  284. },
  285. },
  286. }
  287. </script>
  288. <style scoped>
  289. @import "../assets/css/panel.css";
  290. .tabs ul {
  291. width: 400px;
  292. }
  293. .content {
  294. width: 100%;
  295. overflow: hidden;
  296. display: block;
  297. margin: 0 auto;
  298. padding-left: 10px;
  299. }
  300. </style>