|
|
|
@ -201,16 +201,103 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
result.shift(); // 移除预置的 索引为0 的值
|
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
getunithouse(data,n,x){
|
|
|
|
|
data[0].buildingtypeId = n.id |
|
|
|
|
data[0].name = x.name |
|
|
|
|
data[0].buildtype = n.name |
|
|
|
|
data[0].tongyong = true |
|
|
|
|
data[0].index = x.index |
|
|
|
|
if(data[0].buildtype == "石油化工类"){ |
|
|
|
|
data[0].tongyong = false |
|
|
|
|
data[0].isshiyou = true |
|
|
|
|
this.deviceinfodata = data[0].buildingBasicGroups[1].propertyInfos //存储装置信息的初始数据,需要转换成datasource形式
|
|
|
|
|
var map = [] |
|
|
|
|
this.deviceinfodata.forEach((item,index) => { |
|
|
|
|
if(item.tag == ""){ |
|
|
|
|
item.tag = "1" |
|
|
|
|
} |
|
|
|
|
if(!(item.tag in map)){ |
|
|
|
|
map[item.tag] = [] |
|
|
|
|
} |
|
|
|
|
map[item.tag].push(item) |
|
|
|
|
}); |
|
|
|
|
let zhuangzhiinfodatasource = [] |
|
|
|
|
map.forEach((item,index)=>{ |
|
|
|
|
zhuangzhiinfodatasource[index] = {} |
|
|
|
|
item.forEach(i => { |
|
|
|
|
if (i.propertyName == "装置区名称") { |
|
|
|
|
zhuangzhiinfodatasource[index].name = i.propertyValue |
|
|
|
|
} |
|
|
|
|
if (i.propertyName == "工艺流程") { |
|
|
|
|
zhuangzhiinfodatasource[index].flow = i.propertyValue |
|
|
|
|
} |
|
|
|
|
if (i.propertyName == "火灾危险性") { |
|
|
|
|
zhuangzhiinfodatasource[index].danger = i.propertyValue |
|
|
|
|
} |
|
|
|
|
if (i.propertyName == "灭火注意事项") { |
|
|
|
|
zhuangzhiinfodatasource[index].payattentionto = i.propertyValue |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
this.newzhuangzhiinfodatasource =[] //数据去空
|
|
|
|
|
zhuangzhiinfodatasource.forEach(item=>{ |
|
|
|
|
if(item !== "" && item != undefined){ |
|
|
|
|
this.newzhuangzhiinfodatasource.push(item) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
this.devicedataSourcebox[data[0].buildingId] = new MatTableDataSource<any>(this.newzhuangzhiinfodatasource) |
|
|
|
|
data[0].newzhuangzhiinfodatasource = this.newzhuangzhiinfodatasource |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//把bigfor分组取出来 先大循环 (储罐信息---储罐信息/罐区情况)为一组
|
|
|
|
|
let bigtankgroups = data[0].buildingBasicGroups.slice(2) |
|
|
|
|
// console.log("bigtankgroups",bigtankgroups)
|
|
|
|
|
let proportion = 2; //按照比例切割
|
|
|
|
|
let num = 0; |
|
|
|
|
let bigfor =[]; |
|
|
|
|
for(let i=0;i<bigtankgroups.length;i++){ |
|
|
|
|
if(i % proportion == 0 && i != 0){ |
|
|
|
|
bigfor.push(bigtankgroups.slice(num,i)); |
|
|
|
|
num = i; |
|
|
|
|
} |
|
|
|
|
if((i+1)==bigtankgroups.length){ |
|
|
|
|
bigfor.push(bigtankgroups.slice(num,(i+1))); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
var map2 = [] |
|
|
|
|
let tankdetailindo = [] |
|
|
|
|
let noemptyArr = [] |
|
|
|
|
|
|
|
|
|
//bigfor决定当前储罐分组有几个
|
|
|
|
|
|
|
|
|
|
bigfor.forEach(item=>{ |
|
|
|
|
item[1].propertyInfos.forEach(item => { |
|
|
|
|
if(item.tag == ""){ |
|
|
|
|
item.tag = 1 |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
item[1].propertyInfos = this.formatHandle(item[1].propertyInfos) |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
data[0].bigfor = bigfor |
|
|
|
|
} |
|
|
|
|
if(data[0].buildtype == "地铁类"){ |
|
|
|
|
data[0].tongyong = false |
|
|
|
|
data[0].ditie = true |
|
|
|
|
} |
|
|
|
|
return data[0] |
|
|
|
|
} |
|
|
|
|
//得到建筑信息数据并进行处理
|
|
|
|
|
getunitallbuilding(){ |
|
|
|
|
this.houses = [] |
|
|
|
|
this.http.get("/api/CompanyAccount/Buildings").subscribe((data:any)=>{ // 获得当前单位所有的建筑
|
|
|
|
|
this.http.get("/api/CompanyAccount/Buildings").subscribe(async (data:any)=>{ // 获得当前单位所有的建筑
|
|
|
|
|
this.basicCategoryId = data[0].buildingTypes[0].id |
|
|
|
|
this.presentbuildinfoId = data[0].id // 用于存储当前单位第一个建筑的id
|
|
|
|
|
data.forEach(async (n,index) => { |
|
|
|
|
for (let i = 0, length = data.length; i < length; i++) { |
|
|
|
|
const n = data[i]; |
|
|
|
|
const index = i; |
|
|
|
|
this.buildinginfoId.push(n.id) |
|
|
|
|
const result = await (new Promise((resolve) => { |
|
|
|
|
const result = await new Promise((resolve) => { |
|
|
|
|
this.http.get("/api/CompanyAccount/BasicInfos",{ // 循环请求当前单位建筑每一个建筑的模板信息保存到数组中
|
|
|
|
|
params:{ |
|
|
|
|
buildingId:n.id, |
|
|
|
@ -225,7 +312,7 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
if(data[0].buildtype == "石油化工类"){ |
|
|
|
|
data[0].tongyong = false |
|
|
|
|
data[0].isshiyou = true |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.deviceinfodata = data[0].buildingBasicGroups[1].propertyInfos //存储装置信息的初始数据,需要转换成datasource形式
|
|
|
|
|
var map = [] |
|
|
|
|
this.deviceinfodata.forEach((item,index) => { |
|
|
|
@ -263,7 +350,7 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
}) |
|
|
|
|
this.devicedataSourcebox[data[0].buildingId] = new MatTableDataSource<any>(this.newzhuangzhiinfodatasource) |
|
|
|
|
data[0].newzhuangzhiinfodatasource = this.newzhuangzhiinfodatasource |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//把bigfor分组取出来 先大循环 (储罐信息---储罐信息/罐区情况)为一组
|
|
|
|
|
let bigtankgroups = data[0].buildingBasicGroups.slice(2) |
|
|
|
@ -296,7 +383,6 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
data[0].bigfor = bigfor |
|
|
|
|
console.log(1222,data[0]) |
|
|
|
|
} |
|
|
|
|
if(data[0].buildtype == "地铁类"){ |
|
|
|
|
data[0].tongyong = false |
|
|
|
@ -304,9 +390,9 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
resolve(data[0]) // 把数据传递出去
|
|
|
|
|
}) |
|
|
|
|
})) |
|
|
|
|
}) |
|
|
|
|
this.houses.push(result) // 并且把他添加到 tab 总体数组中
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -416,7 +502,6 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
]) |
|
|
|
|
console.log(item.bigfor) |
|
|
|
|
} |
|
|
|
|
removetankbox(item,bigkey){ |
|
|
|
|
|
|
|
|
@ -658,7 +743,6 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
alert("hhh") |
|
|
|
|
} |
|
|
|
|
templatebuildtype(n ,item){ |
|
|
|
|
console.log(n ,item.index) |
|
|
|
|
this.http.put(`/api/CompanyAccount/Buildings/${item.buildingId}`,{ //(通用)只修改建筑名称和建筑类型
|
|
|
|
|
id: item.buildingId, |
|
|
|
|
name: item.housename, |
|
|
|
@ -672,18 +756,16 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
] |
|
|
|
|
}).subscribe(data=>{ |
|
|
|
|
this.getunitallbuilding() |
|
|
|
|
// this.http.get("/api/CompanyAccount/BasicInfos",{//请求当前建筑的模板信息保存到数组中
|
|
|
|
|
// params:{
|
|
|
|
|
// buildingId:item.buildingId,
|
|
|
|
|
// buildingType:n.id
|
|
|
|
|
// }
|
|
|
|
|
// }).subscribe(data=>{
|
|
|
|
|
// // console.log(2222,data)
|
|
|
|
|
// console.log(1111,this.houses[item.index])
|
|
|
|
|
// // this.houses[item.index] = data
|
|
|
|
|
|
|
|
|
|
// })
|
|
|
|
|
// this.getunitallbuilding()
|
|
|
|
|
this.http.get("/api/CompanyAccount/BasicInfos",{//请求当前建筑的模板信息保存到数组中
|
|
|
|
|
params:{ |
|
|
|
|
buildingId:item.buildingId, |
|
|
|
|
buildingType:n.id |
|
|
|
|
} |
|
|
|
|
}).subscribe(data=>{ |
|
|
|
|
this.getunithouse(data,n,item) |
|
|
|
|
this.houses[item.index] = data[0] |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
@ -730,7 +812,6 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
buildingId :newbody[0].buildingId |
|
|
|
|
} |
|
|
|
|
}).subscribe((data:any)=>{ |
|
|
|
|
console.log(23,data) |
|
|
|
|
this.houses[key].id = data[0].id |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
@ -948,7 +1029,7 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
bodyObj.buildingBasicGroups.push(basictankinfobody) |
|
|
|
|
} |
|
|
|
|
console.log(item) //-------------后续储罐信息以及储罐信息/罐区情况都push到这个数组中
|
|
|
|
|
//-------------后续储罐信息以及储罐信息/罐区情况都push到这个数组中
|
|
|
|
|
|
|
|
|
|
let basictankchildinfobody:any = [] |
|
|
|
|
item.bigfor.forEach(item => { |
|
|
|
@ -1186,7 +1267,6 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
bodyObj.buildingBasicGroups.push(basictankchildinfobody) |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
console.log(789,basictankchildinfobody) |
|
|
|
|
let newbodyObj = [] |
|
|
|
|
newbodyObj.push(bodyObj) |
|
|
|
|
this.http.post("/api/CompanyAccount/BasicInfos",newbodyObj,{ |
|
|
|
@ -1204,8 +1284,6 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(item.buildtype == "地铁类"){ |
|
|
|
|
console.log(value) |
|
|
|
|
console.log(item) |
|
|
|
|
let newObj = _.cloneDeep(item) |
|
|
|
|
delete newObj.name |
|
|
|
|
delete newObj.tongyong |
|
|
|
|