|
@@ -22,7 +22,13 @@ export default {
|
|
|
teachers: [],
|
|
|
schools: [],
|
|
|
vipGroupCategory: [],
|
|
|
- educations:[]
|
|
|
+ educations:[],
|
|
|
+ branchsLoading:false,
|
|
|
+ subjectsLoading:false,
|
|
|
+ teachersLoading:false,
|
|
|
+ schoolsLoading:false,
|
|
|
+ vipGroupCategoryLoading:false,
|
|
|
+ educationsLoading:false
|
|
|
},
|
|
|
mutations: {
|
|
|
commit_branchs: (state, branchs) => {
|
|
@@ -53,54 +59,72 @@ export default {
|
|
|
},
|
|
|
actions: {
|
|
|
async setBranchs ({ commit, state }, force) {
|
|
|
- if (!state.branchs.length || force === true) {
|
|
|
+ if (!state.branchs.length || force === true || !state.branchsLoading) {
|
|
|
+ if(state.branchsLoading)return
|
|
|
try {
|
|
|
+ state.branchsLoading = true
|
|
|
const res = await getEmployeeOrgan()
|
|
|
commit('commit_branchs', res.data)
|
|
|
} catch (error) { }
|
|
|
+ state.branchsLoading = false
|
|
|
}
|
|
|
},
|
|
|
async setSubjects ({ commit, state }, force) {
|
|
|
if (!state.subjects.length || force === true) {
|
|
|
+ if(state.subjectsLoading)return
|
|
|
try {
|
|
|
+ state.subjectsLoading = true
|
|
|
const res = await getSubject({rows: 9999, tenantId: '1'})
|
|
|
commit('commit_subjects', res.data)
|
|
|
} catch (error) { }
|
|
|
+ state.subjectsLoading = false
|
|
|
}
|
|
|
},
|
|
|
async setTeachers ({ commit, state }, force) {
|
|
|
if (!state.teachers.length || force === true) {
|
|
|
-
|
|
|
+ if(state.teachersLoading)return
|
|
|
try {
|
|
|
+ state.teachersLoading =true
|
|
|
const res = await getTeacher()
|
|
|
commit('commit_teachers', res.data)
|
|
|
} catch (error) { }
|
|
|
+ state.teachersLoading = false
|
|
|
}
|
|
|
},
|
|
|
async setSchools ({ commit, state }, force) {
|
|
|
if (!state.schools.length || force === true) {
|
|
|
+ if(state.schoolsLoading)return
|
|
|
try {
|
|
|
+ state.schoolsLoading = true
|
|
|
const res = await getSchool()
|
|
|
commit('commit_schools', res.data)
|
|
|
} catch (error) { }
|
|
|
+ state.schoolsLoading = false
|
|
|
}
|
|
|
},
|
|
|
async setVipGroupCategory ({ commit, state }, force) {
|
|
|
if (!state.vipGroupCategory.length || force === true) {
|
|
|
+ if(state.vipGroupCategoryLoading)return
|
|
|
try {
|
|
|
+ state.vipGroupCategoryLoading = true
|
|
|
const res = await vipGroupCategory()
|
|
|
commit('commit_vip_group_category', res.data)
|
|
|
} catch (error) { }
|
|
|
+ state.vipGroupCategoryLoading = false
|
|
|
+
|
|
|
}
|
|
|
},
|
|
|
async setEducations({commit,state},force){
|
|
|
- if (!state.educations.length || force === true) {
|
|
|
+ if (!state.educations.length || force === true ) {
|
|
|
+ if(state.educationsLoading)return
|
|
|
try {
|
|
|
-
|
|
|
+ state.educationsLoading = true
|
|
|
const res = await findEducationUsers()
|
|
|
commit('commit_educations', res.data)
|
|
|
- } catch (error) { }
|
|
|
+ } catch (error) { }
|
|
|
+ state.educationsLoading = false
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|