import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)
const files = require.context('./modules', false, /\.js$/)
const modules = {}

files.keys().forEach(key => {
  modules[key.replace(/(\.\/|\.js)/g, '')] = files(key).default
})
export default new Vuex.Store({
  state: {},
  mutations: {},
  actions: {},
  getters: {
    getuserinfo(state) {
      // console.log(state.user, '啊啊啊')
      return state.user.userInfo
    },
    getPermissions(state) {
      return state.user.permissions
    },
    getPatiensInfo(state) {
      return state.user.patiensInfo
    },
    getActiveID(state) {
      return state.nav.activeID
    },
    getActive(state) {
      return state.nav.active
    },
    getDrugInfo(state) {
      return state.drug.drugsInfo
    },
    getRecipeId(state) {
      return state.drug.recipeId;
    },
    getIsSee(state) {
      return state.user.isSeeDoctor
    },
    getPreNo(state) {
      return state.user.preNo
    },
    getOutpatientDiagnosis(state) {
      return state.user.outpatientDiagnosis
    },
    getEmrDiagnosis(state) {
      return state.user.emr
    }
  },
  modules
})