ls-pro-common 3.0.30 → 3.0.32

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 (47) hide show
  1. package/dist/common.js +1 -1
  2. package/dist/common.min.js +1 -1
  3. package/es/components/IconBack.d.ts +5 -4
  4. package/es/components/IconBack.js +1 -1
  5. package/es/components/IconBell.d.ts +2 -4
  6. package/es/components/IconBell.js +1 -1
  7. package/es/components/IconQuestion.d.ts +2 -4
  8. package/es/components/IconQuestion.js +1 -1
  9. package/es/components/IconSearch.d.ts +2 -4
  10. package/es/components/IconSearch.js +1 -1
  11. package/es/components/IconText.d.ts +2 -4
  12. package/es/components/IconText.js +1 -1
  13. package/es/utils/index.d.ts +31 -2
  14. package/es/utils/index.js +113 -2
  15. package/lib/components/404.js +7 -15
  16. package/lib/components/AreaCascader.js +23 -32
  17. package/lib/components/AreaCascaderPanel.js +52 -61
  18. package/lib/components/DescritionCard.js +23 -32
  19. package/lib/components/DtlLayout.js +28 -37
  20. package/lib/components/GroupTip.js +11 -19
  21. package/lib/components/IconBack.d.ts +5 -4
  22. package/lib/components/IconBack.js +7 -15
  23. package/lib/components/IconBell.d.ts +2 -4
  24. package/lib/components/IconBell.js +7 -15
  25. package/lib/components/IconQuestion.d.ts +2 -4
  26. package/lib/components/IconQuestion.js +9 -17
  27. package/lib/components/IconSearch.d.ts +2 -4
  28. package/lib/components/IconSearch.js +7 -15
  29. package/lib/components/IconSelector.js +49 -57
  30. package/lib/components/IconText.d.ts +2 -4
  31. package/lib/components/IconText.js +12 -20
  32. package/lib/components/ImageSelector.js +93 -101
  33. package/lib/components/InputMultiLine.js +35 -44
  34. package/lib/components/InputTable.js +71 -80
  35. package/lib/components/Loading.js +11 -19
  36. package/lib/components/Permission.js +7 -15
  37. package/lib/hooks/useDtl/index.js +88 -96
  38. package/lib/hooks/useGetState.js +6 -13
  39. package/lib/hooks/usePermission/index.js +14 -21
  40. package/lib/hooks/useSingle/index.js +74 -82
  41. package/lib/http/index.js +42 -56
  42. package/lib/index.js +26 -207
  43. package/lib/service/BaseService.js +33 -41
  44. package/lib/typing.js +1 -5
  45. package/lib/utils/index.d.ts +31 -2
  46. package/lib/utils/index.js +187 -173
  47. package/package.json +2 -2
