邵佳豪 3 years ago
parent
commit
aeacfbea3d
  1. 305
      src/app/plan-management/create-plan-online-five/create-plan-online-five.component.ts

305
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-08-24 15:32:48
* @LastEditTime: 2021-08-27 15:27:29
*/
import { HttpClient } from '@angular/common/http';
import { Component, Inject, OnInit, Renderer2, ViewChild, Input } from '@angular/core';
@ -64,6 +64,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
this.pattern='edit'
}
this.getUnitData()
//this.getpili()
this.getOrganizations();
//this.getAllBuildings()
}
@ -162,6 +163,72 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
});
})
}
//获得四周毗邻信息
pilinData=[]
async getpili(){
let result = await new Promise((resolve) =>{
this.planTemplateData[1].building.forEach(element => {
let id = {buildingId:element.buildingId}
this.http.get('/api/BuildingAdjoins',{params:id}).subscribe(data=>{
this.pilinData.push(data)
resolve(data)
})
});
})
//this.pilinData.push(result)
this.pilinData=JSON.parse(JSON.stringify(this.pilinData))
console.log(this.pilinData)
this.pilinData.forEach((pvalue,pindex,parr)=>{
parr[pindex].forEach((nval,nindex,narr) => {
this.planTemplateData[1].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
}else if(nval.direction==1){
this.planTemplateData[1].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
}else if(nval.direction==3){
this.planTemplateData[1].building[i].body[2].attinf[3].value=nval.name
}
}
});
});
})
}
//获取重点部位
buData=[]
async getbuwei(){
let result = await new Promise((resolve) =>{
this.planTemplateData[1].building.forEach(element => {
let id = {buildingId:element.buildingId}
this.http.get('/api/BuildingImportantLocations',{params:id}).subscribe(data=>{
this.buData.push(data)
resolve(data)
})
});
})
this.buData=JSON.parse(JSON.stringify(this.buData))
console.log(this.buData)
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
});
}
})
}
selectedItem: string = '封面'
async clickTitleItem(item) {
@ -257,14 +324,16 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
} else if (this.selectedItem == '单位概况') {
await this.getAllBuildings()
await this.getAllBuildingsInfo()
console.log(this.buildZong)
await this.getpili()
await this.getbuwei()
//console.log(this.buildZong)
this.planTemplateData[1].building.forEach(element => {
element.body[0].attinf[0].olddata = this.unitData.usci
element.body[0].attinf[1].olddata = this.unitData.buildingTypes[0].name
element.body[0].attinf[2].olddata = this.unitData.contacts
element.body[0].attinf[3].olddata = this.unitData.phone
element.body[0].attinf[4].olddata = this.unitData.organizationName
element.body[0].attinf[5].olddata = this.unitData.address
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
element.body[0].attinf[3].value=element.body[0].attinf[3].olddata = this.unitData.phone
element.body[0].attinf[4].value=element.body[0].attinf[4].olddata = this.unitData.organizationName
element.body[0].attinf[5].value=element.body[0].attinf[5].olddata = this.unitData.address
if(element.body[1].attinf!=undefined){
element.body[1].attinf.forEach(eBuild => {
this.buildZong.forEach(oldBuild => {
@ -279,12 +348,12 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
});
this.planTemplateData[1].attribute[0].attinf[0].value=this.planTemplateData[1].attribute[0].attinf[0].olddata = this.unitData.usci
/* 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
this.planTemplateData[1].attribute[0].attinf[5].value=this.planTemplateData[1].attribute[0].attinf[5].olddata = this.unitData.address */
console.log(this.planTemplateData)
} /* else if (this.selectedItem == '单位概况') {
@ -300,6 +369,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
buildZong
//获得所有建筑信息
async getAllBuildingsInfo(){
const result = await new Promise((resolve) =>{
this.http.get("/api/Buildings",{
params:{
@ -320,7 +390,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
resolve(this.buildingsData)
})
}
console.log(this.buildingsData)
//console.log(this.buildingsData)
if (this.planTemplateData[1].building == undefined) {
this.planTemplateData[1].building = []
if(this.planTemplateData[1].attribute[1].attinf!=undefined){
@ -337,16 +407,23 @@ 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, body: this.planTemplateData[1].attribute, completed: true })
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 })
} else {
this.planTemplateData[1].building.push({ name: this.buildDataName[i].name, body: this.planTemplateData[1].attribute, completed: false })
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 })
}
}
}
})
})
//console.log(result)
for(var a=0;a<this.planTemplateData[1].building.length;a++){
if(a>0){
this.planTemplateData[1].building[a].body[0].completed=false
}
}
this.buildZong=result
}
@ -636,98 +713,101 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
var orginputCount=0
var orgtextAreaCount=0
var orgtreeCount=0
if(this.planTemplateData[4]!=undefined&&this.planTemplateData[4].groupName=='组织指挥'){
this.planTemplateData[4].attribute.forEach((orgvalue,orgi,orgArr) => {
if(orgArr[orgi].level=='1'){
orgtableCount++
this.yinJson.organizationCommands.tableCount.tables.push({itemCount:orgArr[orgi].tableth.length})
}else if(orgArr[orgi].level=='2'){
orginputCount++
this.yinJson.organizationCommands.inputCount.inputs.push({colCount:orgArr[orgi].lieNumber,rowCount:orgArr[orgi].hNumber})
}else if(orgArr[orgi].level=='3'){
orgtextAreaCount++
}else if(orgArr[orgi].level=='4'){
orgtreeCount++
}
});
}
this.yinJson.organizationCommands.tableCount.totalCount=orgtableCount
this.yinJson.organizationCommands.inputCount.totalCount=orginputCount
this.yinJson.organizationCommands.textAreaCount.totalCount=orgtextAreaCount
this.yinJson.organizationCommands.treeCount.totalCount=orgtreeCount
var shetableCount=0
var sheinputCount=0
var shetextAreaCount=0
var shetreeCount=0
if(this.planTemplateData[6]!=undefined&&this.planTemplateData[6].groupName=='社会联动'){
this.planTemplateData[6].attribute.forEach((orgvalue,orgi,orgArr) => {
if(orgArr[orgi].level=='1'){
shetableCount++
//this.yinJson.organizationCommands.tableCount.tables.push({itemCount:orgtableCount})
}else if(orgArr[orgi].level=='2'){
sheinputCount++
this.yinJson.socialLinkages.inputCount.inputs.push({colCount:orgArr[orgi].lieNumber,rowCount:orgArr[orgi].hNumber})
}else if(orgArr[orgi].level=='3'){
shetextAreaCount++
}else if(orgArr[orgi].level=='4'){
shetreeCount++
}
});
}
this.yinJson.socialLinkages.tableCount.totalCount=shetableCount
this.yinJson.socialLinkages.inputCount.totalCount=sheinputCount
this.yinJson.socialLinkages.textAreaCount.totalCount=shetextAreaCount
this.yinJson.socialLinkages.treeCount.totalCount=shetreeCount
var qintableCount=0
var qininputCount=0
var qintextAreaCount=0
var qintreeCount=0
if(this.planTemplateData[7]!=undefined&&this.planTemplateData[7].groupName=='勤务保障'){
this.planTemplateData[7].attribute.forEach((orgvalue,orgi,orgArr) => {
if(orgArr[orgi].level=='1'){
qintableCount++
//this.yinJson.organizationCommands.tableCount.tables.push({itemCount:orgtableCount})
}else if(orgArr[orgi].level=='2'){
qininputCount++
this.yinJson.serviceSupports.inputCount.inputs.push({colCount:orgArr[orgi].lieNumber,rowCount:orgArr[orgi].hNumber})
}else if(orgArr[orgi].level=='3'){
qintextAreaCount++
}else if(orgArr[orgi].level=='4'){
qintreeCount++
}
});
}
this.yinJson.serviceSupports.tableCount.totalCount=qintableCount
this.yinJson.serviceSupports.inputCount.totalCount=qininputCount
this.yinJson.serviceSupports.textAreaCount.totalCount=qintextAreaCount
this.yinJson.serviceSupports.treeCount.totalCount=qintreeCount
var futableCount=0
var fuinputCount=0
var futextAreaCount=0
var futreeCount=0
if(this.planTemplateData[9]!=undefined&&this.planTemplateData[9].groupName=='辅助决策'){
this.planTemplateData[9].attribute.forEach((orgvalue,orgi,orgArr) => {
if(orgArr[orgi].level=='1'){
futableCount++
//this.yinJson.organizationCommands.tableCount.tables.push({itemCount:orgtableCount})
}else if(orgArr[orgi].level=='2'){
fuinputCount++
this.yinJson.decisionSupports.inputCount.inputs.push({colCount:orgArr[orgi].lieNumber,rowCount:orgArr[orgi].hNumber})
}else if(orgArr[orgi].level=='3'){
futextAreaCount++
}else if(orgArr[orgi].level=='4'){
futreeCount++
}
});
}
this.planTemplateData.forEach((value,index,array) => {
if(value.groupName=='组织指挥'){
this.planTemplateData[4].attribute.forEach((orgvalue,orgi,orgArr) => {
if(orgArr[orgi].level=='1'){
orgtableCount++
this.yinJson.organizationCommands.tableCount.tables.push({itemCount:orgArr[orgi].tableth.length})
}else if(orgArr[orgi].level=='2'){
orginputCount++
this.yinJson.organizationCommands.inputCount.inputs.push({colCount:orgArr[orgi].lieNumber,rowCount:orgArr[orgi].hNumber})
}else if(orgArr[orgi].level=='3'){
orgtextAreaCount++
}else if(orgArr[orgi].level=='4'){
orgtreeCount++
}
});
}
this.yinJson.organizationCommands.tableCount.totalCount=orgtableCount
this.yinJson.organizationCommands.inputCount.totalCount=orginputCount
this.yinJson.organizationCommands.textAreaCount.totalCount=orgtextAreaCount
this.yinJson.organizationCommands.treeCount.totalCount=orgtreeCount
var shetableCount=0
var sheinputCount=0
var shetextAreaCount=0
var shetreeCount=0
if(value.groupName=='社会联动'){
this.planTemplateData[6].attribute.forEach((orgvalue,orgi,orgArr) => {
if(orgArr[orgi].level=='1'){
shetableCount++
//this.yinJson.organizationCommands.tableCount.tables.push({itemCount:orgtableCount})
}else if(orgArr[orgi].level=='2'){
sheinputCount++
this.yinJson.socialLinkages.inputCount.inputs.push({colCount:orgArr[orgi].lieNumber,rowCount:orgArr[orgi].hNumber})
}else if(orgArr[orgi].level=='3'){
shetextAreaCount++
}else if(orgArr[orgi].level=='4'){
shetreeCount++
}
});
}
this.yinJson.socialLinkages.tableCount.totalCount=shetableCount
this.yinJson.socialLinkages.inputCount.totalCount=sheinputCount
this.yinJson.socialLinkages.textAreaCount.totalCount=shetextAreaCount
this.yinJson.socialLinkages.treeCount.totalCount=shetreeCount
var qintableCount=0
var qininputCount=0
var qintextAreaCount=0
var qintreeCount=0
if(value.groupName=='勤务保障'){
this.planTemplateData[7].attribute.forEach((orgvalue,orgi,orgArr) => {
if(orgArr[orgi].level=='1'){
qintableCount++
//this.yinJson.organizationCommands.tableCount.tables.push({itemCount:orgtableCount})
}else if(orgArr[orgi].level=='2'){
qininputCount++
this.yinJson.serviceSupports.inputCount.inputs.push({colCount:orgArr[orgi].lieNumber,rowCount:orgArr[orgi].hNumber})
}else if(orgArr[orgi].level=='3'){
qintextAreaCount++
}else if(orgArr[orgi].level=='4'){
qintreeCount++
}
});
}
this.yinJson.serviceSupports.tableCount.totalCount=qintableCount
this.yinJson.serviceSupports.inputCount.totalCount=qininputCount
this.yinJson.serviceSupports.textAreaCount.totalCount=qintextAreaCount
this.yinJson.serviceSupports.treeCount.totalCount=qintreeCount
var futableCount=0
var fuinputCount=0
var futextAreaCount=0
var futreeCount=0
if(value.groupName=='辅助决策'){
this.planTemplateData[9].attribute.forEach((orgvalue,orgi,orgArr) => {
if(orgArr[orgi].level=='1'){
futableCount++
//this.yinJson.organizationCommands.tableCount.tables.push({itemCount:orgtableCount})
}else if(orgArr[orgi].level=='2'){
fuinputCount++
this.yinJson.decisionSupports.inputCount.inputs.push({colCount:orgArr[orgi].lieNumber,rowCount:orgArr[orgi].hNumber})
}else if(orgArr[orgi].level=='3'){
futextAreaCount++
}else if(orgArr[orgi].level=='4'){
futreeCount++
}
});
}
this.yinJson.decisionSupports.tableCount.totalCount=futableCount
this.yinJson.decisionSupports.inputCount.totalCount=fuinputCount
this.yinJson.decisionSupports.textAreaCount.totalCount=futextAreaCount
this.yinJson.decisionSupports.treeCount.totalCount=futreeCount
});
this.yinJson.decisionSupports.tableCount.totalCount=futableCount
this.yinJson.decisionSupports.inputCount.totalCount=fuinputCount
this.yinJson.decisionSupports.textAreaCount.totalCount=futextAreaCount
this.yinJson.decisionSupports.treeCount.totalCount=futreeCount
}
if(type==5){
var orgtableCount=0
@ -988,18 +1068,7 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
})
})
this.allBuildings = data
/* if (this.planTemplateData[1].building == undefined) {
this.planTemplateData[1].building = []
for (var i = 0; i < this.allBuildings.length; i++) {
if (i == 0) {
this.planTemplateData[1].building.push({ name: this.allBuildings[i].name, body: this.planTemplateData[1].attribute, completed: true })
} else {
this.planTemplateData[1].building.push({ name: this.allBuildings[i].name, body: this.planTemplateData[1].attribute, completed: false })
}
}
} */
this.group = this.planTemplateData[1].building
//this.group = this.planTemplateData[1].building
//delete this.planTemplateData[0].attribute
})
@ -1098,6 +1167,8 @@ export class CreatePlanOnlineFiveComponent implements OnInit {
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
}

Loading…
Cancel
Save