Commit 6b909af0765b45f95ba012e2bbbc107bb51ebaa9

Authored by wuxw
1 parent b8ac379c

v1.9 优化员工详情页面

src/api/staff/staffDetailApi.js
@@ -9,11 +9,7 @@ export function getStaffDetail(params) { @@ -9,11 +9,7 @@ export function getStaffDetail(params) {
9 params 9 params
10 }).then(response => { 10 }).then(response => {
11 const res = response.data 11 const res = response.data
12 - if (res.code === 0) {  
13 resolve(res) 12 resolve(res)
14 - } else {  
15 - reject(new Error(res.msg || '获取员工详情失败'))  
16 - }  
17 }).catch(error => { 13 }).catch(error => {
18 reject(error) 14 reject(error)
19 }) 15 })
@@ -49,11 +45,8 @@ export function getStaffRoles(params) { @@ -49,11 +45,8 @@ export function getStaffRoles(params) {
49 params 45 params
50 }).then(response => { 46 }).then(response => {
51 const res = response.data 47 const res = response.data
52 - if (res.code === 0) {  
53 resolve(res) 48 resolve(res)
54 - } else {  
55 - reject(new Error(res.msg || '获取员工角色失败'))  
56 - } 49 +
57 }).catch(error => { 50 }).catch(error => {
58 reject(error) 51 reject(error)
59 }) 52 })
@@ -64,7 +57,7 @@ export function getStaffRoles(params) { @@ -64,7 +57,7 @@ export function getStaffRoles(params) {
64 export function getStaffPrivileges(params) { 57 export function getStaffPrivileges(params) {
65 return new Promise((resolve, reject) => { 58 return new Promise((resolve, reject) => {
66 request({ 59 request({
67 - url: '/privilege.queryStaffPrivileges', 60 + url: '/query.user.privilege',
68 method: 'get', 61 method: 'get',
69 params 62 params
70 }).then(response => { 63 }).then(response => {
src/views/staff/staffDetailList.vue
@@ -77,12 +77,13 @@ @@ -77,12 +77,13 @@
77 <span>{{ $t('staffDetailInfo.relatedRoleCommunity') }}</span> 77 <span>{{ $t('staffDetailInfo.relatedRoleCommunity') }}</span>
78 </div> 78 </div>
79 <div v-for="(item, index) in staffDetailInfo.roles" :key="index"> 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 <span v-for="(item1, index1) in item.roleCommunityDtoList" :key="index1"> 82 <span v-for="(item1, index1) in item.roleCommunityDtoList" :key="index1">
83 {{ item1.communityName }} 83 {{ item1.communityName }}
84 {{ index1 === item.roleCommunityDtoList.length - 1 ? " " : " 、 " }} 84 {{ index1 === item.roleCommunityDtoList.length - 1 ? " " : " 、 " }}
85 </span> ) 85 </span> )
  86 + </div>
86 </div> 87 </div>
87 </div> 88 </div>
88 </el-card> 89 </el-card>
@@ -152,9 +153,9 @@ export default { @@ -152,9 +153,9 @@ export default {
152 staffId: this.staffDetailInfo.staffId 153 staffId: this.staffDetailInfo.staffId
153 } 154 }
154 const res = await getStaffDetail(params) 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 } catch (error) { 160 } catch (error) {
160 this.$message.error(this.$t('staffDetailInfo.fetchError')) 161 this.$message.error(this.$t('staffDetailInfo.fetchError'))
@@ -183,7 +184,7 @@ export default { @@ -183,7 +184,7 @@ export default {
183 staffId: this.staffDetailInfo.staffId 184 staffId: this.staffDetailInfo.staffId
184 } 185 }
185 const res = await getStaffRoles(params) 186 const res = await getStaffRoles(params)
186 - if (res.code === 0) { 187 + if (res.code == 0) {
187 this.staffDetailInfo.roles = res.data 188 this.staffDetailInfo.roles = res.data
188 } 189 }
189 } catch (error) { 190 } catch (error) {
@@ -196,8 +197,8 @@ export default { @@ -196,8 +197,8 @@ export default {
196 staffId: this.staffDetailInfo.staffId 197 staffId: this.staffDetailInfo.staffId
197 } 198 }
198 const res = await getStaffPrivileges(params) 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 } catch (error) { 203 } catch (error) {
203 this.$message.error(this.$t('staffDetailInfo.fetchPrivilegeError')) 204 this.$message.error(this.$t('staffDetailInfo.fetchPrivilegeError'))