<template>
  <div class="container normal-panel normal-margin panel" style="display:flex">
    <div>
      <el-descriptions>
          <el-descriptions-item label="企业名称">{{enterprise.enterprisename?enterprise.enterprisename:'--'}}</el-descriptions-item>
          <el-descriptions-item label="企业简称">{{enterprise.abbreviation}}</el-descriptions-item>
        <el-descriptions-item label="法人">{{enterprise.contact}}</el-descriptions-item>
        <el-descriptions-item label="电话">{{enterprise.phonenumber}}</el-descriptions-item>
          <!-- <el-descriptions-item label="企业互联ID">苏州市</el-descriptions-item> -->
      </el-descriptions>
      <el-descriptions direction="vertical">
        <el-descriptions-item label="企业操作页LOGO">
          <div class="image-panel" style="margin-left:10px">
            <img v-show="img.usetype === 'actionlogo'" v-for="img in siteinfo.attinfos" :key="img.index" style="width:100%" :src="img.url" alt="">
          </div>
        </el-descriptions-item>
        <!-- <el-descriptions-item label="企业登录页LOGO">
          <br><div>
            <el-image src="">
              <div slot="error" class="image-slot">
                <i class="el-icon-picture-outline"></i>
              </div>
            </el-image>
          </div>
        </el-descriptions-item> -->
        <!-- <el-descriptions-item label="登录背景">
        </el-descriptions-item> -->
      </el-descriptions>
    </div>
    <el-button  :disabled="!tool.checkAuth($route.name,'update')" icon="el-icon-edit" size="small" type="primary" style="width:120px;height: 30px"
                @click="onShowDtail">编 辑</el-button>
  </div>
</template>

<script>
import {mapGetters} from 'vuex'
import edit from './edit.vue'

export default {
  data () {
    return {
      enterprise:{},
      drawer:false,
      sys_enterpriseid:''
    }
  },
  components:{edit},
  computed:{
    ...mapGetters({
      siteinfo:'siteinfo',
      closeDrawerTemp:'closeDrawerTemp',
    }),
    show () {
      console.log(this.siteinfo);

      if (this.siteinfo.attinfos.some(item=>item.usetype === 'actionlogo')) {
        return false
      } else {
        return true
      }
    }
  },
  methods:{
     onShowDtail () {
      this.$store.dispatch('changeDetailDrawer',true),this.$router.push({path:'/enterpriseDetail',query:{basicInfo:this.siteinfo,id:this.sys_enterpriseid}})
     },
    async enterpriseData(){
      const res = await this.$api.requested({
        "id": 20221022165203,
        "content": {

        }
      })
      console.log(res,"企业信息")
      this.enterprise = res.data
      this.sys_enterpriseid = res.data.sys_enterpriseid
    },
    siteInfos () {
      this.$store.dispatch('querySiteInfo',{
        "classname": "webmanage.site.site",
        "method": "querySite",
        "content": {}
      })
    },
    closeDrawer () {
      this.drawer = false
    },
  },
  mounted () {
    this.enterpriseData()
  },
  watch:{
    closeDrawerTemp (val) {
    /*  !val?this.enterpriseData() this.queryImg():""*/
      if (!val){
        this.enterpriseData()
        /*this.queryImg()*/
        this.siteInfos()
      }
    }
  }
}

</script>
<style scoped>
/deep/.el-descriptions:last-child .el-descriptions-row {
  display: inline-block;
}
</style>