ソースを参照

fix(employee profile): add deptType prop and adjust department data fetch

1. 为员工档案页面的SearchBar组件传入deptType为'user'参数
2. 新增getDeptUserTree接口调用用于获取用户部门树数据
3. 调整部门数据加载逻辑,区分user类型和其他类型的部门数据获取方式
4. 修复部分代码缩进格式问题
huoyi 3 週間 前
コミット
58a3c64762
共有2 個のファイルを変更した10 個の追加7 個の削除を含む
  1. 9 6
      src/views/portraitManagement/components/SearchBar.vue
  2. 1 1
      src/views/portraitManagement/employeeProfile/index.vue

+ 9 - 6
src/views/portraitManagement/components/SearchBar.vue

@@ -44,7 +44,7 @@
44 44
 <script setup>
45 45
 import { onMounted, onUnmounted } from 'vue'
46 46
 import { searchPortraitUsers } from '@/api/score/index'
47
-import { getDeptList } from '@/api/item/items'
47
+import { getDeptList,getDeptUserTree } from '@/api/item/items'
48 48
 import { listDept } from '@/api/system/dept'
49 49
 
50 50
 const props = defineProps({
@@ -140,13 +140,13 @@ const handleNodeClick = (node) => {
140 140
     if (node.deptType === props.deptType) {
141 141
       personName.value = node.deptName || node.name || node.label;
142 142
       let obj = {}
143
-      if(props.deptType === 'BRIGADE') {
143
+      if (props.deptType === 'BRIGADE') {
144 144
         obj = { deptId: node.deptId || node.id }
145
-      } 
146
-      if(props.deptType === 'MANAGER') {
145
+      }
146
+      if (props.deptType === 'MANAGER') {
147 147
         obj = { teamId: node.deptId || node.id }
148 148
       }
149
-      if(props.deptType === 'TEAMS') {
149
+      if (props.deptType === 'TEAMS') {
150 150
         obj = { groupId: node.deptId || node.id }
151 151
       }
152 152
       searchHandler(obj)
@@ -177,10 +177,13 @@ const resetStyle = () => {
177 177
 
178 178
 onMounted(async () => {
179 179
   setStyle()
180
-  const res = await getDeptList({ deptType: props.deptType })
180
+
181 181
   if (props.deptType === 'user') {
182
+    const res = await getDeptUserTree()
182 183
     departments.value = res.data
184
+
183 185
   } else {
186
+    const res = await getDeptList({ deptType: props.deptType })
184 187
     departments.value = filterDeptTree(res.data, props.deptType)
185 188
   }
186 189
 })

+ 1 - 1
src/views/portraitManagement/employeeProfile/index.vue

@@ -2,7 +2,7 @@
2 2
   <Page @click="visible = false" v-loading="loading" element-loading-background="rgba(22, 22, 22, 0.8)">
3 3
     <div class="content">
4 4
       <div class="content-search">
5
-        <SearchBar v-model:visible="visible" @search="searchHandler" />
5
+        <SearchBar v-model:visible="visible" @search="searchHandler" :deptType="'user'" />
6 6
       </div>
7 7
       
8 8
         <div v-show="portrait.personName" class="content-info">