<template>
  <div class="common-page qyzz page-t1">
    
    <div class="head-container">
      <div class="panel-bottom page-row">
        <div class="ctin-box">
          <div class="content-within">
            <div class="content-fix">
        <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
          <el-form-item label="姓名" prop="name">
            <el-input
              v-model="queryParams.exact.name"
              placeholder="请输入姓名"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <!-- <el-form-item label="手机号" prop="phone">
            <el-input
              v-model="queryParams.phone"
              placeholder="请输入手机号"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item> -->
          <el-form-item label="发送时间">
            <el-date-picker
              v-model="dateRange"
              style="width: 240px"
              value-format="yyyy-MM-dd"
              type="daterange"
              range-separator="-"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
              @change="daterangeChange"
            ></el-date-picker>
          </el-form-item>
          
          <el-form-item>
            <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
          </el-form-item>
        </el-form>
        <el-table ref="table" v-loading="loading" :data="dataList" size="small" style="width: 100%;" border >
          <el-table-column label="姓名" align="center" prop="name" />
          <el-table-column label="电话" align="center" prop="phone" />
          <el-table-column label="时间" align="center" prop="time" />
          <el-table-column label="短信内容" align="center" prop="content" width="500"/>
          
        </el-table>
        <el-pagination
          layout="total, prev, pager, next"
          :current-page="queryParams.page"
          @current-change="changePage"
          @size-change="changeSize"
          :total="total"
          :page-size="10"
        >
        </el-pagination>
      </div>
    </div></div></div>
    </div>
    
  </div>
</template>

<script>
import { getPhoneMsgHis } from '@/api/alarmMsg'


export default {
  name: 'ToolQiniuConfig',
 
  data() {
    return {
      dateRange:[],
     // 遮罩层
     loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 表格数据
      dataList: [],
      // 弹出层标题
      title: "a",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        page:1,
        size: 10,
        phone:null,
        name:'',
        daterange:null,
        exact:{name:''}
      },
      // 表单参数
      form: {},
       
    }
  },
  created(){
    this.getList()
  },
  methods: {
   
    getList(){
      getPhoneMsgHis(this.queryParams).then(res => {
        this.dataList = res.body.list
        this.total = res.body.total;
      })
      this.loading = false;
    },
    changePage(page) {
      this.queryParams.page = page;
      this.getList();
    },
    changeSize(size){
      console.log(size)
      this.queryParams.size = size;
    },
    daterangeChange(val){
      console.log(val.join(','))
      this.queryParams.daterange=val.join(',');
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.page = 1;
      this.getList();
    },
    resetQuery() {
      this.dateRange = []
      this.queryParams={
        page:1,
        size: 10,
        phone:null,
        name:'',
        daterange:null,
        exact:{name:''}
      }
      this.handleQuery();
    },
  }
}
</script>

<style scoped>

</style>
