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
|
@@ -86,7 +86,22 @@ export default function RoleInfo({
|
|
|
86
86
|
dataIndex: 'account',
|
|
87
87
|
key: 'account'
|
|
88
88
|
},
|
|
89
|
-
|
|
89
|
+
{
|
|
90
|
+
title: '工号',
|
|
91
|
+
dataIndex: 'jobNumber',
|
|
92
|
+
key: 'jobNumber'
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
title: '手机号',
|
|
96
|
+
dataIndex: 'mobile',
|
|
97
|
+
key: 'mobile'
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
title: '邮箱',
|
|
101
|
+
dataIndex: 'email',
|
|
102
|
+
key: 'email',
|
|
103
|
+
copyable: true
|
|
104
|
+
},
|
|
90
105
|
{
|
|
91
106
|
title: '是否主账号',
|
|
92
107
|
dataIndex: 'isAdmin',
|
|
@@ -121,22 +136,20 @@ export default function RoleInfo({
|
|
|
121
136
|
fixed: 'right',
|
|
122
137
|
render: (rowdata: any) => (
|
|
123
138
|
<Space>
|
|
124
|
-
{rowdata?.isAdmin ? null : (
|
|
125
139
|
<a
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
</Space>
|
|
140
|
+
onClick={() => {
|
|
141
|
+
Modal.confirm({
|
|
142
|
+
title: '确认解绑吗?',
|
|
143
|
+
content: '',
|
|
144
|
+
onOk: () => {
|
|
145
|
+
roleUnboundAccountsFunc(rowdata.id)
|
|
146
|
+
}
|
|
147
|
+
})
|
|
148
|
+
}}
|
|
149
|
+
>
|
|
150
|
+
解绑
|
|
151
|
+
</a>
|
|
152
|
+
</Space>
|
|
140
153
|
)
|
|
141
154
|
}
|
|
142
155
|
]
|
package/src/.umi/core/helmet.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
// This file is generated by Umi automatically
|
|
3
|
-
// DO NOT CHANGE IT MANUALLY!
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import { HelmetProvider } from '/Users/wujingang/Desktop/workspace/base-components/node_modules/@umijs/renderer-react';
|
|
6
|
-
import { context } from './helmetContext';
|
|
7
|
-
|
|
8
|
-
export const innerProvider = (container) => {
|
|
9
|
-
return React.createElement(HelmetProvider, { context }, container);
|
|
10
|
-
}
|
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react'
|
|
2
|
-
import { Button, Modal, Form, Input, Radio, Space, message } from 'antd'
|
|
3
|
-
let timeChange: any
|
|
4
|
-
|
|
5
|
-
export default function Index({
|
|
6
|
-
ModalOpen, //弹框状态
|
|
7
|
-
editOpenStatus, //关闭弹框
|
|
8
|
-
editingData, //编辑数据
|
|
9
|
-
actionFunc, //新增事件
|
|
10
|
-
accountGetAccountPasswordFunc
|
|
11
|
-
}: any) {
|
|
12
|
-
const [form] = Form.useForm()
|
|
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 [stepNext, setStepNext] = useState(false)
|
|
19
|
-
const formDom = [
|
|
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
|
-
]
|
|
24
|
-
const nextFormDom = [
|
|
25
|
-
{ title: '账号', key: 'account', type: 'rString', required: false },
|
|
26
|
-
{ title: '密码', key: 'passwordType', type: 'rPwString', required: false }
|
|
27
|
-
]
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
return () => {
|
|
30
|
-
clearInterval(timeChange)
|
|
31
|
-
}
|
|
32
|
-
}, [])
|
|
33
|
-
|
|
34
|
-
const init = () => {
|
|
35
|
-
setLoading(false)
|
|
36
|
-
setDisabledType(true)
|
|
37
|
-
setShowText('关闭(4s)')
|
|
38
|
-
timeChange = setInterval(
|
|
39
|
-
() =>
|
|
40
|
-
setSecondNum((t: any) => {
|
|
41
|
-
let num = t
|
|
42
|
-
console.log(t, 't')
|
|
43
|
-
return --num
|
|
44
|
-
}),
|
|
45
|
-
1000
|
|
46
|
-
)
|
|
47
|
-
}
|
|
48
|
-
useEffect(() => {
|
|
49
|
-
console.log(secondNum, 'secondNum')
|
|
50
|
-
if (secondNum > 0 && secondNum <= 3) {
|
|
51
|
-
setShowText(`关闭(${secondNum}s)`)
|
|
52
|
-
} else {
|
|
53
|
-
clearInterval(timeChange)
|
|
54
|
-
setSecondNum(4)
|
|
55
|
-
setDisabledType(false)
|
|
56
|
-
setShowText('关闭')
|
|
57
|
-
}
|
|
58
|
-
}, [secondNum])
|
|
59
|
-
|
|
60
|
-
useEffect(() => {
|
|
61
|
-
if (!ModalOpen) return
|
|
62
|
-
if (editingData) {
|
|
63
|
-
console.log(editingData, 'editingData')
|
|
64
|
-
clearInterval(timeChange)
|
|
65
|
-
form.setFieldsValue({
|
|
66
|
-
...editingData
|
|
67
|
-
})
|
|
68
|
-
}
|
|
69
|
-
}, [ModalOpen])
|
|
70
|
-
|
|
71
|
-
const showCom = ({ title, key, type, required }: any) => {
|
|
72
|
-
let dom: any = null
|
|
73
|
-
switch (type) {
|
|
74
|
-
case 'rString':
|
|
75
|
-
dom = (
|
|
76
|
-
<Form.Item label={title} name={key} rules={[{ required: required, message: '请输入' }]}>
|
|
77
|
-
<span>{editingData?.[key]}</span>
|
|
78
|
-
</Form.Item>
|
|
79
|
-
)
|
|
80
|
-
break
|
|
81
|
-
case 'rPwString':
|
|
82
|
-
dom = (
|
|
83
|
-
<Form.Item label={title} name={key} rules={[{ required: required, message: '请输入' }]}>
|
|
84
|
-
<span>
|
|
85
|
-
******* <a onClick={() => copy()}>复制</a>
|
|
86
|
-
</span>
|
|
87
|
-
</Form.Item>
|
|
88
|
-
)
|
|
89
|
-
break
|
|
90
|
-
case 'account':
|
|
91
|
-
dom = (
|
|
92
|
-
<Form.Item label={title} name={key} rules={[{ required: required, message: '请输入' }]}>
|
|
93
|
-
<Input placeholder='请输入' disabled />
|
|
94
|
-
</Form.Item>
|
|
95
|
-
)
|
|
96
|
-
break
|
|
97
|
-
case 'psw':
|
|
98
|
-
dom = (
|
|
99
|
-
<Form.Item label={title} name={key} rules={[{ required: required, message: '请输入' }]}>
|
|
100
|
-
<Radio.Group>
|
|
101
|
-
<Space
|
|
102
|
-
direction='vertical'
|
|
103
|
-
onChange={(e: any) => {
|
|
104
|
-
setPasswordType(e.target.value)
|
|
105
|
-
}}
|
|
106
|
-
>
|
|
107
|
-
<Radio value='server'>生成随机密码(安全性高)</Radio>
|
|
108
|
-
<Radio value='diy'>自定义密码</Radio>
|
|
109
|
-
</Space>
|
|
110
|
-
</Radio.Group>
|
|
111
|
-
</Form.Item>
|
|
112
|
-
)
|
|
113
|
-
break
|
|
114
|
-
case 'pswDiy':
|
|
115
|
-
dom = passwordType === 'diy' && (
|
|
116
|
-
<Form.Item
|
|
117
|
-
label={null}
|
|
118
|
-
name={key}
|
|
119
|
-
rules={[
|
|
120
|
-
{ required: required, message: '请输入' },
|
|
121
|
-
{
|
|
122
|
-
pattern: /^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d!@#$%^&*()_+{}|]{8,32}$/,
|
|
123
|
-
message: '请输入正确的密码'
|
|
124
|
-
}
|
|
125
|
-
]}
|
|
126
|
-
extra='密码要求至少包含英文字母和数字,字符数8-32位'
|
|
127
|
-
>
|
|
128
|
-
<Input placeholder='请输入' />
|
|
129
|
-
</Form.Item>
|
|
130
|
-
)
|
|
131
|
-
break
|
|
132
|
-
default:
|
|
133
|
-
break
|
|
134
|
-
}
|
|
135
|
-
return dom
|
|
136
|
-
}
|
|
137
|
-
const copy = () => {
|
|
138
|
-
accountGetAccountPasswordFunc({
|
|
139
|
-
id: editingData?.id
|
|
140
|
-
}).then((res: any) => {
|
|
141
|
-
message.success('复制成功')
|
|
142
|
-
navigator.clipboard.writeText(res)
|
|
143
|
-
})
|
|
144
|
-
}
|
|
145
|
-
const closeModel = () => {
|
|
146
|
-
form.resetFields()
|
|
147
|
-
editOpenStatus(false)
|
|
148
|
-
setStepNext(false)
|
|
149
|
-
}
|
|
150
|
-
const generateRandomString = (minLength = 8, maxLength = 32) => {
|
|
151
|
-
const length = Math.floor(Math.random() * (maxLength - minLength + 1)) + minLength
|
|
152
|
-
const possibleChars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
|
|
153
|
-
let result = ''
|
|
154
|
-
for (let i = 0; i < length; i++) {
|
|
155
|
-
result += possibleChars.charAt(Math.floor(Math.random() * possibleChars.length))
|
|
156
|
-
}
|
|
157
|
-
return result
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
const modelSubmit = () => {
|
|
161
|
-
form.validateFields().then(value => {
|
|
162
|
-
if (value.passwordType === 'server') {
|
|
163
|
-
value.password = generateRandomString()
|
|
164
|
-
}
|
|
165
|
-
actionFunc({
|
|
166
|
-
id: editingData?.id,
|
|
167
|
-
newPassword: value.password
|
|
168
|
-
}).then(() => {
|
|
169
|
-
// form.resetFields()
|
|
170
|
-
setStepNext(true)
|
|
171
|
-
init()
|
|
172
|
-
})
|
|
173
|
-
})
|
|
174
|
-
}
|
|
175
|
-
return (
|
|
176
|
-
<Modal
|
|
177
|
-
title={'重置密码'}
|
|
178
|
-
destroyOnClose={true}
|
|
179
|
-
open={ModalOpen}
|
|
180
|
-
closable={false}
|
|
181
|
-
footer={
|
|
182
|
-
stepNext
|
|
183
|
-
? [
|
|
184
|
-
<Button
|
|
185
|
-
disabled={disabledType}
|
|
186
|
-
key='refresh'
|
|
187
|
-
type='primary'
|
|
188
|
-
onClick={() => {
|
|
189
|
-
closeModel()
|
|
190
|
-
}}
|
|
191
|
-
>
|
|
192
|
-
{showText}
|
|
193
|
-
</Button>
|
|
194
|
-
]
|
|
195
|
-
: [
|
|
196
|
-
<Button
|
|
197
|
-
key='refresh'
|
|
198
|
-
onClick={() => {
|
|
199
|
-
closeModel()
|
|
200
|
-
}}
|
|
201
|
-
>
|
|
202
|
-
取消
|
|
203
|
-
</Button>,
|
|
204
|
-
<Button
|
|
205
|
-
key='submit'
|
|
206
|
-
type='primary'
|
|
207
|
-
loading={loading}
|
|
208
|
-
onClick={() => {
|
|
209
|
-
modelSubmit()
|
|
210
|
-
}}
|
|
211
|
-
>
|
|
212
|
-
确定
|
|
213
|
-
</Button>
|
|
214
|
-
]
|
|
215
|
-
}
|
|
216
|
-
>
|
|
217
|
-
<Form
|
|
218
|
-
form={form}
|
|
219
|
-
layout={'vertical'}
|
|
220
|
-
initialValues={{
|
|
221
|
-
remember: true,
|
|
222
|
-
passwordType: 'server'
|
|
223
|
-
}}
|
|
224
|
-
autoComplete='off'
|
|
225
|
-
>
|
|
226
|
-
{(stepNext ? nextFormDom : formDom).map((item: any, index: number) => {
|
|
227
|
-
return <div key={index}>{showCom(item)}</div>
|
|
228
|
-
})}
|
|
229
|
-
</Form>
|
|
230
|
-
</Modal>
|
|
231
|
-
)
|
|
232
|
-
}
|