@jiangood/springboot-admin-starter 0.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 +10 -0
- package/config/config.local.js +10 -0
- package/config/defaultConfig.js +35 -0
- package/config/plugins/forms.js +44 -0
- package/config/plugins/routes.js +82 -0
- package/package.json +41 -0
- package/src/.npmignore +6 -0
- package/src/app.js +0 -0
- package/src/asserts/login_bg.jpg +0 -0
- package/src/asserts/welcome.png +0 -0
- package/src/components/InstanceInfo.jsx +138 -0
- package/src/components/InstanceStatusInfo.jsx +79 -0
- package/src/components/StreamLog.jsx +27 -0
- package/src/components/flow/BpmnUtils.js +85 -0
- package/src/components/flow/customTranslate/customTranslate.js +19 -0
- package/src/components/flow/customTranslate/translations.js +79 -0
- package/src/components/flow/design/contextPad.js +50 -0
- package/src/components/flow/design/form/ConditionForm.jsx +316 -0
- package/src/components/flow/design/form/ServiceTaskForm.jsx +55 -0
- package/src/components/flow/design/form/TimerEventDefinitionForm.jsx +62 -0
- package/src/components/flow/design/form/UserTaskForm.jsx +211 -0
- package/src/components/flow/design/palette.js +39 -0
- package/src/components/monitor/AllDefinition.jsx +46 -0
- package/src/components/monitor/AllInstance.jsx +76 -0
- package/src/forms/demoForm.jsx +16 -0
- package/src/framework/components/ButtonList.d.ts +9 -0
- package/src/framework/components/ButtonList.jsx +91 -0
- package/src/framework/components/DownloadFileButton.d.ts +11 -0
- package/src/framework/components/DownloadFileButton.jsx +33 -0
- package/src/framework/components/Echarts/index.d.ts +10 -0
- package/src/framework/components/Echarts/index.jsx +49 -0
- package/src/framework/components/EditTable/index.d.ts +11 -0
- package/src/framework/components/EditTable/index.jsx +85 -0
- package/src/framework/components/EditTable/index.less +29 -0
- package/src/framework/components/Ellipsis.jsx +39 -0
- package/src/framework/components/Ellipsis.less +8 -0
- package/src/framework/components/FieldRemoteTree.jsx +20 -0
- package/src/framework/components/Gap/index.d.ts +10 -0
- package/src/framework/components/Gap/index.jsx +15 -0
- package/src/framework/components/Gap/index.less +3 -0
- package/src/framework/components/HasPerm.jsx +18 -0
- package/src/framework/components/ImageView.d.ts +12 -0
- package/src/framework/components/ImageView.jsx +64 -0
- package/src/framework/components/LinkButton.d.ts +14 -0
- package/src/framework/components/LinkButton.jsx +13 -0
- package/src/framework/components/MsgBox.jsx +180 -0
- package/src/framework/components/NamedIcon.tsx +15 -0
- package/src/framework/components/OrgTree.jsx +60 -0
- package/src/framework/components/Page/index.d.ts +10 -0
- package/src/framework/components/Page/index.jsx +30 -0
- package/src/framework/components/Page/index.less +10 -0
- package/src/framework/components/PageLoading.jsx +31 -0
- package/src/framework/components/Panel/index.d.ts +11 -0
- package/src/framework/components/Panel/index.jsx +24 -0
- package/src/framework/components/Panel/index.less +0 -0
- package/src/framework/components/ProModal/index.tsx +66 -0
- package/src/framework/components/ProTable/components/ToolBar/index.jsx +124 -0
- package/src/framework/components/ProTable/components/ToolBar/index.less +53 -0
- package/src/framework/components/ProTable/index.d.ts +38 -0
- package/src/framework/components/ProTable/index.jsx +258 -0
- package/src/framework/components/ProTable/index.less +3 -0
- package/src/framework/components/ProTable/utils/index.js +43 -0
- package/src/framework/components/RoleTree.jsx +53 -0
- package/src/framework/components/ValueType/index.jsx +34 -0
- package/src/framework/components/ValueType/registry.jsx +38 -0
- package/src/framework/components/field/FieldAutoTime/index.tsx +46 -0
- package/src/framework/components/field/FieldBoolean/index.tsx +92 -0
- package/src/framework/components/field/FieldEditTable/index.d.ts +13 -0
- package/src/framework/components/field/FieldEditTable/index.jsx +103 -0
- package/src/framework/components/field/FieldEditTable/index.less +29 -0
- package/src/framework/components/field/FieldEditor.jsx +48 -0
- package/src/framework/components/field/FieldFileBase64/index.d.ts +15 -0
- package/src/framework/components/field/FieldFileBase64/index.jsx +23 -0
- package/src/framework/components/field/FieldImageBase64/index.d.ts +15 -0
- package/src/framework/components/field/FieldImageBase64/index.jsx +22 -0
- package/src/framework/components/field/FieldInput.jsx +13 -0
- package/src/framework/components/field/FieldOrgTree/index.tsx +45 -0
- package/src/framework/components/field/FieldPassword.jsx +11 -0
- package/src/framework/components/field/FieldProps.ts +19 -0
- package/src/framework/components/field/FieldRemoteTreeCascader.jsx +75 -0
- package/src/framework/components/field/FieldRemoteTreeCheckable.jsx +81 -0
- package/src/framework/components/field/FieldRemoteTreeMultipleSelect.jsx +100 -0
- package/src/framework/components/field/FieldRemoteTreeSelect.jsx +82 -0
- package/src/framework/components/field/FieldSelectPosition/index.tsx +85 -0
- package/src/framework/components/field/FieldTree.jsx +45 -0
- package/src/framework/components/field/dict/index.tsx +110 -0
- package/src/framework/components/field/flat-multiple-select/index.d.ts +4 -0
- package/src/framework/components/field/flat-multiple-select/index.jsx +116 -0
- package/src/framework/components/field/flat-multiple-select/index.less +12 -0
- package/src/framework/components/field/flat-select/index.d.ts +4 -0
- package/src/framework/components/field/flat-select/index.jsx +107 -0
- package/src/framework/components/field/flat-select/index.less +12 -0
- package/src/framework/components/field/index.js +33 -0
- package/src/framework/components/field/input-number-percent/index.d.ts +11 -0
- package/src/framework/components/field/input-number-percent/index.jsx +28 -0
- package/src/framework/components/field/select/FieldSelect/index.d.ts +39 -0
- package/src/framework/components/field/select/FieldSelect/index.jsx +156 -0
- package/src/framework/components/field/select/FieldTableSelect/index.d.ts +29 -0
- package/src/framework/components/field/select/FieldTableSelect/index.jsx +155 -0
- package/src/framework/components/field/select/index.jsx +2 -0
- package/src/framework/components/field/switch-y-n/index.d.ts +11 -0
- package/src/framework/components/field/switch-y-n/index.jsx +31 -0
- package/src/framework/components/field/text/index.tsx +7 -0
- package/src/framework/components/field/time/DatePickerString.tsx +37 -0
- package/src/framework/components/field/time/DateTimePickerString.tsx +42 -0
- package/src/framework/components/field/time/FieldDateRange.d.ts +9 -0
- package/src/framework/components/field/time/FieldDateRange.jsx +49 -0
- package/src/framework/components/field/time/HHmmPickerString.tsx +42 -0
- package/src/framework/components/field/time/MonthPickerString.tsx +45 -0
- package/src/framework/components/field/time/TimePickerTool.ts +14 -0
- package/src/framework/components/field/time/YearPickerString.tsx +41 -0
- package/src/framework/components/field/time/YearQuarterString.tsx +38 -0
- package/src/framework/components/field/time/index.tsx +7 -0
- package/src/framework/components/field/upload/FieldUploadCropImage/index.d.ts +22 -0
- package/src/framework/components/field/upload/FieldUploadCropImage/index.jsx +11 -0
- package/src/framework/components/field/upload/FieldUploadFile.d.ts +35 -0
- package/src/framework/components/field/upload/FieldUploadFile.jsx +145 -0
- package/src/framework/components/field/upload/FieldUploadImage.d.ts +7 -0
- package/src/framework/components/field/upload/FieldUploadImage.jsx +16 -0
- package/src/framework/components/field/upload/index.jsx +3 -0
- package/src/framework/components/index.js +25 -0
- package/src/framework/components/system.jsx +29 -0
- package/src/framework/components/view/ViewBoolean.jsx +15 -0
- package/src/framework/components/view/ViewBooleanEnableDisable.jsx +16 -0
- package/src/framework/components/view/ViewEllipsis.d.ts +11 -0
- package/src/framework/components/view/ViewEllipsis.jsx +30 -0
- package/src/framework/components/view/ViewFile.d.ts +10 -0
- package/src/framework/components/view/ViewFile.jsx +50 -0
- package/src/framework/components/view/ViewFileButton.d.ts +10 -0
- package/src/framework/components/view/ViewFileButton.jsx +0 -0
- package/src/framework/components/view/ViewImage.d.ts +9 -0
- package/src/framework/components/view/ViewImage.jsx +61 -0
- package/src/framework/components/view/ViewPassword.jsx +24 -0
- package/src/framework/components/view/ViewRange/index.d.ts +16 -0
- package/src/framework/components/view/ViewRange/index.jsx +20 -0
- package/src/framework/components/view/ViewText.jsx +9 -0
- package/src/framework/components/view/index.js +12 -0
- package/src/framework/index.js +3 -0
- package/src/framework/system/FormRegistry.js +58 -0
- package/src/framework/system/dict.js +88 -0
- package/src/framework/system/http.jsx +290 -0
- package/src/framework/system/index.js +13 -0
- package/src/framework/system/page.js +109 -0
- package/src/framework/system/permission.js +44 -0
- package/src/framework/system/sys.js +60 -0
- package/src/framework/system/theme.js +17 -0
- package/src/framework/utils/arr.js +118 -0
- package/src/framework/utils/browser.js +24 -0
- package/src/framework/utils/color.js +269 -0
- package/src/framework/utils/date.js +173 -0
- package/src/framework/utils/debounce.js +33 -0
- package/src/framework/utils/dom.js +16 -0
- package/src/framework/utils/eventBus.js +70 -0
- package/src/framework/utils/html.js +13 -0
- package/src/framework/utils/index.js +17 -0
- package/src/framework/utils/obj.js +72 -0
- package/src/framework/utils/storage.js +37 -0
- package/src/framework/utils/str.js +297 -0
- package/src/framework/utils/tree.js +175 -0
- package/src/framework/utils/uid.js +76 -0
- package/src/framework/utils/url.js +84 -0
- package/src/framework/utils/validate.js +9 -0
- package/src/index.js +2 -0
- package/src/layouts/PageRender.d.ts +22 -0
- package/src/layouts/PageRender.jsx +90 -0
- package/src/layouts/admin/HeaderRight.jsx +104 -0
- package/src/layouts/admin/TabPageRender.jsx +158 -0
- package/src/layouts/admin/index.jsx +174 -0
- package/src/layouts/admin/index.less +64 -0
- package/src/layouts/index.jsx +163 -0
- package/src/layouts/index.less +45 -0
- package/src/loading.jsx +18 -0
- package/src/pages/404.jsx +13 -0
- package/src/pages/about.jsx +14 -0
- package/src/pages/api/accessLog/index.jsx +108 -0
- package/src/pages/api/accountResource/index.jsx +149 -0
- package/src/pages/api/doc.jsx +135 -0
- package/src/pages/api/index.jsx +163 -0
- package/src/pages/api/resource.jsx +18 -0
- package/src/pages/flowable/design/index.css +7 -0
- package/src/pages/flowable/design/index.jsx +297 -0
- package/src/pages/flowable/index.jsx +128 -0
- package/src/pages/flowable/instance/view.jsx +13 -0
- package/src/pages/flowable/monitor.jsx +106 -0
- package/src/pages/flowable/task/form.jsx +99 -0
- package/src/pages/flowable/task/index.jsx +200 -0
- package/src/pages/flowable/test/form.jsx +31 -0
- package/src/pages/flowable/test/index.jsx +54 -0
- package/src/pages/index.jsx +25 -0
- package/src/pages/job/index.jsx +239 -0
- package/src/pages/job/logList.jsx +100 -0
- package/src/pages/job/status.jsx +84 -0
- package/src/pages/login.jsx +144 -0
- package/src/pages/login.less +53 -0
- package/src/pages/system/config/index.jsx +136 -0
- package/src/pages/system/dict/Dict.jsx +73 -0
- package/src/pages/system/dict/DictItem.jsx +177 -0
- package/src/pages/system/dict/index.jsx +25 -0
- package/src/pages/system/file/index.jsx +152 -0
- package/src/pages/system/log/index.jsx +78 -0
- package/src/pages/system/org/index.jsx +263 -0
- package/src/pages/system/role/index.jsx +314 -0
- package/src/pages/system/role/perm.jsx +111 -0
- package/src/pages/system/sysManual/index.jsx +127 -0
- package/src/pages/system/user/UserPerm.jsx +132 -0
- package/src/pages/system/user/index.jsx +261 -0
- package/src/pages/test.jsx +16 -0
- package/src/pages/ureport/index.jsx +43 -0
- package/src/pages/userCenter/ChangePassword.jsx +64 -0
- package/src/pages/userCenter/index.jsx +90 -0
- package/src/pages/userCenter/manual.jsx +63 -0
- package/src/pages/userCenter/message.jsx +105 -0
- package/src/style/global.less +51 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export * from './FieldAutoTime'
|
|
2
|
+
export * from './FieldEditor'
|
|
3
|
+
export * from './FieldBoolean';
|
|
4
|
+
export * from './switch-y-n';
|
|
5
|
+
export * from './FieldSelectPosition';
|
|
6
|
+
export * from './input-number-percent';
|
|
7
|
+
|
|
8
|
+
export * from './FieldRemoteTreeSelect';
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
export * from './time';
|
|
12
|
+
export * from './flat-multiple-select';
|
|
13
|
+
export * from './flat-select';
|
|
14
|
+
export * from './dict';
|
|
15
|
+
export * from './FieldRemoteTreeCascader';
|
|
16
|
+
export * from './FieldRemoteTreeMultipleSelect';
|
|
17
|
+
export * from './text';
|
|
18
|
+
export * from './FieldProps'
|
|
19
|
+
export * from './FieldOrgTree'
|
|
20
|
+
|
|
21
|
+
export * from './FieldAutoTime'
|
|
22
|
+
export * from './FieldRemoteTreeCheckable'
|
|
23
|
+
export * from './FieldPassword'
|
|
24
|
+
export * from './FieldInput'
|
|
25
|
+
|
|
26
|
+
export * from './FieldTree'
|
|
27
|
+
export * from './FieldEditTable'
|
|
28
|
+
export * from './FieldFileBase64'
|
|
29
|
+
|
|
30
|
+
export * from './upload'
|
|
31
|
+
export * from './select'
|
|
32
|
+
|
|
33
|
+
export * from './FieldImageBase64'
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
export interface InputNumberPercentProps {
|
|
4
|
+
mode?: string | 'read';
|
|
5
|
+
value?: Number;
|
|
6
|
+
onChange?: (value: Number) => void;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare class InputNumberPercent extends React.Component<InputNumberPercentProps, any> {}
|
|
10
|
+
|
|
11
|
+
declare class FieldInputNumberPercent extends React.Component<InputNumberPercentProps, any> {}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {InputNumber} from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
export class InputNumberPercent extends React.Component {
|
|
5
|
+
render() {
|
|
6
|
+
const { props } = this;
|
|
7
|
+
const { value, mode, ...rest } = props;
|
|
8
|
+
|
|
9
|
+
if (mode === 'read') {
|
|
10
|
+
return (value * 100).toFixed(2) + '%';
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<InputNumber
|
|
15
|
+
min={0}
|
|
16
|
+
max={1}
|
|
17
|
+
step={0.01}
|
|
18
|
+
formatter={(value) => (value * 100).toFixed(2)}
|
|
19
|
+
parser={(value) => (value / 100).toFixed(2)}
|
|
20
|
+
addonAfter={'%'}
|
|
21
|
+
value={value}
|
|
22
|
+
{...rest}
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { InputNumberPercent as FieldInputNumberPercent };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
declare type FieldSelectProps = {
|
|
5
|
+
|
|
6
|
+
url: string,
|
|
7
|
+
value?: any
|
|
8
|
+
onChange?: (value:any)=>{},
|
|
9
|
+
|
|
10
|
+
// 数据加载完
|
|
11
|
+
onLoadDataFinish?:(list:any[])=>{};
|
|
12
|
+
|
|
13
|
+
showRefresh?:boolean;
|
|
14
|
+
|
|
15
|
+
placeholder?:string
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
disabled?:false;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 是否多选
|
|
22
|
+
*/
|
|
23
|
+
multiple?:boolean;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* 多选选时返回对象数组
|
|
27
|
+
*
|
|
28
|
+
* primitive 原始值,如123 , 多选时时数组, 如[123,456]
|
|
29
|
+
* object 包装成对象的值, 如 {id:123}, 多选时 [{id:123},{id:456}]
|
|
30
|
+
* joined 逗号分割的字符串, 如123,456
|
|
31
|
+
*
|
|
32
|
+
*/
|
|
33
|
+
valueType?: 'primitive'| 'object' | 'joined' | undefined | null;
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export class FieldSelect extends React.Component<FieldSelectProps, any> {
|
|
39
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import {Button, Select, Spin} from 'antd';
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import {HttpUtil} from "../../../../system";
|
|
5
|
+
import {ReloadOutlined} from "@ant-design/icons";
|
|
6
|
+
import {ObjUtil} from "../../../../utils";
|
|
7
|
+
|
|
8
|
+
export class FieldSelect extends React.Component {
|
|
9
|
+
|
|
10
|
+
constructor(props) {
|
|
11
|
+
super(props);
|
|
12
|
+
|
|
13
|
+
ObjUtil.copyPropertyIfPresent(props, this.state)
|
|
14
|
+
this.state.componentValue = this.convertInputToComponentValue(this.state.value)
|
|
15
|
+
|
|
16
|
+
if (this.state.multiple) {
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
state = {
|
|
21
|
+
// 参数
|
|
22
|
+
url: '',
|
|
23
|
+
data: [],
|
|
24
|
+
value: null,
|
|
25
|
+
loading: false,
|
|
26
|
+
searchText: '',
|
|
27
|
+
showRefresh: false,
|
|
28
|
+
placeholder: '请选择',
|
|
29
|
+
|
|
30
|
+
multiple: false,
|
|
31
|
+
valueType: 'primitive',
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
// 内部状态
|
|
35
|
+
componentValue: null
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
componentDidMount() {
|
|
40
|
+
this.loadData({});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
componentDidUpdate(prevProps, prevState, snapshot) {
|
|
44
|
+
let {value} = this.props;
|
|
45
|
+
// 表单主动设置value的情况
|
|
46
|
+
if (value !== prevProps.value && this.state.value !== value) {
|
|
47
|
+
const v = this.convertInputToComponentValue(value);
|
|
48
|
+
this.setState({componentValue: v, value: v}, () => this.loadData({}))
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
convertInputToComponentValue = value => {
|
|
53
|
+
if (value != null) {
|
|
54
|
+
if (this.state.multiple) {
|
|
55
|
+
if (this.state.valueType === 'object') {
|
|
56
|
+
return value.map(v => v.id)
|
|
57
|
+
}
|
|
58
|
+
if (this.state.valueType === 'joined') {
|
|
59
|
+
return value.split(',')
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
if (this.state.valueType === 'object') {
|
|
63
|
+
return value.id
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return value
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
convertComponentValueToOutput = value => {
|
|
73
|
+
if (value != null) {
|
|
74
|
+
if (this.state.multiple) {
|
|
75
|
+
if (this.state.valueType === 'object') {
|
|
76
|
+
return value.map(v => {
|
|
77
|
+
return {id: v}
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
if (this.state.valueType === 'joined') {
|
|
81
|
+
return value.join(',')
|
|
82
|
+
}
|
|
83
|
+
} else {
|
|
84
|
+
if (this.state.valueType === 'object') {
|
|
85
|
+
return {id: value}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return value
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
handleChange = (value) => {
|
|
95
|
+
this.setState({componentValue: value, loading: false});
|
|
96
|
+
this.props.onChange?.(this.convertComponentValueToOutput(value));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
handleSearch = (searchText) => {
|
|
101
|
+
this.setState({searchText});
|
|
102
|
+
this.loadData({searchText: searchText});
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
loadData = ({searchText}) => {
|
|
106
|
+
const {value, url} = this.state;
|
|
107
|
+
|
|
108
|
+
let selected = null;
|
|
109
|
+
if (value != null) {
|
|
110
|
+
const isArray = value instanceof Array
|
|
111
|
+
if (isArray) {
|
|
112
|
+
selected = value.join(',')
|
|
113
|
+
} else {
|
|
114
|
+
selected = value
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
this.setState({loading: true});
|
|
120
|
+
HttpUtil.get(url, {searchText, selected})
|
|
121
|
+
.then(data => {
|
|
122
|
+
this.setState({data});
|
|
123
|
+
this.props.onLoadDataFinish?.(data);
|
|
124
|
+
})
|
|
125
|
+
.finally(() => {
|
|
126
|
+
this.setState({loading: false});
|
|
127
|
+
})
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
render() {
|
|
132
|
+
console.log(this.props.disabled)
|
|
133
|
+
return (
|
|
134
|
+
<div style={{display: 'flex', alignItems: 'center'}}>
|
|
135
|
+
<Select
|
|
136
|
+
{...this.props}
|
|
137
|
+
allowClear
|
|
138
|
+
showSearch
|
|
139
|
+
style={{width: '100%', minWidth: 200}}
|
|
140
|
+
notFoundContent={this.state.loading ? <Spin size="small"/> : null}
|
|
141
|
+
filterOption={false}
|
|
142
|
+
onSearch={this.handleSearch}
|
|
143
|
+
onChange={this.handleChange}
|
|
144
|
+
placeholder={this.state.placeholder}
|
|
145
|
+
value={this.state.componentValue}
|
|
146
|
+
options={this.state.data}
|
|
147
|
+
mode={this.state.multiple ? 'multiple' : undefined}
|
|
148
|
+
>
|
|
149
|
+
</Select>
|
|
150
|
+
{this.state.showRefresh &&
|
|
151
|
+
<Button onClick={this.loadData} autoInsertSpace={false} icon={<ReloadOutlined/>}
|
|
152
|
+
size='small'/>}
|
|
153
|
+
</div>
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
declare type FieldTableSelectProps = {
|
|
5
|
+
/**
|
|
6
|
+
* 远程方法连接, 返回的data数据为 io.tmgg.lang.obj.Table
|
|
7
|
+
*/
|
|
8
|
+
url:string;
|
|
9
|
+
|
|
10
|
+
type: 'checkbox' | 'radio';
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 显示的字段
|
|
16
|
+
*/
|
|
17
|
+
labelKey: string;
|
|
18
|
+
|
|
19
|
+
placeholder?:string;
|
|
20
|
+
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 下拉表格
|
|
25
|
+
*
|
|
26
|
+
* 后端参考接口:
|
|
27
|
+
*/
|
|
28
|
+
export class FieldTableSelect extends React.Component<FieldTableSelectProps, any> {
|
|
29
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {Input, Select, Table, Typography} from "antd";
|
|
3
|
+
import {SearchOutlined} from "@ant-design/icons";
|
|
4
|
+
import {HttpUtil} from "../../../../system";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 下拉表格
|
|
8
|
+
*/
|
|
9
|
+
export class FieldTableSelect extends React.Component {
|
|
10
|
+
|
|
11
|
+
state = {
|
|
12
|
+
loading: false,
|
|
13
|
+
columns: [],
|
|
14
|
+
dataSource: [],
|
|
15
|
+
|
|
16
|
+
open: false,
|
|
17
|
+
searchText: null,
|
|
18
|
+
|
|
19
|
+
value: null,
|
|
20
|
+
label: null,
|
|
21
|
+
|
|
22
|
+
// 分页参数
|
|
23
|
+
totalElements: 0,
|
|
24
|
+
current: 1,
|
|
25
|
+
pageSize: 10,
|
|
26
|
+
sorter: null
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
componentDidMount() {
|
|
32
|
+
let value = this.props.value;
|
|
33
|
+
this.state.value = value
|
|
34
|
+
// 首次加载时,将默认的那条数据也下载下来,方便显示label
|
|
35
|
+
this.initData(value);
|
|
36
|
+
|
|
37
|
+
this.loadData()
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
initData(value) {
|
|
41
|
+
if (value != null) {
|
|
42
|
+
let selected = [value];
|
|
43
|
+
HttpUtil.post(this.props.url, {selected}, {size:1})
|
|
44
|
+
.then(({ dataSource}) => {
|
|
45
|
+
const record = dataSource[0]
|
|
46
|
+
if (record) {
|
|
47
|
+
this.setState({label: record[this.props.labelKey]})
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
componentDidUpdate(prevProps, prevState, snapshot) {
|
|
54
|
+
let {value} = this.props;
|
|
55
|
+
// 表单主动设置value的情况
|
|
56
|
+
if (value !== prevProps.value && this.state.value !== value) {
|
|
57
|
+
this.setState({value: value, label: null}, this.loadData)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
loadData = searchText => {
|
|
62
|
+
this.setState({loading: true})
|
|
63
|
+
|
|
64
|
+
const params = {
|
|
65
|
+
size: this.state.pageSize,
|
|
66
|
+
page: this.state.current,
|
|
67
|
+
searchText,
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
if(this.state.sorter){
|
|
72
|
+
const {field, order} = this.state.sorter
|
|
73
|
+
if (field) {
|
|
74
|
+
params.sort = field + "," + (order === 'ascend' ? 'asc' : 'desc')
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
HttpUtil.get(this.props.url, params).then(({columns, dataSource, totalElements}) => {
|
|
80
|
+
this.setState({columns, dataSource, totalElements: parseInt(totalElements)})
|
|
81
|
+
}).finally(() => {
|
|
82
|
+
this.setState({loading: false})
|
|
83
|
+
})
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
onSearch = searchText => {
|
|
88
|
+
this.setState({searchText})
|
|
89
|
+
this.loadData(searchText)
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
render() {
|
|
93
|
+
return <>
|
|
94
|
+
<Select popupRender={this.popupRender} loading={this.state.loading}
|
|
95
|
+
open={this.state.open}
|
|
96
|
+
onOpenChange={visible => this.setState({open: visible})}
|
|
97
|
+
style={{minWidth: 300}}
|
|
98
|
+
value={this.state.value}
|
|
99
|
+
labelRender={() => this.state.label}
|
|
100
|
+
popupMatchSelectWidth={900}
|
|
101
|
+
placeholder={this.props.placeholder || '请选择'}
|
|
102
|
+
/>
|
|
103
|
+
</>
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
popupRender = () => {
|
|
108
|
+
return <div>
|
|
109
|
+
<div style={{padding: 8, display: 'flex', justifyContent: 'end'}}>
|
|
110
|
+
<Input
|
|
111
|
+
placeholder="搜索..."
|
|
112
|
+
prefix={<SearchOutlined/>}
|
|
113
|
+
value={this.state.searchText}
|
|
114
|
+
onChange={(e) => this.onSearch(e.target.value)}
|
|
115
|
+
style={{maxWidth: 280}}
|
|
116
|
+
/>
|
|
117
|
+
</div>
|
|
118
|
+
<Table dataSource={this.state.dataSource} loading={this.state.loading}
|
|
119
|
+
columns={this.state.columns}
|
|
120
|
+
size='small'
|
|
121
|
+
bordered
|
|
122
|
+
rowKey='id'
|
|
123
|
+
onRow={(record) => {
|
|
124
|
+
return {
|
|
125
|
+
onDoubleClick: (event) => {
|
|
126
|
+
let value = record.id;
|
|
127
|
+
let label = record[this.props.labelKey]
|
|
128
|
+
|
|
129
|
+
this.setState({label, value, open: false})
|
|
130
|
+
this.props.onChange?.(value)
|
|
131
|
+
},
|
|
132
|
+
}
|
|
133
|
+
}}
|
|
134
|
+
|
|
135
|
+
pagination={{
|
|
136
|
+
total: this.state.totalElements,
|
|
137
|
+
pageSize: this.state.pageSize,
|
|
138
|
+
current: this.state.current,
|
|
139
|
+
showTotal: (total) => `共 ${total} 条`
|
|
140
|
+
}}
|
|
141
|
+
|
|
142
|
+
onChange={(pagination, filters, sorter, extra) => {
|
|
143
|
+
this.setState({
|
|
144
|
+
current: pagination.current,
|
|
145
|
+
pageSize: pagination.pageSize,
|
|
146
|
+
sorter
|
|
147
|
+
}, this.loadData)
|
|
148
|
+
}}
|
|
149
|
+
summary={()=><Typography.Text>提示:双击选择数据</Typography.Text>}
|
|
150
|
+
|
|
151
|
+
></Table>
|
|
152
|
+
|
|
153
|
+
</div>
|
|
154
|
+
};
|
|
155
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
export interface SwitchYNProps {
|
|
4
|
+
mode?: string | 'read';
|
|
5
|
+
value?: String;
|
|
6
|
+
onChange?: (value: String) => void;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare class SwitchYN extends React.Component<SwitchYNProps, any> {}
|
|
10
|
+
|
|
11
|
+
declare class FieldSwitchYN extends React.Component<SwitchYNProps, any> {}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Switch} from 'antd';
|
|
3
|
+
|
|
4
|
+
export { SwitchYN as FieldSwitchYN };
|
|
5
|
+
|
|
6
|
+
export class SwitchYN extends React.Component {
|
|
7
|
+
render() {
|
|
8
|
+
let { value, mode } = this.props;
|
|
9
|
+
|
|
10
|
+
if (mode === 'read') {
|
|
11
|
+
if (value) {
|
|
12
|
+
return value === 'Y' ? '是' : '否';
|
|
13
|
+
}
|
|
14
|
+
return '';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
let strValue = null;
|
|
18
|
+
if (value != null && value != '') {
|
|
19
|
+
strValue = value == 'Y';
|
|
20
|
+
} else {
|
|
21
|
+
// 设置默认值
|
|
22
|
+
strValue = 'N';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return <Switch value={strValue} {...this.props} onChange={this.onChange}></Switch>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
onChange = (b) => {
|
|
29
|
+
this.props.onChange(b ? 'Y' : 'N');
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {DatePicker} from 'antd';
|
|
3
|
+
import {valueToDate} from "./TimePickerTool";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* 值类型为字符串
|
|
8
|
+
*/
|
|
9
|
+
export { DatePickerString as FieldDatePickerString };
|
|
10
|
+
|
|
11
|
+
const FMT = 'YYYY-MM-DD';
|
|
12
|
+
|
|
13
|
+
export class DatePickerString extends React.Component {
|
|
14
|
+
static FORMAT = FMT
|
|
15
|
+
onChange = (date) => {
|
|
16
|
+
const str = date ? date.format(FMT) : null;
|
|
17
|
+
this.props.onChange(str);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
render() {
|
|
21
|
+
let { value, readOnly = false, mode } = this.props;
|
|
22
|
+
if (mode == 'read') {
|
|
23
|
+
return value;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
value = valueToDate(value,FMT)
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<DatePicker
|
|
30
|
+
{...this.props}
|
|
31
|
+
value={value}
|
|
32
|
+
onChange={this.onChange}
|
|
33
|
+
disabled={readOnly || this.props.disabled}
|
|
34
|
+
></DatePicker>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {DatePicker} from 'antd';
|
|
3
|
+
import {valueToDate} from "./TimePickerTool";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 月份选择器
|
|
7
|
+
*
|
|
8
|
+
* 值类型为字符串
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
export { DateTimePickerString as FieldDateTimePickerString };
|
|
13
|
+
const FMT = 'YYYY-MM-DD HH:mm:ss';
|
|
14
|
+
|
|
15
|
+
export class DateTimePickerString extends React.Component {
|
|
16
|
+
|
|
17
|
+
static FORMAT = FMT
|
|
18
|
+
|
|
19
|
+
onChange = (date) => {
|
|
20
|
+
const str = date ? date.format(FMT) :null;
|
|
21
|
+
this.props.onChange(str);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
render() {
|
|
25
|
+
let { value, readOnly = false, mode } = this.props;
|
|
26
|
+
if (mode == 'read') {
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
value = valueToDate(value,FMT)
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<DatePicker
|
|
33
|
+
{...this.props}
|
|
34
|
+
showTime
|
|
35
|
+
value={value}
|
|
36
|
+
onChange={this.onChange}
|
|
37
|
+
|
|
38
|
+
disabled={readOnly || this.props.disabled}
|
|
39
|
+
></DatePicker>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {DatePicker} from "antd";
|
|
3
|
+
import dayjs from "dayjs";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 日期区间选择, 格式为时间戳数组
|
|
7
|
+
*
|
|
8
|
+
* 时间范围使用ISO 8601 时间间隔格式
|
|
9
|
+
* 存储格式:开始时间/结束时间
|
|
10
|
+
* 2023-01-01/2023-01-01
|
|
11
|
+
*
|
|
12
|
+
* 提示:后端便捷方式 q.betweenIsoDateRange("createTime", dateRange);
|
|
13
|
+
*/
|
|
14
|
+
export class FieldDateRange extends React.Component {
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
str2dayjs(v) {
|
|
18
|
+
console.log('调用转换')
|
|
19
|
+
if (v ) {
|
|
20
|
+
const arr = v.split("/")
|
|
21
|
+
|
|
22
|
+
let v1 = arr[0];
|
|
23
|
+
let v2 = arr[1];
|
|
24
|
+
return [dayjs(v1), dayjs(v2)]
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
render() {
|
|
33
|
+
let {value, onChange} = this.props
|
|
34
|
+
|
|
35
|
+
value = this.str2dayjs(value)
|
|
36
|
+
|
|
37
|
+
return <DatePicker.RangePicker
|
|
38
|
+
value={value}
|
|
39
|
+
format={"YYYY-MM-DD"}
|
|
40
|
+
onChange={(value, dateString) => {
|
|
41
|
+
let strValue = dateString.join('/');
|
|
42
|
+
strValue = strValue === '/' ? null: strValue
|
|
43
|
+
onChange(strValue)
|
|
44
|
+
}}
|
|
45
|
+
>
|
|
46
|
+
</DatePicker.RangePicker>
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {TimePicker} from 'antd';
|
|
4
|
+
import {valueToDate} from "./TimePickerTool";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 时分
|
|
8
|
+
*
|
|
9
|
+
* 值类型为字符串
|
|
10
|
+
*
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
const FMT = 'HH:mm';
|
|
14
|
+
|
|
15
|
+
export class FieldHHmmPickerString extends React.Component {
|
|
16
|
+
|
|
17
|
+
static FORMAT = FMT
|
|
18
|
+
|
|
19
|
+
onChange = (date) => {
|
|
20
|
+
const str = date ? date.format(FMT) : null;
|
|
21
|
+
this.props.onChange(str);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
render() {
|
|
25
|
+
let { value, readOnly = false, mode } = this.props;
|
|
26
|
+
if (mode == 'read') {
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
value = valueToDate(value,FMT)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<TimePicker
|
|
34
|
+
{...this.props}
|
|
35
|
+
value={value}
|
|
36
|
+
onChange={this.onChange}
|
|
37
|
+
format={FMT}
|
|
38
|
+
disabled={readOnly || this.props.disabled}
|
|
39
|
+
></TimePicker>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
}
|