IdleFee.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <template>
  2. <div class="app-container">
  3. <div class="filter-container filter-view">
  4. <el-select
  5. class="filter-view-item"
  6. v-model="filter.pageVo.userType"
  7. placeholder="User Type"
  8. @change="toSearch"
  9. clearable>
  10. <el-option
  11. v-for="item in userTypeOptions"
  12. :key="item"
  13. :label="item"
  14. :value="item" />
  15. </el-select>
  16. <div style="flex: 1; max-width: 420px;">
  17. <el-input
  18. clearable
  19. prefix-icon="el-icon-search"
  20. v-model="filter.pageVo.criteria"
  21. placeholder="Station ID, Vehicle, Transaction ID, Email, Carpark Code"
  22. @keyup.enter.native="toSearch"
  23. @change="toSearch"/>
  24. </div>
  25. <!-- <el-form-item>
  26. <el-date-picker
  27. v-model="filter.pageVo.date"
  28. type="month"
  29. format="yyyy-MM"
  30. value-format="yyyy-MM"
  31. placeholder="Filter Date"/>
  32. </el-form-item>
  33. <el-form-item>
  34. <el-select
  35. filterable
  36. remote
  37. clearable
  38. v-model="filter.pageVo.sitePk"
  39. :remote-method="(s) => getSiteOptions(s)"
  40. placeholder="Filter by site"
  41. @change="getStationOptions">
  42. <el-option
  43. v-for="(item, index) in siteOptions"
  44. :key="index"
  45. :label="item.siteName"
  46. :value="item.sitePk"/>
  47. </el-select>
  48. </el-form-item>
  49. <el-form-item>
  50. <el-select
  51. clearable
  52. v-model="filter.pageVo.chargeBoxId"
  53. placeholder="Filter by Station ID"
  54. v-loading="listLoading">
  55. <el-option
  56. v-for="(item, index) in stationOptions"
  57. :key="index"
  58. :label="item.stationId"
  59. :value="item.stationId"/>
  60. </el-select>
  61. </el-form-item> -->
  62. <div>
  63. <el-button
  64. type="primary"
  65. icon="el-icon-search"
  66. @click="getTableData">
  67. Search
  68. </el-button>
  69. </div>
  70. </div>
  71. <el-table
  72. :data="table.list"
  73. v-loading="loading">
  74. <el-table-column
  75. label="User ID"
  76. align="center"
  77. prop="userPk"
  78. min-width="100"/>
  79. <el-table-column
  80. label="Site Name"
  81. align="center"
  82. prop="siteName"
  83. min-width="100"/>
  84. <el-table-column
  85. label="Station ID"
  86. align="center"
  87. prop="chargeBoxId"
  88. min-width="100"/>
  89. <el-table-column
  90. label="Carpark Code"
  91. prop="carParkCode"
  92. align="center"
  93. min-width="120"/>
  94. <el-table-column
  95. label="Start Date/Time"
  96. align="center"
  97. prop="startTime"
  98. min-width="130"/>
  99. <el-table-column
  100. label="End Date/Time"
  101. align="center"
  102. prop="endTime"
  103. min-width="130"/>
  104. <el-table-column
  105. label="Duration"
  106. align="center"
  107. prop="duration"
  108. min-width="100"/>
  109. <el-table-column
  110. label="Rate"
  111. align="center"
  112. prop="rate"
  113. min-width="200"/>
  114. <el-table-column
  115. label="Charges"
  116. align="center"
  117. prop="charges"
  118. min-width="100"/>
  119. </el-table>
  120. <div class="right">
  121. <Pagination
  122. v-show="table.total > 0"
  123. :total="table.total"
  124. :page.sync="filter.pageNo"
  125. :limit.sync="filter.pageSize"
  126. @pagination="getTableData" />
  127. </div>
  128. </div>
  129. </template>
  130. <script>
  131. import site from '@/http/api/site'
  132. import ocpp from '@/http/api/ocpp'
  133. import apiUser from '../../http/api/apiUser.js'
  134. import financial from '@/http/api/financial'
  135. import Pagination from '@/components/Pagination'
  136. export default {
  137. data() {
  138. return {
  139. loading: false,
  140. listLoading: false,
  141. siteOptions: [],
  142. stationOptions: [],
  143. userTypeOptions: [],
  144. table: {
  145. list: [],
  146. total: 0
  147. },
  148. filter: {
  149. pageNo: 1,
  150. pageSize: 10,
  151. pageVo: {
  152. date: "",
  153. sitePk: "",
  154. criteria: "",
  155. userType: "",
  156. chargeBoxId: ""
  157. }
  158. },
  159. }
  160. },
  161. components: { Pagination },
  162. created() {
  163. this.getUserTypeOption();
  164. //this.getSiteOptions()
  165. this.getTableData()
  166. },
  167. methods: {
  168. toSearch() {
  169. this.filter.pageNo = 1;
  170. this.getTableData();
  171. },
  172. getSiteOptions(search) {
  173. site.getAllSiteList({siteName: search ?? ""}).then(res => {
  174. if (res.data && res.data.length > 0) {
  175. this.siteOptions = res.data
  176. }
  177. });
  178. },
  179. getStationOptions() {
  180. this.listLoading = true;
  181. ocpp.getStationPages({
  182. pageNo: 1,
  183. pageSize: 20,
  184. pageVo: {
  185. date: "",
  186. sitePk: this.filter.pageVo.sitePk
  187. }
  188. }).then(res => {
  189. if (res.data) {
  190. this.stationOptions = res.data;
  191. }
  192. }).finally(() => {
  193. this.listLoading = false;
  194. })
  195. },
  196. getUserTypeOption() {
  197. apiUser.getUserTypeOptions().then(res => {
  198. if (res.data) {
  199. this.userTypeOptions = res.data
  200. }
  201. }).catch(error => {
  202. this.$message({
  203. message: error,
  204. type: 'error'
  205. })
  206. })
  207. },
  208. getTableData() {
  209. this.loading = true;
  210. financial.getIdleFeesPages(this.filter).then(res => {
  211. this.loading = false;
  212. if (res.data) {
  213. this.table.total = res.total
  214. this.table.list = res.data
  215. } else {
  216. this.table.total = 0;
  217. this.table.list = [];
  218. }
  219. }).catch(err => {
  220. this.loading = false;
  221. this.$message({
  222. message: err,
  223. type: 'error'
  224. })
  225. this.table.total = 0;
  226. this.table.list = [];
  227. })
  228. }
  229. }
  230. }
  231. </script>
  232. <style>
  233. </style>