天波用户运营管理后台系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

171 lines
5.1KB

  1. <!--
  2. * @Date: 2021-11-30 09:44:24
  3. * @LastEditors: JinxuChen
  4. * @LastEditTime: 2021-12-23 09:53:54
  5. * @FilePath: \GpsCardAdmin\src\views\off-limits-manage\alarm-query\index.vue
  6. * @description:
  7. -->
  8. <template>
  9. <div class="app-container">
  10. <div class="filter-container">
  11. <!-- 搜索 -->
  12. <el-input
  13. v-model="searchValue"
  14. :placeholder="placeholder"
  15. style="width: 200px; margin-left: 10px;"
  16. class="filter-item"
  17. @keyup.enter.native="onSearch"
  18. clearable
  19. @clear="onClear"
  20. />
  21. <el-button
  22. class="filter-item"
  23. style="margin-left: 10px;"
  24. type="primary"
  25. icon="el-icon-search"
  26. @click="onSearch"
  27. >搜索</el-button>
  28. </div>
  29. <!-- 表格 -->
  30. <!-- <el-table
  31. :key="tableKey"
  32. v-loading="listLoading"
  33. :data="list"
  34. border
  35. fit
  36. highlight-current-row
  37. style="width: 100%;"
  38. @sort-change="sortChange"
  39. ></el-table>-->
  40. <TTable :tableData="list" :columns="columns" @update="onUpdate" @delete="onDelete"></TTable>
  41. <!-- 分页 -->
  42. <pagination
  43. v-show="total>0"
  44. :total="total"
  45. ref="pages"
  46. :page.sync="page"
  47. :limit.sync="limit"
  48. @pagination="getList"
  49. />
  50. </div>
  51. </template>
  52. <script>
  53. import TTable from "../../../components/TTable/TTable";
  54. import Pagination from "@/components/Pagination";
  55. import APIAlarmQuery from "@/api/alarm-query";
  56. export default {
  57. name: "",
  58. components: { TTable, Pagination },
  59. data() {
  60. return {
  61. model: "",
  62. modelOptions: [
  63. {
  64. value: "1",
  65. label: "类别1"
  66. },
  67. {
  68. value: "2",
  69. label: "类别1"
  70. }
  71. ],
  72. searchValue: "",
  73. columns: [
  74. /* { prop: "alarmType", title: "告警类别", fixed: 'left' }, */
  75. { prop: "imei", title: "设备IMEI", fixed: 'left' },
  76. { prop: "alarmAddress", title: "告警地址" },
  77. { prop: "baiduLngLat", title: "百度经纬度" },
  78. { prop: "gaodelngLat", title: "高德经纬度" },
  79. { prop: "remarks", title: "告警内容" },
  80. { prop: "createTime", title: "创建时间", fixed: 'right' }
  81. /* {
  82. action: true,
  83. title: "操作",
  84. actions: [
  85. { fnName: "delete", title: "删除", type: "error" },
  86. ]
  87. } */
  88. ],
  89. list: [
  90. {
  91. alarmType: "出走风险",
  92. imei: "141152552521",
  93. alarmAddress: "广东省佛山市南海区",
  94. createTime: "2021-11-30"
  95. }
  96. ],
  97. total: 0,
  98. page: 1,
  99. limit: 10,
  100. placeholder: '请输入内容'
  101. };
  102. },
  103. watch: {
  104. searchValue(value) {
  105. if (value === "") {
  106. this.$refs['pages'].currentPage = 1;
  107. this.getList();
  108. }
  109. }
  110. },
  111. methods: {
  112. // 搜索
  113. onSearch() {
  114. this.$refs['pages'].currentPage = 1;
  115. this.getList();
  116. },
  117. // 修改
  118. onUpdate(row) {
  119. console.log("修改", row);
  120. },
  121. // 删除
  122. onDelete(row) {
  123. console.log("删除", row);
  124. },
  125. // 获取分页数据
  126. getList() {
  127. let reqBody = {
  128. pageNumber: this.page,
  129. begNumber: this.limit,
  130. imei: this.checkIsNumber(this.searchValue) ? this.searchValue : this.searchValue,
  131. };
  132. APIAlarmQuery.getAlarmQuery(reqBody).then(res => {
  133. this.list = res.data.map(m => {
  134. return {
  135. imei: m.serialno,
  136. content: m.address,
  137. createTime: m.createTime || "无",
  138. alarmAddress: m.address,
  139. baiduLngLat: `${m.baiduLng}, ${m.baiduLat}`,
  140. gaodelngLat: `${m.glng}, ${m.glat}`,
  141. remarks: m.remarks,
  142. keyId: m.keyId,
  143. };
  144. });
  145. this.total = res.count;
  146. });
  147. },
  148. // 点击清除按钮时
  149. onClear() {
  150. this.$refs["pages"].currentPage = 1;
  151. this.getList();
  152. },
  153. // 判断是否是数字并且是15位
  154. checkIsNumber(value) {
  155. let reg = /^[0-9]+.?[0-9]*$/;
  156. if(value.length >= 15 && reg.test(value)) {
  157. return true
  158. }
  159. }
  160. },
  161. mounted() {
  162. this.getList();
  163. }
  164. };
  165. </script>
  166. <style scoped>
  167. </style>