Browse Source

数字油站导出基本信息

beijing
陈鹏飞 3 years ago
parent
commit
027d450fbf
  1. 2
      src/app/pages/left-domain/left-domain.component.html
  2. 26
      src/app/pages/left-domain/left-domain.component.ts

2
src/app/pages/left-domain/left-domain.component.html

@ -298,7 +298,7 @@
</div> </div>
<div class="childBottom" *ngIf="beforeFence === 0 && editMode"> <div class="childBottom" *ngIf="beforeFence === 0 && editMode">
<button (click)="editInfo()"><i nz-icon nzType="edit" nzTheme="outline"></i>编辑信息</button> <!-- <button (click)="editInfo()"><i nz-icon nzType="edit" nzTheme="outline"></i>编辑信息</button> -->
<button (click)="deriveExcel()"><i nz-icon nzType="file-excel" nzTheme="outline"></i>导出Excel</button> <button (click)="deriveExcel()"><i nz-icon nzType="file-excel" nzTheme="outline"></i>导出Excel</button>
</div> </div>

26
src/app/pages/left-domain/left-domain.component.ts

@ -509,10 +509,28 @@ export class LeftDomainComponent implements OnInit {
//导出Excel //导出Excel
deriveExcel() { deriveExcel() {
this.originalData = sessionStorage.getItem('userdata') // this.originalData = sessionStorage.getItem('userdata')
let userdata = { organization: PlanComponent.instance.companyData, hideCloseBtn: true } // let userdata = { organization: PlanComponent.instance.companyData, hideCloseBtn: true }
sessionStorage.setItem('userdata', JSON.stringify(userdata)) // sessionStorage.setItem('userdata', JSON.stringify(userdata))
this.isShowBaseDialog = true // this.isShowBaseDialog = true
let threeData = JSON.parse(sessionStorage.getItem('3dSceneData'));
const httpOptions = {
responseType: 'blob' as 'json'
};
this.http.get(`/api/services/app/GasStation/ExportExcelFile?gasStationId=${threeData.id}`, httpOptions).subscribe((data: any) => {
// 文件名中有中文 则对文件名进行转码
const link = document.createElement('a');
const blob = new Blob([data], { type: 'application/vnd.ms-excel' });
link.setAttribute('href', window.URL.createObjectURL(blob));
link.setAttribute('download', threeData.stationName + '基本信息' + '.xls');
link.style.visibility = 'hidden';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
this.message.create('success', '导出成功!');
}, err => {
this.message.create('error', '导出失败!');
})
} }
//关闭 编辑信息/导出Excel 弹窗 //关闭 编辑信息/导出Excel 弹窗

Loading…
Cancel
Save