<template>
  <div class="AppPartyMember">
    <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";
import NeighbourSetting from "./components/neighbourSetting";

export default {
  name: 'AppPartyMember',
  label: '党员管理',
  components: {
    NeighbourSetting,
    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.hash == "#ns") {
        return NeighbourSetting
      } 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>
.AppPartyMember {
  height: 100%;
}
</style>
