@jiangood/open-admin 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/config/common-plugin.js +94 -0
  2. package/config/config.js +58 -0
  3. package/config/utils.js +73 -0
  4. package/package.json +8 -11
  5. package/src/.umi-production/appData.json +2365 -0
  6. package/src/.umi-production/core/EmptyRoute.tsx +9 -0
  7. package/src/.umi-production/core/defineApp.ts +16 -0
  8. package/src/.umi-production/core/helmet.ts +10 -0
  9. package/src/.umi-production/core/helmetContext.ts +4 -0
  10. package/src/.umi-production/core/history.ts +72 -0
  11. package/src/.umi-production/core/historyIntelli.ts +132 -0
  12. package/src/.umi-production/core/plugin.ts +40 -0
  13. package/src/.umi-production/core/pluginConfig.ts +324 -0
  14. package/src/.umi-production/core/pluginConfigJoi.d.ts +7 -0
  15. package/src/.umi-production/core/polyfill.ts +220 -0
  16. package/src/.umi-production/core/route.tsx +54 -0
  17. package/src/.umi-production/core/routeProps.js +5 -0
  18. package/src/.umi-production/core/routeProps.ts +6 -0
  19. package/src/.umi-production/core/terminal.ts +37 -0
  20. package/src/.umi-production/exports.ts +17 -0
  21. package/src/.umi-production/testBrowser.tsx +90 -0
  22. package/src/.umi-production/tsconfig.json +44 -0
  23. package/src/.umi-production/typings.d.ts +136 -0
  24. package/src/.umi-production/umi.ts +83 -0
  25. package/src/framework/components/{DownloadFileButton.jsx → DownloadFileButton/index.jsx} +1 -1
  26. package/src/framework/components/{LinkButton.d.ts → LinkButton/index.d.ts} +1 -1
  27. package/src/framework/components/{LinkButton.jsx → LinkButton/index.jsx} +1 -1
  28. package/src/framework/components/NamedIcon/index.d.ts +5 -0
  29. package/src/framework/components/{NamedIcon.tsx → NamedIcon/index.jsx} +1 -5
  30. package/src/framework/components/OrgTree/index.d.ts +4 -0
  31. package/src/framework/{field-components/system/OrgTree.tsx → components/OrgTree/index.jsx} +1 -4
  32. package/src/framework/components/PageLoading/index.d.ts +1 -0
  33. package/src/framework/components/{PageLoading.tsx → PageLoading/index.jsx} +3 -5
  34. package/src/framework/components/RoleTree/index.d.ts +4 -0
  35. package/src/framework/{field-components/system/RoleTree.tsx → components/RoleTree/index.jsx} +1 -4
  36. package/src/framework/components/ValueType/index.jsx +1 -1
  37. package/src/framework/components/ValueType/registry.jsx +2 -3
  38. package/src/framework/components/{view/ViewRange → ViewRange}/index.d.ts +5 -7
  39. package/src/framework/components/index.ts +3 -7
  40. package/src/framework/components/system/index.tsx +1 -1
  41. package/src/framework/fields/FieldBoolean/index.d.ts +9 -0
  42. package/src/framework/{field-components/FieldBoolean.jsx → fields/FieldBoolean/index.jsx} +6 -9
  43. package/src/framework/{field-components/FieldDate.d.ts → fields/FieldDate/index.d.ts} +5 -9
  44. package/src/framework/{field-components/FieldDate.jsx → fields/FieldDate/index.jsx} +28 -26
  45. package/src/framework/fields/FieldDateRange/index.d.ts +22 -0
  46. package/src/framework/{field-components/FieldDateRange.jsx → fields/FieldDateRange/index.jsx} +26 -27
  47. package/src/framework/fields/FieldDictSelect/index.d.ts +12 -0
  48. package/src/framework/{field-components/FieldDictSelect.jsx → fields/FieldDictSelect/index.jsx} +5 -5
  49. package/src/framework/fields/FieldEditor/index.d.ts +14 -0
  50. package/src/framework/fields/FieldEditor/index.jsx +59 -0
  51. package/src/framework/fields/FieldNumberRange/index.d.ts +10 -0
  52. package/src/framework/{field-components/FieldNumberRange.jsx → fields/FieldNumberRange/index.jsx} +20 -24
  53. package/src/framework/fields/FieldPercent/index.d.ts +8 -0
  54. package/src/framework/{field-components/FieldPercent.jsx → fields/FieldPercent/index.jsx} +9 -6
  55. package/src/framework/fields/FieldRemoteSelect/index.d.ts +44 -0
  56. package/src/framework/fields/FieldRemoteSelect/index.jsx +125 -0
  57. package/src/framework/fields/FieldRemoteSelectMultiple/index.d.ts +20 -0
  58. package/src/framework/{field-components/FieldRemoteSelectMultiple.jsx → fields/FieldRemoteSelectMultiple/index.jsx} +4 -5
  59. package/src/framework/fields/FieldRemoteSelectMultipleInline/index.d.ts +21 -0
  60. package/src/framework/{field-components/FieldRemoteSelectMultipleInline.jsx → fields/FieldRemoteSelectMultipleInline/index.jsx} +8 -6
  61. package/src/framework/fields/FieldRemoteTree/index.d.ts +20 -0
  62. package/src/framework/fields/FieldRemoteTree/index.jsx +50 -0
  63. package/src/framework/{field-components/FieldRemoteTreeCascader.d.ts → fields/FieldRemoteTreeCascader/index.d.ts} +10 -15
  64. package/src/framework/{field-components/FieldRemoteTreeCascader.jsx → fields/FieldRemoteTreeCascader/index.jsx} +11 -13
  65. package/src/framework/fields/FieldRemoteTreeSelect/index.d.ts +19 -0
  66. package/src/framework/{field-components/FieldRemoteTreeSelect.jsx → fields/FieldRemoteTreeSelect/index.jsx} +10 -20
  67. package/src/framework/fields/FieldRemoteTreeSelectMultiple/index.d.ts +20 -0
  68. package/src/framework/{field-components/FieldRemoteTreeSelectMultiple.jsx → fields/FieldRemoteTreeSelectMultiple/index.jsx} +11 -21
  69. package/src/framework/fields/FieldSysOrgTree/index.d.ts +9 -0
  70. package/src/framework/fields/FieldSysOrgTree/index.jsx +20 -0
  71. package/src/framework/fields/FieldSysOrgTreeSelect/index.d.ts +9 -0
  72. package/src/framework/{field-components/FieldSysOrgTreeSelect.jsx → fields/FieldSysOrgTreeSelect/index.jsx} +7 -8
  73. package/src/framework/fields/FieldTable/index.d.ts +14 -0
  74. package/src/framework/{field-components/FieldTable.jsx → fields/FieldTable/index.jsx} +38 -38
  75. package/src/framework/fields/FieldTableSelect/index.d.ts +19 -0
  76. package/src/framework/{field-components/FieldTableSelect.jsx → fields/FieldTableSelect/index.jsx} +13 -12
  77. package/src/framework/{field-components/FieldUploadFile.d.ts → fields/FieldUploadFile/index.d.ts} +12 -15
  78. package/src/framework/{field-components/FieldUploadFile.jsx → fields/FieldUploadFile/index.jsx} +32 -34
  79. package/src/framework/{field-components → fields}/index.ts +2 -1
  80. package/src/framework/fields/types.ts +16 -0
  81. package/src/framework/index.ts +2 -2
  82. package/src/framework/utils/index.ts +0 -1
  83. package/src/framework/utils/system/DictUtils.ts +1 -1
  84. package/src/framework/views/ViewApproveStatus/index.d.ts +3 -0
  85. package/src/framework/{view-components/ViewApproveStatus.tsx → views/ViewApproveStatus/index.jsx} +3 -8
  86. package/src/framework/views/ViewBoolean/index.d.ts +3 -0
  87. package/src/framework/views/ViewBoolean/index.jsx +4 -0
  88. package/src/framework/views/ViewBooleanEnableDisable/index.d.ts +5 -0
  89. package/src/framework/{components/view/ViewBooleanEnableDisable.tsx → views/ViewBooleanEnableDisable/index.jsx} +2 -7
  90. package/src/framework/{components/view/ViewFileButton.d.ts → views/ViewFile/index.d.ts} +3 -3
  91. package/src/framework/views/ViewFileButton/index.d.ts +10 -0
  92. package/src/framework/views/ViewFileButton/index.jsx +22 -0
  93. package/src/framework/views/ViewImage/index.d.ts +6 -0
  94. package/src/framework/views/ViewPassword/index.d.ts +5 -0
  95. package/src/framework/{view-components/ViewPassword.tsx → views/ViewPassword/index.jsx} +2 -3
  96. package/src/framework/views/ViewProcessInstanceProgress/index.d.ts +12 -0
  97. package/src/framework/{view-components/ViewFlowableInstanceProgress.jsx → views/ViewProcessInstanceProgress/index.jsx} +2 -2
  98. package/src/framework/views/ViewProcessInstanceProgressButton/index.d.ts +6 -0
  99. package/src/framework/{view-components/ViewFlowableInstanceProgressButton.tsx → views/ViewProcessInstanceProgressButton/index.jsx} +4 -6
  100. package/src/framework/views/ViewText/index.d.ts +16 -0
  101. package/src/framework/views/ViewText/index.jsx +42 -0
  102. package/src/framework/views/index.ts +12 -0
  103. package/src/framework/views/types.ts +26 -0
  104. package/src/layouts/admin/index.jsx +0 -2
  105. package/src/layouts/index.jsx +38 -16
  106. package/src/pages/404.jsx +4 -4
  107. package/src/pages/about.jsx +0 -2
  108. package/src/pages/index.jsx +4 -19
  109. package/src/pages/login.jsx +3 -8
  110. package/src/pages/system/api/ApiDoc.jsx +19 -15
  111. package/src/pages/system/api/index.jsx +23 -24
  112. package/src/pages/system/api/perm.jsx +4 -4
  113. package/src/pages/system/dict/Dict.jsx +0 -5
  114. package/src/pages/system/dict/DictItem.jsx +23 -25
  115. package/src/pages/system/dict/index.jsx +2 -2
  116. package/src/pages/system/file/index.jsx +16 -29
  117. package/src/pages/system/job/index.jsx +44 -44
  118. package/src/pages/system/log/index.jsx +3 -4
  119. package/src/pages/system/org/index.jsx +34 -36
  120. package/src/pages/system/role/index.jsx +68 -74
  121. package/src/pages/system/role/perm.jsx +0 -1
  122. package/src/pages/system/sysManual/index.jsx +27 -28
  123. package/src/pages/system/user/UserPerm.jsx +5 -8
  124. package/src/pages/system/user/index.jsx +46 -51
  125. package/src/pages/test/views.jsx +95 -0
  126. package/src/pages/ureport/index.jsx +2 -2
  127. package/src/pages/userCenter/ChangePassword.jsx +2 -1
  128. package/src/pages/userCenter/index.jsx +8 -8
  129. package/src/pages/userCenter/manual.jsx +3 -5
  130. package/src/pages/userCenter/message.jsx +14 -16
  131. package/config/dist/common-plugin.js +0 -149
  132. package/config/dist/config.js +0 -45
  133. package/config/dist/index.js +0 -18
  134. package/src/app.js +0 -1
  135. package/src/asserts/welcome.png +0 -0
  136. package/src/forms/demoForm.jsx +0 -16
  137. package/src/framework/components/Ellipsis.jsx +0 -39
  138. package/src/framework/components/Ellipsis.less +0 -8
  139. package/src/framework/components/view/ViewEllipsis.d.ts +0 -11
  140. package/src/framework/components/view/ViewEllipsis.jsx +0 -30
  141. package/src/framework/components/view/ViewFile.d.ts +0 -10
  142. package/src/framework/components/view/ViewFileButton.jsx +0 -0
  143. package/src/framework/components/view/ViewImage.d.ts +0 -9
  144. package/src/framework/components/view/ViewText.tsx +0 -16
  145. package/src/framework/components/view/index.ts +0 -10
  146. package/src/framework/field-components/FieldBoolean.d.ts +0 -13
  147. package/src/framework/field-components/FieldDateRange.d.ts +0 -6
  148. package/src/framework/field-components/FieldDictSelect.d.ts +0 -13
  149. package/src/framework/field-components/FieldEditor.d.ts +0 -10
  150. package/src/framework/field-components/FieldEditor.jsx +0 -58
  151. package/src/framework/field-components/FieldNumberRange.d.ts +0 -13
  152. package/src/framework/field-components/FieldPercent.d.ts +0 -12
  153. package/src/framework/field-components/FieldRemoteSelect.d.ts +0 -13
  154. package/src/framework/field-components/FieldRemoteSelect.jsx +0 -87
  155. package/src/framework/field-components/FieldRemoteSelectMultiple.d.ts +0 -13
  156. package/src/framework/field-components/FieldRemoteSelectMultipleInline.d.ts +0 -20
  157. package/src/framework/field-components/FieldRemoteTree.d.ts +0 -21
  158. package/src/framework/field-components/FieldRemoteTree.jsx +0 -45
  159. package/src/framework/field-components/FieldRemoteTreeSelect.d.ts +0 -17
  160. package/src/framework/field-components/FieldRemoteTreeSelectMultiple.d.ts +0 -17
  161. package/src/framework/field-components/FieldSysOrgTree.d.ts +0 -12
  162. package/src/framework/field-components/FieldSysOrgTree.jsx +0 -23
  163. package/src/framework/field-components/FieldSysOrgTreeSelect.d.ts +0 -12
  164. package/src/framework/field-components/FieldTable.d.ts +0 -17
  165. package/src/framework/field-components/FieldTableSelect.d.ts +0 -19
  166. package/src/framework/field-components/system/index.ts +0 -2
  167. package/src/framework/view-components/ViewBoolean.tsx +0 -6
  168. package/src/framework/view-components/ViewFlowableInstanceProgress.d.ts +0 -12
  169. package/src/framework/view-components/ViewProps.ts +0 -11
  170. package/src/framework/view-components/index.ts +0 -6
  171. package/src/pages/test.jsx +0 -200
  172. /package/src/framework/components/{DownloadFileButton.d.ts → DownloadFileButton/index.d.ts} +0 -0
  173. /package/src/framework/components/{view/ViewRange → ViewRange}/index.jsx +0 -0
  174. /package/src/framework/{field-components/FieldTable.less → fields/FieldTable/styles.less} +0 -0
  175. /package/src/framework/{components/view/ViewFile.jsx → views/ViewFile/index.jsx} +0 -0
  176. /package/src/framework/{components/view/ViewImage.jsx → views/ViewImage/index.jsx} +0 -0
