ls-pro-common 3.0.11 → 3.0.13

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 (113) hide show
  1. package/README.md +22 -22
  2. package/dist/common.css +122 -21
  3. package/dist/common.js +1 -1
  4. package/dist/common.min.css +122 -21
  5. package/dist/common.min.js +1 -1
  6. package/lib/index.js +8 -1
  7. package/package.json +48 -48
  8. package/CHANGELOG.md +0 -746
  9. package/es/components/404.d.ts +0 -3
  10. package/es/components/404.jpg +0 -0
  11. package/es/components/404.js +0 -9
  12. package/es/components/AreaCascader.d.ts +0 -4
  13. package/es/components/AreaCascader.js +0 -76
  14. package/es/components/AreaCascaderPanel.d.ts +0 -5
  15. package/es/components/AreaCascaderPanel.js +0 -230
  16. package/es/components/DescritionCard.d.ts +0 -11
  17. package/es/components/DescritionCard.js +0 -79
  18. package/es/components/DtlLayout.d.ts +0 -44
  19. package/es/components/DtlLayout.js +0 -115
  20. package/es/components/GroupTip.d.ts +0 -10
  21. package/es/components/GroupTip.js +0 -31
  22. package/es/components/IconBack.d.ts +0 -3
  23. package/es/components/IconBack.js +0 -20
  24. package/es/components/IconBell.d.ts +0 -3
  25. package/es/components/IconBell.js +0 -22
  26. package/es/components/IconQuestion.d.ts +0 -3
  27. package/es/components/IconQuestion.js +0 -26
  28. package/es/components/IconSearch.d.ts +0 -3
  29. package/es/components/IconSearch.js +0 -22
  30. package/es/components/IconSelector.d.ts +0 -14
  31. package/es/components/IconSelector.js +0 -222
  32. package/es/components/IconText.d.ts +0 -3
  33. package/es/components/IconText.js +0 -30
  34. package/es/components/ImageSelector.d.ts +0 -31
  35. package/es/components/ImageSelector.js +0 -437
  36. package/es/components/InputMultiLine.d.ts +0 -46
  37. package/es/components/InputMultiLine.js +0 -139
  38. package/es/components/InputTable.d.ts +0 -106
  39. package/es/components/InputTable.js +0 -477
  40. package/es/components/Loading.d.ts +0 -8
  41. package/es/components/Loading.js +0 -20
  42. package/es/components/Permission.d.ts +0 -6
  43. package/es/components/Permission.js +0 -13
  44. package/es/components/antd-custom.less +0 -262
  45. package/es/components/common.less +0 -468
  46. package/es/hooks/useDtl/index.d.ts +0 -48
  47. package/es/hooks/useDtl/index.js +0 -949
  48. package/es/hooks/usePermission/index.d.ts +0 -15
  49. package/es/hooks/usePermission/index.js +0 -58
  50. package/es/hooks/useSingle/index.d.ts +0 -55
  51. package/es/hooks/useSingle/index.js +0 -662
  52. package/es/http/index.d.ts +0 -53
  53. package/es/http/index.js +0 -301
  54. package/es/index.d.ts +0 -31
  55. package/es/index.js +0 -25
  56. package/es/service/BaseService.d.ts +0 -24
  57. package/es/service/BaseService.js +0 -214
  58. package/es/typing.d.ts +0 -53
  59. package/es/typing.js +0 -1
  60. package/es/utils/index.d.ts +0 -252
  61. package/es/utils/index.js +0 -671
  62. package/lib/components/404.d.ts +0 -3
  63. package/lib/components/404.jpg +0 -0
  64. package/lib/components/404.js +0 -17
  65. package/lib/components/AreaCascader.d.ts +0 -4
  66. package/lib/components/AreaCascader.js +0 -85
  67. package/lib/components/AreaCascaderPanel.d.ts +0 -5
  68. package/lib/components/AreaCascaderPanel.js +0 -239
  69. package/lib/components/DescritionCard.d.ts +0 -11
  70. package/lib/components/DescritionCard.js +0 -88
  71. package/lib/components/DtlLayout.d.ts +0 -44
  72. package/lib/components/DtlLayout.js +0 -124
  73. package/lib/components/GroupTip.d.ts +0 -10
  74. package/lib/components/GroupTip.js +0 -39
  75. package/lib/components/IconBack.d.ts +0 -3
  76. package/lib/components/IconBack.js +0 -28
  77. package/lib/components/IconBell.d.ts +0 -3
  78. package/lib/components/IconBell.js +0 -30
  79. package/lib/components/IconQuestion.d.ts +0 -3
  80. package/lib/components/IconQuestion.js +0 -34
  81. package/lib/components/IconSearch.d.ts +0 -3
  82. package/lib/components/IconSearch.js +0 -30
  83. package/lib/components/IconSelector.d.ts +0 -14
  84. package/lib/components/IconSelector.js +0 -230
  85. package/lib/components/IconText.d.ts +0 -3
  86. package/lib/components/IconText.js +0 -38
  87. package/lib/components/ImageSelector.d.ts +0 -31
  88. package/lib/components/ImageSelector.js +0 -445
  89. package/lib/components/InputMultiLine.d.ts +0 -46
  90. package/lib/components/InputMultiLine.js +0 -148
  91. package/lib/components/InputTable.d.ts +0 -106
  92. package/lib/components/InputTable.js +0 -486
  93. package/lib/components/Loading.d.ts +0 -8
  94. package/lib/components/Loading.js +0 -28
  95. package/lib/components/Permission.d.ts +0 -6
  96. package/lib/components/Permission.js +0 -21
  97. package/lib/components/antd-custom.less +0 -262
  98. package/lib/components/common.less +0 -468
  99. package/lib/hooks/useDtl/index.d.ts +0 -48
  100. package/lib/hooks/useDtl/index.js +0 -957
  101. package/lib/hooks/usePermission/index.d.ts +0 -15
  102. package/lib/hooks/usePermission/index.js +0 -65
  103. package/lib/hooks/useSingle/index.d.ts +0 -55
  104. package/lib/hooks/useSingle/index.js +0 -670
  105. package/lib/http/index.d.ts +0 -53
  106. package/lib/http/index.js +0 -315
  107. package/lib/index.d.ts +0 -31
  108. package/lib/service/BaseService.d.ts +0 -24
  109. package/lib/service/BaseService.js +0 -222
  110. package/lib/typing.d.ts +0 -53
  111. package/lib/typing.js +0 -5
  112. package/lib/utils/index.d.ts +0 -252
  113. package/lib/utils/index.js +0 -767
