<template>
    <div>
      <el-drawer class="custom-drawer-form" size="1100px" :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)"></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>