coolcare-lite-scada-component 4.1.0 → 4.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/app.js +23 -0
- package/es/components/BoxShadowPicker/index.less.d.ts +9 -9
- package/es/components/ColorPicker/util.js +4 -4
- package/es/components/DialogHistory/index.css +22 -0
- package/es/components/DialogHistory/index.js +388 -79
- package/es/components/DialogImagePicker/GroupPanel/index.js +1 -12
- package/es/components/ECharts/index.js +31 -23
- package/es/components/FormBindPoint/FreedomScene.js +181 -11
- package/es/components/FormBindPoint/ProductionOrDeviceScene.js +12 -5
- package/es/components/FormBindPoint/index.js +6 -0
- package/es/components/Icon/index.js +1 -1
- package/es/components/IconFont/index.js +6 -0
- package/es/components/ImageUploader/index.js +8 -7
- package/es/components/ModalChangePointValue.js +272 -0
- package/es/components/ModalChoosePoint/index.js +53 -16
- package/es/components/PointSelect/DeviceIndicatorTable.js +111 -0
- package/es/components/PointSelect/IndicatorSelect.js +182 -0
- package/es/constant.js +2 -2
- package/es/element/BorderBox/util/typings.d.ts +9 -9
- package/es/element/Decoration/util/typings.d.ts +9 -9
- package/es/element/EleFan/Component.js +1 -1
- package/es/element/EleFanBySvg/index.js +3 -3
- package/es/element/EleImage/index.js +1 -1
- package/es/element/ElePointImage/Component.js +30 -41
- package/es/element/ElePointImage/index.js +1 -1
- package/es/element/ElePointValue/Component.js +117 -17
- package/es/element/ElePointValue/PropsSet/StatisticsPropsSet/index.js +6 -0
- package/es/element/ElePointValue/index.css +11 -0
- package/es/element/ElePointValue/index.js +6 -0
- package/es/element/EleShine/Component.js +133 -23
- package/es/element/EleShine/PropsSet/OtherPropsSet/index.js +27 -34
- package/es/element/EleShine/PropsSet/PointAlarmTool.js +99 -0
- package/es/element/EleShine/PropsSet/index.js +9 -1
- package/es/element/EleShine/index.js +2 -1
- package/es/element/EleState/index.js +1 -1
- package/es/element/EleSwitch/Component.js +2 -12
- package/es/element/PipeNodes/NodeBL/index.js +1 -1
- package/es/element/PipeNodes/NodeBR/index.js +1 -1
- package/es/element/PipeNodes/NodeBottom/index.js +1 -1
- package/es/element/PipeNodes/NodeCenter/index.js +1 -1
- package/es/element/PipeNodes/NodeHorizontal/index.js +1 -1
- package/es/element/PipeNodes/NodeLeft/index.js +1 -1
- package/es/element/PipeNodes/NodeRight/index.js +1 -1
- package/es/element/PipeNodes/NodeTL/index.js +1 -1
- package/es/element/PipeNodes/NodeTR/index.js +1 -1
- package/es/element/PipeNodes/NodeTop/index.js +1 -1
- package/es/element/PipeNodes/NodeVertical/index.js +1 -1
- package/es/element/PointCard/PointListCard/Component.js +3 -2
- package/es/element/PointCard/PointListCard/index.js +1 -0
- package/es/element/type.d.ts +4 -6
- package/es/element/utils/getValueByExpression.js +3 -0
- package/es/element/utils/handleEleEvent.js +11 -1
- package/es/element/utils/pointWrite.js +4 -5
- package/es/hooks/usePointWatch.js +1 -1
- package/es/models/useEditor.js +14 -8
- package/es/pages/display/Player/index.js +444 -123
- package/es/pages/display/index.js +2 -2
- package/es/pages/document.ejs +1 -1
- package/es/pages/editor/PanelLeft/BasicShapeList/listData.js +8 -8
- package/es/pages/editor/PanelLeft/BorderBoxEleList/index.less.d.ts +7 -7
- package/es/pages/editor/PanelLeft/DecorationEleList/index.less.d.ts +7 -7
- package/es/pages/editor/PanelLeft/GroupManageDialog/index.js +4 -4
- package/es/pages/editor/PanelLeft/ImgGroup/index.js +1 -12
- package/es/pages/editor/PanelLeft/MetaEleList/listData.js +14 -14
- package/es/pages/editor/PanelLeft/PipeEleList/listData.js +11 -11
- package/es/pages/editor/PanelLeft/PointCardEleList/listData.js +6 -6
- package/es/pages/editor/PanelLeft/RecommendEleList/listData.js +4 -4
- package/es/pages/editor/PanelLeft/index.js +3 -3
- package/es/pages/editor/PanelRight/components/FormLayer/index.js +3 -1
- package/es/pages/editor/PanelRight/index.less.d.ts +7 -7
- package/es/pages/editor/PanelTop/HotKeyDescribe/index.js +1 -1
- package/es/pages/editor/PanelTop/Save/index.js +120 -67
- package/es/pages/editor/index.js +223 -135
- package/es/pages/editor/utils/scadaChangeLog.js +237 -0
- package/es/services/common/Uploader.js +1 -1
- package/es/services/common/typings.d.ts +15 -15
- package/es/services/energy/index.js +56 -0
- package/es/services/gateway/Device.js +22 -0
- package/es/services/gateway/Point.js +46 -25
- package/es/services/gateway/typings.d.ts +3 -0
- package/es/services/master/typings.d.ts +362 -362
- package/es/services/product/typings.d.ts +1045 -1045
- package/es/services/project/typings.d.ts +1609 -1609
- package/es/services/request.js +126 -13
- package/es/shims.x6.d.ts +15 -15
- package/es/typings.d.ts +12 -0
- package/es/utils/auth.js +6 -2
- package/es/utils/cssStyle.js +4 -4
- package/es/utils/dataURItoBlob.js +25 -0
- package/es/utils/date.js +7 -0
- package/es/utils/decomposeMatrix.js +5 -5
- package/es/utils/events.js +3 -3
- package/es/utils/index.js +34 -34
- package/es/utils/pointValueFormat.js +3 -3
- package/package.json +16 -15
- package/es/elementCss.css +0 -19
package/es/services/request.js
CHANGED
|
@@ -9,10 +9,10 @@ function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try {
|
|
|
9
9
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
10
10
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
11
11
|
import { extend } from 'umi-request';
|
|
12
|
-
import { notification } from 'antd';
|
|
12
|
+
import { notification, Modal } from 'antd';
|
|
13
13
|
// eslint-disable-next-line no-unused-vars
|
|
14
14
|
|
|
15
|
-
import { getAccessToken, storeToken } from "../utils/auth";
|
|
15
|
+
import { getAccessToken, getXAccessToken, parseAccessToken, storeToken, goLogin } from "../utils/auth";
|
|
16
16
|
var codeMessage = {
|
|
17
17
|
200: '服务器成功返回请求的数据。',
|
|
18
18
|
201: '新建或修改数据成功。',
|
|
@@ -47,6 +47,24 @@ var errorHandler = function errorHandler(error) {
|
|
|
47
47
|
statusText = response.statusText,
|
|
48
48
|
url = response.url;
|
|
49
49
|
if (status === 401) {
|
|
50
|
+
if (isShowLoginOverdueModal) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
isShowLoginOverdueModal = true;
|
|
54
|
+
Modal.confirm({
|
|
55
|
+
title: '登录过期',
|
|
56
|
+
maskClosable: false,
|
|
57
|
+
closable: false,
|
|
58
|
+
content: '登录时效已过期,请重新登录',
|
|
59
|
+
okText: '重新登录',
|
|
60
|
+
onOk: function onOk() {
|
|
61
|
+
goLogin();
|
|
62
|
+
isShowLoginOverdueModal = false;
|
|
63
|
+
},
|
|
64
|
+
onCancel: function onCancel() {
|
|
65
|
+
isShowLoginOverdueModal = false;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
50
68
|
return;
|
|
51
69
|
}
|
|
52
70
|
var errorText = codeMessage[status] || statusText;
|
|
@@ -74,6 +92,66 @@ export function setRequestENV(env) {
|
|
|
74
92
|
export function setRequrl(val) {
|
|
75
93
|
reqUrl = val;
|
|
76
94
|
}
|
|
95
|
+
var requestPrefixMap = {
|
|
96
|
+
dev: 'https://dev.sinocold.com:30443',
|
|
97
|
+
prod: 'https://iot.sinocold.net',
|
|
98
|
+
staging: 'https://dev.sinocold.com:30443',
|
|
99
|
+
generalfushi: 'https://iot.generalfushi.com'
|
|
100
|
+
};
|
|
101
|
+
var REPEAT_WRITE_REQUEST_INTERVAL = 800;
|
|
102
|
+
var WRITE_REQUEST_METHODS_WITHOUT_POST = ['PUT', 'PATCH', 'DELETE'];
|
|
103
|
+
var POST_WRITE_REQUEST_KEYWORDS = ['add', 'create', 'update', 'edit', 'delete', 'remove', 'save', 'submit', 'bind', 'unbind', 'relevance', 'change', 'import', 'ack', 'treatment', 'clear', 'underedit', 'batch', 'modify'];
|
|
104
|
+
var repeatWriteRequestCache = new Map();
|
|
105
|
+
var isWriteRequest = function isWriteRequest(url, method) {
|
|
106
|
+
var _url$split$0$split$po;
|
|
107
|
+
if (WRITE_REQUEST_METHODS_WITHOUT_POST.includes(method)) {
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
if (method !== 'POST') {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
var actionName = ((_url$split$0$split$po = url.split(/[?#]/)[0].split('/').pop()) === null || _url$split$0$split$po === void 0 ? void 0 : _url$split$0$split$po.toLowerCase()) || '';
|
|
114
|
+
if (/^(get|query|list|page|search|download|export)/.test(actionName)) {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
return POST_WRITE_REQUEST_KEYWORDS.some(function (keyword) {
|
|
118
|
+
return actionName.includes(keyword);
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
var stringifyRequestPayload = function stringifyRequestPayload(payload) {
|
|
122
|
+
if (payload === undefined || payload === null) {
|
|
123
|
+
return '';
|
|
124
|
+
}
|
|
125
|
+
if (typeof payload === 'string') {
|
|
126
|
+
return payload;
|
|
127
|
+
}
|
|
128
|
+
try {
|
|
129
|
+
return JSON.stringify(payload);
|
|
130
|
+
} catch (_unused) {
|
|
131
|
+
return String(payload);
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
var isRepeatWriteRequest = function isRepeatWriteRequest(url, options) {
|
|
135
|
+
var _requestOptions$data;
|
|
136
|
+
var method = (options.method || 'GET').toUpperCase();
|
|
137
|
+
if (!isWriteRequest(url, method)) {
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
var requestOptions = options;
|
|
141
|
+
var requestKey = [method, url, stringifyRequestPayload(requestOptions.params), stringifyRequestPayload((_requestOptions$data = requestOptions.data) !== null && _requestOptions$data !== void 0 ? _requestOptions$data : requestOptions.body)].join('&');
|
|
142
|
+
var now = Date.now();
|
|
143
|
+
var lastRequestTime = repeatWriteRequestCache.get(requestKey);
|
|
144
|
+
if (lastRequestTime && now - lastRequestTime < REPEAT_WRITE_REQUEST_INTERVAL) {
|
|
145
|
+
return true;
|
|
146
|
+
}
|
|
147
|
+
repeatWriteRequestCache.set(requestKey, now);
|
|
148
|
+
setTimeout(function () {
|
|
149
|
+
if (repeatWriteRequestCache.get(requestKey) === now) {
|
|
150
|
+
repeatWriteRequestCache.delete(requestKey);
|
|
151
|
+
}
|
|
152
|
+
}, REPEAT_WRITE_REQUEST_INTERVAL);
|
|
153
|
+
return false;
|
|
154
|
+
};
|
|
77
155
|
var requestClient = extend({
|
|
78
156
|
errorHandler: errorHandler
|
|
79
157
|
});
|
|
@@ -85,7 +163,7 @@ requestClient.use(/*#__PURE__*/function () {
|
|
|
85
163
|
case 0:
|
|
86
164
|
req = ctx.req;
|
|
87
165
|
url = req.url;
|
|
88
|
-
ctx.req.url = "
|
|
166
|
+
ctx.req.url = "".concat(reqUrl ? reqUrl : REACT_APP_PLATFORM && requestPrefixMap[REACT_APP_PLATFORM] ? requestPrefixMap[REACT_APP_PLATFORM] : requestPrefixMap[Request_ENV]).concat(url);
|
|
89
167
|
_context.n = 1;
|
|
90
168
|
return next();
|
|
91
169
|
case 1:
|
|
@@ -101,10 +179,30 @@ requestClient.use(/*#__PURE__*/function () {
|
|
|
101
179
|
// 局部请求拦截器使用
|
|
102
180
|
requestClient.interceptors.request.use(function (url, options) {
|
|
103
181
|
var headers = options.headers;
|
|
182
|
+
if (isRepeatWriteRequest(url, options)) {
|
|
183
|
+
notification.warning({
|
|
184
|
+
message: '操作过于频繁',
|
|
185
|
+
description: '请勿重复提交,请稍后再试。'
|
|
186
|
+
});
|
|
187
|
+
throw new Error('Repeat write request blocked');
|
|
188
|
+
}
|
|
104
189
|
var accessToken = getAccessToken();
|
|
190
|
+
var xAccessToken = getXAccessToken();
|
|
191
|
+
if (!xAccessToken) {
|
|
192
|
+
// 如果 x-access-token 没有的话,直接跳转登录页面
|
|
193
|
+
goLogin();
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// @ts-ignore
|
|
197
|
+
headers.Authorization = "Bearer ".concat(accessToken);
|
|
105
198
|
|
|
106
199
|
// @ts-ignore
|
|
107
200
|
headers.Authorization = "Bearer ".concat(accessToken);
|
|
201
|
+
if (accessToken && parseAccessToken(accessToken).exp * 1000 < Date.now() + 1 * 60 * 1000) {
|
|
202
|
+
// 如果 access-token 的过期时间 < 当前时间 + 1分钟, 说明 token 快过期了, 传 x-access-token 刷新 token
|
|
203
|
+
// @ts-ignore
|
|
204
|
+
headers['X-Authorization'] = "Bearer ".concat(xAccessToken);
|
|
205
|
+
}
|
|
108
206
|
return {
|
|
109
207
|
url: url,
|
|
110
208
|
options: _objectSpread(_objectSpread({}, options), {}, {
|
|
@@ -117,24 +215,39 @@ requestClient.interceptors.request.use(function (url, options) {
|
|
|
117
215
|
|
|
118
216
|
/** 响应拦截器 */
|
|
119
217
|
requestClient.interceptors.response.use(/*#__PURE__*/function () {
|
|
120
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(response) {
|
|
121
|
-
var xAccessToken, accessToken, data, _data$code, errorText;
|
|
218
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(response, options) {
|
|
219
|
+
var _response$headers, _response$headers2, xAccessToken, accessToken, data, _data$code, errorText;
|
|
122
220
|
return _regenerator().w(function (_context2) {
|
|
123
221
|
while (1) switch (_context2.n) {
|
|
124
222
|
case 0:
|
|
223
|
+
if (!(response instanceof Blob)) {
|
|
224
|
+
_context2.n = 1;
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
return _context2.a(2, response);
|
|
228
|
+
case 1:
|
|
125
229
|
if (!(response.status >= 200 && response.status < 300)) {
|
|
126
|
-
_context2.n =
|
|
230
|
+
_context2.n = 5;
|
|
127
231
|
break;
|
|
128
232
|
}
|
|
129
233
|
// 如果 response header 里面有 x-access-token 和 access-token, 那么保存到 cookies 中
|
|
130
|
-
xAccessToken = response.headers.get('x-access-token');
|
|
131
|
-
accessToken = response.headers.get('access-token');
|
|
234
|
+
xAccessToken = (_response$headers = response.headers) === null || _response$headers === void 0 ? void 0 : _response$headers.get('x-access-token');
|
|
235
|
+
accessToken = (_response$headers2 = response.headers) === null || _response$headers2 === void 0 ? void 0 : _response$headers2.get('access-token');
|
|
132
236
|
if (accessToken && xAccessToken) {
|
|
133
237
|
storeToken(accessToken, xAccessToken);
|
|
134
238
|
}
|
|
135
|
-
|
|
239
|
+
if (!(options.responseType === 'blob')) {
|
|
240
|
+
_context2.n = 3;
|
|
241
|
+
break;
|
|
242
|
+
}
|
|
243
|
+
_context2.n = 2;
|
|
244
|
+
return response.blob();
|
|
245
|
+
case 2:
|
|
246
|
+
return _context2.a(2, _context2.v);
|
|
247
|
+
case 3:
|
|
248
|
+
_context2.n = 4;
|
|
136
249
|
return response.clone().json();
|
|
137
|
-
case
|
|
250
|
+
case 4:
|
|
138
251
|
data = _context2.v;
|
|
139
252
|
if (!data.success) {
|
|
140
253
|
if (Object.keys(codeMessage).includes((_data$code = data.code) === null || _data$code === void 0 ? void 0 : _data$code.toString())) {
|
|
@@ -147,16 +260,16 @@ requestClient.interceptors.response.use(/*#__PURE__*/function () {
|
|
|
147
260
|
}
|
|
148
261
|
}
|
|
149
262
|
return _context2.a(2, response);
|
|
150
|
-
case
|
|
263
|
+
case 5:
|
|
151
264
|
throw {
|
|
152
265
|
response: response
|
|
153
266
|
};
|
|
154
|
-
case
|
|
267
|
+
case 6:
|
|
155
268
|
return _context2.a(2);
|
|
156
269
|
}
|
|
157
270
|
}, _callee2);
|
|
158
271
|
}));
|
|
159
|
-
return function (_x3) {
|
|
272
|
+
return function (_x3, _x4) {
|
|
160
273
|
return _ref2.apply(this, arguments);
|
|
161
274
|
};
|
|
162
275
|
}());
|
package/es/shims.x6.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
// // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
|
-
// import '@antv/x6'
|
|
3
|
-
// import '@antv/x6-react-shape'
|
|
4
|
-
|
|
5
|
-
// declare module '@antv/x6' {
|
|
6
|
-
// interface Cell {
|
|
7
|
-
// /** cell 的 tooltip 内容(React 组件) */
|
|
8
|
-
// tooltipContent?: React.FunctionComponent<any>;
|
|
9
|
-
// /** 是否禁用 resize */
|
|
10
|
-
// disableResize?: boolean;
|
|
11
|
-
// }
|
|
12
|
-
// }
|
|
13
|
-
|
|
14
|
-
// declare module '@antv/x6-react-shape' {
|
|
15
|
-
// }
|
|
1
|
+
// // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
|
+
// import '@antv/x6'
|
|
3
|
+
// import '@antv/x6-react-shape'
|
|
4
|
+
|
|
5
|
+
// declare module '@antv/x6' {
|
|
6
|
+
// interface Cell {
|
|
7
|
+
// /** cell 的 tooltip 内容(React 组件) */
|
|
8
|
+
// tooltipContent?: React.FunctionComponent<any>;
|
|
9
|
+
// /** 是否禁用 resize */
|
|
10
|
+
// disableResize?: boolean;
|
|
11
|
+
// }
|
|
12
|
+
// }
|
|
13
|
+
|
|
14
|
+
// declare module '@antv/x6-react-shape' {
|
|
15
|
+
// }
|
package/es/typings.d.ts
CHANGED
|
@@ -59,6 +59,8 @@ type EditorQuery =
|
|
|
59
59
|
companyId: string;
|
|
60
60
|
/** 项目 id */
|
|
61
61
|
projectId?: string;
|
|
62
|
+
// 权限
|
|
63
|
+
premission?: string;
|
|
62
64
|
};
|
|
63
65
|
|
|
64
66
|
type PlayerQuery =
|
|
@@ -142,6 +144,10 @@ type PlayerQuery =
|
|
|
142
144
|
token?: string;
|
|
143
145
|
/** 刷新token */
|
|
144
146
|
xToken?: string;
|
|
147
|
+
/** 项目 id */
|
|
148
|
+
projectId?: string;
|
|
149
|
+
/** 权限 */
|
|
150
|
+
premission: string;
|
|
145
151
|
};
|
|
146
152
|
|
|
147
153
|
type WindowCommunicateMsg =
|
|
@@ -153,6 +159,9 @@ type WindowCommunicateMsg =
|
|
|
153
159
|
productId: number;
|
|
154
160
|
productVersionId?: number;
|
|
155
161
|
scadaType: GatewayAPI.EProductConfigurationType;
|
|
162
|
+
operationUserId?: number;
|
|
163
|
+
configHasChanged?: boolean;
|
|
164
|
+
configChangeLog?: string;
|
|
156
165
|
};
|
|
157
166
|
}
|
|
158
167
|
| {
|
|
@@ -160,6 +169,9 @@ type WindowCommunicateMsg =
|
|
|
160
169
|
event: 'device-scada-config-change';
|
|
161
170
|
payload: {
|
|
162
171
|
deviceId: number;
|
|
172
|
+
operationUserId?: number;
|
|
173
|
+
configHasChanged?: boolean;
|
|
174
|
+
configChangeLog?: string;
|
|
163
175
|
};
|
|
164
176
|
}
|
|
165
177
|
| {
|
package/es/utils/auth.js
CHANGED
|
@@ -43,14 +43,18 @@ export function parseAccessToken(token) {
|
|
|
43
43
|
* @param xAccessToken x-access-token
|
|
44
44
|
*/
|
|
45
45
|
export function storeToken(accessToken, xAccessToken) {
|
|
46
|
+
/** x-access-token 有效时长(单位:天) */
|
|
47
|
+
var xAccessTokenExpires = parseAccessToken(xAccessToken).exp * 1000;
|
|
46
48
|
// 将 access-token 保存到 cookie
|
|
47
49
|
Cookies.set(accessTokenCookieName, accessToken || '', {
|
|
48
|
-
domain: '
|
|
50
|
+
domain: rootDomainMap['prod'],
|
|
51
|
+
expires: new Date(xAccessTokenExpires)
|
|
49
52
|
});
|
|
50
53
|
|
|
51
54
|
// 将 x-access-token 保存到 cookie
|
|
52
55
|
Cookies.set(xAccessTokenCookieName, xAccessToken || '', {
|
|
53
|
-
domain: '
|
|
56
|
+
domain: rootDomainMap['prod'],
|
|
57
|
+
expires: new Date(xAccessTokenExpires)
|
|
54
58
|
});
|
|
55
59
|
}
|
|
56
60
|
export function storeAccessToken(token) {
|
package/es/utils/cssStyle.js
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export default function dataURItoBlob(dataURI) {
|
|
2
|
+
// convert base64 to raw binary data held in a string
|
|
3
|
+
// doesn't handle URLEncoded DataURIs - see SO answer #6850276 for code that does this
|
|
4
|
+
var byteString = atob(dataURI.split(',')[1]);
|
|
5
|
+
|
|
6
|
+
// separate out the mime component
|
|
7
|
+
var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
|
|
8
|
+
|
|
9
|
+
// write the bytes of the string to an ArrayBuffer
|
|
10
|
+
var ab = new ArrayBuffer(byteString.length);
|
|
11
|
+
|
|
12
|
+
// create a view into the buffer
|
|
13
|
+
var ia = new Uint8Array(ab);
|
|
14
|
+
|
|
15
|
+
// set the bytes of the buffer to the correct values
|
|
16
|
+
for (var i = 0; i < byteString.length; i += 1) {
|
|
17
|
+
ia[i] = byteString.charCodeAt(i);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// write the ArrayBuffer to a blob, and you're done
|
|
21
|
+
var blob = new Blob([ab], {
|
|
22
|
+
type: mimeString
|
|
23
|
+
});
|
|
24
|
+
return blob;
|
|
25
|
+
}
|
package/es/utils/date.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export function dateDiff(str, end) {
|
|
2
|
+
var diff = (new Date(end).getTime() - new Date(str).getTime()) / 1000;
|
|
3
|
+
var d = Math.floor(diff / (60 * 60 * 24));
|
|
4
|
+
var h = Math.floor(diff % (60 * 60 * 24) / 60 / 60);
|
|
5
|
+
var m = Math.floor(diff % (60 * 60) / 60);
|
|
6
|
+
return "".concat(d ? "".concat(d, "\u5929") : '').concat(h ? "".concat(h, "\u5C0F\u65F6") : '', "".concat(m, "\u5206\u949F"));
|
|
7
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
var degrees = 180 / Math.PI;
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* 将 matrix 分解成 translate scale skew rotate
|
|
5
|
-
* https:// github.com/d3/d3-interpolate/blob/main/src/transform/decompose.js#L12-L25
|
|
6
|
-
* @param matrix
|
|
7
|
-
* @returns
|
|
3
|
+
/**
|
|
4
|
+
* 将 matrix 分解成 translate scale skew rotate
|
|
5
|
+
* https:// github.com/d3/d3-interpolate/blob/main/src/transform/decompose.js#L12-L25
|
|
6
|
+
* @param matrix
|
|
7
|
+
* @returns
|
|
8
8
|
*/
|
|
9
9
|
export default function decompose(matrix) {
|
|
10
10
|
var a = matrix.a,
|
package/es/utils/events.js
CHANGED
package/es/utils/index.js
CHANGED
|
@@ -7,11 +7,11 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
|
7
7
|
export * from "./type";
|
|
8
8
|
export * from "./getMittMeta";
|
|
9
9
|
export { default as queryToObject } from "./queryToObject";
|
|
10
|
-
/**
|
|
11
|
-
* 交换数组元素
|
|
12
|
-
* @param arr 数组
|
|
13
|
-
* @param index1 元素下标1
|
|
14
|
-
* @param index2 元素下标2
|
|
10
|
+
/**
|
|
11
|
+
* 交换数组元素
|
|
12
|
+
* @param arr 数组
|
|
13
|
+
* @param index1 元素下标1
|
|
14
|
+
* @param index2 元素下标2
|
|
15
15
|
*/
|
|
16
16
|
export function arrayEleSwap(arr, index1, index2) {
|
|
17
17
|
var temp = arr[index1];
|
|
@@ -19,10 +19,10 @@ export function arrayEleSwap(arr, index1, index2) {
|
|
|
19
19
|
arr[index2] = temp;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
/**
|
|
23
|
-
* 计算鼠标相对事件触发的 currentTarget 元素的相对位置
|
|
24
|
-
* @param e
|
|
25
|
-
* @returns { x: number; y: number }
|
|
22
|
+
/**
|
|
23
|
+
* 计算鼠标相对事件触发的 currentTarget 元素的相对位置
|
|
24
|
+
* @param e
|
|
25
|
+
* @returns { x: number; y: number }
|
|
26
26
|
*/
|
|
27
27
|
export function calculateMousePosition(e) {
|
|
28
28
|
var currentTarget = e.currentTarget;
|
|
@@ -33,17 +33,17 @@ export function calculateMousePosition(e) {
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
/**
|
|
37
|
-
* 特殊字符转义,防止特殊字符导致json字符串转换成json对象出错
|
|
38
|
-
* @param {*} string
|
|
39
|
-
* @returns string
|
|
36
|
+
/**
|
|
37
|
+
* 特殊字符转义,防止特殊字符导致json字符串转换成json对象出错
|
|
38
|
+
* @param {*} string
|
|
39
|
+
* @returns string
|
|
40
40
|
*/
|
|
41
41
|
export var transSpecialChar = function transSpecialChar(string) {
|
|
42
42
|
return string.replace(/>/g, '>').replace(/</g, '<').replace(/ /g, ' ').replace(/(")+/g, '"').replace(/'/g, ''').replace(/\r/g, '\\r').replace(/\n/g, '\\n').replace(/\t/g, '\\t').replace(/\\/g, '\\\\');
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
/**
|
|
46
|
-
* 判断电脑是 window 还是 mac
|
|
45
|
+
/**
|
|
46
|
+
* 判断电脑是 window 还是 mac
|
|
47
47
|
*/
|
|
48
48
|
export function getOS() {
|
|
49
49
|
var agent = navigator.userAgent.toLowerCase();
|
|
@@ -60,12 +60,12 @@ export function getOS() {
|
|
|
60
60
|
return 'window';
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
/**
|
|
64
|
-
* 生成随机字符串
|
|
65
|
-
*
|
|
66
|
-
* @param {*} length 指定长度
|
|
67
|
-
* @param {*} chars 字符集
|
|
68
|
-
* @returns
|
|
63
|
+
/**
|
|
64
|
+
* 生成随机字符串
|
|
65
|
+
*
|
|
66
|
+
* @param {*} length 指定长度
|
|
67
|
+
* @param {*} chars 字符集
|
|
68
|
+
* @returns
|
|
69
69
|
*/
|
|
70
70
|
export function randomString(length) {
|
|
71
71
|
var chars = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
@@ -76,11 +76,11 @@ export function randomString(length) {
|
|
|
76
76
|
return result;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
/**
|
|
80
|
-
* 生成指定范围的随机数
|
|
81
|
-
* @param minNum 最小值
|
|
82
|
-
* @param maxNum 最大值
|
|
83
|
-
* @returns
|
|
79
|
+
/**
|
|
80
|
+
* 生成指定范围的随机数
|
|
81
|
+
* @param minNum 最小值
|
|
82
|
+
* @param maxNum 最大值
|
|
83
|
+
* @returns
|
|
84
84
|
*/
|
|
85
85
|
export function randomExtend(minNum, maxNum) {
|
|
86
86
|
if (maxNum === undefined) {
|
|
@@ -89,11 +89,11 @@ export function randomExtend(minNum, maxNum) {
|
|
|
89
89
|
return Math.floor(Math.random() * (maxNum - minNum + 1) + minNum);
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
/**
|
|
93
|
-
* 给 canvas 添加水印
|
|
94
|
-
* @param canvas canvas 对象
|
|
95
|
-
* @param text 水印字体
|
|
96
|
-
* @returns canvas
|
|
92
|
+
/**
|
|
93
|
+
* 给 canvas 添加水印
|
|
94
|
+
* @param canvas canvas 对象
|
|
95
|
+
* @param text 水印字体
|
|
96
|
+
* @returns canvas
|
|
97
97
|
*/
|
|
98
98
|
export function waterMark(canvas, text) {
|
|
99
99
|
var ctx = canvas.getContext('2d');
|
|
@@ -139,9 +139,9 @@ export function pointValueFormat(expressions, value) {
|
|
|
139
139
|
return '-';
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
-
/**
|
|
143
|
-
* 从点位 id 中获取产品编号、设备编号、标识符
|
|
144
|
-
* @param {string} pointId - The point ID of the point you want to get the info from.
|
|
142
|
+
/**
|
|
143
|
+
* 从点位 id 中获取产品编号、设备编号、标识符
|
|
144
|
+
* @param {string} pointId - The point ID of the point you want to get the info from.
|
|
145
145
|
*/
|
|
146
146
|
export function getInfoFromPointId(pointId) {
|
|
147
147
|
if (!pointId) {
|
package/package.json
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "coolcare-lite-scada-component",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.2",
|
|
4
4
|
"scripts": {
|
|
5
|
-
"start": " umi dev",
|
|
6
|
-
"build:prod": "UMI_ENV=prod umi build",
|
|
7
|
-
"build:
|
|
8
|
-
"build:
|
|
5
|
+
"start": "cross-env PORT=8000 UMI_ENV=prod umi dev",
|
|
6
|
+
"build:prod": "cross-env UMI_ENV=prod umi build",
|
|
7
|
+
"build:generalfushi": "cross-env UMI_ENV=prod REACT_APP_PLATFORM=generalfushi umi build",
|
|
8
|
+
"build:yimin": "cross-env UMI_ENV=prod REACT_APP_PLATFORM=yimin umi build",
|
|
9
|
+
"build:staging": "cross-env UMI_ENV=staging umi build",
|
|
9
10
|
"build:component": "father build",
|
|
10
|
-
"postinstall": "umi generate tmp",
|
|
11
11
|
"prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'",
|
|
12
12
|
"test": "umi-test",
|
|
13
13
|
"test:coverage": "umi-test --coverage",
|
|
14
|
-
"analyze": "ANALYZE=1 umi build"
|
|
15
|
-
"deploy:prod": "docker build -t xiiman-docker.pkg.coding.net/coolcare-lite/coolcare-scada/yiwei:master-2025-4-23-3 . && docker push xiiman-docker.pkg.coding.net/coolcare-lite/coolcare-scada/yiwei:master-2025-4-23-3",
|
|
16
|
-
"publish:component": "yarn build:component && npm publish"
|
|
14
|
+
"analyze": "cross-env ANALYZE=1 umi build"
|
|
17
15
|
},
|
|
18
16
|
"main": "./es/componentIndex.js",
|
|
19
17
|
"module": "./es/componentIndex.js",
|
|
@@ -24,6 +22,7 @@
|
|
|
24
22
|
"publishConfig": {
|
|
25
23
|
"registry": "https://registry.npmjs.org/"
|
|
26
24
|
},
|
|
25
|
+
"packageManager": "yarn@1.22.22",
|
|
27
26
|
"gitHooks": {
|
|
28
27
|
"pre-commit": "lint-staged"
|
|
29
28
|
},
|
|
@@ -37,10 +36,10 @@
|
|
|
37
36
|
},
|
|
38
37
|
"peerDependencies": {
|
|
39
38
|
"antd": "*",
|
|
39
|
+
"moment": "*",
|
|
40
40
|
"react": "*",
|
|
41
41
|
"react-dom": "*",
|
|
42
|
-
"umi": "*"
|
|
43
|
-
"moment": "*"
|
|
42
|
+
"umi": "*"
|
|
44
43
|
},
|
|
45
44
|
"dependencies": {
|
|
46
45
|
"@ant-design/icons": "^4.6.3",
|
|
@@ -49,19 +48,20 @@
|
|
|
49
48
|
"@antv/x6-react-shape": "^1.6.0",
|
|
50
49
|
"@jiaminghi/color": "^0.1.1",
|
|
51
50
|
"ahooks": "^3.7.0",
|
|
52
|
-
"antd": "
|
|
51
|
+
"antd": "4.24.16",
|
|
53
52
|
"array-move": "^4.0.0",
|
|
54
53
|
"classnames": "^2.3.1",
|
|
55
54
|
"dayjs": "^1.10.6",
|
|
56
55
|
"echarts": "^5.2.2",
|
|
56
|
+
"file-saver": "^2.0.5",
|
|
57
57
|
"lodash-es": "^4.17.21",
|
|
58
58
|
"mitt": "^3.0.0",
|
|
59
59
|
"number-precision": "^1.5.1",
|
|
60
|
-
"react": "17.
|
|
60
|
+
"react": "17.0.2",
|
|
61
61
|
"react-color": "^2.19.3",
|
|
62
|
-
"react-dom": "17.
|
|
62
|
+
"react-dom": "17.0.2",
|
|
63
63
|
"react-sortable-hoc": "^2.0.0",
|
|
64
|
-
"umi": "
|
|
64
|
+
"umi": "3.5.43"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@types/js-cookie": "^3.0.1",
|
|
@@ -75,6 +75,7 @@
|
|
|
75
75
|
"antd-dayjs-webpack-plugin": "^1.0.6",
|
|
76
76
|
"babel-plugin-module-resolver": "^4.1.0",
|
|
77
77
|
"babel-plugin-transform-replace-expressions": "^0.2.0",
|
|
78
|
+
"cross-env": "^7.0.3",
|
|
78
79
|
"eslint": "^7.32.0",
|
|
79
80
|
"eslint-plugin-react-hooks": "^4.2.0",
|
|
80
81
|
"father": "^2.30.21",
|
package/es/elementCss.css
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
.big {
|
|
2
|
-
width: 580px !important;
|
|
3
|
-
}
|
|
4
|
-
.big .anticon-exclamation-circle {
|
|
5
|
-
font-size: 44px;
|
|
6
|
-
}
|
|
7
|
-
.big .ant-modal-confirm-title {
|
|
8
|
-
font-size: 64px;
|
|
9
|
-
}
|
|
10
|
-
.big .ant-modal-confirm-content {
|
|
11
|
-
font-size: 48px;
|
|
12
|
-
}
|
|
13
|
-
.big .ant-modal-body {
|
|
14
|
-
padding: 64px 64px 48px;
|
|
15
|
-
}
|
|
16
|
-
.big .ant-btn {
|
|
17
|
-
font-size: 28px !important;
|
|
18
|
-
height: auto !important;
|
|
19
|
-
}
|