connectivity.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <template>
  2. <div class="app-container">
  3. <div class="filter-container">
  4. <div class="radio-group" v-if="false">
  5. <el-radio-group
  6. v-model="params.pageVo.notification"
  7. @change="changeTab">
  8. <el-radio-button
  9. v-for="(item,index) in typeTabs"
  10. :key="index"
  11. :label="item.value">
  12. {{item.name}}
  13. </el-radio-button>
  14. </el-radio-group>
  15. </div>
  16. <div class="filter-view">
  17. <el-select
  18. class="filter-view-item"
  19. v-model="params.pageVo.notification"
  20. placeholder="Notification"
  21. @change="toSearch"
  22. clearable>
  23. <el-option
  24. v-for="(item,index) in typeTabs"
  25. :key="index"
  26. :label="item.name"
  27. :value="item.value" />
  28. </el-select>
  29. <div class="flex1" style="max-width: 400px;">
  30. <el-input
  31. v-model="params.pageVo.criteria"
  32. prefix-icon="el-icon-search"
  33. placeholder="Search by Station Id, Carpark Code, Site Name"
  34. @keyup.enter.native="toSearch"
  35. @change="toSearch"
  36. clearable/>
  37. </div>
  38. </div>
  39. </div>
  40. <el-table
  41. v-loading="table.loading"
  42. :data="table.list"
  43. style="width: 100%;">
  44. <!--
  45. <el-table-column
  46. label="Site ID"
  47. align="center"
  48. min-width="80">
  49. <template slot-scope="{row}">
  50. <span>{{ row.sitePk }}</span>
  51. </template>
  52. </el-table-column>
  53. -->
  54. <el-table-column
  55. label="Site Name"
  56. align="center"
  57. prop="siteName"
  58. min-width="120"/>
  59. <el-table-column
  60. label="Station ID"
  61. align="center"
  62. prop="chargeBoxId"
  63. min-width="100"/>
  64. <el-table-column
  65. label="Carpark Code"
  66. prop="carParkCode"
  67. align="center"
  68. min-width="120"/>
  69. <el-table-column
  70. label="Timestamp"
  71. align="center"
  72. prop="timestamp"
  73. min-width="120"/>
  74. <el-table-column
  75. label="Latest Notification"
  76. align="center"
  77. prop="notification"
  78. min-width="180"/>
  79. <el-table-column
  80. label="Action"
  81. align="center"
  82. min-width="70">
  83. <template slot-scope="{row}">
  84. <el-dropdown
  85. class="action-dropdown"
  86. @command="(v) => handleCommand(v, row)">
  87. <i class="el-icon-more icon-action"></i>
  88. <el-dropdown-menu slot="dropdown">
  89. <el-dropdown-item
  90. command="viewDetail">
  91. View Info
  92. </el-dropdown-item>
  93. </el-dropdown-menu>
  94. </el-dropdown>
  95. </template>
  96. </el-table-column>
  97. </el-table>
  98. <div class="right">
  99. <pagination
  100. v-show="table.total > 0"
  101. :total="table.total"
  102. :page.sync="params.pageNo"
  103. :limit.sync="params.pageSize"
  104. @pagination="getTableData" />
  105. </div>
  106. </div>
  107. </template>
  108. <script>
  109. import Pagination from '@/components/Pagination'
  110. import api from '@/http/api/incident'
  111. import { Base64 } from 'js-base64';
  112. export default {
  113. data() {
  114. return {
  115. params: {
  116. pageNo: 1,
  117. pageSize: 10,
  118. pageVo: {
  119. criteria: "",
  120. notification: ""
  121. }
  122. },
  123. table: {
  124. loading: false,
  125. list: [],
  126. total: 0
  127. },
  128. typeTabs: [{
  129. name: "Loading...",
  130. value: "-"
  131. }]
  132. }
  133. },
  134. components: { Pagination },
  135. created() {
  136. this.getTabList();
  137. },
  138. methods: {
  139. toSearch() {
  140. this.params.pageNo = 1;
  141. this.getTableData();
  142. },
  143. getTabList() {
  144. this.table.loading = true;
  145. api.getConnectivityTabs().then(res => {
  146. if (res.data) {
  147. this.typeTabs = res.data;
  148. const type = window.sessionStorage.getItem("notification")
  149. if (type) this.params.pageVo.notification = type;
  150. this.getTableData();
  151. } else {
  152. this.table.loading = false;
  153. }
  154. }).catch(err => {
  155. this.$message({
  156. type: 'error',
  157. message: err
  158. })
  159. this.table.loading = false;
  160. })
  161. },
  162. getTableData() {
  163. this.table.loading = true;
  164. api.getConnectivityPages(this.params).then(res => {
  165. if (res.data) {
  166. this.table.list = res.data
  167. this.table.total = res.total
  168. } else {
  169. this.table.total = 0;
  170. this.table.list = [];
  171. }
  172. }).catch(err => {
  173. this.$message({
  174. type: 'error',
  175. message: err
  176. })
  177. this.table.total = 0;
  178. this.table.list = [];
  179. }).finally(() => {
  180. this.table.loading = false
  181. })
  182. },
  183. changeTab() {
  184. window.sessionStorage.setItem("notification", this.params.pageVo.notification)
  185. this.getTableData();
  186. },
  187. handleCommand(func, item) {
  188. this[func](item)
  189. },
  190. viewDetail(row) {
  191. const params = {
  192. sitePk: row.sitePk,
  193. //siteName: row.siteName,
  194. chargeBoxId: row.chargeBoxId
  195. }
  196. this.$router.push({
  197. path: "/incident-management/charger-connectivity/info/" + Base64.encode(JSON.stringify(params))
  198. })
  199. }
  200. }
  201. }
  202. </script>
  203. <style lang="scss" scoped>
  204. @import '../../styles/element-ui.scss';
  205. .radio-group {
  206. padding-top: 5px;
  207. user-select: none;
  208. }
  209. .radio-group ::v-deep .el-radio-button {
  210. padding: 5px;
  211. box-shadow: none !important;
  212. .el-radio-button__inner {
  213. border-radius: 4px;
  214. border: 1px solid $--color-primary;
  215. }
  216. }
  217. </style>