<template>
  <div class="container normal-panel">
    <div class="flex-align-center flex-between normal-margin">
      <p class="title">{{ $t('未提报经销商') }}</p>
      <excel :tablecols="tablecols" :param="params" :excelTitle="$t('未提报经销商')"></excel>
    </div>
    <tableLayout :layout="tablecols" :data="list" :custom="true" height="calc(41vh)">
      <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>
        <p v-else>{{scope.column.data[scope.column.columnname]?$t(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:{
        "id":20221102093402,
        "content": {
            "sat_submiteditmodelid": this.$route.query.id,
            "pageNumber": 1,
            "pageSize": 20
        }
      },
      tablecols:[],
      list:[],
      total:0,
      currentPage:0
    }
  },
  methods:{
    async getUnSubmitList () {
      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.getUnSubmitList()
    },
    handleCurrentChange(val) {
      // console.log(`当前页: ${val}`);
      this.params.content.pageNumber = val
      this.getUnSubmitList()
    },
  },
  mounted () {
    this.getUnSubmitList()
  },
  created () {
    this.tablecols = this.tool.tabelCol(this.$route.name)['tablUnSubmit'].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>
