cfel-base-components 0.0.16 → 0.0.17

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.
@@ -4,6 +4,8 @@ import './index.scss';
4
4
  import Layout from '../../src/components/layout';
5
5
  import Account from '../../src/components/account';
6
6
  import AccountInfo from '../../src/components/accountinfo';
7
+ import Role from '../../src/components/role';
8
+ import RoleInfo from '../../src/components/roleinfo';
7
9
 
8
10
 
9
11
 
@@ -32,7 +34,7 @@ const App = () => {
32
34
  // pagination={pagination} //分页配置
33
35
  ></Account> */}
34
36
 
35
- <AccountInfo
37
+ {/* <AccountInfo
36
38
  accountInfo={accountInfo} //用户详情
37
39
  timeFormatter={timeFormatter} //时间戳转换
38
40
  dataList={dataList} //表格数据
@@ -46,8 +48,34 @@ const App = () => {
46
48
  setEditAccountOpen={setEditAccountOpen}// 关闭弹框
47
49
  rolelistRoleData={rolelistRoleData} //弹框总角色数据
48
50
  roleCheckData={roleCheckData} //弹框当前选中
49
- />
51
+ /> */}
52
+ {/* <Role
53
+ // dataList={dataList} //表格数据
54
+ // columns={columns} //列
55
+ // isLoading={isLoading} //加载
56
+ // handleRoload={handleRoload} //分页
57
+ // handleOnReset={handleOnReset} //重置
58
+ // handleOnFinish={handleOnFinish} //搜索
59
+ // pagination={pagination} //分页配置
60
+ ></Role> */}
61
+
62
+ {/* <RoleInfo
63
+ accountInfo={accountInfo} //角色详情
64
+ timeFormatter={timeFormatter} //时间戳转换
65
+ dataList={dataList} //表格数据
66
+ columns={columns} //列
67
+ isLoading={isLoading} //加载
68
+ handleRoload={handleRoload} //分页
69
+ pagination={pagination} //分页配置
70
+ handleOnFinish={handleOnFinish} //搜索
71
+ handleOnReset={handleOnReset} //重置
72
+ queryByKeywordFunc={queryByKeywordFunc}
73
+ getQueryBoundRolesFunc={getQueryBoundRolesFunc} //绑定打开弹框
74
+ editAccountOpen={editAccountOpen}// 弹框状态
75
+ setEditAccountOpen={setEditAccountOpen}// 关闭弹框
76
+ roleBoundAccountsFunc={roleBoundAccountsFunc} //绑定/解绑事件
50
77
 
78
+ /> */}
51
79
  </>
52
80
  );
53
81
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cfel-base-components",
3
- "version": "0.0.16",
3
+ "version": "0.0.17",
4
4
  "description": "cfel-base-components",
5
5
  "main": "/src/index.tsx",
6
6
  "types": "src/index.d.ts",
@@ -1,23 +1,22 @@
1
1
  import React, { useEffect, useRef, useState } from 'react';
2
- import Pagecontainer from '../Pagecontainer';
2
+ import PageContainer from '../PageContainer';
3
3
  import QueryFilter from '../QueryFilter';
4
4
  import ProTable from '../ProTable';
5
5
  import Pagination from '../Pagination';
6
6
  import {
7
7
  ProFormText,
8
8
  } from '@ant-design/pro-components';
9
-
10
9
  import "./index.scss"
11
10
 
12
11
 
13
12
  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;
13
+ dataList: any;
14
+ columns: any;
15
+ isLoading: any;
16
+ handleRoload: () => any;
17
+ pagination: any;
18
+ handleOnReset: (item: any) => any;
19
+ handleOnFinish: (item: any) => any;
21
20
  }
22
21
 
