|
|
|
@ -4,11 +4,12 @@
|
|
|
|
|
* @Author: sueRimn |
|
|
|
|
* @Date: 2021-06-16 13:56:54 |
|
|
|
|
* @LastEditors: sueRimn |
|
|
|
|
* @LastEditTime: 2021-06-17 10:01:26 |
|
|
|
|
* @LastEditTime: 2021-06-17 15:15:17 |
|
|
|
|
*/ |
|
|
|
|
import { HttpClient } from '@angular/common/http'; |
|
|
|
|
import { Component, OnInit } from '@angular/core'; |
|
|
|
|
import { ActivatedRoute } from '@angular/router'; |
|
|
|
|
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; |
|
|
|
|
|
|
|
|
|
@Component({ |
|
|
|
|
selector: 'app-create-plan-online-five', |
|
|
|
@ -17,7 +18,7 @@ import { ActivatedRoute } from '@angular/router';
|
|
|
|
|
}) |
|
|
|
|
export class CreatePlanOnlineFiveComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
constructor(private http: HttpClient, private route: ActivatedRoute) { } |
|
|
|
|
constructor(private http: HttpClient, private route: ActivatedRoute,public snackBar: MatSnackBar) { } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
planName: string //预案名称
|
|
|
|
@ -49,6 +50,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
selectedItem: string = '封面' |
|
|
|
|
clickTitleItem(item) { |
|
|
|
|
this.addNumber=-1 |
|
|
|
|
item == '封面' ? this.selectedItem = '封面' : this.selectedItem = item.groupName |
|
|
|
|
} |
|
|
|
|
planTemplateData: any |
|
|
|
@ -65,6 +67,41 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
|
|
|
|
|
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); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|