connectivity.vue 5.7 KB

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