ls-pro-common 3.0.12 → 3.0.14
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/README.md +22 -22
- package/dist/common.css +121 -21
- package/dist/common.js +1 -1
- package/dist/common.min.css +121 -21
- package/dist/common.min.js +1 -1
- package/package.json +48 -48
- package/CHANGELOG.md +0 -746
- package/es/components/404.d.ts +0 -3
- package/es/components/404.jpg +0 -0
- package/es/components/404.js +0 -9
- package/es/components/AreaCascader.d.ts +0 -4
- package/es/components/AreaCascader.js +0 -76
- package/es/components/AreaCascaderPanel.d.ts +0 -5
- package/es/components/AreaCascaderPanel.js +0 -230
- package/es/components/DescritionCard.d.ts +0 -11
- package/es/components/DescritionCard.js +0 -79
- package/es/components/DtlLayout.d.ts +0 -44
- package/es/components/DtlLayout.js +0 -115
- package/es/components/GroupTip.d.ts +0 -10
- package/es/components/GroupTip.js +0 -31
- package/es/components/IconBack.d.ts +0 -3
- package/es/components/IconBack.js +0 -20
- package/es/components/IconBell.d.ts +0 -3
- package/es/components/IconBell.js +0 -22
- package/es/components/IconQuestion.d.ts +0 -3
- package/es/components/IconQuestion.js +0 -26
- package/es/components/IconSearch.d.ts +0 -3
- package/es/components/IconSearch.js +0 -22
- package/es/components/IconSelector.d.ts +0 -14
- package/es/components/IconSelector.js +0 -222
- package/es/components/IconText.d.ts +0 -3
- package/es/components/IconText.js +0 -30
- package/es/components/ImageSelector.d.ts +0 -31
- package/es/components/ImageSelector.js +0 -437
- package/es/components/InputMultiLine.d.ts +0 -46
- package/es/components/InputMultiLine.js +0 -139
- package/es/components/InputTable.d.ts +0 -106
- package/es/components/InputTable.js +0 -476
- package/es/components/Loading.d.ts +0 -8
- package/es/components/Loading.js +0 -20
- package/es/components/Permission.d.ts +0 -6
- package/es/components/Permission.js +0 -13
- package/es/components/antd-custom.less +0 -262
- package/es/components/common.less +0 -469
- package/es/hooks/useDtl/index.d.ts +0 -48
- package/es/hooks/useDtl/index.js +0 -949
- package/es/hooks/useGetState.d.ts +0 -1
- package/es/hooks/useGetState.js +0 -17
- package/es/hooks/usePermission/index.d.ts +0 -15
- package/es/hooks/usePermission/index.js +0 -58
- package/es/hooks/useSingle/index.d.ts +0 -55
- package/es/hooks/useSingle/index.js +0 -662
- package/es/http/index.d.ts +0 -53
- package/es/http/index.js +0 -305
- package/es/index.d.ts +0 -32
- package/es/index.js +0 -26
- package/es/service/BaseService.d.ts +0 -24
- package/es/service/BaseService.js +0 -214
- package/es/typing.d.ts +0 -53
- package/es/typing.js +0 -1
- package/es/utils/index.d.ts +0 -258
- package/es/utils/index.js +0 -679
- package/lib/components/404.d.ts +0 -3
- package/lib/components/404.jpg +0 -0
- package/lib/components/404.js +0 -17
- package/lib/components/AreaCascader.d.ts +0 -4
- package/lib/components/AreaCascader.js +0 -85
- package/lib/components/AreaCascaderPanel.d.ts +0 -5
- package/lib/components/AreaCascaderPanel.js +0 -239
- package/lib/components/DescritionCard.d.ts +0 -11
- package/lib/components/DescritionCard.js +0 -88
- package/lib/components/DtlLayout.d.ts +0 -44
- package/lib/components/DtlLayout.js +0 -124
- package/lib/components/GroupTip.d.ts +0 -10
- package/lib/components/GroupTip.js +0 -39
- package/lib/components/IconBack.d.ts +0 -3
- package/lib/components/IconBack.js +0 -28
- package/lib/components/IconBell.d.ts +0 -3
- package/lib/components/IconBell.js +0 -30
- package/lib/components/IconQuestion.d.ts +0 -3
- package/lib/components/IconQuestion.js +0 -34
- package/lib/components/IconSearch.d.ts +0 -3
- package/lib/components/IconSearch.js +0 -30
- package/lib/components/IconSelector.d.ts +0 -14
- package/lib/components/IconSelector.js +0 -230
- package/lib/components/IconText.d.ts +0 -3
- package/lib/components/IconText.js +0 -38
- package/lib/components/ImageSelector.d.ts +0 -31
- package/lib/components/ImageSelector.js +0 -445
- package/lib/components/InputMultiLine.d.ts +0 -46
- package/lib/components/InputMultiLine.js +0 -148
- package/lib/components/InputTable.d.ts +0 -106
- package/lib/components/InputTable.js +0 -485
- package/lib/components/Loading.d.ts +0 -8
- package/lib/components/Loading.js +0 -28
- package/lib/components/Permission.d.ts +0 -6
- package/lib/components/Permission.js +0 -21
- package/lib/components/antd-custom.less +0 -262
- package/lib/components/common.less +0 -469
- package/lib/hooks/useDtl/index.d.ts +0 -48
- package/lib/hooks/useDtl/index.js +0 -957
- package/lib/hooks/useGetState.d.ts +0 -1
- package/lib/hooks/useGetState.js +0 -24
- package/lib/hooks/usePermission/index.d.ts +0 -15
- package/lib/hooks/usePermission/index.js +0 -65
- package/lib/hooks/useSingle/index.d.ts +0 -55
- package/lib/hooks/useSingle/index.js +0 -670
- package/lib/http/index.d.ts +0 -53
- package/lib/http/index.js +0 -319
- package/lib/index.d.ts +0 -32
- package/lib/service/BaseService.d.ts +0 -24
- package/lib/service/BaseService.js +0 -222
- package/lib/typing.d.ts +0 -53
- package/lib/typing.js +0 -5
- package/lib/utils/index.d.ts +0 -258
- package/lib/utils/index.js +0 -776
package/es/utils/index.js
DELETED
|
@@ -1,679 +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
|
-
* 读取本地缓存,优先从sessionStorage 取,取不到时再从 localStorage取
|
|
194
|
-
* @param key
|
|
195
|
-
* @returns
|
|
196
|
-
*/
|
|
197
|
-
export var getCacheSessionFirst = function getCacheSessionFirst(key) {
|
|
198
|
-
return getCache(key, true) || getCache(key);
|
|
199
|
-
};
|
|
200
|
-
/**
|
|
201
|
-
*
|
|
202
|
-
* @param key 关键字,不传清除所有
|
|
203
|
-
* @param session 是否session storage , 默认 localStorage
|
|
204
|
-
*/
|
|
205
|
-
export var clearCache = function clearCache(key) {
|
|
206
|
-
var session = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
207
|
-
if (key) {
|
|
208
|
-
if (session) {
|
|
209
|
-
sessionStorage.removeItem(key);
|
|
210
|
-
} else {
|
|
211
|
-
localStorage.removeItem(key);
|
|
212
|
-
}
|
|
213
|
-
} else {
|
|
214
|
-
if (session) {
|
|
215
|
-
sessionStorage.clear();
|
|
216
|
-
} else {
|
|
217
|
-
localStorage.clear();
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
_message.config({
|
|
222
|
-
maxCount: 1
|
|
223
|
-
});
|
|
224
|
-
/** @name 显示错误 */
|
|
225
|
-
export var showError = function showError(text) {
|
|
226
|
-
var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 4;
|
|
227
|
-
_message.error({
|
|
228
|
-
content: text,
|
|
229
|
-
duration: duration,
|
|
230
|
-
getPopupContainer: function getPopupContainer(e) {
|
|
231
|
-
return getFullScreenElement() || document.body;
|
|
232
|
-
}
|
|
233
|
-
});
|
|
234
|
-
};
|
|
235
|
-
/** @name 显示警示 */
|
|
236
|
-
export var showWarn = function showWarn(text) {
|
|
237
|
-
var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;
|
|
238
|
-
_message.warn({
|
|
239
|
-
content: text,
|
|
240
|
-
duration: duration,
|
|
241
|
-
getPopupContainer: function getPopupContainer(e) {
|
|
242
|
-
return getFullScreenElement() || document.body;
|
|
243
|
-
}
|
|
244
|
-
});
|
|
245
|
-
};
|
|
246
|
-
/** @name 显示成功 */
|
|
247
|
-
export var showSuccess = function showSuccess(text) {
|
|
248
|
-
var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;
|
|
249
|
-
_message.success({
|
|
250
|
-
content: text,
|
|
251
|
-
duration: duration,
|
|
252
|
-
getPopupContainer: function getPopupContainer(e) {
|
|
253
|
-
return getFullScreenElement() || document.body;
|
|
254
|
-
}
|
|
255
|
-
});
|
|
256
|
-
};
|
|
257
|
-
/**
|
|
258
|
-
* 弹框提示
|
|
259
|
-
* @param text 提示信息
|
|
260
|
-
* @param title 标题,默认 系统提示
|
|
261
|
-
* @param type 类型
|
|
262
|
-
* @param opts 附加参数
|
|
263
|
-
* @returns Promise<Boolean>
|
|
264
|
-
*/
|
|
265
|
-
export var showAlert = function showAlert(text) {
|
|
266
|
-
var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '系统提示';
|
|
267
|
-
var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'error';
|
|
268
|
-
var opts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
269
|
-
return new Promise(function (resolve, reject) {
|
|
270
|
-
_Modal[type](_objectSpread({
|
|
271
|
-
content: text,
|
|
272
|
-
title: title,
|
|
273
|
-
getContainer: getFullScreenElement() || document.body,
|
|
274
|
-
onOk: function onOk() {
|
|
275
|
-
resolve(true);
|
|
276
|
-
},
|
|
277
|
-
onCancel: function onCancel() {
|
|
278
|
-
reject(false);
|
|
279
|
-
}
|
|
280
|
-
}, opts));
|
|
281
|
-
});
|
|
282
|
-
};
|
|
283
|
-
export var httpError = function httpError(retMsg, retCode, faultCode) {
|
|
284
|
-
var opts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
285
|
-
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));
|
|
286
|
-
return showAlert(msg, '请求接口出错', 'error', opts);
|
|
287
|
-
};
|
|
288
|
-
export var exitAlert = function exitAlert() {
|
|
289
|
-
_Modal.destroyAll();
|
|
290
|
-
};
|
|
291
|
-
/** @name 显示确认 */
|
|
292
|
-
export var showConfirm = function showConfirm(text) {
|
|
293
|
-
var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '系统提示';
|
|
294
|
-
return new Promise(function (resolve, reject) {
|
|
295
|
-
_Modal.confirm({
|
|
296
|
-
title: title,
|
|
297
|
-
content: text,
|
|
298
|
-
icon: /*#__PURE__*/React.createElement(QuestionCircleOutlined, null),
|
|
299
|
-
okType: 'danger',
|
|
300
|
-
closable: true,
|
|
301
|
-
getContainer: getFullScreenElement() || document.body,
|
|
302
|
-
onOk: function onOk() {
|
|
303
|
-
resolve(true);
|
|
304
|
-
},
|
|
305
|
-
onCancel: function onCancel() {
|
|
306
|
-
reject(false);
|
|
307
|
-
}
|
|
308
|
-
});
|
|
309
|
-
});
|
|
310
|
-
};
|
|
311
|
-
var timeout = false;
|
|
312
|
-
/**
|
|
313
|
-
* token过期重新登录
|
|
314
|
-
* @returns
|
|
315
|
-
*/
|
|
316
|
-
export var reLogin = function reLogin() {
|
|
317
|
-
if (timeout) return;
|
|
318
|
-
timeout = true;
|
|
319
|
-
_Modal.warning({
|
|
320
|
-
title: '登录状态已过期,请重新登录',
|
|
321
|
-
okText: '重新登录',
|
|
322
|
-
maskClosable: false,
|
|
323
|
-
afterClose: function afterClose() {
|
|
324
|
-
timeout = false;
|
|
325
|
-
(window.top || window).location.href = location.pathname === '/' ? '/login' : '/login?redirect=' + encodeURIComponent(location.href);
|
|
326
|
-
}
|
|
327
|
-
});
|
|
328
|
-
};
|
|
329
|
-
/**
|
|
330
|
-
* 日期组选择转换
|
|
331
|
-
* @param values 选择的值
|
|
332
|
-
* @param startField 第一个字段
|
|
333
|
-
* @param endField 第二个字段
|
|
334
|
-
* @param endSuffix
|
|
335
|
-
* @returns
|
|
336
|
-
*/
|
|
337
|
-
export var rangeToSearch = function rangeToSearch(values, startField, endField) {
|
|
338
|
-
var endSuffix = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
|
|
339
|
-
var startSuffex = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
|
|
340
|
-
var data = {};
|
|
341
|
-
if (Array.isArray(values) && values[0]) {
|
|
342
|
-
data[startField] = values[0] + startSuffex;
|
|
343
|
-
}
|
|
344
|
-
if (Array.isArray(values) && values[1]) {
|
|
345
|
-
data[endField] = values[1] + endSuffix;
|
|
346
|
-
}
|
|
347
|
-
return data;
|
|
348
|
-
};
|
|
349
|
-
/** @name 状态列表 */
|
|
350
|
-
export var statusList = [{
|
|
351
|
-
value: 1,
|
|
352
|
-
text: '启用',
|
|
353
|
-
label: '1→启用'
|
|
354
|
-
}, {
|
|
355
|
-
value: 0,
|
|
356
|
-
text: '禁用',
|
|
357
|
-
label: '0→禁用'
|
|
358
|
-
}];
|
|
359
|
-
/** @name 是否列表 */
|
|
360
|
-
export var yesnoList = [{
|
|
361
|
-
value: 1,
|
|
362
|
-
text: '是',
|
|
363
|
-
label: '1→是'
|
|
364
|
-
}, {
|
|
365
|
-
value: 0,
|
|
366
|
-
text: '否',
|
|
367
|
-
label: '0→否'
|
|
368
|
-
}];
|
|
369
|
-
/**
|
|
370
|
-
* 遍历树
|
|
371
|
-
* @param list 树对象
|
|
372
|
-
* @param fn 回调函数
|
|
373
|
-
* @param children 树属性字段
|
|
374
|
-
*/
|
|
375
|
-
export var treeEach = function treeEach(list, fn) {
|
|
376
|
-
var children = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "children";
|
|
377
|
-
list.forEach(function (item, index) {
|
|
378
|
-
fn(item, index, list);
|
|
379
|
-
// @ts-ignore
|
|
380
|
-
if (Array.isArray(item[children]) && item[children].length) {
|
|
381
|
-
// @ts-ignore
|
|
382
|
-
treeEach(item[children], fn, children);
|
|
383
|
-
}
|
|
384
|
-
});
|
|
385
|
-
};
|
|
386
|
-
/**
|
|
387
|
-
* 查询数
|
|
388
|
-
* @param list 树对象
|
|
389
|
-
* @param key 查询属性
|
|
390
|
-
* @param val 查询值
|
|
391
|
-
* @param children 树属性字段
|
|
392
|
-
* @returns 返回符合条件的第一条对象
|
|
393
|
-
*/
|
|
394
|
-
export var treeFind = function treeFind(list, key, val) {
|
|
395
|
-
var children = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "children";
|
|
396
|
-
var item = null;
|
|
397
|
-
var _iterator = _createForOfIteratorHelper(list),
|
|
398
|
-
_step;
|
|
399
|
-
try {
|
|
400
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
401
|
-
var row = _step.value;
|
|
402
|
-
if (row[key] === val) {
|
|
403
|
-
item = row;
|
|
404
|
-
break;
|
|
405
|
-
} else if (row[children] && row[children].length) {
|
|
406
|
-
item = treeFind(row[children], key, val);
|
|
407
|
-
if (item) {
|
|
408
|
-
break;
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
} catch (err) {
|
|
413
|
-
_iterator.e(err);
|
|
414
|
-
} finally {
|
|
415
|
-
_iterator.f();
|
|
416
|
-
}
|
|
417
|
-
return item;
|
|
418
|
-
};
|
|
419
|
-
/**
|
|
420
|
-
* 处理普通的尺码横排
|
|
421
|
-
* @param orgSizeHeader 后端返回的原始尺码组表头
|
|
422
|
-
* @param typeWidth 尺码组宽 sizeTypeNo,默认120
|
|
423
|
-
* @param sizeWidth 尺码宽f1~f100, 默认100
|
|
424
|
-
* @returns 返回已处理好的表头[{dataIndex:sizeTypeNo,title:'国标码',width:120,children[...]},{dataIndex:'f1',...}...]
|
|
425
|
-
*/
|
|
426
|
-
export var handleSizeCols = function handleSizeCols(orgSizeHeader) {
|
|
427
|
-
var typeWidth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 120;
|
|
428
|
-
var sizeWidth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 100;
|
|
429
|
-
// f1~f100 当所有尺码组都为null时,删除不需要的尺码。
|
|
430
|
-
var arr = orgSizeHeader.map(function (o) {
|
|
431
|
-
var _loop = function _loop(key) {
|
|
432
|
-
if (orgSizeHeader.every(function (item) {
|
|
433
|
-
return !item['f' + key];
|
|
434
|
-
})) {
|
|
435
|
-
delete o['f' + key];
|
|
436
|
-
}
|
|
437
|
-
};
|
|
438
|
-
for (var key = 1; key <= 100; key++) {
|
|
439
|
-
_loop(key);
|
|
440
|
-
}
|
|
441
|
-
return o;
|
|
442
|
-
});
|
|
443
|
-
// 多表头时找到最底层的表头
|
|
444
|
-
var findNext = function findNext(item) {
|
|
445
|
-
if (item.children.length) {
|
|
446
|
-
return findNext(item.children[0]);
|
|
447
|
-
}
|
|
448
|
-
return item;
|
|
449
|
-
};
|
|
450
|
-
var headers = []; // 用于保存返回表头
|
|
451
|
-
var header; // 用于保存每个配码的表头信息
|
|
452
|
-
arr.forEach(function (h, i) {
|
|
453
|
-
// 先处理尺码组
|
|
454
|
-
header = {
|
|
455
|
-
dataIndex: 'sizeTypeNo',
|
|
456
|
-
title: h.sizeTypeNo,
|
|
457
|
-
width: typeWidth,
|
|
458
|
-
ellipsis: true
|
|
459
|
-
};
|
|
460
|
-
//当返回多个尺码组时,需要用children支持多表头
|
|
461
|
-
if (arr.length > i + 1) {
|
|
462
|
-
header.children = [];
|
|
463
|
-
}
|
|
464
|
-
// 第一个尺码组,直接添加,第二个之后,加到上一个的children中。
|
|
465
|
-
if (i === 0) {
|
|
466
|
-
headers.push(header);
|
|
467
|
-
} else {
|
|
468
|
-
findNext(headers.find(function (o) {
|
|
469
|
-
return o.dataIndex === 'sizeTypeNo';
|
|
470
|
-
})).children.push(header);
|
|
471
|
-
}
|
|
472
|
-
// 处理 f1~f100
|
|
473
|
-
var _loop2 = function _loop2(k) {
|
|
474
|
-
if (k === 'sizeTypeNo') return "continue";
|
|
475
|
-
header = {
|
|
476
|
-
dataIndex: k,
|
|
477
|
-
title: h[k] || ' ',
|
|
478
|
-
width: sizeWidth,
|
|
479
|
-
ellipsis: true
|
|
480
|
-
};
|
|
481
|
-
if (arr.length > i + 1) {
|
|
482
|
-
header.children = [];
|
|
483
|
-
}
|
|
484
|
-
if (i === 0) {
|
|
485
|
-
headers.push(header);
|
|
486
|
-
} else {
|
|
487
|
-
findNext(headers.find(function (o) {
|
|
488
|
-
return o.dataIndex === k;
|
|
489
|
-
})).children.push(header);
|
|
490
|
-
}
|
|
491
|
-
};
|
|
492
|
-
for (var k in h) {
|
|
493
|
-
var _ret = _loop2(k);
|
|
494
|
-
if (_ret === "continue") continue;
|
|
495
|
-
}
|
|
496
|
-
});
|
|
497
|
-
return headers;
|
|
498
|
-
};
|
|
499
|
-
/**
|
|
500
|
-
* 绑定事件
|
|
501
|
-
* @param eventName 事件名
|
|
502
|
-
* @param fn 调用函数
|
|
503
|
-
* @param el 源对象,默认为window
|
|
504
|
-
*/
|
|
505
|
-
export var on = function on(eventName, fn, el) {
|
|
506
|
-
if (!el) {
|
|
507
|
-
el = window;
|
|
508
|
-
}
|
|
509
|
-
el.addEventListener(eventName, fn);
|
|
510
|
-
};
|
|
511
|
-
/**
|
|
512
|
-
* 解绑事件
|
|
513
|
-
* @param eventName 事件名
|
|
514
|
-
* @param fn 调用函数
|
|
515
|
-
* @param el 源对象,默认为window
|
|
516
|
-
*/
|
|
517
|
-
export var off = function off(eventName, fn, el) {
|
|
518
|
-
if (!el) {
|
|
519
|
-
el = window;
|
|
520
|
-
}
|
|
521
|
-
el.removeEventListener(eventName, fn);
|
|
522
|
-
};
|
|
523
|
-
/**
|
|
524
|
-
* 打印预览
|
|
525
|
-
* @param templateNo 打印模板编码
|
|
526
|
-
* @param reqUrl 业务请求api
|
|
527
|
-
* @param bodyParam Post传参数
|
|
528
|
-
* @param param get传参数
|
|
529
|
-
* @param method 请求方式,默认post
|
|
530
|
-
* @returns
|
|
531
|
-
*/
|
|
532
|
-
export var printView = function printView(templateNo, reqUrl) {
|
|
533
|
-
var bodyParam = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
534
|
-
var param = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
|
|
535
|
-
var method = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'POST';
|
|
536
|
-
var printCenterUrl = toGatewayUrl('/petrel-print-center-api/report/remote/print/dataStr');
|
|
537
|
-
reqUrl = toGatewayUrl(reqUrl);
|
|
538
|
-
if (!reqUrl.includes(location.origin)) {
|
|
539
|
-
reqUrl = location.origin + reqUrl;
|
|
540
|
-
}
|
|
541
|
-
var data = {
|
|
542
|
-
templateNo: templateNo,
|
|
543
|
-
printType: 1,
|
|
544
|
-
reqUrl: reqUrl,
|
|
545
|
-
reqMethodType: method,
|
|
546
|
-
params: param || {},
|
|
547
|
-
body: bodyParam || {}
|
|
548
|
-
};
|
|
549
|
-
var openWin = window.open();
|
|
550
|
-
var formStr = "<form style=\"visibility:hidden;\" method=\"POST\" action=\"".concat(printCenterUrl, "\">\n <input type=\"hidden\" name=\"clientPrintData\" value='").concat(JSON.stringify(data), "' />\n </form>");
|
|
551
|
-
openWin.document.body.innerHTML = formStr;
|
|
552
|
-
openWin.document.forms[0].submit();
|
|
553
|
-
return openWin;
|
|
554
|
-
};
|
|
555
|
-
/**
|
|
556
|
-
* 直接打印
|
|
557
|
-
* @param taskName 打印任务名
|
|
558
|
-
* @param templateNo 打印模板
|
|
559
|
-
* @param reqUrl 业务请求api
|
|
560
|
-
* @param bodyParam Post传参数
|
|
561
|
-
* @param param get传参数
|
|
562
|
-
* @param method 请求方式,默认post
|
|
563
|
-
* @returns
|
|
564
|
-
*/
|
|
565
|
-
export var printAsync = function printAsync(taskName, templateNo, reqUrl) {
|
|
566
|
-
var bodyParam = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
567
|
-
var param = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : undefined;
|
|
568
|
-
var method = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'POST';
|
|
569
|
-
var printCenterUrl = toGatewayUrl('/petrel-print-center-api/report/client/print');
|
|
570
|
-
if (!printCenterUrl.includes(location.origin)) {
|
|
571
|
-
printCenterUrl = location.origin + printCenterUrl;
|
|
572
|
-
}
|
|
573
|
-
reqUrl = toGatewayUrl(reqUrl);
|
|
574
|
-
if (!reqUrl.includes(location.origin)) {
|
|
575
|
-
reqUrl = location.origin + reqUrl;
|
|
576
|
-
}
|
|
577
|
-
var data = {
|
|
578
|
-
taskName: taskName,
|
|
579
|
-
printReqUrl: printCenterUrl,
|
|
580
|
-
bizVO: {
|
|
581
|
-
templateNo: templateNo,
|
|
582
|
-
printType: 1,
|
|
583
|
-
reqUrl: reqUrl,
|
|
584
|
-
reqMethodType: method,
|
|
585
|
-
params: param || {},
|
|
586
|
-
body: bodyParam || {}
|
|
587
|
-
},
|
|
588
|
-
token: getCache('token') || ''
|
|
589
|
-
};
|
|
590
|
-
var url = 'http://localhost:10050/client/async/print';
|
|
591
|
-
return httpPost(url, data, true, false);
|
|
592
|
-
};
|
|
593
|
-
export var isDev = location.href.includes("//localhost");
|
|
594
|
-
/** @name 用户信息 */
|
|
595
|
-
export var getUserInfo = function getUserInfo() {
|
|
596
|
-
return getCache('user');
|
|
597
|
-
};
|
|
598
|
-
/** @name 用户名 */
|
|
599
|
-
export var getUserName = function getUserName() {
|
|
600
|
-
var _getUserInfo;
|
|
601
|
-
return (_getUserInfo = getUserInfo()) === null || _getUserInfo === void 0 ? void 0 : _getUserInfo.userName;
|
|
602
|
-
};
|
|
603
|
-
/** @name 登录名 */
|
|
604
|
-
export var getLoginName = function getLoginName() {
|
|
605
|
-
var _getUserInfo2;
|
|
606
|
-
return (_getUserInfo2 = getUserInfo()) === null || _getUserInfo2 === void 0 ? void 0 : _getUserInfo2.loginName;
|
|
607
|
-
};
|
|
608
|
-
/** @name 公司Id */
|
|
609
|
-
export var getCompanyId = function getCompanyId() {
|
|
610
|
-
var _getUserInfo3;
|
|
611
|
-
return (_getUserInfo3 = getUserInfo()) === null || _getUserInfo3 === void 0 ? void 0 : _getUserInfo3.companyId;
|
|
612
|
-
};
|
|
613
|
-
/** @name 微前端原生路径 */
|
|
614
|
-
export var appPath = function appPath() {
|
|
615
|
-
var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
616
|
-
// @ts-ignore
|
|
617
|
-
if (window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__) {
|
|
618
|
-
// @ts-ignore
|
|
619
|
-
return window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__;
|
|
620
|
-
}
|
|
621
|
-
return path ? path : './';
|
|
622
|
-
};
|
|
623
|
-
/**
|
|
624
|
-
* 深度复制对象
|
|
625
|
-
* @param obj
|
|
626
|
-
* @returns
|
|
627
|
-
*/
|
|
628
|
-
export var deepClone = function deepClone(obj) {
|
|
629
|
-
var otype = Object.prototype.toString.call(obj);
|
|
630
|
-
var target = obj;
|
|
631
|
-
if (otype === '[object Array]') {
|
|
632
|
-
target = [];
|
|
633
|
-
for (var i = 0; i < obj.length; i++) {
|
|
634
|
-
target.push(deepClone(obj[i]));
|
|
635
|
-
}
|
|
636
|
-
} else if (otype === '[object Object]') {
|
|
637
|
-
target = {};
|
|
638
|
-
for (var key in obj) {
|
|
639
|
-
target[key] = deepClone(obj[key]);
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
return target;
|
|
643
|
-
};
|
|
644
|
-
/**
|
|
645
|
-
* 在主工程中打开模块
|
|
646
|
-
* @param option {path:模块路由,需要加工程编码, resourceId: 资源Id,两者传一个即可,data:参数}
|
|
647
|
-
*/
|
|
648
|
-
export var openPageInMain = function openPageInMain(option) {
|
|
649
|
-
var win = top || window;
|
|
650
|
-
win.postMessage({
|
|
651
|
-
type: 'openPage',
|
|
652
|
-
param: option
|
|
653
|
-
});
|
|
654
|
-
};
|
|
655
|
-
export var showLoading = function showLoading() {
|
|
656
|
-
var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '处理中...';
|
|
657
|
-
var loading = document.getElementById('myloading');
|
|
658
|
-
if (loading) return;
|
|
659
|
-
var loadWrapper = document.createElement('div');
|
|
660
|
-
loadWrapper.setAttribute("id", "myloading");
|
|
661
|
-
ReactDOM.render( /*#__PURE__*/React.createElement(_Spin, {
|
|
662
|
-
tip: text
|
|
663
|
-
}), loadWrapper);
|
|
664
|
-
var pNode = getFullScreenElement() || document.body;
|
|
665
|
-
pNode.appendChild(loadWrapper);
|
|
666
|
-
};
|
|
667
|
-
export var exitLoading = function exitLoading() {
|
|
668
|
-
var loading = document.getElementById('myloading');
|
|
669
|
-
if (loading) {
|
|
670
|
-
var _loading$parentNode;
|
|
671
|
-
(_loading$parentNode = loading.parentNode) === null || _loading$parentNode === void 0 ? void 0 : _loading$parentNode.removeChild(loading);
|
|
672
|
-
}
|
|
673
|
-
};
|
|
674
|
-
export var handleTheme = function handleTheme() {
|
|
675
|
-
var theme = getCache('theme');
|
|
676
|
-
if (theme) {
|
|
677
|
-
document.body.classList.add('theme-' + theme);
|
|
678
|
-
}
|
|
679
|
-
};
|
package/lib/components/404.d.ts
DELETED
package/lib/components/404.jpg
DELETED
|
Binary file
|
package/lib/components/404.js
DELETED
|
@@ -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;
|