<template>
  <div id="list">
    <el-row :gutter="20" style="padding-bottom:1.2rem;">
      <el-col :span="6">
        <el-input v-model="searchInfo.studname" placeholder="请输入学生名称"></el-input>
      </el-col>
      <el-col :span="2">
        <el-button type="info" circle icon="el-icon-search icons" @click="handleCurrentChange"></el-button>
      </el-col>
    </el-row>
    <el-table size="small" :data="dataList" stripe border style="width: 100%">
      <el-table-column align="center" type="index" prop="num" label="序号" width="50"></el-table-column>
      <el-table-column align="center" prop="title" label="职位名称"></el-table-column>
      <el-table-column align="center" prop="studname" label="姓名"></el-table-column>
      <el-table-column align="center" prop="skill" label="专业技能"></el-table-column>
      <el-table-column align="center" width="130" prop="data" label="操作">
        <template v-slot="scoped">
          <el-row>
            <el-col :span="12">
              <!-- 链接到查看简历公共模块 -->
              <el-button size="mini" type="text" @click="checkResume(scoped.row.resume_id, scoped.row.id)">查看简历</el-button>
            </el-col>
            <el-col :span="12" v-if="type !== '1'">
              <el-button size="mini" type="text" @click="update('1', scoped.row.id)">纳入考虑</el-button>
            </el-col>
            <el-col :span="12" v-if="type !== '2'">
              <el-button size="mini" type="text" @click="update('2', scoped.row.id)">暂不考虑</el-button>
            </el-col>
          </el-row>
        </template>
      </el-table-column>
    </el-table>
    <el-row class="row_pagination">
      <el-col :span="24">
        <el-pagination
          @current-change="handleCurrentChange"
          :current-page="currentPage"
          :page-size="$limit"
          layout="total, prev, pager, next, jumper"
          :total="totalRow"
        >
        </el-pagination>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import _ from 'lodash';
import { mapActions, mapState } from 'vuex';
export default {
  name: 'list',
  props: {
    type: { type: String, defalut: 'none' },
    dataList: { type: Array, defalut: () => [] },
    totalRow: { type: Number, defalut: 0 },
    info: { type: Object, default: () => {} },
  },
  components: {},
  data: () => ({
    currentPage: 1,
    searchInfo: {},
    resumeDialog: false,
    list: [],
    circleUrl: '',
  }),
  created() {},
  computed: {},
  methods: {
    selectInfo(selection) {
      //选择/全选方法,删除或者其他批量操作使用
      let ids = [];
      selection.map(item => {
        ids.push(item.id);
      });
      this.$emit('selectInfo', { type: this.type, ids: ids });
    },
    handleCurrentChange(val) {
      this.currentPage = val ? 1 : val;
      this.$emit('changePage', { type: this.type, currentPage: this.currentPage, searchInfo: this.searchInfo });
    },
    checkResume(resumeid, letterid) {
      this.$emit('searchInfo', { resumeid: resumeid, letterid: letterid });
    },
    update(status, id) {
      console.log(status, id);
      this.$emit('update', { status: status, id: id });
    },
  },
};
</script>

<style lang="less" scoped>
.row_pagination {
  text-align: right;
  margin-top: 1rem;
}
/deep/.el-dialog__body {
  padding: 0;
}
</style>
