coolcare-lite-scada-component 1.0.68 → 1.0.69
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.
|
@@ -21,7 +21,7 @@ import { DownHistoryDataToExcelOrPdf, GetPointHistoryData, GetTdIndicatorHistory
|
|
|
21
21
|
import Echarts from "../ECharts";
|
|
22
22
|
import base64ToBlob from "../../utils/dataURItoBlob";
|
|
23
23
|
// @ts-ignore
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
import styles from "./index.css";
|
|
26
26
|
import ModalChoosePoint from "../ModalChoosePoint";
|
|
27
27
|
import { dateDiff } from "../../utils/date";
|
|
@@ -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, blobUrl;
|
|
106
|
+
var _form$getFieldsValue, dateRange, interval, res, blobUrl, link;
|
|
107
107
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
108
108
|
while (1) switch (_context.prev = _context.next) {
|
|
109
109
|
case 0:
|
|
@@ -135,23 +135,28 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
|
|
|
135
135
|
});
|
|
136
136
|
case 6:
|
|
137
137
|
res = _context.sent;
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
138
|
+
blobUrl = window.URL.createObjectURL(res); // 使用原生方式下载,兼容 npm 插件环境
|
|
139
|
+
link = document.createElement('a');
|
|
140
|
+
link.href = blobUrl;
|
|
141
|
+
link.download = "history_".concat(moment(dateRange[0]).format('YYYY-MM-DD HH:mm:ss'), "_").concat(moment(dateRange[1]).format('YYYY-MM-DD HH:mm:ss'), ".zip");
|
|
142
|
+
document.body.appendChild(link);
|
|
143
|
+
link.click();
|
|
144
|
+
document.body.removeChild(link);
|
|
145
|
+
window.URL.revokeObjectURL(blobUrl);
|
|
141
146
|
setExcelDownloading(false);
|
|
142
|
-
_context.next =
|
|
147
|
+
_context.next = 23;
|
|
143
148
|
break;
|
|
144
|
-
case
|
|
145
|
-
_context.prev =
|
|
149
|
+
case 18:
|
|
150
|
+
_context.prev = 18;
|
|
146
151
|
_context.t0 = _context["catch"](0);
|
|
147
152
|
console.log(_context.t0);
|
|
148
153
|
message.error('下载excel失败');
|
|
149
154
|
setExcelDownloading(false);
|
|
150
|
-
case
|
|
155
|
+
case 23:
|
|
151
156
|
case "end":
|
|
152
157
|
return _context.stop();
|
|
153
158
|
}
|
|
154
|
-
}, _callee, null, [[0,
|
|
159
|
+
}, _callee, null, [[0, 18]]);
|
|
155
160
|
}));
|
|
156
161
|
return function downloadExcel() {
|
|
157
162
|
return _ref2.apply(this, arguments);
|
|
@@ -163,9 +168,19 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
|
|
|
163
168
|
var _chart$current, _chart$current$getEch;
|
|
164
169
|
// @ts-ignore
|
|
165
170
|
var _myChart = chart === null || chart === void 0 ? void 0 : (_chart$current = chart.current) === null || _chart$current === void 0 ? void 0 : (_chart$current$getEch = _chart$current.getEchartsInstance) === null || _chart$current$getEch === void 0 ? void 0 : _chart$current$getEch.call(_chart$current);
|
|
166
|
-
|
|
171
|
+
var blob = base64ToBlob(_myChart.getDataURL({
|
|
167
172
|
backgroundColor: '#fff'
|
|
168
|
-
}))
|
|
173
|
+
}));
|
|
174
|
+
var blobUrl = window.URL.createObjectURL(blob);
|
|
175
|
+
|
|
176
|
+
// 使用原生方式下载,兼容 npm 插件环境
|
|
177
|
+
var link = document.createElement('a');
|
|
178
|
+
link.href = blobUrl;
|
|
179
|
+
link.download = 'chart.jpg';
|
|
180
|
+
document.body.appendChild(link);
|
|
181
|
+
link.click();
|
|
182
|
+
document.body.removeChild(link);
|
|
183
|
+
window.URL.revokeObjectURL(blobUrl);
|
|
169
184
|
};
|
|
170
185
|
var closeModal = function closeModal() {
|
|
171
186
|
form.resetFields();
|