<template>
  <div>
    <div class="d-flex flex-right">
      <el-form label-width="100px" :inline="true">
        <el-form-item prop="keyword">
          <el-input
              placeholder="请输入搜索关键字"
              v-model="keyword"
              clearable
              @clear="getListData"
          >
          </el-input>
        </el-form-item>
        <el-button type="primary" class="ml5" @click="getListData"
        >搜索</el-button
        >
      </el-form>
    </div>
    <el-table
        :data="tableData"
        tooltip-effect="dark"
        v-loading="loading"
        style="width: 100%"
    >
      <el-table-column label="序号" align="center" type="index" width="50">
      </el-table-column>
      <el-table-column
          label="消息内容"
          show-overflow-tooltip
          prop="content"
          width="auto"
      ></el-table-column>
      <el-table-column
          label="发送人"
          prop="fsr_user_realname"
          width="150"
      ></el-table-column>
      <el-table-column
          label="发送时间"
          width="200"
          prop="create_dateline_format"
      ></el-table-column>
      <el-table-column
          label="发送类型"
          width="150"
          prop="cate"
      ></el-table-column>
    </el-table>
    <footer
        class="flex-item-none"
        style="display: flex; justify-content: flex-end; margin-top: 30px"
    >
      <el-pagination
          background
          layout="total,prev, pager, next"
          :page-size="limit"
          :total="total"
          :current-page.sync="cur_page"
          @current-change="handleCurrentChange"
      ></el-pagination>
    </footer>
  </div>
</template>

<script>

import { mes_list } from "./api";
export default {
  name: "index",
  data() {
    return {
      //  type_value: "",
      // type_list: [],
      keyword: "",
      tableData: [],
      limit: 10,
      total: 0,
      cur_page: 1,
      dialogFormVisible: false,
      dialogForm: {
        xxmc: "",
        cjr: "",
        cjrq: "",
        xxnr: "",
        qtfj: "",
      },
      title: "",
      isEdit: false,
      id: "",
      loading: false,
      timestamp: Date.now(),
    };
  },

  methods: {
    getListData() {
      this.loading = true;
      let data = {
        page: this.cur_page,
        limit: this.limit,
        keyword: this.keyword,
      };

     mes_list(data).then((res) => {
        this.loading = false;
        this.tableData = res.data.page_data;
        this.cur_page = Number(res.data.page_now);
        this.total = Number(res.data.total_rows);
      });
    },
    handleCurrentChange(val) {
      this.cur_page = val;
      this.getListData();
    }
  },
  mounted() {
    this.getListData();
  },
};
</script>

<style scoped>
</style>