package/es/utils/index.js DELETED
@@ -1,671 +0,0 @@
1
- import "antd/es/spin/style";
2
- import _Spin from "antd/es/spin";
3
- import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
4
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
5
- import "antd/es/modal/style";
6
- import _Modal from "antd/es/modal";
7
- import "antd/es/message/style";
8
- import _message from "antd/es/message";
9
- import _typeof from "@babel/runtime/helpers/esm/typeof";
10
- import ReactDOM from 'react-dom';
11
- import { QuestionCircleOutlined } from '@ant-design/icons';
12
- import { dateFormat, toGatewayUrl } from 'ls-pro-table';
13
- import { httpPost } from '../http';
14
- import React from 'react';
15
- export { throttle, debounce } from 'lodash';
16
- export { getUrlQuery, setUrlQuery, toGatewayUrl, dateFormat, getResourceProps } from 'ls-pro-table';
17
- /**
18
- * 设置文档title
19
- * @param {*} title
20
- * @returns
21
- */
22
- export var setTitle = function setTitle(title) {
23
- if (!title) return;
24
- document.title = title;
25
- };
26
- /**
27
- * 日期格式化
28
- * @param dt 日期
29
- * @param showTime 是否显示时间 默认true
30
- * @returns YYYY-MM-DD hh:mm:ss
31
- */
32
- export var formatDate = dateFormat;
33
- /**
34
- * 返回当前日期
35
- * @returns YYYY-MM-DD
36
- */
37
- export var today = function today() {
38
- return dateFormat(null, false);
39
- };
40
- /**
41
- * 返回当前日期时间
42
- * @returns YYYY-MM-DD hh:mm:ss
43
- */
44
- export var now = function now() {
45
- return dateFormat(null, true);
46
- };
47
- /**
48
- * 时间加减
49
- * @param dt 原始时间,传 null 为当前时间
50
- * @param addDay 添加添数,可为负数
51
- * @param addMonth 添加月数,可为负数
52
- * @param addYear 添加年数,可以负责
53
- * @returns YYYY-MM-DD hh:mm:ss
54
- */
55
- export var dateAdd = function dateAdd(dt, addDay) {
56
- var addMonth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
57
- var addYear = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
58
- if (!dt) {
59
- dt = new Date();
60
- }
61
- if (addDay) {
62
- dt.setDate(dt.getDate() + addDay);
63
- }
64
- if (addMonth) {
65
- dt.setMonth(dt.getMonth() + addMonth);
66
- }
67
- if (addYear) {
68
- dt.setFullYear(dt.getFullYear() + addYear);
69
- }
70
- return dateFormat(dt, true);
71
- };
72
- /**
73
- * 当前时间加减
74
- * @param addDay 添加添数,可为负数
75
- * @param addMonth 添加月数,可为负数
76
- * @param addYear 添加年数,可以负责
77
- * @returns YYYY-MM-DD hh:mm:ss
78
- */
79
- export var nowAdd = function nowAdd(addDay) {
80
- var addMonth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
81
- var addYear = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
82
- return dateAdd(null, addDay, addMonth, addYear);
83
- };
84
- /**
85
- * 当前日期加减
86
- * @param addDay 添加添数,可为负数
87
- * @param addMonth 添加月数,可为负数
88
- * @param addYear 添加年数,可以负责
89
- * @returns YYYY-MM-DD
90
- */
91
- export var todayAdd = function todayAdd(addDay) {
92
- var addMonth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
93
- var addYear = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
94
- return nowAdd(addDay, addMonth, addYear).split(' ')[0];
95
- };
96
- /**
97
- * 千位符格式化数值
98
- * @param num 数值
99
- * @param dec 小数位数,默认为2位小数
100
- * @returns xx,xxx.xx
101
- */
102
- export var formatMoney = function formatMoney(num) {
103
- var dec = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
104
- if (typeof num !== 'number') {
105
- num = Number(num);
106
- if (Number.isNaN(num)) {
107
- num = 0;
108
- }
109
- }
110
- var str = num.toFixed(dec);
111
- if (str.indexOf('.') === -1) {
112
- str += '.';
113
- }
114
- return str.replace(/(\d)(?=(\d{3})+\.)/g, '$1,').replace(/\.$/, '');
115
- };
116
- /**
117
- * 获取Cookie
118
- * @param {String} name cookie名
119
- * @returns
120
- */
121
- export var getCookie = function getCookie(name) {
122
- var arr;
123
- var reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
124
- if (arr = document.cookie.match(reg)) return arr[2];else return null;
125
- };
126
- /**
127
- * 设置Cookie
128
- * @param {*} key Cookie名称
129
- * @param {*} value Cookie 值
130
- * @param { Number } day 有效天数 默认1天,
131
- */
132
- export var setCookie = function setCookie(key, value) {
133
- var day = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
134
- var sameSite = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
135
- if (day !== 0) {
136
- var d = new Date(Date.now() + day * 24 * 60 * 60 * 1000);
137
- if (sameSite) {
138
- document.cookie = "".concat(key, "=").concat(value, ";expires=").concat(d.toUTCString(), ";path=/;sameSite=None;secure=true");
139
- } else {
140
- document.cookie = "".concat(key, "=").concat(value, ";expires=").concat(d.toUTCString(), ";path=/");
141
- }
142
- } else {
143
- if (sameSite) {
144
- document.cookie = key + "=" + value + ";path=/;sameSite=None;secure=true";
145
- } else {
146
- document.cookie = key + "=" + value + ";path=/";
147
- }
148
- }
149
- };
150
- /**
151
- * 判断是否登录
152
- * @returns
153
- */
154
- export var isLogin = function isLogin() {
155
- return !!getCookie('online');
156
- };
157
- export var getFullScreenElement = function getFullScreenElement() {
158
- //@ts-ignore
159
- return document.fullscreenElement || document.mozFullScreenElement || document.msFullScreenElement || document.webkitFullscreenElement || undefined;
160
- };
161
- /**
162
- * 设置本地缓存
163
- * @param { String } key 关键字
164
- * @param { Object } data 值
165
- * @param { Boolean } session 保存到 sessionStorage 还是 localStorage,默认 localStorage
166
- */
167
- export var setCache = function setCache(key, data) {
168
- var session = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
169
- if (_typeof(data) === 'object') {
170
- data = JSON.stringify(data);
171
- }
172
- if (session) {
173
- sessionStorage.setItem(key, data);
174
- } else {
175
- localStorage.setItem(key, data);
176
- }
177
- };
178
- /**
179
- * 读取本地缓存
180
- * @param { String } key 关键字
181
- * @param { boolean } session 从 sessionStorage 取数还是从 localStorage 中取数 默认从 localStorage
182
- * @returns 关键字对应的值
183
- */
184
- export var getCache = function getCache(key) {
185
- var session = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
186
- var data = session ? sessionStorage.getItem(key) : localStorage.getItem(key);
187
- if (data && (data.startsWith('{') || data.startsWith('['))) {
188
- data = JSON.parse(data);
189
- }
190
- return data;
191
- };
192
- /**
193
- *
194
- * @param key 关键字,不传清除所有
195
- * @param session 是否session storage , 默认 localStorage
196
- */
197
- export var clearCache = function clearCache(key) {
198
- var session = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
199
- if (key) {
200
- if (session) {
201
- sessionStorage.removeItem(key);
202
- } else {
203
- localStorage.removeItem(key);
204
- }
205
- } else {
206
- if (session) {
207
- sessionStorage.clear();
208
- } else {
209
- localStorage.clear();
210
- }
211
- }
212
- };
213
- _message.config({
214
- maxCount: 1
215
- });
216
- /** @name 显示错误 */
217
- export var showError = function showError(text) {
218
- var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 4;
219
- _message.error({
220
- content: text,
221
- duration: duration,
222
- getPopupContainer: function getPopupContainer(e) {
223
- return getFullScreenElement() || document.body;
224
- }
225
- });
226
- };
227
- /** @name 显示警示 */
228
- export var showWarn = function showWarn(text) {
229
- var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;
230
- _message.warn({
231
- content: text,
232
- duration: duration,
233
- getPopupContainer: function getPopupContainer(e) {
234
- return getFullScreenElement() || document.body;
235
- }
236
- });
237
- };
238
- /** @name 显示成功 */
239
- export var showSuccess = function showSuccess(text) {
240
- var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;
241
- _message.success({
242
- content: text,
243
- duration: duration,
244
- getPopupContainer: function getPopupContainer(e) {
245
- return getFullScreenElement() || document.body;
246
- }
247
- });
248
- };
249
- /**
250
- * 弹框提示
251
- * @param text 提示信息
252
- * @param title 标题,默认 系统提示
253
- * @param type 类型
254
- * @param opts 附加参数
255
- * @returns Promise<Boolean>
256
- */
257
- export var showAlert = function showAlert(text) {
258
- var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '系统提示';
259
- var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'error';
260
- var opts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
261
- return new Promise(function (resolve, reject) {
262
- _Modal[type](_objectSpread({
263
- content: text,
264
- title: title,
265
- getContainer: getFullScreenElement() || document.body,
266
- onOk: function onOk() {
267
- resolve(true);
268
- },
269
- onCancel: function onCancel() {
270
- reject(false);
271
- }
272
- }, opts));
273
- });
274
- };
275
- export var httpError = function httpError(retMsg, retCode, faultCode) {
276
- var opts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
277
- var msg = /*#__PURE__*/React.createElement(React.Fragment, null, "\u9519\u8BEF\u539F\u56E0:", /*#__PURE__*/React.createElement("b", null, retMsg), /*#__PURE__*/React.createElement("br", null), "\u9519\u8BEF\u7801:", /*#__PURE__*/React.createElement("b", null, retCode), /*#__PURE__*/React.createElement("br", null), "\u6545\u969C\u7801:", /*#__PURE__*/React.createElement("b", null, faultCode));
278
- return showAlert(msg, '请求接口出错', 'error', opts);
279
- };
280
- export var exitAlert = function exitAlert() {
281
- _Modal.destroyAll();
282
- };
283
- /** @name 显示确认 */
284
- export var showConfirm = function showConfirm(text) {
285
- var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '系统提示';
286
- return new Promise(function (resolve, reject) {
287
- _Modal.confirm({
288
- title: title,
289
- content: text,
290
- icon: /*#__PURE__*/React.createElement(QuestionCircleOutlined, null),
291
- okType: 'danger',
292
- closable: true,
293
- getContainer: getFullScreenElement() || document.body,
294
- onOk: function onOk() {
295
- resolve(true);
296
- },
297
- onCancel: function onCancel() {
298
- reject(false);
299
- }
300
- });
301
- });
302
- };
303
- var timeout = false;
304
- /**
305
- * token过期重新登录
306
- * @returns
307
- */
308
- export var reLogin = function reLogin() {
309
- if (timeout) return;
310
- timeout = true;
311
- _Modal.warning({
312
- title: '登录状态已过期,请重新登录',
313
- okText: '重新登录',
314
- maskClosable: false,
315
- afterClose: function afterClose() {
316
- timeout = false;
317
- location.href = location.pathname === '/' ? '/login' : '/login?redirect=' + encodeURIComponent(location.href);
318
- }
319
- });
320
- };
321
- /**
322
- * 日期组选择转换
323
- * @param values 选择的值
324
- * @param startField 第一个字段
325
- * @param endField 第二个字段
326
- * @param endSuffix
327
- * @returns
328
- */
329
- export var rangeToSearch = function rangeToSearch(values, startField, endField) {
330
- var endSuffix = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
331
- var startSuffex = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
332
- var data = {};
333
- if (Array.isArray(values) && values[0]) {
334
- data[startField] = values[0] + startSuffex;
335
- }
336
- if (Array.isArray(values) && values[1]) {
337
- data[endField] = values[1] + endSuffix;
338
- }
339
- return data;
340
- };
341
- /** @name 状态列表 */
342
- export var statusList = [{
343
- value: 1,
344
- text: '启用',
345
- label: '1→启用'
346
- }, {
347
- value: 0,
348
- text: '禁用',
349
- label: '0→禁用'
350
- }];
351
- /** @name 是否列表 */
352
- export var yesnoList = [{
353
- value: 1,
354
- text: '是',
355
- label: '1→是'
356
- }, {
357
- value: 0,
358
- text: '否',
359
- label: '0→否'
360
- }];
361
- /**
362
- * 遍历树
363
- * @param list 树对象
364
- * @param fn 回调函数
365
- * @param children 树属性字段
366
- */
367
- export var treeEach = function treeEach(list, fn) {
368
- var children = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "children";
369
- list.forEach(function (item, index) {
370
- fn(item, index, list);
371
- // @ts-ignore
372
- if (Array.isArray(item[children]) && item[children].length) {
373
- // @ts-ignore
374
- treeEach(item[children], fn, children);
375
- }
376
- });
377
- };
378
- /**
379
- * 查询数
380
- * @param list 树对象
381
- * @param key 查询属性
382
- * @param val 查询值
383
- * @param children 树属性字段
384
- * @returns 返回符合条件的第一条对象
385
- */
386
- export var treeFind = function treeFind(list, key, val) {
387
- var children = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "children";
388
- var item = null;
389
- var _iterator = _createForOfIteratorHelper(list),
390
- _step;
391
- try {
392
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
393
- var row = _step.value;
394
- if (row[key] === val) {
395
- item = row;
396
- break;
397
- } else if (row[children] && row[children].length) {
398
- item = treeFind(row[children], key, val);
399
- if (item) {
400
- break;
401
- }
402
- }
403
- }
404
- } catch (err) {
405
- _iterator.e(err);
406
- } finally {
407
- _iterator.f();
408
- }
409
- return item;
410
- };
411
- /**
412
- * 处理普通的尺码横排
413
- * @param orgSizeHeader 后端返回的原始尺码组表头
414
- * @param typeWidth 尺码组宽 sizeTypeNo,默认120
415
- * @param sizeWidth 尺码宽f1~f100, 默认100
416
- * @returns 返回已处理好的表头[{dataIndex:sizeTypeNo,title:'国标码',width:120,children[...]},{dataIndex:'f1',...}...]
417
- */
418
- export var handleSizeCols = function handleSizeCols(orgSizeHeader) {
419
- var typeWidth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 120;
420
- var sizeWidth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 100;
421
- // f1~f100 当所有尺码组都为null时,删除不需要的尺码。
422
- var arr = orgSizeHeader.map(function (o) {
423
- var _loop = function _loop(key) {
424
- if (orgSizeHeader.every(function (item) {
425
- return !item['f' + key];
426
- })) {
427
- delete o['f' + key];
428
- }
429
- };
430
- for (var key = 1; key <= 100; key++) {
431
- _loop(key);
432
- }
433
- return o;
434
- });
435
- // 多表头时找到最底层的表头
436
- var findNext = function findNext(item) {
437
- if (item.children.length) {
438
- return findNext(item.children[0]);
439
- }
440
- return item;
441
- };
442
- var headers = []; // 用于保存返回表头
443
- var header; // 用于保存每个配码的表头信息
444
- arr.forEach(function (h, i) {
445
- // 先处理尺码组
446
- header = {
447
- dataIndex: 'sizeTypeNo',
448
- title: h.sizeTypeNo,
449
- width: typeWidth,
450
- ellipsis: true
451
- };
452
- //当返回多个尺码组时,需要用children支持多表头
453
- if (arr.length > i + 1) {
454
- header.children = [];
455
- }
456
- // 第一个尺码组,直接添加,第二个之后,加到上一个的children中。
457
- if (i === 0) {
458
- headers.push(header);
459
- } else {
460
- findNext(headers.find(function (o) {
461
- return o.dataIndex === 'sizeTypeNo';
462
- })).children.push(header);
463
- }
464
- // 处理 f1~f100
465
- var _loop2 = function _loop2(k) {
466
- if (k === 'sizeTypeNo') return "continue";
467
- header = {
468
- dataIndex: k,
469
- title: h[k] || ' ',
470
- width: sizeWidth,
471
- ellipsis: true
472
- };
473
- if (arr.length > i + 1) {
474
- header.children = [];
475
- }
476
- if (i === 0) {
477
- headers.push(header);
478
- } else {
479
- findNext(headers.find(function (o) {
480
- return o.dataIndex === k;
481
- })).children.push(header);
482
- }
483
- };
484
- for (var k in h) {
485
- var _ret = _loop2(k);
486
- if (_ret === "continue") continue;
487
- }
488
- });
489
- return headers;
490
- };
491
- /**
492
- * 绑定事件
493
- * @param eventName 事件名
494
- * @param fn 调用函数
495
- * @param el 源对象,默认为window
496
- */
497
- export var on = function on(eventName, fn, el) {
498
- if (!el) {
499
- el = window;
500
- }
501
- el.addEventListener(eventName, fn);
502
- };
503
- /**
504
- * 解绑事件
505
- * @param eventName 事件名
506
- * @param fn 调用函数
507
- * @param el 源对象,默认为window
508
- */
509
- export var off = function off(eventName, fn, el) {
510
- if (!el) {
511
- el = window;
512
- }
513
- el.removeEventListener(eventName, fn);
514
- };
515
- /**
516
- * 打印预览
517
- * @param templateNo 打印模板编码
518
- * @param reqUrl 业务请求api
519
- * @param bodyParam Post传参数
520
- * @param param get传参数
521
- * @param method 请求方式,默认post
522
- * @returns
523
- */
524
- export var printView = function printView(templateNo, reqUrl) {
525
- var bodyParam = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
526
- var param = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
527
- var method = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'POST';
528
- var printCenterUrl = toGatewayUrl('/petrel-print-center-api/report/remote/print/dataStr');
529
- reqUrl = toGatewayUrl(reqUrl);
530
- if (!reqUrl.includes(location.origin)) {
531
- reqUrl = location.origin + reqUrl;
532
- }
533
- var data = {
534
- templateNo: templateNo,
535
- printType: 1,
536
- reqUrl: reqUrl,
537
- reqMethodType: method,
538
- params: param || {},
539
- body: bodyParam || {}
540
- };
541
- var openWin = window.open();
542
- var formStr = "<form style=\"visibility:hidden;\" method=\"POST\" action=\"".concat(printCenterUrl, "\">\n <input type=\"hidden\" name=\"clientPrintData\" value='").concat(JSON.stringify(data), "' />\n </form>");
543
- openWin.document.body.innerHTML = formStr;
544
- openWin.document.forms[0].submit();
545
- return openWin;
546
- };
547
- /**
548
- * 直接打印
549
- * @param taskName 打印任务名
550
- * @param templateNo 打印模板
551
- * @param reqUrl 业务请求api
552
- * @param bodyParam Post传参数
553
- * @param param get传参数
554
- * @param method 请求方式,默认post
555
- * @returns
556
- */
557
- export var printAsync = function printAsync(taskName, templateNo, reqUrl) {
558
- var bodyParam = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
559
- var param = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : undefined;
560
- var method = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'POST';
561
- var printCenterUrl = toGatewayUrl('/petrel-print-center-api/report/client/print');
562
- if (!printCenterUrl.includes(location.origin)) {
563
- printCenterUrl = location.origin + printCenterUrl;
564
- }
565
- reqUrl = toGatewayUrl(reqUrl);
566
- if (!reqUrl.includes(location.origin)) {
567
- reqUrl = location.origin + reqUrl;
568
- }
569
- var data = {
570
- taskName: taskName,
571
- printReqUrl: printCenterUrl,
572
- bizVO: {
573
- templateNo: templateNo,
574
- printType: 1,
575
- reqUrl: reqUrl,
576
- reqMethodType: method,
577
- params: param || {},
578
- body: bodyParam || {}
579
- },
580
- token: getCache('token') || ''
581
- };
582
- var url = 'http://localhost:10050/client/async/print';
583
- return httpPost(url, data, true, false);
584
- };
585
- export var isDev = location.href.includes("//localhost");
586
- /** @name 用户信息 */
587
- export var getUserInfo = function getUserInfo() {
588
- return getCache('user');
589
- };
590
- /** @name 用户名 */
591
- export var getUserName = function getUserName() {
592
- var _getUserInfo;
593
- return (_getUserInfo = getUserInfo()) === null || _getUserInfo === void 0 ? void 0 : _getUserInfo.userName;
594
- };
595
- /** @name 登录名 */
596
- export var getLoginName = function getLoginName() {
597
- var _getUserInfo2;
598
- return (_getUserInfo2 = getUserInfo()) === null || _getUserInfo2 === void 0 ? void 0 : _getUserInfo2.loginName;
599
- };
600
- /** @name 公司Id */
601
- export var getCompanyId = function getCompanyId() {
602
- var _getUserInfo3;
603
- return (_getUserInfo3 = getUserInfo()) === null || _getUserInfo3 === void 0 ? void 0 : _getUserInfo3.companyId;
604
- };
605
- /** @name 微前端原生路径 */
606
- export var appPath = function appPath() {
607
- var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
608
- // @ts-ignore
609
- if (window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__) {
610
- // @ts-ignore
611
- return window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__;
612
- }
613
- return path ? path : './';
614
- };
615
- /**
616
- * 深度复制对象
617
- * @param obj
618
- * @returns
619
- */
620
- export var deepClone = function deepClone(obj) {
621
- var otype = Object.prototype.toString.call(obj);
622
- var target = obj;
623
- if (otype === '[object Array]') {
624
- target = [];
625
- for (var i = 0; i < obj.length; i++) {
626
- target.push(deepClone(obj[i]));
627
- }
628
- } else if (otype === '[object Object]') {
629
- target = {};
630
- for (var key in obj) {
631
- target[key] = deepClone(obj[key]);
632
- }
633
- }
634
- return target;
635
- };
636
- /**
637
- * 在主工程中打开模块
638
- * @param option {path:模块路由,需要加工程编码, resourceId: 资源Id,两者传一个即可,data:参数}
639
- */
640
- export var openPageInMain = function openPageInMain(option) {
641
- var win = top || window;
642
- win.postMessage({
643
- type: 'openPage',
644
- param: option
645
- });
646
- };
647
- export var showLoading = function showLoading() {
648
- var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '处理中...';
649
- var loading = document.getElementById('myloading');
650
- if (loading) return;
651
- var loadWrapper = document.createElement('div');
652
- loadWrapper.setAttribute("id", "myloading");
653
- ReactDOM.render( /*#__PURE__*/React.createElement(_Spin, {
654
- tip: text
655
- }), loadWrapper);
656
- var pNode = getFullScreenElement() || document.body;
657
- pNode.appendChild(loadWrapper);
658
- };
659
- export var exitLoading = function exitLoading() {
660
- var loading = document.getElementById('myloading');
661
- if (loading) {
662
- var _loading$parentNode;
663
- (_loading$parentNode = loading.parentNode) === null || _loading$parentNode === void 0 ? void 0 : _loading$parentNode.removeChild(loading);
664
- }
665
- };
666
- export var handleTheme = function handleTheme() {
667
- var theme = getCache('theme');
668
- if (theme) {
669
- document.body.classList.add('theme-' + theme);
670
- }
671
- };
@@ -1,3 +0,0 @@
1
- import './common.less';
2
- declare const _default: () => JSX.Element;
3
- export default _default;
Binary file
@@ -1,17 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _react = _interopRequireDefault(require("react"));
9
- require("./common.less");
10
- var _default = function _default() {
11
- return /*#__PURE__*/_react.default.createElement("div", {
12
- className: "page404"
13
- }, /*#__PURE__*/_react.default.createElement("img", {
14
- src: require('./404.jpg')
15
- }), " \u60A8\u8BBF\u95EE\u7684\u8D44\u6E90\u4E0D\u5B58\u5728~~");
16
- };
17
- exports.default = _default;
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import type { CascaderProps } from 'antd';
3
- declare const AreaCascader: React.ForwardRefExoticComponent<CascaderProps<any> & React.RefAttributes<unknown>>;
4
- export default AreaCascader;