From 41ab37a37a1fd20a6ea9853b74899dc0fd95a432 Mon Sep 17 00:00:00 2001 From: chenjingyu Date: Wed, 23 Jun 2021 17:22:28 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=96=B0=E5=A2=9E]=E5=8D=95=E4=BD=8D=E6=A6=82?= =?UTF-8?q?=E5=86=B5=E8=BF=9B=E6=94=BB=E9=80=9A=E9=81=93=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E4=B8=80=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../create-plan-online-five.component.html | 19 ++++++-- .../create-plan-online-five.component.ts | 45 ++++++++++++++++--- 2 files changed, 55 insertions(+), 9 deletions(-) diff --git a/src/app/plan-management/create-plan-online-five/create-plan-online-five.component.html b/src/app/plan-management/create-plan-online-five/create-plan-online-five.component.html index 2481c0a..1dc78d8 100644 --- a/src/app/plan-management/create-plan-online-five/create-plan-online-five.component.html +++ b/src/app/plan-management/create-plan-online-five/create-plan-online-five.component.html @@ -334,7 +334,7 @@
{{buildingName}}
-
+
{{element.surveyName}} @@ -342,11 +342,11 @@
-
+
{{attack.head}} - - + +
@@ -356,6 +356,15 @@ [(ngModel)]="attack.tableth[tablethi]"> + + + + +
+ +
@@ -363,6 +372,8 @@
+ +
diff --git a/src/app/plan-management/create-plan-online-five/create-plan-online-five.component.ts b/src/app/plan-management/create-plan-online-five/create-plan-online-five.component.ts index 291f747..caaeed6 100644 --- a/src/app/plan-management/create-plan-online-five/create-plan-online-five.component.ts +++ b/src/app/plan-management/create-plan-online-five/create-plan-online-five.component.ts @@ -4,7 +4,7 @@ * @Author: sueRimn * @Date: 2021-06-16 13:56:54 * @LastEditors: sueRimn - * @LastEditTime: 2021-06-22 17:16:01 + * @LastEditTime: 2021-06-23 16:26:37 */ import { HttpClient } from '@angular/common/http'; import { Component, Inject, OnInit, Renderer2, ViewChild, Input } from '@angular/core'; @@ -238,6 +238,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit { this.planTemplateData[0].building.push({name:this.allBuildings[i].name,body:this.planTemplateData[0].attribute}) } this.buildingName=this.allBuildings[0].name + this.group=this.planTemplateData[0].building[this.clicki].body console.log(this.planTemplateData) }) } @@ -280,7 +281,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit { trackByFn(index) { return index } - //表格增加一行 + //灾情设定表格增加一行 addNumber = -1 addTd(key, i) { this.addNumber++ @@ -299,7 +300,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit { } console.log(this.planTemplateData) } - //表格删除一行 + //灾情设定表格删除一行 delTd(key, i) { const config = new MatSnackBarConfig(); config.verticalPosition = 'top'; @@ -318,14 +319,48 @@ export class CreatePlanOnlineFiveComponent implements OnInit { //单位概况左侧建筑点击事件 buildingName clicki=0 + group clickBuilding(item,i){ this.buildingName=item.name this.clicki=i + this.group=this.planTemplateData[0].building[this.clicki].body + //console.log(this.group) } //单位概况增加一行 - unitadd(groupName){ - if(groupName=='进攻通道'){ + unitadd(surveyName,attacki){ + this.addNumber++ + if(surveyName=='进攻通道'){ + if (this.planTemplateData[0].building[this.clicki].body[4].attinf[attacki].tabletr == undefined) { + this.planTemplateData[0].building[this.clicki].body[4].attinf[attacki].tabletr = [] + } + this.planTemplateData[0].building[this.clicki].body[4].attinf[attacki].tabletr.push({ tabletd: [] }) + for (var j = 0; j < this.planTemplateData[0].building[this.clicki].body[4].attinf[attacki].tableth.length; j++) { + if (this.planTemplateData[0].building[this.clicki].body[4].attinf[attacki].tabletr != undefined) { + this.planTemplateData[0].building[this.clicki].body[4].attinf[attacki].tabletr[this.planTemplateData[0].building[this.clicki].body[4].attinf[attacki].tabletr.length - 1].tabletd.push('') + } + else { + this.planTemplateData[0].building[this.clicki].body[4].attinf[attacki].tabletr[this.addNumber].tabletd.push('') + } + } + console.log(this.planTemplateData) + } + } + //单位概况删除一行 + unitDel(surveyName,attacki){ + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + if(surveyName=='进攻通道'){ + if (this.planTemplateData[0].building[this.clicki].body[4].attinf[attacki].tabletr != undefined) { + this.planTemplateData[0].building[this.clicki].body[4].attinf[attacki].tabletr.splice(this.planTemplateData[0].building[this.clicki].body[4].attinf[attacki].tabletr.length - 1, 1) + this.addNumber-- + if (this.planTemplateData[0].building[this.clicki].body[4].attinf[attacki].tabletr.length == 0) { + this.addNumber = -1 + } + } else { + this.snackBar.open('请先增加一行!', '确定', config); + } } }