Browse Source

[新增]五级高层在线编制上传word对接后端接口

tangshan
陈敬瑜 4 years ago
parent
commit
e37dde65b5
  1. 9
      src/app/plan-management/create-plan-online-five/create-plan-online-five.component.html
  2. 17
      src/app/plan-management/create-plan-online-five/create-plan-online-five.component.scss
  3. 62
      src/app/plan-management/create-plan-online-five/create-plan-online-five.component.ts

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

@ -14,7 +14,7 @@
<button mat-stroked-button *ngIf="zaixianDr" (click)='upload()'>
<mat-icon>cloud_upload</mat-icon> 导入
</button>
<input type="file" style="display: none;" id="up" accept=".docx">
<input type="file" style="display: none;" id="up" accept=".docx" (change)='fileSc($event)'>
<button mat-stroked-button (click)="preview()">
<mat-icon>visibility</mat-icon> 预览
</button>
@ -27,7 +27,9 @@
<mat-icon>visibility</mat-icon> 退出预览
</button>
<div class="contentbox" [ngClass]="{'noPadding': pattern == 'look'}">
<div class="shadow" *ngIf="iftrue">
<mat-spinner></mat-spinner>
</div>
<div class="leftbox"
*ngIf="pattern == 'edit' && (selectedItem == '重点图示' || selectedItem == '交通水源' || selectedItem == '预案附件' || selectedItem == '单位概况')||(selectedItem!='灾情设定'&&selectedItem!='力量调集'&&selectedItem!='组织指挥'&&selectedItem!='作战行动'&&selectedItem!='社会联动'&&selectedItem!='勤务保障'&&selectedItem!='特别警示'&&selectedItem!='辅助决策'&&selectedItem!='处置要点'&&tuTrue)">
<div *ngIf="selectedItem == '重点图示'||(selectedItem!='灾情设定'&&selectedItem!='力量调集'&&selectedItem!='组织指挥'&&selectedItem!='作战行动'&&selectedItem!='社会联动'&&selectedItem!='勤务保障'&&selectedItem!='特别警示'&&selectedItem!='辅助决策'&&selectedItem!='处置要点'&&tuTrue)" class="leftKeyImg">
@ -262,7 +264,8 @@
</div>
</div>
<div class="mainbox" id="mainbox">
<div class="mainbox" id="mainbox" *ngIf="!iftrue">
<!-- 模板页面 -->
<div *ngFor="let item of planTemplateData;let key = index">

17
src/app/plan-management/create-plan-online-five/create-plan-online-five.component.scss

@ -79,6 +79,22 @@
box-sizing: border-box;
padding-top: 66px;
overflow-y: auto;
.shadow{
height: 95%;
width: 97%;
margin: 10px 10px 10px 10px;
/* position:absolute;
left:0;
top:0; */
z-index:998;
background-color:#FFFFFF;
opacity:0.6;
mat-spinner{
position: relative;
top: 40%;
left: 45%;
}
}
.leftbox {
position: fixed;
width: 14%;
@ -401,6 +417,7 @@
min-height: 97%;
box-sizing: border-box;
padding: 10px 10px 0;
.cover {
width: 100%;
min-height: 780px;

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

@ -230,7 +230,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
})
this.buData = JSON.parse(JSON.stringify(this.buData))
console.log(this.buData)
//console.log(this.buData)
this.buData.forEach((pvalue, pindex, parr) => {
if (parr[pindex].length > 0) {
parr[pindex].forEach((nval, nindex, narr) => {
@ -392,7 +392,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
//delete this.planTemplateData[this.planTemplateData.length-3]
}
//JSON.parse(JSON.stringify(this.planTemplateData))
console.log(this.planTemplateData)
//console.log(this.planTemplateData)
});
}
}
@ -420,7 +420,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
drop(event: CdkDragDrop<string[]>) {
moveItemInArray(this.planTemplateData, event.previousIndex, event.currentIndex);
console.log('拖拽标题', this.planTemplateData)
//console.log('拖拽标题', this.planTemplateData)
}
//获取建筑信息
@ -1117,7 +1117,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
})
}
console.log(this.planTemplateData)
//console.log(this.planTemplateData)
}
//单位相关数据
unitId: any = this.route.snapshot.queryParams.companyId
@ -1340,6 +1340,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
pattern: string = 'edit'
preview() {
this.pattern = 'look'
this.clickTitleItem('单位概况')
}
quitPreview() {
this.pattern = 'edit'
@ -1489,7 +1490,58 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
}
//上传
upload() {
document.getElementById('up').click()
let isTrue = confirm('上传新文件后可能会覆盖原有数据,您确定要继续上传吗')
if(isTrue){
document.getElementById('up').click()
}
}
//在线文档上传接口
fileData
iftrue=false
fileSc(e){
this.iftrue=true
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
let formData = new FormData()
formData.append("file", e.target.files[0])
let fileData={
type:1,
file:formData
}
this.http.post(`/api/OfficeExtract/ExtractWordPlan?type=1`,formData).subscribe((data:any)=>{
console.log(data)
if(data==null){
this.snackBar.open('解析失败,请确定好格式再重新上传!', '确定', config);
}else{
this.fileData=JSON.parse(JSON.stringify(data))
this.fileData.forEach((value,index,array) => {
if(value.groupName=='交通水源'||value.groupName=='重点图示'){
value.attribute.forEach(element => {
element.imgArr[0]=element.imgArr[0].slice(25,element.imgArr[0].length)
});
}
this.planTemplateData.forEach((pvalue,pindex,parr) => {
if(parr[1].building==undefined){
if(array[index].groupName==parr[pindex].groupName){
parr[pindex].attribute=array[index].attribute
}
}else{
if(array[index].groupName==parr[pindex].groupName&&pindex!=1){
parr[pindex].attribute=array[index].attribute
}else if(array[index].groupName==parr[pindex].groupName&&pindex==1){
parr[pindex].building[0].body=array[index].attribute
}
}
});
});
//console.log(this.fileData)
this.snackBar.open('解析成功!', '确定', config);
}
this.iftrue=false
e.target.value=''
})
}
}

Loading…
Cancel
Save