@jiangood/admin-spring-boot-starter 0.2.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.
- package/config/dist/config.js +45 -0
- package/config/dist/index.js +19 -0
- package/config/dist/plugins/form-plugin.js +51 -0
- package/config/dist/plugins/route-plugin.js +72 -0
- package/package.json +41 -0
- package/src/app.js +1 -0
- package/src/asserts/welcome.png +0 -0
- package/src/forms/demoForm.jsx +16 -0
- package/src/framework/components/DownloadFileButton.d.ts +11 -0
- package/src/framework/components/DownloadFileButton.jsx +33 -0
- package/src/framework/components/Ellipsis.jsx +39 -0
- package/src/framework/components/Ellipsis.less +8 -0
- package/src/framework/components/Gap/index.d.ts +23 -0
- package/src/framework/components/Gap/index.jsx +46 -0
- package/src/framework/components/LinkButton.d.ts +14 -0
- package/src/framework/components/LinkButton.jsx +10 -0
- package/src/framework/components/NamedIcon.tsx +15 -0
- package/src/framework/components/Page/index.d.ts +17 -0
- package/src/framework/components/Page/index.jsx +30 -0
- package/src/framework/components/Page/index.less +10 -0
- package/src/framework/components/PageLoading.tsx +27 -0
- package/src/framework/components/ProModal/index.tsx +66 -0
- package/src/framework/components/ProTable/components/ToolBar/index.jsx +123 -0
- package/src/framework/components/ProTable/components/ToolBar/index.less +53 -0
- package/src/framework/components/ProTable/index.d.ts +42 -0
- package/src/framework/components/ProTable/index.jsx +260 -0
- package/src/framework/components/ProTable/index.less +14 -0
- package/src/framework/components/ProTable/utils/index.js +43 -0
- package/src/framework/components/ValueType/index.jsx +34 -0
- package/src/framework/components/ValueType/registry.jsx +27 -0
- package/src/framework/components/index.ts +17 -0
- package/src/framework/components/system/ButtonList.d.ts +9 -0
- package/src/framework/components/system/ButtonList.jsx +35 -0
- package/src/framework/components/system/HasPerm.tsx +14 -0
- package/src/framework/components/system/index.tsx +29 -0
- package/src/framework/components/view/ViewBooleanEnableDisable.tsx +20 -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 +49 -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 +60 -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.tsx +16 -0
- package/src/framework/components/view/index.ts +10 -0
- package/src/framework/field-components/FieldBoolean.d.ts +13 -0
- package/src/framework/field-components/FieldBoolean.jsx +76 -0
- package/src/framework/field-components/FieldDate.d.ts +27 -0
- package/src/framework/field-components/FieldDate.jsx +114 -0
- package/src/framework/field-components/FieldDateRange.d.ts +6 -0
- package/src/framework/field-components/FieldDateRange.jsx +104 -0
- package/src/framework/field-components/FieldDictSelect.d.ts +13 -0
- package/src/framework/field-components/FieldDictSelect.jsx +16 -0
- package/src/framework/field-components/FieldEditor.d.ts +10 -0
- package/src/framework/field-components/FieldEditor.jsx +58 -0
- package/src/framework/field-components/FieldNumberRange.d.ts +13 -0
- package/src/framework/field-components/FieldNumberRange.jsx +59 -0
- package/src/framework/field-components/FieldPercent.d.ts +12 -0
- package/src/framework/field-components/FieldPercent.jsx +27 -0
- package/src/framework/field-components/FieldRemoteSelect.d.ts +13 -0
- package/src/framework/field-components/FieldRemoteSelect.jsx +87 -0
- package/src/framework/field-components/FieldRemoteSelectMultiple.d.ts +13 -0
- package/src/framework/field-components/FieldRemoteSelectMultiple.jsx +86 -0
- package/src/framework/field-components/FieldRemoteSelectMultipleInline.d.ts +20 -0
- package/src/framework/field-components/FieldRemoteSelectMultipleInline.jsx +86 -0
- package/src/framework/field-components/FieldRemoteTree.d.ts +21 -0
- package/src/framework/field-components/FieldRemoteTree.jsx +45 -0
- package/src/framework/field-components/FieldRemoteTreeCascader.d.ts +23 -0
- package/src/framework/field-components/FieldRemoteTreeCascader.jsx +61 -0
- package/src/framework/field-components/FieldRemoteTreeSelect.d.ts +17 -0
- package/src/framework/field-components/FieldRemoteTreeSelect.jsx +67 -0
- package/src/framework/field-components/FieldRemoteTreeSelectMultiple.d.ts +17 -0
- package/src/framework/field-components/FieldRemoteTreeSelectMultiple.jsx +68 -0
- package/src/framework/field-components/FieldSysOrgTree.d.ts +12 -0
- package/src/framework/field-components/FieldSysOrgTree.jsx +23 -0
- package/src/framework/field-components/FieldSysOrgTreeSelect.d.ts +12 -0
- package/src/framework/field-components/FieldSysOrgTreeSelect.jsx +23 -0
- package/src/framework/field-components/FieldTable.d.ts +17 -0
- package/src/framework/field-components/FieldTable.jsx +108 -0
- package/src/framework/field-components/FieldTable.less +29 -0
- package/src/framework/field-components/FieldTableSelect.d.ts +19 -0
- package/src/framework/field-components/FieldTableSelect.jsx +59 -0
- package/src/framework/field-components/FieldUploadFile.d.ts +34 -0
- package/src/framework/field-components/FieldUploadFile.jsx +141 -0
- package/src/framework/field-components/index.ts +21 -0
- package/src/framework/field-components/system/OrgTree.tsx +61 -0
- package/src/framework/field-components/system/RoleTree.tsx +53 -0
- package/src/framework/field-components/system/index.ts +2 -0
- package/src/framework/index.ts +5 -0
- package/src/framework/pages/LoginPage.d.ts +15 -0
- package/src/framework/pages/LoginPage.jsx +132 -0
- package/src/framework/pages/LoginPage.less +53 -0
- package/src/framework/pages/LoginPageUtils.ts +35 -0
- package/src/framework/pages/index.ts +2 -0
- package/src/framework/utils/ArrUtils.ts +229 -0
- package/src/framework/utils/ColorsUtils.ts +378 -0
- package/src/framework/utils/DateUtils.ts +187 -0
- package/src/framework/utils/DeviceUtils.ts +46 -0
- package/src/framework/utils/DomUtils.ts +50 -0
- package/src/framework/utils/EventBusUtils.ts +144 -0
- package/src/framework/utils/MessageUtils.tsx +145 -0
- package/src/framework/utils/ObjectUtils.ts +118 -0
- package/src/framework/utils/StorageUtils.ts +50 -0
- package/src/framework/utils/StringUtils.ts +412 -0
- package/src/framework/utils/TreeUtils.ts +251 -0
- package/src/framework/utils/UrlUtils.ts +152 -0
- package/src/framework/utils/UuidUtils.ts +88 -0
- package/src/framework/utils/ValidateUtils.ts +28 -0
- package/src/framework/utils/index.ts +16 -0
- package/src/framework/utils/system/DictUtils.ts +97 -0
- package/src/framework/utils/system/FormRegistryUtils.ts +77 -0
- package/src/framework/utils/system/HttpUtils.ts +247 -0
- package/src/framework/utils/system/PageUtils.ts +163 -0
- package/src/framework/utils/system/PermUtils.ts +79 -0
- package/src/framework/utils/system/SysUtils.ts +97 -0
- package/src/framework/utils/system/ThemeUtils.ts +27 -0
- package/src/framework/utils/system/index.ts +7 -0
- package/src/framework/view-components/ViewApproveStatus.tsx +26 -0
- package/src/framework/view-components/ViewBoolean.tsx +6 -0
- package/src/framework/view-components/ViewFlowableInstanceProgress.d.ts +12 -0
- package/src/framework/view-components/ViewFlowableInstanceProgress.jsx +97 -0
- package/src/framework/view-components/ViewFlowableInstanceProgressButton.tsx +26 -0
- package/src/framework/view-components/ViewPassword.tsx +25 -0
- package/src/framework/view-components/ViewProps.ts +11 -0
- package/src/framework/view-components/index.ts +6 -0
- package/src/index.ts +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 +161 -0
- package/src/layouts/admin/index.less +65 -0
- package/src/layouts/index.jsx +153 -0
- package/src/layouts/index.less +24 -0
- package/src/loading.jsx +18 -0
- package/src/pages/404.jsx +13 -0
- package/src/pages/about.jsx +14 -0
- package/src/pages/flowable/design/contextPad.js +50 -0
- package/src/pages/flowable/design/customTranslate/customTranslate.js +16 -0
- package/src/pages/flowable/design/customTranslate/translations-properties-panel.js +10 -0
- package/src/pages/flowable/design/customTranslate/translations.js +144 -0
- package/src/pages/flowable/design/descriptors/flowable.json +1109 -0
- package/src/pages/flowable/design/index.css +7 -0
- package/src/pages/flowable/design/index.jsx +171 -0
- package/src/pages/flowable/design/provider/FlowablePropertiesProvider.js +75 -0
- package/src/pages/flowable/design/provider/index.js +6 -0
- package/src/pages/flowable/design/provider/properties/ConditionDesign.jsx +175 -0
- package/src/pages/flowable/design/provider/properties/ConditionProps.jsx +76 -0
- package/src/pages/flowable/design/provider/properties/DelegateExpressionProps.js +54 -0
- package/src/pages/flowable/design/provider/properties/FormProps.js +55 -0
- package/src/pages/flowable/design/provider/properties/MultiInstanceProps.js +100 -0
- package/src/pages/flowable/design/provider/properties/UserTaskForm.jsx +48 -0
- package/src/pages/flowable/design/provider/properties/utils.jsx +35 -0
- package/src/pages/flowable/index.jsx +87 -0
- package/src/pages/flowable/monitor/definition.jsx +87 -0
- package/src/pages/flowable/monitor/instance/index.jsx +177 -0
- package/src/pages/flowable/monitor/instance/view.jsx +102 -0
- package/src/pages/flowable/monitor/task.jsx +98 -0
- package/src/pages/flowable/task/form.jsx +186 -0
- package/src/pages/flowable/task/index.jsx +184 -0
- package/src/pages/flowable/task/instance/view.jsx +85 -0
- package/src/pages/flowable/test/index.jsx +57 -0
- package/src/pages/index.jsx +25 -0
- package/src/pages/login.jsx +21 -0
- package/src/pages/system/api/ApiDoc.jsx +144 -0
- package/src/pages/system/api/index.jsx +268 -0
- package/src/pages/system/api/perm.jsx +69 -0
- package/src/pages/system/config/index.jsx +136 -0
- package/src/pages/system/dict/Dict.jsx +72 -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 +160 -0
- package/src/pages/system/job/index.jsx +324 -0
- package/src/pages/system/log/index.jsx +78 -0
- package/src/pages/system/org/index.jsx +262 -0
- package/src/pages/system/role/index.jsx +308 -0
- package/src/pages/system/role/perm.jsx +108 -0
- package/src/pages/system/sysManual/index.jsx +127 -0
- package/src/pages/system/user/UserPerm.jsx +97 -0
- package/src/pages/system/user/index.jsx +258 -0
- package/src/pages/test.jsx +200 -0
- package/src/pages/ureport/index.jsx +22 -0
- package/src/pages/userCenter/ChangePassword.jsx +63 -0
- package/src/pages/userCenter/index.jsx +90 -0
- package/src/pages/userCenter/manual.jsx +59 -0
- package/src/pages/userCenter/message.jsx +105 -0
- package/src/style/global.less +51 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {Spin, TreeSelect} from 'antd';
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import {HttpUtils, StringUtils} from "../utils";
|
|
5
|
+
|
|
6
|
+
export class FieldRemoteTreeSelect extends React.Component {
|
|
7
|
+
|
|
8
|
+
static defaultProps = {
|
|
9
|
+
treeDefaultExpandAll: true,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
state = {
|
|
13
|
+
data: [],
|
|
14
|
+
value: [],
|
|
15
|
+
loading: false,
|
|
16
|
+
key: this.props.id,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
componentDidMount() {
|
|
20
|
+
this.loadData();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
loadData = async () => {
|
|
25
|
+
const {url} = this.props;
|
|
26
|
+
this.setState({loading: true});
|
|
27
|
+
try {
|
|
28
|
+
const rs = await HttpUtils.get(url)
|
|
29
|
+
this.setState({data: rs});
|
|
30
|
+
} finally {
|
|
31
|
+
this.setState({loading: false});
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
render() {
|
|
38
|
+
let {value,onChange} = this.props;
|
|
39
|
+
let {data} = this.state;
|
|
40
|
+
|
|
41
|
+
if (this.state.loading) {
|
|
42
|
+
return <Spin/>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<TreeSelect
|
|
50
|
+
style={{width: '100%', minWidth: 200}}
|
|
51
|
+
allowClear={true}
|
|
52
|
+
dropdownStyle={{maxHeight: 400, overflow: 'auto'}}
|
|
53
|
+
treeData={data}
|
|
54
|
+
showCheckedStrategy={TreeSelect.SHOW_ALL}
|
|
55
|
+
value={value || undefined}
|
|
56
|
+
onChange={onChange}
|
|
57
|
+
|
|
58
|
+
filterTreeNode={(inputValue, treeNode) => {
|
|
59
|
+
const {title} = treeNode
|
|
60
|
+
return StringUtils.contains(title, inputValue)
|
|
61
|
+
}}
|
|
62
|
+
treeLine={{showLeafIcon: true}}
|
|
63
|
+
treeDefaultExpandAll={this.props.treeDefaultExpandAll}
|
|
64
|
+
/>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
export interface FieldRemoteTreeSelectMultipleProps {
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 请求地址
|
|
7
|
+
*/
|
|
8
|
+
url: string ;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 默认展开所有
|
|
12
|
+
*/
|
|
13
|
+
treeDefaultExpandAll?: boolean ;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export class FieldRemoteTreeSelectMultiple extends React.Component<FieldRemoteTreeSelectMultipleProps, any> {}
|
|
17
|
+
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import {Spin, TreeSelect} from 'antd';
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import {HttpUtils, StringUtils} from "../utils";
|
|
5
|
+
|
|
6
|
+
export class FieldRemoteTreeSelectMultiple extends React.Component {
|
|
7
|
+
|
|
8
|
+
static defaultProps = {
|
|
9
|
+
treeDefaultExpandAll: true,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
state = {
|
|
13
|
+
data: [],
|
|
14
|
+
value: [],
|
|
15
|
+
loading: false,
|
|
16
|
+
key: this.props.id,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
componentDidMount() {
|
|
20
|
+
this.loadData();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
loadData = async () => {
|
|
25
|
+
const {url} = this.props;
|
|
26
|
+
this.setState({loading: true});
|
|
27
|
+
try {
|
|
28
|
+
const rs = await HttpUtils.get(url)
|
|
29
|
+
this.setState({data: rs});
|
|
30
|
+
} finally {
|
|
31
|
+
this.setState({loading: false});
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
render() {
|
|
38
|
+
let {value,onChange} = this.props;
|
|
39
|
+
let {data} = this.state;
|
|
40
|
+
|
|
41
|
+
if (this.state.loading) {
|
|
42
|
+
return <Spin/>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<TreeSelect
|
|
50
|
+
style={{width: '100%', minWidth: 200}}
|
|
51
|
+
allowClear={true}
|
|
52
|
+
dropdownStyle={{maxHeight: 400, overflow: 'auto'}}
|
|
53
|
+
treeData={data}
|
|
54
|
+
showCheckedStrategy={TreeSelect.SHOW_ALL}
|
|
55
|
+
value={value || undefined}
|
|
56
|
+
onChange={onChange}
|
|
57
|
+
multiple={true}
|
|
58
|
+
|
|
59
|
+
filterTreeNode={(inputValue, treeNode) => {
|
|
60
|
+
const {title} = treeNode
|
|
61
|
+
return StringUtils.contains(title, inputValue)
|
|
62
|
+
}}
|
|
63
|
+
treeLine={{showLeafIcon: true}}
|
|
64
|
+
treeDefaultExpandAll={this.props.treeDefaultExpandAll}
|
|
65
|
+
/>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 组织机构树
|
|
3
|
+
*/
|
|
4
|
+
import React from "react";
|
|
5
|
+
import {FieldRemoteTree} from "./FieldRemoteTree";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export class FieldSysOrgTree extends React.Component {
|
|
9
|
+
static defaultProps = {
|
|
10
|
+
type: 'dept',
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
render() {
|
|
15
|
+
let {type,...rest} = this.props;
|
|
16
|
+
const url = type === 'dept'?
|
|
17
|
+
'/admin/sysOrg/deptTree':
|
|
18
|
+
'/admin/sysOrg/unitTree'
|
|
19
|
+
return <FieldRemoteTree url={url} {...rest} />
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SelectProps } from 'antd/es/select';
|
|
3
|
+
|
|
4
|
+
export interface FieldSysOrgTreeSelectProps {
|
|
5
|
+
|
|
6
|
+
type?: 'dept' | 'unit'
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export class FieldSysOrgTreeSelect extends React.Component<FieldSysOrgTreeSelectProps, any> {}
|
|
12
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 组织机构树
|
|
3
|
+
*/
|
|
4
|
+
import React from "react";
|
|
5
|
+
import {FieldRemoteTreeSelect} from "./FieldRemoteTreeSelect";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export class FieldSysOrgTreeSelect extends React.Component {
|
|
9
|
+
|
|
10
|
+
static defaultProps = {
|
|
11
|
+
type: 'dept',
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
render() {
|
|
15
|
+
let {type,...rest} = this.props;
|
|
16
|
+
const url = type === 'dept'?
|
|
17
|
+
'/admin/sysOrg/deptTree':
|
|
18
|
+
'/admin/sysOrg/unitTree'
|
|
19
|
+
|
|
20
|
+
return <FieldRemoteTreeSelect url={url} {...rest}/>
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {ColumnsType} from "antd/es/table";
|
|
3
|
+
|
|
4
|
+
declare type FieldTableProps = {
|
|
5
|
+
columns: ColumnsType,
|
|
6
|
+
value?: any[]
|
|
7
|
+
onChange?: (list:any[])=>{},
|
|
8
|
+
style?: React.CSSProperties
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/***
|
|
12
|
+
* 可编辑表格
|
|
13
|
+
*/
|
|
14
|
+
export class FieldTable extends React.Component<FieldTableProps, any> {
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import {Button, Input, Table} from 'antd'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import {DeleteOutlined, PlusOutlined} from "@ant-design/icons";
|
|
4
|
+
import './FieldTable.less'
|
|
5
|
+
import {ArrUtils} from "../utils";
|
|
6
|
+
|
|
7
|
+
export class FieldTable extends React.Component {
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
columns = []
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
constructor(props) {
|
|
14
|
+
super(props);
|
|
15
|
+
|
|
16
|
+
this.columns = this.props.columns.map(col => {
|
|
17
|
+
if (col.render == null) {
|
|
18
|
+
col.render = (v, record, index) => {
|
|
19
|
+
return <Input value={v} onChange={(e) => this.onCellChange(index, col.dataIndex, e)}/>
|
|
20
|
+
}
|
|
21
|
+
} else {
|
|
22
|
+
if (!col._oldRender) {
|
|
23
|
+
col._oldRender = col.render
|
|
24
|
+
col.render = (v, record, index) => {
|
|
25
|
+
const cmp = col._oldRender(v, record, index)
|
|
26
|
+
return React.createElement(cmp.type,
|
|
27
|
+
{
|
|
28
|
+
...cmp.props,
|
|
29
|
+
value: v,
|
|
30
|
+
onChange: (e) => {
|
|
31
|
+
this.onCellChange(index, col.dataIndex, e);
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return col
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
this.columns.push({
|
|
41
|
+
title: '操作',
|
|
42
|
+
render: (v, record) => {
|
|
43
|
+
return <Button icon={<DeleteOutlined/>} title='删除' size='small' shape={'circle'}
|
|
44
|
+
onClick={() => this.remove(record)}></Button>
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
if (this.props.value != null) {
|
|
49
|
+
this.state.dataSource = this.props.value
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
state = {
|
|
55
|
+
dataSource: []
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
onCellChange = (index, dataIndex, e) => {
|
|
60
|
+
let {dataSource} = this.state
|
|
61
|
+
let row = dataSource[index]
|
|
62
|
+
|
|
63
|
+
let v = e;
|
|
64
|
+
if (e != null && e.hasOwnProperty('target')) {
|
|
65
|
+
v = e.target.value;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
row[dataIndex] = v
|
|
70
|
+
|
|
71
|
+
dataSource = [...dataSource]
|
|
72
|
+
this.setState({dataSource}, this.notifyParent)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
add = () => {
|
|
76
|
+
let {dataSource} = this.state
|
|
77
|
+
dataSource = [...dataSource, {}];
|
|
78
|
+
this.setState({dataSource}, this.notifyParent)
|
|
79
|
+
};
|
|
80
|
+
remove = (record) => {
|
|
81
|
+
let {dataSource} = this.state
|
|
82
|
+
ArrUtils.remove(dataSource, record)
|
|
83
|
+
this.setState({dataSource: [...dataSource]}, this.notifyParent)
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
notifyParent() {
|
|
87
|
+
let {dataSource} = this.state
|
|
88
|
+
this.props.onChange(dataSource)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
render() {
|
|
92
|
+
return <div className='edit-table' style={this.props.style}>
|
|
93
|
+
<Table columns={this.columns}
|
|
94
|
+
dataSource={this.state.dataSource}
|
|
95
|
+
size='small'
|
|
96
|
+
footer={() => <Button type='dashed'
|
|
97
|
+
icon={<PlusOutlined/>}
|
|
98
|
+
onClick={this.add}>增加一行
|
|
99
|
+
</Button>}
|
|
100
|
+
pagination={false}
|
|
101
|
+
>
|
|
102
|
+
|
|
103
|
+
</Table>
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
</div>
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
.edit-table {
|
|
2
|
+
table{
|
|
3
|
+
width: 100%;
|
|
4
|
+
border-spacing: 0;
|
|
5
|
+
|
|
6
|
+
th {
|
|
7
|
+
background-color: rgb(250, 250, 250);
|
|
8
|
+
padding: 16px;
|
|
9
|
+
color: rgba(0, 0, 0, 0.88);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
th:last-child, td:last-child {
|
|
15
|
+
text-align: center;
|
|
16
|
+
width: 50px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
td {
|
|
20
|
+
padding: 2px;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
.add-btn-wrapper{
|
|
26
|
+
margin: 8px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
declare type FieldTableSelectProps = {
|
|
5
|
+
url:string;
|
|
6
|
+
placeholder?:string;
|
|
7
|
+
columns: {
|
|
8
|
+
title: string;
|
|
9
|
+
dataIndex: string;
|
|
10
|
+
}[];
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* 下拉表格
|
|
15
|
+
*
|
|
16
|
+
* 后端参考接口:
|
|
17
|
+
*/
|
|
18
|
+
export class FieldTableSelect extends React.Component<FieldTableSelectProps, any> {
|
|
19
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {Button, Select} from "antd";
|
|
3
|
+
import {ProTable} from "../components";
|
|
4
|
+
import {HttpUtils} from "../utils";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 下拉表格
|
|
8
|
+
*/
|
|
9
|
+
export class FieldTableSelect extends React.Component {
|
|
10
|
+
|
|
11
|
+
static defaultProps = {
|
|
12
|
+
placeholder: '请搜索选择',
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
state = {
|
|
16
|
+
open: false,
|
|
17
|
+
label: '',
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
render() {
|
|
21
|
+
return <Select popupRender={this.popupRender}
|
|
22
|
+
open={this.state.open}
|
|
23
|
+
onOpenChange={v => this.setState({open: v})}
|
|
24
|
+
style={{minWidth: 300}}
|
|
25
|
+
value={this.props.value}
|
|
26
|
+
labelRender={() => this.state.label}
|
|
27
|
+
popupMatchSelectWidth={900}
|
|
28
|
+
placeholder={this.props.placeholder}
|
|
29
|
+
/>
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
popupRender = () => {
|
|
34
|
+
return <ProTable
|
|
35
|
+
columns={[...this.props.columns, {
|
|
36
|
+
title: '操作',
|
|
37
|
+
dataIndex: 'action',
|
|
38
|
+
width: 100,
|
|
39
|
+
render: (text, record) => {
|
|
40
|
+
return <Button
|
|
41
|
+
size='small'
|
|
42
|
+
type='primary'
|
|
43
|
+
onClick={() => {
|
|
44
|
+
this.setState({
|
|
45
|
+
label: record.name,
|
|
46
|
+
open: false
|
|
47
|
+
})
|
|
48
|
+
this.props.onChange(record.id)
|
|
49
|
+
}}>选择</Button>
|
|
50
|
+
}
|
|
51
|
+
}]}
|
|
52
|
+
showToolbarSearch
|
|
53
|
+
request={(params) => {
|
|
54
|
+
params.selected = this.props.value
|
|
55
|
+
return HttpUtils.get(this.props.url, params);
|
|
56
|
+
}}>
|
|
57
|
+
</ProTable>
|
|
58
|
+
};
|
|
59
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import React from "react";
|
|
3
|
+
import {CropperProps} from "react-easy-crop/Cropper";
|
|
4
|
+
import {UploadListType} from "antd/es/upload/interface";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
declare type FieldUploadFileProps = {
|
|
8
|
+
value?: string; // 文件的值,sysFile的id, 逗号分割
|
|
9
|
+
onChange?: (v: string) => {};
|
|
10
|
+
onFileChange?: (fileList: any[]) => {}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 是否裁切图片
|
|
14
|
+
*/
|
|
15
|
+
cropImage?: boolean;
|
|
16
|
+
cropperProps?: CropperProps;
|
|
17
|
+
|
|
18
|
+
maxCount?: number;
|
|
19
|
+
|
|
20
|
+
accept?: "image/*" | ".pdf" | ".docx" | '.xlsx' | string;
|
|
21
|
+
|
|
22
|
+
children?: React.ReactNode;
|
|
23
|
+
|
|
24
|
+
listType?: UploadListType
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 上传图片前裁切, 单张图片
|
|
29
|
+
*
|
|
30
|
+
* 可参考 react-easy-crop
|
|
31
|
+
*/
|
|
32
|
+
export class FieldUploadFile extends React.Component<FieldUploadFileProps, any> {
|
|
33
|
+
|
|
34
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import ImgCrop from "antd-img-crop";
|
|
3
|
+
import {Modal, Upload} from "antd";
|
|
4
|
+
import UploadOutlined from "@ant-design/icons/lib/icons/UploadOutlined";
|
|
5
|
+
import {ViewFile} from "../components";
|
|
6
|
+
import {ObjectUtils} from "../utils";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export class FieldUploadFile extends React.Component {
|
|
10
|
+
|
|
11
|
+
state = {
|
|
12
|
+
// 传入的参数
|
|
13
|
+
maxCount: 1,
|
|
14
|
+
cropImage: false,
|
|
15
|
+
|
|
16
|
+
// 内部参数
|
|
17
|
+
fileList: [],
|
|
18
|
+
value: null // 都好分隔的文件id
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
constructor(props) {
|
|
22
|
+
super(props);
|
|
23
|
+
ObjectUtils.copyPropertyIfPresent(props, this.state)
|
|
24
|
+
this.state.fileList = this.convertInputToComponentValue(this.state.value);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
convertInputToComponentValue(value) {
|
|
28
|
+
let list = [];
|
|
29
|
+
if (value && value.length > 0) {
|
|
30
|
+
const arr = value.split(",")
|
|
31
|
+
for (const id of arr) {
|
|
32
|
+
const url = 'admin/sysFile/preview/' + id
|
|
33
|
+
let file = {id, url, uid: id, name: id, status: 'done', fileName: id};
|
|
34
|
+
list.push(file);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return list
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
convertComponentValueToOutput(fileList) {
|
|
42
|
+
let fileIds = [];
|
|
43
|
+
for (const f of fileList) {
|
|
44
|
+
if (f.status === 'done') {
|
|
45
|
+
if(f.response) { // 新上传的
|
|
46
|
+
const ajaxResult = f.response
|
|
47
|
+
if (ajaxResult.success) {
|
|
48
|
+
const {id, name} = ajaxResult.data
|
|
49
|
+
f.id = id;
|
|
50
|
+
fileIds.push(id);
|
|
51
|
+
} else {
|
|
52
|
+
Modal.error({title: '上传文件失败', content: ajaxResult.message})
|
|
53
|
+
}
|
|
54
|
+
}else { // 老的
|
|
55
|
+
fileIds.push(f.id)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return fileIds;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
handleChange = ({fileList, event, file}) => {
|
|
66
|
+
console.log('检测到文件变化', fileList)
|
|
67
|
+
const rs = file.response;
|
|
68
|
+
if (rs != null && rs.success === false) {
|
|
69
|
+
Modal.error({
|
|
70
|
+
title: '上传失败',
|
|
71
|
+
content: rs.message,
|
|
72
|
+
});
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
this.setState({fileList});
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
let newIds = this.convertComponentValueToOutput(fileList);
|
|
81
|
+
if (newIds.length > 0 && this.props.onFileChange) {
|
|
82
|
+
this.props.onFileChange(fileList)
|
|
83
|
+
}
|
|
84
|
+
if(this.props.onChange){
|
|
85
|
+
let value = newIds.join(',');
|
|
86
|
+
console.log('上传文件值', value )
|
|
87
|
+
this.props.onChange(value);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
handlePreview = (file) => {
|
|
94
|
+
Modal.info({
|
|
95
|
+
title: '文件预览',
|
|
96
|
+
width: '80vw',
|
|
97
|
+
content: <ViewFile value={file.id} height='70vh'/>
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
render() {
|
|
103
|
+
if (this.state.cropImage) {
|
|
104
|
+
return <ImgCrop cropperProps={this.props.cropperProps} modalTitle={'裁剪图片'} fillColor={null}>
|
|
105
|
+
{this.getUpload()}
|
|
106
|
+
</ImgCrop>
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return this.getUpload();
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
getUpload = () => {
|
|
113
|
+
const {accept, fileList, maxCount} = this.state;
|
|
114
|
+
|
|
115
|
+
return <Upload
|
|
116
|
+
action={'admin/sysFile/upload'}
|
|
117
|
+
listType={this.props.listType || 'picture-card'}
|
|
118
|
+
fileList={fileList}
|
|
119
|
+
onChange={this.handleChange}
|
|
120
|
+
multiple={false}
|
|
121
|
+
accept={accept}
|
|
122
|
+
maxCount={maxCount}
|
|
123
|
+
onPreview={this.handlePreview}
|
|
124
|
+
>
|
|
125
|
+
{this.renderButton()}
|
|
126
|
+
|
|
127
|
+
</Upload>;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
renderButton = () => {
|
|
131
|
+
const {fileList, maxCount} = this.state;
|
|
132
|
+
if (fileList.length >= maxCount) {
|
|
133
|
+
return
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return <>
|
|
137
|
+
<UploadOutlined/>
|
|
138
|
+
<div className="ant-upload-text">选择文件</div>
|
|
139
|
+
</>;
|
|
140
|
+
};
|
|
141
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// 表单组件,主要属性: value onChange
|
|
2
|
+
export * from './FieldRemoteSelect';
|
|
3
|
+
export * from './FieldRemoteSelectMultiple';
|
|
4
|
+
export * from './FieldRemoteSelectMultipleInline';
|
|
5
|
+
export * from './FieldRemoteTree';
|
|
6
|
+
export * from './FieldDictSelect';
|
|
7
|
+
export * from './FieldEditor'
|
|
8
|
+
export * from './FieldRemoteTreeCascader'
|
|
9
|
+
export * from './FieldRemoteTreeSelect'
|
|
10
|
+
export * from './FieldRemoteTreeSelectMultiple'
|
|
11
|
+
export * from './FieldBoolean';
|
|
12
|
+
export * from './FieldDate';
|
|
13
|
+
export * from './FieldDateRange';
|
|
14
|
+
export * from './FieldNumberRange';
|
|
15
|
+
export * from './FieldTable'
|
|
16
|
+
export * from './FieldTableSelect'
|
|
17
|
+
export * from './FieldSysOrgTreeSelect'
|
|
18
|
+
export * from './FieldSysOrgTree'
|
|
19
|
+
export * from './FieldPercent'
|
|
20
|
+
export * from './FieldUploadFile';
|
|
21
|
+
export * from './system';
|