ubi.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <div class="zy-template">
  3. <div class="zy-main-title">设备列表-普适型</div>
  4. <div class="zy-module">
  5. <el-form ref="form" :model="query" label-width="60px">
  6. <el-form-item label="设备码:" class="zy-search-form-item">
  7. <el-input v-model="query.openNum" size="mini" clearable></el-input>
  8. </el-form-item>
  9. <el-form-item label="设备组:" class="zy-search-form-item">
  10. <el-select v-model="query.groupId" filterable clearable placeholder=" " size="mini">
  11. <el-option v-for="item in groups" :key="item" :value="item" />
  12. </el-select>
  13. </el-form-item>
  14. <el-button type="primary" size="mini" @click="submit">查询</el-button>
  15. </el-form>
  16. </div>
  17. <div class="zy-module">
  18. <el-table :data="page.records" header-cell-class-name="zy-table-header-cell" cell-class-name='zy-table-cell'
  19. stripe>
  20. <el-table-column prop="openNum" label="设备码" min-width="180">
  21. <template #default="scope">IMEI{{scope.row.openNum}}</template>
  22. </el-table-column>
  23. <el-table-column prop="groupId" label="设备组" min-width="120" />
  24. <el-table-column prop="createTime" label="创建时间" min-width="180" />
  25. <el-table-column prop="freq" label="上传频率(秒)" min-width="120" />
  26. <el-table-column prop="powerVolt" label="电池电压" min-width="100" />
  27. <el-table-column prop="signal4g" label="4G信号" min-width="80" />
  28. <el-table-column prop="oemType" label="板卡类型" min-width="100" />
  29. <el-table-column prop="version" label="软件版本号" min-width="100" />
  30. <el-table-column prop="lon" label="经度" min-width="120" />
  31. <el-table-column prop="lat" label="纬度" min-width="120" />
  32. <el-table-column prop="satNum" label="卫星颗数" min-width="80" />
  33. <el-table-column label="状态" min-width="100">
  34. <template #default="scope">
  35. <el-tag type="success" v-if="scope.row.status===1" size="small">在线</el-tag>
  36. <el-tag type="danger" v-if="scope.row.status===0" size="small">离线</el-tag>
  37. </template>
  38. </el-table-column>
  39. <el-table-column prop="updateTime" label="最近通讯时间" min-width="180" />
  40. <!-- <el-table-column label="操作" min-width="80">-->
  41. <!-- <template #default="scope">-->
  42. <!-- <el-button @click="detailHandler(scope.row.openNum)" type="text" size="small">详情</el-button>-->
  43. <!-- </template>-->
  44. <!-- </el-table-column>-->
  45. </el-table>
  46. <el-pagination class="zy-table-pagination" background layout="prev, pager, next"
  47. :current-page="page.current" :total="page.total" :page-size="page.size" @current-change="pagination" />
  48. </div>
  49. <el-dialog title="设备详情" v-model="detailDialog" width="500px">
  50. <el-descriptions :column="2" border>
  51. <el-descriptions-item label="设备码:">{{detail.openNum}}</el-descriptions-item>
  52. <el-descriptions-item label="定位模式:">{{detail.mode==1?'GPS':'基站'}}</el-descriptions-item>
  53. </el-descriptions>
  54. </el-dialog>
  55. </div>
  56. </template>
  57. <script>
  58. export default {
  59. data() {
  60. return {
  61. query: {
  62. openNum: "",
  63. type: null,
  64. },
  65. page: {
  66. current: 1,
  67. size: 20,
  68. },
  69. groups: [], //设备组
  70. detailDialog: false, //详情弹出框
  71. detail: {}, //设备详情
  72. };
  73. },
  74. mounted() {
  75. this.getDevicesList();
  76. this.getGroupList();
  77. },
  78. methods: {
  79. /**
  80. * 提交查询条件
  81. */
  82. submit: function() {
  83. const param = {
  84. current: 1,
  85. size: this.page.size,
  86. groupId: this.query.groupId,
  87. openNum: this.query.openNum,
  88. };
  89. this.getDevicesList(param);
  90. },
  91. /**
  92. * 分页点击事件
  93. */
  94. pagination: function(current) {
  95. const param = {
  96. current: current,
  97. size: this.page.size,
  98. groupId: this.query.groupId,
  99. openNum: this.query.openNum,
  100. };
  101. this.getDevicesList(param);
  102. },
  103. /**
  104. * 查看详情
  105. */
  106. detailHandler: function(openNum) {
  107. this.detailDialog = true;
  108. this.getDeviceDetail(openNum);
  109. },
  110. /**
  111. * 获取设备列表
  112. */
  113. getDevicesList: function(params) {
  114. this.$http.Get(this.$global.ubi.listPage, params).then(res => {
  115. this.page = res.data;
  116. })
  117. },
  118. /**
  119. * 获取设备详情
  120. */
  121. getDeviceDetail: function(openNum) {
  122. const params = {
  123. openNum: openNum
  124. };
  125. this.$http.Get(this.$global.ubi.detail, params).then(res => {
  126. console.log(res.data);
  127. this.detail = res.data;
  128. })
  129. },
  130. /**
  131. * 获取设备组
  132. */
  133. getGroupList() {
  134. this.$http.Get(this.$global.group.listAll, {}).then(res => {
  135. const arr = [];
  136. this.groups = res.data.forEach(item => {
  137. if (item.type == 'gnss') {
  138. arr.push(item.code)
  139. }
  140. });
  141. this.groups = arr;
  142. })
  143. }
  144. }
  145. };
  146. </script>