|
|
|
@ -4,13 +4,13 @@
|
|
|
|
|
* @Author: sueRimn |
|
|
|
|
* @Date: 2021-06-16 13:56:54 |
|
|
|
|
* @LastEditors: sueRimn |
|
|
|
|
* @LastEditTime: 2021-06-17 10:01:26 |
|
|
|
|
* @LastEditTime: 2021-06-17 17:05:09 |
|
|
|
|
*/ |
|
|
|
|
import { HttpClient } from '@angular/common/http'; |
|
|
|
|
import { Component, Inject, OnInit, Renderer2, ViewChild, Input } from '@angular/core'; |
|
|
|
|
import { ActivatedRoute } from '@angular/router'; |
|
|
|
|
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; |
|
|
|
|
import { MatSnackBar } from '@angular/material/snack-bar'; |
|
|
|
|
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; |
|
|
|
|
|
|
|
|
|
@Component({ |
|
|
|
|
selector: 'app-create-plan-online-five', |
|
|
|
@ -30,8 +30,28 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
|
|
|
|
|
console.log('级别', this.planLevel) |
|
|
|
|
this.getTemplateData() |
|
|
|
|
this.getUnitData() |
|
|
|
|
this.tree = { |
|
|
|
|
json:this.treedate, |
|
|
|
|
config: this.treeConfig |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//树形结构数据
|
|
|
|
|
treedate=[ |
|
|
|
|
{ |
|
|
|
|
"guid": "bc4c7a02-5379-4046-92be-12c67af4295a", |
|
|
|
|
"displayName": "Elentrix", |
|
|
|
|
"children": [ |
|
|
|
|
/* "85d412c2-ebc1-4d56-96c9-7da433ac9bb2", |
|
|
|
|
"28aac445-83b1-464d-9695-a4157dab6eac" */ |
|
|
|
|
] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
] |
|
|
|
|
tree |
|
|
|
|
treeConfig = { |
|
|
|
|
nodeWidth: 90, |
|
|
|
|
nodeHeight: 60 |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
//获得单位信息
|
|
|
|
|
unitData: any |
|
|
|
@ -51,6 +71,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
selectedItem: string = '封面' |
|
|
|
|
clickTitleItem(item) { |
|
|
|
|
this.addNumber=-1 |
|
|
|
|
item == '封面' ? this.selectedItem = '封面' : this.selectedItem = item.groupName |
|
|
|
|
if (this.selectedItem == '重点图示') { |
|
|
|
|
this.getAllBuildings() |
|
|
|
@ -202,15 +223,6 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
|
|
|
|
|
dialogRef.afterClosed().subscribe((data) => { }); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//input key值,一个字符焦点消失问题
|
|
|
|
|
trackByFn(index) { |
|
|
|
|
return index |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//正常上传
|
|
|
|
|
async uploadFile(companyId: string, planId: string, file) { |
|
|
|
|
let formData = new FormData() |
|
|
|
@ -221,6 +233,46 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
|
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
//input key值,一个字符焦点消失问题
|
|
|
|
|
trackByFn(index){ |
|
|
|
|
return index |
|
|
|
|
} |
|
|
|
|
//表格增加一行
|
|
|
|
|
addNumber=-1 |
|
|
|
|
addTd(key,i){ |
|
|
|
|
this.addNumber++ |
|
|
|
|
//this.planTemplateData[key].attribute[i].push({tabletr:[]})
|
|
|
|
|
if(this.planTemplateData[key].attribute[i].tabletr==undefined){ |
|
|
|
|
this.planTemplateData[key].attribute[i].tabletr=[] |
|
|
|
|
} |
|
|
|
|
this.planTemplateData[key].attribute[i].tabletr.push({tabletd:[]}) |
|
|
|
|
for(var j=0;j<this.planTemplateData[key].attribute[i].tableth.length;j++){ |
|
|
|
|
if(this.planTemplateData[key].attribute[i].tabletr!=undefined){ |
|
|
|
|
this.planTemplateData[key].attribute[i].tabletr[this.planTemplateData[key].attribute[i].tabletr.length-1].tabletd.push('') |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
this.planTemplateData[key].attribute[i].tabletr[this.addNumber].tabletd.push('') |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
console.log(this.planTemplateData) |
|
|
|
|
} |
|
|
|
|
//表格删除一行
|
|
|
|
|
delTd(key,i){ |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
if(this.planTemplateData[key].attribute[i].tabletr!=undefined){ |
|
|
|
|
this.planTemplateData[key].attribute[i].tabletr.splice(this.planTemplateData[key].attribute[i].tabletr.length-1,1) |
|
|
|
|
this.addNumber-- |
|
|
|
|
if(this.planTemplateData[key].attribute[i].tabletr.length==0){ |
|
|
|
|
this.addNumber=-1 |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
this.snackBar.open('请先增加一行!','确定',config); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//分段上传
|
|
|
|
|
sectionUpload(companyId: string, planId: string, file) { |
|
|
|
|
let data = { filename: file.name } |
|
|
|
|