coolcare-lite-scada-component 1.0.70 → 1.0.71
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.
|
@@ -103,7 +103,7 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
|
|
|
103
103
|
/** 下载excel、pdf */
|
|
104
104
|
var downloadExcel = /*#__PURE__*/function () {
|
|
105
105
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
106
|
-
var _form$getFieldsValue, dateRange, interval, res, fileName, blobUrl, link;
|
|
106
|
+
var _form$getFieldsValue, dateRange, interval, res, fileName, blobUrl, link, _e$response, _e$message;
|
|
107
107
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
108
108
|
while (1) switch (_context.prev = _context.next) {
|
|
109
109
|
case 0:
|
|
@@ -134,6 +134,14 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
|
|
|
134
134
|
});
|
|
135
135
|
case 5:
|
|
136
136
|
res = _context.sent;
|
|
137
|
+
if (!(!res || res.size === 0)) {
|
|
138
|
+
_context.next = 10;
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
message.error('服务器返回空文件,请稍后重试');
|
|
142
|
+
setExcelDownloading(false);
|
|
143
|
+
return _context.abrupt("return");
|
|
144
|
+
case 10:
|
|
137
145
|
// 安全的下载方式,避免权限问题
|
|
138
146
|
fileName = "history_".concat(moment(dateRange[0]).format('YYYY-MM-DD HH:mm:ss'), "_").concat(moment(dateRange[1]).format('YYYY-MM-DD HH:mm:ss'), ".zip");
|
|
139
147
|
if (window.navigator && window.navigator.msSaveOrOpenBlob) {
|
|
@@ -163,19 +171,26 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
|
|
|
163
171
|
}, 100);
|
|
164
172
|
}
|
|
165
173
|
setExcelDownloading(false);
|
|
166
|
-
_context.next =
|
|
174
|
+
_context.next = 20;
|
|
167
175
|
break;
|
|
168
|
-
case
|
|
169
|
-
_context.prev =
|
|
176
|
+
case 15:
|
|
177
|
+
_context.prev = 15;
|
|
170
178
|
_context.t0 = _context["catch"](0);
|
|
171
179
|
console.log(_context.t0);
|
|
172
|
-
|
|
180
|
+
// 检查是否是网络错误或API错误
|
|
181
|
+
if (_context.t0 === null || _context.t0 === void 0 ? void 0 : (_e$response = _context.t0.response) === null || _e$response === void 0 ? void 0 : _e$response.status) {
|
|
182
|
+
message.error("\u4E0B\u8F7D\u5931\u8D25: HTTP ".concat(_context.t0.response.status));
|
|
183
|
+
} else if (_context.t0 === null || _context.t0 === void 0 ? void 0 : (_e$message = _context.t0.message) === null || _e$message === void 0 ? void 0 : _e$message.includes('response')) {
|
|
184
|
+
message.error('服务器响应异常,请检查网络连接');
|
|
185
|
+
} else {
|
|
186
|
+
message.error('下载excel失败');
|
|
187
|
+
}
|
|
173
188
|
setExcelDownloading(false);
|
|
174
|
-
case
|
|
189
|
+
case 20:
|
|
175
190
|
case "end":
|
|
176
191
|
return _context.stop();
|
|
177
192
|
}
|
|
178
|
-
}, _callee, null, [[0,
|
|
193
|
+
}, _callee, null, [[0, 15]]);
|
|
179
194
|
}));
|
|
180
195
|
return function downloadExcel() {
|
|
181
196
|
return _ref2.apply(this, arguments);
|
package/es/services/request.js
CHANGED