cfel-base-components 2.5.12 → 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/.vscode/settings.json +3 -0
- package/demo/src/index.html +4 -3
- package/package.json +1 -1
- package/src/.umi/core/helmet.ts +10 -0
- package/src/.umi/core/helmetContext.ts +4 -0
- package/src/apiRequest/config.ts +2 -2
- package/src/components/layout/index.tsx +14 -4
- package/src/components/layout/user-card/index.scss +31 -8
- package/src/components/layout/user-card/index.tsx +79 -91
- package/src/components/universal-pages/cpcAccount/AddModal/index.tsx +307 -123
- package/src/components/universal-pages/cpcAccount/EditNameModal/index.tsx +97 -0
- package/src/components/universal-pages/cpcAccount/ResetModal/index.tsx +240 -0
- package/src/components/universal-pages/cpcAccount/api.ts +35 -15
- package/src/components/universal-pages/cpcAccount/index.tsx +149 -97
- package/src/components/universal-pages/cpcAccountInfo/index.tsx +3 -1
- package/src/components/universal-pages/cpcRole/AddModal/index.tsx +1 -1
- package/src/components/universal-pages/cpcRole/index.tsx +101 -99
- package/src/components/universal-pages/cpcRoleInfo/index.tsx +16 -29
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
|
+
import { Button, Modal, Form, Input, Radio, Space, message, Alert } 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
|
+
{stepNext && (
|
|
218
|
+
<Alert
|
|
219
|
+
description='新的重置密码仅可本弹窗时复制,关闭后不可再复制,请及时保存'
|
|
220
|
+
type='info'
|
|
221
|
+
showIcon
|
|
222
|
+
style={{ marginBottom: '20px' }}
|
|
223
|
+
/>
|
|
224
|
+
)}
|
|
225
|
+
<Form
|
|
226
|
+
form={form}
|
|
227
|
+
layout={'vertical'}
|
|
228
|
+
initialValues={{
|
|
229
|
+
remember: true,
|
|
230
|
+
passwordType: 'server'
|
|
231
|
+
}}
|
|
232
|
+
autoComplete='off'
|
|
233
|
+
>
|
|
234
|
+
{(stepNext ? nextFormDom : formDom).map((item: any, index: number) => {
|
|
235
|
+
return <div key={index}>{showCom(item)}</div>
|
|
236
|
+
})}
|
|
237
|
+
</Form>
|
|
238
|
+
</Modal>
|
|
239
|
+
)
|
|
240
|
+
}
|
|
@@ -1,18 +1,38 @@
|
|
|
1
1
|
import request from "../../../apiRequest/config"
|
|
2
2
|
|
|
3
|
+
|
|
3
4
|
//分页查询账号
|
|
4
|
-
export const accountPage= (data?: any) => {
|
|
5
|
-
return request.post(
|
|
6
|
-
}
|
|
7
|
-
//指定租户下创建账号
|
|
8
|
-
export const accountCreateAccount = (data?: any) => {
|
|
9
|
-
return request.post(
|
|
10
|
-
}
|
|
11
|
-
//指定租户下修改账号
|
|
12
|
-
export const accountUpdateAccount = (data?: any) => {
|
|
13
|
-
return request.post(
|
|
14
|
-
}
|
|
15
|
-
//指定租户下删除账号
|
|
16
|
-
export const accountDeleteAccount = (data?: any) => {
|
|
17
|
-
return request.get(
|
|
18
|
-
}
|
|
5
|
+
export const accountPage = (data?: any) => {
|
|
6
|
+
return request.post('/sdk/permission/rbac/console/account/page.json', { ...data })
|
|
7
|
+
}
|
|
8
|
+
//指定租户下创建账号
|
|
9
|
+
export const accountCreateAccount = (data?: any) => {
|
|
10
|
+
return request.post('/sdk/permission/rbac/console/account/createAccount.json', { ...data })
|
|
11
|
+
}
|
|
12
|
+
//指定租户下修改账号
|
|
13
|
+
export const accountUpdateAccount = (data?: any) => {
|
|
14
|
+
return request.post('/api/permission/account/updateAccount.json', { ...data })
|
|
15
|
+
}
|
|
16
|
+
//指定租户下删除账号
|
|
17
|
+
export const accountDeleteAccount = (data?: any) => {
|
|
18
|
+
return request.get('/sdk/permission/rbac/console/account/deleteAccount.json', {
|
|
19
|
+
params: { ...data }
|
|
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
|
+
//更新账号
|
|
35
|
+
export const updateAccount = (data?: any) => {
|
|
36
|
+
return request.post('/sdk/permission/rbac/console/account/updateAccount.json', { ...data })
|
|
37
|
+
}
|
|
38
|
+
|
|
@@ -1,31 +1,48 @@
|
|
|
1
|
-
import React, { useEffect, useRef, useState } from 'react'
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react'
|
|
2
|
+
|
|
2
3
|
import PageContainer from '../../base-component/PageContainer';
|
|
3
4
|
import QueryFilter from '../../base-component/QueryFilter';
|
|
4
5
|
import ProTable from '../../base-component/ProTable';
|
|
5
6
|
import Pagination from '../../base-component/Pagination';
|
|
6
|
-
import { ProFormText, } from '@ant-design/pro-components';
|
|
7
|
-
import { Space, Button, message,Modal } from 'antd';
|
|
8
|
-
import { get } from 'lodash';
|
|
9
|
-
import { timeFormatter } from '../../../utils';
|
|
10
7
|
import useTableHooks from "../../../hooks/useTableHooks"
|
|
8
|
+
import { timeFormatter, getUrlParams } from '../../../utils';
|
|
9
|
+
|
|
10
|
+
import { ProFormText } from '@ant-design/pro-components'
|
|
11
|
+
import { Space, Button, message, Modal } from 'antd'
|
|
12
|
+
import { get } from 'lodash'
|
|
13
|
+
|
|
14
|
+
import { FormOutlined } from '@ant-design/icons'
|
|
11
15
|
import {
|
|
12
|
-
accountPage,
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
accountPage,
|
|
17
|
+
accountCreateAccount,
|
|
18
|
+
accountUpdateAccount,
|
|
19
|
+
accountDeleteAccount,
|
|
20
|
+
accountGetAccount,
|
|
21
|
+
accountGetAccountPassword,
|
|
22
|
+
accountResetPw,
|
|
23
|
+
updateAccount
|
|
24
|
+
} from './api'
|
|
15
25
|
import AddModal from './AddModal'
|
|
16
|
-
import
|
|
26
|
+
import ResetModal from './ResetModal'
|
|
27
|
+
import EditNameModal from './EditNameModal'
|
|
28
|
+
|
|
29
|
+
import './index.scss'
|
|
17
30
|
|
|
18
31
|
export interface AccountProps {
|
|
19
|
-
historyAction: any
|
|
32
|
+
historyAction: any
|
|
20
33
|
}
|
|
21
34
|
|
|
22
|
-
export default function Account({
|
|
23
|
-
historyAction
|
|
24
|
-
}: AccountProps) {
|
|
35
|
+
export default function Account({ historyAction }: AccountProps) {
|
|
25
36
|
const searchFormRef: any = useRef()
|
|
26
37
|
|
|
27
38
|
const [ModalOpen, setModalOpen] = useState(false)
|
|
28
|
-
const [editingData, setEditingData] = useState(null)
|
|
39
|
+
const [editingData, setEditingData]: any = useState(null) //编辑数据
|
|
40
|
+
|
|
41
|
+
const [resetModalOpen, setResetModalOpen] = useState(false)
|
|
42
|
+
const [resetEditingData, setResetEditingData]: any = useState(null) //编辑数据
|
|
43
|
+
|
|
44
|
+
const [editNameModalOpen, setEditNameModalOpen] = useState(false)
|
|
45
|
+
const [editNameData, setEditNameData]: any = useState(null) //编辑数据
|
|
29
46
|
|
|
30
47
|
useEffect(() => {
|
|
31
48
|
execute()
|
|
@@ -38,41 +55,22 @@ export default function Account({
|
|
|
38
55
|
key: 'name',
|
|
39
56
|
render: (text: any, data: any) => {
|
|
40
57
|
return (
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
{data?.name}
|
|
51
|
-
</span>
|
|
52
|
-
);
|
|
53
|
-
},
|
|
58
|
+
<Space>
|
|
59
|
+
<span>{data?.name}</span>
|
|
60
|
+
<FormOutlined
|
|
61
|
+
style={{ cursor: 'pointer', color: '#1677ff' }}
|
|
62
|
+
onClick={() => openEditName(data)}
|
|
63
|
+
/>
|
|
64
|
+
</Space>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
54
67
|
},
|
|
55
68
|
{
|
|
56
69
|
title: '账号',
|
|
57
70
|
dataIndex: 'account',
|
|
58
|
-
key: 'account'
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
title: '工号',
|
|
62
|
-
dataIndex: 'jobNumber',
|
|
63
|
-
key: 'jobNumber',
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
title: '手机号',
|
|
67
|
-
dataIndex: 'mobile',
|
|
68
|
-
key: 'mobile',
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
title: '邮箱',
|
|
72
|
-
dataIndex: 'email',
|
|
73
|
-
key: 'email',
|
|
74
|
-
ellipsis: true,
|
|
71
|
+
key: 'account'
|
|
75
72
|
},
|
|
73
|
+
|
|
76
74
|
{
|
|
77
75
|
title: '是否主账号',
|
|
78
76
|
dataIndex: 'isAdmin',
|
|
@@ -107,39 +105,48 @@ export default function Account({
|
|
|
107
105
|
fixed: 'right',
|
|
108
106
|
width: 150,
|
|
109
107
|
render: (rowdata: any) => (
|
|
110
|
-
|
|
111
108
|
<Space>
|
|
112
|
-
<a
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
109
|
+
<a
|
|
110
|
+
onClick={() => {
|
|
111
|
+
setResetEditingData(rowdata)
|
|
112
|
+
setResetModalOpen(true)
|
|
113
|
+
}}
|
|
114
|
+
>
|
|
115
|
+
重置密码
|
|
116
|
+
</a>
|
|
116
117
|
<a
|
|
117
118
|
onClick={() => {
|
|
118
119
|
historyAction?.push({
|
|
119
120
|
pathname: `/account-info`,
|
|
120
|
-
search: `?id=${rowdata.id}
|
|
121
|
-
})
|
|
121
|
+
search: `?id=${rowdata.id}`
|
|
122
|
+
})
|
|
122
123
|
}}
|
|
123
124
|
>
|
|
124
125
|
配置
|
|
125
126
|
</a>
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
127
|
+
{rowdata.isAdmin ? null : (
|
|
128
|
+
<a
|
|
129
|
+
onClick={() => {
|
|
130
|
+
Modal.confirm({
|
|
131
|
+
title: `确认删除${rowdata?.name}吗?`,
|
|
132
|
+
onOk: () => {
|
|
133
|
+
DeleteFunc(rowdata?.id)
|
|
134
|
+
}
|
|
135
|
+
})
|
|
136
|
+
}}
|
|
137
|
+
>
|
|
138
|
+
删除
|
|
139
|
+
</a>
|
|
140
|
+
)}
|
|
134
141
|
</Space>
|
|
135
|
-
)
|
|
136
|
-
}
|
|
137
|
-
]
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
]
|
|
138
145
|
|
|
139
146
|
const handleOnReset: any = async (values: any) => {
|
|
140
147
|
searchFormRef.current = { ...values }
|
|
141
148
|
execute({
|
|
142
|
-
innerPageNo: 1
|
|
149
|
+
innerPageNo: 1
|
|
143
150
|
})
|
|
144
151
|
}
|
|
145
152
|
|
|
@@ -148,17 +155,14 @@ export default function Account({
|
|
|
148
155
|
execute()
|
|
149
156
|
}
|
|
150
157
|
|
|
151
|
-
const readDataList = ({
|
|
152
|
-
innerPageNo,
|
|
153
|
-
innerPageSize,
|
|
154
|
-
}: any) => {
|
|
158
|
+
const readDataList = ({ innerPageNo, innerPageSize }: any) => {
|
|
155
159
|
return accountPage({
|
|
156
160
|
currentPage: innerPageNo,
|
|
157
161
|
pageSize: innerPageSize,
|
|
158
|
-
...searchFormRef.current
|
|
162
|
+
...searchFormRef.current
|
|
159
163
|
}).then((res: any) => {
|
|
160
|
-
let records = get(res,
|
|
161
|
-
let total = get(res,
|
|
164
|
+
let records = get(res, 'records', [])
|
|
165
|
+
let total = get(res, 'total', 0)
|
|
162
166
|
return {
|
|
163
167
|
...res,
|
|
164
168
|
dataList: records,
|
|
@@ -179,63 +183,111 @@ export default function Account({
|
|
|
179
183
|
setEditingData(null)
|
|
180
184
|
}
|
|
181
185
|
const actionFunc = (data: any, type: string) => {
|
|
182
|
-
return
|
|
183
|
-
message.success(
|
|
184
|
-
|
|
185
|
-
setEditingData(null)
|
|
186
|
+
return accountCreateAccount({ ...data }).then((res: any) => {
|
|
187
|
+
message.success(`新增成功`)
|
|
188
|
+
accountGetAccountFunc(res)
|
|
186
189
|
execute()
|
|
187
190
|
})
|
|
188
191
|
}
|
|
189
|
-
const
|
|
192
|
+
const accountGetAccountFunc = (id: any) => {
|
|
193
|
+
accountGetAccount({
|
|
194
|
+
id
|
|
195
|
+
}).then((res: any) => {
|
|
196
|
+
setEditingData(res)
|
|
197
|
+
})
|
|
198
|
+
}
|
|
199
|
+
const DeleteFunc = (id: any) => {
|
|
190
200
|
accountDeleteAccount({
|
|
191
|
-
|
|
201
|
+
id
|
|
192
202
|
}).then((res: any) => {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
203
|
+
message.success('删除成功')
|
|
204
|
+
execute()
|
|
205
|
+
})
|
|
206
|
+
}
|
|
207
|
+
const accountGetAccountPasswordFunc = (data: any) => {
|
|
208
|
+
return accountGetAccountPassword(data)
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
const actionResetFunc = (data: any) => {
|
|
212
|
+
return accountResetPw({ ...data }).then((res: any) => {
|
|
213
|
+
message.success(`重置成功`)
|
|
214
|
+
})
|
|
215
|
+
}
|
|
216
|
+
const setResetModalOpenFunc = (type: boolean) => {
|
|
217
|
+
setResetModalOpen(type)
|
|
218
|
+
setResetEditingData(null)
|
|
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
|
+
}
|
|
197
236
|
return (
|
|
198
237
|
<PageContainer>
|
|
199
|
-
<QueryFilter
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
>
|
|
203
|
-
<ProFormText name="name" label="名称" />
|
|
204
|
-
<ProFormText name="account" label="账号" />
|
|
238
|
+
<QueryFilter onReset={handleOnReset} onFinish={handleOnFinish}>
|
|
239
|
+
<ProFormText name='name' label='名称' />
|
|
240
|
+
<ProFormText name='account' label='账号' />
|
|
205
241
|
</QueryFilter>
|
|
206
242
|
<ProTable
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
243
|
+
columnsState={{
|
|
244
|
+
persistenceKey: 'base_cpcAccount',
|
|
245
|
+
persistenceType: 'localStorage'
|
|
246
|
+
}}
|
|
211
247
|
toolBarRender={() => {
|
|
212
248
|
return [
|
|
213
249
|
<Button
|
|
214
|
-
|
|
250
|
+
key='add'
|
|
251
|
+
type='primary'
|
|
215
252
|
onClick={() => {
|
|
216
253
|
setModalOpen(true)
|
|
217
254
|
}}
|
|
218
255
|
>
|
|
219
256
|
新增账号
|
|
220
|
-
</Button
|
|
221
|
-
]
|
|
257
|
+
</Button>
|
|
258
|
+
]
|
|
222
259
|
}}
|
|
223
|
-
headerTitle={
|
|
260
|
+
headerTitle={'账号列表'}
|
|
224
261
|
dataSource={dataList}
|
|
225
262
|
loading={isLoading}
|
|
226
263
|
columns={columns}
|
|
227
|
-
rowKey=
|
|
264
|
+
rowKey='id'
|
|
228
265
|
options={{
|
|
229
266
|
reload: handleRoload
|
|
230
267
|
}}
|
|
231
268
|
/>
|
|
269
|
+
|
|
270
|
+
<Pagination {...pagination} />
|
|
271
|
+
<ResetModal
|
|
272
|
+
ModalOpen={resetModalOpen} //弹框状态
|
|
273
|
+
editOpenStatus={setResetModalOpenFunc} //关闭弹框
|
|
274
|
+
editingData={resetEditingData} //编辑数据
|
|
275
|
+
actionFunc={actionResetFunc} //新增事件
|
|
276
|
+
accountGetAccountPasswordFunc={accountGetAccountPasswordFunc}
|
|
277
|
+
/>
|
|
232
278
|
<AddModal
|
|
233
279
|
ModalOpen={ModalOpen}
|
|
234
280
|
editOpenStatus={setModalOpenFunc} //修改状态事件
|
|
235
281
|
editingData={editingData} //当前数据
|
|
236
|
-
actionFunc={actionFunc}//事件
|
|
282
|
+
actionFunc={actionFunc} //事件
|
|
283
|
+
accountGetAccountPasswordFunc={accountGetAccountPasswordFunc}
|
|
284
|
+
/>
|
|
285
|
+
<EditNameModal
|
|
286
|
+
ModalOpen={editNameModalOpen} //弹框状态
|
|
287
|
+
editOpenStatus={setEditModalOpenFunc} //关闭弹框
|
|
288
|
+
editingData={editNameData} //编辑数据
|
|
289
|
+
actionFunc={actionEditFunc} //新增事件
|
|
237
290
|
/>
|
|
238
|
-
<Pagination {...pagination} />
|
|
239
291
|
</PageContainer>
|
|
240
292
|
)
|
|
241
293
|
}
|
|
@@ -130,6 +130,7 @@ export default function AccountInfo({ isShowTab, getAuthTree, getAccountAuthTree
|
|
|
130
130
|
fixed: 'right',
|
|
131
131
|
render: (rowdata: any) => (
|
|
132
132
|
<Space>
|
|
133
|
+
{accountInfo?.isAdmin && rowdata.roleCode === 'admin' ? null : (
|
|
133
134
|
<a
|
|
134
135
|
onClick={() => {
|
|
135
136
|
Modal.confirm({
|
|
@@ -143,7 +144,8 @@ export default function AccountInfo({ isShowTab, getAuthTree, getAccountAuthTree
|
|
|
143
144
|
>
|
|
144
145
|
解绑
|
|
145
146
|
</a>
|
|
146
|
-
|
|
147
|
+
)}
|
|
148
|
+
</Space>
|
|
147
149
|
)
|
|
148
150
|
}
|
|
149
151
|
]
|