cfel-base-components 0.0.24 → 1.0.0

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.
Files changed (53) hide show
  1. package/README.md +1 -1
  2. package/config/webpack.base.js +11 -2
  3. package/demo/src/index.html +0 -26
  4. package/demo/src/index.jsx +11 -27
  5. package/demo/src/index.module.less +3 -0
  6. package/demo/src/index.scss +2 -59
  7. package/package.json +4 -5
  8. package/src/components/base-component/PageContainer/index.module.less +13 -0
  9. package/src/components/base-component/PageContainer/index.tsx +28 -0
  10. package/src/components/base-component/Pagination/index.tsx +22 -0
  11. package/src/components/base-component/ProTable/index.tsx +29 -0
  12. package/src/components/base-component/QueryFilter/index.tsx +24 -0
  13. package/src/components/layout/index.scss +1 -1
  14. package/src/components/universal-pages/account/index.tsx +54 -0
  15. package/src/components/universal-pages/accountInfo/index.tsx +98 -0
  16. package/src/components/universal-pages/role/index.tsx +53 -0
  17. package/src/components/{roleInfo → universal-pages/roleInfo}/EditAccountDrawer/index.tsx +0 -1
  18. package/src/components/universal-pages/roleInfo/index.scss +3 -0
  19. package/src/components/universal-pages/roleInfo/index.tsx +94 -0
  20. package/src/index.d.ts +8 -1
  21. package/src/index.tsx +10 -17
  22. package/.vscode/settings.json +0 -3
  23. package/src/.umi/core/helmet.ts +0 -10
  24. package/src/.umi/core/helmetContext.ts +0 -4
  25. package/src/apiRequest/config.ts +0 -71
  26. package/src/apiRequest/hosts.ts +0 -6
  27. package/src/apiRequest/iotConfig.ts +0 -71
  28. package/src/components/PageContainer/index.scss +0 -13
  29. package/src/components/PageContainer/index.tsx +0 -22
  30. package/src/components/Pagination/index.tsx +0 -20
  31. package/src/components/ProTable/index.tsx +0 -22
  32. package/src/components/QueryFilter/index.tsx +0 -20
  33. package/src/components/account/api.ts +0 -11
  34. package/src/components/account/index.tsx +0 -169
  35. package/src/components/accountInfo/api.ts +0 -26
  36. package/src/components/accountInfo/index.tsx +0 -229
  37. package/src/components/button/index.tsx +0 -16
  38. package/src/components/role/api.ts +0 -9
  39. package/src/components/role/index.scss +0 -0
  40. package/src/components/role/index.tsx +0 -141
  41. package/src/components/roleInfo/api.ts +0 -22
  42. package/src/components/roleInfo/index.scss +0 -3
  43. package/src/components/roleInfo/index.tsx +0 -239
  44. package/src/components/widthAutoLabelProps/index.tsx +0 -54
  45. package/src/hooks/useTableHooks.ts +0 -60
  46. package/src/utils/index.ts +0 -29
  47. /package/src/components/{Pagination/index.scss → base-component/Pagination/index.module.less} +0 -0
  48. /package/src/components/{ProTable/index.scss → base-component/ProTable/index.module.less} +0 -0
  49. /package/src/components/{QueryFilter/index.scss → base-component/QueryFilter/index.module.less} +0 -0
  50. /package/src/components/{account → universal-pages/account}/index.scss +0 -0
  51. /package/src/components/{accountInfo → universal-pages/accountInfo}/EditAccountDrawer/index.tsx +0 -0
  52. /package/src/components/{accountInfo → universal-pages/accountInfo}/index.scss +0 -0
  53. /package/src/components/{button → universal-pages/role}/index.scss +0 -0
