chenjingyu 4 years ago
parent
commit
6cd38a65fb
  1. 9
      src/app/plan-management/create-plan-online-five/create-plan-online-five.component.html
  2. 28
      src/app/plan-management/create-plan-online-five/create-plan-online-five.component.scss
  3. 142
      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

@ -2,7 +2,8 @@
<div class="titlebox" *ngIf="pattern == 'edit'"> <div class="titlebox" *ngIf="pattern == 'edit'">
<div class="titleitembox" cdkDropList cdkDropListOrientation="horizontal" (cdkDropListDropped)="drop($event)"> <div class="titleitembox" cdkDropList cdkDropListOrientation="horizontal" (cdkDropListDropped)="drop($event)">
<div cdkDrag class="item" *ngFor="let item of planTemplateData;let key = index" (click)="clickTitleItem(item)" <div cdkDrag class="item" *ngFor="let item of planTemplateData;let key = index" (click)="clickTitleItem(item)"
[ngClass]="{'selectedItem': selectedItem == item.groupName}" [title]="item.groupName"> [ngClass]="{'selectedItem': selectedItem == item.groupName}" [title]="item.groupName"
[cdkDragDisabled]="item.groupName == '封面'">
{{key + 1}}.{{item.groupName}} {{key + 1}}.{{item.groupName}}
</div> </div>
</div> </div>
@ -174,10 +175,10 @@
<span>建筑列表</span> <span>建筑列表</span>
</div> </div>
<div class="buildingBody"> <div class="buildingBody">
<div class="buildName" *ngFor="let item of planTemplateData[1].building;let i=index"> <div class="buildName" *ngFor="let item of selectedContent.building;let i=index">
<mat-checkbox class="example-margin" color='primary' [(ngModel)]="item.completed" <mat-checkbox class="example-margin" color='primary' [(ngModel)]="item.completed"
(change)='clickBuilding(item,i)'></mat-checkbox> (change)='clickBuilding(item,i)'></mat-checkbox>
<span>{{item.name}}</span> <span [title]="item.name">{{item.name}}</span>
</div> </div>
</div> </div>
</div> </div>
@ -680,7 +681,7 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
overflow-y: auto;"> overflow-y: auto;">
<div *ngFor="let itemunit of planTemplateData[1].building;let uniti=index"> <!-- style="border-bottom: 3px solid #999;" --> <div *ngFor="let itemunit of item.building;let uniti=index"> <!-- style="border-bottom: 3px solid #999;" -->
<div *ngIf="itemunit.completed"> <div *ngIf="itemunit.completed">
<div class="unithead" style=" height: 40px; <div class="unithead" style=" height: 40px;
width: 100%; width: 100%;

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

@ -39,6 +39,7 @@
overflow: hidden; /*超出部分隐藏*/ overflow: hidden; /*超出部分隐藏*/
white-space: nowrap; /*不换行*/ white-space: nowrap; /*不换行*/
text-overflow: ellipsis; /*超出部分文字以...显示*/ text-overflow: ellipsis; /*超出部分文字以...显示*/
user-select: none;
} }
.item:hover { .item:hover {
background: #e8f4fe; background: #e8f4fe;
@ -197,6 +198,9 @@
cursor: pointer; cursor: pointer;
height: 40px; height: 40px;
width: 100%; width: 100%;
overflow: hidden;/*超出部分隐藏*/
white-space: nowrap;/*不换行*/
text-overflow:ellipsis;/*超出部分文字以...显示*/
border-bottom: 1px solid #f2f4f5; border-bottom: 1px solid #f2f4f5;
.example-margin { .example-margin {
width: 14px; width: 14px;
@ -1209,3 +1213,27 @@
} }
} }
.cdk-drag-preview {
height: 36px;
line-height: 36px;
background: white;
color: #8b8c8c;
margin: 0 3px;
text-align: center;
box-sizing: border-box;
padding: 0 10px;
font-size: 14px;
overflow: hidden; /*超出部分隐藏*/
white-space: nowrap; /*不换行*/
text-overflow: ellipsis; /*超出部分文字以...显示*/
box-sizing: border-box;
border-radius: 40px;
box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 8px 10px 1px rgba(0, 0, 0, 0.14),
0 3px 14px 2px rgba(0, 0, 0, 0.12);
}
.cdk-drag-placeholder {
opacity: 0;
}
.cdk-drag-animating {
transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
}

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

