<template>
  <div class="AppPartyMember">
    <component ref="component" :is="component" :selected.sync="selected" :instance="instance" :dict="dict"/>
  </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
  },
  data() {
    return {
      selected: {}
    }
  },
  computed: {
    ...mapState(['user']),
    component() {
      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>
