| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- <template>
- <div class="app-container">
- <div class="filter-container filter-view">
- <el-select
- class="filter-view-item"
- v-model="filter.pageVo.loadBalancing"
- placeholder="Load Balancing Type"
- @change="onSearch"
- clearable>
- <el-option
- v-for="(item, index) in typeOptions"
- :key="index"
- :label="item.name"
- :value="item.value"/>
- </el-select>
- <div class="flex1" style="min-width: 200px; max-width: 350px;">
- <el-input
- v-model="filter.pageVo.criteria"
- class="filter-view-item"
- prefix-icon="el-icon-search"
- placeholder="Search by Carpark Code, Site Name"
- @keyup.enter.native="onSearch"
- @change="onSearch"
- clearable/>
- </div>
- <div>
- <el-button
- type="primary"
- icon="el-icon-search"
- @click="onSearch">
- Search
- </el-button>
- </div>
- </div>
- <el-table
- :data="table.data"
- class="no-border"
- v-loading="loading">
- <el-table-column
- label="Site Name"
- prop="sitePk"
- align="center"
- min-width="150">
- <template slot-scope="{row}">
- <span class="link-type" @click="onEditClick(row)">{{ row.siteName }}</span>
- </template>
- </el-table-column>
- <el-table-column
- label="Address"
- prop="address"
- align="center"
- min-width="180"/>
- <el-table-column
- label="Service Provider"
- align="center"
- min-width="150">
- <template slot-scope="{row}">
- <div
- v-for="(item, index) in row.serviceProviders"
- :key="index">
- {{item.providerName}}
- </div>
- </template>
- </el-table-column>
- <el-table-column
- label="Load Balancing Type"
- prop="loadBalancingType"
- align="center"
- min-width="150"/>
- <el-table-column
- v-if="!$route.meta.onlyView"
- label="Action"
- align="center"
- min-width="70">
- <template slot-scope="{row}">
- <el-dropdown
- class="action-dropdown"
- @command="(v) => handleCommand(v, row)">
- <i class="el-icon-more icon-action"></i>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item
- command="onEditClick">
- Edit Info
- </el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- </template>
- </el-table-column>
- </el-table>
- <div class="right">
- <pagination
- v-show="table.total > 0"
- :total="table.total"
- :page.sync="filter.pageNo"
- :limit.sync="filter.pageSize"
- @pagination="getTableData" />
- </div>
- </div>
- </template>
- <script>
- import api from '@/http/api/apiBalancing.js';
- import Pagination from '@/components/Pagination'
- import TableAction from '@/components/TableAction.vue'
- export default {
- data() {
- return {
- loading: false,
- filter: {
- pageNo: 1,
- pageSize: 10,
- pageVo: {
- criteria: "",
- loadBalancing: ""
- }
- },
- table: {
- data: [],
- total: 0
- },
- typeOptions: []
- };
- },
- components: {Pagination, TableAction},
- created() {
- this.getTypeOptions();
- this.onSearch();
- },
- methods: {
- onSearch() {
- this.filter.pageNo = 1;
- this.getTableData();
- },
- getTypeOptions() {
- api.getBalancingTypes().then(res => {
- if (res.data) {
- this.typeOptions = res.data
- }
- }).catch(err => {
- this.$message({
- message: err,
- type: 'error'
- })
- });
- },
- getTableData() {
- this.loading = true;
- api.getBalancingPages(this.filter).then(res => {
- if (res.data && res.total) {
- this.table.data = res.data
- this.table.total = res.total
- } else {
- this.table.data = []
- this.table.total = 0
- }
- }).catch(err => {
- this.$message({
- message: err,
- type: 'error'
- })
- this.table.data = []
- this.table.total = 0
- }).finally(() => {
- this.loading = false;
- })
- },
- handleCommand(cb, item) {
- this[cb](item)
- },
- onEditClick(row) {
- this.$router.push({
- path: '/smart-energy-management/site-load-balancing/' + row.sitePk
- })
- }
- }
- }
- </script>
- <style scoped>
- </style>
|