Browse Source

[完善]完善planTemplateData[index]

tangshan
邵佳豪 4 years ago
parent
commit
9386328ad3
  1. 6
      src/app/plan-management/create-plan-online-five/create-plan-online-five.component.html
  2. 3
      src/app/plan-management/create-plan-online-five/create-plan-online-five.component.scss
  3. 132
      src/app/plan-management/create-plan-online-five/create-plan-online-five.component.ts

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

@ -175,10 +175,10 @@
<span>建筑列表</span>
</div>
<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"
(change)='clickBuilding(item,i)'></mat-checkbox>
<span>{{item.name}}</span>
<span [title]="item.name">{{item.name}}</span>
</div>
</div>
</div>
@ -681,7 +681,7 @@
display: flex;
flex-direction: column;
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 class="unithead" style=" height: 40px;
width: 100%;

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

@ -198,6 +198,9 @@
cursor: pointer;
height: 40px;
width: 100%;
overflow: hidden;/*超出部分隐藏*/
white-space: nowrap;/*不换行*/
text-overflow:ellipsis;/*超出部分文字以...显示*/
border-bottom: 1px solid #f2f4f5;
.example-margin {
width: 14px;

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

@ -163,11 +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 = []
async getpili() {
let index = this.getArrayIndex(this.planTemplateData,'单位概况')
let result = await new Promise((resolve) => {
console.log(1111,this.planTemplateData)
this.planTemplateData[1].building.forEach(element => {
this.planTemplateData[index].building.forEach(element => {
let id = { buildingId: element.buildingId }
this.http.get('/api/BuildingAdjoins', { params: id }).subscribe(data => {
this.pilinData.push(data)
@ -181,16 +190,16 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
console.log(this.pilinData)
this.pilinData.forEach((pvalue, pindex, parr) => {
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 (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) {
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) {
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) {
this.planTemplateData[1].building[i].body[2].attinf[3].value=nval.name
this.planTemplateData[index].building[i].body[2].attinf[3].value = nval.name
}
}
});
@ -204,8 +213,9 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
//获取重点部位
buData = []
async getbuwei() {
let index = this.getArrayIndex(this.planTemplateData,'单位概况')
let result = await new Promise((resolve) => {
this.planTemplateData[1].building.forEach(element => {
this.planTemplateData[index].building.forEach(element => {
let id = { buildingId: element.buildingId }
this.http.get('/api/BuildingImportantLocations', { params: id }).subscribe(data => {
this.buData.push(data)
@ -219,11 +229,11 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
this.buData.forEach((pvalue, pindex, parr) => {
if (parr[pindex].length > 0) {
parr[pindex].forEach((nval, nindex, narr) => {
this.planTemplateData[1].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[1].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[1].building[pindex].body[5].attinf[0].body[4].value=nval.hazards
this.planTemplateData[index].building[pindex].body[5].attinf[0].body[0].value = nval.name
this.planTemplateData[index].building[pindex].body[5].attinf[0].body[1].value = nval.nature
this.planTemplateData[index].building[pindex].body[5].attinf[0].body[2].value = nval.position
this.planTemplateData[index].building[pindex].body[5].attinf[0].body[3].value = nval.structure
this.planTemplateData[index].building[pindex].body[5].attinf[0].body[4].value = nval.hazards
});
}
@ -231,7 +241,9 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
}
selectedItem: string = '封面'
selectedContent:any
async clickTitleItem(item) {
this.selectedContent = item
this.addNumber = -1
this.yinruData = {
items: []
@ -327,7 +339,8 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
await this.getpili()
await this.getbuwei()
//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[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
@ -349,7 +362,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
});
console.log(this.planTemplateData)
// console.log(this.planTemplateData)
} /* else if (this.selectedItem == '单位概况') {
//this.getAllBuildings()
} */ else if (this.selectedItem == '') {
@ -368,7 +381,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
buildZong
//获得所有建筑信息
async getAllBuildingsInfo() {
let index = this.getArrayIndex(this.planTemplateData,'单位概况')
const result = await new Promise((resolve) => {
this.http.get("/api/Buildings", {
params: {
@ -390,10 +403,10 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
})
}
//console.log(this.buildingsData)
if (this.planTemplateData[1].building == undefined) {
this.planTemplateData[1].building = []
if(this.planTemplateData[1].attribute[1].attinf!=undefined){
this.planTemplateData[1].attribute[1].attinf.forEach(pData => {
if (this.planTemplateData[index].building == undefined) {
this.planTemplateData[index].building = []
if (this.planTemplateData[index].attribute[1].attinf != undefined) {
this.planTemplateData[index].attribute[1].attinf.forEach(pData => {
this.buildingsData.forEach((bDara, bi, bArr) => {
if (bDara.buildingBasicGroups.length > 0) {
bDara.buildingBasicGroups[0].propertyInfos.forEach(bInfo => {
@ -406,9 +419,9 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
for (var i = 0; i < this.buildDataName.length; i++) {
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 {
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 })
}
}
@ -418,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) {
this.planTemplateData[1].building[a].body[0].completed=false
this.planTemplateData[index].building[a].body[0].completed = false
}
}
this.buildZong = result
@ -714,7 +727,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
var orgtreeCount = 0
this.planTemplateData.forEach((value, index, array) => {
if (value.groupName == '组织指挥') {
this.planTemplateData[4].attribute.forEach((orgvalue,orgi,orgArr) => {
value.attribute.forEach((orgvalue, orgi, orgArr) => {
if (orgArr[orgi].level == '1') {
orgtableCount++
this.yinJson.organizationCommands.tableCount.tables.push({ itemCount: orgArr[orgi].tableth.length })
@ -738,7 +751,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
var shetextAreaCount = 0
var shetreeCount = 0
if (value.groupName == '社会联动') {
this.planTemplateData[6].attribute.forEach((orgvalue,orgi,orgArr) => {
value.attribute.forEach((orgvalue, orgi, orgArr) => {
if (orgArr[orgi].level == '1') {
shetableCount++
//this.yinJson.organizationCommands.tableCount.tables.push({itemCount:orgtableCount})
@ -762,7 +775,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
var qintextAreaCount = 0
var qintreeCount = 0
if (value.groupName == '勤务保障') {
this.planTemplateData[7].attribute.forEach((orgvalue,orgi,orgArr) => {
value.attribute.forEach((orgvalue, orgi, orgArr) => {
if (orgArr[orgi].level == '1') {
qintableCount++
//this.yinJson.organizationCommands.tableCount.tables.push({itemCount:orgtableCount})
@ -786,7 +799,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
var futextAreaCount = 0
var futreeCount = 0
if (value.groupName == '辅助决策') {
this.planTemplateData[9].attribute.forEach((orgvalue,orgi,orgArr) => {
value.attribute.forEach((orgvalue, orgi, orgArr) => {
if (orgArr[orgi].level == '1') {
futableCount++
//this.yinJson.organizationCommands.tableCount.tables.push({itemCount:orgtableCount})
@ -813,7 +826,8 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
var orginputCount = 0
var orgtextAreaCount = 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') {
orgtableCount++
this.yinJson.organizationCommands.tableCount.tables.push({ itemCount: orgArr[orgi].tableth.length })
@ -838,7 +852,8 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
var orginputCount = 0
var orgtextAreaCount = 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') {
orgtableCount++
//this.yinJson.organizationCommands.tableCount.tables.push({itemCount:orgtableCount})
@ -863,7 +878,8 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
var orginputCount = 0
var orgtextAreaCount = 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') {
orgtableCount++
//this.yinJson.organizationCommands.tableCount.tables.push({itemCount:orgtableCount})
@ -888,7 +904,8 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
var orginputCount = 0
var orgtextAreaCount = 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') {
orgtableCount++
//this.yinJson.organizationCommands.tableCount.tables.push({itemCount:orgtableCount})
@ -909,7 +926,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
this.yinJson.serviceSupports = null
this.yinJson.socialLinkages = null
}
console.log(this.yinJson)
// console.log(this.yinJson)
}
//查询能引入的预案
yinruData = {
@ -950,7 +967,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
data: { selectedItem: this.selectedItem, yinruData: this.yinruData.items[clicki].webTextData }
});
dialogRef.afterClosed().subscribe(result => {
console.log(result)
// console.log(result)
if (result != undefined) {
this.planTemplateData.forEach(element => {
if (element.groupName == this.selectedItem) {
@ -1020,7 +1037,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
}
//重点图示上传图片
filechange(e, i) {
console.log(i)
// console.log(i)
let file = e.target.files[0] || null //获取上传的文件
let fileSize = file.size || null //上传文件的总大小
let maxSize = 5 * 1024 * 1024 //5MB一个分片
@ -1067,9 +1084,6 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
})
})
this.allBuildings = data
//this.group = this.planTemplateData[1].building
//delete this.planTemplateData[0].attribute
})
})
@ -1127,7 +1141,6 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
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 = []
}
@ -1165,50 +1178,49 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
clickBuilding(item, i) {
this.buildingName = item.name
this.clicki = i
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
// console.log(item, this.clicki)
}
//单位概况增加一行
unitadd(surveyName, attacki, i) {
 let index = this.getArrayIndex(this.planTemplateData,'单位概况')
this.addNumber++
if (surveyName == '进攻通道') {
if (this.planTemplateData[1].building[attacki].body[4].attinf[i].tabletr == undefined) {
this.planTemplateData[1].building[attacki].body[4].attinf[i].tabletr = []
if (this.planTemplateData[index].building[attacki].body[4].attinf[i].tabletr == undefined) {
this.planTemplateData[index].building[attacki].body[4].attinf[i].tabletr = []
}
this.planTemplateData[1].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++) {
if (this.planTemplateData[1].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.push({ tabletd: [] })
for (var j = 0; j < this.planTemplateData[index].building[attacki].body[4].attinf[i].tableth.length; j++) {
if (this.planTemplateData[index].building[attacki].body[4].attinf[i].tabletr != undefined) {
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 {
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)
}
else if (surveyName == '功能分区') {
console.log(attacki)
this.planTemplateData[1].building[attacki].body[6].attinf.push({ name: '', value: '' })
// console.log(attacki)
this.planTemplateData[index].building[attacki].body[6].attinf.push({ name: '', value: '' })
} 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) {
let index = this.getArrayIndex(this.planTemplateData,'单位概况')
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
let isTrue = confirm('您确定要删除该条信息吗')
if (surveyName == '进攻通道') {
if (isTrue) {
if (this.planTemplateData[1].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)
if (this.planTemplateData[index].building[attacki].body[4].attinf[i].tabletr != undefined) {
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--
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
}
} else {
@ -1217,11 +1229,11 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
}
} else if (surveyName == '功能分区') {
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 == '重点部位') {
if (isTrue) {
this.planTemplateData[1].building[attacki].body[5].attinf.splice(i, 1)
this.planTemplateData[index].building[attacki].body[5].attinf.splice(i, 1)
}
}
}
@ -1400,7 +1412,7 @@ export class yinYong{
this.selectedItem = this.data.selectedItem
this.planTemplateData = JSON.parse(this.data.yinruData)
this.yinData()
console.log(this.planTemplateData)
// console.log(this.planTemplateData)
}
selectedItem//传来的组织指挥或者。。。
planTemplateData//传来的数据

Loading…
Cancel
Save