<template>
  <div class="personal-target">
    <Header>
      <el-button size="small" @click="export1" v-if="tool.checkAuth($route.name,'export')">导出</el-button>
    </Header>
    <div class="container normal-panel">
      <select-panel 
        @yearChange="yearChange" 
        @targetChange="targetChange" 
        @clearTarget="targetClear" 
        @searchActive="searchActive" 
        @clearData="searchClear"
      />
      <Table ref="table">
        <template v-slot:detail="scope">
          <el-button v-if="tool.checkAuth($route.name,'read')" type="text" size="small" @click="$router.push({path:'/PersonalDetail',query:{id:scope.data.data.hrid,year:scope.data.year}})">详情</el-button>
        </template>
      </Table>
    </div>
  </div>
</template>

<script>
import Header from '@/SManagement/archives_upload/components/Header';
import selectPanel from '@/SManagement/project_target/components/selectPanel'
import Table from './components/table'
export default {
  name: '',
  data() {
    return {
      tablecols:'',
      list:'',
      reslut:'',
    };
  },
  components: { Header, selectPanel , Table},
  computed:{
  },
  watch:{
  },
  created() {
  },
  methods: {
    yearChange(time) {
      this.$refs.table.year = time
    },
    targetChange(data) {
      this.$refs.table.params.content.type = data
      this.$refs.table.queryData()
    },
    targetClear() {
      this.$refs.table.params.content.type = ''
      this.$refs.table.queryData()
    },
    searchActive(data) {
      this.$refs.table.params.content.where.condition = data
      this.$refs.table.queryData()
    },
    searchClear() {
      this.$refs.table.params.content.where.condition = ''
      this.$refs.table.queryData()
    },
    async export1() {
      if(!Object.keys(this.$refs.table.tableData).length > 0) return
      let res = await this.$api.requested({
        "id": 20220916095402,
        "content": {
            "row": this.$refs.table.tableData
        }
      })
      this.tool.showMessage(res,() => {
        window.open(res.msg,'_self')
      })
    }
  },
};
</script>

<style scoped>
*{
  box-sizing: border-box;
}
  .base-target {
    width: 100%;
    padding: 0 15px;
    border: 1px solid #c0c4cc;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    word-break: break-all;
    border-radius: 5px;
    background: #ffffff;
  }
  .base-target input {
    border: 0 none;
    outline: none;
    height: 32px;
    width: 100%;
  }
</style>
