index.vue 6.48 KB
<template>
    <div class="clerk-wrapper queueManagementContainer">
        <div class="header manage-head-wrapper">
            <el-form ref="form" label-width="100px" inline class="searchForm boxShadow searchFormSocial">
                <el-form-item :label="$t('table.mall')">
                    <el-select v-model="searchForm.mallId" filterable :placeholder="$t('pholder.select')" @change="mallChange">
                      <el-option v-for="item in mallListForTerm" :key="item.id" :label="item.name" :value="item.id" />
                    </el-select>
                </el-form-item>
                <el-form-item :label="$t('table.areaName')">
                   <el-input v-model="searchForm.name" class="search-inp" :placeholder="$t('pholder.input')" clearable></el-input>
                </el-form-item>
                <el-form-item>
                   <el-button type="primary" class="search-btn" size="mini" plain @click="searchFun">{{$t('button.search')}}</el-button>
                </el-form-item>
            </el-form>
        </div>
        <div class="manage-content">
            <div class="asis-table-content boxShadow" v-loading="loading">
              <el-table
                :data="tableData"
                :max-height="tableHeight"
                style="width: 100%;"
                ref="row_table"
                v-loading="loading"
                class="clerk-manage-table"
                header-row-class-name="manage-tab-head"
              >
                <el-table-column :label="$t('table.order')" align="center" type="index" width="100"></el-table-column>
                <el-table-column :label="$t('table.areaName')" align="center" prop="name"></el-table-column>
                <el-table-column :label="$t('table.areaNumber')" align="center" prop="code"></el-table-column>
                <el-table-column :label="$t('table.areaType')" align="center" prop="type">
                    <template slot-scope="scope">
                        <span>{{scope.row.type==1?$t('pholder.selfService'):$t('pholder.manualCashier')}}</span>
                    </template>
                </el-table-column>
                <el-table-column :label="$t('table.boundDevices')" align="center" prop="count"></el-table-column>
                <el-table-column :label="$t('table.operate')" align="center" width="150">
                  <template slot-scope="scope">
                    <el-button type="text" class="tab-btn" @click="bindRow(scope.row)">{{$t('button.positionCalibration')}}</el-button>
                  </template>
                </el-table-column>
              </el-table>
              <el-pagination
                class="manage-pagination-box"
                background
                :current-page="currentPage"
                :page-sizes="[10, 20, 50, 100]"
                :page-size="pageSize"
                @size-change="sizeChange"
                @current-change="cerrentChange"
                layout="sizes, prev, pager, next, slot"
                :total="total"
              >
                <span
                  class="slot-ele-total"
                >{{$t('table.pageHead')}} {{ total }} {{$t('table.pageTail')}}</span>
              </el-pagination>
            </div>
        </div>
        <bind-dev-dialog ref="bindDevModel"></bind-dev-dialog>
    </div>
</template>

<script>
    import bindDevDialog from "./bindDev";
    export default {
        data() {
            return {
              mallListForTerm:[],
              tableData: [],
              total: 0,
              pageSize: 10,
              currentPage: 1,
              pagesizeArr: [10, 20, 50, 100],
              loading: false,
              searchForm:{
                  mallId:'',
                  name:''
              },
              tableData:[]
            }
        },
        components:{
            bindDevDialog
        },
        mounted() {
            this.getMallListForTerm()
        },
        computed: {
            tableHeight() {
                const windowInnerHeight = window.innerHeight;
                return windowInnerHeight - windowInnerHeight * 0.24;
            },
        },
        methods: {
            getMallListForTerm() {
                this.mallListForTerm = [];
                this.searchForm.mallId = "";
                this.$api.base.mall({
                    accountId: this.$cookie.get('accountId'),
                    status_arr: "1,3"
                }).then(data => {
                    let result = data.data;
                    if (result.data.length) {
                        if (this.getSessionLocal("mallId")) {
                          this.searchForm.mallId = Number(this.getSessionLocal("mallId"));
                        } else {
                        this.searchForm.mallId = result.data[0].id;
                        this.setSessionLocal("mallId", this.searchForm.mallId);
                        }
                        this.mallListForTerm = result.data;
                    }
                    this.getTableData();
                })
            },
            mallChange(val) {
                this.setSessionLocal("mallId", val);
                this.getTableData();
            },
            bindRow(row){
                this.$refs.bindDevModel.dialogInit(row);
            },
            searchFun(){
                this.currentPage = 1;
                this.getTableData()
            },
            getTableData() {
                this.loading = true;
                this.tableData = [];
                this.$api.queueManagementApi.getAreaList({
                    name: this.searchForm.name,
                    mallId: this.searchForm.mallId,
                    pageNum: this.currentPage,
                    pageSize: this.pageSize
                }).then(res => {
                    let result = res.data;
                    if(result.code==200){
                       this.tableData = result.data.list;
                       this.total = result.data.total;
                    }
                    this.loading = false;
                })
            },
            sizeChange(val) {
              this.pageSize = val;
              this.getTableData();
            },
            cerrentChange(val) {
              if (this.currentPage != val) {
                this.currentPage = val;
                this.getTableData();
              }
            },
        }
    }
</script>

<style scoped="scoped" lang="less">
    .face-img {
      width: 50px;
      height: 50px;
      cursor: zoom-in;
    }

    .zoomout-img {
      width: auto;
      height: 300px;
    }
</style>