<template>
  <div>
    <tableNewLayout :layout="tablecols" :data="list" :opwidth="200" height="calc(100vh - 356px)" :width="true" :custom="true" fixedName="operation">
      <template v-slot:customcol="scope">
        <div v-if="scope.column.columnname == 'scale'">
          {{scope.column.data[[scope.column.columnname]] + scope.column.data.unitname}}
        </div>
        <div v-else-if="scope.column.columnname == 'status'">
          <span :style="tool.getStatusColor(scope.column.data[[scope.column.columnname]])">{{$t(scope.column.data[[scope.column.columnname]])}}</span>
        </div>
        <div v-else-if="scope.column.columnname == 'leader'">
          <span v-if="scope.column.data[[scope.column.columnname]].length !== 0">{{scope.column.data[[scope.column.columnname]].length > 0 && scope.column.data[[scope.column.columnname]][0].name}}</span>
          <span v-else>--</span>
        </div>
        <div v-else>
          {{scope.column.data[[scope.column.columnname]] ||  scope.column.columnname === 'operation'? scope.column.data[[scope.column.columnname]] : '--'}}
        </div>
      </template>
      <template v-slot:opreation="scope">
        <el-button   type="text" size="mini" @click="goDetail(scope.data)">{{$t('详 情')}}</el-button>
      </template>
    </tableNewLayout>
  </div>
</template>

<script>
export default {
  name: "clueData",
  props:["data"],
  data(){
    return {
      tablecols:[],
      list:[],
      param:{
        "id": 2025042213202602,
        "content": {
          "sys_phonebookid": '',
          "pageSize": 20,
          "pageNumber": 1,
          "where": {
            "condition": ""
          }
        },
      },
    }
  },
  methods:{
    async listData(){
      this.param.content.sys_phonebookid = this.data.sys_phonebookid
      const res = await this.$api.requested(this.param)
      this.list = res.data
    },
    goDetail(row){
      let route = this.$route
      if (route.path !== '/orderclue_detail') {
        this.oldRoute = {path:route.path,query:route.query}
        this.$store.dispatch('setHistoryRouter',this.oldRoute)
      }
      this.$router.push({path:'/orderclue_detail',query:{id:row.sat_orderclueid,rowindex:row.rowindex}})
    },
  },
  mounted() {
    this.listData()
  },
  created() {
    this.tablecols = this.tool.tabelCol(this.$route.name).associationClueTable.tablecols
  }
}
</script>

<style scoped>

</style>
