<template>
  <div class="form">
    <component ref="TabPage" :is="component" @change="onChange" :params="params"/>
  </div>
</template>

<script>
import Tabbar from './components/Tabbar.vue'
import AddForm from './AddForm.vue'
import Result from './Result.vue'
import {mapActions} from "vuex";

export default {
  name: 'AppAskForm',
  appName: '问卷表单管理',

  data() {
    return {
      component: 'Tabbar',
      params: {},
      refresh: true
    }
  },

  components: {
    Tabbar,
    Result,
    AddForm
  },

  methods: {
    ...mapActions(['injectJWeixin']),
    onChange(e) {
      this.params = e.params
      this.component = e.type
    }
  },
  onShow() {
    document.title = "问卷表单"
    this.$refs?.TabPage?.show()
    this.$nextTick(() => {
      this.injectJWeixin(['sendChatMessage', 'selectEnterpriseContact', 'shareAppMessage', 'shareWechatMessage']).then(() => {
        this.$dict.load(['questionnaireStatus', 'questionnaireType', 'questionnaireFieldType'])
      })
    })
  }
}
</script>

<style lang="scss" scoped>
</style>
