a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
<template>
<div class="staff-detail-container">
<el-row :gutter="20">
<el-col :span="18">
<el-card class="box-card">
<div slot="header" class="clearfix flex justify-between">
<span>{{ $t('staffDetailInfo.title') }}</span>
<el-button style="padding: 3px 0" type="text" @click="goBack">
{{ $t('common.back') }}
</el-button>
</div>
<div class="staff-info">
<el-row :gutter="20">
<el-col :span="4">
|
27dcfde5
wuxw
系统全面测试完成
|
15
16
|
<el-image style="width: 120px; height: 140px; border-radius: 4px;" :src="staffDetailInfo.photo"
fit="cover" @error="errorLoadImg">
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
</el-image>
</el-col>
<el-col :span="20">
<el-row :gutter="20">
<el-col :span="8">
<div class="info-item">
<label>{{ $t('staffDetailInfo.staffId') }}</label>
<div>{{ staffDetailInfo.staffId }}</div>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>{{ $t('staffDetailInfo.userName') }}</label>
<div>{{ staffDetailInfo.userName }}</div>
</div>
</el-col>
<el-col :span="8">
<div class="info-item ">
<label>{{ $t('staffDetailInfo.email') }}</label>
<div>{{ staffDetailInfo.email }}</div>
</div>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<div class="info-item">
<label>{{ $t('staffDetailInfo.tel') }}</label>
<div>{{ staffDetailInfo.tel }}</div>
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>{{ $t('staffDetailInfo.sex') }}</label>
|
27dcfde5
wuxw
系统全面测试完成
|
50
51
|
<div>{{ staffDetailInfo.sex == '0' ? $t('staffDetailInfo.male') : $t('staffDetailInfo.female') }}
</div>
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
</div>
</el-col>
<el-col :span="8">
<div class="info-item">
<label>{{ $t('staffDetailInfo.address') }}</label>
<div>{{ staffDetailInfo.address }}</div>
</div>
</el-col>
</el-row>
</el-col>
</el-row>
</div>
</el-card>
<el-card class="box-card margin-top text-left">
<div slot="header" class="clearfix ">
<span>{{ $t('staffDetailInfo.relatedOrg') }}</span>
</div>
|
27dcfde5
wuxw
系统全面测试完成
|
70
|
<div v-for="(item, index) in staffDetailInfo.orgs" :key="index">
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
71
72
73
74
75
76
77
78
|
<div class="org-item">{{ $t('staffDetailInfo.org') }}: {{ item.orgName }}</div>
</div>
</el-card>
<el-card class="box-card margin-top text-left">
<div slot="header" class="clearfix">
<span>{{ $t('staffDetailInfo.relatedRoleCommunity') }}</span>
</div>
|
27dcfde5
wuxw
系统全面测试完成
|
79
80
|
<div v-for="(item, index) in staffDetailInfo.roles" :key="index">
<div v-if="item.roleCommunityDtoList.length > 0">
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
81
|
{{ item.roleName }} (
|
27dcfde5
wuxw
系统全面测试完成
|
82
|
<span v-for="(item1, index1) in item.roleCommunityDtoList" :key="index1">
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
83
|
{{ item1.communityName }}
|
27dcfde5
wuxw
系统全面测试完成
|
84
|
{{ index1 === item.roleCommunityDtoList.length - 1 ? " " : " 、 " }}
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
85
86
87
88
89
90
91
92
93
94
95
96
97
|
</span> )
</div>
</div>
</el-card>
<!-- <staff-map-pos :staff-id="staffDetailInfo.staffId" class="margin-top"></staff-map-pos> -->
</el-col>
<el-col :span="6">
<el-card class="box-card text-left">
<div slot="header" class="clearfix">
<span>{{ $t('staffDetailInfo.staffPrivilege') }}</span>
</div>
|
27dcfde5
wuxw
系统全面测试完成
|
98
|
<el-tree :data="privilegeTreeData" node-key="id" default-expand-all :props="defaultProps">
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
|
</el-tree>
</el-card>
</el-col>
</el-row>
</div>
</template>
<script>
import { getStaffDetail, getStaffOrgs, getStaffRoles, getStaffPrivileges } from '@/api/staff/staffDetailApi'
export default {
name: 'StaffDetailList',
components: {
},
data() {
return {
staffDetailInfo: {
staffId: '',
userName: '',
email: '',
tel: '',
sex: '',
address: '',
photo: '',
orgs: [],
roles: []
},
privilegeTreeData: [],
defaultProps: {
children: 'children',
label: 'text'
}
}
},
created() {
this.staffDetailInfo.staffId = this.$route.query.staffId
this.loadStaffDetail()
this.loadStaffOrgs()
this.loadStaffRoles()
this.loadStaffPrivileges()
},
methods: {
goBack() {
this.$router.go(-1)
},
errorLoadImg() {
this.staffDetailInfo.photo = "/img/noPhoto.jpg"
},
async loadStaffDetail() {
try {
const params = {
page: 1,
row: 1,
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
}
} catch (error) {
this.$message.error(this.$t('staffDetailInfo.fetchError'))
}
},
async loadStaffOrgs() {
try {
const params = {
page: 1,
row: 1,
staffId: this.staffDetailInfo.staffId
}
const res = await getStaffOrgs(params)
if (res.code === 0) {
this.staffDetailInfo.orgs = res.data
}
} catch (error) {
this.$message.error(this.$t('staffDetailInfo.fetchOrgError'))
}
},
async loadStaffRoles() {
try {
const params = {
page: 1,
row: 9999,
staffId: this.staffDetailInfo.staffId
}
const res = await getStaffRoles(params)
if (res.code === 0) {
this.staffDetailInfo.roles = res.data
}
} catch (error) {
this.$message.error(this.$t('staffDetailInfo.fetchRoleError'))
}
},
async loadStaffPrivileges() {
try {
const params = {
staffId: this.staffDetailInfo.staffId
}
const res = await getStaffPrivileges(params)
|
27dcfde5
wuxw
系统全面测试完成
|
199
|
if (res.data && res.data.length > 0) {
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
200
201
202
203
204
205
206
207
|
this.privilegeTreeData = this.buildTreeData(res.data)
}
} catch (error) {
this.$message.error(this.$t('staffDetailInfo.fetchPrivilegeError'))
}
},
buildTreeData(privileges) {
const groupMap = {}
|
27dcfde5
wuxw
系统全面测试完成
|
208
|
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
209
210
211
212
213
214
215
216
217
|
privileges.forEach(item => {
if (!groupMap[item.gId]) {
groupMap[item.gId] = {
id: `g_${item.gId}`,
gId: item.gId,
text: item.gName,
children: []
}
}
|
27dcfde5
wuxw
系统全面测试完成
|
218
|
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
219
220
|
const group = groupMap[item.gId]
const menuExists = group.children.some(menu => menu.mId === item.mId)
|
27dcfde5
wuxw
系统全面测试完成
|
221
|
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
222
223
224
225
226
227
228
229
|
if (!menuExists) {
group.children.push({
id: `m_${item.mId}`,
mId: item.mId,
text: item.mName,
children: []
})
}
|
27dcfde5
wuxw
系统全面测试完成
|
230
|
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
231
232
233
234
235
236
237
|
const menu = group.children.find(menu => menu.mId === item.mId)
menu.children.push({
id: `p_${item.pId}`,
pId: item.pId,
text: item.pName
})
})
|
27dcfde5
wuxw
系统全面测试完成
|
238
|
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
239
240
241
242
243
244
245
246
247
|
return Object.values(groupMap)
}
}
}
</script>
<style lang="scss" scoped>
.staff-detail-container {
padding: 20px;
|
27dcfde5
wuxw
系统全面测试完成
|
248
|
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
249
250
251
|
.margin-top {
margin-top: 20px;
}
|
27dcfde5
wuxw
系统全面测试完成
|
252
|
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
253
254
255
|
.info-item {
margin-bottom: 15px;
|
27dcfde5
wuxw
系统全面测试完成
|
256
|
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
257
258
259
260
261
262
|
label {
display: block;
color: #909399;
margin-bottom: 5px;
}
}
|
27dcfde5
wuxw
系统全面测试完成
|
263
|
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
264
265
266
267
268
|
.org-item {
padding: 5px 0;
}
}
</style>
|