// import Popover from './Popover'
import Question from './question.vue'
export default {
  props: {
    total: {
      type:[Array,Object]
    },
    QuestionTotal:Array,
    eventName:String,
    eventId:{
      
    }
  },
  components: {
    // Popover,
    Question
  },

  data() {
    return {}
  },
  methods: {
    handleClick(type,val) {
      this.$emit('on-click', {type,isPatentMining:val})
    },
    getTotal(title,type) {
      var total = this.total.find(item=>{
        return item.name == title
      })
      var types = {
        '2':'projectCount',
        '3':'reportCount',
        '4':'patentMiningCount'
      }
      if(total){
        return total.total[types[type]]
      }else{
        return 0
      }
    },
    getColor(title){
      var total = this.total.find(item=>{
        return item.name == title
      })
      if(total){
        var count = total.total
        let sign = false
        for(let key in count){
          if(count[key]>0){
            sign = true
          }
        }
        if(sign){
          return '#316292'
        }else{
          return '#767676'
        }
      }else{
        return '#767676'
      }
    },
    getIcon(title){
      var total = this.total.find(item=>{
        return item.name == title
      })
      if(total){
        var count = total.total
        let sign = false
        for(let key in count){
          if(count[key]>0){
            sign = true
          }
        }
        if(sign){
          return 'url(#SvgjsPattern1061)'
        }else{
          return 'url(#SvgjsPattern1100)'
        }
      }else{
        return 'url(#SvgjsPattern1100)'
      }
    },
    getCss(title){
      if(this.eventName){
        return 'display:none'
      }
      return 'display:block'
    },
    getQuestionTotal(type) {
      if(this.QuestionTotal.length>0){
        const total = this.QuestionTotal.find(item=>{return item.name == type}).count
        if (total) {
          return total
        }else{
          return 0
        }
      }
      
      return 0
    },
    getQuestionId(type){
      if(this.QuestionTotal.length>0){
         return this.QuestionTotal.find(item=>{return item.applicationScenarioName == type})
      }
    },
  }
}