Qrcodemanage.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  1. <template>
  2. <div>
  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>设备ID:</em>
  16. <el-input v-model="panel.keyword" placeholder="请输入设备ID"></el-input>
  17. </el-col>
  18. <el-col :span="4">
  19. <em>MAC:</em>
  20. <el-input v-model="panel.keyword" placeholder="请输入MAC地址"></el-input>
  21. </el-col>
  22. <el-col :span="4">
  23. <em>所属区域:</em>
  24. <el-select v-model="panel.taskstatus">
  25. <el-option
  26. v-for="item in panel.options"
  27. :key="item.value"
  28. :label="item.label"
  29. :value="item.value">
  30. </el-option>
  31. </el-select>
  32. </el-col>
  33. <el-col :span="6">
  34. <em>登记时间:</em>
  35. <el-date-picker
  36. v-model="panel.time1"
  37. type="daterange"
  38. range-separator="至"
  39. start-placeholder="开始日期"
  40. end-placeholder="结束日期">
  41. </el-date-picker>
  42. </el-col>
  43. <el-col :span="4">
  44. <el-button size="small" type="primary" @click="query">查询</el-button>
  45. </el-col>
  46. </el-row>
  47. </div>
  48. </div>
  49. </div>
  50. <div class="contorl">
  51. <el-button size="small" type="primary" @click="addList">添加</el-button>
  52. <el-button size="small" type="primary" @click="delList">删除</el-button>
  53. <el-button size="small" type="primary" @click="changeList">修改</el-button>
  54. </div>
  55. <el-table
  56. :data="tableData"
  57. class=""
  58. stripe
  59. @selection-change="handleSelectionChange"
  60. >
  61. <el-table-column
  62. type="selection"
  63. width="55">
  64. </el-table-column>
  65. <el-table-column
  66. prop="name"
  67. label="设备ID"
  68. >
  69. </el-table-column>
  70. <el-table-column
  71. prop="date"
  72. label="检测时间"
  73. width="180">
  74. </el-table-column>
  75. <el-table-column
  76. prop="name"
  77. label="探测区域"
  78. >
  79. </el-table-column>
  80. <el-table-column
  81. prop="name"
  82. label="信道"
  83. width="180">
  84. </el-table-column>
  85. <el-table-column
  86. prop="address"
  87. label="信号频段">
  88. </el-table-column>
  89. <el-table-column
  90. prop="address"
  91. label="数据量">
  92. </el-table-column>
  93. <el-table-column
  94. prop="address"
  95. label="信号强度">
  96. </el-table-column>
  97. <el-table-column
  98. prop="address"
  99. label="操作记录">
  100. <template slot-scope="scope">
  101. <span @click="goRecord(scope.row)">探测记录</span>
  102. </template>
  103. </el-table-column>
  104. </el-table>
  105. <br>
  106. <el-pagination
  107. background
  108. :total="pageination.total"
  109. :page-size="pageination.pageItem"
  110. @current-change="pageChange"
  111. ></el-pagination>
  112. <dialog_referrer_list
  113. :show="dialog_state"
  114. :title="dialog_title"
  115. :large="true"
  116. @dialog_cancel="dialog_cancel"
  117. @dialog_ok="dialog_ok"
  118. >
  119. <div class="dialogContent">
  120. <el-row :gutter="20">
  121. <el-col :span="10">
  122. <label>
  123. 设备ID
  124. </label>
  125. <el-input v-model="dialog.name"></el-input>
  126. </el-col>
  127. <el-col :span="10">
  128. <label>
  129. MAC地址
  130. </label>
  131. <el-input v-model="dialog.name"></el-input>
  132. </el-col>
  133. <el-col :span="10">
  134. <label>
  135. 标签名
  136. </label>
  137. <el-input v-model="dialog.name"></el-input>
  138. </el-col>
  139. <el-col :span="10">
  140. <label>
  141. 设备所属楼层
  142. </label>
  143. <el-select v-model="dialog.region" placeholder="请选择所属楼层">
  144. <el-option
  145. v-for="item in panel.options"
  146. :key="item.value"
  147. :label="item.label"
  148. :value="item.value">
  149. </el-option>
  150. </el-select>
  151. </el-col>
  152. <el-col :span="20">
  153. <label>
  154. 备注
  155. </label>
  156. <el-input type="textarea" v-model="dialog.memo"></el-input>
  157. </el-col>
  158. </el-row>
  159. </div>
  160. </dialog_referrer_list>
  161. </div>
  162. </template>
  163. <script>
  164. import Global from '../Global.js'
  165. import dialog_referrer_list from '../components/dialog_referrer_list'
  166. export default {
  167. data() {
  168. return {
  169. // dialog
  170. dialog_state: false,
  171. dialog_title: '添加设备',
  172. dialog_type: '',//类型,1是添加,2是修改
  173. tabIndex: 0,
  174. tabs: [
  175. {name: '二维码管理', url: 'qrcodemanage'},
  176. ],
  177. // panel 配置项目
  178. panel: {
  179. usercode: '',
  180. username: '',
  181. compname: '',
  182. keyword: '',
  183. USERCODE: '',
  184. taskstatus: 99,
  185. options: [
  186. {value: 99, label: '全部'},
  187. {value: 1, label: '进行中'},
  188. {value: 2, label: '已完成'},
  189. ],
  190. time1: globalBt2(),
  191. },
  192. pageination: {
  193. pageItem: 10,
  194. pageoptions: pageOptions(),
  195. total: 10,
  196. pageIndex: 1,
  197. },
  198. dialog: {
  199. name: 10,
  200. region: 10,
  201. memo: '',
  202. },
  203. multipleSelection: [],
  204. tableData: [{
  205. date: '2016-05-02',
  206. name: '王小虎',
  207. address: '上海市普陀区金沙江路 1518 弄'
  208. }, {
  209. date: '2016-05-04',
  210. name: '王小虎',
  211. address: '上海市普陀区金沙江路 1517 弄'
  212. }, {
  213. date: '2016-05-01',
  214. name: '王小虎',
  215. address: '上海市普陀区金沙江路 1519 弄'
  216. }, {
  217. date: '2016-05-03',
  218. name: '王小虎',
  219. address: '上海市普陀区金沙江路 1516 弄'
  220. }]
  221. }
  222. },
  223. mounted() {
  224. this.getTableQuery();
  225. },
  226. methods: {
  227. // 跳转tab页面
  228. goTab(url) {
  229. this.$router.push({path: url});
  230. },
  231. // 查询按钮
  232. query() {
  233. this.getTableQuery();
  234. this.$message.success('查询完毕');
  235. },
  236. handleSelectionChange(val) {
  237. this.multipleSelection = val;
  238. console.log(val);
  239. },
  240. // 页面数据查询
  241. getTableQuery() {
  242. // let that = this;
  243. // that.loading = true;
  244. // let url = headapi + '?ctl=ajax&mod=dial&act=taskListQuery';//获取
  245. // let param = {
  246. // 'taskstatus': that.panel.taskstatus,
  247. // 'bt': globaltime2String(that.panel.time1[0]),
  248. // 'et': globaltime2String(that.panel.time1[1]),
  249. // 'KEYWORD': that.panel.keyword,
  250. // 'USERCODE': that.panel.USERCODE,
  251. // };
  252. // let JSON = '';
  253. // let postdata = qs.stringify(param);
  254. // axios.post(url, postdata)
  255. // .then(function (response) {
  256. // JSON = response.data;
  257. // that.loading = false;
  258. // that.allTableData = JSON.rs;
  259. // that.recordsTotal = JSON.rs.length;
  260. // // 设置分页数据
  261. // that.setPaginations();
  262. // })
  263. // .catch(function (error) {
  264. // console.log(error);
  265. // });
  266. },
  267. // 设置分页数据
  268. setPaginations() {
  269. // 分页属性
  270. let that = this;
  271. that.pageination.total = that.recordsTotal;
  272. // 默认分页
  273. that.tableData = that.allTableData.filter((item, index) => {
  274. return index < that.pageination.pageItem;
  275. });
  276. },
  277. // 每页显示数量
  278. handleSizeChange() {
  279. let that = this;
  280. that.tableData = that.allTableData.filter((item, index) => {
  281. return index < that.pageination.pageItem;
  282. });
  283. that.draw = that.pageination.pageItem;
  284. that.getTableQuery();
  285. },
  286. // 翻页
  287. pageChange(pageIndex) {
  288. let that = this;
  289. // 获取当前页
  290. let index = that.pageination.pageItem * (pageIndex - 1);
  291. // 数据总数
  292. let nums = that.pageination.pageItem * pageIndex;
  293. // 容器
  294. let tables = [];
  295. for (var i = index; i < nums; i++) {
  296. if (that.allTableData[i]) {
  297. tables.push(that.allTableData[i])
  298. }
  299. this.tableData = tables;
  300. }
  301. that.start = index * that.draw;
  302. that.getTableQuery();
  303. },
  304. // 自动排序
  305. sortChange(params) {
  306. console.log(params)
  307. },
  308. // 过滤时间
  309. filterFmtDate(value, row, column) {
  310. let that = this;
  311. return globalfmtDate(column, 11);
  312. },
  313. addList() {
  314. this.dialog_state = true;
  315. this.dialog_title = '添加设备';
  316. },
  317. delList() {
  318. // checkNum
  319. if (!this.multipleSelection.length) {
  320. this.$message({
  321. showClose: true,
  322. message: '错了哦,需要先选中至少一条记录',
  323. type: 'error'
  324. });
  325. return false
  326. }
  327. // todo delEquip
  328. },
  329. changeList() {
  330. // checkNum
  331. if (!this.multipleSelection.length) {
  332. this.$message({
  333. showClose: true,
  334. message: '错了哦,需要先选中一条记录',
  335. type: 'error'
  336. });
  337. return false
  338. }
  339. if (this.multipleSelection.length > 1) {
  340. this.$message({
  341. showClose: true,
  342. message: '错了哦,只能选中一条记录',
  343. type: 'error'
  344. });
  345. return false
  346. }
  347. },
  348. // 探测记录
  349. goRecord(row) {
  350. console.log(row);
  351. this.$router.push({path: '/record', query: {row: row}});
  352. },
  353. dialog_cancel() {
  354. let that = this;
  355. that.dialog_state = false;
  356. },
  357. dialog_ok() {
  358. let that = this;
  359. let dialog_type = that.dialog_type;
  360. let name = that.field_name;
  361. let id = that.field_id;
  362. },
  363. },
  364. components: {
  365. dialog_referrer_list
  366. }
  367. }
  368. </script>
  369. <style scoped>
  370. @import "../assets/css/panel.css";
  371. @import "../assets/css/dialog.css";
  372. .tabs ul {
  373. width: 168px;
  374. }
  375. table span {
  376. cursor: pointer;
  377. }
  378. </style>