<template>
  <div class="normal-panel normal-margin">
    <div class="flex-align-center flex-between normal-margin">
      <p class="title">评分业务员</p>
      <excel :tablecols="tablecols" :param="params" excelTitle="评分业务员"></excel>
    </div>
    <tableLayout :layout="tablecols" :data="list" :custom="true" :height="310">
      <template v-slot:customcol="scope">
        <div v-if="scope.column.columnname === 'province'">
         {{scope.column.data.province}}-{{scope.column.data.city}}-{{scope.column.data.county}}
        </div>
        <div v-else-if="scope.column.columnname === 'isdownloadfile'">
         {{scope.column.data.isdownloadfile === 1?'是':'否'}}
        </div>
        <p v-else>{{scope.column.data[scope.column.columnname]}}</p>
      </template>
    </tableLayout>
    <div style="margin-top:16px;text-align:right">
      <el-pagination
        background
        small
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="currentPage"
        :page-size="params.content.pageSize"
        layout="total, prev, pager, next, jumper"
        :total="total">
      </el-pagination>
    </div>
  </div>
</template>

<script>
import excel from '@/components/export_excel/index.vue'
export default {
  components:{
    excel
  },
  data () {
    return {
      params:{
        "classname": "webmanage.saletool.notice.statistics.team",
        "method": "getScoreList",
        "content": {
          "sat_noticeid": this.$route.query.id,
          "pageNumber": 1,
          "pageSize": 10,
          "isAll":false
        }
      },
      tablecols:[],
      list:[],
      total:0,
      currentPage:0
    }
  },
  methods:{
    async getScoreList () {
      const res = await this.$api.requested(this.params)
      this.list = res.data
      this.total = res.total
      this.currentPage = res.pageNumber
    },
    handleSizeChange(val) {
      // console.log(`每页 ${val} 条`);
      this.params.content.pageSize = val
      this.getScoreList()
    },
    handleCurrentChange(val) {
      // console.log(`当前页: ${val}`);
      this.params.content.pageNumber = val
      this.getScoreList()
    },
  },
  mounted () {
    this.getScoreList()
  },
  created () {
    this.tablecols = this.tool.tabelCol(this.$route.name)['tableGroupScore'].tablecols
  }
}

</script>
<style>

</style>
<style scoped>
.title{
  height: 20px;
  line-height: 20px;
  font-size: 14px;
  text-indent: 7px;
  font-weight: bold;
  color: #333333;
  margin-bottom: 20px;
  border-left: .3rem solid #3874F6;
}
</style>