Kaynağa Gözat

交接完成

wolyshaw 4 yıl önce
ebeveyn
işleme
bb59cb9ede

+ 37 - 10
src/store/modules/selects.js

@@ -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
       }
     }
   }

+ 9 - 0
src/views/categroyManager/insideSetting/api.js

@@ -17,3 +17,12 @@ export const employeeLevelDetail = data => {
     params: data
   })
 }
+
+// 获取所有员工
+export const employeeFindEmployeeByRole = data => {
+  return request2({
+    url: '/api-web/employee/queryEmployByOrganId',
+    method: 'get',
+    params: data
+  })
+}

+ 44 - 13
src/views/categroyManager/insideSetting/modals/handover.vue

@@ -1,5 +1,5 @@
 <template>
-  <div>
+  <div v-loading="loading">
     <el-form ref="form" inline :model="form" v-if="!isEmpty">
       <template v-for="(item, key) in form">
         <select-user
@@ -8,7 +8,8 @@
           :name="key"
           :item="item"
           :branchsyId="branchsyId"
-          :teachersByOrganId="teachersByOrganId"
+          :employeeByOrganId="employeeByOrganId"
+          :technicianByOrganId="technicianByOrganId"
         />
       </template>
     </el-form>
@@ -23,7 +24,7 @@
 </template>
 <script>
 import { array2object } from '@/helpers/utils'
-import { employeeLevelDetail, employeeLevel } from '../api'
+import { employeeLevelDetail, employeeLevel, employeeFindEmployeeByRole } from '../api'
 import selectUser from './select-user'
 export default {
   props: ['detail'],
@@ -38,7 +39,9 @@ export default {
         director: [],
         education: [],
         teamTeacher: [],
-      }
+      },
+      employees: [],
+      loading: false,
     }
   },
   computed: {
@@ -57,20 +60,38 @@ export default {
     branchsyId() {
       return array2object(this.selects.branchs, 'id')
     },
-    teachersByOrganId() {
+    technicianByOrganId() {
+      const data = {}
+      for (const item of this.selects.technician) {
+        if (item.organIdList) {
+          for (const organId of item.organIdList) {
+            if (!data[organId]) {
+              data[organId] = []
+            }
+            data[organId].push(item)
+          }
+        }
+      }
+      return data
+    },
+    employeeByOrganId() {
       const data = {}
-      for (const item of this.selects.teachers) {
-        if (!data[item.organId]) {
-          data[item.organId] = []
+      for (const item of this.employees) {
+        if (item.organIdList) {
+          for (const organId of item.organIdList) {
+            if (!data[organId]) {
+              data[organId] = []
+            }
+            data[organId].push(item)
+          }
         }
-        data[item.organId].push(item)
       }
       return data
     }
   },
-  mounted() {
+  async mounted() {
     this.$store.dispatch('setBranchs')
-    this.$store.dispatch('setTeachers')
+    this.$store.dispatch('setTechnician')
     this.FetchDetail()
   },
   methods: {
@@ -101,9 +122,18 @@ export default {
       })
     },
     async FetchDetail() {
+      this.loading = true
       try {
-        const res = await employeeLevelDetail({
-          userId: this.detail.id
+        const res = await Promise.all([
+          employeeFindEmployeeByRole({
+            rows: 99999
+          }),
+          employeeLevelDetail({
+            userId: this.detail.id
+          })
+        ]).then(res => {
+          this.employees = res[0].data.rows
+          return res[1]
         })
         this.list = res.data
         for (const key in res.data) {
@@ -120,6 +150,7 @@ export default {
         }
         this.form = this.form
       } catch (error) {}
+      this.loading = false
     }
   }
 };

+ 5 - 2
src/views/categroyManager/insideSetting/modals/select-user.vue

@@ -28,7 +28,7 @@
               filterable
             >
               <el-option
-                v-for="option in teachersByOrganId[row.organId]"
+                v-for="option in options[row.organId]"
                 :key="option.id"
                 :value="option.id"
                 :label="option.realName"
@@ -51,7 +51,7 @@
 <script>
 import { employeeLevelDetail, employeeLevel } from '../api'
 export default {
-  props: ['item', 'name', 'branchsyId', 'teachersByOrganId'],
+  props: ['item', 'name', 'branchsyId', 'employeeByOrganId', 'technicianByOrganId'],
   computed: {
     formatName() {
       const types = {
@@ -61,6 +61,9 @@ export default {
         teamTeacher: '运营主管',
       }
       return types[this.name]
+    },
+    options() {
+      return this.name === 'repair' ? this.technicianByOrganId : this.employeeByOrganId
     }
   },
   methods: {