<template>
  <div>
    <div class="d-flex flex-between">
      <div></div>
      <el-form label-width="100px" :inline="true">
        <el-form-item prop="state_value">
          <el-select
            class="mr10"
            clearable
            v-model="state_value"
            placeholder="全部"
            @change="getListData"
          >
            <el-option
              v-for="item in state_list"
              :key="item.hysyd_id"
              :label="item.hysyd_hymc"
              :value="item.hysyd_id"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <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="applyTable" tooltip-effect="dark" style="width: 100%">
      <el-table-column type="selection" align="center" width="55">
      </el-table-column>
      <el-table-column label="序号" align="center" type="index" width="50">
      </el-table-column>
      <el-table-column
        label="会议纪要名称"
        show-overflow-tooltip
        prop="jy_mc"
      >
      </el-table-column>
      <el-table-column
        label="所属会议"
        show-overflow-tooltip
        prop="jy_hysyd_mc"
      ></el-table-column>
      <el-table-column
        label="创建人"
        prop="jy_cjr"
      ></el-table-column>
      <el-table-column
        label="创建时间"
        prop="jy_cjsj"
        width="auto"
      ></el-table-column>
      <el-table-column label="操作" width="180" align="right">
        <template slot-scope="scope">
          <el-button type="text" @click="detailData(scope.row)"
            >详情
          </el-button>
        </template>
      </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 { useUserStore } from "@/stores/user";

const { real_name, dept_ids } = useUserStore();
import FileUpload from "@/components/FileUpload/index.vue";
import { hyjy_list,hysyd_list } from "./api";
export default {
  name: "index",
  components: {
    FileUpload,
  },
  data() {
    return {
      state_value: "",
      state_list: [
       
      ],
      keyword: "",
      title: "",
      applyTable: [],
      limit: 10,
      total: 0,
      cur_page: 1,
      
    };
  },
  methods: {
    gethyjyList() {
      let data = {
        site: "jnmf",
        page: 1,
        limit: 999,
        jy_lx: "1",
      };
      hyjy_list(data).then((res) => {
        this.applyTable = res.data.page_data;
      });
    },
    getListData() {
      let data = {
        site: "jnmf",
        page: this.cur_page,
        limit: this.limit,
        jy_mc: this.keyword,
        jy_lx: "1",
        jy_hysyd_id: this.state_value
      };
      hyjy_list(data).then((res) => {
        this.applyTable = 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();
    },
    getHy() {
      let data = {
        site: "jnmf",
      };
      hysyd_list(data).then((res) => {
        if (res.code == "1") {
          this.state_list = res.data.page_data;
        }
      });
    },
    detailData(row) {
      this.$router.push({
        name: "hyjyk_detail",
        params: {
          jy_id: row.jy_id,
        },
      });
    },
  },
  mounted() {
    this.getHy();
    this.gethyjyList();
  },
};
</script>