cfel-base-components 2.5.41 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cfel-base-components",
3
- "version": "2.5.41",
3
+ "version": "2.5.42",
4
4
  "description": "cfel-base-components",
5
5
  "main": "/src/index.tsx",
6
6
  "types": "src/index.d.ts",
@@ -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
- metaData: Object.keys(editingData.metaData).map(key => {
32
- if (editingData.metaData[key] === 'true') {
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
- let myMeta: Record<string, boolean> = {}
78
- Object.keys(metaData).forEach((item: any) => {
79
- if (value.metaData.includes(item)) {
80
- myMeta[item] = true
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
- <Form.Item
123
- label='规则配置'
124
- name='metaData'
125
- rules={[{ required: true, message: '请选择至少一个规则权限' }]}
126
- >
127
- <Checkbox.Group>
128
- {Object.keys(metaData).map((item: any, index: number) => {
129
- return (
130
- <Checkbox key={index} value={item}>
131
- {metaData[item]}
132
- </Checkbox>
133
- )
134
- })}
135
- </Checkbox.Group>
136
- </Form.Item>
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>
@@ -1,5 +1,7 @@
1
1
  import request from "../../../apiRequest/config"
2
2
 
3
+ //import request from '@/api/config'
4
+
3
5
  export const pageRequest = (data?: any) => {
4
6
  return request.post('/api/permission/role/page.json', { ...data })
5
7
  }
@@ -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, boolean> = {}
47
+ const translatedData: Record<string, string> = {}
47
48
 
48
- Object.entries(metaData).forEach(([key, value]) => {
49
- translatedData[value] = data[key]
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)
@@ -127,9 +129,10 @@ export default function Role({ historyAction }: RoleProps) {
127
129
  onClick={() => {
128
130
  let initialValues: Record<string, boolean> = {}
129
131
  if (record.metaData === null) {
130
- Object.entries(metaData).forEach(([key, value]) => {
131
- initialValues[key] = false
132
- })
132
+ initialValues = {
133
+ readOnly: false,
134
+ hypervisorManager: false,
135
+ }
133
136
  } else {
134
137
  initialValues = record.metaData
135
138
  }
@@ -276,9 +279,9 @@ export default function Role({ historyAction }: RoleProps) {
276
279
  return (
277
280
  <PageContainer>
278
281
  <JsonViewDialog open={open} jsonData={openJson} closeModel={() => setOpen(false)} />
279
- <QueryFilter onReset={handleOnReset} onFinish={handleOnFinish}>
280
- <ProFormText name="roleName" label="角色名称" />
281
- </QueryFilter>
282
+ {/* <QueryFilter onReset={handleOnReset} onFinish={handleOnFinish}>
283
+ <ProFormText name='roleName' label='角色名称' />
284
+ </QueryFilter> */}
282
285
 
283
286
  <ProTable
284
287
  columnsState={{
@@ -1,5 +1,7 @@
1
1
  import request from '../../../apiRequest/config'
2
2
 
3
+ //import request from '@/api/config'
4
+
3
5
  //根据角色分页查询绑定的账号
4
6
  export const pageBoundAccounts = (data?: any) => {
5
7
  return request.post('/api/permission/accountRole/pageBoundAccounts.json', { ...data })
@@ -66,23 +66,20 @@ export default function RoleInfo({ isShowTab, getAuthTree, getRoleAuthTree, empo
66
66
  const renderMetaData = () => {
67
67
  //如果详情为的metadata为null则显示false
68
68
  if (roleInfo?.metaData === null) {
69
- return Object.keys(metaData).map((key) => {
70
- return (
71
- <Descriptions.Item key={key} label={metaData[key]}>
72
- false
73
- </Descriptions.Item>
74
- )
75
- })
76
- }
77
-
78
- //如果有数据则根据metadata翻译成中文
79
- return Object.keys(metaData).map((key) => {
80
69
  return (
81
- <Descriptions.Item key={key} label={metaData[key]}>
82
- {roleInfo?.metaData[key]}
83
- </Descriptions.Item>
70
+ <>
71
+ <Descriptions.Item label="读写规则">只读</Descriptions.Item>
72
+ <Descriptions.Item label="云厂商/租户规则">租户</Descriptions.Item>
73
+ </>
84
74
  )
85
- })
75
+ }
76
+
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
+ )
86
83
  }
87
84
 
88
85
  const columns: any = [