|
|
|
@ -17,9 +17,7 @@ export class CreateTestScoreComponent implements OnInit {
|
|
|
|
|
this.selectedTab = index |
|
|
|
|
} |
|
|
|
|
ngOnInit(): void { |
|
|
|
|
this.unitId.forEach(item => { |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
console.log(12345,) |
|
|
|
|
this.getUnitData() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -77,10 +75,14 @@ export class CreateTestScoreComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
//上个页面传过来的单位数据
|
|
|
|
|
unitId:any = [{name:'最最最最最',id:'5fb76c42919f2b44e464016f'}, |
|
|
|
|
// {name:'华南城集团有限公司',id:'5ee19fe06f91049f5e23e937'},
|
|
|
|
|
// {name:'贵港油库',id:'5fa35d68f8eb762cb03c662e'}
|
|
|
|
|
{name:'华南城集团有限公司',id:'5ee19fe06f91049f5e23e937'}, |
|
|
|
|
{name:'贵港油库',id:'5fa35d68f8eb762cb03c662e'} |
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取单位数据
|
|
|
|
|
getUnitData(){ |
|
|
|
|
this.unitId.forEach((element,index) => { |
|
|
|
@ -94,7 +96,7 @@ export class CreateTestScoreComponent implements OnInit {
|
|
|
|
|
name: '单位信息', |
|
|
|
|
type:'基本信息', |
|
|
|
|
expanded: false, |
|
|
|
|
key:element.id + '单位信息' + index, |
|
|
|
|
key:(Math.random()*10000000).toString(16).substr(0,4)+(new Date()).getTime()+Math.random().toString().substr(2,5), |
|
|
|
|
children:[] |
|
|
|
|
} |
|
|
|
|
data.usci ? unitData.children.push({ |
|
|
|
@ -138,25 +140,71 @@ export class CreateTestScoreComponent implements OnInit {
|
|
|
|
|
console.log(1234,buildingsData) |
|
|
|
|
buildingsData.name = data[i].name |
|
|
|
|
buildingsData.buildingType = data[i].buildingTypes[0].name |
|
|
|
|
let propertyInfosArr = [] |
|
|
|
|
buildingsData[0].buildingBasicGroups[0].propertyInfos.forEach((x,key) => { |
|
|
|
|
if(x.propertyValue){ |
|
|
|
|
x.key = data[i].name + x.propertyName + key |
|
|
|
|
x.isLeaf = true |
|
|
|
|
x.name = x.propertyName |
|
|
|
|
propertyInfosArr.push(x) |
|
|
|
|
|
|
|
|
|
buildingsData[0].buildingBasicGroups.forEach((y,m) => { |
|
|
|
|
let propertyInfosArr = [] |
|
|
|
|
let tabledata |
|
|
|
|
if(y.type == 1){//如果是表格类
|
|
|
|
|
var map = {}, |
|
|
|
|
dest:any = []; |
|
|
|
|
for(var i = 0; i < y.propertyInfos.length; i++){ |
|
|
|
|
var ai = y.propertyInfos[i]; |
|
|
|
|
if(!map[ai.propertyName]){ |
|
|
|
|
dest.push({ |
|
|
|
|
propertyName: ai.propertyName, |
|
|
|
|
data: [ai] |
|
|
|
|
}); |
|
|
|
|
map[ai.propertyName] = ai; |
|
|
|
|
}else{ |
|
|
|
|
for(var j = 0; j < dest.length; j++){ |
|
|
|
|
var dj = dest[j]; |
|
|
|
|
if(dj.propertyName == ai.propertyName){ |
|
|
|
|
dj.data.push(ai); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//根据行数确定在循环数组中的index
|
|
|
|
|
dest.forEach(item => { |
|
|
|
|
item.data.sort(function(a,b){ |
|
|
|
|
return Number(a.tag) - Number(b.tag)
|
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
y.tabledata = dest |
|
|
|
|
tabledata = dest |
|
|
|
|
console.log('pppp',y) |
|
|
|
|
y.tabledata[0].data.forEach((x,key) => { |
|
|
|
|
if(x.propertyValue){ |
|
|
|
|
x.key = (Math.random()*10000000).toString(16).substr(0,4)+(new Date()).getTime()+Math.random().toString().substr(2,5) |
|
|
|
|
x.isLeaf = true |
|
|
|
|
x.name = x.propertyValue |
|
|
|
|
propertyInfosArr.push(x) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}else{ |
|
|
|
|
y.propertyInfos.forEach((x,key) => { |
|
|
|
|
if(x.propertyValue){ |
|
|
|
|
x.key = (Math.random()*10000000).toString(16).substr(0,4)+(new Date()).getTime()+Math.random().toString().substr(2,5) |
|
|
|
|
x.isLeaf = true |
|
|
|
|
x.name = x.propertyName |
|
|
|
|
propertyInfosArr.push(x) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
element.basicInfoNodes.push({ |
|
|
|
|
name:y.name != '基本信息' ? buildingsData.name + '-' + y.name : buildingsData.name , |
|
|
|
|
type:'基本信息', |
|
|
|
|
expanded: false, |
|
|
|
|
key:(Math.random()*10000000).toString(16).substr(0,4)+(new Date()).getTime()+Math.random().toString().substr(2,5), |
|
|
|
|
children:propertyInfosArr, |
|
|
|
|
tabledata:tabledata ? tabledata : null |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
element.basicInfoNodes = [...element.basicInfoNodes] |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
element.basicInfoNodes.push({ |
|
|
|
|
name: buildingsData.name, |
|
|
|
|
type:'基本信息', |
|
|
|
|
expanded: false, |
|
|
|
|
key:buildingsData[0].id, |
|
|
|
|
children:propertyInfosArr |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
element.basicInfoNodes = [...element.basicInfoNodes] |
|
|
|
|
|
|
|
|
|
resolve(i) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
@ -169,10 +217,11 @@ export class CreateTestScoreComponent implements OnInit {
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//获得建筑信息
|
|
|
|
|
getAllBuildingsInfo(unitId){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//查看树节点
|
|
|
|
|
lookTreeNode(node){ |
|
|
|
|
console.log(node.origin) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|