@@ -1,77 +1,136 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.dateAdd = exports.clearCache = exports.appPath = void 0;
8
- Object.defineProperty(exports, "dateFormat", {
9
- enumerable: true,
10
- get: function get() {
11
- return _lsProTable.dateFormat;
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 { httpPost } from '../http';
13
+ import React from 'react';
14
+ export { throttle, debounce } from 'lodash';
15
+ /**
16
+ * 获取 url 参数
17
+ * @param name
18
+ * @param url
19
+ * @returns
20
+ */
21
+ export var getUrlQuery = function getUrlQuery(name) {
22
+ var url = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : location.search.slice(1) || '';
23
+ if (!name) return '';
24
+ var reg = new RegExp('(^|[&|?])' + name + '=([^&]*)(&|$)');
25
+ var r = url.match(reg);
26
+ if (r != null) {
27
+ return decodeURIComponent(decodeURI(r[2]));
12
28
  }
13
- });
14
- Object.defineProperty(exports, "debounce", {
15
- enumerable: true,
16
- get: function get() {
17
- return _lodash.debounce;
29
+ return '';
30
+ };
31
+ export var getResourceProps = function getResourceProps(name) {
32
+ if (!name) return '';
33
+ var id = getUrlQuery('resCode');
34
+ var obj;
35
+ // window.lsResourceList 为主工程写入的资源
36
+ // @ts-ignore
37
+ var resList = window.lsResourceList || parent.window.lsResourceList || [];
38
+ if (id) {
39
+ obj = resList.find(function (o) {
40
+ return o.resourceId === id;
41
+ });
42
+ } else if (location.pathname && location.pathname.length > 2) {
43
+ obj = resList.find(function (o) {
44
+ return o.microUrl === location.pathname;
45
+ });
18
46
  }
19
- });
20
- exports.getLoginName = exports.getFullScreenElement = exports.getCookie = exports.getCompanyId = exports.getCacheSessionFirst = exports.getCache = exports.formatMoney = exports.formatDate = exports.exitLoading = exports.exitAlert = exports.deepClone = void 0;
21
- Object.defineProperty(exports, "getResourceProps", {
22
- enumerable: true,
23
- get: function get() {
24
- return _lsProTable.getResourceProps;
47
+ if (!obj) return '';
48
+ return obj[name] || '';
49
+ };
50
+ /**
51
+ * 设置url传参
52
+ * @param {*} url
53
+ * @param {*} keyvals
54
+ * @returns
55
+ */
56
+ export var setUrlQuery = function setUrlQuery(url) {
57
+ var keyvals = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
58
+ var newUrl = url;
59
+ for (var name in keyvals) {
60
+ var reg = new RegExp('(^|[&|?])' + name + '=([^&]*)(|$)');
61
+ var tmp = (newUrl.includes('?') ? '&' : '?') + name + '=' + keyvals[name];
62
+ if (newUrl.match(reg) != null) {
63
+ // @ts-ignore
64
+ newUrl = newUrl.replace(eval(reg), tmp);
65
+ if (!newUrl.includes('?')) {
66
+ newUrl = newUrl.replace('&', '?');
67
+ }
68
+ } else {
69
+ newUrl = newUrl + tmp;
70
+ }
25
71
  }
26
- });
27
- Object.defineProperty(exports, "getUrlQuery", {
28
- enumerable: true,
29
- get: function get() {
30
- return _lsProTable.getUrlQuery;
72
+ return newUrl;
73
+ };
74
+ /**
75
+ * 日期格式化
76
+ * @param dt 日期
77
+ * @param showTime 是否显示时间
78
+ * @returns YYYY-MM-DD
79
+ */
80
+ export var dateFormat = function dateFormat(dt) {
81
+ var showTime = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
82
+ var ct = dt ? dt : new Date(Date.now());
83
+ var str = ct.getFullYear() + '-' + ('' + (ct.getMonth() + 1)).padStart(2, '0') + '-' + ('' + ct.getDate()).padStart(2, '0');
84
+ if (showTime) {
85
+ str += ' ' + (ct.getHours() + '').padStart(2, '0') + ':' + (ct.getMinutes() + '').padStart(2, '0') + ":" + (ct.getSeconds() + '').padStart(2, '0');
31
86
  }
32
- });
33
- exports.setTitle = exports.setCookie = exports.setCache = exports.reLogin = exports.rangeToSearch = exports.printView = exports.printAsync = exports.openPageInMain = exports.on = exports.off = exports.nowAdd = exports.now = exports.isLogin = exports.isDev = exports.httpError = exports.handleTheme = exports.handleSizeCols = exports.getUserName = exports.getUserInfo = void 0;
34
- Object.defineProperty(exports, "setUrlQuery", {
35
- enumerable: true,
36
- get: function get() {
37
- return _lsProTable.setUrlQuery;
87
+ return str;
88
+ };
89
+ /**
90
+ * 给 url 添加网关
91
+ * @param url 原url,以 / 打头
92
+ * @param gatewayKey 设置gateway关键字 默认为 'gateway'
93
+ * @param defGateway 默认网关 ''
94
+ * @returns
95
+ */
96
+ export var toGatewayUrl = function toGatewayUrl(url) {
97
+ var gatewayKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'gateway';
98
+ var defGateway = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
99
+ // 如果url带有名称,不需要设置网关
100
+ if (url.startsWith('http://') || url.startsWith('https://') || url.startsWith('//')) return url;
101
+ // 读取项目的默认网关
102
+ if (!defGateway) {
103
+ // @ts-ignore
104
+ defGateway = window.defaultGateway || '';
38
105
  }
39
- });
40
- exports.statusList = exports.showWarn = exports.showSuccess = exports.showLoading = exports.showError = exports.showConfirm = exports.showAlert = void 0;
41
- Object.defineProperty(exports, "throttle", {
42
- enumerable: true,
43
- get: function get() {
44
- return _lodash.throttle;
106
+ // 取网关的顺序, 1.取url里的传参,2.取资源里的网关, 3. 取项目里设置的默认网关
107
+ var gateway = getUrlQuery(gatewayKey) || getResourceProps(gatewayKey) || defGateway;
108
+ // 如果没有找到网关,直接从项目配置中取网关
109
+ if (!gateway) {
110
+ var projects = JSON.parse(sessionStorage.getItem('lsProjects') || '[]');
111
+ var projectKey = localStorage.getItem("projectId");
112
+ if (projectKey && projects.length) {
113
+ var project = projects.find(function (o) {
114
+ return o.projectId === projectKey;
115
+ });
116
+ if (project) {
117
+ gateway = project.gatewayUrl || '';
118
+ }
119
+ }
45
120
  }
46
- });
47
- Object.defineProperty(exports, "toGatewayUrl", {
48
- enumerable: true,
49
- get: function get() {
50
- return _lsProTable.toGatewayUrl;
121
+ // 网关加上域名,避免多次设置
122
+ if (gateway && !gateway.startsWith("http")) {
123
+ var h = location.origin ? location.origin : "".concat(location.protocol, "//").concat(location.hostname).concat(location.port ? ':' + location.port : '');
124
+ gateway = h + gateway;
51
125
  }
52
- });
53
- exports.yesnoList = exports.treeFind = exports.treeEach = exports.todayAdd = exports.today = void 0;
54
- require("antd/es/spin/style");
55
- var _spin = _interopRequireDefault(require("antd/es/spin"));
56
- var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/createForOfIteratorHelper"));
57
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
58
- require("antd/es/modal/style");
59
- var _modal = _interopRequireDefault(require("antd/es/modal"));
60
- require("antd/es/message/style");
61
- var _message2 = _interopRequireDefault(require("antd/es/message"));
62
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
63
- var _reactDom = _interopRequireDefault(require("react-dom"));
64
- var _icons = require("@ant-design/icons");
65
- var _lsProTable = require("ls-pro-table");
66
- var _http = require("../http");
67
- var _react = _interopRequireDefault(require("react"));
68
- var _lodash = require("lodash");
126
+ return gateway + url;
127
+ };
69
128
  /**
70
129
  * 设置文档title
71
130
  * @param {*} title
72
131
  * @returns
73
132
  */
74
- var setTitle = function setTitle(title) {
133
+ export var setTitle = function setTitle(title) {
75
134
  if (!title) return;
76
135
  document.title = title;
77
136
  };
@@ -81,23 +140,20 @@ var setTitle = function setTitle(title) {
81
140
  * @param showTime 是否显示时间 默认true
82
141
  * @returns YYYY-MM-DD hh:mm:ss
83
142
  */
84
- exports.setTitle = setTitle;
85
- var formatDate = _lsProTable.dateFormat;
143
+ export var formatDate = dateFormat;
86
144
  /**
87
145
  * 返回当前日期
88
146
  * @returns YYYY-MM-DD
89
147
  */
90
- exports.formatDate = formatDate;
91
- var today = function today() {
92
- return (0, _lsProTable.dateFormat)(null, false);
148
+ export var today = function today() {
149
+ return dateFormat(null, false);
93
150
  };
94
151
  /**
95
152
  * 返回当前日期时间
96
153
  * @returns YYYY-MM-DD hh:mm:ss
97
154
  */
98
- exports.today = today;
99
- var now = function now() {
100
- return (0, _lsProTable.dateFormat)(null, true);
155
+ export var now = function now() {
156
+ return dateFormat(null, true);
101
157
  };
102
158
  /**
103
159
  * 时间加减
@@ -107,8 +163,7 @@ var now = function now() {
107
163
  * @param addYear 添加年数,可以负责
108
164
  * @returns YYYY-MM-DD hh:mm:ss
109
165
  */
110
- exports.now = now;
111
- var dateAdd = function dateAdd(dt, addDay) {
166
+ export var dateAdd = function dateAdd(dt, addDay) {
112
167
  var addMonth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
113
168
  var addYear = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
114
169
  if (!dt) {
@@ -123,7 +178,7 @@ var dateAdd = function dateAdd(dt, addDay) {
123
178
  if (addYear) {
124
179
  dt.setFullYear(dt.getFullYear() + addYear);
125
180
  }
126
- return (0, _lsProTable.dateFormat)(dt, true);
181
+ return dateFormat(dt, true);
127
182
  };
128
183
  /**
129
184
  * 当前时间加减
@@ -132,8 +187,7 @@ var dateAdd = function dateAdd(dt, addDay) {
132
187
  * @param addYear 添加年数,可以负责
133
188
  * @returns YYYY-MM-DD hh:mm:ss
134
189
  */
135
- exports.dateAdd = dateAdd;
136
- var nowAdd = function nowAdd(addDay) {
190
+ export var nowAdd = function nowAdd(addDay) {
137
191
  var addMonth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
138
192
  var addYear = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
139
193
  return dateAdd(null, addDay, addMonth, addYear);
@@ -145,8 +199,7 @@ var nowAdd = function nowAdd(addDay) {
145
199
  * @param addYear 添加年数,可以负责
146
200
  * @returns YYYY-MM-DD
147
201
  */
148
- exports.nowAdd = nowAdd;
149
- var todayAdd = function todayAdd(addDay) {
202
+ export var todayAdd = function todayAdd(addDay) {
150
203
  var addMonth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
151
204
  var addYear = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
152
205
  return nowAdd(addDay, addMonth, addYear).split(' ')[0];
@@ -157,8 +210,7 @@ var todayAdd = function todayAdd(addDay) {
157
210
  * @param dec 小数位数,默认为2位小数
158
211
  * @returns xx,xxx.xx
159
212
  */
160
- exports.todayAdd = todayAdd;
161
- var formatMoney = function formatMoney(num) {
213
+ export var formatMoney = function formatMoney(num) {
162
214
  var dec = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
163
215
  if (typeof num !== 'number') {
164
216
  num = Number(num);
@@ -177,8 +229,7 @@ var formatMoney = function formatMoney(num) {
177
229
  * @param {String} name cookie名
178
230
  * @returns
179
231
  */
180
- exports.formatMoney = formatMoney;
181
- var getCookie = function getCookie(name) {
232
+ export var getCookie = function getCookie(name) {
182
233
  var arr;
183
234
  var reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
184
235
  if (arr = document.cookie.match(reg)) return arr[2];else return null;
@@ -189,8 +240,7 @@ var getCookie = function getCookie(name) {
189
240
  * @param {*} value Cookie 值
190
241
  * @param { Number } day 有效天数 默认1天,
191
242
  */
192
- exports.getCookie = getCookie;
193
- var setCookie = function setCookie(key, value) {
243
+ export var setCookie = function setCookie(key, value) {
194
244
  var day = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
195
245
  var sameSite = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
196
246
  if (day !== 0) {
@@ -212,12 +262,10 @@ var setCookie = function setCookie(key, value) {
212
262
  * 判断是否登录
213
263
  * @returns
214
264
  */
215
- exports.setCookie = setCookie;
216
- var isLogin = function isLogin() {
265
+ export var isLogin = function isLogin() {
217
266
  return !!getCookie('online');
218
267
  };
219
- exports.isLogin = isLogin;
220
- var getFullScreenElement = function getFullScreenElement() {
268
+ export var getFullScreenElement = function getFullScreenElement() {
221
269
  //@ts-ignore
222
270
  return document.fullscreenElement || document.mozFullScreenElement || document.msFullScreenElement || document.webkitFullscreenElement || undefined;
223
271
  };
@@ -227,10 +275,9 @@ var getFullScreenElement = function getFullScreenElement() {
227
275
  * @param { Object } data 值
228
276
  * @param { Boolean } session 保存到 sessionStorage 还是 localStorage,默认 localStorage
229
277
  */
230
- exports.getFullScreenElement = getFullScreenElement;
231
- var setCache = function setCache(key, data) {
278
+ export var setCache = function setCache(key, data) {
232
279
  var session = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
233
- if ((0, _typeof2.default)(data) === 'object') {
280
+ if (_typeof(data) === 'object') {
234
281
  data = JSON.stringify(data);
235
282
  }
236
283
  if (session) {
@@ -245,8 +292,7 @@ var setCache = function setCache(key, data) {
245
292
  * @param { boolean } session 从 sessionStorage 取数还是从 localStorage 中取数 默认从 localStorage
246
293
  * @returns 关键字对应的值
247
294
  */
248
- exports.setCache = setCache;
249
- var getCache = function getCache(key) {
295
+ export var getCache = function getCache(key) {
250
296
  var session = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
251
297
  var data = session ? sessionStorage.getItem(key) : localStorage.getItem(key);
252
298
  if (data && (data.startsWith('{') || data.startsWith('['))) {
@@ -259,8 +305,7 @@ var getCache = function getCache(key) {
259
305
  * @param key
260
306
  * @returns
261
307
  */
262
- exports.getCache = getCache;
263
- var getCacheSessionFirst = function getCacheSessionFirst(key) {
308
+ export var getCacheSessionFirst = function getCacheSessionFirst(key) {
264
309
  return getCache(key, true) || getCache(key);
265
310
  };
266
311
  /**
@@ -268,8 +313,7 @@ var getCacheSessionFirst = function getCacheSessionFirst(key) {
268
313
  * @param key 关键字,不传清除所有
269
314
  * @param session 是否session storage , 默认 localStorage
270
315
  */
271
- exports.getCacheSessionFirst = getCacheSessionFirst;
272
- var clearCache = function clearCache(key) {
316
+ export var clearCache = function clearCache(key) {
273
317
  var session = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
274
318
  if (key) {
275
319
  if (session) {
@@ -285,14 +329,13 @@ var clearCache = function clearCache(key) {
285
329
  }
286
330
  }
287
331
  };
288
- exports.clearCache = clearCache;
289
- _message2.default.config({
332
+ _message.config({
290
333
  maxCount: 1
291
334
  });
292
335
  /** @name 显示错误 */
293
- var showError = function showError(text) {
336
+ export var showError = function showError(text) {
294
337
  var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 4;
295
- _message2.default.error({
338
+ _message.error({
296
339
  content: text,
297
340
  duration: duration,
298
341
  getPopupContainer: function getPopupContainer(e) {
@@ -301,10 +344,9 @@ var showError = function showError(text) {
301
344
  });
302
345
  };
303
346
  /** @name 显示警示 */
304
- exports.showError = showError;
305
- var showWarn = function showWarn(text) {
347
+ export var showWarn = function showWarn(text) {
306
348
  var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;
307
- _message2.default.warn({
349
+ _message.warn({
308
350
  content: text,
309
351
  duration: duration,
310
352
  getPopupContainer: function getPopupContainer(e) {
@@ -313,10 +355,9 @@ var showWarn = function showWarn(text) {
313
355
  });
314
356
  };
315
357
  /** @name 显示成功 */
316
- exports.showWarn = showWarn;
317
- var showSuccess = function showSuccess(text) {
358
+ export var showSuccess = function showSuccess(text) {
318
359
  var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;
319
- _message2.default.success({
360
+ _message.success({
320
361
  content: text,
321
362
  duration: duration,
322
363
  getPopupContainer: function getPopupContainer(e) {
@@ -332,13 +373,12 @@ var showSuccess = function showSuccess(text) {
332
373
  * @param opts 附加参数
333
374
  * @returns Promise<Boolean>
334
375
  */
335
- exports.showSuccess = showSuccess;
336
- var showAlert = function showAlert(text) {
376
+ export var showAlert = function showAlert(text) {
337
377
  var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '系统提示';
338
378
  var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'error';
339
379
  var opts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
340
380
  return new Promise(function (resolve, reject) {
341
- _modal.default[type]((0, _objectSpread2.default)({
381
+ _Modal[type](_objectSpread({
342
382
  content: text,
343
383
  title: title,
344
384
  getContainer: getFullScreenElement() || document.body,
@@ -351,25 +391,22 @@ var showAlert = function showAlert(text) {
351
391
  }, opts));
352
392
  });
353
393
  };
354
- exports.showAlert = showAlert;
355
- var httpError = function httpError(retMsg, retCode, faultCode) {
394
+ export var httpError = function httpError(retMsg, retCode, faultCode) {
356
395
  var opts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
357
- var msg = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, "\u9519\u8BEF\u539F\u56E0:", /*#__PURE__*/_react.default.createElement("b", null, retMsg), /*#__PURE__*/_react.default.createElement("br", null), "\u9519\u8BEF\u7801:", /*#__PURE__*/_react.default.createElement("b", null, retCode), /*#__PURE__*/_react.default.createElement("br", null), "\u6545\u969C\u7801:", /*#__PURE__*/_react.default.createElement("b", null, faultCode));
396
+ 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));
358
397
  return showAlert(msg, '请求接口出错', 'error', opts);
359
398
  };
360
- exports.httpError = httpError;
361
- var exitAlert = function exitAlert() {
362
- _modal.default.destroyAll();
399
+ export var exitAlert = function exitAlert() {
400
+ _Modal.destroyAll();
363
401
  };
364
402
  /** @name 显示确认 */
365
- exports.exitAlert = exitAlert;
366
- var showConfirm = function showConfirm(text) {
403
+ export var showConfirm = function showConfirm(text) {
367
404
  var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '系统提示';
368
405
  return new Promise(function (resolve, reject) {
369
- _modal.default.confirm({
406
+ _Modal.confirm({
370
407
  title: title,
371
408
  content: text,
372
- icon: /*#__PURE__*/_react.default.createElement(_icons.QuestionCircleOutlined, null),
409
+ icon: /*#__PURE__*/React.createElement(QuestionCircleOutlined, null),
373
410
  okType: 'danger',
374
411
  closable: true,
375
412
  cancelButtonProps: {
@@ -385,16 +422,15 @@ var showConfirm = function showConfirm(text) {
385
422
  });
386
423
  });
387
424
  };
388
- exports.showConfirm = showConfirm;
389
425
  var timeout = false;
390
426
  /**
391
427
  * token过期重新登录
392
428
  * @returns
393
429
  */
394
- var reLogin = function reLogin() {
430
+ export var reLogin = function reLogin() {
395
431
  if (timeout) return;
396
432
  timeout = true;
397
- _modal.default.warning({
433
+ _Modal.warning({
398
434
  title: '登录状态已过期,请重新登录',
399
435
  okText: '重新登录',
400
436
  maskClosable: false,
@@ -412,8 +448,7 @@ var reLogin = function reLogin() {
412
448
  * @param endSuffix
413
449
  * @returns
414
450
  */
415
- exports.reLogin = reLogin;
416
- var rangeToSearch = function rangeToSearch(values, startField, endField) {
451
+ export var rangeToSearch = function rangeToSearch(values, startField, endField) {
417
452
  var endSuffix = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
418
453
  var startSuffex = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
419
454
  var data = {};
@@ -426,8 +461,7 @@ var rangeToSearch = function rangeToSearch(values, startField, endField) {
426
461
  return data;
427
462
  };
428
463
  /** @name 状态列表 */
429
- exports.rangeToSearch = rangeToSearch;
430
- var statusList = [{
464
+ export var statusList = [{
431
465
  value: 1,
432
466
  text: '启用',
433
467
  label: '1→启用'
@@ -437,8 +471,7 @@ var statusList = [{
437
471
  label: '0→禁用'
438
472
  }];
439
473
  /** @name 是否列表 */
440
- exports.statusList = statusList;
441
- var yesnoList = [{
474
+ export var yesnoList = [{
442
475
  value: 1,
443
476
  text: '是',
444
477
  label: '1→是'
@@ -453,8 +486,7 @@ var yesnoList = [{
453
486
  * @param fn 回调函数
454
487
  * @param children 树属性字段
455
488
  */
456
- exports.yesnoList = yesnoList;
457
- var treeEach = function treeEach(list, fn) {
489
+ export var treeEach = function treeEach(list, fn) {
458
490
  var children = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "children";
459
491
  list.forEach(function (item, index) {
460
492
  fn(item, index, list);
@@ -473,11 +505,10 @@ var treeEach = function treeEach(list, fn) {
473
505
  * @param children 树属性字段
474
506
  * @returns 返回符合条件的第一条对象
475
507
  */
476
- exports.treeEach = treeEach;
477
- var treeFind = function treeFind(list, key, val) {
508
+ export var treeFind = function treeFind(list, key, val) {
478
509
  var children = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "children";
479
510
  var item = null;
480
- var _iterator = (0, _createForOfIteratorHelper2.default)(list),
511
+ var _iterator = _createForOfIteratorHelper(list),
481
512
  _step;
482
513
  try {
483
514
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -506,8 +537,7 @@ var treeFind = function treeFind(list, key, val) {
506
537
  * @param sizeWidth 尺码宽f1~f100, 默认100
507
538
  * @returns 返回已处理好的表头[{dataIndex:sizeTypeNo,title:'国标码',width:120,children[...]},{dataIndex:'f1',...}...]
508
539
  */
509
- exports.treeFind = treeFind;
510
- var handleSizeCols = function handleSizeCols(orgSizeHeader) {
540
+ export var handleSizeCols = function handleSizeCols(orgSizeHeader) {
511
541
  var typeWidth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 120;
512
542
  var sizeWidth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 100;
513
543
  // f1~f100 当所有尺码组都为null时,删除不需要的尺码。
@@ -586,8 +616,7 @@ var handleSizeCols = function handleSizeCols(orgSizeHeader) {
586
616
  * @param fn 调用函数
587
617
  * @param el 源对象,默认为window
588
618
  */
589
- exports.handleSizeCols = handleSizeCols;
590
- var on = function on(eventName, fn, el) {
619
+ export var on = function on(eventName, fn, el) {
591
620
  if (!el) {
592
621
  el = window;
593
622
  }
@@ -599,8 +628,7 @@ var on = function on(eventName, fn, el) {
599
628
  * @param fn 调用函数
600
629
  * @param el 源对象,默认为window
601
630
  */
602
- exports.on = on;
603
- var off = function off(eventName, fn, el) {
631
+ export var off = function off(eventName, fn, el) {
604
632
  if (!el) {
605
633
  el = window;
606
634
  }
@@ -615,13 +643,12 @@ var off = function off(eventName, fn, el) {
615
643
  * @param method 请求方式,默认post
616
644
  * @returns
617
645
  */
618
- exports.off = off;
619
- var printView = function printView(templateNo, reqUrl) {
646
+ export var printView = function printView(templateNo, reqUrl) {
620
647
  var bodyParam = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
621
648
  var param = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
622
649
  var method = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'POST';
623
- var printCenterUrl = (0, _lsProTable.toGatewayUrl)('/petrel-print-center-api/report/remote/print/dataStr');
624
- reqUrl = (0, _lsProTable.toGatewayUrl)(reqUrl);
650
+ var printCenterUrl = toGatewayUrl('/petrel-print-center-api/report/remote/print/dataStr');
651
+ reqUrl = toGatewayUrl(reqUrl);
625
652
  if (!reqUrl.includes(location.origin)) {
626
653
  reqUrl = location.origin + reqUrl;
627
654
  }
@@ -649,16 +676,15 @@ var printView = function printView(templateNo, reqUrl) {
649
676
  * @param method 请求方式,默认post
650
677
  * @returns
651
678
  */
652
- exports.printView = printView;
653
- var printAsync = function printAsync(taskName, templateNo, reqUrl) {
679
+ export var printAsync = function printAsync(taskName, templateNo, reqUrl) {
654
680
  var bodyParam = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
655
681
  var param = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : undefined;
656
682
  var method = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'POST';
657
- var printCenterUrl = (0, _lsProTable.toGatewayUrl)('/petrel-print-center-api/report/client/print');
683
+ var printCenterUrl = toGatewayUrl('/petrel-print-center-api/report/client/print');
658
684
  if (!printCenterUrl.includes(location.origin)) {
659
685
  printCenterUrl = location.origin + printCenterUrl;
660
686
  }
661
- reqUrl = (0, _lsProTable.toGatewayUrl)(reqUrl);
687
+ reqUrl = toGatewayUrl(reqUrl);
662
688
  if (!reqUrl.includes(location.origin)) {
663
689
  reqUrl = location.origin + reqUrl;
664
690
  }
@@ -676,36 +702,30 @@ var printAsync = function printAsync(taskName, templateNo, reqUrl) {
676
702
  token: getCache('token') || ''
677
703
  };
678
704
  var url = 'http://localhost:10050/client/async/print';
679
- return (0, _http.httpPost)(url, data, true, false);
705
+ return httpPost(url, data, true, false);
680
706
  };
681
- exports.printAsync = printAsync;
682
- var isDev = location.href.includes("//localhost");
707
+ export var isDev = location.href.includes("//localhost");
683
708
  /** @name 用户信息 */
684
- exports.isDev = isDev;
685
- var getUserInfo = function getUserInfo() {
709
+ export var getUserInfo = function getUserInfo() {
686
710
  return getCache('user');
687
711
  };
688
712
  /** @name 用户名 */
689
- exports.getUserInfo = getUserInfo;
690
- var getUserName = function getUserName() {
713
+ export var getUserName = function getUserName() {
691
714
  var _getUserInfo;
692
715
  return (_getUserInfo = getUserInfo()) === null || _getUserInfo === void 0 ? void 0 : _getUserInfo.userName;
693
716
  };
694
717
  /** @name 登录名 */
695
- exports.getUserName = getUserName;
696
- var getLoginName = function getLoginName() {
718
+ export var getLoginName = function getLoginName() {
697
719
  var _getUserInfo2;
698
720
  return (_getUserInfo2 = getUserInfo()) === null || _getUserInfo2 === void 0 ? void 0 : _getUserInfo2.loginName;
699
721
  };
700
722
  /** @name 公司Id */
701
- exports.getLoginName = getLoginName;
702
- var getCompanyId = function getCompanyId() {
723
+ export var getCompanyId = function getCompanyId() {
703
724
  var _getUserInfo3;
704
725
  return (_getUserInfo3 = getUserInfo()) === null || _getUserInfo3 === void 0 ? void 0 : _getUserInfo3.companyId;
705
726
  };
706
727
  /** @name 微前端原生路径 */
707
- exports.getCompanyId = getCompanyId;
708
- var appPath = function appPath() {
728
+ export var appPath = function appPath() {
709
729
  var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
710
730
  // @ts-ignore
711
731
  if (window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__) {
@@ -722,8 +742,7 @@ var appPath = function appPath() {
722
742
  * @param obj
723
743
  * @returns
724
744
  */
725
- exports.appPath = appPath;
726
- var deepClone = function deepClone(obj) {
745
+ export var deepClone = function deepClone(obj) {
727
746
  var otype = Object.prototype.toString.call(obj);
728
747
  var target = obj;
729
748
  if (otype === '[object Array]') {
@@ -743,40 +762,35 @@ var deepClone = function deepClone(obj) {
743
762
  * 在主工程中打开模块
744
763
  * @param option {path:模块路由,需要加工程编码, resourceId: 资源Id,两者传一个即可,data:参数}
745
764
  */
746
- exports.deepClone = deepClone;
747
- var openPageInMain = function openPageInMain(option) {
765
+ export var openPageInMain = function openPageInMain(option) {
748
766
  var win = top || window;
749
767
  win.postMessage({
750
768
  type: 'openPage',
751
769
  param: option
752
770
  });
753
771
  };
754
- exports.openPageInMain = openPageInMain;
755
- var showLoading = function showLoading() {
772
+ export var showLoading = function showLoading() {
756
773
  var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '处理中...';
757
774
  var loading = document.getElementById('myloading');
758
775
  if (loading) return;
759
776
  var loadWrapper = document.createElement('div');
760
777
  loadWrapper.setAttribute("id", "myloading");
761
- _reactDom.default.render( /*#__PURE__*/_react.default.createElement(_spin.default, {
778
+ ReactDOM.render( /*#__PURE__*/React.createElement(_Spin, {
762
779
  tip: text
763
780
  }), loadWrapper);
764
781
  var pNode = getFullScreenElement() || document.body;
765
782
  pNode.appendChild(loadWrapper);
766
783
  };
767
- exports.showLoading = showLoading;
768
- var exitLoading = function exitLoading() {
784
+ export var exitLoading = function exitLoading() {
769
785
  var loading = document.getElementById('myloading');
770
786
  if (loading) {
771
787
  var _loading$parentNode;
772
788
  (_loading$parentNode = loading.parentNode) === null || _loading$parentNode === void 0 ? void 0 : _loading$parentNode.removeChild(loading);
773
789
  }
774
790
  };
775
- exports.exitLoading = exitLoading;
776
- var handleTheme = function handleTheme() {
791
+ export var handleTheme = function handleTheme() {
777
792
  var theme = getCache('theme');
778
793
  if (theme) {
779
794
  document.body.classList.add('theme-' + theme);
780
795
  }
781
- };
782
- exports.handleTheme = handleTheme;
796
+ };