<template>
  <div v-loading="loading">
    <el-form v-if="type == '1'" :model="row" label-width="110px" style="margin:0 auto;width:50%">
        <el-form-item label="类别名称" prop="name">
          <myTooltip :content="row.name" >
            <div class="noWrap" v-html="$commonJS.getColumnData(row, {type:'String',value:'name'})"></div>
          </myTooltip>
        </el-form-item>
        <el-form-item label="参考许可费率" prop="licenseRate">
          <myTooltip :content="row.licenseRate+''" >
            <div class="noWrap" v-html="$commonJS.getColumnData(row, {type:'String',value:'licenseRate'})"></div>
          </myTooltip>
        </el-form-item>
        <el-form-item label="管理人" prop="adminPersons">
          <myTooltip :content="$commonJS.getColumnData(row, {type:'Array',value:'adminPersons'},'name')" >
            <div class="noWrap" v-html="$commonJS.getColumnData(row, {type:'Array',value:'adminPersons'},'name')"></div>
          </myTooltip>
        </el-form-item>
        <el-form-item label="谁可以看" prop="persons">
          <myTooltip :content="$commonJS.getColumnData(row, {type:'Array',value:'persons'},'name')">
            <div class="noWrap" v-html="$commonJS.getColumnData(row, {type:'Array',value:'persons'},'name')"></div>
          </myTooltip>
        </el-form-item>
        <el-form-item label="图片">
          <span v-if="row.systemFileList && row.systemFileList.length>0" class="avatar">
            <el-image ref="image" style="width:148px;height:148px;" :src="$commonJS.checkViewer(row.systemFileList[0].guid)" :preview-src-list="[$commonJS.checkViewer(row.systemFileList[0].guid)]"></el-image>
          </span>
        </el-form-item>
        <el-form-item label="创建人" prop="createName">
          <myTooltip :content="row.createName">
            <div class="noWrap" v-html="$commonJS.getColumnData(row, {type:'String',value:'createName'})"></div>
          </myTooltip>
        </el-form-item>
        <el-form-item label="创建时间" prop="createTime">
          <myTooltip :content="row.createTime">
            <div class="noWrap" v-html="$commonJS.getColumnData(row, {type:'String',value:'createTime'})"></div>
          </myTooltip>
        </el-form-item>
        <el-form-item label="描述" prop="description">
          <myTooltip :content="row.description">
            <div class="noWrap" v-html="$commonJS.getColumnData(row, {type:'String',value:'description'})"></div>
          </myTooltip>
        </el-form-item>
    </el-form>

    <el-form v-else :model="row" label-width="110px" style="margin:0 auto;width:50%">
        <!-- <el-form-item label="所属产品类别" prop="name">
          <myTooltip :content="row.name" >
            <div class="noWrap" v-html="$commonJS.getColumnData(row, {type:'String',value:'name'})"></div>
          </myTooltip>
        </el-form-item> -->
        <el-form-item label="产品名称" prop="name">
          <myTooltip :content="row.name" >
            <div class="noWrap" v-html="$commonJS.getColumnData(row, {type:'String',value:'name'})"></div>
          </myTooltip>
        </el-form-item>
        <el-form-item label="上市时间" prop="marketTime">
          <myTooltip :content="row.marketTime" >
            <div class="noWrap" v-html="$commonJS.getColumnData(row, {type:'String',value:'marketTime'})"></div>
          </myTooltip>
        </el-form-item>
        <el-form-item label="所属公司" prop="companyName">
          <myTooltip :content="row.companyName" >
            <div class="noWrap" v-html="$commonJS.getColumnData(row, {type:'String',value:'companyName'})"></div>
          </myTooltip>
        </el-form-item>
        <el-form-item label="参考许可费率" prop="licenseRate">
          <myTooltip :content="row.licenseRate+''" >
            <div class="noWrap" v-html="$commonJS.getColumnData(row, {type:'String',value:'licenseRate'})"></div>
          </myTooltip>
        </el-form-item>
        <el-form-item label="管理人" prop="adminPersons">
          <myTooltip :content="$commonJS.getColumnData(row, {type:'Array',value:'adminPersons'},'name')" >
            <div class="noWrap" v-html="$commonJS.getColumnData(row, {type:'Array',value:'adminPersons'},'name')"></div>
          </myTooltip>
        </el-form-item>
        <el-form-item label="谁可以看" prop="persons">
          <myTooltip :content="$commonJS.getColumnData(row, {type:'Array',value:'persons'},'name')">
            <div class="noWrap" v-html="$commonJS.getColumnData(row, {type:'Array',value:'persons'},'name')"></div>
          </myTooltip>
        </el-form-item>
        <el-form-item label="图片">
          <span v-if="row.systemFileList && row.systemFileList.length>0" class="avatar">
            <el-image ref="image" style="width:148px;height:148px;" :src="$commonJS.checkViewer(row.systemFileList[0].guid)" :preview-src-list="[$commonJS.checkViewer(row.systemFileList[0].guid)]"></el-image>
          </span>
        </el-form-item>
        <el-form-item label="创建人" prop="createName">
          <myTooltip :content="row.createName">
            <div class="noWrap" v-html="$commonJS.getColumnData(row, {type:'String',value:'createName'})"></div>
          </myTooltip>
        </el-form-item>
        <el-form-item label="创建时间" prop="createTime">
          <myTooltip :content="row.createTime">
            <div class="noWrap" v-html="$commonJS.getColumnData(row, {type:'String',value:'createTime'})"></div>
          </myTooltip>
        </el-form-item>
        <el-form-item label="描述" prop="description">
          <myTooltip :content="row.description">
            <div class="noWrap" v-html="$commonJS.getColumnData(row, {type:'String',value:'description'})"></div>
          </myTooltip>
        </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  components: {},
  props: {
    type:{},
    id:{}
  },
  data() {
    return {
      row:{},
      params:{
        current:1,
        size:10,
        orderDTOList: null,
      },
      loading:false
    };
  },
  watch: {},
  computed: {},
  created() {},
  mounted() {
    if(Object.keys(this.row).length>0){
      return false
    }
    if(this.type == '1'){
      this.getProductCategory()
    }else{
      this.getProduct()
    }
  },
  methods: {
    //获取产品类别信息
    getProductCategory(){
      this.params.searchQuery = `category_id=${this.id}`
      this.loading = true
      this.$api.queryProductCategory(this.params).then(response=>{
        if(response.code == 200){
          this.row = response.data.data[0]
          this.loading = false
        }
      }).catch(error=>{
        this.row = {}
        this.loading = false
      })
    },
    //获取产品信息
    getProduct(){
      this.params.searchQuery = `product_id=${this.id}`
      this.loading = true
      this.$api.queryProduct(this.params).then(response=>{
        if(response.code == 200){
          this.row = response.data.data[0]
          this.loading = false
        }
      }).catch(error=>{
        this.row = {}
        this.loading = false
      })
    },
  },
};
</script>
<style lang="scss" scoped>
</style>