<template>
<div>
  <basicDetails
      ref="details"
      :titleText="mainData.name"
      formPath="marketing2/saler"
      :editData="mainData"
      :mainAreaData="mainAreaData"
      turnPageId="20221011144603"
      idname="sa_salearea_hrid"
      ownertable="sa_salearea_hr"
      tags=""
      :tabs="['详细信息','业绩目标']"
      @pageChange="pageChange"
      @onEditSuccess="queryMainData($route.query.id)">
    <div slot="tags">
      <!-- 使用此插槽可不传[tags] -->
      <!-- :tabs="['经销商团队','代理区域','营销类别','账户余额']" -->
      <!--        <tagPanl slot="tags" :data="tags" :id="mainData.sa_customersid" @onSuccess="queryMainData"/>-->
    </div>
    <div slot="customOperation" >
      <!-- 此区域提供了自定义操作按钮 -->
<!--      <transaction_status class="inline-16" v-if="tool.checkAuth($route.name,'transaction')" :id="mainData.sa_customersid" @onshow="onSuccess" @shareSuccess="onSuccess"></transaction_status>-->
      <!--<lock class="inline-16" v-if="tool.checkAuth($route.name,'lock')"   :id="mainData.sa_customersid" @onshow="onSuccess"></lock>-->
      <!--<unlock class="inline-16" v-if="tool.checkAuth($route.name,'unlock')" :id="mainData.sa_customersid" @onshow="onSuccess"></unlock> -->
<!--      <share class="inline-16" v-if="tool.checkAuth($route.name,'share') && mainData.poolname === ''" :id="mainData.sa_customersid" @onshow="onSuccess" @shareSuccess="onSuccess"></share>
      <send_back style="display:inline" v-if="tool.checkAuth($route.name,'back') "  :data="mainData" @onshow="onSuccess" @backSuccess="onSuccess"></send_back>
      <to_void class="inline-16" v-if="tool.checkAuth($route.name,'toVoid')" :id="mainData.sa_customersid" @onshow="onSuccess" @toVoidSuccess="onSuccess"></to_void>
      <recovery class="inline-16" v-if="tool.checkAuth($route.name,'recovery') "  :data="mainData" @onshow="onSuccess" @backSuccess="onSuccess"></recovery>-->
    </div>
    <div slot="slot0" >
      <detailed ref="detailed"></detailed>
    </div>
<!--    <div slot="slot0" >
      <detailed ref="detailed"></detailed>
    </div>
    <div slot="slot1" class="container normal-panel"  >
      <contacts :data="mainData"  @onSuccess="onSuccess" v-if="flag"></contacts>
    </div>
    <div slot="slot2" class="container normal-panel">
      <address_manage :data="mainData"  v-if="flag"></address_manage>
    </div>-->
  </basicDetails>
</div>
</template>

<script>
export default {
  data () {
    return {
      mainData:{},
      mainAreaData:{}
    }
  },
  methods:{
    async queryMainData (id) {
      const res = await this.$api.requested({
        "classname": "webmanage.sale.salearea.salearea",
        "method": "query_salermain",
        "content": {
          "sa_salearea_hrid":id
        }
      })
      this.mainData = res.data
      console.log("输出获取的数据")
      console.log(this.mainData)
      this.changeDataStructure()
    },
    // 监听切换数据,上一页,下一页
    pageChange (id,rowindex) {
      this.flag = false
      this.$router.replace({path:'/saler_detail',query:{id:id,rowindex:rowindex}})
      this.queryMainData(id)
    },
    changeDataStructure () {
      this.mainAreaData = [
        {
          label:'业务员名称',
          value:this.mainData.name
        },
        {
          label:'编号',
          value:this.mainData.hrcode
        },
        {
          label:'部门',
          value:this.mainData.depname
        },
        {
          label:'手机号',
          value:this.mainData.phonenumber
        },
        {
          label:'邮箱',
          value:this.mainData.email
        },
        {
          label:'负责区域',
          value:this.mainData.areaname
        },
        {
          label:'汇报对象',
          value:this.mainData.reporthrname
        }
      ]
    },
  },
  mounted () {
    /*this.query_salermain()*/

    console.log("id"+'_____'+this.$route.query.id)
    this.queryMainData(this.$route.query.id)
  }
}

</script>
<style>
</style>