|
@@ -3,6 +3,9 @@
|
|
|
import { getSubject, getTeacher,findEducationUsers,getEmployeeOrgan } from '@/api/buildTeam'
|
|
|
import { getSchool } from '@/api/systemManage'
|
|
|
import { vipGroupCategory } from "@/api/vipSeting"
|
|
|
+import { findTechnician } from '@/api/repairManager'
|
|
|
+
|
|
|
+const loadings = {}
|
|
|
|
|
|
/**
|
|
|
*
|
|
@@ -22,7 +25,8 @@ export default {
|
|
|
teachers: [],
|
|
|
schools: [],
|
|
|
vipGroupCategory: [],
|
|
|
- educations:[]
|
|
|
+ educations:[],
|
|
|
+ technician: []
|
|
|
},
|
|
|
mutations: {
|
|
|
commit_branchs: (state, branchs) => {
|
|
@@ -48,59 +52,82 @@ export default {
|
|
|
commit_vip_group_category: (state, vipGroupCategory) => {
|
|
|
state.vipGroupCategory = vipGroupCategory
|
|
|
},
|
|
|
- commit_educations:(state,educations)=>{
|
|
|
+ commit_educations: (state, educations)=>{
|
|
|
state.educations = educations
|
|
|
+ },
|
|
|
+ commit_technician: (state, technician) => {
|
|
|
+ state.technician = technician
|
|
|
}
|
|
|
},
|
|
|
actions: {
|
|
|
async setBranchs ({ commit, state }, force) {
|
|
|
- if (!state.branchs.length || force === true) {
|
|
|
+ if ((!state.branchs.length || force === true) && !loadings.commit_branchs) {
|
|
|
+ loadings.commit_branchs = true
|
|
|
try {
|
|
|
const res = await getEmployeeOrgan()
|
|
|
commit('commit_branchs', res.data)
|
|
|
} catch (error) { }
|
|
|
+ loadings.commit_branchs = false
|
|
|
}
|
|
|
},
|
|
|
async setSubjects ({ commit, state }, force) {
|
|
|
- if (!state.subjects.length || force === true) {
|
|
|
+ if ((!state.subjects.length || force === true) && !loadings.commit_subjects) {
|
|
|
+ loadings.commit_subjects = true
|
|
|
try {
|
|
|
const res = await getSubject({rows: 9999, tenantId: '1'})
|
|
|
commit('commit_subjects', res.data)
|
|
|
} catch (error) { }
|
|
|
+ loadings.commit_subjects = false
|
|
|
}
|
|
|
},
|
|
|
async setTeachers ({ commit, state }, force) {
|
|
|
- if (!state.teachers.length || force === true) {
|
|
|
-
|
|
|
+ if ((!state.teachers.length || force === true) && !loadings.commit_teachers) {
|
|
|
+ loadings.commit_teachers = true
|
|
|
try {
|
|
|
const res = await getTeacher()
|
|
|
commit('commit_teachers', res.data)
|
|
|
} catch (error) { }
|
|
|
+ loadings.commit_teachers = false
|
|
|
}
|
|
|
},
|
|
|
async setSchools ({ commit, state }, force) {
|
|
|
- if (!state.schools.length || force === true) {
|
|
|
+ if ((!state.schools.length || force === true) && !loadings.commit_schools) {
|
|
|
+ loadings.commit_schools = true
|
|
|
try {
|
|
|
const res = await getSchool()
|
|
|
commit('commit_schools', res.data)
|
|
|
} catch (error) { }
|
|
|
+ loadings.commit_schools = false
|
|
|
}
|
|
|
},
|
|
|
async setVipGroupCategory ({ commit, state }, force) {
|
|
|
- if (!state.vipGroupCategory.length || force === true) {
|
|
|
+ if ((!state.vipGroupCategory.length || force === true) && !loadings.commit_vip_group_category) {
|
|
|
+ loadings.commit_vip_group_category = true
|
|
|
try {
|
|
|
const res = await vipGroupCategory()
|
|
|
commit('commit_vip_group_category', res.data)
|
|
|
} catch (error) { }
|
|
|
+ loadings.commit_vip_group_category = false
|
|
|
}
|
|
|
},
|
|
|
async setEducations({commit,state},force){
|
|
|
- if (!state.educations.length || force === true) {
|
|
|
+ if ((!state.educations.length || force === true) && !loadings.commit_educations) {
|
|
|
+ loadings.commit_educations = true
|
|
|
try {
|
|
|
-
|
|
|
const res = await findEducationUsers()
|
|
|
commit('commit_educations', res.data)
|
|
|
} catch (error) { }
|
|
|
+ loadings.commit_educations = false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async setTechnician({commit,state},force){
|
|
|
+ if ((!state.educations.length || force === true) && !loadings.commit_technician) {
|
|
|
+ loadings.commit_technician = true
|
|
|
+ try {
|
|
|
+ const res = await findTechnician()
|
|
|
+ commit('commit_technician', res.data)
|
|
|
+ } catch (error) {}
|
|
|
+ loadings.commit_technician = false
|
|
|
}
|
|
|
}
|
|
|
}
|