cfel-base-components 2.5.11 → 2.5.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/settings.json +0 -3
- package/demo/src/index.html +3 -4
- package/package.json +1 -1
- package/src/apiRequest/config.ts +2 -2
- package/src/components/layout/index.tsx +4 -14
- package/src/components/layout/user-card/index.scss +8 -31
- package/src/components/layout/user-card/index.tsx +91 -79
- package/src/components/universal-pages/cpcAccount/AddModal/index.tsx +124 -263
- package/src/components/universal-pages/cpcAccount/api.ts +15 -31
- package/src/components/universal-pages/cpcAccount/index.tsx +97 -132
- package/src/components/universal-pages/cpcAccountInfo/index.tsx +1 -3
- package/src/components/universal-pages/cpcRole/AddModal/index.tsx +1 -1
- package/src/components/universal-pages/cpcRole/index.tsx +99 -101
- package/src/components/universal-pages/cpcRoleInfo/index.tsx +29 -16
- package/src/.umi/core/helmet.ts +0 -10
- package/src/.umi/core/helmetContext.ts +0 -4
- package/src/components/universal-pages/cpcAccount/ResetModal/index.tsx +0 -232
|
@@ -1,271 +1,132 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react'
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export default function
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
accountGetAccountPasswordFunc //复制
|
|
2
|
+
import {
|
|
3
|
+
Button, Modal, Form, Input,
|
|
4
|
+
} from 'antd';
|
|
5
|
+
export default function index({
|
|
6
|
+
ModalOpen, //弹框状态
|
|
7
|
+
editOpenStatus, //关闭弹框
|
|
8
|
+
editingData, //编辑数据
|
|
9
|
+
actionFunc, //新增事件
|
|
11
10
|
}: any) {
|
|
12
|
-
|
|
13
|
-
const [passwordType, setPasswordType] = useState('server')
|
|
14
|
-
const [loading, setLoading] = useState(false)
|
|
15
|
-
const [disabledType, setDisabledType] = useState(true)
|
|
16
|
-
const [secondNum, setSecondNum]: any = useState(null) //秒数
|
|
17
|
-
const [showText, setShowText] = useState('')
|
|
18
|
-
const formDom = [
|
|
19
|
-
{ title: '名称', key: 'name', type: 'string', required: true },
|
|
20
|
-
{ title: '账号', key: 'account', type: 'account', required: true },
|
|
21
|
-
{ title: '密码', key: 'passwordType', type: 'psw', required: true },
|
|
22
|
-
{ title: ' ', key: 'password', type: 'pswDiy', required: true },
|
|
23
|
-
{ title: '手机号', key: 'mobile', type: 'mobileint', required: false },
|
|
24
|
-
{ title: '邮箱', key: 'email', type: 'emailstring', required: false }
|
|
25
|
-
]
|
|
26
|
-
const editFormDom = [
|
|
27
|
-
{ title: '名称', key: 'name', type: 'rString', required: false },
|
|
28
|
-
{ title: '账号', key: 'account', type: 'rString', required: false },
|
|
29
|
-
{ title: '密码', key: 'passwordType', type: 'rPswString', required: false },
|
|
30
|
-
{ title: '手机号', key: 'mobile', type: 'rString', required: false },
|
|
31
|
-
{ title: '邮箱', key: 'email', type: 'rString', required: false }
|
|
32
|
-
]
|
|
33
|
-
useEffect(() => {
|
|
34
|
-
clearInterval(timeChange)
|
|
35
|
-
return () => {
|
|
36
|
-
clearInterval(timeChange)
|
|
37
|
-
}
|
|
38
|
-
}, [])
|
|
39
|
-
useEffect(() => {
|
|
40
|
-
if (!editingData) return
|
|
41
|
-
init()
|
|
42
|
-
}, [editingData])
|
|
43
|
-
const init = () => {
|
|
44
|
-
setLoading(false)
|
|
45
|
-
setDisabledType(true)
|
|
46
|
-
setShowText('关闭(4s)')
|
|
47
|
-
timeChange = setInterval(
|
|
48
|
-
() =>
|
|
49
|
-
setSecondNum((t: any) => {
|
|
50
|
-
let num = t
|
|
51
|
-
console.log(t, 't')
|
|
52
|
-
return --num
|
|
53
|
-
}),
|
|
54
|
-
1000
|
|
55
|
-
)
|
|
56
|
-
}
|
|
57
|
-
useEffect(() => {
|
|
58
|
-
console.log(secondNum, 'secondNum')
|
|
59
|
-
if (secondNum > 0 && secondNum <= 3) {
|
|
60
|
-
setShowText(`关闭(${secondNum}s)`)
|
|
61
|
-
} else {
|
|
62
|
-
clearInterval(timeChange)
|
|
63
|
-
setSecondNum(4)
|
|
64
|
-
setDisabledType(false)
|
|
65
|
-
setShowText('关闭')
|
|
66
|
-
}
|
|
67
|
-
}, [secondNum])
|
|
11
|
+
const [form] = Form.useForm();
|
|
68
12
|
|
|
69
|
-
const showCom = ({ title, key, type, required }: any) => {
|
|
70
|
-
let dom: any = null
|
|
71
|
-
switch (type) {
|
|
72
|
-
case 'rString':
|
|
73
|
-
dom = <Form.Item label={title}>{editingData[key]}</Form.Item>
|
|
74
|
-
break
|
|
75
|
-
case 'rPswString':
|
|
76
|
-
dom = (
|
|
77
|
-
<Form.Item label={title}>
|
|
78
|
-
<span>
|
|
79
|
-
********** <a onClick={() => copy()}>复制</a>
|
|
80
|
-
</span>
|
|
81
|
-
</Form.Item>
|
|
82
|
-
)
|
|
83
|
-
break
|
|
84
|
-
case 'string':
|
|
85
|
-
dom = (
|
|
86
|
-
<Form.Item label={title} name={key} rules={[{ required: required, message: '请输入' }]}>
|
|
87
|
-
<Input placeholder='请输入' />
|
|
88
|
-
</Form.Item>
|
|
89
|
-
)
|
|
90
|
-
break
|
|
91
13
|
|
|
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
|
-
break
|
|
152
|
-
case 'mobileint':
|
|
153
|
-
dom = (
|
|
154
|
-
<Form.Item
|
|
155
|
-
label={title}
|
|
156
|
-
name={key}
|
|
157
|
-
rules={[
|
|
158
|
-
{ required: required, message: '请输入' },
|
|
159
|
-
{ pattern: /1[0-9]{10}$/, message: '请输入正确的电话号码' }
|
|
160
|
-
]}
|
|
161
|
-
>
|
|
162
|
-
<Input placeholder='请输入' />
|
|
163
|
-
</Form.Item>
|
|
164
|
-
)
|
|
165
|
-
break
|
|
166
|
-
default:
|
|
167
|
-
break
|
|
14
|
+
const formDom = [
|
|
15
|
+
{ title: "名称", key: 'name', type: 'string', required: true },
|
|
16
|
+
{ title: "手机号", key: 'mobile', type: 'mobileint', required: true },
|
|
17
|
+
{ title: "邮箱", key: 'email', type: 'emailstring', required: false },
|
|
18
|
+
]
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (!ModalOpen) return
|
|
21
|
+
|
|
22
|
+
if (editingData) {
|
|
23
|
+
console.log(editingData, "editingData")
|
|
24
|
+
form.setFieldsValue({
|
|
25
|
+
...editingData
|
|
26
|
+
})
|
|
27
|
+
}
|
|
28
|
+
}, [ModalOpen])
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
const showCom = ({ title, key, type, required }: any) => {
|
|
32
|
+
let dom: any = null
|
|
33
|
+
switch (type) {
|
|
34
|
+
case 'string':
|
|
35
|
+
dom = (<Form.Item
|
|
36
|
+
label={title}
|
|
37
|
+
name={key}
|
|
38
|
+
rules={[{ required: required, message: '请输入' }]}
|
|
39
|
+
>
|
|
40
|
+
<Input placeholder="请输入" />
|
|
41
|
+
</Form.Item>)
|
|
42
|
+
break;
|
|
43
|
+
case 'emailstring':
|
|
44
|
+
dom = (<Form.Item
|
|
45
|
+
label={title}
|
|
46
|
+
name={key}
|
|
47
|
+
rules={[
|
|
48
|
+
{ required: required, message: '请输入' },
|
|
49
|
+
{ pattern: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/, message: '请输入正确的邮箱' }
|
|
50
|
+
]}
|
|
51
|
+
>
|
|
52
|
+
<Input placeholder="请输入" />
|
|
53
|
+
</Form.Item>)
|
|
54
|
+
break;
|
|
55
|
+
case 'mobileint':
|
|
56
|
+
dom = (<Form.Item
|
|
57
|
+
label={title}
|
|
58
|
+
name={key}
|
|
59
|
+
rules={
|
|
60
|
+
editingData ? [{ required: required, message: '请输入' }] : [
|
|
61
|
+
{ required: required, message: '请输入' },
|
|
62
|
+
{ pattern: /1[0-9]{10}$/, message: '请输入正确的电话号码' }
|
|
63
|
+
]}
|
|
64
|
+
>
|
|
65
|
+
<Input placeholder="请输入"
|
|
66
|
+
disabled={editingData ? true : false} />
|
|
67
|
+
</Form.Item>)
|
|
68
|
+
break;
|
|
69
|
+
default:
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
return dom
|
|
168
73
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
id: editingData?.id
|
|
174
|
-
}).then((res: any) => {
|
|
175
|
-
message.success('复制成功')
|
|
176
|
-
navigator.clipboard.writeText(res)
|
|
177
|
-
})
|
|
178
|
-
}
|
|
179
|
-
const closeModel = () => {
|
|
180
|
-
form.resetFields()
|
|
181
|
-
editOpenStatus(false)
|
|
182
|
-
}
|
|
183
|
-
const generateRandomString = (minLength = 8, maxLength = 32) => {
|
|
184
|
-
const length = Math.floor(Math.random() * (maxLength - minLength + 1)) + minLength
|
|
185
|
-
const possibleChars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
|
|
186
|
-
let result = ''
|
|
187
|
-
for (let i = 0; i < length; i++) {
|
|
188
|
-
result += possibleChars.charAt(Math.floor(Math.random() * possibleChars.length))
|
|
74
|
+
|
|
75
|
+
const closeModel = () => {
|
|
76
|
+
form.resetFields()
|
|
77
|
+
editOpenStatus(false)
|
|
189
78
|
}
|
|
190
|
-
return result
|
|
191
|
-
}
|
|
192
79
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
>
|
|
246
|
-
<Form
|
|
247
|
-
form={form}
|
|
248
|
-
layout={editingData ? 'horizontal' : 'vertical'}
|
|
249
|
-
initialValues={{
|
|
250
|
-
remember: true,
|
|
251
|
-
passwordType: 'server'
|
|
252
|
-
}}
|
|
253
|
-
autoComplete='off'
|
|
254
|
-
>
|
|
255
|
-
{editingData ? (
|
|
256
|
-
<>
|
|
257
|
-
{editFormDom.map((item: any, index: number) => {
|
|
258
|
-
return <div key={index}>{showCom(item)}</div>
|
|
259
|
-
})}
|
|
260
|
-
</>
|
|
261
|
-
) : (
|
|
262
|
-
<>
|
|
263
|
-
{formDom.map((item: any, index: number) => {
|
|
264
|
-
return <div key={index}>{showCom(item)}</div>
|
|
265
|
-
})}
|
|
266
|
-
</>
|
|
267
|
-
)}
|
|
268
|
-
</Form>
|
|
269
|
-
</Modal>
|
|
270
|
-
)
|
|
80
|
+
const modelSubmit = () => {
|
|
81
|
+
form.validateFields().then((value) => {
|
|
82
|
+
console.log(value, "value")
|
|
83
|
+
if (editingData) {
|
|
84
|
+
value.id = editingData.id
|
|
85
|
+
}
|
|
86
|
+
actionFunc(value, editingData ? "edit" : "add").then(() => {
|
|
87
|
+
form.resetFields()
|
|
88
|
+
})
|
|
89
|
+
})
|
|
90
|
+
}
|
|
91
|
+
return (
|
|
92
|
+
<Modal title={editingData ? "编辑账号" : "新增账号"}
|
|
93
|
+
destroyOnClose={true}
|
|
94
|
+
open={ModalOpen}
|
|
95
|
+
onCancel={() => {
|
|
96
|
+
closeModel()
|
|
97
|
+
}}
|
|
98
|
+
footer={[
|
|
99
|
+
<Button
|
|
100
|
+
key="refresh"
|
|
101
|
+
onClick={() => {
|
|
102
|
+
closeModel()
|
|
103
|
+
}}
|
|
104
|
+
>
|
|
105
|
+
取消
|
|
106
|
+
</Button>,
|
|
107
|
+
<Button
|
|
108
|
+
key="submit"
|
|
109
|
+
type="primary"
|
|
110
|
+
onClick={() => {
|
|
111
|
+
modelSubmit()
|
|
112
|
+
}}
|
|
113
|
+
>
|
|
114
|
+
确定
|
|
115
|
+
</Button>,
|
|
116
|
+
]}
|
|
117
|
+
>
|
|
118
|
+
<Form
|
|
119
|
+
form={form}
|
|
120
|
+
layout={'vertical'}
|
|
121
|
+
initialValues={{ remember: true }}
|
|
122
|
+
autoComplete="off"
|
|
123
|
+
>
|
|
124
|
+
{
|
|
125
|
+
formDom.map((item: any, index: number) => {
|
|
126
|
+
return <div key={index}>{showCom(item)}</div>
|
|
127
|
+
})
|
|
128
|
+
}
|
|
129
|
+
</Form>
|
|
130
|
+
</Modal>
|
|
131
|
+
)
|
|
271
132
|
}
|
|
@@ -1,34 +1,18 @@
|
|
|
1
1
|
import request from "../../../apiRequest/config"
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
//分页查询账号
|
|
5
|
-
export const accountPage
|
|
6
|
-
return request.post(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return request.post(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return request.post(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return request.get(
|
|
19
|
-
|
|
20
|
-
})
|
|
21
|
-
}
|
|
22
|
-
//按账号id查询账号信息
|
|
23
|
-
export const accountGetAccount = (data?: any) => {
|
|
24
|
-
return request.post('/sdk/permission/rbac/console/account/getAccount.json', { ...data })
|
|
25
|
-
}
|
|
26
|
-
//按账号id查询账号信息
|
|
27
|
-
export const accountGetAccountPassword = (data?: any) => {
|
|
28
|
-
return request.post('/sdk/permission/rbac/console/account/getAccountPassword.json', { ...data })
|
|
29
|
-
}
|
|
30
|
-
//按账号id查询账号信息
|
|
31
|
-
export const accountResetPw = (data?: any) => {
|
|
32
|
-
return request.post('/sdk/permission/rbac/console/account/resetPw.json', { ...data })
|
|
33
|
-
}
|
|
34
|
-
|
|
4
|
+
export const accountPage= (data?: any) => {
|
|
5
|
+
return request.post("/api/permission/account/page.json", { ...data })
|
|
6
|
+
}
|
|
7
|
+
//指定租户下创建账号
|
|
8
|
+
export const accountCreateAccount = (data?: any) => {
|
|
9
|
+
return request.post("/api/permission/account/createAccount.json", { ...data })
|
|
10
|
+
}
|
|
11
|
+
//指定租户下修改账号
|
|
12
|
+
export const accountUpdateAccount = (data?: any) => {
|
|
13
|
+
return request.post("/api/permission/account/updateAccount.json", { ...data })
|
|
14
|
+
}
|
|
15
|
+
//指定租户下删除账号
|
|
16
|
+
export const accountDeleteAccount = (data?: any) => {
|
|
17
|
+
return request.get("/api/permission/account/deleteAccount.json", { params:{...data} })
|
|
18
|
+
}
|