<template>
    <div>
      <el-drawer class="custom-drawer-form" size="900px" :with-header="false" :visible.sync="drawer" direction="rtl" :before-close="close" destroy-on-close append-to-body>
          <div style="padding:10px;height:100%">
            <questionIndex :applicationScenario="getQuestionId(params.scenarioName)" isOperate='可视化'></questionIndex>
          </div>
      </el-drawer>
    </div>
</template>
  
<script>
  export default {
    name:'eventDrawer',
    components: {
        questionIndex:() => import('@/views/event/components/index.vue')
    },
    props: {},
    data() {
      return {
          //控制弹窗是否显示
          drawer:false,
          //事件的信息
          params:{},
          //事件数量
          QuestionTotal:[]
      };
    },
    watch: {},
    computed: {},
    created() {},
    mounted() {
        //获取事件数量
        this.getEventNumber()
    },
    methods: {
        //获取当前应用场景数据
        getQuestionId(type){
            if(this.QuestionTotal.length>0){
                var a= this.QuestionTotal.find(item=>{return item.applicationScenarioName == type})
                if(a){
                    return a.applicationScenarioValue
                }
            }
        },
        //获取事件数量
        async getEventNumber(){
            await  this.$api.queryApplicationScenarioEventNumber().then(response=>{
                if(response.code == 200){
                this.QuestionTotal = response.data
                }
            })
        },
        //打开抽屉
        open(scenarioName, typeName, question){
          this.params = {
              scenarioName:scenarioName, 
              typeName:typeName, 
              question:question
          }
          this.drawer = true
        },
        //关闭抽屉
        close(){
            this.$emit('close')
            this.drawer = false
        }
    },
  };
  </script>
  <style lang="scss">
  </style>