新增global,缓存职位信息
This commit is contained in:
		
							
								
								
									
										7
									
								
								stdiet-ui/src/store/actions.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								stdiet-ui/src/store/actions.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | ||||
| const actions = { | ||||
|   async init({ dispatch }, payload) { | ||||
|     dispatch("global/init", payload); | ||||
|   } | ||||
| }; | ||||
|  | ||||
| export default actions; | ||||
| @@ -11,6 +11,15 @@ const getters = { | ||||
|   roles: state => state.user.roles, | ||||
|   permissions: state => state.user.permissions, | ||||
|   userId: state => state.user.userId, | ||||
|   permission_routes: state => state.permission.routes | ||||
| } | ||||
| export default getters | ||||
|   permission_routes: state => state.permission.routes, | ||||
|   // | ||||
|   nutritionistIdOptions: state => state.global.nutritionistIdOptions, | ||||
|   nutriAssisIdOptions: state => state.global.nutriAssisIdOptions, | ||||
|   preSaleIdOptions: state => state.global.preSaleIdOptions, | ||||
|   afterSaleIdOptions: state => state.global.afterSaleIdOptions, | ||||
|   plannerIdOptions: state => state.global.plannerIdOptions, | ||||
|   plannerAssisIdOptions: state => state.global.plannerAssisIdOptions, | ||||
|   operatorIdOptions: state => state.global.operatorIdOptions, | ||||
|   operatorAssisIdOptions: state => state.global.operatorAssisIdOptions | ||||
| }; | ||||
| export default getters; | ||||
|   | ||||
| @@ -9,6 +9,7 @@ import recipes from "./modules/recipes"; | ||||
| import global from "./modules/global"; | ||||
|  | ||||
| import getters from "./getters"; | ||||
| import actions from "./actions"; | ||||
|  | ||||
| Vue.use(Vuex); | ||||
|  | ||||
| @@ -22,7 +23,8 @@ const store = new Vuex.Store({ | ||||
|     recipes, | ||||
|     global | ||||
|   }, | ||||
|   getters | ||||
|   getters, | ||||
|   actions | ||||
| }); | ||||
|  | ||||
| export default store; | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| import { getOptions } from "@/api/custom/order"; | ||||
| import { getOptions } from "@/api/custom/global"; | ||||
|  | ||||
| const oriState = { | ||||
|   nutritionistIdOptions: [], | ||||
| @@ -8,7 +8,7 @@ const oriState = { | ||||
|   plannerIdOptions: [], | ||||
|   plannerAssisIdOptions: [], | ||||
|   operatorIdOptions: [], | ||||
|   operatorAssisIdOptions: [], | ||||
|   operatorAssisIdOptions: [] | ||||
| }; | ||||
|  | ||||
| const mutations = { | ||||
| @@ -28,9 +28,7 @@ const actions = { | ||||
|     const { data: optionsData } = await getOptions(); | ||||
|     const options = optionsData.reduce((opts, cur) => { | ||||
|       if (!opts[cur.postCode]) { | ||||
|         opts[cur.postCode] = [ | ||||
|           // { dictValue: null, dictLabel: "全部", remark: null } | ||||
|         ]; | ||||
|         opts[cur.postCode] = [{ dictValue: 0, dictLabel: "无", remark: null }]; | ||||
|       } | ||||
|       opts[cur.postCode].push({ | ||||
|         dictValue: cur.userId, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user