@jiangood/open-admin 1.3.4 → 2.0.1
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/config/config.js +3 -8
- package/package.json +5 -9
- package/src/.umi-production/appData.json +325 -365
- package/src/.umi-production/core/helmet.ts +1 -1
- package/src/.umi-production/core/history.ts +1 -1
- package/src/.umi-production/core/historyIntelli.ts +1 -1
- package/src/.umi-production/core/pluginConfig.ts +1 -1
- package/src/.umi-production/core/polyfill.ts +216 -216
- package/src/.umi-production/core/route.tsx +2 -4
- package/src/.umi-production/exports.ts +3 -3
- package/src/.umi-production/testBrowser.tsx +1 -1
- package/src/.umi-production/tsconfig.json +1 -1
- package/src/.umi-production/umi.ts +2 -2
- package/src/framework/components/ErrorBoundary/index.tsx +86 -0
- package/src/framework/components/Gap/index.tsx +42 -0
- package/src/framework/components/NamedIcon/index.d.ts +6 -4
- package/src/framework/components/NamedIcon/index.jsx +9 -6
- package/src/framework/components/OrgTree/{index.jsx → index.tsx} +10 -19
- package/src/framework/components/PageLoading/{index.jsx → index.tsx} +2 -5
- package/src/framework/components/ProModal/index.tsx +1 -1
- package/src/framework/components/ProTable/components/ToolBar/{index.jsx → index.tsx} +3 -3
- package/src/framework/components/ProTable/index.less +1 -1
- package/src/framework/components/ProTable/{index.jsx → index.tsx} +9 -7
- package/src/framework/components/ProTable/utils/index.ts +62 -0
- package/src/framework/components/RoleTree/{index.jsx → index.tsx} +7 -17
- package/src/framework/components/ValueType/{index.jsx → index.tsx} +2 -1
- package/src/framework/components/ViewRange/index.tsx +15 -0
- package/src/framework/components/index.ts +2 -1
- package/src/framework/components/system/ButtonList.tsx +22 -0
- package/src/framework/components/system/index.tsx +4 -4
- package/src/framework/fields/BaseRemoteSelect/index.tsx +129 -0
- package/src/framework/fields/FieldDictSelect/{index.jsx → index.tsx} +10 -4
- package/src/framework/fields/FieldRemoteSelect/index.tsx +37 -0
- package/src/framework/fields/FieldRemoteSelectMultiple/index.tsx +29 -0
- package/src/framework/fields/FieldRemoteSelectMultipleInline/index.tsx +33 -0
- package/src/framework/fields/FieldRemoteTree/index.tsx +31 -0
- package/src/framework/fields/FieldRemoteTreeCascader/index.tsx +39 -0
- package/src/framework/fields/FieldRemoteTreeSelect/index.tsx +39 -0
- package/src/framework/fields/FieldRemoteTreeSelectMultiple/index.tsx +43 -0
- package/src/framework/fields/FieldSysOrgTree/{index.jsx → index.tsx} +2 -2
- package/src/framework/fields/FieldSysOrgTreeSelect/{index.jsx → index.tsx} +2 -2
- package/src/framework/fields/FieldTable/{index.jsx → index.tsx} +5 -5
- package/src/framework/fields/FieldUploadFile/{index.jsx → index.tsx} +1 -3
- package/src/framework/index.ts +0 -1
- package/src/framework/utils/ArrayUtils.ts +186 -0
- package/src/framework/utils/EventBusUtils.ts +0 -1
- package/src/framework/utils/MessageUtils.tsx +0 -2
- package/src/framework/utils/TreeUtils.ts +2 -2
- package/src/framework/utils/index.ts +1 -1
- package/src/framework/utils/system/FormRegistryUtils.ts +0 -1
- package/src/framework/utils/system/PermUtils.ts +2 -2
- package/src/framework/views/ViewApproveStatus/index.tsx +11 -0
- package/src/framework/views/ViewBoolean/index.tsx +6 -0
- package/src/framework/views/ViewFile/{index.jsx → index.tsx} +4 -4
- package/src/framework/views/ViewImage/{index.jsx → index.tsx} +3 -3
- package/src/framework/views/ViewPassword/{index.jsx → index.tsx} +2 -2
- package/src/framework/views/ViewProcessInstanceProgressButton/{index.jsx → index.tsx} +1 -2
- package/src/layouts/PageRender.jsx +6 -6
- package/src/layouts/admin/HeaderRight.jsx +2 -2
- package/src/layouts/admin/TabPageRender.jsx +28 -13
- package/src/layouts/admin/index.jsx +15 -14
- package/src/layouts/admin/index.less +1 -1
- package/src/layouts/index.jsx +12 -13
- package/src/layouts/index.less +2 -2
- package/src/loading.jsx +17 -16
- package/src/pages/login.jsx +132 -4
- package/src/{framework/pages/LoginPage.less → pages/login.less} +3 -3
- package/src/pages/system/dict/index.jsx +4 -3
- package/src/pages/system/file/index.jsx +6 -5
- package/src/pages/system/job/index.jsx +10 -9
- package/src/pages/system/{sysManual → manual}/index.jsx +1 -1
- package/src/pages/system/org/index.jsx +4 -5
- package/src/pages/system/role/index.jsx +5 -5
- package/src/pages/system/role/perm.jsx +6 -6
- package/src/pages/system/user/UserPerm.jsx +4 -4
- package/src/pages/system/user/index.jsx +2 -2
- package/src/pages/userCenter/ChangePassword.jsx +3 -5
- package/src/pages/userCenter/manual.jsx +1 -1
- package/src/pages/userCenter/message.jsx +1 -1
- package/src/framework/components/DownloadFileButton/index.d.ts +0 -11
- package/src/framework/components/Gap/index.d.ts +0 -23
- package/src/framework/components/Gap/index.jsx +0 -46
- package/src/framework/components/LinkButton/index.d.ts +0 -14
- package/src/framework/components/OrgTree/index.d.ts +0 -4
- package/src/framework/components/Page/index.d.ts +0 -17
- package/src/framework/components/PageLoading/index.d.ts +0 -1
- package/src/framework/components/ProTable/index.d.ts +0 -42
- package/src/framework/components/ProTable/utils/index.js +0 -43
- package/src/framework/components/RoleTree/index.d.ts +0 -4
- package/src/framework/components/ViewRange/index.d.ts +0 -14
- package/src/framework/components/ViewRange/index.jsx +0 -20
- package/src/framework/components/system/ButtonList.d.ts +0 -8
- package/src/framework/components/system/ButtonList.jsx +0 -42
- package/src/framework/fields/FieldBoolean/index.d.ts +0 -9
- package/src/framework/fields/FieldDate/index.d.ts +0 -23
- package/src/framework/fields/FieldDateRange/index.d.ts +0 -22
- package/src/framework/fields/FieldDictSelect/index.d.ts +0 -12
- package/src/framework/fields/FieldEditor/index.d.ts +0 -14
- package/src/framework/fields/FieldNumberRange/index.d.ts +0 -10
- package/src/framework/fields/FieldPercent/index.d.ts +0 -8
- package/src/framework/fields/FieldRemoteSelect/index.d.ts +0 -44
- package/src/framework/fields/FieldRemoteSelect/index.jsx +0 -66
- package/src/framework/fields/FieldRemoteSelectMultiple/index.d.ts +0 -20
- package/src/framework/fields/FieldRemoteSelectMultiple/index.jsx +0 -85
- package/src/framework/fields/FieldRemoteSelectMultipleInline/index.d.ts +0 -21
- package/src/framework/fields/FieldRemoteSelectMultipleInline/index.jsx +0 -88
- package/src/framework/fields/FieldRemoteTree/index.d.ts +0 -20
- package/src/framework/fields/FieldRemoteTree/index.jsx +0 -50
- package/src/framework/fields/FieldRemoteTreeCascader/index.d.ts +0 -18
- package/src/framework/fields/FieldRemoteTreeCascader/index.jsx +0 -59
- package/src/framework/fields/FieldRemoteTreeSelect/index.d.ts +0 -19
- package/src/framework/fields/FieldRemoteTreeSelect/index.jsx +0 -57
- package/src/framework/fields/FieldRemoteTreeSelectMultiple/index.d.ts +0 -20
- package/src/framework/fields/FieldRemoteTreeSelectMultiple/index.jsx +0 -62
- package/src/framework/fields/FieldSysOrgTree/index.d.ts +0 -9
- package/src/framework/fields/FieldSysOrgTreeSelect/index.d.ts +0 -9
- package/src/framework/fields/FieldTable/index.d.ts +0 -14
- package/src/framework/fields/FieldTableSelect/index.d.ts +0 -19
- package/src/framework/fields/FieldUploadFile/index.d.ts +0 -31
- package/src/framework/pages/LoginPage.d.ts +0 -16
- package/src/framework/pages/LoginPage.jsx +0 -135
- package/src/framework/pages/LoginPageUtils.ts +0 -36
- package/src/framework/pages/index.ts +0 -2
- package/src/framework/utils/ArrUtils.ts +0 -229
- package/src/framework/views/ViewApproveStatus/index.d.ts +0 -5
- package/src/framework/views/ViewApproveStatus/index.jsx +0 -15
- package/src/framework/views/ViewBoolean/index.d.ts +0 -3
- package/src/framework/views/ViewBoolean/index.jsx +0 -4
- package/src/framework/views/ViewBooleanEnableDisable/index.d.ts +0 -5
- package/src/framework/views/ViewFile/index.d.ts +0 -10
- package/src/framework/views/ViewFileButton/index.d.ts +0 -10
- package/src/framework/views/ViewImage/index.d.ts +0 -6
- package/src/framework/views/ViewPassword/index.d.ts +0 -5
- package/src/framework/views/ViewProcessInstanceProgress/index.d.ts +0 -12
- package/src/framework/views/ViewProcessInstanceProgressButton/index.d.ts +0 -6
- package/src/framework/views/ViewText/index.d.ts +0 -16
- package/src/pages/system/api/index.jsx +0 -279
- package/src/pages/test/views.jsx +0 -95
- package/src/framework/components/DownloadFileButton/{index.jsx → index.tsx} +0 -0
- package/src/framework/components/LinkButton/{index.jsx → index.tsx} +0 -0
- package/src/framework/components/Page/{index.jsx → index.tsx} +0 -0
- package/src/framework/components/ValueType/{registry.jsx → registry.tsx} +1 -1
- /package/src/framework/fields/FieldBoolean/{index.jsx → index.tsx} +0 -0
- /package/src/framework/fields/FieldDate/{index.jsx → index.tsx} +0 -0
- /package/src/framework/fields/FieldDateRange/{index.jsx → index.tsx} +0 -0
- /package/src/framework/fields/FieldEditor/{index.jsx → index.tsx} +0 -0
- /package/src/framework/fields/FieldNumberRange/{index.jsx → index.tsx} +0 -0
- /package/src/framework/fields/FieldPercent/{index.jsx → index.tsx} +0 -0
- /package/src/framework/fields/FieldTableSelect/{index.jsx → index.tsx} +0 -0
- /package/src/framework/views/ViewBooleanEnableDisable/{index.jsx → index.tsx} +0 -0
- /package/src/framework/views/ViewFileButton/{index.jsx → index.tsx} +0 -0
- /package/src/framework/views/ViewProcessInstanceProgress/{index.jsx → index.tsx} +0 -0
- /package/src/framework/views/ViewText/{index.jsx → index.tsx} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export function PageLoading(props: { message?: string });
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
// @ts-ignore
|
|
2
|
-
import React from "react";
|
|
3
|
-
import {ColumnsType} from "antd/es/table";
|
|
4
|
-
|
|
5
|
-
declare type ProTableProps = {
|
|
6
|
-
columns: ColumnsType,
|
|
7
|
-
/**
|
|
8
|
-
* 请求函数
|
|
9
|
-
*/
|
|
10
|
-
request: (params:any)=>{};
|
|
11
|
-
|
|
12
|
-
rowKey?: string,
|
|
13
|
-
|
|
14
|
-
// 选择行,通ant table
|
|
15
|
-
rowSelection?: any,
|
|
16
|
-
|
|
17
|
-
toolBarRender?: (params:any, {selectedRows:[],selectedRowKeys:[]})=>{},
|
|
18
|
-
bordered?:boolean,
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* 默认每页数量
|
|
22
|
-
*/
|
|
23
|
-
defaultPageSize?:number,
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* 查询表单的引用
|
|
27
|
-
*/
|
|
28
|
-
formRef?: React.Ref<any>,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
showToolbarSearch?:boolean
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* 垂直滚动条, true自动计算, 也可指定高度
|
|
37
|
-
*/
|
|
38
|
-
scrollY?: boolean | number
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export class ProTable extends React.Component<ProTableProps, any> {
|
|
42
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 获取用户的 action 信息
|
|
3
|
-
*
|
|
4
|
-
* @param actionRef
|
|
5
|
-
* @param counter
|
|
6
|
-
* @param onCleanSelected
|
|
7
|
-
*/
|
|
8
|
-
export function useActionType(
|
|
9
|
-
ref,
|
|
10
|
-
action,
|
|
11
|
-
props,
|
|
12
|
-
) {
|
|
13
|
-
/** 这里生成action的映射,保证 action 总是使用的最新 只需要渲染一次即可 */
|
|
14
|
-
const userAction = {
|
|
15
|
-
pageInfo: action.pageInfo,
|
|
16
|
-
reload: async (resetPageIndex) => {
|
|
17
|
-
// 如果为 true,回到第一页
|
|
18
|
-
if (resetPageIndex) {
|
|
19
|
-
await action.setPageInfo({
|
|
20
|
-
current: 1,
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
action?.reload();
|
|
24
|
-
},
|
|
25
|
-
reloadAndRest: async () => {
|
|
26
|
-
// reload 之后大概率会切换数据,清空一下选择。
|
|
27
|
-
props.onCleanSelected();
|
|
28
|
-
await action.setPageInfo({
|
|
29
|
-
current: 1,
|
|
30
|
-
});
|
|
31
|
-
await action?.reload();
|
|
32
|
-
},
|
|
33
|
-
reset: async () => {
|
|
34
|
-
await props.resetAll();
|
|
35
|
-
await action?.reset?.();
|
|
36
|
-
await action?.reload();
|
|
37
|
-
},
|
|
38
|
-
clearSelected: () => props.onCleanSelected(),
|
|
39
|
-
setPageInfo: (rest) => action.setPageInfo(rest),
|
|
40
|
-
};
|
|
41
|
-
// eslint-disable-next-line no-param-reassign
|
|
42
|
-
ref.current = userAction;
|
|
43
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
export class ViewRange extends React.Component {
|
|
4
|
-
|
|
5
|
-
static defaultProps = {
|
|
6
|
-
min : '未知',max : '未知'
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
render() {
|
|
10
|
-
let {min,max} = this.props
|
|
11
|
-
if(min == null && max == null){
|
|
12
|
-
return null;
|
|
13
|
-
}
|
|
14
|
-
min = min == null ? '未知': min;
|
|
15
|
-
max = max == null ? '未知': max;
|
|
16
|
-
|
|
17
|
-
return min + ' - ' + max;
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {Space} from 'antd';
|
|
3
|
-
import {PermUtils} from "../../utils";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* 带权限的按钮列表
|
|
8
|
-
* @param maxNum: 显示子节点的个数, 超过的为收缩起来
|
|
9
|
-
*
|
|
10
|
-
*/
|
|
11
|
-
export class ButtonList extends React.Component {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
render() {
|
|
15
|
-
let {children} = this.props;
|
|
16
|
-
|
|
17
|
-
// 单节点的情况
|
|
18
|
-
if (!Array.isArray(children)) {
|
|
19
|
-
if (this.checkPerm(children)) {
|
|
20
|
-
return children;
|
|
21
|
-
}
|
|
22
|
-
return null
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const menus = [];
|
|
26
|
-
for (let child of children) {
|
|
27
|
-
if (child === null || child === undefined) {
|
|
28
|
-
continue;
|
|
29
|
-
}
|
|
30
|
-
if (this.checkPerm(child)) {
|
|
31
|
-
menus.push(child);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return <Space>{menus}</Space>;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
checkPerm = element => {
|
|
38
|
-
let props = element.props;
|
|
39
|
-
return props == null || props.perm == null || PermUtils.hasPermission(props.perm);
|
|
40
|
-
|
|
41
|
-
};
|
|
42
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { FieldProps } from '../types';
|
|
3
|
-
|
|
4
|
-
interface FieldBooleanProps extends FieldProps<boolean> {
|
|
5
|
-
type?: 'select' | 'radio' | 'checkbox' | 'switch'; // 默认 select
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export class FieldBoolean extends React.Component<FieldBooleanProps, any> {
|
|
9
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { FieldProps } from '../types';
|
|
3
|
-
|
|
4
|
-
interface FieldDateProps extends FieldProps<string | null> {
|
|
5
|
-
type: 'YYYY-MM-DD' | 'DAY'|
|
|
6
|
-
'YYYY-MM-DD HH:mm:ss' |
|
|
7
|
-
// 年
|
|
8
|
-
'YYYY' | 'YEAR' |
|
|
9
|
-
// 年月
|
|
10
|
-
'YYYY-MM' | 'YEAR_MONTH'|
|
|
11
|
-
// 季度
|
|
12
|
-
'YYYY-QQ' | 'YEAR_QUARTER'|
|
|
13
|
-
|
|
14
|
-
'YYYY-MM-DD HH:mm' |
|
|
15
|
-
|
|
16
|
-
// 时间
|
|
17
|
-
'HH:mm' |
|
|
18
|
-
'HH:mm:ss';
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export class FieldDate extends React.Component<FieldDateProps, any> {
|
|
22
|
-
static getDefaultValue(type: string): string | null;
|
|
23
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { FieldProps } from '../types';
|
|
3
|
-
|
|
4
|
-
interface FieldDateRangeProps extends FieldProps<string> {
|
|
5
|
-
type: 'YYYY-MM-DD' | 'DAY'|
|
|
6
|
-
'YYYY-MM-DD HH:mm:ss' |
|
|
7
|
-
// 年
|
|
8
|
-
'YYYY' | 'YEAR' |
|
|
9
|
-
// 年月
|
|
10
|
-
'YYYY-MM' | 'YEAR_MONTH'|
|
|
11
|
-
// 季度
|
|
12
|
-
'YYYY-QQ' | 'YEAR_QUARTER'|
|
|
13
|
-
|
|
14
|
-
'YYYY-MM-DD HH:mm' |
|
|
15
|
-
|
|
16
|
-
// 时间
|
|
17
|
-
'HH:mm' |
|
|
18
|
-
'HH:mm:ss';
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export class FieldDateRange extends React.Component<FieldDateRangeProps, any> {
|
|
22
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import {SelectProps} from "antd/es/select";
|
|
3
|
-
import { FieldProps } from '../types';
|
|
4
|
-
|
|
5
|
-
interface FieldDictSelectProps extends Omit<SelectProps, 'options' | 'children'|'mode' | 'value' | 'onChange'>, FieldProps<any> {
|
|
6
|
-
/**
|
|
7
|
-
* 字典类型编码
|
|
8
|
-
*/
|
|
9
|
-
typeCode: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function FieldDictSelect(props: FieldDictSelectProps);
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { FieldProps } from '../types';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* 富文本编辑器
|
|
6
|
-
*
|
|
7
|
-
* 图片上传相关配置 https://www.tiny.cloud/docs/tinymce/7/image/
|
|
8
|
-
*/
|
|
9
|
-
interface FieldEditProps extends FieldProps<string> {
|
|
10
|
-
height?: number;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export class FieldEditor extends React.Component<FieldEditProps, any> {
|
|
14
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { SelectProps } from "antd/es/select";
|
|
3
|
-
import { FieldProps } from '../types';
|
|
4
|
-
|
|
5
|
-
interface FieldRemoteSelectProps extends Omit<SelectProps, 'value' | 'onChange'>, FieldProps<any> {
|
|
6
|
-
/**
|
|
7
|
-
* 请求地址
|
|
8
|
-
*/
|
|
9
|
-
url: string;
|
|
10
|
-
/**
|
|
11
|
-
* 防抖时间(毫秒)
|
|
12
|
-
*/
|
|
13
|
-
debounceTime?: number;
|
|
14
|
-
/**
|
|
15
|
-
* 请求参数处理函数
|
|
16
|
-
*/
|
|
17
|
-
paramsProcessor?: (params: any) => any;
|
|
18
|
-
/**
|
|
19
|
-
* 响应数据处理函数
|
|
20
|
-
*/
|
|
21
|
-
dataProcessor?: (data: any) => any;
|
|
22
|
-
/**
|
|
23
|
-
* 缓存大小
|
|
24
|
-
*/
|
|
25
|
-
cacheSize?: number;
|
|
26
|
-
/**
|
|
27
|
-
* 初始加载
|
|
28
|
-
*/
|
|
29
|
-
initialLoad?: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* 搜索时是否清空已选项
|
|
32
|
-
*/
|
|
33
|
-
clearOnSearch?: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* 请求失败回调
|
|
36
|
-
*/
|
|
37
|
-
onError?: (error: any) => void;
|
|
38
|
-
/**
|
|
39
|
-
* 加载完成回调
|
|
40
|
-
*/
|
|
41
|
-
onLoad?: (data: any) => void;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export const FieldRemoteSelect: React.FC<FieldRemoteSelectProps>;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect, useCallback, useRef } from 'react';
|
|
2
|
-
import { Select, Spin, message } from 'antd';
|
|
3
|
-
import { debounce } from 'lodash';
|
|
4
|
-
import { HttpUtils } from "../../utils";
|
|
5
|
-
|
|
6
|
-
export class FieldRemoteSelect extends React.Component {
|
|
7
|
-
|
|
8
|
-
static defaultProps = {
|
|
9
|
-
placeholder: '请搜索选择'
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
state = {
|
|
13
|
-
dataLoading:true,
|
|
14
|
-
data: {}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
componentDidMount() {
|
|
18
|
-
this.loadData(null);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
loadData = (searchText) => {
|
|
22
|
-
this.setState({dataLoading:true})
|
|
23
|
-
const {url} = this.props;
|
|
24
|
-
const params = {
|
|
25
|
-
searchText,
|
|
26
|
-
selected: this.props.value
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
HttpUtils.get(url,params).then(data => {
|
|
30
|
-
this.setState({data})
|
|
31
|
-
}).finally(() => {
|
|
32
|
-
this.setState({dataLoading: false})
|
|
33
|
-
})
|
|
34
|
-
};
|
|
35
|
-
handleSearch = searchText => {
|
|
36
|
-
this.loadData(searchText)
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
render() {
|
|
40
|
-
let {
|
|
41
|
-
value,
|
|
42
|
-
placeholder,
|
|
43
|
-
...rest
|
|
44
|
-
} = this.props;
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
<Select
|
|
48
|
-
showSearch={{
|
|
49
|
-
filterOption: false,
|
|
50
|
-
onSearch: this.handleSearch,
|
|
51
|
-
}}
|
|
52
|
-
options={this.state.data}
|
|
53
|
-
notFoundContent={this.state.dataLoading ? <Spin size="small"/> : '数据为空'}
|
|
54
|
-
style={{width: '100%', minWidth: 200}}
|
|
55
|
-
allowClear
|
|
56
|
-
loading={this.state.dataLoading}
|
|
57
|
-
value={value}
|
|
58
|
-
{...rest}
|
|
59
|
-
/>
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {SelectProps} from "antd/es/select";
|
|
3
|
-
|
|
4
|
-
interface FieldRemoteSelectMultipleProps extends Omit<SelectProps, 'options' | 'children'| 'mode' | 'value' | 'onChange'> {
|
|
5
|
-
/**
|
|
6
|
-
* 请求地址
|
|
7
|
-
*/
|
|
8
|
-
url: string;
|
|
9
|
-
/**
|
|
10
|
-
* 选中的值
|
|
11
|
-
*/
|
|
12
|
-
value?: any[];
|
|
13
|
-
/**
|
|
14
|
-
* 值变化回调
|
|
15
|
-
*/
|
|
16
|
-
onChange?: (value: any[]) => void;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export class FieldRemoteSelectMultiple extends React.Component<FieldRemoteSelectMultipleProps, any> {
|
|
20
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {Select, Spin, message} from 'antd';
|
|
3
|
-
import {debounce} from 'lodash';
|
|
4
|
-
import {HttpUtils} from "../../utils";
|
|
5
|
-
|
|
6
|
-
export class FieldRemoteSelectMultiple extends React.Component {
|
|
7
|
-
constructor(props) {
|
|
8
|
-
super(props);
|
|
9
|
-
|
|
10
|
-
this.fetchIdRef = 0;
|
|
11
|
-
this.state = {
|
|
12
|
-
options: [],
|
|
13
|
-
loading: false,
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
this.loadDataDebounce = debounce(this.loadData, 800);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
static defaultProps = {
|
|
20
|
-
placeholder: '请搜索选择'
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
componentDidMount() {
|
|
24
|
-
this.loadData('');
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
componentWillUnmount() {
|
|
28
|
-
this.loadDataDebounce.cancel();
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
loadData = async (searchText) => {
|
|
32
|
-
const {url, value} = this.props;
|
|
33
|
-
const fetchId = ++this.fetchIdRef;
|
|
34
|
-
|
|
35
|
-
this.setState({loading: true});
|
|
36
|
-
|
|
37
|
-
try {
|
|
38
|
-
const data = await HttpUtils.get(url, {searchText, selected: value});
|
|
39
|
-
|
|
40
|
-
if (fetchId === this.fetchIdRef) {
|
|
41
|
-
this.setState({options: data || []});
|
|
42
|
-
}
|
|
43
|
-
} catch (error) {
|
|
44
|
-
console.error('远程搜索失败:', error);
|
|
45
|
-
message.error('搜索失败,请重试');
|
|
46
|
-
this.setState({options: []});
|
|
47
|
-
} finally {
|
|
48
|
-
if (fetchId === this.fetchIdRef) {
|
|
49
|
-
this.setState({loading: false});
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
handleSearch = (value) => {
|
|
55
|
-
if (value.trim() === '') {
|
|
56
|
-
this.setState({options: []});
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
this.loadDataDebounce(value.trim());
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
render() {
|
|
63
|
-
const {options, loading} = this.state;
|
|
64
|
-
const {value, onChange, url, ...selectProps} = this.props;
|
|
65
|
-
return (
|
|
66
|
-
<Select
|
|
67
|
-
showSearch={
|
|
68
|
-
{
|
|
69
|
-
filterOption: false,
|
|
70
|
-
onSearch: this.handleSearch,
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
value={value}
|
|
74
|
-
onChange={onChange}
|
|
75
|
-
options={options}
|
|
76
|
-
notFoundContent={loading ? <Spin size="small"/> : '数据为空'}
|
|
77
|
-
style={{width: '100%', minWidth: 200}}
|
|
78
|
-
allowClear
|
|
79
|
-
mode='multiple'
|
|
80
|
-
{...selectProps}
|
|
81
|
-
>
|
|
82
|
-
</Select>
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {SelectProps} from "antd/es/select";
|
|
3
|
-
import { FieldProps } from '../types';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 多选,但是值是字符串,逗号破解的
|
|
7
|
-
*/
|
|
8
|
-
export interface FieldRemoteSelectMultipleInlineProps extends Omit<SelectProps, 'options' | 'children'| 'mode' | 'value' | 'onChange'>, FieldProps<string> {
|
|
9
|
-
/**
|
|
10
|
-
* 请求地址
|
|
11
|
-
*/
|
|
12
|
-
url: string;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* 默认展开所有
|
|
16
|
-
*/
|
|
17
|
-
treeDefaultExpandAll?: boolean;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export class FieldRemoteSelectMultipleInline extends React.Component<FieldRemoteSelectMultipleInlineProps, any> {
|
|
21
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {Select, Spin, message} from 'antd';
|
|
3
|
-
import {debounce} from 'lodash';
|
|
4
|
-
import {HttpUtils, StringUtils} from "../../utils";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* 多选,但是值是字符串,逗号破解的
|
|
8
|
-
*/
|
|
9
|
-
export class FieldRemoteSelectMultipleInline extends React.Component {
|
|
10
|
-
constructor(props) {
|
|
11
|
-
super(props);
|
|
12
|
-
|
|
13
|
-
this.fetchIdRef = 0;
|
|
14
|
-
this.state = {
|
|
15
|
-
options: [],
|
|
16
|
-
loading: false,
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
this.loadDataDebounce = debounce(this.loadData, 800);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
static defaultProps = {
|
|
23
|
-
placeholder: '请搜索选择'
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
componentDidMount() {
|
|
27
|
-
this.loadData('');
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
componentWillUnmount() {
|
|
31
|
-
this.loadDataDebounce.cancel();
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
loadData = async (searchText) => {
|
|
35
|
-
const {url, value} = this.props;
|
|
36
|
-
const fetchId = ++this.fetchIdRef;
|
|
37
|
-
|
|
38
|
-
this.setState({loading: true});
|
|
39
|
-
|
|
40
|
-
try {
|
|
41
|
-
const data = await HttpUtils.get(url, {searchText, selected: value});
|
|
42
|
-
|
|
43
|
-
if (fetchId === this.fetchIdRef) {
|
|
44
|
-
this.setState({options: data || []});
|
|
45
|
-
}
|
|
46
|
-
} catch (error) {
|
|
47
|
-
console.error('远程搜索失败:', error);
|
|
48
|
-
message.error('搜索失败,请重试');
|
|
49
|
-
this.setState({options: []});
|
|
50
|
-
} finally {
|
|
51
|
-
if (fetchId === this.fetchIdRef) {
|
|
52
|
-
this.setState({loading: false});
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
handleSearch = (value) => {
|
|
58
|
-
if (value.trim() === '') {
|
|
59
|
-
this.setState({options: []});
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
this.loadDataDebounce(value.trim());
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
render() {
|
|
66
|
-
const {options, loading} = this.state;
|
|
67
|
-
const {value, onChange, url, ...selectProps} = this.props;
|
|
68
|
-
return (
|
|
69
|
-
<Select
|
|
70
|
-
showSearch={
|
|
71
|
-
{
|
|
72
|
-
filterOption: false,
|
|
73
|
-
onSearch: this.handleSearch,
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
value={StringUtils.split(value, ',')}
|
|
77
|
-
onChange={arr => onChange && onChange(StringUtils.join(arr, ','))}
|
|
78
|
-
options={options}
|
|
79
|
-
notFoundContent={loading ? <Spin size="small"/> : '数据为空'}
|
|
80
|
-
style={{width: '100%', minWidth: 200}}
|
|
81
|
-
allowClear
|
|
82
|
-
mode='multiple'
|
|
83
|
-
{...selectProps}
|
|
84
|
-
>
|
|
85
|
-
</Select>
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import {TreeProps} from "antd";
|
|
3
|
-
import { FieldProps } from '../types';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 多选树
|
|
7
|
-
*
|
|
8
|
-
* 区别于下拉框,是扁平展示的树
|
|
9
|
-
* 这种需要扁平展示的树,通常都是多选。
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
interface FieldRemoteTreeProps extends Omit<TreeProps, 'treeData' | 'checkedKeys' | 'onCheck' | 'multiple' | 'checkable' | 'defaultExpandAll' | 'checkStrictly'>, FieldProps<string[]> {
|
|
13
|
-
/**
|
|
14
|
-
* 请求地址
|
|
15
|
-
*/
|
|
16
|
-
url: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export class FieldRemoteTree extends React.Component<FieldRemoteTreeProps, string> {
|
|
20
|
-
}
|