PersonDetail.ets
6.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
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
import AreaPickerDialog from '../dialog/AreaPickerDialog'
import { personData, personTest } from '../api/userType'
import baseUrl from '../utils/baseUrl'
import { router } from '@kit.ArkUI';
import { AxiosResponse } from '@ohos/axios'
import NavHeader from '../components/NavHeader'
import { getPersonDetail } from '../api/user'
interface routerQuery {
personId: number
}
let getTextInfo = (state: string | null) => {
if(state == '0') {
return '离职'
} else if(state == '1') {
return '待确定'
} else if(state == '2') {
return '在职'
} else {
return ''
}
}
let routerParams = router.getParams() as routerQuery
let personId = routerParams.personId
@Entry
@Component
struct EditUser {
@Builder indicatorBuilder(icon: ResourceStr) {
Image(icon)
}
@State isShowCode: boolean = false
@State userInfo: personData = {
createBy: '',
createTime: '',
updateBy: '',
updateTime: '',
remark: '',
personId: 0,
personName: '',
email: '',
gender: '',
birthDate: '',
idNo: '',
phone: '',
personalImg: '',
idImgFront: '',
idImgBack: '',
address: '',
userId: 0,
username: '',
state: '',
companyId: 0,
}
@State pickerValue:string[] = ['广西壮族自治区','南宁市','青秀区']//省市区选中值
areaController: CustomDialogController = new CustomDialogController({
builder: AreaPickerDialog({
value:this.pickerValue,//首次默认选中值
onChange: (value:string[]) => {//选择改变回调
this.pickerValue = value
this.userInfo.address = this.pickerValue.join(' ')
}
}),
customStyle: true
})
async aboutToAppear(){
let res: AxiosResponse<personTest> = await getPersonDetail(personId)
this.userInfo = res.data.data
}
build() {
Column(){
NavHeader({title: '个人信息'})
Column(){
Column(){
Row(){
Row(){
Text().width(3).height(16).backgroundColor('#1890ff').margin({right: 10})
Text('基本信息').fontSize(12).fontColor('#999')
}
}.border({width: {bottom: 1}, color: '#eee'}).justifyContent(FlexAlign.Start).width('100%').padding({top: 10, bottom: 10})
Row(){
Row(){
Text('姓名').fontSize(14).fontColor('#999')
}.width(90)
Text(this.userInfo.personName).fontSize(12).fontColor('#999')
}.border({width: {bottom: 1}, color: '#eee'}).padding({top: 10, bottom: 10}).width('100%')
.justifyContent(FlexAlign.SpaceBetween)
Row(){
Row(){
Text('员工状态').fontSize(14).fontColor('#999')
}.width(90)
Text(getTextInfo(this.userInfo.state || '2')).fontSize(12).fontColor('#999')
}.border({width: {bottom: 1}, color: '#eee'}).padding({top: 10, bottom: 10}).width('100%')
.justifyContent(FlexAlign.SpaceBetween)
Row(){
Row(){
Text('邮箱').fontSize(14).fontColor('#999')
}.width(90)
Text(this.userInfo.email).fontSize(12).fontColor('#999')
}.border({width: {bottom: 1}, color: '#eee'}).padding({top: 10, bottom: 10}).width('100%')
.justifyContent(FlexAlign.SpaceBetween)
Row(){
Row(){
Text('性别').fontSize(14).fontColor('#999')
}.width(90)
Text(this.userInfo.gender == '0' ? '男': '女').fontSize(12).fontColor('#999')
}.border({width: {bottom: 1}, color: '#eee'}).padding({top: 10, bottom: 10}).width('100%')
.justifyContent(FlexAlign.SpaceBetween)
Row(){
Row(){
Text('出生日期').fontSize(14).fontColor('#999')
}.width(90)
Text(this.userInfo.birthDate).fontSize(12).fontColor('#999')
}.border({width: {bottom: 1}, color: '#eee'}).padding({top: 10, bottom: 10}).width('100%')
.justifyContent(FlexAlign.SpaceBetween)
Row(){
Row(){
Text('身份证号').fontSize(14).fontColor('#999')
}.width(90)
Text(this.userInfo.idNo).fontSize(12).fontColor('#999')
}.border({width: {bottom: 1}, color: '#eee'}).padding({top: 10, bottom: 10}).width('100%')
.justifyContent(FlexAlign.SpaceBetween)
Row(){
Row(){
Text('手机号').fontSize(14).fontColor('#999')
}.width(90)
Text(this.userInfo.phone).fontSize(12).fontColor('#999')
}.border({width: {bottom: 1}, color: '#eee'}).padding({top: 10, bottom: 10}).width('100%')
.justifyContent(FlexAlign.SpaceBetween)
Row(){
Row(){
Text('个人照片').fontSize(14).fontColor('#999')
}.width(90)
Row(){
Image(baseUrl + this.userInfo.personalImg || $r('app.media.userAvatar')).width(60)
}.margin({left: 20})
}.border({width: {bottom: 1}, color: '#eee'}).padding({top: 10, bottom: 10}).width('100%')
.justifyContent(FlexAlign.SpaceBetween).height(80)
Row(){
Row(){
Text('证件正面').fontSize(14).fontColor('#999')
}.width(90)
Row(){
Image(baseUrl + this.userInfo.idImgFront || $r('app.media.idCard')).width(60)
}.margin({left: 20})
}.border({width: {bottom: 1}, color: '#eee'}).padding({top: 10, bottom: 10}).width('100%')
.justifyContent(FlexAlign.SpaceBetween).height(80)
Row(){
Row(){
Text('证件反面').fontSize(14).fontColor('#999')
}.width(90)
Row(){
Image(baseUrl + this.userInfo.idImgBack || $r('app.media.unIdCard')).width(60)
}.margin({left: 20})
}.border({width: {bottom: 1}, color: '#eee'}).padding({top: 10, bottom: 10}).width('100%')
.justifyContent(FlexAlign.SpaceBetween).height(80)
Row(){
Row(){
Text('地址').fontSize(14).fontColor('#999')
}.width(70)
Text(this.pickerValue.join(' ')).padding({top: 8, bottom: 8, left: 16, right: 16}).fontSize(12).fontColor('#999')
.backgroundColor('#fff').fontColor('#999').textOverflow({overflow: TextOverflow.Ellipsis}).maxLines(2)
}.padding({top: 10, bottom: 10}).justifyContent(FlexAlign.SpaceBetween).width('100%')
}.backgroundColor('#fff').width('100%').height('100%').padding({left: 10, right: 10}).borderRadius(10)
}.padding(10).margin({bottom: 20, top: 10})
}.width('100%').height('100%').backgroundColor('#f2f3f7')
}
}