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

View File

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