cfel-base-components 0.0.12 → 0.0.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/README.md CHANGED
@@ -0,0 +1,2 @@
1
+ <!-- npm run dev
2
+ npm pubilsh -->
@@ -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
- user={{
10
- name: "\u5434\u6668\u61CB\uFF08\u592A\u4E00\uFF09",
11
- avatar: "https:\/\/static-legacy.dingtalk.com\/media\/lQLPM5AkqOufBy7NAyDNAyCwJZ592czMOC4EeIgNJAAGAA_800_800.png",
12
- tenantName: "\u8FDC\u822A\u8DE8\u56FD\u63A7\u80A1\u96C6\u56E2",
13
- switchTenantUrl: "https:\/\/cfel-sso-daily.chengfengerlai.com\/tenant\/switch?fakeAccountId=1676424765496406018\u0026redirect=http:\/\/lios-iot-obee-daily.chengfengerlai.com\/sso\/login?back=http%3A%2F%2Flios-iot-obee-daily.chengfengerlai.com%2Fweb",
14
- // role:["超级管理员","超管","子管理员","超级管理员","超级管理员123","子管理员","超级管理员","超级管理员123","子管理员","超级管理员","超级管理员123超级管理员123超级管理员123超级管理员123","子管理员"]
15
- // role:["超级管理员"]
16
- }}
17
- >
18
-
19
- </Layout >
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.12",
3
+ "version": "0.0.14",
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,13 @@
1
+ .page-container {
2
+ background: white;
3
+ border-radius: 8px;
4
+ flex: 1;
5
+ position: relative;
6
+ }
7
+ .page-footEmpower {
8
+ text-align: center;
9
+ color: #b6b6b6;
10
+ font-size: 10px;
11
+ padding: 4px 0px;
12
+ }
13
+
@@ -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,4 @@
1
+ .pagination {
2
+ text-align: right;
3
+ padding-right: 24px;
4
+ }
@@ -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,3 @@
1
+ .basicInfoWrap{
2
+ padding:0 24px
3
+ }
@@ -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
+
@@ -1,3 +0,0 @@
1
- .aaa-button {
2
- color: red;
3
- }
package/src/index.tsx CHANGED
@@ -1,8 +1,18 @@
1
1
  import LiosLayout, { LiosLayoutlProps } from './components/layout'
2
-
3
-
2
+ import Pagecontainer from './components/Pagecontainer'
3
+ import QueryFilter from './components/QueryFilter'
4
+ import ProTable from './components/ProTable'
5
+ import Pagination from './components/Pagination'
6
+ import Account from './components/account'
7
+ import AccountInfo from './components/accountInfo'
4
8
 
5
9
  export {
6
10
  LiosLayout,
7
- LiosLayoutlProps
11
+ LiosLayoutlProps,
12
+ Pagecontainer,
13
+ QueryFilter,
14
+ ProTable,
15
+ Pagination,
16
+ Account,
17
+ AccountInfo
8
18
  }