|
@@ -10,47 +10,58 @@ import './style.less'
|
10
|
10
|
|
11
|
11
|
|
12
|
12
|
export default (props) => {
|
13
|
|
- const [phone, setPhone] = useState('')
|
|
13
|
+ const [phone, setPhone] = useState('18052044111')
|
14
|
14
|
|
15
|
15
|
const { deptName, person, sessionKey, setFormValue, formValue } = useModel('userData')
|
16
|
16
|
console.log('formValue', formValue);
|
17
|
17
|
let form = null
|
|
18
|
+ useEffect(() => {
|
|
19
|
+ form.getFieldsValue(person)
|
|
20
|
+ }, [person])
|
18
|
21
|
const onSubmit = (e) => {
|
19
|
22
|
form.validateFields((errorMessage, fieldValues) => {
|
20
|
23
|
if (errorMessage && errorMessage.length) {
|
|
24
|
+ console.info('fieldValues', fieldValues)
|
|
25
|
+
|
21
|
26
|
return console.info('errorMessage', errorMessage)
|
22
|
27
|
} else {
|
23
|
|
- console.info(fieldValues)
|
|
28
|
+ console.info('fieldValues', fieldValues)
|
24
|
29
|
// setFormValue(fieldValues)
|
25
|
30
|
// Taro.redirectTo({
|
26
|
31
|
// url: '/pages/index/index'
|
27
|
32
|
// })
|
28
|
|
- setUserInfo({ ...fieldValues, person: person?.personId }).then(() => {
|
29
|
|
- setFormValue(fieldValues)
|
30
|
|
-
|
31
|
|
- Taro.showToast({
|
32
|
|
- title: '保存成功',
|
33
|
|
- icon: 'none',
|
34
|
|
- duration: 2000
|
35
|
|
- }).then(() => {
|
36
|
|
- Taro.redirectTo({
|
37
|
|
- url: '/pages/index/index'
|
38
|
|
- })
|
39
|
|
- })
|
|
33
|
+ // setUserInfo({ ...fieldValues, person: person?.personId, deptCode: deptName?.id }).then(() => {
|
|
34
|
+ // // setFormValue(fieldValues)
|
|
35
|
+
|
|
36
|
+ // Taro.showToast({
|
|
37
|
+ // title: '保存成功',
|
|
38
|
+ // icon: 'none',
|
|
39
|
+ // duration: 2000
|
|
40
|
+ // }).then(() => {
|
|
41
|
+ // Taro.redirectTo({
|
|
42
|
+ // url: '/pages/index/index'
|
|
43
|
+ // })
|
|
44
|
+ // })
|
40
|
45
|
|
41
|
|
- })
|
|
46
|
+ // })
|
42
|
47
|
|
43
|
48
|
}
|
44
|
49
|
})
|
45
|
|
-
|
46
|
|
-
|
47
|
50
|
}
|
|
51
|
+
|
48
|
52
|
const goDepartmen = () => {
|
49
|
53
|
Taro.navigateTo({
|
50
|
54
|
url: '/pages/DepartmentSelection/index'
|
51
|
55
|
})
|
52
|
56
|
|
53
|
57
|
}
|
|
58
|
+
|
|
59
|
+ useEffect(() => {
|
|
60
|
+ console.log('form', form);
|
|
61
|
+ form.setFields(person)
|
|
62
|
+ }, [person])
|
|
63
|
+
|
|
64
|
+
|
54
|
65
|
const getPhone = (e) => {
|
55
|
66
|
console.log('deptName', deptName);
|
56
|
67
|
console.log('手机号', e);
|
|
@@ -65,14 +76,6 @@ export default (props) => {
|
65
|
76
|
return (
|
66
|
77
|
<View className='page-index'>
|
67
|
78
|
<Form
|
68
|
|
- initialValues={{
|
69
|
|
- // ...formValue,
|
70
|
|
- // phone: formValue?.phone || phone,
|
71
|
|
- phone: phone,
|
72
|
|
- deptName: deptName
|
73
|
|
-
|
74
|
|
-
|
75
|
|
- }}
|
76
|
79
|
ref={(el) => (form = el)}
|
77
|
80
|
onFinish={(e) => onSubmit(e)}
|
78
|
81
|
>
|
|
@@ -82,7 +85,6 @@ export default (props) => {
|
82
|
85
|
required
|
83
|
86
|
trigger='onInput'
|
84
|
87
|
validateTrigger='onBlur'
|
85
|
|
- // taro的input的onInput事件返回对应表单的最终值为e.detail.value
|
86
|
88
|
valueFormat={(e) => e.detail.value}
|
87
|
89
|
>
|
88
|
90
|
<Input placeholder='请输入用户名' />
|
|
@@ -94,9 +96,7 @@ export default (props) => {
|
94
|
96
|
required
|
95
|
97
|
validateTrigger='onBlur'
|
96
|
98
|
valueFormat={(e) => e.detail.value}
|
97
|
|
- >
|
98
|
|
- <Input placeholder='请输入手机号' type='number' maxlength={11} disabled value={formValue?.phone || phone} />
|
99
|
|
- <Button
|
|
99
|
+ renderRight={<Button
|
100
|
100
|
plain
|
101
|
101
|
hairline
|
102
|
102
|
size='small'
|
|
@@ -106,7 +106,11 @@ export default (props) => {
|
106
|
106
|
onGetPhoneNumber={getPhone}
|
107
|
107
|
>
|
108
|
108
|
授权手机
|
109
|
|
- </Button>
|
|
109
|
+ </Button>}
|
|
110
|
+ >
|
|
111
|
+ <Input placeholder='请输入手机号' maxlength={11} disabled />
|
|
112
|
+
|
|
113
|
+
|
110
|
114
|
</FormItem>
|
111
|
115
|
|
112
|
116
|
<FormItem
|
|
@@ -115,7 +119,6 @@ export default (props) => {
|
115
|
119
|
required
|
116
|
120
|
trigger='onInput'
|
117
|
121
|
validateTrigger='onBlur'
|
118
|
|
- // taro的input的onInput事件返回对应表单的最终值为e.detail.value
|
119
|
122
|
valueFormat={(e) => e.detail.value}
|
120
|
123
|
>
|
121
|
124
|
<Input placeholder='请输入身份证号' type='number' maxlength={18} />
|
|
@@ -127,10 +130,9 @@ export default (props) => {
|
127
|
130
|
trigger='onInput'
|
128
|
131
|
required
|
129
|
132
|
validateTrigger='onBlur'
|
130
|
|
- // taro的input的onInput事件返回对应表单的最终值为e.detail.value
|
131
|
133
|
valueFormat={(e) => e.detail.value}
|
132
|
134
|
>
|
133
|
|
- <Input placeholder='请选择科室' disabled onClick={goDepartmen} />
|
|
135
|
+ <Input placeholder='请选择科室' onClick={goDepartmen} disabled />
|
134
|
136
|
</FormItem>
|
135
|
137
|
<View className='buttom-box'>
|
136
|
138
|
<Button
|