
<template>
  <basicDetails 
    ref="details"
    :titleText="mainData.projectname"
    formPath="projectChange/quotation"
    :editData="mainData"  
    :mainAreaData="mainAreaData" 
    :turnPageId="20221020165103" 
    idname="sa_quotedpriceid"
    tags=""
    @pageChange="pageChange"
    @onEditSuccess="queryMainData($route.query.id)">
    <!-- 使用此插槽可不传[tags] -->
    <tagPanl slot="tags" :data="tagObj" ownertable="sa_project" :id="mainData.sa_projectid" @onSuccess="queryMainData"/>
    <div slot="customOperation">
      <!-- 此区域提供了自定义操作按钮 -->
    </div>
  </basicDetails>
</template>

<script>

export default {
  components:{},
  data () {
    return {
      mainData:{},
      mainAreaData:'',
      tagObj:''
    }
  },
  provide () {
    return {
      detailData:() => this.mainData
    }
  },
  methods:{
    async queryMainData (id) {
      const res = await this.$api.requested({
        "id": "20221020165203",
        "version":1,
        "content": {
            "sa_quotedpriceid":this.$route.query.id
        }
      })
      this.mainData = res.data
      console.log(this.mainData);
      this.changeDataStructure()
      /* 获取标签数据 */
      this.tagObj = await this.$store.dispatch('queryTagList',{table:'sa_quotedprice',id:this.mainData.sa_quotedpriceid})
    },
    // 监听切换数据,上一页,下一页
    pageChange (id,rowindex) {
      this.$router.replace({path:'/projectChangeDetail',query:{id:id,rowindex:rowindex}})
      this.queryMainData(id)
    },
    changeDataStructure () {
      this.mainAreaData = [
        {
          label:'企业名称',
          value: this.mainData.enterprisename
        },
        {
          label:'单号',
          value: this.mainData.billno
        },
        {
          label:'项目名称',
          value:this.mainData.projectname
        },
        {
          label:'负责人',
          value: this.mainData.name
        },
        {
          label:'部门',
          value: this.mainData.depname
        },
        {
          label:'有效时间',
          value:this.mainData.invaliddate
        },
        {
          label:'状态',
          value: this.mainData.status
        },
        {
          label:'地址',
          value: this.mainData.address
        },
        {
          label:'创建时间',
          value: this.mainData.createdate
        },
        {
          label:'创建人',
          value: this.mainData.createby
        },{
          label:'编辑时间',
          value: this.mainData.changedate
        },{
          label:'编辑人',
          value: this.mainData.changeby
        },{
          label:'所属行业',
          value: this.mainData.industry
        },
      ]
    }
  },
  mounted () {
    this.queryMainData()
  },
  async created () {
    // 验证权限
    // this.tool.checkAuth(this.$route.name,'update')?'':this.$router.go(-1)
  },
}

</script>
<style>
</style>