|
|
|
@ -1,9 +1,9 @@
|
|
|
|
|
import { SelectionModel } from '@angular/cdk/collections'; |
|
|
|
|
import { HttpClient } from '@angular/common/http'; |
|
|
|
|
import { Component, Inject, OnInit } from '@angular/core'; |
|
|
|
|
import { Component, Inject, OnInit, ViewChild } from '@angular/core'; |
|
|
|
|
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; |
|
|
|
|
import { MatTableDataSource } from '@angular/material/table'; |
|
|
|
|
import { NzFormatEmitEvent } from 'ng-zorro-antd/tree'; |
|
|
|
|
import { NzFormatEmitEvent, NzTreeComponent } from 'ng-zorro-antd/tree'; |
|
|
|
|
@Component({ |
|
|
|
|
selector: 'app-create-test-score', |
|
|
|
|
templateUrl: './create-test-score.component.html', |
|
|
|
@ -475,12 +475,12 @@ export class CreateTestScoreComponent implements OnInit {
|
|
|
|
|
if (data.length != 0) { getAllBuildingFireFac(data) } |
|
|
|
|
}) |
|
|
|
|
async function getAllBuildingFireFac (buildingsdata) { |
|
|
|
|
console.log('建筑'+index,buildingsdata) |
|
|
|
|
// console.log('建筑'+index,buildingsdata)
|
|
|
|
|
for (let i = 0, length = buildingsdata.length; i < length; i++){ |
|
|
|
|
let header = {buildingId: buildingsdata[i].id, buildingType: buildingsdata[i].buildingTypes[0].id,companyId:buildingsdata[i].companyId} |
|
|
|
|
let result = await new Promise((resolve, reject) =>{ |
|
|
|
|
that.http.get('/api/BuildingFacilities',{params:header}).subscribe((data:any)=>{ |
|
|
|
|
console.log(index+'消防设施'+ i,data) |
|
|
|
|
// console.log(index+'消防设施'+ i,data)
|
|
|
|
|
|
|
|
|
|
data[0].summary.buildingFacilityGroups.forEach(element => { //循环单位内置分组项
|
|
|
|
|
element.facilityItems.forEach((elements,index) => { |
|
|
|
@ -732,6 +732,279 @@ export class CreateTestScoreComponent implements OnInit {
|
|
|
|
|
}) |
|
|
|
|
this.examScore = examScore + examScore2 |
|
|
|
|
} |
|
|
|
|
@ViewChild('nzTreeComponent', { static: false }) nzTreeComponent!: NzTreeComponent; |
|
|
|
|
//保存
|
|
|
|
|
save(){ |
|
|
|
|
let copyDatas = JSON.parse(JSON.stringify(this.unitId)) |
|
|
|
|
|
|
|
|
|
//循环每个建筑处理数据筛选出选中数据
|
|
|
|
|
copyDatas.forEach(item => { |
|
|
|
|
//建筑的基本信息模块处理
|
|
|
|
|
item.basicInfoNodes.forEach((i,key) => { |
|
|
|
|
//如果顶级节点未选中则需要筛除没有选中的数据
|
|
|
|
|
if(!i.checked){ |
|
|
|
|
// console.log(i)
|
|
|
|
|
let newArr = [] |
|
|
|
|
i.children.forEach(element => { |
|
|
|
|
element.checked ? newArr.push(element) : null |
|
|
|
|
}) |
|
|
|
|
let discard = []//即将废弃的数组
|
|
|
|
|
// newArr.length == 0 ? item.basicInfoNodes.splice(key,1) : i.children = newArr
|
|
|
|
|
newArr.length == 0 ? discard.push(i) : i.children = newArr |
|
|
|
|
item.basicInfoNodes = item.basicInfoNodes.filter(items => { |
|
|
|
|
if (!discard.includes(items)) return items; |
|
|
|
|
}) |
|
|
|
|
}
|
|
|
|
|
//将children处理成指定形式
|
|
|
|
|
if(i.name =='单位信息'){ |
|
|
|
|
let newChildren = [] |
|
|
|
|
i.children.forEach((element,index) => { |
|
|
|
|
let newChildrenItem:any= {} |
|
|
|
|
newChildrenItem.name = element.name//题目名称
|
|
|
|
|
newChildrenItem.result = element.value//题目答案
|
|
|
|
|
newChildrenItem.physicalUnit = element.physicalUnit || ''//计量单位
|
|
|
|
|
newChildrenItem.propertyType = 0//输入框类型
|
|
|
|
|
newChildren.push(newChildrenItem) |
|
|
|
|
}) |
|
|
|
|
i.children = newChildren |
|
|
|
|
}else if(!i.tabledata){ |
|
|
|
|
let newChildren = [] |
|
|
|
|
i.children.forEach((element,index) => { |
|
|
|
|
let newChildrenItem:any= {} |
|
|
|
|
newChildrenItem.name = element.propertyName//题目名称
|
|
|
|
|
newChildrenItem.result = element.propertyValue//题目答案
|
|
|
|
|
newChildrenItem.physicalUnit = element.physicalUnit || ''//计量单位
|
|
|
|
|
newChildrenItem.propertyType = element.propertyType//输入框类型
|
|
|
|
|
newChildren.push(newChildrenItem) |
|
|
|
|
}) |
|
|
|
|
i.children = newChildren |
|
|
|
|
}else if(i.tabledata){//如果是表格类
|
|
|
|
|
let newChildren = [] |
|
|
|
|
i.children.forEach((element,index) => { |
|
|
|
|
let newChildrenItem:any= {} |
|
|
|
|
newChildrenItem.name = element.propertyValue//题目名称
|
|
|
|
|
newChildrenItem.result = element.tag//代表第几行
|
|
|
|
|
newChildrenItem.physicalUnit = ''//计量单位
|
|
|
|
|
newChildrenItem.propertyType = ''//输入框类型
|
|
|
|
|
newChildren.push(newChildrenItem) |
|
|
|
|
}) |
|
|
|
|
i.children = newChildren |
|
|
|
|
i.tabledata.forEach(element => { |
|
|
|
|
let newData = [] |
|
|
|
|
element.data.forEach(ele => { |
|
|
|
|
let newObj:any = {} |
|
|
|
|
newObj.name = ele.propertyName//题目名称
|
|
|
|
|
newObj.result = ele.propertyValue//代表第几行
|
|
|
|
|
newObj.physicalUnit = ele.physicalUnit//计量单位
|
|
|
|
|
newObj.propertyType = ele.propertyType//输入框类型
|
|
|
|
|
newObj.tag = ele.tag//第几行
|
|
|
|
|
newData.push(newObj) |
|
|
|
|
}) |
|
|
|
|
element.data = newData |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
delete i.selected |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
//建筑的四周毗邻模块处理
|
|
|
|
|
item.aroundNodes.forEach((i,key) => { |
|
|
|
|
//如果顶级节点未选中则需要筛除没有选中的数据
|
|
|
|
|
if(!i.checked){ |
|
|
|
|
let newArr = [] |
|
|
|
|
i.children.forEach(element => { |
|
|
|
|
element.checked ? newArr.push(element) : null |
|
|
|
|
}) |
|
|
|
|
let discard = []//即将废弃的数组
|
|
|
|
|
newArr.length == 0 ? discard.push(i) : i.children = newArr |
|
|
|
|
item.aroundNodes = item.aroundNodes.filter(items => { |
|
|
|
|
if (!discard.includes(items)) return items; |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
let newChildren = [] |
|
|
|
|
i.children.forEach((element,index) => { |
|
|
|
|
let newChildrenItem:any= {} |
|
|
|
|
newChildrenItem.name = element.title//题目名称
|
|
|
|
|
newChildrenItem.result = element.name//题目答案
|
|
|
|
|
newChildrenItem.physicalUnit = ''//计量单位
|
|
|
|
|
newChildrenItem.propertyType = 0//输入框类型
|
|
|
|
|
newChildren.push(newChildrenItem) |
|
|
|
|
}) |
|
|
|
|
i.children = newChildren |
|
|
|
|
delete i.selected |
|
|
|
|
}) |
|
|
|
|
//建筑的重点部位模块处理
|
|
|
|
|
item.keySiteNodes.forEach((i,key) => { |
|
|
|
|
i.selected ? i.selected = null : null |
|
|
|
|
//如果顶级节点未选中则需要筛除没有选中的数据
|
|
|
|
|
if(!i.checked){ |
|
|
|
|
let newArr = [] |
|
|
|
|
i.children.forEach(element => { |
|
|
|
|
element.checked ? newArr.push(element) : null |
|
|
|
|
}) |
|
|
|
|
let discard = []//即将废弃的数组
|
|
|
|
|
newArr.length == 0 ? discard.push(i) : i.children = newArr |
|
|
|
|
item.keySiteNodes = item.keySiteNodes.filter(items => { |
|
|
|
|
if (!discard.includes(items)) return items; |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
i.tabledata = [{propertyName: "重点部位名称",data:[]}, |
|
|
|
|
{propertyName: "重点部位所在位置",data:[]}, |
|
|
|
|
{propertyName: "建筑结构",data:[]}, |
|
|
|
|
{propertyName: "使用性质",data:[]}, |
|
|
|
|
{propertyName: "主要危险性",data:[]}] |
|
|
|
|
i.children.forEach(element => { |
|
|
|
|
i.tabledata[0].data.push({ |
|
|
|
|
name: "重点部位名称", |
|
|
|
|
physicalUnit: '', |
|
|
|
|
propertyType: 0, |
|
|
|
|
result: element.name, |
|
|
|
|
tag: "" |
|
|
|
|
}) |
|
|
|
|
i.tabledata[1].data.push({ |
|
|
|
|
name: "重点部位所在位置", |
|
|
|
|
physicalUnit: '', |
|
|
|
|
propertyType: 0, |
|
|
|
|
result: element.position, |
|
|
|
|
tag: "" |
|
|
|
|
}) |
|
|
|
|
i.tabledata[2].data.push({ |
|
|
|
|
name: "建筑结构", |
|
|
|
|
physicalUnit: '', |
|
|
|
|
propertyType: 0, |
|
|
|
|
result: element.structure, |
|
|
|
|
tag: "" |
|
|
|
|
}) |
|
|
|
|
i.tabledata[3].data.push({ |
|
|
|
|
name: "使用性质", |
|
|
|
|
physicalUnit: '', |
|
|
|
|
propertyType: 0, |
|
|
|
|
result: element.nature, |
|
|
|
|
tag: "" |
|
|
|
|
}) |
|
|
|
|
i.tabledata[4].data.push({ |
|
|
|
|
name: "主要危险性", |
|
|
|
|
physicalUnit: '', |
|
|
|
|
propertyType: 0, |
|
|
|
|
result: element.hazards, |
|
|
|
|
tag: "" |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
let newChildren = [] |
|
|
|
|
i.children.forEach((element,index) => { |
|
|
|
|
let newChildrenItem:any= {} |
|
|
|
|
// newChildrenItem.name = element.name//重点部位题目名称
|
|
|
|
|
// newChildrenItem.position = element.position//重点部位所在位置
|
|
|
|
|
// newChildrenItem.structure = element.structure//重点部位建筑结构
|
|
|
|
|
// newChildrenItem.nature = element.nature//重点部位使用性质
|
|
|
|
|
// newChildrenItem.hazards = element.hazards//重点部位主要危险性
|
|
|
|
|
newChildrenItem.name = element.name//题目名称
|
|
|
|
|
newChildrenItem.result = element.position + element.structure + element.nature + element.hazards//题目答案
|
|
|
|
|
newChildrenItem.physicalUnit = element.physicalUnit || ''//计量单位
|
|
|
|
|
newChildrenItem.propertyType = 0//输入框类型
|
|
|
|
|
newChildren.push(newChildrenItem) |
|
|
|
|
}) |
|
|
|
|
i.children = newChildren |
|
|
|
|
delete i.selected |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
//建筑的功能分区模块处理
|
|
|
|
|
item.funDivNodes.forEach((i,key) => { |
|
|
|
|
|
|
|
|
|
//如果顶级节点未选中则需要筛除没有选中的数据
|
|
|
|
|
if(!i.checked){ |
|
|
|
|
let newArr = [] |
|
|
|
|
i.children.forEach(element => { |
|
|
|
|
element.checked ? newArr.push(element) : null |
|
|
|
|
}) |
|
|
|
|
let discard = []//即将废弃的数组
|
|
|
|
|
newArr.length == 0 ? discard.push(i) : i.children = newArr |
|
|
|
|
item.funDivNodes = item.funDivNodes.filter(items => { |
|
|
|
|
if (!discard.includes(items)) return items; |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
i.tabledata = [{propertyName: "区域",data:[]}, |
|
|
|
|
{propertyName: "面积",data:[]}, |
|
|
|
|
{propertyName: "基本情况",data:[]}] |
|
|
|
|
i.children.forEach(element => { |
|
|
|
|
i.tabledata[0].data.push({ |
|
|
|
|
name: "区域", |
|
|
|
|
physicalUnit: '', |
|
|
|
|
propertyType: 0, |
|
|
|
|
result: element.region, |
|
|
|
|
tag: "" |
|
|
|
|
}) |
|
|
|
|
i.tabledata[1].data.push({ |
|
|
|
|
name: "面积", |
|
|
|
|
physicalUnit: '', |
|
|
|
|
propertyType: 0, |
|
|
|
|
result: element.area, |
|
|
|
|
tag: "" |
|
|
|
|
}) |
|
|
|
|
i.tabledata[2].data.push({ |
|
|
|
|
name: "基本情况", |
|
|
|
|
physicalUnit: '', |
|
|
|
|
propertyType: 0, |
|
|
|
|
result: element.details, |
|
|
|
|
tag: "" |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
let newChildren = [] |
|
|
|
|
i.children.forEach((element,index) => { |
|
|
|
|
let newChildrenItem:any= {} |
|
|
|
|
// newChildrenItem.name = element.region//功能分区题目名称
|
|
|
|
|
// newChildrenItem.area = element.area//功能分区面积
|
|
|
|
|
// newChildrenItem.details = element.details//功能分区基本情况
|
|
|
|
|
newChildrenItem.name = element.region//题目名称
|
|
|
|
|
newChildrenItem.result = element.area + element.details//题目答案
|
|
|
|
|
newChildrenItem.physicalUnit = element.physicalUnit || ''//计量单位
|
|
|
|
|
newChildrenItem.propertyType = 0//输入框类型
|
|
|
|
|
newChildren.push(newChildrenItem) |
|
|
|
|
}) |
|
|
|
|
i.children = newChildren |
|
|
|
|
delete i.selected |
|
|
|
|
}) |
|
|
|
|
//建筑的数据核验模块处理
|
|
|
|
|
item.fireFacNodes.forEach((i,key) => { |
|
|
|
|
i.selected ? i.selected = null : null |
|
|
|
|
//如果顶级节点未选中则需要筛除没有选中的数据
|
|
|
|
|
if(!i.checked){ |
|
|
|
|
let newArr = [] |
|
|
|
|
i.children.forEach(element => { |
|
|
|
|
element.checked ? newArr.push(element) : null |
|
|
|
|
}) |
|
|
|
|
let discard = []//即将废弃的数组
|
|
|
|
|
newArr.length == 0 ? discard.push(i) : i.children = newArr |
|
|
|
|
item.fireFacNodes = item.fireFacNodes.filter(items => { |
|
|
|
|
if (!discard.includes(items)) return items; |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
let newChildren = [] |
|
|
|
|
i.children.forEach((element,index) => { |
|
|
|
|
let newChildrenItem:any= {} |
|
|
|
|
newChildrenItem.name = element.name//题目名称
|
|
|
|
|
newChildrenItem.result = element.total//题目答案
|
|
|
|
|
newChildrenItem.physicalUnit = ''//计量单位
|
|
|
|
|
newChildrenItem.propertyType = 0//输入框类型
|
|
|
|
|
newChildren.push(newChildrenItem) |
|
|
|
|
}) |
|
|
|
|
i.children = newChildren |
|
|
|
|
delete i.selected |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
//循环每个建筑处理数据
|
|
|
|
|
console.log(copyDatas)
|
|
|
|
|
// copyDatas.forEach(item =>{
|
|
|
|
|
// //建筑的基本信息模块处理
|
|
|
|
|
// item.basicInfoNodes.forEach((i,key) => {
|
|
|
|
|
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// })
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//添加预案1
|
|
|
|
|