<template>
  <div>
    <basicLayout
        ref="list"
        formPath="competitor"
        tableName="competitorTable"
        idName="sa_competitorid"
        :apiId="{query:20221018164302,del:'20221018164202'}"
        :options="options"
        :autoQuery="false"
        :detailPath="{path:'/competitorDetail'}"
      >
      <div slot="titleRight">
        <importExcel style="margin-left:10px" @onSuccess="onSuccess"></importExcel>
      </div>
      <template #custom>
        <div class="mt-10">
          <label class="search__label">创建时间:</label>
          <el-date-picker
              v-model="date"
              style="margin-right: 24px !important;"
              size="small"
              type="daterange"
              value-format="yyyy-MM-dd"
              range-separator="至"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
              :default-time="['00:00:00', '23:59:59']"
              @change="datechange">
          </el-date-picker>
        </div>
      </template>
      <template v-slot:tbList="scope">
        <div>
          {{scope.data.column.data[[scope.data.column.columnname]]?scope.data.column.data[[scope.data.column.columnname]]:'--'}}
        </div>
      </template>
      <template v-slot:tbOpreation="scope">
      </template>
    </basicLayout>
  </div>
</template>

<script>
import importExcel from './modules/importCompetior.vue'
export default {
  name: "index",
  data(){
    return {
      options:[],
      date:[]
    }
  },
  components:{
    importExcel
  },
  methods:{
    datechange(){
      console.log(this.date,"日期")
      this.$refs['list'].param.content.isExport = false
      if (this.date === null){
        this.$refs['list'].param.content.where.startdate = ''
        this.$refs['list'].param.content.where.enddate = ''
      }else{
        this.$refs['list'].param.content.where.startdate = this.date[0]
        this.$refs['list'].param.content.where.enddate = this.date[1]
      }
      this.$refs['list'].listData()
    },
    onSuccess () {
      this.$refs['list'].listData()
    }
  },
  mounted() {
    this.$refs['list'].param.content.isExport = false
    this.$refs['list'].listData()
  }
}
</script>

<style scoped>

</style>