cfel-base-components 2.5.13 → 2.5.14
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/package.json +1 -1
- package/src/apiRequest/config.ts +2 -2
- package/src/components/universal-pages/cpcAccount/AddModal/index.tsx +54 -9
- package/src/components/universal-pages/cpcAccount/EditNameModal/index.tsx +97 -0
- package/src/components/universal-pages/cpcAccount/ResetModal/index.tsx +9 -1
- package/src/components/universal-pages/cpcAccount/api.ts +4 -0
- package/src/components/universal-pages/cpcAccount/index.tsx +34 -17
package/package.json
CHANGED
package/src/apiRequest/config.ts
CHANGED
|
@@ -47,7 +47,7 @@ instance.interceptors.response.use(
|
|
|
47
47
|
enum CodeMessage {
|
|
48
48
|
"发出的请求有错误,服务器没有进行新建或修改数据的操作。" = 400,
|
|
49
49
|
"用户未登录。" = 401,
|
|
50
|
-
"
|
|
50
|
+
"用户得到授权,但是访问是被禁止的。" = 403,
|
|
51
51
|
"发出的请求针对的是不存在的记录,服务器没有进行操作。" = 404,
|
|
52
52
|
"请求的格式不可得。" = 406,
|
|
53
53
|
"请求的资源被永久删除,且不会再得到的。" = 410,
|
|
@@ -60,7 +60,7 @@ instance.interceptors.response.use(
|
|
|
60
60
|
|
|
61
61
|
notification.error({
|
|
62
62
|
message:
|
|
63
|
-
response?.data?.
|
|
63
|
+
response?.data?.message ||
|
|
64
64
|
CodeMessage[status] ||
|
|
65
65
|
"服务暂不可用,请检查网络",
|
|
66
66
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react'
|
|
2
|
-
import { Button, Modal, Form, Input, Radio, Space, message } from 'antd'
|
|
2
|
+
import { Button, Modal, Form, Input, Radio, Space, message, Alert } from 'antd'
|
|
3
3
|
let timeChange: any
|
|
4
4
|
|
|
5
5
|
export default function Index({
|
|
@@ -16,8 +16,15 @@ export default function Index({
|
|
|
16
16
|
const [secondNum, setSecondNum]: any = useState(null) //秒数
|
|
17
17
|
const [showText, setShowText] = useState('')
|
|
18
18
|
const formDom = [
|
|
19
|
-
{ title: '名称', key: 'name', type: 'string', required: true },
|
|
20
|
-
{
|
|
19
|
+
{ title: '名称', key: 'name', type: 'string', required: true, maxLength: 15, showCount: true },
|
|
20
|
+
{
|
|
21
|
+
title: '账号',
|
|
22
|
+
key: 'account',
|
|
23
|
+
type: 'account',
|
|
24
|
+
required: true,
|
|
25
|
+
maxLength: 12,
|
|
26
|
+
showCount: true
|
|
27
|
+
},
|
|
21
28
|
{ title: '密码', key: 'passwordType', type: 'psw', required: true },
|
|
22
29
|
{ title: ' ', key: 'password', type: 'pswDiy', required: true },
|
|
23
30
|
{ title: '手机号', key: 'mobile', type: 'mobileint', required: false },
|
|
@@ -25,7 +32,7 @@ export default function Index({
|
|
|
25
32
|
]
|
|
26
33
|
const editFormDom = [
|
|
27
34
|
{ title: '名称', key: 'name', type: 'rString', required: false },
|
|
28
|
-
{ title: '账号', key: 'account', type: '
|
|
35
|
+
{ title: '账号', key: 'account', type: 'rAccountString', required: false },
|
|
29
36
|
{ title: '密码', key: 'passwordType', type: 'rPswString', required: false },
|
|
30
37
|
{ title: '手机号', key: 'mobile', type: 'rString', required: false },
|
|
31
38
|
{ title: '邮箱', key: 'email', type: 'rString', required: false }
|
|
@@ -66,12 +73,28 @@ export default function Index({
|
|
|
66
73
|
}
|
|
67
74
|
}, [secondNum])
|
|
68
75
|
|
|
69
|
-
const showCom = ({ title, key, type, required }: any) => {
|
|
76
|
+
const showCom = ({ title, key, type, required, maxLength, showCount }: any) => {
|
|
70
77
|
let dom: any = null
|
|
71
78
|
switch (type) {
|
|
72
79
|
case 'rString':
|
|
73
80
|
dom = <Form.Item label={title}>{editingData[key]}</Form.Item>
|
|
74
81
|
break
|
|
82
|
+
case 'rAccountString':
|
|
83
|
+
dom = (
|
|
84
|
+
<Form.Item label={title}>
|
|
85
|
+
{editingData[key]}{' '}
|
|
86
|
+
<a
|
|
87
|
+
onClick={() => {
|
|
88
|
+
message.success('复制成功')
|
|
89
|
+
navigator.clipboard.writeText(editingData[key])
|
|
90
|
+
}}
|
|
91
|
+
>
|
|
92
|
+
复制
|
|
93
|
+
</a>
|
|
94
|
+
</Form.Item>
|
|
95
|
+
)
|
|
96
|
+
break
|
|
97
|
+
|
|
75
98
|
case 'rPswString':
|
|
76
99
|
dom = (
|
|
77
100
|
<Form.Item label={title}>
|
|
@@ -84,15 +107,28 @@ export default function Index({
|
|
|
84
107
|
case 'string':
|
|
85
108
|
dom = (
|
|
86
109
|
<Form.Item label={title} name={key} rules={[{ required: required, message: '请输入' }]}>
|
|
87
|
-
<Input placeholder='请输入' />
|
|
110
|
+
<Input placeholder='请输入' maxLength={maxLength} showCount={showCount} />
|
|
88
111
|
</Form.Item>
|
|
89
112
|
)
|
|
90
113
|
break
|
|
91
114
|
|
|
92
115
|
case 'account':
|
|
93
116
|
dom = (
|
|
94
|
-
<Form.Item
|
|
95
|
-
|
|
117
|
+
<Form.Item
|
|
118
|
+
label={title}
|
|
119
|
+
name={key}
|
|
120
|
+
rules={[
|
|
121
|
+
{ required: required, message: '请输入' },
|
|
122
|
+
{ pattern: /^[a-zA-Z0-9]+$/, message: '只能输入英文、数字' }
|
|
123
|
+
]}
|
|
124
|
+
extra=''
|
|
125
|
+
>
|
|
126
|
+
<Input
|
|
127
|
+
placeholder='请输入英文字符或数字'
|
|
128
|
+
addonAfter={`@${(window as any)?.g_config?.tenant?.id}.oncfel.com`}
|
|
129
|
+
maxLength={maxLength}
|
|
130
|
+
showCount={showCount}
|
|
131
|
+
/>
|
|
96
132
|
</Form.Item>
|
|
97
133
|
)
|
|
98
134
|
break
|
|
@@ -193,7 +229,7 @@ export default function Index({
|
|
|
193
229
|
const modelSubmit = () => {
|
|
194
230
|
form.validateFields().then(value => {
|
|
195
231
|
setLoading(true)
|
|
196
|
-
value.account = `${value.account}@${(window as any)
|
|
232
|
+
value.account = `${value.account}@${(window as any)?.g_config?.tenant?.id}.oncfel.com`
|
|
197
233
|
if (value.passwordType === 'server') {
|
|
198
234
|
value.password = generateRandomString()
|
|
199
235
|
}
|
|
@@ -243,6 +279,15 @@ export default function Index({
|
|
|
243
279
|
]
|
|
244
280
|
}
|
|
245
281
|
>
|
|
282
|
+
{editingData && (
|
|
283
|
+
<Alert
|
|
284
|
+
description='新账号初始密码仅可在创建时可复制,请及时保存'
|
|
285
|
+
type='info'
|
|
286
|
+
showIcon
|
|
287
|
+
style={{ marginBottom: '20px' }}
|
|
288
|
+
/>
|
|
289
|
+
)}
|
|
290
|
+
|
|
246
291
|
<Form
|
|
247
292
|
form={form}
|
|
248
293
|
layout={editingData ? 'horizontal' : 'vertical'}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
|
+
import { Button, Modal, Form, Input, Radio, Space, message } from 'antd'
|
|
3
|
+
|
|
4
|
+
export default function Index({
|
|
5
|
+
ModalOpen, //弹框状态
|
|
6
|
+
editOpenStatus, //关闭弹框
|
|
7
|
+
editingData, //编辑数据
|
|
8
|
+
actionFunc //新增事件
|
|
9
|
+
}: any) {
|
|
10
|
+
const [form] = Form.useForm()
|
|
11
|
+
const formDom = [
|
|
12
|
+
{ title: '名称', key: 'name', type: 'string', required: true, maxLength: 15, showCount: true }
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (!ModalOpen) return
|
|
17
|
+
if (editingData) {
|
|
18
|
+
console.log(editingData, 'editingData')
|
|
19
|
+
form.setFieldsValue({
|
|
20
|
+
...editingData
|
|
21
|
+
})
|
|
22
|
+
}
|
|
23
|
+
}, [ModalOpen])
|
|
24
|
+
|
|
25
|
+
const showCom = ({ title, key, type, required, maxLength, showCount }: any) => {
|
|
26
|
+
let dom: any = null
|
|
27
|
+
switch (type) {
|
|
28
|
+
case 'string':
|
|
29
|
+
dom = (
|
|
30
|
+
<Form.Item label={title} name={key} rules={[{ required: required, message: '请输入' }]}>
|
|
31
|
+
<Input placeholder='请输入' maxLength={maxLength} showCount={showCount} />
|
|
32
|
+
</Form.Item>
|
|
33
|
+
)
|
|
34
|
+
break
|
|
35
|
+
}
|
|
36
|
+
return dom
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const closeModel = () => {
|
|
40
|
+
form.resetFields()
|
|
41
|
+
editOpenStatus(false)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const modelSubmit = () => {
|
|
45
|
+
form.validateFields().then(value => {
|
|
46
|
+
actionFunc({
|
|
47
|
+
id: editingData?.id,
|
|
48
|
+
name: value?.name,
|
|
49
|
+
account: editingData?.account
|
|
50
|
+
}).then(() => {
|
|
51
|
+
form.resetFields()
|
|
52
|
+
})
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
return (
|
|
56
|
+
<Modal
|
|
57
|
+
title={'修改名称'}
|
|
58
|
+
destroyOnClose={true}
|
|
59
|
+
open={ModalOpen}
|
|
60
|
+
onCancel={() => {
|
|
61
|
+
closeModel()
|
|
62
|
+
}}
|
|
63
|
+
footer={[
|
|
64
|
+
<Button
|
|
65
|
+
key='refresh'
|
|
66
|
+
onClick={() => {
|
|
67
|
+
closeModel()
|
|
68
|
+
}}
|
|
69
|
+
>
|
|
70
|
+
取消
|
|
71
|
+
</Button>,
|
|
72
|
+
<Button
|
|
73
|
+
key='submit'
|
|
74
|
+
type='primary'
|
|
75
|
+
onClick={() => {
|
|
76
|
+
modelSubmit()
|
|
77
|
+
}}
|
|
78
|
+
>
|
|
79
|
+
确定
|
|
80
|
+
</Button>
|
|
81
|
+
]}
|
|
82
|
+
>
|
|
83
|
+
<Form
|
|
84
|
+
form={form}
|
|
85
|
+
layout={'vertical'}
|
|
86
|
+
initialValues={{
|
|
87
|
+
remember: true
|
|
88
|
+
}}
|
|
89
|
+
autoComplete='off'
|
|
90
|
+
>
|
|
91
|
+
{formDom.map((item: any, index: number) => {
|
|
92
|
+
return <div key={index}>{showCom(item)}</div>
|
|
93
|
+
})}
|
|
94
|
+
</Form>
|
|
95
|
+
</Modal>
|
|
96
|
+
)
|
|
97
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react'
|
|
2
|
-
import { Button, Modal, Form, Input, Radio, Space, message } from 'antd'
|
|
2
|
+
import { Button, Modal, Form, Input, Radio, Space, message, Alert } from 'antd'
|
|
3
3
|
let timeChange: any
|
|
4
4
|
|
|
5
5
|
export default function Index({
|
|
@@ -214,6 +214,14 @@ export default function Index({
|
|
|
214
214
|
]
|
|
215
215
|
}
|
|
216
216
|
>
|
|
217
|
+
{stepNext && (
|
|
218
|
+
<Alert
|
|
219
|
+
description='新的重置密码仅可本弹窗时复制,关闭后不可再复制,请及时保存'
|
|
220
|
+
type='info'
|
|
221
|
+
showIcon
|
|
222
|
+
style={{ marginBottom: '20px' }}
|
|
223
|
+
/>
|
|
224
|
+
)}
|
|
217
225
|
<Form
|
|
218
226
|
form={form}
|
|
219
227
|
layout={'vertical'}
|
|
@@ -31,4 +31,8 @@ export const accountPage = (data?: any) => {
|
|
|
31
31
|
export const accountResetPw = (data?: any) => {
|
|
32
32
|
return request.post('/sdk/permission/rbac/console/account/resetPw.json', { ...data })
|
|
33
33
|
}
|
|
34
|
+
//更新账号
|
|
35
|
+
export const updateAccount = (data?: any) => {
|
|
36
|
+
return request.post('/sdk/permission/rbac/console/account/updateAccount.json', { ...data })
|
|
37
|
+
}
|
|
34
38
|
|
|
@@ -19,10 +19,12 @@ import {
|
|
|
19
19
|
accountDeleteAccount,
|
|
20
20
|
accountGetAccount,
|
|
21
21
|
accountGetAccountPassword,
|
|
22
|
-
accountResetPw
|
|
22
|
+
accountResetPw,
|
|
23
|
+
updateAccount
|
|
23
24
|
} from './api'
|
|
24
25
|
import AddModal from './AddModal'
|
|
25
26
|
import ResetModal from './ResetModal'
|
|
27
|
+
import EditNameModal from './EditNameModal'
|
|
26
28
|
|
|
27
29
|
import './index.scss'
|
|
28
30
|
|
|
@@ -34,12 +36,14 @@ export default function Account({ historyAction }: AccountProps) {
|
|
|
34
36
|
const searchFormRef: any = useRef()
|
|
35
37
|
|
|
36
38
|
const [ModalOpen, setModalOpen] = useState(false)
|
|
37
|
-
const [id, setId] = useState(null)
|
|
38
39
|
const [editingData, setEditingData]: any = useState(null) //编辑数据
|
|
39
40
|
|
|
40
41
|
const [resetModalOpen, setResetModalOpen] = useState(false)
|
|
41
42
|
const [resetEditingData, setResetEditingData]: any = useState(null) //编辑数据
|
|
42
43
|
|
|
44
|
+
const [editNameModalOpen, setEditNameModalOpen] = useState(false)
|
|
45
|
+
const [editNameData, setEditNameData]: any = useState(null) //编辑数据
|
|
46
|
+
|
|
43
47
|
useEffect(() => {
|
|
44
48
|
execute()
|
|
45
49
|
}, [])
|
|
@@ -51,20 +55,13 @@ export default function Account({ historyAction }: AccountProps) {
|
|
|
51
55
|
key: 'name',
|
|
52
56
|
render: (text: any, data: any) => {
|
|
53
57
|
return (
|
|
54
|
-
|
|
55
|
-
<span
|
|
58
|
+
<Space>
|
|
59
|
+
<span>{data?.name}</span>
|
|
60
|
+
<FormOutlined
|
|
56
61
|
style={{ cursor: 'pointer', color: '#1677ff' }}
|
|
57
|
-
onClick={() =>
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
search: `?id=${data.id}`
|
|
61
|
-
})
|
|
62
|
-
}}
|
|
63
|
-
>
|
|
64
|
-
{data?.name}
|
|
65
|
-
<FormOutlined />
|
|
66
|
-
</span>
|
|
67
|
-
</>
|
|
62
|
+
onClick={() => openEditName(data)}
|
|
63
|
+
/>
|
|
64
|
+
</Space>
|
|
68
65
|
)
|
|
69
66
|
}
|
|
70
67
|
},
|
|
@@ -184,12 +181,10 @@ export default function Account({ historyAction }: AccountProps) {
|
|
|
184
181
|
const setModalOpenFunc = (type: boolean) => {
|
|
185
182
|
setModalOpen(type)
|
|
186
183
|
setEditingData(null)
|
|
187
|
-
setId(null)
|
|
188
184
|
}
|
|
189
185
|
const actionFunc = (data: any, type: string) => {
|
|
190
186
|
return accountCreateAccount({ ...data }).then((res: any) => {
|
|
191
187
|
message.success(`新增成功`)
|
|
192
|
-
setId(res)
|
|
193
188
|
accountGetAccountFunc(res)
|
|
194
189
|
execute()
|
|
195
190
|
})
|
|
@@ -222,6 +217,22 @@ export default function Account({ historyAction }: AccountProps) {
|
|
|
222
217
|
setResetModalOpen(type)
|
|
223
218
|
setResetEditingData(null)
|
|
224
219
|
}
|
|
220
|
+
|
|
221
|
+
const openEditName = (data: any) => {
|
|
222
|
+
setEditNameModalOpen(true)
|
|
223
|
+
setEditNameData(data)
|
|
224
|
+
}
|
|
225
|
+
const setEditModalOpenFunc = (type: boolean) => {
|
|
226
|
+
setEditNameModalOpen(type)
|
|
227
|
+
setEditNameData(null)
|
|
228
|
+
}
|
|
229
|
+
const actionEditFunc = (data: any) => {
|
|
230
|
+
return updateAccount({ ...data }).then((res: any) => {
|
|
231
|
+
message.success(`更新名称成功`)
|
|
232
|
+
setEditModalOpenFunc(false)
|
|
233
|
+
execute()
|
|
234
|
+
})
|
|
235
|
+
}
|
|
225
236
|
return (
|
|
226
237
|
<PageContainer>
|
|
227
238
|
<QueryFilter onReset={handleOnReset} onFinish={handleOnFinish}>
|
|
@@ -271,6 +282,12 @@ export default function Account({ historyAction }: AccountProps) {
|
|
|
271
282
|
actionFunc={actionFunc} //事件
|
|
272
283
|
accountGetAccountPasswordFunc={accountGetAccountPasswordFunc}
|
|
273
284
|
/>
|
|
285
|
+
<EditNameModal
|
|
286
|
+
ModalOpen={editNameModalOpen} //弹框状态
|
|
287
|
+
editOpenStatus={setEditModalOpenFunc} //关闭弹框
|
|
288
|
+
editingData={editNameData} //编辑数据
|
|
289
|
+
actionFunc={actionEditFunc} //新增事件
|
|
290
|
+
/>
|
|
274
291
|
</PageContainer>
|
|
275
292
|
)
|
|
276
293
|
}
|