Browse Source

[新增]单位概况进攻通道新增一行

tangshan
chenjingyu 4 years ago
parent
commit
41ab37a37a
  1. 19
      src/app/plan-management/create-plan-online-five/create-plan-online-five.component.html
  2. 45
      src/app/plan-management/create-plan-online-five/create-plan-online-five.component.ts

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

@ -334,7 +334,7 @@
<div class="unithead">
<span>{{buildingName}}</span>
</div>
<div class="unitbody" *ngFor="let element of item.building[clicki].body;let i=index">
<div class="unitbody" *ngFor="let element of group;let i=index">
<div *ngIf="element.completed">
<div class="unitbodyHead">
<span>{{element.surveyName}}</span>
@ -342,11 +342,11 @@
<div class="body">
<!-- 进攻通道 -->
<div class="attack" *ngIf="element.surveyName=='进攻通道'">
<div *ngFor="let attack of element.attinf">
<div *ngFor="let attack of element.attinf;let attacki=index">
<div class="attackhead">
<span>{{attack.head}}</span>
<img src="../../../assets/images/deleteblue.png" >
<img src="../../../assets/images/add.png" >
<img src="../../../assets/images/deleteblue.png" (click)='unitDel(element.surveyName,attacki)'>
<img src="../../../assets/images/add.png" (click)='unitadd(element.surveyName,attacki)'>
</div>
<div class="attackbody">
<table>
@ -356,6 +356,15 @@
[(ngModel)]="attack.tableth[tablethi]">
</th>
</thead>
<tbody>
<tr *ngFor="let itemtr of attack.tabletr">
<td
*ngFor="let itemtd of itemtr.tabletd;let tabletdi=index;TrackBy:trackByFn">
<input type="text" placeholder="请输入"
[(ngModel)]="itemtr.tabletd[tabletdi]">
</td>
</tr>
</tbody>
<tbody></tbody>
</table>
</div>
@ -363,6 +372,8 @@
</div>
<!-- 单位和建筑信息 -->
<div class="building"></div>
</div>
</div>

45
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);
}
}
}

Loading…
Cancel
Save