|
|
@@ -1,40 +1,48 @@
|
|
|
<template>
|
|
|
<div class="app-container">
|
|
|
<div class="filter-container">
|
|
|
- <el-form
|
|
|
- ref="filter-form"
|
|
|
- :model="filter"
|
|
|
- v-bind:inline="true"
|
|
|
- label-position="left"
|
|
|
- label-width="70px"
|
|
|
- style="width: 100%;">
|
|
|
- <div class="filter-view">
|
|
|
- <div class="flex1" style="min-width: 200px; max-width: 350px;">
|
|
|
- <el-input
|
|
|
- v-model="filter.criteria"
|
|
|
- placeholder="Search by Site Name or Address"
|
|
|
- @keyup.enter.native="handleFilter" />
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- <el-button
|
|
|
- v-waves
|
|
|
- type="primary"
|
|
|
- icon="el-icon-search"
|
|
|
- @click="handleFilter">
|
|
|
- Search
|
|
|
- </el-button>
|
|
|
- </div>
|
|
|
- <div class="filter-flex-button">
|
|
|
- <el-button
|
|
|
- v-if="visible.addButton"
|
|
|
- type="primary"
|
|
|
- icon="el-icon-plus"
|
|
|
- @click="handleClickAddSiteButton">
|
|
|
- Add Site
|
|
|
- </el-button>
|
|
|
- </div>
|
|
|
+ <div class="filter-view">
|
|
|
+ <el-select
|
|
|
+ class="filter-view-item"
|
|
|
+ v-model="filter.pageVo.providerPk"
|
|
|
+ placeholder="Service Provider"
|
|
|
+ @change="handleFilter"
|
|
|
+ clearable>
|
|
|
+ <el-option
|
|
|
+ v-for="(item, index) in providerOptions"
|
|
|
+ :key="index"
|
|
|
+ :label="item.providerName"
|
|
|
+ :value="item.providerPk"/>
|
|
|
+ </el-select>
|
|
|
+ <div class="flex1" style="max-width: 350px;">
|
|
|
+ <el-input
|
|
|
+ class="filter-view-item"
|
|
|
+ v-model="filter.pageVo.criteria"
|
|
|
+ prefix-icon="el-icon-search"
|
|
|
+ placeholder="Search by Site Name, Address, Carpark Code"
|
|
|
+ @keyup.enter.native="handleFilter"
|
|
|
+ @change="handleFilter"
|
|
|
+ clearable/>
|
|
|
</div>
|
|
|
- </el-form>
|
|
|
+ <div>
|
|
|
+ <el-button
|
|
|
+ v-waves
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-search"
|
|
|
+ @click="handleFilter">
|
|
|
+ Search
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
+ <div class="filter-flex-button">
|
|
|
+ <el-button
|
|
|
+ v-if="visible.addButton"
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-plus"
|
|
|
+ @click="handleClickAddSiteButton">
|
|
|
+ Add Site
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<el-table
|
|
|
:key="tableKey"
|
|
|
@@ -59,6 +67,11 @@
|
|
|
<span>{{ row.siteName }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="Carpark Code"
|
|
|
+ prop="carParkCode"
|
|
|
+ align="center"
|
|
|
+ min-width="125"/>
|
|
|
<el-table-column
|
|
|
label="Address"
|
|
|
prop="siteAddress"
|
|
|
@@ -107,14 +120,6 @@
|
|
|
<span>{{ row.stationInUse || "0" }}/{{ row.stationNo || "0" }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <!--el-table-column
|
|
|
- label="Stations in Use"
|
|
|
- prop="stationNo"
|
|
|
- align="center">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <span>{{ row.stationInUse || "0" }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column-->
|
|
|
<el-table-column
|
|
|
label="Total Connectors"
|
|
|
prop="connectorNo"
|
|
|
@@ -142,7 +147,7 @@
|
|
|
v-if="visible.actions"
|
|
|
label="Action"
|
|
|
align="center"
|
|
|
- min-width="140">
|
|
|
+ min-width="120">
|
|
|
<template slot-scope="{row, $index}">
|
|
|
<TableAction
|
|
|
:showDel="visible.actionDelete"
|
|
|
@@ -155,9 +160,9 @@
|
|
|
<pagination
|
|
|
v-show="total > 0"
|
|
|
:total="total"
|
|
|
- :page.sync="listQuery.page"
|
|
|
- :limit.sync="listQuery.limit"
|
|
|
- @pagination="handlePageChange" />
|
|
|
+ :page.sync="filter.pageNo"
|
|
|
+ :limit.sync="filter.pageSize"
|
|
|
+ @pagination="getList" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -169,15 +174,10 @@ import waves from '@/directive/waves'
|
|
|
// secondary package based on el-pagination
|
|
|
import Pagination from '@/components/Pagination'
|
|
|
import TableAction from '@/components/TableAction.vue'
|
|
|
-
|
|
|
import site from '../../http/api/site'
|
|
|
+import provider from '../../http/api/provider'
|
|
|
import { getRoleName } from '@/utils/auth'
|
|
|
|
|
|
-const {
|
|
|
- deleteSite,
|
|
|
- getSiteList
|
|
|
-} = site;
|
|
|
-
|
|
|
export default {
|
|
|
name: 'SiteManagement',
|
|
|
components: { Pagination, TableAction },
|
|
|
@@ -189,12 +189,14 @@ export default {
|
|
|
total: 0,
|
|
|
listLoading: true,
|
|
|
filter: {
|
|
|
- criteria: '',
|
|
|
- },
|
|
|
- listQuery: {
|
|
|
- page: 1,
|
|
|
- limit: 10,
|
|
|
+ pageNo: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ pageVo: {
|
|
|
+ criteria: '',
|
|
|
+ providerPk: ''
|
|
|
+ }
|
|
|
},
|
|
|
+ providerOptions: [],
|
|
|
visible: {
|
|
|
actions: true,
|
|
|
actionDelete: true,
|
|
|
@@ -203,8 +205,9 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
- this.getList()
|
|
|
- this.setVisible()
|
|
|
+ this.getAllProvider();
|
|
|
+ this.getList();
|
|
|
+ this.setVisible();
|
|
|
},
|
|
|
methods: {
|
|
|
setVisible() {
|
|
|
@@ -217,15 +220,16 @@ export default {
|
|
|
this.visible.addButton = false
|
|
|
}
|
|
|
},
|
|
|
+ getAllProvider() {
|
|
|
+ provider.getAllServiceProvider().then(res => {
|
|
|
+ if (res.data && res.data.length > 0) {
|
|
|
+ this.providerOptions = res.data
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
getList() {
|
|
|
this.listLoading = true
|
|
|
- getSiteList({
|
|
|
- pageSize: this.listQuery.limit,
|
|
|
- pageNo: this.listQuery.page,
|
|
|
- pageVo: {
|
|
|
- criteria: this.filter.criteria,
|
|
|
- }
|
|
|
- }).then((response) => {
|
|
|
+ site.getSiteList(this.filter).then((response) => {
|
|
|
this.list = response.data
|
|
|
this.total = response.total
|
|
|
}).catch(err => {
|
|
|
@@ -237,14 +241,8 @@ export default {
|
|
|
this.listLoading = false
|
|
|
})
|
|
|
},
|
|
|
- handlePageChange(value) {
|
|
|
- const {limit, page} = value;
|
|
|
- this.listQuery.limit = limit;
|
|
|
- this.listQuery.page = page;
|
|
|
- this.getList();
|
|
|
- },
|
|
|
handleFilter() {
|
|
|
- this.listQuery.page = 1
|
|
|
+ this.filter.pageNo = 1
|
|
|
this.getList()
|
|
|
},
|
|
|
handleClickAddSiteButton() {
|
|
|
@@ -259,14 +257,12 @@ export default {
|
|
|
handleDeleteSite(row, index) {
|
|
|
this.$confirm(
|
|
|
'Are you sure you want to delete this site ?',
|
|
|
- 'Delete',
|
|
|
- {
|
|
|
- confirmButtonText: 'OK',
|
|
|
- cancelButtonText: 'Cancel',
|
|
|
- type: 'warning'
|
|
|
- },
|
|
|
- ).then(res => {
|
|
|
- deleteSite({ sitePk: row.sitePk }).then(() => {
|
|
|
+ 'Delete', {
|
|
|
+ confirmButtonText: 'OK',
|
|
|
+ cancelButtonText: 'Cancel',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(res => {
|
|
|
+ site.deleteSite({ sitePk: row.sitePk }).then(() => {
|
|
|
this.$message({
|
|
|
message: `delete site success ${row.siteName}`,
|
|
|
type: "success",
|