Browse Source

[修改]预案导入修改两个建筑只导入一个建筑的信息】

tangshan
陈敬瑜 3 years ago
parent
commit
1b9fdd3afd
  1. 9
      src/app/plan-management/create-plan-online-five/create-plan-online-five.component.ts
  2. 1
      src/app/plan-management/entry-plan-look/entry-plan-look.component.html
  3. 34
      src/app/plan-management/entry-plan-look/entry-plan-look.component.ts

9
src/app/plan-management/create-plan-online-five/create-plan-online-five.component.ts

@ -235,7 +235,6 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
})
this.buData = JSON.parse(JSON.stringify(this.buData))
console.log(this.buData)
this.buData[0].forEach((pvalue, pindex, parr) => {
if (parr[pindex].length > 0) {
parr[pindex].forEach((nval, nindex, narr) => {
@ -1700,21 +1699,20 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
fileData
iftrue=false
fileSc(e){
this.clickTitleItem(this.planTemplateData[1])
this.iftrue=true
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
let formData = new FormData()
formData.append("file", e.target.files[0])
console.log(formData)
let type=this.unitData.buildingTypes[0].name=='高层建筑'?1:this.unitData.buildingTypes[0].name=='居民小区'?2:this.unitData.buildingTypes[0].name=='厂房'?3
:(this.unitData.buildingTypes[0].name=='商市场'||this.unitData.buildingTypes[0].name=='医院'||this.unitData.buildingTypes[0].name=='学校'
||this.unitData.buildingTypes[0].name=='宾馆'||this.unitData.buildingTypes[0].name=='娱乐场所'||this.unitData.buildingTypes[0].name=='餐饮业'
||this.unitData.buildingTypes[0].name=='影剧院'||this.unitData.buildingTypes[0].name=='展览建筑'||this.unitData.buildingTypes[0].name=='养老院'
||this.unitData.buildingTypes[0].name=='会议中心')?4:this.unitData.buildingTypes[0].name=='储罐类'?'StorageTankFivePlan':this.unitData.buildingTypes[0].name=='化工生产'?'ChemicalProductionFivePlan':''
/* let fileData={
type:this.unitData.buildingTypes[0].name=='高层建筑'?1:2,
file:formData
} */
this.http.post(`/api/OfficeExtract/ExtractWordPlan?type=${type}`,formData).subscribe((data:any)=>{
console.log(data)
if(data==null){
@ -1729,6 +1727,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
}
this.planTemplateData.forEach((pvalue,pindex,parr) => {
if(parr[1].building==undefined){
this.planTemplateData[index].building = []
if(array[index].groupName==parr[pindex].groupName){
parr[pindex].attribute=array[index].attribute
}

1
src/app/plan-management/entry-plan-look/entry-plan-look.component.html

@ -81,6 +81,7 @@
<th mat-header-cell *matHeaderCellDef>操作</th>
<td mat-cell *matCellDef="let element">
<span (click)="changeName(element)" *ngIf="element.auditStatus==8">改名</span>
<span (click)="upzhuanMb(element)">转在线导入</span>
<span (click)="editPlan(element)"
[ngClass]="{'grey': !(element.auditStatus!='16' && element.auditStatus != '1')}">编辑</span>
<span (click)="lookPlan(element)" *ngIf="element.planType == 2 || element.planType == 16">查看</span>

34
src/app/plan-management/entry-plan-look/entry-plan-look.component.ts

@ -456,12 +456,12 @@ export class EntryPlanLookComponent implements OnInit {
let file = this.download
let fileSize = file.fileLength//下载文件的总大小
let shardSize = 10 * 1024 * 1024 //文件大小是否大于10MB
console.log(file)
if (file && fileSize <= shardSize) { //<=10MB时直接下载
this.downloadisLoading = true
// this.setFileLoading()
this.http.get(`/api/Objects/PlanPlatform/${file.objectName}`, { responseType: 'blob' },).subscribe(data => {
console.log(data)
let url = window.URL.createObjectURL(new Blob([data])); //createObjectURL创建一个下载Blob的url地址
let link = document.createElement("a");
link.style.display = "none";
@ -558,6 +558,36 @@ export class EntryPlanLookComponent implements OnInit {
}
);
}
//上传word转在线编制
async upzhuanMb(element){
console.log(element)
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
let formData = new FormData()
let type=this.unitdata.unittype=='高层建筑'?1:this.unitdata.unittype=='居民小区'?2:this.unitdata.unittype=='厂房'?3
:(this.unitdata.unittype=='商市场'||this.unitdata.unittype=='医院'||this.unitdata.unittype=='学校'
||this.unitdata.unittype=='宾馆'||this.unitdata.unittype=='娱乐场所'||this.unitdata.unittype=='餐饮业'
||this.unitdata.unittype=='影剧院'||this.unitdata.unittype=='展览建筑'||this.unitdata.unittype=='养老院'
||this.unitdata.unittype=='会议中心')?4:this.unitdata.unittype=='储罐类'?'StorageTankFivePlan':this.unitdata.unittype=='化工生产'?'ChemicalProductionFivePlan':''
let file=[]
let fileResult=await new Promise((resolve, reject) => {
this.http.get(`/api/Objects/PlanPlatform/${element}?x-oss-process=image/auto-orient,1`, { responseType: 'blob' }).subscribe((data: any) => {
resolve(data)
})
})
//file.push(fileResult)
console.log(file)
//formData.append('file',file)
/* this.http.post(`/api/OfficeExtract/ExtractWordPlan?type=${type}`,formData).subscribe((data:any)=>{
console.log(data)
if(data==null){
this.snackBar.open('解析失败,请确定好格式再重新上传!', '确定', config);
}else{
console.log(data)
}
}) */
}
}

Loading…
Cancel
Save