<template>
  <div class="AppRecruitPartyMembers">
    <component ref="component" :is="currentPage" :selected.sync="selected" v-bind="$props"/>
  </div>
</template>

<script>
import List from './components/List'
import Add from './components/Add'
import Detail from './components/Detail'
import {mapState} from "vuex";

export default {
  name: 'AppRecruitPartyMembers',
  label: '发展党员',
  components: {
    Add,
    List,
    Detail
  },
  props: {
    instance: Function,
    dict: Object,
    permissions:Function
  },
  data() {
    return {
      selected: {}
    }
  },
  computed: {
    ...mapState(['user']),
    currentPage() {
      if (this.$route.hash == "#add") {
        return Add
      } else if (this.$route.query.id) {
        return Detail
      } else return List
    }
  },
  created() {
    this.dict.load("yesOrNo")
    let {organizationId: id, organizationName: name} = this.user.info
    this.selected = {id, name}
  },

}
</script>

<style lang="scss" scoped>
.AppRecruitPartyMembers {
  height: 100%;
}
</style>
