<template>
  <div>
      <basicLayout
      ref="list"
      formPath="salerPrivatecustomer"
      tableName="salerPrivatecustomerTable"
      idName="sa_customersid"
      :apiId="{query:20221012164402,del:''}"
      :options="options"
      :autoQuery="false"
      :detailPath="{path:'/customerDetail',param:{tabIndex:tabIndex}}">
        <template #custom>
          <!-- <el-divider direction="vertical"></el-divider>
          <el-dropdown size="medium" @command="handleCommand">
          <span class="el-dropdown-link">
            {{editableTabsValue}}<i class="el-icon-arrow-down el-icon--right"></i>
          </span>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item v-for="(item,index) in editableTabs" :key="index" :command="item">{{item.title}}</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown> -->
          <el-select v-model="value" size="small" placeholder="请选择">
            <el-option
              @click.native="handleCommand(item)"
              v-for="item in editableTabs"
              :key="item.index"
              :label="item.title"
              :value="item.name">
            </el-option>
          </el-select>
        </template>
        <template v-slot:tbList="scope">
          <div v-if="scope.data.column.columnname === 'isleader'">
            <span v-if="scope.data.column.data['leader'].length !== 0">已分配</span>
            <span v-else>未分配</span>
          </div>
          <div v-else-if="scope.data.column.columnname === 'contact'">
            <span>{{scope.data.column.data['leader'][0]?scope.data.column.data['leader'][0].name:''}}</span>
          </div>
          <div v-else-if="scope.data.column.columnname === 'grade'">
            <p v-if="scope.data.column.data.grade === 2">B级</p>
            <p v-if="scope.data.column.data.grade === 1">A级</p>
            <p v-if="scope.data.column.data.grade === 3">C级</p>
          </div>
          <div v-else>
            {{scope.data.column.data[[scope.data.column.columnname]]}}
          </div>
        </template>
<<<<<<< HEAD
        <!-- <template v-slot:tbOpreation="scope">
          <el-button size="mini" type="text" @click="$router.push({path:'/customerDetail',query:{id:scope.data.data.sa_customersid,rowindex:scope.data.data.rowindex,tabIndex:tabIndex}})">详 情</el-button>
        </template> -->
=======
<!--        <template v-slot:tbOpreation="scope">-->
<!--          <el-button size="mini" type="text" @click="$router.push({path:'/customerDetail',query:{id:scope.data.data.sa_customersid,rowindex:scope.data.data.rowindex,tabIndex:tabIndex}})">详 情</el-button>-->
<!--        </template>-->
>>>>>>> 8be118da8263bf7cea1e45cdd92c84cc2cd45a40
      </basicLayout>
  </div>
</template>

<script>
export default {
  name: "index",
  data() {
    return {
      value:'0',
      editableTabsValue: "全部",
      editableTabs: [{
        title: '全部',
        name: "0",
      },{
        title: '我负责的',
        name: "1",
      }, {
        title: '我参与的',
        name: "2",
      }, {
        title: '我下属负责的',
        name: "3",
      }, {
        title: '我下属参与的',
        name: "4",
      }],
      tabIndex:"0",
      options:[],
      listData:[]
    }
  },
  mounted() {
    this.queryData('')
  },
  methods:{
    queryData(id){
      this.$refs['list'].param.content.type = id
      this.$refs['list'].param.content.isExport = false
      this.$refs['list'].listData()
      // this.$store.dispatch('sendDataToForm',)
    },
    handleCommand(command){
      this.tabIndex = command.name
      this.editableTabsValue = command.title
      this.$refs['list'].param.content.type = command.name
      this.$refs['list'].param.content.isExport = 0
      this.$refs['list'].listData()
      // this.$store.dispatch('sendDataToForm',)
    }
  },
  created() {

  }
}
</script>

<style scoped>
.el-dropdown-link {
  cursor: pointer;
  color: #151515;
  font-size: 16px;
}
.el-divider--vertical{
  margin: 0 16px;
}
.el-icon-arrow-down {
  font-size: 16px;
}
</style>