cfel-base-components 2.5.36 → 2.5.38

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.36",
3
+ "version": "2.5.38",
4
4
  "description": "cfel-base-components",
5
5
  "main": "/src/index.tsx",
6
6
  "types": "src/index.d.ts",
@@ -0,0 +1,9 @@
1
+ .document {
2
+ margin: 0 12px;
3
+ color: #0958d9;
4
+ transition: all 0.3s;
5
+
6
+ &:hover {
7
+ color: rgb(105, 177, 255);
8
+ }
9
+ }
@@ -0,0 +1,15 @@
1
+ import { ReadOutlined } from '@ant-design/icons'
2
+ import './index.scss'
3
+ import React from 'react'
4
+
5
+ export default function DocumentEntry({ documentId, target }: any) {
6
+ return (
7
+ <ReadOutlined
8
+ className="document"
9
+ title={'帮助文档'}
10
+ onClick={() => {
11
+ window.open(`/help/doc?documentId=${documentId}&target=${target}`)
12
+ }}
13
+ />
14
+ )
15
+ }
@@ -27,6 +27,7 @@ import ResetModal from './ResetModal'
27
27
  import EditNameModal from './EditNameModal'
28
28
 
29
29
  import './index.scss'
30
+ import DocumentEntry from '../../document-entry';
30
31
 
31
32
  export interface AccountProps {
32
33
  historyAction: any
@@ -234,6 +235,8 @@ export default function Account({ historyAction }: AccountProps) {
234
235
  execute()
235
236
  })
236
237
  }
238
+
239
+ const productCode = (window as any).g_config.productCode
237
240
  return (
238
241
  <PageContainer>
239
242
  <QueryFilter onReset={handleOnReset} onFinish={handleOnFinish}>
@@ -258,7 +261,16 @@ export default function Account({ historyAction }: AccountProps) {
258
261
  </Button>
259
262
  ]
260
263
  }}
261
- headerTitle={'账号列表'}
264
+ headerTitle={
265
+ productCode === 'puhui-console' ? (
266
+ <>
267
+ 账号列表
268
+ <DocumentEntry documentId={'pc8tgn179k0aky1f'} />
269
+ </>
270
+ ) : (
271
+ '账号列表'
272
+ )
273
+ }
262
274
  dataSource={dataList}
263
275
  loading={isLoading}
264
276
  columns={columns}
@@ -1,11 +1,12 @@
1
1
  import React, { useEffect, useRef, useState } from 'react'
2
2
 
3
- import PageContainer from '../../base-component/PageContainer';
4
- import QueryFilter from '../../base-component/QueryFilter';
5
- import ProTable from '../../base-component/ProTable';
6
- import Pagination from '../../base-component/Pagination';
7
- import useTableHooks from "../../../hooks/useTableHooks"
8
- import { timeFormatter, getUrlParams } from '../../../utils';
3
+ import PageContainer from '../../base-component/PageContainer'
4
+ import QueryFilter from '../../base-component/QueryFilter'
5
+ import ProTable from '../../base-component/ProTable'
6
+ import Pagination from '../../base-component/Pagination'
7
+ import useTableHooks from '../../../hooks/useTableHooks'
8
+ import DocumentEntry from '../../document-entry/index'
9
+ import { timeFormatter, getUrlParams } from '../../../utils'
9
10
 
10
11
  import { get } from 'lodash'
11
12
  import { Space, Button, message, Modal, Popover } from 'antd'
@@ -46,19 +47,19 @@ export default function Role({ historyAction }: RoleProps) {
46
47
  onClick={() => {
47
48
  historyAction?.push({
48
49
  pathname: `/role-info`,
49
- search: `?roleCode=${data.roleCode}`
50
+ search: `?roleCode=${data.roleCode}`,
50
51
  })
51
52
  }}
52
53
  >
53
54
  {data?.roleName}
54
55
  </span>
55
56
  )
56
- }
57
+ },
57
58
  },
58
59
  {
59
60
  title: '角色编码',
60
61
  dataIndex: 'roleCode',
61
- key: 'roleCode'
62
+ key: 'roleCode',
62
63
  },
63
64
  {
64
65
  title: '来源',
@@ -72,7 +73,7 @@ export default function Role({ historyAction }: RoleProps) {
72
73
  } else {
73
74
  return '未知'
74
75
  }
75
- }
76
+ },
76
77
  },
77
78
  {
78
79
  title: '角色描述',
@@ -82,10 +83,7 @@ export default function Role({ historyAction }: RoleProps) {
82
83
  if (text?.length > 30) {
83
84
  let sliceText = text.slice(0, 30)
84
85
  return (
85
- <Popover
86
- content={<div style={{ width: '300px', wordWrap: 'break-word' }}>{text}</div>}
87
- trigger='hover'
88
- >
86
+ <Popover content={<div style={{ width: '300px', wordWrap: 'break-word' }}>{text}</div>} trigger="hover">
89
87
  {sliceText}
90
88
  <a>更多</a>
91
89
  </Popover>
@@ -93,7 +91,7 @@ export default function Role({ historyAction }: RoleProps) {
93
91
  } else {
94
92
  return text
95
93
  }
96
- }
94
+ },
97
95
  },
98
96
  {
99
97
  title: '创建时间',
@@ -101,7 +99,7 @@ export default function Role({ historyAction }: RoleProps) {
101
99
  key: 'gmtCreate',
102
100
  render: (cell: any) => {
103
101
  return timeFormatter(cell)
104
- }
102
+ },
105
103
  },
106
104
  {
107
105
  title: '更新时间',
@@ -109,7 +107,7 @@ export default function Role({ historyAction }: RoleProps) {
109
107
  key: 'gmtModified',
110
108
  render: (cell: any) => {
111
109
  return timeFormatter(cell)
112
- }
110
+ },
113
111
  },
114
112
  {
115
113
  title: '操作',
@@ -131,7 +129,7 @@ export default function Role({ historyAction }: RoleProps) {
131
129
  onClick={() => {
132
130
  historyAction?.push({
133
131
  pathname: `/role-info`,
134
- search: `?roleCode=${rowdata.roleCode}`
132
+ search: `?roleCode=${rowdata.roleCode}`,
135
133
  })
136
134
  }}
137
135
  >
@@ -153,7 +151,7 @@ export default function Role({ historyAction }: RoleProps) {
153
151
  content: '',
154
152
  onOk: () => {
155
153
  DeleteFunc(rowdata?.roleCode)
156
- }
154
+ },
157
155
  })
158
156
  }}
