| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- <template>
- <div class="app-container">
- <div class="filter-container right">
- <div class="filter-view">
- <div style="flex: 1; min-width: 180px; max-width: 350px;">
- <el-input
- v-model="params.pageVo.criteria"
- placeholder="Search by Name, Email, Contact or Login ID"
- @keyup.enter.native="getList" />
- </div>
- <div>
- <el-button
- type="primary"
- icon="el-icon-search"
- @click="getList">
- Search
- </el-button>
- </div>
- <div class="filter-flex-button">
- <el-button
- type="primary"
- icon="el-icon-plus"
- @click="addRfid">
- Add
- </el-button>
- </div>
- </div>
- </div>
- <el-table
- v-loading="table.loading"
- :data="table.data"
- fit
- style="width: 100%;">
- <!--el-table-column
- label="RFID No."
- align="center"
- class-name="fixed-width">
- <template slot-scope="{row}">
- <a class="link-detail" href="javascript:void(0);" @click="viewDevice(row)">{{ row.rfidNumber }}</a>
- </template>
- </el-table-column-->
- <el-table-column
- label="RFID No."
- align="center"
- prop="rfidNumber">
- </el-table-column>
- <el-table-column
- label="Email Address"
- align="center"
- prop="email"
- class-name="fixed-width">
- </el-table-column>
- <el-table-column
- label="User ID"
- align="center"
- prop="userPk">
- </el-table-column>
- <el-table-column
- label="User Type"
- align="center"
- prop="userType">
- </el-table-column>
- <el-table-column
- label="Group"
- align="center"
- prop="groupName">
- </el-table-column>
- <el-table-column
- label="Status"
- align="center"
- prop="status"
- width="100px">
- </el-table-column>
- <el-table-column
- label="Action"
- align="center"
- class-name="fixed-width">
- <template slot-scope="{row}">
- <TableAction
- @edit="viewDevice(row)"
- @delete="handleDelete(row)"/>
- </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="handlePageChange" />
- </div>
- </div>
- </template>
- <script>
- import Pagination from '@/components/Pagination'
- import TableAction from '@/components/TableAction.vue'
- import api from '../../http/api/rfid.js'
- export default {
- data() {
- return {
- table: {
- data: [],
- total: 0,
- loading: false
- },
- params: {
- pageNo: 1,
- pageSize: 10,
- pageVo: {
- criteria: ""
- }
- }
- }
- },
- components: { Pagination, TableAction },
- created() {
- this.getList();
- },
- methods: {
- getList() {
- this.table.loading = true;
- api.getRfidPages(this.params).then(res => {
- this.table.loading = false;
- this.table.total = res.total;
- this.table.data = res.data
- }).catch(err => {
- this.table.loading = false;
- this.$message.error(err)
- });
- },
- addRfid() {
- this.$router.push({
- path: '/rfid-card-management/add'
- });
- },
- viewDevice({ocppTagPk}) {
- this.$router.push({
- path: '/rfid-card-management/edit/' + ocppTagPk
- });
- },
- handleDelete(row) {
- this.$confirm('Are you sure you want to delete this rfid?', 'Delete', {
- confirmButtonText: 'OK',
- cancelButtonText: 'Cancel',
- type: 'warning'
- }).then(res => {
- this.deleteRfid(row.ocppTagPk)
- })
- },
- deleteRfid(id) {
- this.table.loading = true;
- api.deleteRfidCard({ocppTagPk: id}).then(res => {
- this.$message({
- message: 'Delete successfully!',
- type: 'success'
- });
- this.getList();
- }).catch(err => {
- this.$message({
- message: err,
- type: 'error'
- });
- this.table.loading = false;
- })
- },
- handlePageChange() {
- this.table.loading = true;
- this.getList();
- }
- }
- }
- </script>
- <style>
- .link-detail {
- text-decoration: underline;
- }
- </style>
|