| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219 |
- <template>
- <div class="app-container">
- <div class="filter-container">
- <div class="radio-group" v-if="false">
- <el-radio-group
- v-model="params.pageVo.notification"
- @change="changeTab">
- <el-radio-button
- v-for="(item,index) in typeTabs"
- :key="index"
- :label="item.value">
- {{item.name}}
- </el-radio-button>
- </el-radio-group>
- </div>
- <div class="filter-view">
- <el-select
- class="filter-view-item"
- v-model="params.pageVo.notification"
- placeholder="Notification"
- @change="toSearch"
- clearable>
- <el-option
- v-for="(item,index) in typeTabs"
- :key="index"
- :label="item.name"
- :value="item.value" />
- </el-select>
- <div class="flex1" style="max-width: 400px;">
- <el-input
- v-model="params.pageVo.criteria"
- prefix-icon="el-icon-search"
- placeholder="Search by Station Id, Carpark Code, Site Name"
- @keyup.enter.native="toSearch"
- @change="toSearch"
- clearable/>
- </div>
- </div>
- </div>
- <el-table
- v-loading="table.loading"
- :data="table.list"
- style="width: 100%;">
- <!--
- <el-table-column
- label="Site ID"
- align="center"
- min-width="80">
- <template slot-scope="{row}">
- <span>{{ row.sitePk }}</span>
- </template>
- </el-table-column>
- -->
- <el-table-column
- label="Site Name"
- align="center"
- prop="siteName"
- min-width="120"/>
- <el-table-column
- label="Station ID"
- align="center"
- prop="chargeBoxId"
- min-width="100"/>
- <el-table-column
- label="Carpark Code"
- prop="carParkCode"
- align="center"
- min-width="120"/>
- <el-table-column
- label="Timestamp"
- align="center"
- prop="timestamp"
- min-width="120"/>
- <el-table-column
- label="Latest Notification"
- align="center"
- prop="notification"
- min-width="180"/>
- <el-table-column
- 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="viewDetail">
- View 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="params.pageNo"
- :limit.sync="params.pageSize"
- @pagination="getTableData" />
- </div>
- </div>
- </template>
- <script>
- import Pagination from '@/components/Pagination'
- import api from '@/http/api/incident'
- import { Base64 } from 'js-base64';
- export default {
- data() {
- return {
- params: {
- pageNo: 1,
- pageSize: 10,
- pageVo: {
- criteria: "",
- notification: ""
- }
- },
- table: {
- loading: false,
- list: [],
- total: 0
- },
- typeTabs: [{
- name: "Loading...",
- value: "-"
- }]
- }
- },
- components: { Pagination },
- created() {
- this.getTabList();
- },
- methods: {
- toSearch() {
- this.params.pageNo = 1;
- this.getTableData();
- },
- getTabList() {
- this.table.loading = true;
- api.getConnectivityTabs().then(res => {
- if (res.data) {
- this.typeTabs = res.data;
- const type = window.sessionStorage.getItem("notification")
- if (type) this.params.pageVo.notification = type;
- this.getTableData();
- } else {
- this.table.loading = false;
- }
- }).catch(err => {
- this.$message({
- type: 'error',
- message: err
- })
- this.table.loading = false;
- })
- },
- getTableData() {
- this.table.loading = true;
- api.getConnectivityPages(this.params).then(res => {
- if (res.data) {
- this.table.list = res.data
- this.table.total = res.total
- } else {
- this.table.total = 0;
- this.table.list = [];
- }
- }).catch(err => {
- this.$message({
- type: 'error',
- message: err
- })
- this.table.total = 0;
- this.table.list = [];
- }).finally(() => {
- this.table.loading = false
- })
- },
- changeTab() {
- window.sessionStorage.setItem("notification", this.params.pageVo.notification)
- this.getTableData();
- },
- handleCommand(func, item) {
- this[func](item)
- },
- viewDetail(row) {
- const params = {
- sitePk: row.sitePk,
- //siteName: row.siteName,
- chargeBoxId: row.chargeBoxId
- }
- this.$router.push({
- path: "/incident-management/charger-connectivity/info/" + Base64.encode(JSON.stringify(params))
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- @import '../../styles/element-ui.scss';
- .radio-group {
- padding-top: 5px;
- user-select: none;
- }
- .radio-group ::v-deep .el-radio-button {
- padding: 5px;
- box-shadow: none !important;
- .el-radio-button__inner {
- border-radius: 4px;
- border: 1px solid $--color-primary;
- }
- }
- </style>
|