package/src/index.tsx CHANGED
@@ -1,15 +1,13 @@
1
1
  import LiosLayout, { LiosLayoutlProps } from './components/layout'
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'
8
- import Role from './components/role'
9
- import RoleInfo from './components/roleInfo'
10
- import request from './apiRequest/config'
11
- import iotRequest from './apiRequest/iotConfig'
12
- import { getUrlParams, downloadFile, timeFormatter } from './utils/index'
2
+ import PageContainer from './components/base-component/PageContainer'
3
+ import QueryFilter from './components/base-component/QueryFilter'
4
+ import ProTable from './components/base-component/ProTable'
5
+ import Pagination from './components/base-component/Pagination'
6
+ import Account from './components/universal-pages/account'
7
+ import AccountInfo from './components/universal-pages/accountInfo'
8
+ import Role from './components/universal-pages/role'
9
+ import RoleInfo from './components/universal-pages/roleInfo'
10
+
13
11
  export {
14
12
  LiosLayout,
15
13
  LiosLayoutlProps,
@@ -20,10 +18,5 @@ export {
20
18
  Account,
21
19
  AccountInfo,
22
20
  Role,
23
- RoleInfo,
24
- request,
25
- iotRequest,
26
- getUrlParams,
27
- downloadFile,
28
- timeFormatter
21
+ RoleInfo
29
22
  }
@@ -1,3 +0,0 @@
1
- {
2
- "typescript.tsdk": "node_modules/typescript/lib"
3
- }
@@ -1,10 +0,0 @@
1
- // @ts-nocheck
2
- // This file is generated by Umi automatically
3
- // DO NOT CHANGE IT MANUALLY!
4
- import React from 'react';
5
- import { HelmetProvider } from '/Users/wujingang/Desktop/workspace/base-components/node_modules/@umijs/renderer-react';
6
- import { context } from './helmetContext';
7
-
8
- export const innerProvider = (container) => {
9
- return React.createElement(HelmetProvider, { context }, container);
10
- }
@@ -1,4 +0,0 @@
1
- // @ts-nocheck
2
- // This file is generated by Umi automatically
3
- // DO NOT CHANGE IT MANUALLY!
4
- export const context = {};
@@ -1,71 +0,0 @@
1
- import axios, { AxiosRequestHeaders } from 'axios';
2
- import { notification } from 'antd';
3
-
4
-
5
- let UMI_APP_BASEURL:any = window.location.origin || process.env
6
- const instance = axios.create({ baseURL: UMI_APP_BASEURL });
7
-
8
- instance.interceptors.request.use(
9
- (config: any) => {
10
- config.headers = {
11
- ...config.headers,
12
- "cfel-token": (window as any)?.g_config?.token
13
- } as AxiosRequestHeaders;
14
-
15
- config.params = {
16
- ...config.params,
17
- productCode: (window as any)?.g_config?.productCode,
18
- }
19
-
20
- return config;
21
- },
22
- (error: any) => Promise.reject(error)
23
- );
24
-
25
- instance.interceptors.response.use(
26
- //状态码为2xx的时候执行
27
- (response: any) => {
28
- const { data = {} } = response;
29
- const { success, content, errorCode, errorMsg } = data;
30
-
31
- if (!success) {
32
- notification.error({
33
- message: errorMsg
34
- });
35
- return Promise.reject(data);
36
- }
37
-
38
- return content;
39
- },
40
- //状态码不为2xx的时候执行
41
- (error: any) => {
42
- const { response = {} } = error;
43
- const { status } = response;
44
-
45
- enum CodeMessage {
46
- '发出的请求有错误,服务器没有进行新建或修改数据的操作。' = 400,
47
- '用户未登录。' = 401,
48
- '用户得到授权,但是访问是被禁止的。' = 403,
49
- '发出的请求针对的是不存在的记录,服务器没有进行操作。' = 404,
50
- '请求的格式不可得。' = 406,
51
- '请求的资源被永久删除,且不会再得到的。' = 410,
52
- '当创建一个对象时,发生一个验证错误。' = 422,
53
- '服务器发生错误,请检查服务器。' = 500,
54
- '网关错误。' = 502,
55
- '服务不可用,服务器暂时过载或维护。' = 503,
56
- '网关超时。' = 504
57
- }
58
-
59
- notification.error({
60
- message: response?.data?.message || CodeMessage[status]
61
- });
62
-
63
- if (status === 401) {
64
-
65
- }
66
-
67
- return Promise.reject(error);
68
- }
69
- );
70
-
71
- export default instance;
@@ -1,6 +0,0 @@
1
- export const hosts: any = {
2
- iot: {
3
- "daily": "https://lios-iot-daily.chengfengerlai.com",
4
- "product": ""
5
- }
6
- }
@@ -1,71 +0,0 @@
1
- import axios, { AxiosRequestHeaders } from 'axios';
2
- import { notification } from 'antd';
3
- import { hosts } from './hosts'
4
-
5
- const env = (window as any)?.g_config?.env
6
- const instance = axios.create({ baseURL: hosts["iot"][env] });
7
-
8
- instance.interceptors.request.use(
9
- (config: any) => {
10
- config.headers = {
11
- ...config.headers,
12
- "cfel-token": (window as any)?.g_config?.token
13
- } as AxiosRequestHeaders;
14
-
15
- config.params = {
16
- ...config.params,
17
- productCode: (window as any)?.g_config?.productCode,
18
- }
19
-
20
- return config;
21
- },
22
- (error: any) => Promise.reject(error)
23
- );
24
-
25
- instance.interceptors.response.use(
26
- //状态码为2xx的时候执行
27
- (response: any) => {
28
- const { data = {} } = response;
29
- const { success, content, errorCode, errorMsg } = data;
30
-
31
- if (!success) {
32
- notification.error({
33
- message: errorMsg
34
- });
35
- return Promise.reject(data);
36
- }
37
-
38
- return content;
39
- },
40
- //状态码不为2xx的时候执行
41
- (error: any) => {
42
- const { response = {} } = error;
43
- const { status } = response;
44
-
45
- enum CodeMessage {
46
- '发出的请求有错误,服务器没有进行新建或修改数据的操作。' = 400,
47
- '用户未登录。' = 401,
48
- '用户得到授权,但是访问是被禁止的。' = 403,
49
- '发出的请求针对的是不存在的记录,服务器没有进行操作。' = 404,
50
- '请求的格式不可得。' = 406,
51
- '请求的资源被永久删除,且不会再得到的。' = 410,
52
- '当创建一个对象时,发生一个验证错误。' = 422,
53
- '服务器发生错误,请检查服务器。' = 500,
54
- '网关错误。' = 502,
55
- '服务不可用,服务器暂时过载或维护。' = 503,
56
- '网关超时。' = 504
57
- }
58
-
59
- notification.error({
60
- message: response?.data?.message || CodeMessage[status]
61
- });
62
-
63
- if (status === 401) {
64
-
65
- }
66
-
67
- return Promise.reject(error);
68
- }
69
- );
70
-
71
- export default instance;
@@ -1,13 +0,0 @@
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
-
@@ -1,22 +0,0 @@
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
- }
@@ -1,20 +0,0 @@
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
- }
@@ -1,22 +0,0 @@
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
- }
@@ -1,20 +0,0 @@
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
- }
@@ -1,11 +0,0 @@
1
- import request from "../../apiRequest/config"
2
-
3
- //分页查询账号
4
- export const accountPage= (data?: any) => {
5
- return request.post("/api/permission/account/page.json", { ...data })
6
- }
7
-
8
- export const updateDevice = (data?: any) => {
9
- return request.post("/api/wifi/device/bound/space/update.json", { ...data })
10
- }
11
-
@@ -1,169 +0,0 @@
1
- import React, { useEffect, useRef, useState } from 'react';
2
- import useTableHooks from "../../hooks/useTableHooks"
3
- import PageContainer from '../PageContainer';
4
- import QueryFilter from '../QueryFilter';
5
- import ProTable from '../ProTable';
6
- import Pagination from '../Pagination';
7
- import { ProFormText,} from '@ant-design/pro-components';
8
- import { Space, } from 'antd';
9
- import { get } from 'lodash';
10
- import { timeFormatter } from '../../utils';
11
- import { accountPage } from "./api"
12
-
13
- import "./index.scss"
14
-
15
- export interface AccountProps {
16
- historyAction: any;
17
- }
18
-
19
- export default function Account({
20
- historyAction
21
- }:AccountProps) {
22
- const searchFormRef: any = useRef()
23
-
24
- useEffect(() => {
25
- execute()
26
- }, [])
27
-
28
- const columns: any = [
29
- {
30
- title: '名称',
31
- dataIndex: 'name',
32
- key: 'name',
33
- render: (text: any) => {
34
- return <span>{text}</span>
35
- }
36
- },
37
- {
38
- title: '账号',
39
- dataIndex: 'account',
40
- key: 'account',
41
- },
42
- {
43
- title: '工号',
44
- dataIndex: 'jobNumber',
45
- key: 'jobNumber',
46
- },
47
- {
48
- title: '手机号',
49
- dataIndex: 'mobile',
50
- key: 'mobile',
51
- },
52
- {
53
- title: '邮箱',
54
- dataIndex: 'email',
55
- key: 'email',
56
- ellipsis: true,
57
- },
58
- {
59
- title: '是否企业管理员',
60
- dataIndex: 'isAdmin',
61
- key: 'isAdmin',
62
- render: (text: any, rowData: any) => {
63
- if (rowData.isAdmin) {
64
- return '是'
65
- } else {
66
- return '否'
67
- }
68
- }
69
- },
70
-
71
- {
72
- title: '创建时间',
73
- dataIndex: 'gmtCreate',
74
- key: 'gmtCreate',
75
- render: (cell: any) => {
76
- return timeFormatter(cell)
77
- }
78
- },
79
- {
80
- title: '修改时间',
81
- dataIndex: 'gmtModified',
82
- key: 'gmtModified',
83
- render: (cell: any) => {
84
- return timeFormatter(cell)
85
- }
86
- },
87
- {
88
- title: '操作',
89
- fixed: 'right',
90
- width: 80,
91
- render: (rowdata: any) => (
92
-
93
- <Space>
94
- <a
95
- onClick={() => {
96
- historyAction?.push({
97
- pathname: `/account-info`,
98
- search: `?id=${rowdata.id}`,
99
- });
100
- }}
101
- >
102
- 配置
103
- </a>
104
- </Space>
105
- ),
106
- },
107
- ];
108
-
109
- const handleOnReset: any = async (values: any) => {
110
- searchFormRef.current = { ...values }
111
- execute({
112
- innerPageNo: 1,
113
- })
114
- }
115
-
116
- const handleOnFinish: any = async (values: any) => {
117
- searchFormRef.current = { ...values }
118
- execute()
119
- }
120
-
121
- const readDataList = ({
122
- innerPageNo,
123
- innerPageSize,
124
- }: any) => {
125
- return accountPage({
126
- currentPage: innerPageNo,
127
- pageSize: innerPageSize,
128
- ...searchFormRef.current,
129
- }).then((res: any) => {
130
- let records = get(res, "records", [])
131
- let total = get(res, "total", 0)
132
- return {
133
- dataList: records,
134
- totalCount: total
135
- }
136
- })
137
- }
138
-
139
- const { execute, dataList, isLoading, pagination } = useTableHooks({
140
- asyncFunction: readDataList
141
- })
142
-
143
- const handleRoload = () => {
144
- execute()
145
- }
146
-
147
- return (
148
- <PageContainer>
149
- <QueryFilter
150
- onReset={handleOnReset}
151
- onFinish={handleOnFinish}
152
- >
153
- <ProFormText name="name" label="名称" />
154
- <ProFormText name="account" label="账号" />
155
- </QueryFilter>
156
- <ProTable
157
- headerTitle={"账号列表"}
158
- dataSource={dataList}
159
- loading={isLoading}
160
- columns={columns}
161
- rowKey="id"
162
- options={{
163
- reload: handleRoload
164
- }}
165
- />
166
- <Pagination {...pagination} />
167
- </PageContainer>
168
- )
169
- }
@@ -1,26 +0,0 @@
1
- import request from "../../apiRequest/config"
2
-
3
- //按账号id查询账号信息
4
- export const getAccount= (data?: any) => {
5
- return request.post("/api/permission/account/getAccount.json", { ...data })
6
- }
7
- //根据账号查询绑定的角色 分页
8
- export const pageBoundRoles= (data?: any) => {
9
- return request.post("/api/permission/accountRole/pageBoundRoles.json", { ...data })
10
- }
11
- //根据账号查询绑定的角色
12
- export const queryBoundRoles= (data?: any) => {
13
- return request.post("/api/permission/accountRole/queryBoundRoles.json", { ...data })
14
- }
15
- //获取所有角色
16
- export const rolelistRole = (data?: any) => {
17
- return request.get("/api/permission/role/listRole.json", { ...data })
18
- }
19
- //账号下绑定角色
20
- export const accountBoundRoles= (data?: any) => {
21
- return request.post("/api/permission/accountRole/accountBoundRoles.json", { ...data })
22
- }
23
- //账号下解绑角色
24
- export const accountUnboundRoles= (data?: any) => {
25
- return request.post("/api/permission/accountRole/accountUnboundRoles.json", { ...data })
26
- }