Commit 6b909af0765b45f95ba012e2bbbc107bb51ebaa9
1 parent
b8ac379c
v1.9 优化员工详情页面
Showing
2 changed files
with
11 additions
and
17 deletions
src/api/staff/staffDetailApi.js
| ... | ... | @@ -9,11 +9,7 @@ export function getStaffDetail(params) { |
| 9 | 9 | params |
| 10 | 10 | }).then(response => { |
| 11 | 11 | const res = response.data |
| 12 | - if (res.code === 0) { | |
| 13 | 12 | resolve(res) |
| 14 | - } else { | |
| 15 | - reject(new Error(res.msg || '获取员工详情失败')) | |
| 16 | - } | |
| 17 | 13 | }).catch(error => { |
| 18 | 14 | reject(error) |
| 19 | 15 | }) |
| ... | ... | @@ -49,11 +45,8 @@ export function getStaffRoles(params) { |
| 49 | 45 | params |
| 50 | 46 | }).then(response => { |
| 51 | 47 | const res = response.data |
| 52 | - if (res.code === 0) { | |
| 53 | 48 | resolve(res) |
| 54 | - } else { | |
| 55 | - reject(new Error(res.msg || '获取员工角色失败')) | |
| 56 | - } | |
| 49 | + | |
| 57 | 50 | }).catch(error => { |
| 58 | 51 | reject(error) |
| 59 | 52 | }) |
| ... | ... | @@ -64,7 +57,7 @@ export function getStaffRoles(params) { |
| 64 | 57 | export function getStaffPrivileges(params) { |
| 65 | 58 | return new Promise((resolve, reject) => { |
| 66 | 59 | request({ |
| 67 | - url: '/privilege.queryStaffPrivileges', | |
| 60 | + url: '/query.user.privilege', | |
| 68 | 61 | method: 'get', |
| 69 | 62 | params |
| 70 | 63 | }).then(response => { | ... | ... |
src/views/staff/staffDetailList.vue
| ... | ... | @@ -77,12 +77,13 @@ |
| 77 | 77 | <span>{{ $t('staffDetailInfo.relatedRoleCommunity') }}</span> |
| 78 | 78 | </div> |
| 79 | 79 | <div v-for="(item, index) in staffDetailInfo.roles" :key="index"> |
| 80 | - <div v-if="item.roleCommunityDtoList.length > 0"> | |
| 81 | - {{ item.roleName }} ( | |
| 80 | + <div class="flex justify-start"> | |
| 81 | + <div> {{ item.roleName }} </div> <div v-if="item.roleCommunityDtoList.length > 0">( | |
| 82 | 82 | <span v-for="(item1, index1) in item.roleCommunityDtoList" :key="index1"> |
| 83 | 83 | {{ item1.communityName }} |
| 84 | 84 | {{ index1 === item.roleCommunityDtoList.length - 1 ? " " : " 、 " }} |
| 85 | 85 | </span> ) |
| 86 | + </div> | |
| 86 | 87 | </div> |
| 87 | 88 | </div> |
| 88 | 89 | </el-card> |
| ... | ... | @@ -152,9 +153,9 @@ export default { |
| 152 | 153 | staffId: this.staffDetailInfo.staffId |
| 153 | 154 | } |
| 154 | 155 | const res = await getStaffDetail(params) |
| 155 | - if (res.code === 0 && res.data.length > 0) { | |
| 156 | - Object.assign(this.staffDetailInfo, res.data[0]) | |
| 157 | - this.staffDetailInfo.photo = res.data[0].faceUrl | |
| 156 | + if ( res.staffs.length > 0) { | |
| 157 | + Object.assign(this.staffDetailInfo, res.staffs[0]) | |
| 158 | + this.staffDetailInfo.photo = res.staffs[0].faceUrl | |
| 158 | 159 | } |
| 159 | 160 | } catch (error) { |
| 160 | 161 | this.$message.error(this.$t('staffDetailInfo.fetchError')) |
| ... | ... | @@ -183,7 +184,7 @@ export default { |
| 183 | 184 | staffId: this.staffDetailInfo.staffId |
| 184 | 185 | } |
| 185 | 186 | const res = await getStaffRoles(params) |
| 186 | - if (res.code === 0) { | |
| 187 | + if (res.code == 0) { | |
| 187 | 188 | this.staffDetailInfo.roles = res.data |
| 188 | 189 | } |
| 189 | 190 | } catch (error) { |
| ... | ... | @@ -196,8 +197,8 @@ export default { |
| 196 | 197 | staffId: this.staffDetailInfo.staffId |
| 197 | 198 | } |
| 198 | 199 | const res = await getStaffPrivileges(params) |
| 199 | - if (res.data && res.data.length > 0) { | |
| 200 | - this.privilegeTreeData = this.buildTreeData(res.data) | |
| 200 | + if (res.datas && res.datas.length > 0) { | |
| 201 | + this.privilegeTreeData = this.buildTreeData(res.datas) | |
| 201 | 202 | } |
| 202 | 203 | } catch (error) { |
| 203 | 204 | this.$message.error(this.$t('staffDetailInfo.fetchPrivilegeError')) | ... | ... |