cfel-base-components 2.5.40 → 2.5.42
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 +2 -1
- package/src/components/universal-pages/cpcRole/AddModal/index.tsx +29 -31
- package/src/components/universal-pages/cpcRole/api.ts +3 -1
- package/src/components/universal-pages/cpcRole/index.tsx +16 -10
- package/src/components/universal-pages/cpcRoleInfo/api.ts +4 -1
- package/src/components/universal-pages/cpcRoleInfo/index.tsx +14 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cfel-base-components",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.42",
|
|
4
4
|
"description": "cfel-base-components",
|
|
5
5
|
"main": "/src/index.tsx",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"dayjs": "^1.11.9",
|
|
55
55
|
"html2canvas": "^1.4.1",
|
|
56
56
|
"qrcode.react": "^3.1.0",
|
|
57
|
+
"react-json-view": "^1.21.3",
|
|
57
58
|
"sass": "^1.77.6"
|
|
58
59
|
}
|
|
59
60
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react'
|
|
2
|
-
import { Button, Modal, Form, Input, Checkbox } from 'antd'
|
|
2
|
+
import { Button, Modal, Form, Input, Checkbox, Space, Radio } from 'antd'
|
|
3
3
|
export default function Index({
|
|
4
4
|
ModalOpen, //弹框状态
|
|
5
5
|
editOpenStatus, //关闭弹框
|
|
@@ -28,12 +28,8 @@ export default function Index({
|
|
|
28
28
|
})
|
|
29
29
|
if (isCustomer && editingData.metaData) {
|
|
30
30
|
form.setFieldsValue({
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return key
|
|
34
|
-
}
|
|
35
|
-
return null
|
|
36
|
-
})
|
|
31
|
+
readOnly: editingData?.metaData?.readOnly,
|
|
32
|
+
hypervisorManager: editingData?.metaData?.hypervisorManager
|
|
37
33
|
})
|
|
38
34
|
}
|
|
39
35
|
}
|
|
@@ -74,15 +70,10 @@ export default function Index({
|
|
|
74
70
|
value.roleCode = editingData.roleCode
|
|
75
71
|
}
|
|
76
72
|
if (isCustomer) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
} else {
|
|
82
|
-
myMeta[item] = false
|
|
83
|
-
}
|
|
84
|
-
})
|
|
85
|
-
value.metaData = myMeta
|
|
73
|
+
value.metaData = {
|
|
74
|
+
readOnly: value.readOnly,
|
|
75
|
+
hypervisorManager: value.hypervisorManager
|
|
76
|
+
}
|
|
86
77
|
}
|
|
87
78
|
actionFunc(value, editingData ? 'edit' : 'add').then(() => {
|
|
88
79
|
form.resetFields()
|
|
@@ -119,21 +110,28 @@ export default function Index({
|
|
|
119
110
|
>
|
|
120
111
|
<Form form={form} layout={'vertical'} initialValues={{ remember: true }} autoComplete='off'>
|
|
121
112
|
{isCustomer && (
|
|
122
|
-
<
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
113
|
+
<Space size={50}>
|
|
114
|
+
<Form.Item
|
|
115
|
+
label='读写规则'
|
|
116
|
+
name='readOnly'
|
|
117
|
+
rules={[{ required: true, message: '请选择读写规则' }]}
|
|
118
|
+
>
|
|
119
|
+
<Radio.Group>
|
|
120
|
+
<Radio value='false'>只读</Radio>
|
|
121
|
+
<Radio value='true'>读写</Radio>
|
|
122
|
+
</Radio.Group>
|
|
123
|
+
</Form.Item>
|
|
124
|
+
<Form.Item
|
|
125
|
+
label='云厂商/租户规则'
|
|
126
|
+
name='hypervisorManager'
|
|
127
|
+
rules={[{ required: true, message: '请选择云厂商/租户规则' }]}
|
|
128
|
+
>
|
|
129
|
+
<Radio.Group>
|
|
130
|
+
<Radio value='true'>云厂商</Radio>
|
|
131
|
+
<Radio value='false'>租户</Radio>
|
|
132
|
+
</Radio.Group>
|
|
133
|
+
</Form.Item>
|
|
134
|
+
</Space>
|
|
137
135
|
)}
|
|
138
136
|
{formDom.map((item: any, index: number) => {
|
|
139
137
|
return <div key={index}>{showCom(item)}</div>
|
|
@@ -6,6 +6,7 @@ import ProTable from '../../base-component/ProTable'
|
|
|
6
6
|
import Pagination from '../../base-component/Pagination'
|
|
7
7
|
import useTableHooks from '../../../hooks/useTableHooks'
|
|
8
8
|
import DocumentEntry from '../../document-entry/index'
|
|
9
|
+
|
|
9
10
|
import { timeFormatter, getUrlParams } from '../../../utils'
|
|
10
11
|
|
|
11
12
|
import { get } from 'lodash'
|
|
@@ -43,11 +44,12 @@ export default function Role({ historyAction }: RoleProps) {
|
|
|
43
44
|
const [openJson, setOpenJson] = useState({})
|
|
44
45
|
|
|
45
46
|
const lookMoreJson = (data: any) => {
|
|
46
|
-
const translatedData: Record<string,
|
|
47
|
+
const translatedData: Record<string, string> = {}
|
|
47
48
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
console.log(data)
|
|
50
|
+
|
|
51
|
+
translatedData['读写规则'] = data.readOnly === 'true' ? '读写' : '只读'
|
|
52
|
+
translatedData['云厂商/租户规则'] = data.hypervisorManager === 'true' ? '云厂商' : '租户'
|
|
51
53
|
|
|
52
54
|
setOpen(true)
|
|
53
55
|
setOpenJson(translatedData)
|
|
@@ -117,6 +119,9 @@ export default function Role({ historyAction }: RoleProps) {
|
|
|
117
119
|
hidden: !(productCode === 'puhui-operation-customer'),
|
|
118
120
|
key: 'metaData',
|
|
119
121
|
render: (cell: any, record: any) => {
|
|
122
|
+
if (record.roleCode === 'admin') {
|
|
123
|
+
return '-'
|
|
124
|
+
}
|
|
120
125
|
if (cell !== undefined) {
|
|
121
126
|
return (
|
|
122
127
|
<span
|
|
@@ -124,9 +129,10 @@ export default function Role({ historyAction }: RoleProps) {
|
|
|
124
129
|
onClick={() => {
|
|
125
130
|
let initialValues: Record<string, boolean> = {}
|
|
126
131
|
if (record.metaData === null) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
132
|
+
initialValues = {
|
|
133
|
+
readOnly: false,
|
|
134
|
+
hypervisorManager: false,
|
|
135
|
+
}
|
|
130
136
|
} else {
|
|
131
137
|
initialValues = record.metaData
|
|
132
138
|
}
|
|
@@ -273,9 +279,9 @@ export default function Role({ historyAction }: RoleProps) {
|
|
|
273
279
|
return (
|
|
274
280
|
<PageContainer>
|
|
275
281
|
<JsonViewDialog open={open} jsonData={openJson} closeModel={() => setOpen(false)} />
|
|
276
|
-
<QueryFilter onReset={handleOnReset} onFinish={handleOnFinish}>
|
|
277
|
-
<ProFormText name=
|
|
278
|
-
</QueryFilter>
|
|
282
|
+
{/* <QueryFilter onReset={handleOnReset} onFinish={handleOnFinish}>
|
|
283
|
+
<ProFormText name='roleName' label='角色名称' />
|
|
284
|
+
</QueryFilter> */}
|
|
279
285
|
|
|
280
286
|
<ProTable
|
|
281
287
|
columnsState={{
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import request from
|
|
1
|
+
import request from '../../../apiRequest/config'
|
|
2
|
+
|
|
3
|
+
//import request from '@/api/config'
|
|
4
|
+
|
|
2
5
|
//根据角色分页查询绑定的账号
|
|
3
6
|
export const pageBoundAccounts = (data?: any) => {
|
|
4
7
|
return request.post('/api/permission/accountRole/pageBoundAccounts.json', { ...data })
|
|
@@ -65,16 +65,21 @@ export default function RoleInfo({ isShowTab, getAuthTree, getRoleAuthTree, empo
|
|
|
65
65
|
|
|
66
66
|
const renderMetaData = () => {
|
|
67
67
|
//如果详情为的metadata为null则显示false
|
|
68
|
-
if (roleInfo
|
|
69
|
-
return
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
if (roleInfo?.metaData === null) {
|
|
69
|
+
return (
|
|
70
|
+
<>
|
|
71
|
+
<Descriptions.Item label="读写规则">只读</Descriptions.Item>
|
|
72
|
+
<Descriptions.Item label="云厂商/租户规则">租户</Descriptions.Item>
|
|
73
|
+
</>
|
|
74
|
+
)
|
|
72
75
|
}
|
|
73
76
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
return (
|
|
78
|
+
<>
|
|
79
|
+
<Descriptions.Item label="读写规则">{roleInfo?.metaData?.readOnly === 'true' ? '读写' : '只读'}</Descriptions.Item>
|
|
80
|
+
<Descriptions.Item label="云厂商/租户规则">{roleInfo?.metaData?.hypervisorManager === 'true' ? '云厂商' : '租户'}</Descriptions.Item>
|
|
81
|
+
</>
|
|
82
|
+
)
|
|
78
83
|
}
|
|
79
84
|
|
|
80
85
|
const columns: any = [
|
|
@@ -484,7 +489,7 @@ export default function RoleInfo({ isShowTab, getAuthTree, getRoleAuthTree, empo
|
|
|
484
489
|
<Descriptions.Item label="角色描述">{roleInfo?.description || ''}</Descriptions.Item>
|
|
485
490
|
<Descriptions.Item label="创建时间">{timeFormatter(roleInfo?.gmtCreate) || ''}</Descriptions.Item>
|
|
486
491
|
<Descriptions.Item label="更新时间">{timeFormatter(roleInfo?.gmtModified) || ''}</Descriptions.Item>
|
|
487
|
-
{isCustomer && renderMetaData()}
|
|
492
|
+
{roleInfo?.roleCode === 'admin' ? null : <>{isCustomer && roleInfo?.id && renderMetaData()}</>}
|
|
488
493
|
</Descriptions>
|
|
489
494
|
|
|
490
495
|
<div>
|