<template>
  <basicDetails 
    :titleText="mainData.enterprisename"
    formPath="EnterpriseArchives"
    :editData="mainData"
    :mainAreaData="mainAreaData" 
    turnPageId="20220920083901" 
    idname="sys_enterpriseid"
    :tags="[]"
    @pageChange="pageChange"
    @onEditSuccess="queryMainData($route.query.id)">
    <div slot="tags">
      <!-- 使用此插槽可不传[tags] -->
      <!-- :tabs="['经销商团队','代理区域','营销类别','账户余额']" -->
    </div>
    <div slot="customOperation">
      <!-- 此区域提供了自定义操作按钮 -->
    </div>
    <div slot="custom">
      <!-- 自定义内容区域 -->
    </div>
  </basicDetails>
</template>

<script>
export default {
  data () {
    return {
      mainData:{},
      mainAreaData:[]
    }
  },
  methods:{
    async queryMainData (id) {
      const res = await this.$api.requested({
        "id": 20220920084001,
        "content": {
          "sys_enterpriseid": id
        }
      })
      this.mainData = res.data
      this.changeDataStructure()
    },
    pageChange (id,rowindex) {
      this.queryMainData(id)
      this.$router.replace({path:'/EnterpriseArchivesDetail',query:{id:id,rowindex:rowindex}})
    },
    changeDataStructure () {
      this.mainAreaData = [
        {
          label:'企业名称',
          value: this.mainData.enterprisename
        },
        {
          label:'省市县',
          value: `${this.mainData.province}-${this.mainData.city}-${this.mainData.county}`
        },
        {
          label:'详细地址',
          value: this.mainData.address
        },
        {
          label:'企业联系人',
          value: this.mainData.contact
        },
        {
          label:'联系电话',
          value: this.mainData.phonenumber
        },
        {
          label:'税号',
          value: this.mainData.taxno
        },
        {
          label:'创建人',
          value: this.mainData.createby
        },
        {
          label:'创建时间',
          value: this.mainData.createdate
        },
      ]
    }
  },
  mounted () {
    this.queryMainData(this.$route.query.id)
  }
}

</script>
<style>
</style>