cfel-base-components 0.0.12 → 0.0.13
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/README.md +2 -0
- package/demo/src/index.jsx +38 -12
- package/package.json +5 -3
- package/src/components/Pagecontainer/index.scss +13 -0
- package/src/components/Pagecontainer/index.tsx +22 -0
- package/src/components/Pagination/index.scss +4 -0
- package/src/components/Pagination/index.tsx +20 -0
- package/src/components/ProTable/index.scss +0 -0
- package/src/components/ProTable/index.tsx +22 -0
- package/src/components/QueryFilter/index.scss +0 -0
- package/src/components/QueryFilter/index.tsx +20 -0
- package/src/components/account/index.scss +0 -0
- package/src/components/account/index.tsx +55 -0
- package/src/components/accountInfo/EditAccountDrawer/index.tsx +80 -0
- package/src/components/accountInfo/index.scss +3 -0
- package/src/components/accountInfo/index.tsx +93 -0
- package/src/components/button/index.scss +0 -3
package/README.md
CHANGED
package/demo/src/index.jsx
CHANGED
|
@@ -2,23 +2,49 @@ import React from "react"
|
|
|
2
2
|
import { createRoot } from 'react-dom/client';
|
|
3
3
|
import './index.scss';
|
|
4
4
|
import Layout from '../../src/components/layout';
|
|
5
|
+
import Account from '../../src/components/account';
|
|
6
|
+
import AccountInfo from '../../src/components/accountinfo';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
5
10
|
|
|
6
11
|
const App = () => {
|
|
7
12
|
return (
|
|
8
|
-
< Layout appName="123123" productCode="lios-iot-wifi"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
>
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
// < Layout appName="123123" productCode="lios-iot-wifi"
|
|
14
|
+
// user={{
|
|
15
|
+
// name: "\u5434\u6668\u61CB\uFF08\u592A\u4E00\uFF09",
|
|
16
|
+
// avatar: "https:\/\/static-legacy.dingtalk.com\/media\/lQLPM5AkqOufBy7NAyDNAyCwJZ592czMOC4EeIgNJAAGAA_800_800.png",
|
|
17
|
+
// tenantName: "\u8FDC\u822A\u8DE8\u56FD\u63A7\u80A1\u96C6\u56E2",
|
|
18
|
+
// role:["超级管理员","超管","子管理员","超级管理员","超级管理员123","子管理员","超级管理员","超级管理员123","子管理员","超级管理员","超级管理员123超级管理员123超级管理员123超级管理员123","子管理员"]
|
|
19
|
+
// // role:["超级管理员"]
|
|
20
|
+
// }}
|
|
21
|
+
// >
|
|
22
|
+
// </Layout >
|
|
23
|
+
<>
|
|
24
|
+
|
|
25
|
+
{/* <Account
|
|
26
|
+
// dataList={dataList} //表格数据
|
|
27
|
+
// columns={columns} //列
|
|
28
|
+
// isLoading={isLoading} //加载
|
|
29
|
+
// handleRoload={handleRoload} //分页
|
|
30
|
+
// handleOnReset={handleOnReset} //重置
|
|
31
|
+
// handleOnFinish={handleOnFinish} //搜索
|
|
32
|
+
// pagination={pagination} //分页配置
|
|
33
|
+
></Account> */}
|
|
20
34
|
|
|
35
|
+
<AccountInfo
|
|
36
|
+
accountInfo={accountInfo} //用户详情
|
|
37
|
+
timeFormatter={timeFormatter} //时间戳转换
|
|
38
|
+
dataList={dataList} //表格数据
|
|
39
|
+
columns={columns} //列
|
|
40
|
+
isLoading={isLoading} //加载
|
|
41
|
+
handleRoload={handleRoload} //分页
|
|
42
|
+
pagination={pagination} //分页配置
|
|
43
|
+
isBoundRolesFunc={isBoundRolesFunc} //绑定/解绑事件
|
|
44
|
+
getQueryBoundRolesFunc={getQueryBoundRolesFunc} //绑定打开弹框
|
|
45
|
+
/>
|
|
21
46
|
|
|
47
|
+
</>
|
|
22
48
|
);
|
|
23
49
|
}
|
|
24
50
|
const container = document.getElementById('root');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cfel-base-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"description": "cfel-base-components",
|
|
5
5
|
"main": "/src/index.tsx",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -40,7 +40,9 @@
|
|
|
40
40
|
"webpack-dev-server": "^4.15.1",
|
|
41
41
|
"webpack-merge": "^5.9.0"
|
|
42
42
|
},
|
|
43
|
-
"peerDependencies":{
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"@ant-design/icons": "^5.1.4",
|
|
45
|
+
"@ant-design/pro-components": "^2.6.12",
|
|
44
46
|
"antd": "^5.5.2"
|
|
45
47
|
}
|
|
46
|
-
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import "./index.scss"
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export default function PageContainer({
|
|
6
|
+
className,
|
|
7
|
+
children,
|
|
8
|
+
...restFileds
|
|
9
|
+
}: any) {
|
|
10
|
+
return (
|
|
11
|
+
<>
|
|
12
|
+
<div
|
|
13
|
+
className={`page-container ${className}`}
|
|
14
|
+
{...restFileds}
|
|
15
|
+
>
|
|
16
|
+
{children}
|
|
17
|
+
</div>
|
|
18
|
+
<div className="page-footEmpower">
|
|
19
|
+
©{new Date().getFullYear() || ''} 橙蜂而来{' '}
|
|
20
|
+
</div>
|
|
21
|
+
</>)
|
|
22
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Pagination, PaginationProps } from 'antd';
|
|
3
|
+
import "./index.scss"
|
|
4
|
+
|
|
5
|
+
export default function PaginationComponent (props: PaginationProps){
|
|
6
|
+
const { className } = props
|
|
7
|
+
return (
|
|
8
|
+
<div
|
|
9
|
+
className={`pagination ${className}`}
|
|
10
|
+
>
|
|
11
|
+
<Pagination
|
|
12
|
+
showQuickJumper
|
|
13
|
+
showSizeChanger
|
|
14
|
+
showTotal={(total) => `共 ${total} 条`}
|
|
15
|
+
{...props}
|
|
16
|
+
/>
|
|
17
|
+
</div>
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
ProTable,
|
|
4
|
+
ProTableProps
|
|
5
|
+
} from '@ant-design/pro-components';
|
|
6
|
+
import "./index.scss"
|
|
7
|
+
|
|
8
|
+
export default function ProTableComponent (props: ProTableProps<any,any>){
|
|
9
|
+
const { className } = props
|
|
10
|
+
return (
|
|
11
|
+
<ProTable
|
|
12
|
+
className={`protable ${className}`}
|
|
13
|
+
search={false}
|
|
14
|
+
pagination={false}
|
|
15
|
+
scroll={{
|
|
16
|
+
x: 'max-content'
|
|
17
|
+
}}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
QueryFilter,
|
|
4
|
+
QueryFilterProps
|
|
5
|
+
} from '@ant-design/pro-components';
|
|
6
|
+
import "./index.scss"
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export default function PaginationComponent (props: QueryFilterProps<any>){
|
|
11
|
+
const { className } = props
|
|
12
|
+
return (
|
|
13
|
+
<QueryFilter
|
|
14
|
+
className={`queryfilter ${className}`}
|
|
15
|
+
layout="vertical"
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import Pagecontainer from '../Pagecontainer';
|
|
3
|
+
import QueryFilter from '../QueryFilter';
|
|
4
|
+
import ProTable from '../ProTable';
|
|
5
|
+
import Pagination from '../Pagination';
|
|
6
|
+
import {
|
|
7
|
+
ProFormText,
|
|
8
|
+
} from '@ant-design/pro-components';
|
|
9
|
+
|
|
10
|
+
import "./index.scss"
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
export interface AccountProps {
|
|
14
|
+
dataList:any;
|
|
15
|
+
columns:any;
|
|
16
|
+
isLoading:any;
|
|
17
|
+
handleRoload:()=>any;
|
|
18
|
+
pagination:any;
|
|
19
|
+
handleOnReset:(item:any)=>any;
|
|
20
|
+
handleOnFinish:(item:any)=>any;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default function Account({
|
|
24
|
+
dataList,
|
|
25
|
+
columns,
|
|
26
|
+
isLoading,
|
|
27
|
+
handleRoload,
|
|
28
|
+
pagination,
|
|
29
|
+
handleOnReset,
|
|
30
|
+
handleOnFinish
|
|
31
|
+
}: AccountProps) {
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<Pagecontainer>
|
|
35
|
+
<QueryFilter
|
|
36
|
+
onReset={handleOnReset}
|
|
37
|
+
onFinish={handleOnFinish}
|
|
38
|
+
>
|
|
39
|
+
<ProFormText name="name" label="名称" />
|
|
40
|
+
<ProFormText name="account" label="账号" />
|
|
41
|
+
</QueryFilter>
|
|
42
|
+
<ProTable
|
|
43
|
+
headerTitle={"账号列表"}
|
|
44
|
+
dataSource={dataList}
|
|
45
|
+
loading={isLoading}
|
|
46
|
+
columns={columns}
|
|
47
|
+
rowKey="id"
|
|
48
|
+
options={{
|
|
49
|
+
reload: handleRoload
|
|
50
|
+
}}
|
|
51
|
+
/>
|
|
52
|
+
<Pagination {...pagination} />
|
|
53
|
+
</Pagecontainer>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
import { Button, Drawer, Select, Form, Space } from 'antd';
|
|
3
|
+
|
|
4
|
+
interface propsType {
|
|
5
|
+
open: boolean;
|
|
6
|
+
editOpenStatus: Function;
|
|
7
|
+
isBoundRolesFunc: Function;
|
|
8
|
+
rolelistRoleData: any;
|
|
9
|
+
roleCheckData: any;
|
|
10
|
+
}
|
|
11
|
+
export default function index({
|
|
12
|
+
open,
|
|
13
|
+
editOpenStatus,
|
|
14
|
+
isBoundRolesFunc,
|
|
15
|
+
rolelistRoleData,
|
|
16
|
+
roleCheckData,
|
|
17
|
+
}: propsType) {
|
|
18
|
+
|
|
19
|
+
const [form] = Form.useForm();
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (!open) return
|
|
22
|
+
form.setFieldsValue({
|
|
23
|
+
roleCodes: roleCheckData || [],
|
|
24
|
+
})
|
|
25
|
+
}, [open])
|
|
26
|
+
|
|
27
|
+
const onCloseDrawer = () => {
|
|
28
|
+
editOpenStatus(false)
|
|
29
|
+
}
|
|
30
|
+
const onFinishForm = () => {
|
|
31
|
+
form.validateFields()
|
|
32
|
+
.then((values) => {
|
|
33
|
+
isBoundRolesFunc(true, values).then((res: any) => {
|
|
34
|
+
form.resetFields()
|
|
35
|
+
})
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
return (<Drawer
|
|
39
|
+
title="绑定的角色"
|
|
40
|
+
closable={false}
|
|
41
|
+
open={open}
|
|
42
|
+
destroyOnClose={true}
|
|
43
|
+
onClose={() => { onCloseDrawer() }}
|
|
44
|
+
footer={<Space>
|
|
45
|
+
<Button
|
|
46
|
+
type="primary"
|
|
47
|
+
onClick={() => {
|
|
48
|
+
onFinishForm()
|
|
49
|
+
}}
|
|
50
|
+
>保存</Button>
|
|
51
|
+
<Button
|
|
52
|
+
onClick={() => { onCloseDrawer() }}
|
|
53
|
+
>取消</Button>
|
|
54
|
+
</Space>
|
|
55
|
+
}
|
|
56
|
+
>
|
|
57
|
+
<Form
|
|
58
|
+
form={form}
|
|
59
|
+
layout={'vertical'}
|
|
60
|
+
initialValues={{ remember: true }}
|
|
61
|
+
autoComplete="off"
|
|
62
|
+
>
|
|
63
|
+
<Form.Item
|
|
64
|
+
name="roleCodes"
|
|
65
|
+
label="绑定角色"
|
|
66
|
+
rules={[{ required: true, message: '' }]} >
|
|
67
|
+
<Select
|
|
68
|
+
mode="multiple"
|
|
69
|
+
allowClear
|
|
70
|
+
placeholder="请选择"
|
|
71
|
+
options={rolelistRoleData?.map((d: any) => ({
|
|
72
|
+
label: d.roleName,
|
|
73
|
+
value: d.roleCode,
|
|
74
|
+
}))}
|
|
75
|
+
/>
|
|
76
|
+
</Form.Item>
|
|
77
|
+
</Form>
|
|
78
|
+
</Drawer >
|
|
79
|
+
);
|
|
80
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import React, { useEffect, useRef ,useState} from 'react';
|
|
2
|
+
import Pagecontainer from '../Pagecontainer';
|
|
3
|
+
import ProTable from '../ProTable';
|
|
4
|
+
import Pagination from '../Pagination';
|
|
5
|
+
|
|
6
|
+
import { Modal, Button, Divider, Descriptions, Space, message, Avatar } from 'antd';
|
|
7
|
+
import { UserOutlined } from '@ant-design/icons';
|
|
8
|
+
import EditAccountDrawer from './EditAccountDrawer/index'
|
|
9
|
+
|
|
10
|
+
import "./index.scss"
|
|
11
|
+
|
|
12
|
+
export interface AccountInfoProps {
|
|
13
|
+
accountInfo:any;
|
|
14
|
+
timeFormatter:(item:any)=>any;
|
|
15
|
+
dataList:any;
|
|
16
|
+
columns:any;
|
|
17
|
+
isLoading:any;
|
|
18
|
+
handleRoload:()=>any;
|
|
19
|
+
pagination:any;
|
|
20
|
+
isBoundRolesFunc:(type:any,item:any)=>any;
|
|
21
|
+
getQueryBoundRolesFunc:()=>any;
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default function AccountInfo ({
|
|
26
|
+
accountInfo,
|
|
27
|
+
timeFormatter,
|
|
28
|
+
dataList,
|
|
29
|
+
columns,
|
|
30
|
+
isLoading,
|
|
31
|
+
handleRoload,
|
|
32
|
+
pagination,
|
|
33
|
+
isBoundRolesFunc,
|
|
34
|
+
getQueryBoundRolesFunc
|
|
35
|
+
}: AccountInfoProps) {
|
|
36
|
+
const [rolelistRoleData, setRolelistRoleData]: any = useState([]); // 角色总数据
|
|
37
|
+
const [roleCheckData, setRoleCheckData]: any = useState([]); //当前选中的角色list
|
|
38
|
+
|
|
39
|
+
const [editAccountOpen, setEditAccountOpen] = useState(false);
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<Pagecontainer>
|
|
43
|
+
<Divider orientation="left">
|
|
44
|
+
<Avatar
|
|
45
|
+
style={{ backgroundColor: '#1677ff', marginRight: '8px' }}
|
|
46
|
+
draggable={false}
|
|
47
|
+
icon={<UserOutlined />}
|
|
48
|
+
src={!!accountInfo.avatar ? accountInfo.avatar : undefined}
|
|
49
|
+
/>
|
|
50
|
+
{accountInfo?.name || ''}
|
|
51
|
+
</Divider>
|
|
52
|
+
<Descriptions className='basicInfoWrap'>
|
|
53
|
+
<Descriptions.Item label="账号">{accountInfo?.account || ''}</Descriptions.Item>
|
|
54
|
+
<Descriptions.Item label="员工工号">{accountInfo?.jobNumber || ''}</Descriptions.Item>
|
|
55
|
+
<Descriptions.Item label="名称">{accountInfo?.name || ''}</Descriptions.Item>
|
|
56
|
+
<Descriptions.Item label="手机号">{accountInfo?.mobile || ''}</Descriptions.Item>
|
|
57
|
+
<Descriptions.Item label="邮箱">{accountInfo?.email || ''}</Descriptions.Item>
|
|
58
|
+
<Descriptions.Item label="是否企业管理员">{accountInfo?.isAdmin ? '是' : '否'}</Descriptions.Item>
|
|
59
|
+
<Descriptions.Item label="创建时间">{timeFormatter(accountInfo?.gmtCreate)}</Descriptions.Item>
|
|
60
|
+
<Descriptions.Item label="修改时间">{timeFormatter(accountInfo?.gmtModified)}</Descriptions.Item>
|
|
61
|
+
</Descriptions>
|
|
62
|
+
|
|
63
|
+
<ProTable
|
|
64
|
+
headerTitle={"绑定的角色"}
|
|
65
|
+
dataSource={dataList}
|
|
66
|
+
loading={isLoading}
|
|
67
|
+
columns={columns}
|
|
68
|
+
rowKey="id"
|
|
69
|
+
options={{
|
|
70
|
+
reload: handleRoload
|
|
71
|
+
}}
|
|
72
|
+
toolBarRender={() => {
|
|
73
|
+
return [
|
|
74
|
+
<Button type="primary" onClick={(() => {
|
|
75
|
+
getQueryBoundRolesFunc()
|
|
76
|
+
})}>绑定</Button>
|
|
77
|
+
];
|
|
78
|
+
}}
|
|
79
|
+
/>
|
|
80
|
+
<Pagination {...pagination} />
|
|
81
|
+
|
|
82
|
+
<EditAccountDrawer
|
|
83
|
+
open={editAccountOpen} // 状态
|
|
84
|
+
editOpenStatus={setEditAccountOpen} //修改弹框显隐事件
|
|
85
|
+
rolelistRoleData={rolelistRoleData} //总角色
|
|
86
|
+
roleCheckData={roleCheckData} //当前角色选中数据
|
|
87
|
+
isBoundRolesFunc={isBoundRolesFunc}
|
|
88
|
+
></EditAccountDrawer>
|
|
89
|
+
</Pagecontainer>
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
}
|
|
93
|
+
|