<template>
  <div>
    <basicDetails
        ref="details"
        :titleText="`${mainData.accountno}-${mainData.name}`"
        :oldFormPath="{edit:'HManagement/accountManage/modules'}"
        :editData="mainData"
        :mainAreaData="mainAreaData"
        turnPageId="20221031141102"
        idname="userid"
        ownertable="sys_users"
        tags=""
        :tabs="['员工信息','角色信息']"
        @pageChange="pageChange"
        @onEditSuccess="queryMainData($route.query.id)">
      <div slot="tags">
      </div>
      <div slot="customOperation" >
      </div>
      <div slot="slot0" >
      </div>
      <div slot="slot1" >
      </div>
    </basicDetails>
  </div>
</template>

<script>
export default {
  name: "detail",
  data() {
    return {
      mainData:{},
      mainAreaData:{}
    }
  },
  components:{
  },
  methods:{
    async queryMainData(id) {
      const res = await this.$api.requested({
        "classname": "webmanage.users.users",
        "method": "query_userMain",
        "content": {
          "userid": this.$route.query.id
        }
      })
      this.mainData = res.data
    },
    changeDataStructure() {
      this.mainAreaData = [
        {
          label:'账号类型',
          value:this.mainData.usertypename
        },
        {
          label:'状态',
          value:this.minaInfo.status === 'ACTIVE'?'启用':this.minaInfo.status === 'INACTIVE'?'停用':'其他'
        },
        {
          label:'联系方式',
          value:this.mainData.phonenumber
        },
        {
          label:'上级企业',
          value:this.mainData.superiorenterprisename
        },
        {
          label:'成交状态',
          value:this.mainData.tradingstatus
        },
        {
          label:'负责人',
          value:this.mainData.leader[0]?this.mainData.leader[0].name:""
        },
        {
          label:'最近跟近时间',
          value:''
        },
        {
          label:'所属公海',
          value:this.mainData.poolname
        }
      ]
    },
    // 监听切换数据,上一页,下一页
    pageChange (id,rowindex,tabIndex) {
      this.flag = false
      tabIndex = this.$route.query.tabIndex
      this.$router.replace({path:'/customerDetail',query:{id:id,rowindex:rowindex,tabIndex:tabIndex}})
      this.queryMainData(id)
    },
    onSuccess(){
      this.visible = false
      this.queryMainData(this.$route.query.id)
      this.$emit('onSuccess')
    }
  },
  mounted () {
    this.queryMainData(this.$route.query.id)
  },
  created() {
  }
}
</script>

<style scoped>

</style>