|
@@ -179,7 +179,7 @@ export default {
|
|
|
};
|
|
|
|
|
|
option && myChart.setOption(option);
|
|
|
- this.exportCharts();
|
|
|
+ this.exportCharts("left");
|
|
|
},
|
|
|
//初始化echartRight
|
|
|
initEchartRight(transData) {
|
|
@@ -208,46 +208,30 @@ export default {
|
|
|
source: transData.dataset_source
|
|
|
},
|
|
|
series: [{ type: 'bar' }, { type: 'bar' }],
|
|
|
- dataZoom : [
|
|
|
- {
|
|
|
- type: 'slider',
|
|
|
- show: true,
|
|
|
- start: 0,
|
|
|
- end: 100,
|
|
|
- handleSize: 8
|
|
|
- },
|
|
|
- {
|
|
|
- type: 'inside',
|
|
|
- start: 0,
|
|
|
- end: 100
|
|
|
- },
|
|
|
- {
|
|
|
- type: 'slider',
|
|
|
- show: true,
|
|
|
- yAxisIndex: 0,
|
|
|
- filterMode: 'empty',
|
|
|
- width: 12,
|
|
|
- height: '70%',
|
|
|
- handleSize: 8,
|
|
|
- showDataShadow: false,
|
|
|
- left: '93%'
|
|
|
- }
|
|
|
- ]
|
|
|
};
|
|
|
|
|
|
option && myChart.setOption(option);
|
|
|
- this.exportCharts();
|
|
|
+ this.exportCharts("right");
|
|
|
},
|
|
|
//图片转化为文件流
|
|
|
- exportCharts() {
|
|
|
- const leftBase64 = this.leftEchart.getDataURL({
|
|
|
+ exportCharts(markLabel) {
|
|
|
+ if (markLabel == "left") {
|
|
|
+ const leftBase64 = this.leftEchart.getDataURL({
|
|
|
backgroundColor: '#fff'
|
|
|
- })
|
|
|
- const rightBase64 = this.leftEchart.getDataURL({
|
|
|
- backgroundColor: '#fff'
|
|
|
- })
|
|
|
-
|
|
|
- function base642File(dataurl, filename) {
|
|
|
+ })
|
|
|
+ const leftFile = this.base642File(leftBase64, 'left.png');
|
|
|
+ this.leftFile = this.base642File(leftBase64, 'left.png');
|
|
|
+
|
|
|
+ } else {
|
|
|
+ const rightBase64 = this.rightEchart.getDataURL({
|
|
|
+ backgroundColor: '#fff'
|
|
|
+ })
|
|
|
+ const rightFile = this.base642File(rightBase64, 'right.png');
|
|
|
+ this.rightFile = this.base642File(rightBase64, 'right.png');
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ base642File(dataurl, filename) {
|
|
|
var arr = dataurl.split(','),
|
|
|
mime = arr[0].match(/:(.*?);/)[1],
|
|
|
bstr = atob(arr[1]),
|
|
@@ -257,17 +241,6 @@ export default {
|
|
|
u8arr[n] = bstr.charCodeAt(n);
|
|
|
}
|
|
|
return new File([u8arr], filename, { type: mime });
|
|
|
- }
|
|
|
-
|
|
|
- const leftFile = base642File(leftBase64, 'left.png');
|
|
|
- const rightFile = base642File(rightBase64, 'right.png');
|
|
|
-
|
|
|
- this.leftFile = base642File(leftBase64, 'left.png');
|
|
|
- this.rightFile = base642File(rightBase64, 'right.png');
|
|
|
-
|
|
|
- console.log('leftFile : ', leftFile)
|
|
|
- console.log('rightFile : ', rightFile)
|
|
|
-
|
|
|
},
|
|
|
//导出
|
|
|
exportSingle() {
|
|
@@ -315,7 +288,7 @@ export default {
|
|
|
formData.append('token', token);
|
|
|
formData.append('ids', this.stringExpId);
|
|
|
formData.append('pdf_images[0]', this.leftFile);
|
|
|
- formData.append('pdf_images[1]', this.leftFile);
|
|
|
+ formData.append('pdf_images[1]', this.rightFile);
|
|
|
// formData.append('aa', 1);
|
|
|
|
|
|
//发起axios请求
|
|
@@ -326,12 +299,12 @@ export default {
|
|
|
headers:{'Content-Type': 'multipart/form-data'},
|
|
|
data: formData
|
|
|
})
|
|
|
- .then(res=>{
|
|
|
- if (res.code == "1") {
|
|
|
+ .then(res => {
|
|
|
+ let responseMain=res.data
|
|
|
+ if (responseMain.code == "1") {
|
|
|
this.loading = false;
|
|
|
- console.log("77")
|
|
|
- let openLink = window.globalVariables.api + res.data.pdf;
|
|
|
- window.open(openLink, "_blank");
|
|
|
+ let openLink = window.globalVariables.api + responseMain.data.pdf;
|
|
|
+ window.open(openLink, "_blank");
|
|
|
|
|
|
}
|
|
|
})
|