23
22
  export default function Account({
@@ -29,27 +28,27 @@ export default function Account({
29
28
  handleOnReset,
30
29
  handleOnFinish
31
30
  }: AccountProps) {
32
-
31
+
33
32
  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>
33
+ <PageContainer>
34
+ <QueryFilter
35
+ onReset={handleOnReset}
36
+ onFinish={handleOnFinish}
37
+ >
38
+ <ProFormText name="name" label="名称" />
39
+ <ProFormText name="account" label="账号" />
40
+ </QueryFilter>
41
+ <ProTable
42
+ headerTitle={"账号列表"}
43
+ dataSource={dataList}
44
+ loading={isLoading}
45
+ columns={columns}
46
+ rowKey="id"
47
+ options={{
48
+ reload: handleRoload
49
+ }}
50
+ />
51
+ <Pagination {...pagination} />
52
+ </PageContainer>
54
53
  )
55
54
  }
@@ -1,5 +1,5 @@
1
- import React, { useEffect, useRef ,useState} from 'react';
2
- import Pagecontainer from '../Pagecontainer';
1
+ import React, { useEffect, useRef, useState } from 'react';
2
+ import Pagecontainer from '../PageContainer';
3
3
  import ProTable from '../ProTable';
4
4
  import Pagination from '../Pagination';
5
5
 
@@ -10,22 +10,22 @@ import EditAccountDrawer from './EditAccountDrawer/index'
10
10
  import "./index.scss"
11
11
 
12
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
- editAccountOpen:any
23
- setEditAccountOpen:(item:any)=>any;
24
- rolelistRoleData:any,
25
- roleCheckData:any,
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
+ editAccountOpen: any
23
+ setEditAccountOpen: (item: any) => any;
24
+ rolelistRoleData: any,
25
+ roleCheckData: any,
26
26
  }
27
27
 