@ -65,9 +65,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
this.pattern = 'edit' this.pattern = 'edit'
} }
this.getUnitData() this.getUnitData()
//this.getpili() this.getOrganizations()
this.getOrganizations();
//this.getAllBuildings()
} }
zdysearch = '' zdysearch = ''
organizationName: any //当前单位组织机构名称 organizationName: any //当前单位组织机构名称
@ -165,10 +163,20 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
}) })
} }
//获得四周毗邻信息 //获得四周毗邻信息
getArrayIndex(arr, groupName) {
for (var i = 0; i < arr.length; i++) {
if (arr[i].groupName === groupName) {
return i;
}
}
return -1;
}
pilinData = [] pilinData = []
async getpili() { async getpili() {
let index = this.getArrayIndex(this.planTemplateData,'单位概况')
let result = await new Promise((resolve) => { let result = await new Promise((resolve) => {
this.planTemplateData[1].building.forEach(element => { this.planTemplateData[index].building.forEach(element => {
let id = { buildingId: element.buildingId } let id = { buildingId: element.buildingId }
this.http.get('/api/BuildingAdjoins', { params: id }).subscribe(data => { this.http.get('/api/BuildingAdjoins', { params: id }).subscribe(data => {
this.pilinData.push(data) this.pilinData.push(data)
@ -182,16 +190,16 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
console.log(this.pilinData) console.log(this.pilinData)
this.pilinData.forEach((pvalue, pindex, parr) => { this.pilinData.forEach((pvalue, pindex, parr) => {
parr[pindex].forEach((nval, nindex, narr) => { parr[pindex].forEach((nval, nindex, narr) => {
this.planTemplateData[1].building.forEach((value,i,arr) => { this.planTemplateData[index].building.forEach((value, i, arr) => {
if (narr[nindex].buildingId == arr[i].buildingId) { if (narr[nindex].buildingId == arr[i].buildingId) {
if (nval.direction == 0) { if (nval.direction == 0) {
this.planTemplateData[1].building[i].body[2].attinf[0].value=nval.name this.planTemplateData[index].building[i].body[2].attinf[0].value = nval.name
} else if (nval.direction == 1) { } else if (nval.direction == 1) {
this.planTemplateData[1].building[i].body[2].attinf[1].value=nval.name this.planTemplateData[index].building[i].body[2].attinf[1].value = nval.name
} else if (nval.direction == 2) { } else if (nval.direction == 2) {
this.planTemplateData[1].building[i].body[2].attinf[2].value=nval.name this.planTemplateData[index].building[i].body[2].attinf[2].value = nval.name
} else if (nval.direction == 3) { } else if (nval.direction == 3) {
this.planTemplateData[1].building[i].body[2].attinf[3].value=nval.name this.planTemplateData[index].building[i].body[2].attinf[3].value = nval.name
} }
} }
}); });
@ -205,8 +213,9 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
//获取重点部位 //获取重点部位
buData = [] buData = []
async getbuwei() { async getbuwei() {
let index = this.getArrayIndex(this.planTemplateData,'单位概况')
let result = await new Promise((resolve) => { let result = await new Promise((resolve) => {
this.planTemplateData[1].building.forEach(element => { this.planTemplateData[index].building.forEach(element => {
let id = { buildingId: element.buildingId } let id = { buildingId: element.buildingId }
this.http.get('/api/BuildingImportantLocations', { params: id }).subscribe(data => { this.http.get('/api/BuildingImportantLocations', { params: id }).subscribe(data => {
this.buData.push(data) this.buData.push(data)
@ -220,11 +229,11 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
this.buData.forEach((pvalue, pindex, parr) => { this.buData.forEach((pvalue, pindex, parr) => {
if (parr[pindex].length > 0) { if (parr[pindex].length > 0) {
parr[pindex].forEach((nval, nindex, narr) => { parr[pindex].forEach((nval, nindex, narr) => {
this.planTemplateData[1].building[pindex].body[5].attinf[0].body[0].value=nval.name this.planTemplateData[index].building[pindex].body[5].attinf[0].body[0].value = nval.name
this.planTemplateData[1].building[pindex].body[5].attinf[0].body[1].value=nval.nature this.planTemplateData[index].building[pindex].body[5].attinf[0].body[1].value = nval.nature
this.planTemplateData[1].building[pindex].body[5].attinf[0].body[2].value=nval.position this.planTemplateData[index].building[pindex].body[5].attinf[0].body[2].value = nval.position
this.planTemplateData[1].building[pindex].body[5].attinf[0].body[3].value=nval.structure this.planTemplateData[index].building[pindex].body[5].attinf[0].body[3].value = nval.structure
this.planTemplateData[1].building[pindex].body[5].attinf[0].body[4].value=nval.hazards this.planTemplateData[index].building[pindex].body[5].attinf[0].body[4].value = nval.hazards
}); });
} }
@ -232,7 +241,9 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
} }
selectedItem: string = '封面' selectedItem: string = '封面'
selectedContent:any
async clickTitleItem(item) { async clickTitleItem(item) {
this.selectedContent = item
this.addNumber = -1 this.addNumber = -1
this.yinruData = { this.yinruData = {
items: [] items: []
@ -328,7 +339,8 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
await this.getpili() await this.getpili()
await this.getbuwei() await this.getbuwei()
//console.log(this.buildZong) //console.log(this.buildZong)
this.planTemplateData[1].building.forEach(element => { let index = this.getArrayIndex(this.planTemplateData,'单位概况')
this.planTemplateData[index].building.forEach(element => {
element.body[0].attinf[0].value = element.body[0].attinf[0].olddata = this.unitData.usci element.body[0].attinf[0].value = element.body[0].attinf[0].olddata = this.unitData.usci
element.body[0].attinf[1].value = element.body[0].attinf[1].olddata = this.unitData.buildingTypes[0].name element.body[0].attinf[1].value = element.body[0].attinf[1].olddata = this.unitData.buildingTypes[0].name
element.body[0].attinf[2].value = element.body[0].attinf[2].olddata = this.unitData.contacts element.body[0].attinf[2].value = element.body[0].attinf[2].olddata = this.unitData.contacts
@ -349,14 +361,8 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
}); });
/* this.planTemplateData[1].building[0].body[0].attinf[0].value=this.planTemplateData[1].attribute[0].attinf[0].olddata = this.unitData.usci
this.planTemplateData[1].attribute[0].attinf[1].value=this.planTemplateData[1].attribute[0].attinf[1].olddata = this.unitData.buildingTypes[0].name
this.planTemplateData[1].attribute[0].attinf[2].value=this.planTemplateData[1].attribute[0].attinf[2].olddata = this.unitData.contacts
this.planTemplateData[1].attribute[0].attinf[3].value=this.planTemplateData[1].attribute[0].attinf[3].olddata = this.unitData.phone
this.planTemplateData[1].attribute[0].attinf[4].value=this.planTemplateData[1].attribute[0].attinf[4].olddata = this.unitData.organizationName
this.planTemplateData[1].attribute[0].attinf[5].value=this.planTemplateData[1].attribute[0].attinf[5].olddata = this.unitData.address */
console.log(this.planTemplateData) // console.log(this.planTemplateData)
} /* else if (this.selectedItem == '单位概况') { } /* else if (this.selectedItem == '单位概况') {
//this.getAllBuildings() //this.getAllBuildings()
} */ else if (this.selectedItem == '') { } */ else if (this.selectedItem == '') {
@ -366,6 +372,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
drop(event: CdkDragDrop<string[]>) { drop(event: CdkDragDrop<string[]>) {
moveItemInArray(this.planTemplateData, event.previousIndex, event.currentIndex); moveItemInArray(this.planTemplateData, event.previousIndex, event.currentIndex);
console.log('拖拽标题', this.planTemplateData)
} }
//获取建筑信息 //获取建筑信息
@ -374,7 +381,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
buildZong buildZong
//获得所有建筑信息 //获得所有建筑信息
async getAllBuildingsInfo() { async getAllBuildingsInfo() {
let index = this.getArrayIndex(this.planTemplateData,'单位概况')
const result = await new Promise((resolve) => { const result = await new Promise((resolve) => {
this.http.get("/api/Buildings", { this.http.get("/api/Buildings", {
params: { params: {
@ -396,10 +403,10 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
}) })
} }
//console.log(this.buildingsData) //console.log(this.buildingsData)
if (this.planTemplateData[1].building == undefined) { if (this.planTemplateData[index].building == undefined) {
this.planTemplateData[1].building = [] this.planTemplateData[index].building = []
if(this.planTemplateData[1].attribute[1].attinf!=undefined){ if (this.planTemplateData[index].attribute[1].attinf != undefined) {
this.planTemplateData[1].attribute[1].attinf.forEach(pData => { this.planTemplateData[index].attribute[1].attinf.forEach(pData => {
this.buildingsData.forEach((bDara, bi, bArr) => { this.buildingsData.forEach((bDara, bi, bArr) => {
if (bDara.buildingBasicGroups.length > 0) { if (bDara.buildingBasicGroups.length > 0) {
bDara.buildingBasicGroups[0].propertyInfos.forEach(bInfo => { bDara.buildingBasicGroups[0].propertyInfos.forEach(bInfo => {
@ -412,9 +419,9 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
for (var i = 0; i < this.buildDataName.length; i++) { for (var i = 0; i < this.buildDataName.length; i++) {
if (i == 0) { if (i == 0) {
this.planTemplateData[1].building.push({ name: this.buildDataName[i].name,buildingId:this.buildDataName[i].id, body: JSON.parse(JSON.stringify(this.planTemplateData[1].attribute)), completed: true }) this.planTemplateData[index].building.push({ name: this.buildDataName[i].name, buildingId: this.buildDataName[i].id, body: JSON.parse(JSON.stringify(this.planTemplateData[index].attribute)), completed: true })
} else { } else {
this.planTemplateData[1].building.push({ name: this.buildDataName[i].name,buildingId:this.buildDataName[i].id, body: JSON.parse(JSON.stringify(this.planTemplateData[1].attribute)), completed: false }) this.planTemplateData[index].building.push({ name: this.buildDataName[i].name, buildingId: this.buildDataName[i].id, body: JSON.parse(JSON.stringify(this.planTemplateData[index].attribute)), completed: false })
} }
} }
@ -424,9 +431,9 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
}) })
}) })
for(var a=0;a<this.planTemplateData[1].building.length;a++){ for (var a = 0; a < this.planTemplateData[index].building.length; a++) {
if (a > 0) { if (a > 0) {
this.planTemplateData[1].building[a].body[0].completed=false this.planTemplateData[index].building[a].body[0].completed = false
} }
} }
this.buildZong = result this.buildZong = result
@ -720,7 +727,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
var orgtreeCount = 0 var orgtreeCount = 0
this.planTemplateData.forEach((value, index, array) => { this.planTemplateData.forEach((value, index, array) => {
if (value.groupName == '组织指挥') { if (value.groupName == '组织指挥') {
this.planTemplateData[4].attribute.forEach((orgvalue,orgi,orgArr) => { value.attribute.forEach((orgvalue, orgi, orgArr) => {
if (orgArr[orgi].level == '1') { if (orgArr[orgi].level == '1') {
orgtableCount++ orgtableCount++
this.yinJson.organizationCommands.tableCount.tables.push({ itemCount: orgArr[orgi].tableth.length }) this.yinJson.organizationCommands.tableCount.tables.push({ itemCount: orgArr[orgi].tableth.length })
@ -744,7 +751,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
var shetextAreaCount = 0 var shetextAreaCount = 0
var shetreeCount = 0 var shetreeCount = 0
if (value.groupName == '社会联动') { if (value.groupName == '社会联动') {
this.planTemplateData[6].attribute.forEach((orgvalue,orgi,orgArr) => { value.attribute.forEach((orgvalue, orgi, orgArr) => {
if (orgArr[orgi].level == '1') { if (orgArr[orgi].level == '1') {
shetableCount++ shetableCount++
//this.yinJson.organizationCommands.tableCount.tables.push({itemCount:orgtableCount}) //this.yinJson.organizationCommands.tableCount.tables.push({itemCount:orgtableCount})
@ -768,7 +775,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
var qintextAreaCount = 0 var qintextAreaCount = 0
var qintreeCount = 0 var qintreeCount = 0
if (value.groupName == '勤务保障') { if (value.groupName == '勤务保障') {
this.planTemplateData[7].attribute.forEach((orgvalue,orgi,orgArr) => { value.attribute.forEach((orgvalue, orgi, orgArr) => {
if (orgArr[orgi].level == '1') { if (orgArr[orgi].level == '1') {
qintableCount++ qintableCount++
//this.yinJson.organizationCommands.tableCount.tables.push({itemCount:orgtableCount}) //this.yinJson.organizationCommands.tableCount.tables.push({itemCount:orgtableCount})
@ -792,7 +799,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
var futextAreaCount = 0 var futextAreaCount = 0
var futreeCount = 0 var futreeCount = 0
if (value.groupName == '辅助决策') { if (value.groupName == '辅助决策') {
this.planTemplateData[9].attribute.forEach((orgvalue,orgi,orgArr) => { value.attribute.forEach((orgvalue, orgi, orgArr) => {
if (orgArr[orgi].level == '1') { if (orgArr[orgi].level == '1') {
futableCount++ futableCount++
//this.yinJson.organizationCommands.tableCount.tables.push({itemCount:orgtableCount}) //this.yinJson.organizationCommands.tableCount.tables.push({itemCount:orgtableCount})
@ -819,7 +826,8 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
var orginputCount = 0 var orginputCount = 0
var orgtextAreaCount = 0 var orgtextAreaCount = 0
var orgtreeCount = 0 var orgtreeCount = 0
this.planTemplateData[4].attribute.forEach((orgvalue,orgi,orgArr) => { let index = this.getArrayIndex(this.planTemplateData,'组织指挥')
this.planTemplateData[index].attribute.forEach((orgvalue, orgi, orgArr) => {
if (orgArr[orgi].level == '1') { if (orgArr[orgi].level == '1') {
orgtableCount++ orgtableCount++
this.yinJson.organizationCommands.tableCount.tables.push({ itemCount: orgArr[orgi].tableth.length }) this.yinJson.organizationCommands.tableCount.tables.push({ itemCount: orgArr[orgi].tableth.length })
@ -844,7 +852,8 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
var orginputCount = 0 var orginputCount = 0
var orgtextAreaCount = 0 var orgtextAreaCount = 0
var orgtreeCount = 0 var orgtreeCount = 0
this.planTemplateData[6].attribute.forEach((orgvalue,orgi,orgArr) => { let index = this.getArrayIndex(this.planTemplateData,'社会联动')
this.planTemplateData[index].attribute.forEach((orgvalue, orgi, orgArr) => {
if (orgArr[orgi].level == '1') { if (orgArr[orgi].level == '1') {
orgtableCount++ orgtableCount++
//this.yinJson.organizationCommands.tableCount.tables.push({itemCount:orgtableCount}) //this.yinJson.organizationCommands.tableCount.tables.push({itemCount:orgtableCount})
@ -869,7 +878,8 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
var orginputCount = 0 var orginputCount = 0
var orgtextAreaCount = 0 var orgtextAreaCount = 0
var orgtreeCount = 0 var orgtreeCount = 0
this.planTemplateData[7].attribute.forEach((orgvalue,orgi,orgArr) => { let index = this.getArrayIndex(this.planTemplateData,'勤务保障')
this.planTemplateData[index].attribute.forEach((orgvalue, orgi, orgArr) => {
if (orgArr[orgi].level == '1') { if (orgArr[orgi].level == '1') {
orgtableCount++ orgtableCount++
//this.yinJson.organizationCommands.tableCount.tables.push({itemCount:orgtableCount}) //this.yinJson.organizationCommands.tableCount.tables.push({itemCount:orgtableCount})
@ -894,7 +904,8 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
var orginputCount = 0 var orginputCount = 0
var orgtextAreaCount = 0 var orgtextAreaCount = 0
var orgtreeCount = 0 var orgtreeCount = 0
this.planTemplateData[9].attribute.forEach((orgvalue,orgi,orgArr) => { let index = this.getArrayIndex(this.planTemplateData,'处置要点')
this.planTemplateData[index].attribute.forEach((orgvalue, orgi, orgArr) => {
if (orgArr[orgi].level == '1') { if (orgArr[orgi].level == '1') {
orgtableCount++ orgtableCount++
//this.yinJson.organizationCommands.tableCount.tables.push({itemCount:orgtableCount}) //this.yinJson.organizationCommands.tableCount.tables.push({itemCount:orgtableCount})
@ -915,7 +926,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
this.yinJson.serviceSupports = null this.yinJson.serviceSupports = null
this.yinJson.socialLinkages = null this.yinJson.socialLinkages = null
} }
console.log(this.yinJson) // console.log(this.yinJson)
} }
//查询能引入的预案 //查询能引入的预案
yinruData = { yinruData = {
@ -956,7 +967,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
data: { selectedItem: this.selectedItem, yinruData: this.yinruData.items[clicki].webTextData } data: { selectedItem: this.selectedItem, yinruData: this.yinruData.items[clicki].webTextData }
}); });
dialogRef.afterClosed().subscribe(result => { dialogRef.afterClosed().subscribe(result => {
console.log(result) // console.log(result)
if (result != undefined) { if (result != undefined) {
this.planTemplateData.forEach(element => { this.planTemplateData.forEach(element => {
if (element.groupName == this.selectedItem) { if (element.groupName == this.selectedItem) {
@ -1026,7 +1037,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
} }
//重点图示上传图片 //重点图示上传图片
filechange(e, i) { filechange(e, i) {
console.log(i) // console.log(i)
let file = e.target.files[0] || null //获取上传的文件 let file = e.target.files[0] || null //获取上传的文件
let fileSize = file.size || null //上传文件的总大小 let fileSize = file.size || null //上传文件的总大小
let maxSize = 5 * 1024 * 1024 //5MB一个分片 let maxSize = 5 * 1024 * 1024 //5MB一个分片
@ -1073,9 +1084,6 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
}) })
}) })
this.allBuildings = data this.allBuildings = data
//this.group = this.planTemplateData[1].building
//delete this.planTemplateData[0].attribute
}) })
}) })
@ -1133,7 +1141,6 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
addNumber = -1 addNumber = -1
addTd(key, i) { addTd(key, i) {
this.addNumber++ this.addNumber++
//this.planTemplateData[key].attribute[i].push({tabletr:[]})
if (this.planTemplateData[key].attribute[i].tabletr == undefined) { if (this.planTemplateData[key].attribute[i].tabletr == undefined) {
this.planTemplateData[key].attribute[i].tabletr = [] this.planTemplateData[key].attribute[i].tabletr = []
} }
@ -1171,50 +1178,49 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
clickBuilding(item, i) { clickBuilding(item, i) {
this.buildingName = item.name this.buildingName = item.name
this.clicki = i this.clicki = i
console.log(item, this.clicki) // console.log(item, this.clicki)
/* this.planTemplateData[1].building[1].body[0].completed=false
this.planTemplateData[1].building[0].body[0].completed=true */
//this.group=this.planTemplateData[1].building[this.clicki].body
} }
//单位概况增加一行 //单位概况增加一行
unitadd(surveyName, attacki, i) { unitadd(surveyName, attacki, i) {
 let index = this.getArrayIndex(this.planTemplateData,'单位概况')
this.addNumber++ this.addNumber++
if (surveyName == '进攻通道') { if (surveyName == '进攻通道') {
if (this.planTemplateData[1].building[attacki].body[4].attinf[i].tabletr == undefined) { if (this.planTemplateData[index].building[attacki].body[4].attinf[i].tabletr == undefined) {
this.planTemplateData[1].building[attacki].body[4].attinf[i].tabletr = [] this.planTemplateData[index].building[attacki].body[4].attinf[i].tabletr = []
} }
this.planTemplateData[1].building[attacki].body[4].attinf[i].tabletr.push({ tabletd: [] }) this.planTemplateData[index].building[attacki].body[4].attinf[i].tabletr.push({ tabletd: [] })
for (var j = 0; j < this.planTemplateData[1].building[attacki].body[4].attinf[i].tableth.length; j++) { for (var j = 0; j < this.planTemplateData[index].building[attacki].body[4].attinf[i].tableth.length; j++) {
if (this.planTemplateData[1].building[attacki].body[4].attinf[i].tabletr != undefined) { if (this.planTemplateData[index].building[attacki].body[4].attinf[i].tabletr != undefined) {
this.planTemplateData[1].building[attacki].body[4].attinf[i].tabletr[this.planTemplateData[1].building[attacki].body[4].attinf[i].tabletr.length - 1].tabletd.push('') this.planTemplateData[index].building[attacki].body[4].attinf[i].tabletr[this.planTemplateData[index].building[attacki].body[4].attinf[i].tabletr.length - 1].tabletd.push('')
} }
else { else {
this.planTemplateData[1].building[attacki].body[4].attinf[i].tabletr[this.addNumber].tabletd.push('') this.planTemplateData[index].building[attacki].body[4].attinf[i].tabletr[this.addNumber].tabletd.push('')
} }
} }
// console.log(this.planTemplateData) // console.log(this.planTemplateData)
} }
else if (surveyName == '功能分区') { else if (surveyName == '功能分区') {
console.log(attacki) // console.log(attacki)
this.planTemplateData[1].building[attacki].body[6].attinf.push({ name: '', value: '' }) this.planTemplateData[index].building[attacki].body[6].attinf.push({ name: '', value: '' })
} else if (surveyName == '重点部位') { } else if (surveyName == '重点部位') {
this.planTemplateData[1].building[attacki].body[5].attinf.push({ heafName: '', body: [{ name: '重点部位名称', value: '' }, { name: '重点部位所在位置', value: '' }, { name: '建筑结构', value: '' }, { name: '使用性质', value: '' }, { name: '主要危险性', value: '' }] }) this.planTemplateData[index].building[attacki].body[5].attinf.push({ heafName: '', body: [{ name: '重点部位名称', value: '' }, { name: '重点部位所在位置', value: '' }, { name: '建筑结构', value: '' }, { name: '使用性质', value: '' }, { name: '主要危险性', value: '' }] })
} }
} }
//单位概况删除一行 //单位概况删除一行
unitDel(surveyName, attacki, i) { unitDel(surveyName, attacki, i) {
let index = this.getArrayIndex(this.planTemplateData,'单位概况')
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
let isTrue = confirm('您确定要删除该条信息吗') let isTrue = confirm('您确定要删除该条信息吗')
if (surveyName == '进攻通道') { if (surveyName == '进攻通道') {
if (isTrue) { if (isTrue) {
if (this.planTemplateData[1].building[attacki].body[4].attinf[i].tabletr != undefined) { if (this.planTemplateData[index].building[attacki].body[4].attinf[i].tabletr != undefined) {
this.planTemplateData[1].building[attacki].body[4].attinf[i].tabletr.splice(this.planTemplateData[1].building[attacki].body[4].attinf[i].tabletr.length - 1, 1) this.planTemplateData[index].building[attacki].body[4].attinf[i].tabletr.splice(this.planTemplateData[index].building[attacki].body[4].attinf[i].tabletr.length - 1, 1)
this.addNumber-- this.addNumber--
if (this.planTemplateData[1].building[attacki].body[4].attinf[i].tabletr.length == 0) { if (this.planTemplateData[index].building[attacki].body[4].attinf[i].tabletr.length == 0) {
this.addNumber = -1 this.addNumber = -1
} }
} else { } else {
@ -1223,11 +1229,11 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
} }
} else if (surveyName == '功能分区') { } else if (surveyName == '功能分区') {
if (isTrue) { if (isTrue) {
this.planTemplateData[1].building[attacki].body[6].attinf.splice(i, 1) this.planTemplateData[index].building[attacki].body[6].attinf.splice(i, 1)
} }
} else if (surveyName == '重点部位') { } else if (surveyName == '重点部位') {
if (isTrue) { if (isTrue) {
this.planTemplateData[1].building[attacki].body[5].attinf.splice(i, 1) this.planTemplateData[index].building[attacki].body[5].attinf.splice(i, 1)
} }
} }
} }
@ -1406,7 +1412,7 @@ export class yinYong{
this.selectedItem = this.data.selectedItem this.selectedItem = this.data.selectedItem
this.planTemplateData = JSON.parse(this.data.yinruData) this.planTemplateData = JSON.parse(this.data.yinruData)
this.yinData() this.yinData()
console.log(this.planTemplateData) // console.log(this.planTemplateData)
} }
selectedItem//传来的组织指挥或者。。。 selectedItem//传来的组织指挥或者。。。
planTemplateData//传来的数据 planTemplateData//传来的数据

Loading…
Cancel
Save