天波用户运营管理后台系统
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

159 lines
4.5KB

  1. <!--
  2. * @Date: 2021-11-30 09:44:24
  3. * @LastEditors: JinxuChen
  4. * @LastEditTime: 2021-12-10 11:40:14
  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="请输入关键字"
  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 TopMenu from "@/components/TopMenu";
  54. import TTable from "../../../components/TTable/TTable";
  55. import Pagination from "@/components/Pagination";
  56. import APIAlarmQuery from "@/api/alarm-query";
  57. export default {
  58. name: "",
  59. components: { TTable, TopMenu, Pagination },
  60. data() {
  61. return {
  62. model: "",
  63. modelOptions: [
  64. {
  65. value: "1",
  66. label: "类别1"
  67. },
  68. {
  69. value: "2",
  70. label: "类别1"
  71. }
  72. ],
  73. searchValue: "",
  74. columns: [
  75. { prop: "alarmType", title: "告警类别", fixed: 'left' },
  76. { prop: "imei", title: "设备IMEI" },
  77. { prop: "alarmAddress", title: "告警地址/经纬度" },
  78. { prop: "createTime", title: "创建时间", fixed: 'right' }
  79. /* {
  80. action: true,
  81. title: "操作",
  82. actions: [
  83. { fnName: "delete", title: "删除", type: "error" },
  84. ]
  85. } */
  86. ],
  87. list: [
  88. {
  89. alarmType: "出走风险",
  90. imei: "141152552521",
  91. alarmAddress: "广东省佛山市南海区",
  92. createTime: "2021-11-30"
  93. }
  94. ],
  95. total: 0,
  96. page: 1,
  97. limit: 10
  98. };
  99. },
  100. watch: {
  101. searchValue(value) {
  102. if (value === "") {
  103. this.$refs['pages'].currentPage = 1;
  104. this.getList();
  105. }
  106. }
  107. },
  108. methods: {
  109. // 搜索
  110. onSearch() {
  111. this.$refs['pages'].currentPage = 1;
  112. this.getList();
  113. },
  114. // 修改
  115. onUpdate(row) {
  116. console.log("修改", row);
  117. },
  118. // 删除
  119. onDelete(row) {
  120. console.log("删除", row);
  121. },
  122. // 获取分页数据
  123. getList() {
  124. let reqBody = {
  125. pageNumber: this.page,
  126. begNumber: this.limit,
  127. imei: this.searchValue
  128. };
  129. APIAlarmQuery.getAlarmQuery(reqBody).then(res => {
  130. this.list = res.data.map(m => {
  131. return {
  132. imei: m.serialno,
  133. alarmType: m.typeId,
  134. content: m.address,
  135. createTime: m.createTime || "无",
  136. glat: m.glat,
  137. glng: m.glng,
  138. keyId: m.keyId
  139. };
  140. });
  141. this.total = res.count;
  142. });
  143. },
  144. // 点击清除按钮时
  145. onClear() {
  146. this.$refs["pages"].currentPage = 1;
  147. this.getList();
  148. }
  149. },
  150. mounted() {
  151. this.getList();
  152. }
  153. };
  154. </script>
  155. <style scoped>
  156. </style>