<template>
  <section class="paDetail">
    <ai-detail>
      <ai-title slot="title" title="用户详情" isShowBottomBorder isShowBack @onBackClick="$router.push({query:{}})"/>
      <template #content>
        <el-form size="small" label-width="160px">
          <ai-card title="基本信息">
            <template #content>
              <el-form-item label="用户账号">{{ detail.phone }}</el-form-item>
              <el-form-item label="注册时间">{{ detail.createTime }}</el-form-item>
            </template>
          </ai-card>
          <ai-card title="企业信息">
            <template #content>
              <ai-table :tableData="detail.userEnterpriseList" :colConfigs="colConfigs" :dict="dict"
                        :isShowPagination="false">
                <el-table-column slot="options" label="操作" align="center">
                  <template slot-scope="{row}">
                    <el-button type="text"
                               @click="$router.push({name:'973f0339e5904d99bc8afe86b8cf4e9c',query:{id:row.id}})">详情
                    </el-button>
                  </template>
                </el-table-column>
              </ai-table>
            </template>
          </ai-card>
        </el-form>
      </template>
    </ai-detail>
  </section>
</template>

<script>
export default {
  name: "paDetail",
  props: {
    instance: Function,
    dict: Object,
    permissions: Function
  },
  data() {
    return {
      detail: {},
      colConfigs: [
        {label: "企业名称", prop: "enterpriseName"},
        {label: "企业类型", prop: "enterpriseType", dict: "enterpriseType", align: "center"},
        {label: "状态", prop: "status", dict: "enterpriseStatus", align: "center"},
        {slot: "options"},
      ]
    }
  },
  methods: {
    getDetail() {
      let {id} = this.$route.query
      this.instance.post("/appportaluser/queryDetailByPortalUserId", null, {
        params: {id}
      }).then(res => {
        if (res?.data) {
          this.detail = res.data
        }
      })
    },
  },
  created() {
    this.getDetail()
  }
}
</script>

<style lang="scss" scoped>
.paDetail {
  height: 100%;
}
</style>