@@ -1,13 +1,15 @@
1
- // @ts-ignore
2
1
  import React from "react";
3
2
  import {CropperProps} from "react-easy-crop/Cropper";
4
3
  import {UploadListType} from "antd/es/upload/interface";
4
+ import { FieldProps } from '../types';
5
5
 
6
-
7
- declare type FieldUploadFileProps = {
8
- value?: string; // 文件的值,sysFile的id, 逗号分割
9
- onChange?: (v: string) => {};
10
- onFileChange?: (fileList: any[]) => {}
6
+ /**
7
+ * 上传图片前裁切, 单张图片
8
+ *
9
+ * 可参考 react-easy-crop
10
+ */
11
+ interface FieldUploadFileProps extends FieldProps<string> {
12
+ onFileChange?: (fileList: any[]) => void;
11
13
 
12
14
  /**
13
15
  * 是否裁切图片
@@ -21,14 +23,9 @@ declare type FieldUploadFileProps = {
21
23
 
22
24
  children?: React.ReactNode;
23
25
 
24
- listType?: UploadListType
25
- };
26
+ listType?: UploadListType;
27
+ }
26
28
 
27
- /**
28
- * 上传图片前裁切, 单张图片
29
- *
30
- * 可参考 react-easy-crop
31
- */
32
- export class FieldUploadFile extends React.Component<FieldUploadFileProps, any> {
29
+ export class FieldUploadFile extends React.Component<FieldUploadFileProps, string> {
33
30
 
34
- }
31
+ }
@@ -2,10 +2,14 @@ import React from "react";
2
2
  import ImgCrop from "antd-img-crop";
3
3
  import {Modal, Upload} from "antd";
4
4
  import UploadOutlined from "@ant-design/icons/lib/icons/UploadOutlined";
5
- import {ViewFile} from "../components";
6
- import {ObjectUtils} from "../utils";
7
-
8
-
5
+ import {ViewFile} from "../../views";
6
+ import {ObjectUtils} from "../../utils";
7
+
8
+ /**
9
+ * 上传图片前裁切, 单张图片
10
+ *
11
+ * 可参考 react-easy-crop
12
+ */
9
13
  export class FieldUploadFile extends React.Component {
10
14
 
11
15
  state = {
@@ -15,55 +19,52 @@ export class FieldUploadFile extends React.Component {
15
19
 
16
20
  // 内部参数
17
21
  fileList: [],
18
- value: null // 都好分隔的文件id
22
+ value: null, // 都好分隔的文件id
19
23
  };
20
24
 
21
25
  constructor(props) {
22
26
  super(props);
23
- ObjectUtils.copyPropertyIfPresent(props, this.state)
27
+ ObjectUtils.copyPropertyIfPresent(props, this.state);
24
28
  this.state.fileList = this.convertInputToComponentValue(this.state.value);
25
29
  }
26
30
 
27
31
  convertInputToComponentValue(value) {
28
- let list = [];
32
+ const list = [];
29
33
  if (value && value.length > 0) {
30
- const arr = value.split(",")
34
+ const arr = value.split(",");
31
35
  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};
36
+ const url = 'admin/sysFile/preview/' + id;
37
+ const file = {id, url, uid: id, name: id, status: 'done', fileName: id};
34
38
  list.push(file);
35
39
  }
36
40
  }
37
41
 
38
- return list
42
+ return list;
39
43
  }
40
44
 
41
45
  convertComponentValueToOutput(fileList) {
42
- let fileIds = [];
46
+ const fileIds = [];
43
47
  for (const f of fileList) {
44
48
  if (f.status === 'done') {
45
- if(f.response) { // 新上传的
46
- const ajaxResult = f.response
49
+ if (f.response) { // 新上传的
50
+ const ajaxResult = f.response;
47
51
  if (ajaxResult.success) {
48
- const {id, name} = ajaxResult.data
52
+ const {id, name} = ajaxResult.data;
49
53
  f.id = id;
50
54
  fileIds.push(id);
51
55
  } else {
52
- Modal.error({title: '上传文件失败', content: ajaxResult.message})
56
+ Modal.error({title: '上传文件失败', content: ajaxResult.message});
53
57
  }
54
- }else { // 老的
55
- fileIds.push(f.id)
58
+ } else { // 老的
59
+ fileIds.push(f.id);
56
60
  }
57
-
58
-
59
61
  }
60
62
  }
61
63
  return fileIds;
62
64
  }
63
65
 
64
-
65
66
  handleChange = ({fileList, event, file}) => {
66
- console.log('检测到文件变化', fileList)
67
+ console.log('检测到文件变化', fileList);
67
68
  const rs = file.response;
68
69
  if (rs != null && rs.success === false) {
69
70
  Modal.error({
@@ -73,29 +74,26 @@ export class FieldUploadFile extends React.Component {
73
74
  return;
74
75
  }
75
76
 
76
-
77
77
  this.setState({fileList});
78
78
 
79
-
80
- let newIds = this.convertComponentValueToOutput(fileList);
79
+ const newIds = this.convertComponentValueToOutput(fileList);
81
80
  if (newIds.length > 0 && this.props.onFileChange) {
82
- this.props.onFileChange(fileList)
81
+ this.props.onFileChange(fileList);
83
82
  }
84
- if(this.props.onChange){
85
- let value = newIds.join(',');
86
- console.log('上传文件值', value )
83
+ if (this.props.onChange) {
84
+ const value = newIds.join(',');
85
+ console.log('上传文件值', value);
87
86
  this.props.onChange(value);
88
87
  }
89
88
 
90
89
  };
91
90
 
92
-
93
91
  handlePreview = (file) => {
94
92
  Modal.info({
95
93
  title: '文件预览',
96
94
  width: '80vw',
97
95
  content: <ViewFile value={file.id} height='70vh'/>
98
- })
96
+ });
99
97
 
100
98
  };
101
99
 
@@ -103,7 +101,7 @@ export class FieldUploadFile extends React.Component {
103
101
  if (this.state.cropImage) {
104
102
  return <ImgCrop cropperProps={this.props.cropperProps} modalTitle={'裁剪图片'} fillColor={null}>
105
103
  {this.getUpload()}
106
- </ImgCrop>
104
+ </ImgCrop>;
107
105
  }
108
106
 
109
107
  return this.getUpload();
@@ -130,7 +128,7 @@ export class FieldUploadFile extends React.Component {
130
128
  renderButton = () => {
131
129
  const {fileList, maxCount} = this.state;
132
130
  if (fileList.length >= maxCount) {
133
- return
131
+ return null;
134
132
  }
135
133
 
136
134
  return <>
@@ -138,4 +136,4 @@ export class FieldUploadFile extends React.Component {
138
136
  <div className="ant-upload-text">选择文件</div>
139
137
  </>;
140
138
  };
141
- }
139
+ }
@@ -1,4 +1,5 @@
1
1
  // 表单组件,主要属性: value onChange
2
+ export * from './types';
2
3
  export * from './FieldRemoteSelect';
3
4
  export * from './FieldRemoteSelectMultiple';
4
5
  export * from './FieldRemoteSelectMultipleInline';
@@ -18,4 +19,4 @@ export * from './FieldSysOrgTreeSelect'
18
19
  export * from './FieldSysOrgTree'
19
20
  export * from './FieldPercent'
20
21
  export * from './FieldUploadFile';
21
- export * from './system';
22
+ export * from '../components/OrgTree';
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+
3
+ /**
4
+ * 通用字段组件属性接口
5
+ * @template T - value 的类型
6
+ */
7
+ export interface FieldProps<T> {
8
+ /**
9
+ * 字段值
10
+ */
11
+ value?: T;
12
+ /**
13
+ * 值变化回调函数
14
+ */
15
+ onChange?: (value: T) => void;
16
+ }
@@ -1,5 +1,5 @@
1
1
  export * from './components'
2
2
  export * from './utils'
3
- export * from './field-components'
4
- export * from './view-components'
3
+ export * from './fields'
4
+ export * from './views'
5
5
  export * from './pages'
@@ -6,7 +6,6 @@ export * from "./EventBusUtils";
6
6
  export * from "./ColorsUtils"
7
7
  export * from "./DomUtils"
8
8
  export * from "./UuidUtils";
9
- export * from "./StringUtils"
10
9
  export * from "./TreeUtils";
11
10
  export * from './StorageUtils'
12
11
  export * from './DeviceUtils'
@@ -33,7 +33,7 @@ export class DictUtils {
33
33
  */
34
34
  public static dictList(code: string): DictItem[] {
35
35
  const map = SysUtils.getDictInfo();
36
- if (map === undefined) {
36
+ if (!map) {
37
37
  return [];
38
38
  }
39
39
 
@@ -0,0 +1,3 @@
1
+ import { ViewProps } from "../types";
2
+
3
+ export function ViewApproveStatus(props: ViewProps<string>);
@@ -1,17 +1,12 @@
1
- import {DictUtils} from "../utils";
1
+ import {DictUtils} from "../../utils";
2
2
  import {Tag} from "antd";
3
- import {ViewStringProps} from "./ViewProps";
4
-
5
- interface ViewProps {
6
- value: String;
7
- }
8
3
 
9
4
  /**
10
5
  * 查看审批状态组件
11
6
  * @param props
12
7
  * @constructor
13
8
  */
14
- export function ViewApproveStatus(props:ViewStringProps) {
9
+ export function ViewApproveStatus(props) {
15
10
  let {value} = props;
16
11
  let txt= DictUtils.dictLabel('approveStatus', value)
17
12
 
@@ -23,4 +18,4 @@ export function ViewApproveStatus(props:ViewStringProps) {
23
18
  };
24
19
  let color = colorMap[value]
25
20
  return <Tag color={color}>{txt}</Tag> ;
26
- }
21
+ }
@@ -0,0 +1,3 @@
1
+ import { ViewProps } from "../types";
2
+
3
+ export function ViewBoolean(props: ViewProps<boolean>);
@@ -0,0 +1,4 @@
1
+ export function ViewBoolean(props) {
2
+ let {value} = props;
3
+ return value == null ? null : (value ? '是' : '否')
4
+ }
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { ViewProps } from '../types';
3
+
4
+ export class ViewBooleanEnableDisable extends React.Component<ViewProps<boolean | null | undefined>, any> {
5
+ }
@@ -1,12 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Tag } from 'antd';
3
3
 
4
- // 定义组件的 Props 接口
5
- interface ViewBooleanEnableDisableProps {
6
- value: boolean | null | undefined;
7
- }
8
-
9
- export class ViewBooleanEnableDisable extends React.Component<ViewBooleanEnableDisableProps, any> {
4
+ export class ViewBooleanEnableDisable extends React.Component {
10
5
 
11
6
  render() {
12
7
  const { value } = this.props;
@@ -17,4 +12,4 @@ export class ViewBooleanEnableDisable extends React.Component<ViewBooleanEnableD
17
12
 
18
13
  return value ? <Tag color={"green"}>启用</Tag> : <Tag color={"red"}>禁用</Tag>;
19
14
  }
20
- }
15
+ }
@@ -1,10 +1,10 @@
1
1
  // @ts-ignore
2
2
  import React from "react";
3
+ import { ViewProps } from "../types";
3
4
 
4
- declare type ViewFileProps = {
5
- value: string;
5
+ interface ViewFileProps extends ViewProps<string> {
6
6
  height: string;
7
- };
7
+ }
8
8
 
9
9
  export class ViewFile extends React.Component<ViewFileProps, any> {
10
10
  }
@@ -0,0 +1,10 @@
1
+ // @ts-ignore
2
+ import React from "react";
3
+ import { ViewProps } from "../types";
4
+
5
+ interface ViewFileButtonProps extends ViewProps<string> {
6
+ height: string;
7
+ }
8
+
9
+ export class ViewFileButton extends React.Component<ViewFileButtonProps, any> {
10
+ }
@@ -0,0 +1,22 @@
1
+ import React from "react";
2
+ import {Button} from "antd";
3
+ import { MessageUtils } from "../../utils";
4
+ import { ViewFile } from "../ViewFile";
5
+
6
+ /**
7
+ * 文件按钮查看组件
8
+ */
9
+ export class ViewFileButton extends React.Component {
10
+ render() {
11
+ const {value, height} = this.props;
12
+ if (!value) {
13
+ return null;
14
+ }
15
+
16
+ return <Button type="link" size="small" onClick={()=>{
17
+ MessageUtils.alert(<ViewFile value={this.props.value} />)
18
+ }}>
19
+ 查看文件
20
+ </Button>;
21
+ }
22
+ }
@@ -0,0 +1,6 @@
1
+ // @ts-ignore
2
+ import React from "react";
3
+ import { ViewProps } from "../types";
4
+
5
+ export class ViewImage extends React.Component<ViewProps<string|string[]>, any> {
6
+ }
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import { ViewProps } from "../types";
3
+
4
+ export class ViewPassword extends React.Component<ViewProps<string>, any> {
5
+ }
@@ -1,9 +1,8 @@
1
1
  import React from "react";
2
2
  import {Space} from "antd";
3
3
  import {EyeInvisibleOutlined, EyeOutlined} from "@ant-design/icons";
4
- import {ViewProps, ViewStringProps} from "./ViewProps";
5
4
 
6
- export class ViewPassword extends React.Component<ViewStringProps,any> {
5
+ export class ViewPassword extends React.Component {
7
6
 
8
7
  state = {
9
8
  visible: false
@@ -22,4 +21,4 @@ export class ViewPassword extends React.Component<ViewStringProps,any> {
22
21
  </a>
23
22
  </Space>
24
23
  }
25
- }
24
+ }
@@ -0,0 +1,12 @@
1
+ // @ts-ignore
2
+ import React from "react";
3
+ import { ViewProps } from "../types";
4
+
5
+
6
+
7
+ /**
8
+ * 业务标识businessKey
9
+ */
10
+ export class ViewProcessInstanceProgress extends React.Component<ViewProps<string>, any> {
11
+ }
12
+
@@ -1,11 +1,11 @@
1
1
  import React from "react";
2
2
  import {Empty, Modal, Skeleton, Table, Typography} from "antd";
3
- import {Gap, HttpUtils,} from "../../framework";
3
+ import {Gap} from "../../components"; import {HttpUtils} from "../../utils";
4
4
 
5
5
  /**
6
6
  * 查看流程处理情况(不含表单)
7
7
  */
8
- export class ViewFlowableInstanceProgress extends React.Component {
8
+ export class ViewProcessInstanceProgress extends React.Component {
9
9
 
10
10
  state = {
11
11
  instanceCommentList: [],
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ import { ViewProps } from "../types";
3
+
4
+ export class ViewProcessInstanceProgressButton extends React.Component<ViewProps<string>, any> {
5
+
6
+ }
@@ -1,18 +1,16 @@
1
1
  import React from "react";
2
2
  import {Button} from "antd";
3
- import {MessageUtils,} from "../utils";
4
- import {ViewStringProps} from "./ViewProps";
5
- import {ViewFlowableInstanceProgress} from "./ViewFlowableInstanceProgress";
3
+ import {MessageUtils} from "../../utils";
4
+ import {ViewProcessInstanceProgress} from "../ViewProcessInstanceProgress";
6
5
 
7
-
8
- export class ViewFlowableInstanceProgressButton extends React.Component<ViewStringProps,any>{
6
+ export class ViewProcessInstanceProgressButton extends React.Component {
9
7
  state = {
10
8
  open:false,
11
9
  }
12
10
 
13
11
  onClick = () => {
14
12
  console.log('点击追踪流程')
15
- let content = <ViewFlowableInstanceProgress value={this.props.value} />;
13
+ let content = <ViewProcessInstanceProgress value={this.props.value} />;
16
14
  MessageUtils.alert(content,{
17
15
  title:'流程审批信息',
18
16
  width:800
@@ -0,0 +1,16 @@
1
+ import React from "react";
2
+ import { ViewProps } from "../types";
3
+
4
+ interface ViewTextProps extends ViewProps<string> {
5
+ /**
6
+ * 是否启用文本省略
7
+ */
8
+ ellipsis?: boolean;
9
+ /**
10
+ * 文本省略的最大长度
11
+ */
12
+ maxLength?: number;
13
+ }
14
+
15
+ export class ViewText extends React.Component<ViewTextProps, any> {
16
+ }
@@ -0,0 +1,42 @@
1
+ import React from "react";
2
+ import {Typography, Button, Modal, Popover} from "antd";
3
+ import {StringUtils} from "../../utils";
4
+
5
+ export class ViewText extends React.Component {
6
+
7
+ static defaultProps = {
8
+ ellipsis: false,
9
+ maxLength: 15
10
+ }
11
+
12
+ render() {
13
+ const {value, ellipsis, maxLength} = this.props;
14
+
15
+ if(value == null){
16
+ return null;
17
+ }
18
+
19
+ // 如果没有启用 ellipsis,使用普通文本显示
20
+ if (!ellipsis) {
21
+ return <Typography.Text> {value}</Typography.Text>;
22
+ }
23
+
24
+ // 如果启用了 ellipsis,使用省略功能
25
+ const short = StringUtils.ellipsis(value, maxLength);
26
+ return (
27
+ <Popover placement="topLeft" title={'长文本'} content={<Button onClick={this.showModal}>点击查看全部内容</Button>}>
28
+ {short}
29
+ </Popover>
30
+ );
31
+ }
32
+
33
+ showModal = () => {
34
+ const {value} = this.props;
35
+ Modal.info({
36
+ icon: null,
37
+ title: '长文本内容',
38
+ content: <div style={{height: 500, overflowY: 'auto'}}>{value}</div>,
39
+ width: 700
40
+ });
41
+ };
42
+ }
@@ -0,0 +1,12 @@
1
+ // 查看组件,主要是value 属性
2
+ export * from './types';
3
+ export * from './ViewPassword';
4
+ export * from './ViewBoolean';
5
+ export * from './ViewApproveStatus'
6
+ export * from './ViewProcessInstanceProgress'
7
+ export * from './ViewProcessInstanceProgressButton'
8
+ export * from './ViewBooleanEnableDisable'
9
+ export * from './ViewImage'
10
+ export * from './ViewFile'
11
+ export * from './ViewText'
12
+ export * from './ViewFileButton'
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+
3
+ /**
4
+ * 通用视图组件属性接口
5
+ * @template T - value 的类型
6
+ */
7
+ export interface ViewProps<T> {
8
+ /**
9
+ * 视图值
10
+ */
11
+ value?: T;
12
+ }
13
+
14
+ /**
15
+ * 通用视图组件类类型
16
+ * @template T - value 的类型
17
+ */
18
+ export interface ViewComponent<T> extends React.ComponentClass<ViewProps<T> & any> {
19
+ }
20
+
21
+ /**
22
+ * 通用视图组件函数类型
23
+ * @template T - value 的类型
24
+ */
25
+ export interface ViewFunctionComponent<T> extends React.FC<ViewProps<T> & any> {
26
+ }
@@ -1,5 +1,3 @@
1
- // 全局路由
2
-
3
1
  import React from 'react';
4
2
  import {Badge, Layout, Menu, Watermark} from 'antd';
5
3
 
@@ -1,6 +1,5 @@
1
1
  import AdminLayout from "./admin"
2
2
  import React from "react";
3
-
4
3
  import {ConfigProvider} from "antd";
5
4
 
6
5
  import {Outlet, withRouter} from "umi";
@@ -10,7 +9,7 @@ import {
10
9
  HttpUtils,
11
10
  MessageHolder,
12
11
  PageLoading,
13
- PageUtils,
12
+ PageUtils, StringUtils,
14
13
  SysUtils,
15
14
  ThemeUtils,
16
15
  } from "../framework";
@@ -26,6 +25,25 @@ dayjs.locale('zh-cn');
26
25
  // 不需要登录的页面
27
26
  const SIMPLE_URLS = ['/login', '/test']
28
27
 
28
+ function checkIsSimplePage(pathname) {
29
+ if(pathname === '/' || pathname === '/index'){
30
+ return false;
31
+ }
32
+ // 测试页面
33
+ if(pathname.startsWith("/test/")){
34
+ return true
35
+ }
36
+ let count = StringUtils.count(pathname,'/');
37
+ return ArrUtils.contains(SIMPLE_URLS, pathname) || count === 1;
38
+ }
39
+
40
+ function checkIsPurePage(pathname){
41
+ if(pathname.startsWith("/test/")){
42
+ return true
43
+ }
44
+ return false
45
+ }
46
+
29
47
  class _Layouts extends React.Component {
30
48
 
31
49
  log = Logger.getLogger('Layouts')
@@ -58,16 +76,11 @@ class _Layouts extends React.Component {
58
76
  }
59
77
  }
60
78
 
61
- isSimplePage() {
62
- let {pathname} = this.props.location;
63
- let isSimplePage = ArrUtils.contains(SIMPLE_URLS, pathname);
64
- console.log('简单页面列表定义', SIMPLE_URLS)
65
- console.log('当前页面是否简单页面',pathname,isSimplePage)
66
- return isSimplePage
67
- }
79
+
68
80
 
69
81
  loadLoginInfo = () => {
70
- if (this.isSimplePage() || this.state.loginInfoFinish) {
82
+ let {pathname} = this.props.location;
83
+ if (checkIsPurePage(pathname) || checkIsSimplePage(pathname) || this.state.loginInfoFinish) {
71
84
  return;
72
85
  }
73
86
 
@@ -135,22 +148,31 @@ class _Layouts extends React.Component {
135
148
 
136
149
 
137
150
  renderContent = () => {
151
+ let {pathname} = this.props.location;
152
+
153
+ if(checkIsPurePage(pathname)){
154
+ return <Outlet/>
155
+ }
156
+
138
157
  if(!this.state.messageHolderInit) {
139
158
  this.log.info('加载message holder...')
140
159
  return <PageLoading message='加载消息组件...'/>
141
160
  }
142
161
 
143
- if (this.state.siteInfoLoading) {
144
- return <PageLoading message='加载站点信息...'/>
145
- }
146
-
147
162
  let {params = {}} = this.props.location;
148
163
  console.log('layout: params', params)
149
- let simple = this.isSimplePage();
150
- if (simple || params.hasOwnProperty('_noLayout')) {
164
+ if (checkIsSimplePage(pathname) || params.hasOwnProperty('_noLayout')) {
151
165
  return <Outlet/>
152
166
  }
153
167
 
168
+
169
+
170
+ if (this.state.siteInfoLoading) {
171
+ return <PageLoading message='加载站点信息...'/>
172
+ }
173
+
174
+
175
+
154
176
  if (!this.state.loginInfoFinish) {
155
177
  return <PageLoading message='加载登录信息...'/>
156
178
  }