@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,100 @@
|
|
|
1
|
+
import {message, TreeSelect} from 'antd';
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import {HttpUtil} from "../../system";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* props : url
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export class FieldRemoteTreeMultipleSelect extends React.Component {
|
|
11
|
+
|
|
12
|
+
constructor(props) {
|
|
13
|
+
super(props);
|
|
14
|
+
this.state = {
|
|
15
|
+
url: props.url,
|
|
16
|
+
data: [],
|
|
17
|
+
value: [],
|
|
18
|
+
fetching: false,
|
|
19
|
+
key: this.props.id,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
componentDidMount() {
|
|
24
|
+
this.loadData();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
loadData = () => {
|
|
30
|
+
const {url} = this.state;
|
|
31
|
+
|
|
32
|
+
this.setState({fetching: true});
|
|
33
|
+
HttpUtil.get(url).then((rs) => {
|
|
34
|
+
if (rs == null || rs.success === false) {
|
|
35
|
+
message.error(rs?.message || '异常');
|
|
36
|
+
this.setState({fetching: false});
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
this.setState({data: rs, fetching: false});
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
handleChange = (value) => {
|
|
45
|
+
if (this.props.onChange) {
|
|
46
|
+
this.props.onChange(value);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
render() {
|
|
53
|
+
const {data} = this.state;
|
|
54
|
+
let {value, mode, onChange, ...restProps} = this.props;
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
if (mode === 'read') {
|
|
58
|
+
return this.renderRead();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<TreeSelect
|
|
63
|
+
style={{width: '100%'}}
|
|
64
|
+
allowClear={true}
|
|
65
|
+
dropdownStyle={{maxHeight: 400, overflow: 'auto'}}
|
|
66
|
+
treeData={data}
|
|
67
|
+
showCheckedStrategy={TreeSelect.SHOW_ALL}
|
|
68
|
+
treeDefaultExpandAll={false}
|
|
69
|
+
|
|
70
|
+
multiple
|
|
71
|
+
|
|
72
|
+
showArrow={true}
|
|
73
|
+
|
|
74
|
+
value={value || undefined}
|
|
75
|
+
onChange={this.handleChange}
|
|
76
|
+
|
|
77
|
+
filterTreeNode={(inputValue, treeNode)=>{
|
|
78
|
+
const {title} = treeNode
|
|
79
|
+
return StrUtil.contains(title,inputValue)
|
|
80
|
+
}}
|
|
81
|
+
|
|
82
|
+
treeLine={{showLeafIcon:true}}
|
|
83
|
+
{...restProps}
|
|
84
|
+
/>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
renderRead() {
|
|
89
|
+
const {value} = this.props;
|
|
90
|
+
if (value == null) {
|
|
91
|
+
return '-';
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const {data} = this.state;
|
|
95
|
+
|
|
96
|
+
const itemList = TreeUtil.findByKeyList(data, value);
|
|
97
|
+
|
|
98
|
+
return itemList.map((item) => item.title || item.label).join(',');
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import {Spin, TreeSelect} from 'antd';
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import {HttpUtil} from "../../system";
|
|
5
|
+
import {TreeUtil} from "../../utils";
|
|
6
|
+
|
|
7
|
+
export class FieldRemoteTreeSelect extends React.Component {
|
|
8
|
+
state = {
|
|
9
|
+
data: [],
|
|
10
|
+
value: [],
|
|
11
|
+
fetching: false,
|
|
12
|
+
key: this.props.id,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
componentDidMount() {
|
|
16
|
+
this.fetchData();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
fetchData = () => {
|
|
24
|
+
const { url } = this.props;
|
|
25
|
+
this.setState({ fetching: true });
|
|
26
|
+
|
|
27
|
+
HttpUtil.get(url).then((rs) => {
|
|
28
|
+
this.setState({ data: rs, fetching: false });
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
handleChange = (value) => {
|
|
33
|
+
if (this.props.onChange) {
|
|
34
|
+
this.props.onChange(value);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
render() {
|
|
39
|
+
const { props } = this;
|
|
40
|
+
let { mode, value } = props;
|
|
41
|
+
let { data } = this.state;
|
|
42
|
+
|
|
43
|
+
if (this.state.fetching) {
|
|
44
|
+
return <Spin />;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (mode === 'read') {
|
|
48
|
+
if (value == null) {
|
|
49
|
+
return '';
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const target = TreeUtil.findByKey(data, value);
|
|
53
|
+
if (target) {
|
|
54
|
+
return target.title;
|
|
55
|
+
}
|
|
56
|
+
return '';
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<TreeSelect
|
|
62
|
+
style={{ width: '100%', minWidth: 200 }}
|
|
63
|
+
allowClear={true}
|
|
64
|
+
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
|
|
65
|
+
treeData={data}
|
|
66
|
+
showCheckedStrategy={TreeSelect.SHOW_ALL}
|
|
67
|
+
treeDefaultExpandAll={false}
|
|
68
|
+
onChange={this.handleChange}
|
|
69
|
+
|
|
70
|
+
filterTreeNode={(inputValue, treeNode)=>{
|
|
71
|
+
const {title} = treeNode
|
|
72
|
+
return str.contains(title,inputValue)
|
|
73
|
+
}}
|
|
74
|
+
treeLine={{showLeafIcon:true}}
|
|
75
|
+
|
|
76
|
+
{...this.props}
|
|
77
|
+
value={value || undefined}
|
|
78
|
+
showArrow={true}
|
|
79
|
+
/>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import {ArrayLngLat, Map, Marker} from 'react-amap';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import {FieldProps} from "../FieldProps";
|
|
4
|
+
|
|
5
|
+
interface MapProps extends FieldProps {
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @description 经纬度 lng,lat。 默认北京116.405003,39.917742
|
|
9
|
+
*/
|
|
10
|
+
value: string
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @description 画布宽度
|
|
14
|
+
*/
|
|
15
|
+
width?: number;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @description 画布高度
|
|
19
|
+
*/
|
|
20
|
+
height?: number;
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 设置高德地图key
|
|
29
|
+
* @param key
|
|
30
|
+
*/
|
|
31
|
+
export function configAMapKey(key: string) {
|
|
32
|
+
localStorage.setItem("amapKey", key)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function getAMapKey(): string {
|
|
36
|
+
return localStorage.getItem("amapKey") || ''
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export class FieldSelectPosition extends React.Component<MapProps, any> {
|
|
40
|
+
|
|
41
|
+
static defaultProps = {
|
|
42
|
+
width: 600,
|
|
43
|
+
height: 400,
|
|
44
|
+
value: '116.405003,39.917742'
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
render() {
|
|
49
|
+
let {width, height, mode, value} = this.props
|
|
50
|
+
let disabled = mode == 'read'
|
|
51
|
+
|
|
52
|
+
if (!value) {
|
|
53
|
+
value = FieldSelectPosition.defaultProps.value
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
let [lng, lat] = value.split(',')
|
|
57
|
+
let position: ArrayLngLat = [parseFloat(lng), parseFloat(lat)];
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<div style={{width, height}}>
|
|
61
|
+
<Map
|
|
62
|
+
zoomEnable={!disabled}
|
|
63
|
+
center={position}
|
|
64
|
+
dragEnable={!disabled}
|
|
65
|
+
zoom={16}
|
|
66
|
+
amapkey={getAMapKey()}
|
|
67
|
+
events={{
|
|
68
|
+
click: (e:any) => {
|
|
69
|
+
if (disabled) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const {lnglat} = e;
|
|
73
|
+
const {lng, lat} = lnglat; // 经纬度
|
|
74
|
+
if (this.props.onChange) {
|
|
75
|
+
this.props.onChange(lng + ',' + lat);
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
}}
|
|
79
|
+
>
|
|
80
|
+
{value && <Marker position={position}/>}
|
|
81
|
+
</Map>
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {Tree} from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import {HttpUtil} from "../../system";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export class FieldTree extends React.Component {
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
state = {
|
|
10
|
+
treeData: null,
|
|
11
|
+
checked: [],
|
|
12
|
+
confirmLoading: false,
|
|
13
|
+
}
|
|
14
|
+
actionRef = React.createRef();
|
|
15
|
+
|
|
16
|
+
componentDidMount() {
|
|
17
|
+
const {url} = this.props;
|
|
18
|
+
HttpUtil.get(url).then(rs => {
|
|
19
|
+
this.setState({treeData: rs})
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
render() {
|
|
26
|
+
console.log('checked keys', this.props.value)
|
|
27
|
+
let {treeData} = this.state
|
|
28
|
+
return <>
|
|
29
|
+
<Tree
|
|
30
|
+
treeData={treeData}
|
|
31
|
+
multiple
|
|
32
|
+
checkable
|
|
33
|
+
checkStrictly={true}
|
|
34
|
+
checkedKeys={this.props.value}
|
|
35
|
+
onCheck={(keys)=>this.props.onChange(keys)}
|
|
36
|
+
>
|
|
37
|
+
</Tree>
|
|
38
|
+
</>
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import {Checkbox, Radio, Select} from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import {dictList, dictValue, dictValueTag} from "../../../system";
|
|
4
|
+
|
|
5
|
+
export interface DictProps {
|
|
6
|
+
typeCode: string;
|
|
7
|
+
params?: string; // 同typeCode, pro-table用
|
|
8
|
+
mode?: string | 'read';
|
|
9
|
+
value?: any;
|
|
10
|
+
onChange?: (value: any) => void;
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 字典希腊选择组件
|
|
16
|
+
* @param props
|
|
17
|
+
* @returns {JSX.Element|string|*}
|
|
18
|
+
* @constructor
|
|
19
|
+
*/
|
|
20
|
+
export class DictSelect extends React.Component<DictProps> {
|
|
21
|
+
|
|
22
|
+
render() {
|
|
23
|
+
let {typeCode, params, mode, value, onChange, placeholder = '请选择', ...restProps} = this.props;
|
|
24
|
+
|
|
25
|
+
if (typeCode == null) {
|
|
26
|
+
typeCode = params;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
if (mode === 'read') {
|
|
31
|
+
return dictValueTag(typeCode, value);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
let list = dictList(typeCode) || [];
|
|
35
|
+
|
|
36
|
+
if(value != null){
|
|
37
|
+
value = String(value)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<Select value={value} onChange={onChange} placeholder={placeholder} allowClear {...restProps} style={{minWidth:150}}>
|
|
42
|
+
{list.map((o: any) => (
|
|
43
|
+
<Select.Option value={o.code} key={o.code}>
|
|
44
|
+
{o.name}
|
|
45
|
+
</Select.Option>
|
|
46
|
+
))}
|
|
47
|
+
</Select>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function DictRadio(props: DictProps) {
|
|
53
|
+
let { typeCode, mode, value, params } = props;
|
|
54
|
+
|
|
55
|
+
if(typeCode == null){
|
|
56
|
+
typeCode = params;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (mode === 'read') {
|
|
60
|
+
return dictValueTag(typeCode, value);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
let list = dictList(typeCode);
|
|
64
|
+
return (
|
|
65
|
+
<Radio.Group value={String(value)} onChange={props.onChange}>
|
|
66
|
+
{list.map((o: any) => (
|
|
67
|
+
<Radio value={o.code} key={o.code}>
|
|
68
|
+
{o.name}
|
|
69
|
+
</Radio>
|
|
70
|
+
))}
|
|
71
|
+
</Radio.Group>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// 多选框
|
|
76
|
+
export function DictCheckbox(props: DictProps) {
|
|
77
|
+
const { typeCode, mode, value } = props;
|
|
78
|
+
if (mode === 'read') {
|
|
79
|
+
if (value && value.length) {
|
|
80
|
+
return value.map((v: any) => dictValueTag(typeCode, v));
|
|
81
|
+
}
|
|
82
|
+
return '-';
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
let list = dictList(typeCode);
|
|
86
|
+
return (
|
|
87
|
+
<Checkbox.Group value={value} onChange={props.onChange}>
|
|
88
|
+
{list.map((o: any) => (
|
|
89
|
+
<Checkbox value={o.code} key={o.code}>
|
|
90
|
+
{o.name}
|
|
91
|
+
</Checkbox>
|
|
92
|
+
))}
|
|
93
|
+
</Checkbox.Group>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function FieldDictValueTag(props: DictProps) {
|
|
98
|
+
const { typeCode, value } = props;
|
|
99
|
+
return dictValueTag(typeCode, value);
|
|
100
|
+
}
|
|
101
|
+
export function FieldDictValue(props: DictProps) {
|
|
102
|
+
const { typeCode, value } = props;
|
|
103
|
+
return dictValue(typeCode, value);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export {
|
|
107
|
+
DictRadio as FieldDictRadio,
|
|
108
|
+
DictSelect as FieldDictSelect,
|
|
109
|
+
DictCheckbox as FieldDictCheckbox,
|
|
110
|
+
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 类似下拉选择的功能,不过是横向平铺
|
|
3
|
+
* 可以使用 url 或直接设置data
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import {Button, message} from 'antd';
|
|
7
|
+
|
|
8
|
+
import './index.less';
|
|
9
|
+
import {HttpUtil} from "../../../system";
|
|
10
|
+
|
|
11
|
+
/*
|
|
12
|
+
interface FlatMultipleSelectProps {
|
|
13
|
+
url?: string,
|
|
14
|
+
data?: DATA[]
|
|
15
|
+
onChange: (value: any) => void;
|
|
16
|
+
disabled: boolean;
|
|
17
|
+
style: any
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface DATA {
|
|
21
|
+
label: string,
|
|
22
|
+
value: any
|
|
23
|
+
}
|
|
24
|
+
*/
|
|
25
|
+
export { FlatMultipleSelect as FieldFlatMultipleSelect };
|
|
26
|
+
|
|
27
|
+
export class FlatMultipleSelect extends React.Component {
|
|
28
|
+
state = {
|
|
29
|
+
data: [],
|
|
30
|
+
fetching: false,
|
|
31
|
+
searchText: null,
|
|
32
|
+
value: [],
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
constructor(props) {
|
|
36
|
+
super(props);
|
|
37
|
+
if (props.data != null) {
|
|
38
|
+
this.state.data = props.data;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
componentDidMount() {
|
|
43
|
+
this.loadData();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
loadData = (searchText = '') => {
|
|
47
|
+
const { url } = this.props;
|
|
48
|
+
if (url == null) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
this.setState({ fetching: true });
|
|
53
|
+
|
|
54
|
+
HttpUtil.get(url, { searchText }).then(rs => {
|
|
55
|
+
this.setState({ fetching: false });
|
|
56
|
+
|
|
57
|
+
if (!(rs instanceof Array)) {
|
|
58
|
+
message.error('返回结果的data字段应该为数组');
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
this.setState({ data: rs });
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
onBtnClick = (v) => {
|
|
66
|
+
let value = this.state.value;
|
|
67
|
+
if (v == null) {
|
|
68
|
+
// 所有
|
|
69
|
+
value = [];
|
|
70
|
+
} else {
|
|
71
|
+
const value = this.state.value;
|
|
72
|
+
const idx = value.indexOf(v);
|
|
73
|
+
const exist = idx != -1;
|
|
74
|
+
if (exist) {
|
|
75
|
+
value.splice(idx, 1);
|
|
76
|
+
} else {
|
|
77
|
+
value.push(v);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
this.setState({ value: value });
|
|
82
|
+
|
|
83
|
+
if (this.props.onChange) {
|
|
84
|
+
this.props.onChange(value);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
render() {
|
|
89
|
+
const value = this.state.value || [];
|
|
90
|
+
const data = this.state.data;
|
|
91
|
+
return (
|
|
92
|
+
<div className="flat-select">
|
|
93
|
+
<Button
|
|
94
|
+
type={'text'}
|
|
95
|
+
size={'small'}
|
|
96
|
+
className={value.length == 0 ? 'checked' : ''}
|
|
97
|
+
onClick={() => this.onBtnClick(null)}
|
|
98
|
+
>
|
|
99
|
+
所有
|
|
100
|
+
</Button>
|
|
101
|
+
|
|
102
|
+
{data.map((d) => (
|
|
103
|
+
<Button
|
|
104
|
+
key={d.value}
|
|
105
|
+
type={'text'}
|
|
106
|
+
size={'small'}
|
|
107
|
+
className={value.indexOf(d.value) != -1 ? 'checked' : ''}
|
|
108
|
+
onClick={() => this.onBtnClick(d.value)}
|
|
109
|
+
>
|
|
110
|
+
{d.label}
|
|
111
|
+
</Button>
|
|
112
|
+
))}
|
|
113
|
+
</div>
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 类似下拉选择的功能,不过是横向平铺
|
|
3
|
+
* 可以使用 url 或直接设置data
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import {Button, message} from 'antd';
|
|
7
|
+
|
|
8
|
+
import './index.less';
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
interface FlatMultipleSelectProps {
|
|
12
|
+
url?: string,
|
|
13
|
+
data?: DATA[]
|
|
14
|
+
onChange?: (value: any) => void;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
style?: any,
|
|
17
|
+
showAll?: boolean,
|
|
18
|
+
|
|
19
|
+
value?: any
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface DATA {
|
|
23
|
+
label: string,
|
|
24
|
+
value: any
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
*/
|
|
28
|
+
export { FlatSelect as FieldFlatSelect };
|
|
29
|
+
export class FlatSelect extends React.Component {
|
|
30
|
+
state = {
|
|
31
|
+
data: [],
|
|
32
|
+
fetching: false,
|
|
33
|
+
searchText: null,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
constructor(props) {
|
|
37
|
+
super(props);
|
|
38
|
+
if (props.data != null) {
|
|
39
|
+
this.state.data = props.data;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
componentDidMount() {
|
|
44
|
+
this.loadData();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
loadData = (searchText = '') => {
|
|
48
|
+
const { url } = this.props;
|
|
49
|
+
if (url == null) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
this.setState({ fetching: true });
|
|
54
|
+
|
|
55
|
+
HttpUtil.get(url, { searchText }).then(rs => {
|
|
56
|
+
this.setState({ fetching: false });
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
if (!(rs instanceof Array)) {
|
|
60
|
+
message.error('返回结果的data字段应该为数组');
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
this.setState({ data: rs });
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
onBtnClick = (v) => {
|
|
68
|
+
this.setState({ value: v });
|
|
69
|
+
|
|
70
|
+
if (this.props.onChange) {
|
|
71
|
+
this.props.onChange(v);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
render() {
|
|
76
|
+
const value = this.props.value;
|
|
77
|
+
const data = this.state.data;
|
|
78
|
+
|
|
79
|
+
const showAll = this.props.showAll == null ? true : this.props.showAll;
|
|
80
|
+
return (
|
|
81
|
+
<div className="flat-select">
|
|
82
|
+
{showAll && (
|
|
83
|
+
<Button
|
|
84
|
+
type={'text'}
|
|
85
|
+
size={'small'}
|
|
86
|
+
className={value == null ? 'checked' : ''}
|
|
87
|
+
onClick={() => this.onBtnClick(null)}
|
|
88
|
+
>
|
|
89
|
+
所有
|
|
90
|
+
</Button>
|
|
91
|
+
)}
|
|
92
|
+
|
|
93
|
+
{data.map((d) => (
|
|
94
|
+
<Button
|
|
95
|
+
key={d.value}
|
|
96
|
+
type={'text'}
|
|
97
|
+
size={'small'}
|
|
98
|
+
className={value == d.value ? 'checked' : ''}
|
|
99
|
+
onClick={() => this.onBtnClick(d.value)}
|
|
100
|
+
>
|
|
101
|
+
{d.label}
|
|
102
|
+
</Button>
|
|
103
|
+
))}
|
|
104
|
+
</div>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
}
|