@bchr/bchr-front-lib 0.4.5 → 0.5.2
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/lib/base/layout/ActionButton.js +705 -0
- package/lib/base/utils/Arrays.js +37 -0
- package/lib/base/utils/CNKits.js +227 -0
- package/lib/base/utils/CharReplaceUtils.js +111 -0
- package/lib/base/utils/DES24JS.js +58 -0
- package/lib/base/utils/DateTimes.js +163 -0
- package/lib/base/utils/FormDatas.js +109 -0
- package/lib/base/utils/LangTypes.js +173 -0
- package/lib/base/utils/Objects.js +60 -0
- package/lib/base/utils/Randoms.js +146 -0
- package/lib/base/utils/Strings.js +152 -0
- package/lib/base/utils/TreeDataUtils.js +165 -0
- package/lib/base/utils/Values.js +181 -0
- package/lib/base/utils/index.js +45 -0
- package/lib/services/http.js +486 -0
- package/lib/style/ExtCustomKendo.less +1063 -935
- package/package.json +5 -2
- package/src/base/layout/ActionButton.js +628 -0
- package/src/base/utils/Arrays.js +29 -0
- package/src/base/utils/CNKits.js +236 -0
- package/src/base/utils/CharReplaceUtils.js +99 -0
- package/src/base/utils/DES24JS.js +54 -0
- package/src/base/utils/DateTimes.js +136 -0
- package/src/base/utils/FormDatas.js +103 -0
- package/src/base/utils/LangTypes.js +202 -0
- package/src/base/utils/Objects.js +48 -0
- package/src/base/utils/Randoms.js +142 -0
- package/src/base/utils/Strings.js +146 -0
- package/src/base/utils/TreeDataUtils.js +128 -0
- package/src/base/utils/Values.js +196 -0
- package/src/base/utils/index.js +15 -0
- package/src/services/http.js +460 -0
- package/src/style/ExtCustomKendo.less +1063 -935
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bchr/bchr-front-lib",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "bchr front lib",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -44,11 +44,14 @@
|
|
|
44
44
|
"@progress/kendo-react-progressbars": "^3.15.0",
|
|
45
45
|
"@progress/kendo-treeview-react-wrapper": "^2019.4.1014",
|
|
46
46
|
"antd": "^4.5.4",
|
|
47
|
+
"decimal.js": "^10.4.3",
|
|
47
48
|
"file-saver": "^2.0.5",
|
|
48
49
|
"handsontable": "^7.2.2",
|
|
49
50
|
"jquery": "^3.5.1",
|
|
51
|
+
"lodash": "^4.17.21",
|
|
50
52
|
"moment": "^2.27.0",
|
|
51
53
|
"query-string": "^6.13.1",
|
|
52
|
-
"react-loadable": "^5.5.0"
|
|
54
|
+
"react-loadable": "^5.5.0",
|
|
55
|
+
"react-uuid": "^2.0.0"
|
|
53
56
|
}
|
|
54
57
|
}
|
|
@@ -0,0 +1,628 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {Button, Dropdown, Modal, message, Upload} from 'antd';
|
|
3
|
+
import {
|
|
4
|
+
StopOutlined,
|
|
5
|
+
PlusOutlined,
|
|
6
|
+
EditOutlined,
|
|
7
|
+
SaveOutlined,
|
|
8
|
+
DeleteOutlined,
|
|
9
|
+
FilterOutlined,
|
|
10
|
+
SyncOutlined,
|
|
11
|
+
SearchOutlined,
|
|
12
|
+
UndoOutlined,
|
|
13
|
+
CheckSquareOutlined,
|
|
14
|
+
CaretDownOutlined,
|
|
15
|
+
CloseOutlined,
|
|
16
|
+
BarsOutlined,
|
|
17
|
+
SendOutlined
|
|
18
|
+
} from '@ant-design/icons';
|
|
19
|
+
import {
|
|
20
|
+
SettingOutlined,
|
|
21
|
+
ExportOutlined,
|
|
22
|
+
ImportOutlined,
|
|
23
|
+
UploadOutlined,
|
|
24
|
+
DownloadOutlined,
|
|
25
|
+
ThunderboltOutlined,
|
|
26
|
+
CheckCircleOutlined,
|
|
27
|
+
LockOutlined,
|
|
28
|
+
UnlockOutlined,
|
|
29
|
+
CheckOutlined,
|
|
30
|
+
SwapLeftOutlined,
|
|
31
|
+
CopyOutlined,
|
|
32
|
+
ClearOutlined
|
|
33
|
+
} from '@ant-design/icons';
|
|
34
|
+
import { UnorderedListOutlined, SnippetsTwoTone } from '@ant-design/icons';
|
|
35
|
+
import http from "../../services/http";
|
|
36
|
+
import lodash from "lodash";
|
|
37
|
+
import {Values} from "../utils";
|
|
38
|
+
|
|
39
|
+
const ActionButtonTypes = {
|
|
40
|
+
NewAdd : "newAdd",
|
|
41
|
+
Browse : "browse",
|
|
42
|
+
Modify : "modify",
|
|
43
|
+
Save : "save",
|
|
44
|
+
Select : "select",
|
|
45
|
+
ModalSelect : "modalSelect",
|
|
46
|
+
Attachment : "attachment",
|
|
47
|
+
Delete : "delete",
|
|
48
|
+
Query : "query",
|
|
49
|
+
Refresh : "refresh",
|
|
50
|
+
Search : "search",
|
|
51
|
+
ReturnBack : "returnBack",
|
|
52
|
+
OK : "ok",
|
|
53
|
+
Copy : "copy",
|
|
54
|
+
Cancel : "cancel",
|
|
55
|
+
Close : "close",
|
|
56
|
+
Setting : "setting",
|
|
57
|
+
Submit : "submit",
|
|
58
|
+
CallBack : "callBack",
|
|
59
|
+
Approve : "approve",
|
|
60
|
+
Reject : "reject",
|
|
61
|
+
Export : "export",
|
|
62
|
+
Import : "import",
|
|
63
|
+
Upload : "upload",
|
|
64
|
+
Download : "download",
|
|
65
|
+
Invalid : "invalid",
|
|
66
|
+
Effect : "effect",
|
|
67
|
+
Enable : "enable",
|
|
68
|
+
Disable : "disable",
|
|
69
|
+
More : "more",
|
|
70
|
+
AddLine : "addLine",
|
|
71
|
+
Clear : "clear",
|
|
72
|
+
Stop : "stop",
|
|
73
|
+
Issue : "issue",
|
|
74
|
+
CancelIssue : "cancelIssue",
|
|
75
|
+
Up : "up",
|
|
76
|
+
Down : "down",
|
|
77
|
+
TimeConfig : "timeConfig",
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const buildActionButton = function(props, subActionButton, innerLine) {
|
|
81
|
+
let loading = props.loading != null ? props.loading : false;
|
|
82
|
+
let icon = props.icon;
|
|
83
|
+
let btnLabel = props.btnText;
|
|
84
|
+
let type = "tertiary";
|
|
85
|
+
let theme = "light";
|
|
86
|
+
let confirmMsg = null;
|
|
87
|
+
let confirmType = null;
|
|
88
|
+
let checkField = null;
|
|
89
|
+
let checkData = null;
|
|
90
|
+
let hasBtnLabel = props.btnText !== null && props.btnText !== undefined;
|
|
91
|
+
|
|
92
|
+
switch (props.actionType) {
|
|
93
|
+
case ActionButtonTypes.NewAdd : {
|
|
94
|
+
icon = icon ? icon : <PlusOutlined />;
|
|
95
|
+
btnLabel = hasBtnLabel ? props.btnText : "新增";
|
|
96
|
+
type = "primary";
|
|
97
|
+
theme = "solid";
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
case ActionButtonTypes.Browse : {
|
|
101
|
+
icon = icon ? icon : <BarsOutlined />
|
|
102
|
+
btnLabel = hasBtnLabel ? props.btnText : "浏览";
|
|
103
|
+
type = "primary";
|
|
104
|
+
theme = "solid";
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
case ActionButtonTypes.Modify : {
|
|
108
|
+
icon = icon ? icon : <EditOutlined />
|
|
109
|
+
btnLabel = hasBtnLabel ? props.btnText : "修改";
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
case ActionButtonTypes.Save : {
|
|
113
|
+
icon = icon ? icon : <SaveOutlined />
|
|
114
|
+
btnLabel = hasBtnLabel ? props.btnText : "保存";
|
|
115
|
+
type = "primary";
|
|
116
|
+
theme = "solid";
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
case ActionButtonTypes.Select : {
|
|
120
|
+
icon = icon ? icon : <UnorderedListOutlined />
|
|
121
|
+
btnLabel = hasBtnLabel ? props.btnText : "选择";
|
|
122
|
+
type = "primary";
|
|
123
|
+
theme = "solid";
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
case ActionButtonTypes.ModalSelect : {
|
|
127
|
+
icon = icon ? icon : <UnorderedListOutlined />
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
case ActionButtonTypes.Attachment : {
|
|
131
|
+
icon = icon ? icon : <SnippetsTwoTone />
|
|
132
|
+
btnLabel = hasBtnLabel ? props.btnText : "附件";
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
case ActionButtonTypes.Delete : {
|
|
136
|
+
icon = icon ? icon : <DeleteOutlined />
|
|
137
|
+
btnLabel = hasBtnLabel ? props.btnText : "删除";
|
|
138
|
+
type = "danger";
|
|
139
|
+
theme = "solid";
|
|
140
|
+
confirmMsg = "确定要删除[options]记录吗?";
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
case ActionButtonTypes.Stop : {
|
|
144
|
+
icon = icon ? icon : <StopOutlined />
|
|
145
|
+
btnLabel = hasBtnLabel ? props.btnText : "终止";
|
|
146
|
+
type = "danger";
|
|
147
|
+
theme = "solid";
|
|
148
|
+
confirmMsg = "确定要终止[options]记录吗?";
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
case ActionButtonTypes.Copy : {
|
|
152
|
+
icon = icon ? icon : <CopyOutlined />
|
|
153
|
+
btnLabel = hasBtnLabel ? props.btnText : "复制";
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
case ActionButtonTypes.Query : {
|
|
157
|
+
icon = icon ? icon : <FilterOutlined />
|
|
158
|
+
btnLabel = hasBtnLabel ? props.btnText : "查询";
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
case ActionButtonTypes.Refresh : {
|
|
162
|
+
icon = icon ? icon : <SyncOutlined />
|
|
163
|
+
btnLabel = hasBtnLabel ? props.btnText : "刷新";
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
case ActionButtonTypes.Search : {
|
|
167
|
+
icon = icon ? icon : <SearchOutlined />
|
|
168
|
+
btnLabel = hasBtnLabel ? props.btnText : "检索";
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
case ActionButtonTypes.ReturnBack : {
|
|
172
|
+
icon = icon ? icon : <UndoOutlined />
|
|
173
|
+
btnLabel = hasBtnLabel ? props.btnText : "返回";
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
case ActionButtonTypes.OK : {
|
|
177
|
+
icon = icon ? icon : <CheckSquareOutlined />
|
|
178
|
+
btnLabel = hasBtnLabel ? props.btnText : "确定";
|
|
179
|
+
type = "primary";
|
|
180
|
+
theme = "solid";
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
case ActionButtonTypes.Cancel : {
|
|
184
|
+
icon = icon ? icon : <SwapLeftOutlined />
|
|
185
|
+
btnLabel = hasBtnLabel ? props.btnText : "取消";
|
|
186
|
+
type = "warning"
|
|
187
|
+
confirmMsg = "确定要取消[options]吗?";
|
|
188
|
+
theme = "solid";
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
case ActionButtonTypes.Close : {
|
|
192
|
+
icon = icon ? icon : <CloseOutlined />
|
|
193
|
+
btnLabel = hasBtnLabel ? props.btnText : "关闭";
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
case ActionButtonTypes.Setting : {
|
|
197
|
+
icon = icon ? icon : <SettingOutlined />
|
|
198
|
+
btnLabel = hasBtnLabel ? props.btnText : "设置";
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
case ActionButtonTypes.Submit : {
|
|
202
|
+
icon = icon ? icon : <SendOutlined />
|
|
203
|
+
btnLabel = hasBtnLabel ? props.btnText : "提交";
|
|
204
|
+
type = "primary";
|
|
205
|
+
theme = "solid";
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
case ActionButtonTypes.CallBack : {
|
|
209
|
+
icon = icon ? icon : <SwapLeftOutlined />
|
|
210
|
+
type = hasBtnLabel ? props.btnText : "warning"
|
|
211
|
+
btnLabel = hasBtnLabel ? props.btnText : "收回";
|
|
212
|
+
confirmMsg = "确定要收回[options]吗?";
|
|
213
|
+
theme = "solid";
|
|
214
|
+
type = "primary";
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
case ActionButtonTypes.Approve : {
|
|
218
|
+
icon = icon ? icon : <CheckCircleOutlined />
|
|
219
|
+
btnLabel = hasBtnLabel ? props.btnText : "审批";
|
|
220
|
+
type = "warning"
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
case ActionButtonTypes.Reject : {
|
|
224
|
+
icon = icon ? icon : <ClearOutlined />
|
|
225
|
+
type = "warning";
|
|
226
|
+
btnLabel = hasBtnLabel ? props.btnText : "驳回";
|
|
227
|
+
theme = "solid";
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
case ActionButtonTypes.Export : {
|
|
231
|
+
icon = icon ? icon : <ExportOutlined />
|
|
232
|
+
btnLabel = hasBtnLabel ? props.btnText : "导出";
|
|
233
|
+
break;
|
|
234
|
+
}
|
|
235
|
+
case ActionButtonTypes.Import : {
|
|
236
|
+
icon = icon ? icon : <ImportOutlined />
|
|
237
|
+
btnLabel = hasBtnLabel ? props.btnText : "导入";
|
|
238
|
+
break;
|
|
239
|
+
}
|
|
240
|
+
case ActionButtonTypes.Download : {
|
|
241
|
+
icon = icon ? icon : <DownloadOutlined />
|
|
242
|
+
btnLabel = hasBtnLabel ? props.btnText : "下载";
|
|
243
|
+
break;
|
|
244
|
+
}
|
|
245
|
+
case ActionButtonTypes.Upload : {
|
|
246
|
+
icon = icon ? icon : <UploadOutlined />
|
|
247
|
+
btnLabel = hasBtnLabel ? props.btnText : "上传";
|
|
248
|
+
break;
|
|
249
|
+
}
|
|
250
|
+
case ActionButtonTypes.Invalid : {
|
|
251
|
+
icon = icon ? icon : <CheckCircleOutlined />
|
|
252
|
+
type = hasBtnLabel ? props.btnText : "warning"
|
|
253
|
+
btnLabel = "撤销生效";
|
|
254
|
+
confirmMsg = "确定要撤销生效[options]吗?";
|
|
255
|
+
theme = "solid";
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
case ActionButtonTypes.Effect : {
|
|
259
|
+
icon = icon ? icon : <CheckCircleOutlined />
|
|
260
|
+
type = "primary"
|
|
261
|
+
btnLabel = hasBtnLabel ? props.btnText : "生效";
|
|
262
|
+
theme = "solid";
|
|
263
|
+
break;
|
|
264
|
+
}
|
|
265
|
+
case ActionButtonTypes.Issue : {
|
|
266
|
+
icon = icon ? icon : <span className="iconfont icon-personal-issue"/>
|
|
267
|
+
btnLabel = hasBtnLabel ? props.btnText : "下发";
|
|
268
|
+
break;
|
|
269
|
+
}
|
|
270
|
+
case ActionButtonTypes.CancelIssue : {
|
|
271
|
+
icon = icon ? icon : <span className="iconfont icon-personal-cancel-issue"/>
|
|
272
|
+
btnLabel = hasBtnLabel ? props.btnText : "取消下发";
|
|
273
|
+
break;
|
|
274
|
+
}
|
|
275
|
+
case ActionButtonTypes.Up : {
|
|
276
|
+
icon = icon ? icon : <span className="iconfont icon-personal-arrow-line-left"/>
|
|
277
|
+
btnLabel = hasBtnLabel ? props.btnText : "上一条";
|
|
278
|
+
break;
|
|
279
|
+
}
|
|
280
|
+
case ActionButtonTypes.Down : {
|
|
281
|
+
icon = icon ? icon : <span className="iconfont icon-personal-arrow-line-right"/>
|
|
282
|
+
btnLabel = hasBtnLabel ? props.btnText : "下一条";
|
|
283
|
+
break;
|
|
284
|
+
}
|
|
285
|
+
case ActionButtonTypes.TimeConfig : {
|
|
286
|
+
icon = icon ? icon : <span className="iconfont icon-personal-overtime-ledger"/>
|
|
287
|
+
btnLabel = hasBtnLabel ? props.btnText : "任务设定";
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
290
|
+
case ActionButtonTypes.Enable : {
|
|
291
|
+
icon = icon ? icon : <UnlockOutlined />
|
|
292
|
+
type = "primary"
|
|
293
|
+
btnLabel = hasBtnLabel ? props.btnText : "启用";
|
|
294
|
+
theme = "solid";
|
|
295
|
+
break;
|
|
296
|
+
}
|
|
297
|
+
case ActionButtonTypes.Disable : {
|
|
298
|
+
icon = icon ? icon : <LockOutlined />
|
|
299
|
+
type = "warning"
|
|
300
|
+
btnLabel = hasBtnLabel ? props.btnText : "禁用";
|
|
301
|
+
theme = "solid";
|
|
302
|
+
confirmMsg = "确定要禁用[options]记录吗?";
|
|
303
|
+
break;
|
|
304
|
+
}
|
|
305
|
+
case ActionButtonTypes.More : {
|
|
306
|
+
icon = icon ? icon : <CaretDownOutlined />
|
|
307
|
+
btnLabel = hasBtnLabel ? props.btnText : "更多";
|
|
308
|
+
break;
|
|
309
|
+
}
|
|
310
|
+
case ActionButtonTypes.AddLine : {
|
|
311
|
+
icon = icon ? icon : <CopyOutlined />
|
|
312
|
+
btnLabel = hasBtnLabel ? props.btnText : "增行";
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
315
|
+
case ActionButtonTypes.Clear : {
|
|
316
|
+
icon = icon ? icon : <ClearOutlined />
|
|
317
|
+
btnLabel = hasBtnLabel ? props.btnText : "清除";
|
|
318
|
+
type = "warning"
|
|
319
|
+
theme = "solid";
|
|
320
|
+
break;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
if (!icon) {
|
|
325
|
+
icon = <ThunderboltOutlined />;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
let buttonProps = {
|
|
329
|
+
...props
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
if (buttonProps.moreProps) {
|
|
333
|
+
delete buttonProps.moreProps;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
if (buttonProps.actionType) {
|
|
337
|
+
delete buttonProps.actionType;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
if (hasBtnLabel) {
|
|
341
|
+
delete buttonProps.btnText;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
if (buttonProps.confirmmsg) {
|
|
345
|
+
if (Values.isEmpty(buttonProps.checkField) || Values.isEmpty(buttonProps.checkData)) {
|
|
346
|
+
throw new Error("Please enter the check field and table data before transmitting the check field and table data");
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
checkField = buttonProps.checkField;
|
|
350
|
+
checkData = buttonProps.checkData;
|
|
351
|
+
confirmMsg = buttonProps.confirmmsg;
|
|
352
|
+
|
|
353
|
+
delete buttonProps.checkField;
|
|
354
|
+
delete buttonProps.checkData;
|
|
355
|
+
delete buttonProps.confirmmsg;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
if (buttonProps.confirmtype) {
|
|
359
|
+
confirmType = buttonProps.confirmtype;
|
|
360
|
+
|
|
361
|
+
delete buttonProps.confirmtype;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
if (buttonProps.children) delete buttonProps.children;
|
|
365
|
+
if (!buttonProps.icon) buttonProps.icon = icon;
|
|
366
|
+
if (!buttonProps.type) buttonProps.type = type;
|
|
367
|
+
if (!buttonProps.theme) buttonProps.theme = theme;
|
|
368
|
+
|
|
369
|
+
if (innerLine) {
|
|
370
|
+
if (!buttonProps.size) {
|
|
371
|
+
buttonProps.size = "small";
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
if (confirmMsg && confirmMsg.trim().length > 0 && typeof buttonProps.onClick === "function") {
|
|
376
|
+
let onClickHandler = buttonProps.onClick;
|
|
377
|
+
let onCancelHandler = buttonProps.onCancel;
|
|
378
|
+
|
|
379
|
+
let modalOptions = {
|
|
380
|
+
title : '提示',
|
|
381
|
+
content : confirmMsg,
|
|
382
|
+
onOk : onClickHandler,
|
|
383
|
+
onCancel : onCancelHandler,
|
|
384
|
+
cancelButtonProps : {icon: <UndoOutlined />},
|
|
385
|
+
okButtonProps : {type: buttonProps.type, theme : "solid", icon: <CheckOutlined />}
|
|
386
|
+
};
|
|
387
|
+
buttonProps.onClick = function() {
|
|
388
|
+
if (Values.isEmpty(checkField) || Values.isEmpty(checkData)) {
|
|
389
|
+
throw new Error("Please enter the check field and table data before transmitting the check field and table data");
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
let checkedNames = [];
|
|
393
|
+
if (Values.isNotEmpty(checkField) && Values.isNotEmpty(checkData)) {
|
|
394
|
+
if (Array.isArray(checkData)) {
|
|
395
|
+
let selectedData = checkData.filter(item => item.selected);
|
|
396
|
+
if (Values.isNotEmptyArray(selectedData)) {
|
|
397
|
+
selectedData.forEach(check => {
|
|
398
|
+
checkedNames.push(check[checkField]);
|
|
399
|
+
})
|
|
400
|
+
}
|
|
401
|
+
else {
|
|
402
|
+
message.warning('未找到选中的记录,请检查选中状态');
|
|
403
|
+
return
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
else if (lodash.isPlainObject(checkData)) {
|
|
407
|
+
checkedNames.push(checkData[checkField]);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
modalOptions.content.replace('[options]', checkedNames.join(','));
|
|
412
|
+
|
|
413
|
+
if (confirmType) {
|
|
414
|
+
if (confirmType === 'danger') {
|
|
415
|
+
modalOptions.title = '错误';
|
|
416
|
+
Modal.error(modalOptions);
|
|
417
|
+
}
|
|
418
|
+
else if (confirmType === 'warning') {
|
|
419
|
+
modalOptions.title = '警告';
|
|
420
|
+
Modal.warning(modalOptions);
|
|
421
|
+
}
|
|
422
|
+
else {
|
|
423
|
+
Modal.confirm(modalOptions);
|
|
424
|
+
}
|
|
425
|
+
} else {
|
|
426
|
+
if (buttonProps.type === "danger") {
|
|
427
|
+
modalOptions.title = '错误';
|
|
428
|
+
Modal.error(modalOptions);
|
|
429
|
+
}
|
|
430
|
+
else if (buttonProps.type === "warning") {
|
|
431
|
+
modalOptions.title = '警告';
|
|
432
|
+
Modal.warning(modalOptions);
|
|
433
|
+
}
|
|
434
|
+
else {
|
|
435
|
+
Modal.confirm(modalOptions);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
if (!props.onClick && (props.actionType === ActionButtonTypes.Upload || props.actionType === ActionButtonTypes.Import)) {
|
|
442
|
+
|
|
443
|
+
let fileLimit = props.fileLimit;
|
|
444
|
+
let dragSubText = "支持任意类型文件";
|
|
445
|
+
if (fileLimit && fileLimit != "*" && fileLimit.length > 1) {
|
|
446
|
+
dragSubText = "支持文件类型:" + fileLimit.replaceAll(".", "").replaceAll(",", "、");
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
if (buttonProps.action) delete buttonProps.action;
|
|
450
|
+
if (buttonProps.data) delete buttonProps.data;
|
|
451
|
+
if (buttonProps.onFileChange) delete buttonProps.onFileChange;
|
|
452
|
+
if (buttonProps.fileList) delete buttonProps.fileList;
|
|
453
|
+
if (buttonProps.fileLimit) delete buttonProps.fileLimit;
|
|
454
|
+
if ("showUploadList" in buttonProps) delete buttonProps.showUploadList;
|
|
455
|
+
if ("simpleUploadMode" in buttonProps) delete buttonProps.simpleUploadMode;
|
|
456
|
+
|
|
457
|
+
let actionPath = '';
|
|
458
|
+
if (props.action) {
|
|
459
|
+
if (props.action.indexOf('/') !== -1) {
|
|
460
|
+
actionPath = props.action
|
|
461
|
+
} else {
|
|
462
|
+
actionPath = http.getRequestPath(props.action);
|
|
463
|
+
}
|
|
464
|
+
} else {
|
|
465
|
+
actionPath = http.getRequestPath('uploadFile');
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
let uploadProps = {}
|
|
469
|
+
|
|
470
|
+
if (props.fileList) {
|
|
471
|
+
uploadProps.fileList = props.fileList;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
if (props.simpleUploadMode) {
|
|
475
|
+
let {data} = props;
|
|
476
|
+
let lastProvidedData = data;
|
|
477
|
+
if (lodash.isFunction(data)) {
|
|
478
|
+
lastProvidedData = data();
|
|
479
|
+
}
|
|
480
|
+
return <Upload
|
|
481
|
+
action={actionPath}
|
|
482
|
+
defaultFileList={props.defaultFileList}
|
|
483
|
+
data={lastProvidedData}
|
|
484
|
+
uploadTrigger={props.action ? 'auto' : "custom"}
|
|
485
|
+
beforeRemove={props.beforeRemove}
|
|
486
|
+
onFileChange={props.onFileChange}
|
|
487
|
+
onSuccess={(event, file) => {
|
|
488
|
+
message.success(`${file.name}文件导入成功!`);
|
|
489
|
+
props.onFileChange(event, 'success');
|
|
490
|
+
}}
|
|
491
|
+
onError={(e, file, fileList, xhr) => {
|
|
492
|
+
http.dealAjaxException(xhr);
|
|
493
|
+
}}
|
|
494
|
+
showUploadList={props.showUploadList}
|
|
495
|
+
{...uploadProps}
|
|
496
|
+
fileLimit={fileLimit}
|
|
497
|
+
accept={props.accept}
|
|
498
|
+
showClear={props.showClear}
|
|
499
|
+
draggable={true}
|
|
500
|
+
dragMainText={props.dragMainText || "点击上传文件或拖拽文件到这里"}
|
|
501
|
+
dragSubText={props.dragSubText || dragSubText}
|
|
502
|
+
><Button {...buttonProps}>{props.children ? props.children : btnLabel}</Button></Upload>
|
|
503
|
+
}
|
|
504
|
+
else {
|
|
505
|
+
buttonProps.onClick = function() {
|
|
506
|
+
if (buttonProps.validate === undefined || buttonProps.validate) {
|
|
507
|
+
let actionPath = '';
|
|
508
|
+
if (props.action) {
|
|
509
|
+
if (props.action.indexOf('/') !== -1) {
|
|
510
|
+
actionPath = props.action
|
|
511
|
+
} else {
|
|
512
|
+
actionPath = http.getRequestPath(props.action);
|
|
513
|
+
}
|
|
514
|
+
} else {
|
|
515
|
+
actionPath = http.getRequestPath('uploadFile');
|
|
516
|
+
}
|
|
517
|
+
const uploadModal = Modal.info({
|
|
518
|
+
'icon' : null,
|
|
519
|
+
'title': props.uploadTitle || ' ',
|
|
520
|
+
'okButtonProps' : {icon: <CheckOutlined />},
|
|
521
|
+
'cancelButtonProps' : {icon: <UndoOutlined />},
|
|
522
|
+
'footer': '',
|
|
523
|
+
'content': <Upload
|
|
524
|
+
action={actionPath}
|
|
525
|
+
data={props.data ? props.data : null}
|
|
526
|
+
uploadTrigger={props.action ? 'auto' : "custom"}
|
|
527
|
+
onError={(e, file, fileList, xhr) => {
|
|
528
|
+
http.dealAjaxException(xhr);
|
|
529
|
+
}}
|
|
530
|
+
onFileChange={props.onFileChange}
|
|
531
|
+
onSuccess={(event, file) => {
|
|
532
|
+
message.success(`${file.name}文件导入成功!`);
|
|
533
|
+
props.onFileChange(event, 'success');
|
|
534
|
+
uploadModal.destroy();
|
|
535
|
+
}}
|
|
536
|
+
showUploadList={props.showUploadList}
|
|
537
|
+
{...uploadProps}
|
|
538
|
+
fileLimit={fileLimit}
|
|
539
|
+
draggable={true}
|
|
540
|
+
dragMainText={props.dragMainText || "点击上传文件或拖拽文件到这里"}
|
|
541
|
+
dragSubText={props.dragSubText || dragSubText}/>
|
|
542
|
+
});
|
|
543
|
+
} else {
|
|
544
|
+
if (lodash.isFunction(buttonProps.validateChange)) {
|
|
545
|
+
buttonProps.validateChange();
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
if (props.actionType === ActionButtonTypes.ReturnBack && typeof buttonProps.onClick !== "function") {
|
|
553
|
+
buttonProps.onClick = function() {
|
|
554
|
+
http.goBack();
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
if (subActionButton) {
|
|
559
|
+
return <Dropdown.Item {...buttonProps}>{props.children ? props.children : btnLabel}</Dropdown.Item>
|
|
560
|
+
}
|
|
561
|
+
else {
|
|
562
|
+
if (props.actionType === ActionButtonTypes.More) {
|
|
563
|
+
return <Button {...buttonProps}>{btnLabel}</Button>
|
|
564
|
+
}
|
|
565
|
+
else if (props.actionType === ActionButtonTypes.Down) {
|
|
566
|
+
delete buttonProps.icon;
|
|
567
|
+
return <Button {...buttonProps}>{btnLabel} {icon}</Button>
|
|
568
|
+
}
|
|
569
|
+
else {
|
|
570
|
+
return <Button {...buttonProps}>{props.children ? props.children : btnLabel}</Button>
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
const ActionButton = function(props) {
|
|
576
|
+
if (props.actionType === ActionButtonTypes.More) {
|
|
577
|
+
return <Dropdown
|
|
578
|
+
{...props.moreProps}
|
|
579
|
+
zIndex={1000}
|
|
580
|
+
trigger={props.moreProps?.trigger ? props.moreProps?.trigger : 'hover'}
|
|
581
|
+
position={props.moreProps?.position ? props.moreProps?.position : 'bottomLeft'}
|
|
582
|
+
render={
|
|
583
|
+
<Dropdown.Menu>
|
|
584
|
+
{props.children}
|
|
585
|
+
</Dropdown.Menu>
|
|
586
|
+
}>
|
|
587
|
+
{buildActionButton(props, false, false)}
|
|
588
|
+
</Dropdown>
|
|
589
|
+
}
|
|
590
|
+
else {
|
|
591
|
+
return buildActionButton(props, false, false);
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
const SubActionButton = function(props) {
|
|
596
|
+
return buildActionButton(props, true, false);
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
const InnerLineActionButton = function(props) {
|
|
600
|
+
if (props.actionType === ActionButtonTypes.More) {
|
|
601
|
+
return <Dropdown
|
|
602
|
+
trigger={props.trigger ? props.trigger : 'hover'}
|
|
603
|
+
position={props.position ? props.position : 'bottomLeft'}
|
|
604
|
+
render={
|
|
605
|
+
<Dropdown.Menu>
|
|
606
|
+
{props.children}
|
|
607
|
+
</Dropdown.Menu>
|
|
608
|
+
}
|
|
609
|
+
>
|
|
610
|
+
{buildActionButton(props, false, true)}
|
|
611
|
+
</Dropdown>
|
|
612
|
+
}
|
|
613
|
+
else {
|
|
614
|
+
return buildActionButton(props, false, true);
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
const SubInnerLineActionButton = function(props) {
|
|
619
|
+
return buildActionButton(props, true, true);
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
export {
|
|
623
|
+
ActionButtonTypes,
|
|
624
|
+
ActionButton,
|
|
625
|
+
SubActionButton,
|
|
626
|
+
InnerLineActionButton,
|
|
627
|
+
SubInnerLineActionButton
|
|
628
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import lodash from 'lodash';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const Arrays = {
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 检查两个数组是否有相同的内容
|
|
8
|
+
*/
|
|
9
|
+
isHasSameContent(arr1, arr2) {
|
|
10
|
+
if (arr1 === arr2) {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (!lodash.isArray(arr1) || !lodash.isArray(arr2)) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (arr1.length !== arr2.length) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const sortedArray1 = arr1.slice().sort();
|
|
23
|
+
const sortedArray2 = arr2.slice().sort();
|
|
24
|
+
|
|
25
|
+
return sortedArray1.every((value, index) => value === sortedArray2[index]);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default Arrays;
|