159
157
  >
@@ -161,14 +159,14 @@ export default function Role({ historyAction }: RoleProps) {
161
159
  </a>
162
160
  )}
163
161
  </Space>
164
- )
165
- }
162
+ ),
163
+ },
166
164
  ]
167
165
 
168
166
  const handleOnReset: any = async (values: any) => {
169
167
  searchFormRef.current = { ...values }
170
168
  execute({
171
- innerPageNo: 1
169
+ innerPageNo: 1,
172
170
  })
173
171
  }
174
172
 
@@ -181,20 +179,20 @@ export default function Role({ historyAction }: RoleProps) {
181
179
  return pageRequest({
182
180
  currentPage: innerPageNo,
183
181
  pageSize: innerPageSize,
184
- ...searchFormRef.current
182
+ ...searchFormRef.current,
185
183
  }).then((res: any) => {
186
184
  let records = get(res, 'records', [])
187
185
  let total = get(res, 'total', 0)
188
186
  return {
189
187
  ...res,
190
188
  dataList: records,
191
- totalCount: total
189
+ totalCount: total,
192
190
  }
193
191
  })
194
192
  }
195
193
 
196
194
  const { execute, dataList, isLoading, pagination } = useTableHooks({
197
- asyncFunction: readDataList
195
+ asyncFunction: readDataList,
198
196
  })
199
197
 
200
198
  const handleRoload = () => {
@@ -216,43 +214,54 @@ export default function Role({ historyAction }: RoleProps) {
216
214
  }
217
215
  const DeleteFunc = (roleCode: any) => {
218
216
  remove({
219
- roleCode
217
+ roleCode,
220
218
  }).then((res: any) => {
221
219
  message.success('删除成功')
222
220
  execute()
223
221
  })
224
222
  }
223
+
224
+ const productCode = (window as any).g_config.productCode
225
225
  return (
226
226
  <PageContainer>
227
227
  <QueryFilter onReset={handleOnReset} onFinish={handleOnFinish}>
228
- <ProFormText name='roleName' label='角色名称' />
228
+ <ProFormText name="roleName" label="角色名称" />
229
229
  </QueryFilter>
230
230
 
231
231
  <ProTable
232
232
  columnsState={{
233
233
  persistenceKey: 'base_cpcRole',
234
- persistenceType: 'localStorage'
234
+ persistenceType: 'localStorage',
235
235
  }}
236
236
  toolBarRender={() => {
237
237
  return [
238
238
  <Button
239
- key='add'
240
- type='primary'
239
+ key="add"
240
+ type="primary"
241
241
  onClick={() => {
242
242
  setModalOpen(true)
243
243
  }}
244
244
  >
245
245
  新增角色
246
- </Button>
246
+ </Button>,
247
247
  ]
248
248
  }}
249
- headerTitle={'角色列表'}
249
+ headerTitle={
250
+ productCode === 'puhui-console' ? (
251
+ <>
252
+ 角色列表
253
+ <DocumentEntry documentId={'ovsivik3nchylskc'} />
254
+ </>
255
+ ) : (
256
+ '角色列表'
257
+ )
258
+ }
250
259
  dataSource={dataList}
251
260
  loading={isLoading}
252
261
  columns={columns}
253
- rowKey='id'
262
+ rowKey="id"
254
263
  options={{
255
- reload: handleRoload
264
+ reload: handleRoload,
256
265
  }}
257
266
  />
258
267
  <Pagination {...pagination} />
@@ -0,0 +1,40 @@
1
+ interface Window {
2
+ g_config: {
3
+ token: string
4
+ tenant: Tenant
5
+ custom: Custom
6
+ user: User
7
+ logoutUrl: string
8
+ switchTenantUrl: string
9
+ productCode: string
10
+ env: string
11
+ logo: string
12
+ websiteIcon: string
13
+ }
14
+ }
15
+ interface Tenant {
16
+ id: string
17
+ bizShortCode: string
18
+ corpId: string
19
+ source: string
20
+ name: string
21
+ shortName: string
22
+ logo: string
23
+ }
24
+
25
+ interface Custom {
26
+ id: string
27
+ name: string
28
+ type: string
29
+ isCompleted: number
30
+ isAudited: number
31
+ }
32
+
33
+ interface User {
34
+ id: string
35
+ name: string
36
+ avatar: string
37
+ account: string
38
+ roleInfo: string[]
39
+ isMaster: boolean
40
+ }