28
- export default function AccountInfo ({
28
+ export default function AccountInfo({
29
29
  accountInfo,//用户详情
30
30
  timeFormatter,//时间戳转换
31
31
  dataList,//表格数据
@@ -39,7 +39,7 @@ export default function AccountInfo ({
39
39
  setEditAccountOpen, //关闭弹框
40
40
  rolelistRoleData, //总角色数据
41
41
  roleCheckData, //当前选中
42
-
42
+
43
43
  }: AccountInfoProps) {
44
44
 
45
45
  return (
@@ -92,6 +92,6 @@ export default function AccountInfo ({
92
92
  ></EditAccountDrawer>
93
93
  </Pagecontainer>
94
94
  )
95
-
95
+
96
96
  }
97
97
 
File without changes
@@ -0,0 +1,53 @@
1
+ import React, { useEffect, useRef } 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
+ import "./index.scss"
10
+
11
+ export interface RoleProps {
12
+ dataList: any;
13
+ columns: any;
14
+ isLoading: any;
15
+ handleRoload: () => any;
16
+ pagination: any;
17
+ handleOnReset: (item: any) => any;
18
+ handleOnFinish: (item: any) => any;
19
+ }
20
+
21
+ export default function Role({
22
+ dataList,
23
+ columns,
24
+ isLoading,
25
+ handleRoload,
26
+ pagination,
27
+ handleOnReset,
28
+ handleOnFinish
29
+ }: RoleProps) {
30
+ return (
31
+ <PageContainer >
32
+ <QueryFilter
33
+ onReset={handleOnReset}
34
+ onFinish={handleOnFinish}
35
+ >
36
+ <ProFormText name="roleName" label="角色名称" />
37
+ </QueryFilter>
38
+
39
+ <ProTable
40
+ headerTitle={"角色列表"}
41
+ dataSource={dataList}
42
+ loading={isLoading}
43
+ columns={columns}
44
+ rowKey="id"
45
+ options={{
46
+ reload: handleRoload
47
+ }}
48
+ />
49
+ <Pagination {...pagination} />
50
+
51
+ </PageContainer >
52
+ )
53
+ };
@@ -0,0 +1,110 @@
1
+ import React, { useCallback, useEffect, useRef, useState } from 'react';
2
+ import { Button, Drawer, Select, Modal, Form, Spin, Space } from 'antd';
3
+
4
+
5
+ interface propsType {
6
+ open: boolean;
7
+ editOpenStatus: Function;
8
+ roleBoundAccountsFunc: Function;
9
+ queryByKeywordFunc: Function;
10
+ }
11
+
12
+ export default function index({
13
+ open,
14
+ editOpenStatus,
15
+ roleBoundAccountsFunc,
16
+ queryByKeywordFunc
17
+ }: propsType) {
18
+ const [form] = Form.useForm();
19
+ const [selectOptions, useSelectOptions] = useState([])
20
+
21
+ useEffect(() => {
22
+ form.resetFields()
23
+ }, [open])
24
+
25
+ const editModelOpen = (type: boolean) => {
26
+ editOpenStatus(type);
27
+ };
28
+
29
+ const onCloseDrawer = () => {
30
+ editModelOpen(false)
31
+ }
32
+
33
+ function useDebounce(fn: any, delay: any, dep = []) {
34
+ const { current }: any = useRef({ fn, timer: null });
35
+ useEffect(function () {
36
+ current.fn = fn;
37
+ }, [fn]);
38
+ return useCallback(function f(...args: any) {
39
+ if (current.timer) {
40
+ clearTimeout(current.timer);
41
+ }
42
+ current.timer = setTimeout(() => {
43
+ current.fn(...args);
44
+ }, delay);
45
+ }, dep)
46
+ }
47
+
48
+ const queryByKeywordSearch = useDebounce((keyword: any) => {
49
+ queryByKeywordFunc({
50
+ keyword
51
+ }).then((res: any) => {
52
+ useSelectOptions(res)
53
+ }).catch((err) => {
54
+ })
55
+ }, 500)
56
+
57
+ const onFinishForm = () => {
58
+ form.validateFields()
59
+ .then((values) => {
60
+ roleBoundAccountsFunc(values)
61
+ })
62
+ }
63
+
64
+ return (
65
+ <Drawer
66
+ title="绑定的角色"
67
+ closable={false}
68
+ open={open}
69
+ destroyOnClose={true}
70
+ onClose={() => { onCloseDrawer() }}
71
+ footer={<Space>
72
+ <Button
73
+ key="submit"
74
+ type="primary"
75
+ onClick={() => {
76
+ onFinishForm()
77
+ }}
78
+ >保存</Button>
79
+ <Button
80
+ key="refresh"
81
+ onClick={() => { onCloseDrawer() }}
82
+ >取消</Button>
83
+ </Space>}
84
+ >
85
+ <Form
86
+ form={form}
87
+ layout={'vertical'}
88
+ initialValues={{ remember: true }}
89
+ autoComplete="off"
90
+ >
91
+ <Form.Item name="accountIds" label="添加账号"
92
+ rules={[{ required: true, message: '请选中账号!' }]}>
93
+ <Select
94
+ mode="multiple"
95
+ allowClear
96
+ placeholder="根据名称或账号搜索"
97
+ options={(selectOptions || []).map((d: any) => ({
98
+ value: d.id,
99
+ label: d.name,
100
+ }))}
101
+ onSearch={((e) => {
102
+ queryByKeywordSearch(e)
103
+ })}
104
+ filterOption={false}
105
+ />
106
+ </Form.Item>
107
+ </Form>
108
+ </Drawer>
109
+ );
110
+ }
@@ -0,0 +1,3 @@
1
+ .basicInfoWrap{
2
+ padding:0 24px
3
+ }
@@ -0,0 +1,94 @@
1
+ import React, { useEffect, useRef } 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
+ import { Button, Divider, Modal, Descriptions, Space, } from 'antd';
10
+ import EditAccountDrawer from './EditAccountDrawer/index'
11
+
12
+ import "./index.scss"
13
+ export interface RoleProps {
14
+ roleInfo: any;
15
+ timeFormatter: (item: any) => any;
16
+ handleOnReset: () => any;
17
+ handleOnFinish: () => any;
18
+ dataList: any;
19
+ columns: any;
20
+ isLoading: any;
21
+ handleRoload: () => any;
22
+ pagination: any;
23
+ getQueryBoundRolesFunc: () => any;
24
+ editAccountOpen: any
25
+ setEditAccountOpen: (item: any) => any;
26
+ roleBoundAccountsFunc: (item: any) => any;
27
+ queryByKeywordFunc: (item: any) => any;
28
+
29
+ // rolelistRoleData: any,
30
+ // roleCheckData: any,
31
+ }
32
+ export default function RoleInfo({
33
+ roleInfo,
34
+ timeFormatter,
35
+ handleOnReset,
36
+ handleOnFinish,
37
+ dataList,
38
+ columns,
39
+ isLoading,
40
+ handleRoload,
41
+ pagination,
42
+ getQueryBoundRolesFunc,
43
+ editAccountOpen,
44
+ setEditAccountOpen,
45
+ roleBoundAccountsFunc,
46
+ queryByKeywordFunc
47
+ }:RoleProps){
48
+ return(
49
+ <PageContainer>
50
+ <Divider orientation="left">{roleInfo?.roleName || "-"}</Divider>
51
+ <Descriptions className="basicInfoWrap">
52
+ <Descriptions.Item label="角色名称">{roleInfo?.roleName || ''}</Descriptions.Item>
53
+ <Descriptions.Item label="角色编码">{roleInfo?.roleCode || ''}</Descriptions.Item>
54
+ <Descriptions.Item label="角色描述">{roleInfo?.description || ''}</Descriptions.Item>
55
+ <Descriptions.Item label="创建时间">{timeFormatter(roleInfo?.gmtCreate) || ''}</Descriptions.Item>
56
+ <Descriptions.Item label="更新时间">{timeFormatter(roleInfo?.gmtModified) || ''}</Descriptions.Item>
57
+ </Descriptions>
58
+
59
+ <QueryFilter
60
+ onReset={handleOnReset}
61
+ onFinish={handleOnFinish}
62
+ >
63
+ <ProFormText name="keyword" label="关键词" />
64
+ </QueryFilter>
65
+
66
+ <ProTable
67
+ headerTitle={"角色下绑定的账号"}
68
+ dataSource={dataList}
69
+ loading={isLoading}
70
+ columns={columns}
71
+ rowKey="id"
72
+ options={{
73
+ reload: handleRoload
74
+ }}
75
+ toolBarRender={() => {
76
+ return [
77
+ <Button type="primary" onClick={(() => {
78
+ getQueryBoundRolesFunc()
79
+ })}>添加账号</Button>
80
+ ];
81
+ }}
82
+ />
83
+
84
+ <Pagination {...pagination} />
85
+ <EditAccountDrawer
86
+ open={editAccountOpen} // 状态
87
+ editOpenStatus={setEditAccountOpen} //修改弹框显隐事件
88
+ roleBoundAccountsFunc={roleBoundAccountsFunc}
89
+ queryByKeywordFunc={queryByKeywordFunc} //搜索事件
90
+ ></EditAccountDrawer>
91
+
92
+ </PageContainer>
93
+ )
94
+ };
package/src/index.tsx CHANGED
@@ -5,6 +5,8 @@ import ProTable from './components/ProTable'
5
5
  import Pagination from './components/Pagination'
6
6
  import Account from './components/account'
7
7
  import AccountInfo from './components/accountInfo'
8
+ import Role from './components/role'
9
+
8
10
 
9
11
  export {
10
12
  LiosLayout,
@@ -14,5 +16,6 @@ export {
14
16
  ProTable,
15
17
  Pagination,
16
18
  Account,
17
- AccountInfo
19
+ AccountInfo,
20
+ Role
18
21
  }