change.vue 3.95 KB
<template>
  <d2-container>
    <el-card shadow="never">
      <el-form :inline="true" :model="formInline" class="demo-form-inline" size="small">

        <el-form-item label="更换类型">
          <el-select v-model="formInline.flagType" placeholder="请选择">
            <el-option value="" label="全部">全部</el-option>
            <el-option value="CA" label="更换流量卡">更换流量卡</el-option>
            <el-option value="US" label="更换用户">更换用户</el-option>
            <el-option value="AC" label="激活用户">激活用户</el-option>
            <el-option value="PA" label="商品套餐">商品套餐</el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="IMEI">
          <el-input v-model="formInline.sn" placeholder="请输入IMEI" />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-search" :loading="tableLoading" @click="getList()">搜索</el-button>
        </el-form-item>
      </el-form>
    </el-card>

    <!-- 表格区域 开始 -->
    <div class="table_box">
        <el-table v-loading="tableLoading" :data="tableData" stripe style="width: 100%" size="small" border>
          <el-table-column type="index" :index="index => {return index+1}" label="序号" width="80" />
          <el-table-column prop="sn" label="IMEI" />
          <el-table-column prop="flagType" label="更换类型">
            <template slot-scope="scope">{{ FLAGTYPE[scope.row.flagType]}}</template>
          </el-table-column>
          <el-table-column prop="preFlagName" label="更换前" />
          <el-table-column prop="flagName" label="更换后" />
          <el-table-column prop="updatedDate" label="更换时间">
            <template slot-scope="scope">{{ DATEFORMATE(scope.row.updatedDate, 'YYYY-MM-DD HH:mm:ss') }}</template>
          </el-table-column>
        </el-table>
        <div class="pagination_list">
          <el-pagination
            background
            layout="sizes, total,prev, pager, next, jumper"
            :total="pageTotal"
            :page-size="pageSize"
            :page-sizes="pageSizes"
            @current-change="getList"
            @size-change="changePageSize"
          />
        </div>
    </div>
    <!-- 表格区域 end -->

  </d2-container>
</template>

<script>
import {
  GETLISTDEVICEUPDATERECORD
} from '@/http/interface'
export default {
  data() {
    return {
      formInline: {},
      tableData: [],
      dialogVisible: false,
      tableLoading: false,
      pageTotal: 0,
      userInfo: {},
      currentPage: 1,
      pageSizes: [10, 20, 30, 40],
      pageSize: 10,
      registerDate: [],
      tdWidth: 170,
      DATEFORMATE: (str, type) => { return this.$Util.dateFormate(str, type) },
      deviceTypeList: [],
      FLAGTYPE: {
        'CA': '更换流量卡',
        'US': '更换用户',
        'AC': '激活用户',
        'PA': '商品套餐',
        'FA': '版本'
      }
    }
  },
  created() {

  },

  mounted: function() {
    this.getList()
  },
  methods: {

    /**
       * 查询列表
       */
    getList: function(current) {
      const _this = this
      const oParams = _this.getParams()
      console.log(current)
      oParams.pageNum = current || _this.currentPage
      _this.tableLoading = true
      GETLISTDEVICEUPDATERECORD(oParams).then(res => {
        console.log(res)
        _this.tableLoading = false
        if (res.returnCode == 0) {
          const { data } = res
          const { total, list } = data
          _this.tableData = list || []
          _this.pageTotal = total
        }
      })
    },

    /**
       * 获取查询参数
       */
    getParams: function() {
      const oParams = this.formInline
      oParams.pageSize = this.pageSize
      return oParams
    },


    /**
     * 每页展示
     */
    changePageSize: function(e) {
      this.pageSize = e
      this.getList()
    }



  }

}
</script>

<style lang="scss">
  .table_box {
    margin: 20px 0;
  }
</style>