AddPersonDialog.ets
1.7 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
import { companyAdd, beanType } from '../api/user'
import { addType } from '../api/userType'
import { promptAction } from '@kit.ArkUI'
import { AxiosResponse } from '@ohos/axios'
@CustomDialog
export default struct AddPersonDialog {
controller: CustomDialogController = new CustomDialogController({builder: ''})
@State addForm : addType = {
personName: '',
idNo: ''
}
build() {
Column(){
Text('添加人员').margin({top: 20})
Row(){
Row(){
Image($r('app.media.require')).width(20)
Text('姓名')
}.width(90)
TextInput({placeholder: '请输入姓名', text: $$this.addForm.personName})
.backgroundColor('#fff').layoutWeight(1)
}.border({width: {bottom: 1}, color: '#eee'}).padding({top: 10, bottom: 10})
Row(){
Row(){
Image($r('app.media.require')).width(20)
Text('身份证号')
}.width(90)
TextInput({placeholder: '请输入身份证号', text: $$this.addForm.idNo})
.backgroundColor('#fff').layoutWeight(1)
}.border({width: {bottom: 1}, color: '#eee'}).padding({top: 10, bottom: 10})
Row(){
Text('取消').layoutWeight(1).fontSize(16).height(60).fontColor('#606266')
.textAlign(TextAlign.Center)
.onClick(() => {
this.controller.close()
})
Text('确定').layoutWeight(1).fontSize(16).height(60).fontColor('#1890ff')
.textAlign(TextAlign.Center)
.onClick(async () => {
const res: AxiosResponse<beanType> = await companyAdd(this.addForm)
promptAction.showToast({message: res.data.msg})
this.controller.close()
})
}
}.width('100%').backgroundColor('#fff')
}
}