v1.9 优化员工详情页面

This commit is contained in:
wuxw 2025-08-01 16:23:33 +08:00
parent b8ac379c1b
commit 6b909af076
2 changed files with 11 additions and 17 deletions

View File

@ -9,11 +9,7 @@ export function getStaffDetail(params) {
params
}).then(response => {
const res = response.data
if (res.code === 0) {
resolve(res)
} else {
reject(new Error(res.msg || '获取员工详情失败'))
}
}).catch(error => {
reject(error)
})
@ -49,11 +45,8 @@ export function getStaffRoles(params) {
params
}).then(response => {
const res = response.data
if (res.code === 0) {
resolve(res)
} else {
reject(new Error(res.msg || '获取员工角色失败'))
}
}).catch(error => {
reject(error)
})
@ -64,7 +57,7 @@ export function getStaffRoles(params) {
export function getStaffPrivileges(params) {
return new Promise((resolve, reject) => {
request({
url: '/privilege.queryStaffPrivileges',
url: '/query.user.privilege',
method: 'get',
params
}).then(response => {

View File

@ -77,12 +77,13 @@
<span>{{ $t('staffDetailInfo.relatedRoleCommunity') }}</span>
</div>
<div v-for="(item, index) in staffDetailInfo.roles" :key="index">
<div v-if="item.roleCommunityDtoList.length > 0">
{{ item.roleName }} (
<div class="flex justify-start">
<div> {{ item.roleName }} </div> <div v-if="item.roleCommunityDtoList.length > 0">(
<span v-for="(item1, index1) in item.roleCommunityDtoList" :key="index1">
{{ item1.communityName }}
{{ index1 === item.roleCommunityDtoList.length - 1 ? " " : " 、 " }}
</span> )
</div>
</div>
</div>
</el-card>
@ -152,9 +153,9 @@ export default {
staffId: this.staffDetailInfo.staffId
}
const res = await getStaffDetail(params)
if (res.code === 0 && res.data.length > 0) {
Object.assign(this.staffDetailInfo, res.data[0])
this.staffDetailInfo.photo = res.data[0].faceUrl
if ( res.staffs.length > 0) {
Object.assign(this.staffDetailInfo, res.staffs[0])
this.staffDetailInfo.photo = res.staffs[0].faceUrl
}
} catch (error) {
this.$message.error(this.$t('staffDetailInfo.fetchError'))
@ -183,7 +184,7 @@ export default {
staffId: this.staffDetailInfo.staffId
}
const res = await getStaffRoles(params)
if (res.code === 0) {
if (res.code == 0) {
this.staffDetailInfo.roles = res.data
}
} catch (error) {
@ -196,8 +197,8 @@ export default {
staffId: this.staffDetailInfo.staffId
}
const res = await getStaffPrivileges(params)
if (res.data && res.data.length > 0) {
this.privilegeTreeData = this.buildTreeData(res.data)
if (res.datas && res.datas.length > 0) {
this.privilegeTreeData = this.buildTreeData(res.datas)
}
} catch (error) {
this.$message.error(this.$t('staffDetailInfo.fetchPrivilegeError'))