|
|
|
@ -58,7 +58,7 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
] //单位类型
|
|
|
|
|
} |
|
|
|
|
uploader:FileUploader = new FileUploader({
|
|
|
|
|
url: `/api/Objects/PlanPlatform`,
|
|
|
|
|
url: `/api/Objects/PlanPlatform/${this.unitinfo.id}`,
|
|
|
|
|
method: "POST",
|
|
|
|
|
itemAlias: "uploadedfile", |
|
|
|
|
removeAfterUpload:true |
|
|
|
@ -584,140 +584,145 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
this.snackBar.open('只剩唯一储罐,无法删除','确定',config); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//点击+号 增加建筑
|
|
|
|
|
addhouseinfo() { |
|
|
|
|
const dialogRef = this.dialog.open(AddHouseInfo, {//调用open方法打开对话框并且携带参数过去
|
|
|
|
|
width: '260px', |
|
|
|
|
data: {unitinfo:this.unitinfo} |
|
|
|
|
}); |
|
|
|
|
dialogRef.afterClosed().subscribe( |
|
|
|
|
data => { |
|
|
|
|
if(data){ |
|
|
|
|
this.getunitallbuilding() |
|
|
|
|
let yyy = this.changebuildingdata(data) |
|
|
|
|
console.log(111,yyy)//需要拿着这个去请求模板
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//新建建筑时把原始建筑数据放进来进行加工处理成可用数据
|
|
|
|
|
changebuildingdata(data){ |
|
|
|
|
async changebuildingdata(data){ |
|
|
|
|
let n = data
|
|
|
|
|
let yyy |
|
|
|
|
this.http.get("/api/CompanyAccount/BasicInfos",{ // 需要请求建筑信息的模板
|
|
|
|
|
params:{ |
|
|
|
|
buildingId:data.id, |
|
|
|
|
buildingType:data.buildingTypes[0].id |
|
|
|
|
} |
|
|
|
|
}).subscribe((data)=>{//此时的data才是模板详细信息
|
|
|
|
|
let _data = data |
|
|
|
|
this.http.get("/api/CompanyAccount/BuildingCustomData",{params:{ //-----处理建筑自定义属性部分
|
|
|
|
|
buildingId:n.id |
|
|
|
|
}}).subscribe(data=>{
|
|
|
|
|
if(data){ |
|
|
|
|
_data[0].isCustomData = true //如果data存在则把自定义属性isCustomData设为true
|
|
|
|
|
_data[0].buildingCustomData = data //把建筑自定义信息赋给buildingCustomData自定义属性
|
|
|
|
|
}else{ |
|
|
|
|
_data[0].isCustomData = false |
|
|
|
|
_data[0].buildingCustomData ={ //否则设为false,并且把自定义信息属性赋值为空
|
|
|
|
|
id: "", |
|
|
|
|
customProperties: [ |
|
|
|
|
{ |
|
|
|
|
name: "", |
|
|
|
|
value: "" |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
buildingId: _data[0].buildingId |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
data[0].buildingtypeId = n.buildingTypes[0].id |
|
|
|
|
data[0].buildtype = n.buildingTypes[0].name |
|
|
|
|
data[0].name = n.name |
|
|
|
|
data[0].username = n.name |
|
|
|
|
data[0].tongyong = true |
|
|
|
|
data[0].index = this.houses.length //////////////////
|
|
|
|
|
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 |
|
|
|
|
let result = await new Promise(resolve=>{ |
|
|
|
|
this.http.get("/api/CompanyAccount/BasicInfos",{ // 需要请求建筑信息的模板
|
|
|
|
|
params:{ |
|
|
|
|
buildingId:data.id, |
|
|
|
|
buildingType:data.buildingTypes[0].id |
|
|
|
|
} |
|
|
|
|
}).subscribe((data)=>{//此时的data才是模板详细信息
|
|
|
|
|
let _data = data |
|
|
|
|
this.http.get("/api/CompanyAccount/BuildingCustomData",{params:{ //-----处理建筑自定义属性部分
|
|
|
|
|
buildingId:n.id |
|
|
|
|
}}).subscribe(data=>{
|
|
|
|
|
if(data){ |
|
|
|
|
_data[0].isCustomData = true //如果data存在则把自定义属性isCustomData设为true
|
|
|
|
|
_data[0].buildingCustomData = data //把建筑自定义信息赋给buildingCustomData自定义属性
|
|
|
|
|
}else{ |
|
|
|
|
_data[0].isCustomData = false |
|
|
|
|
_data[0].buildingCustomData ={ //否则设为false,并且把自定义信息属性赋值为空
|
|
|
|
|
id: "", |
|
|
|
|
customProperties: [ |
|
|
|
|
{ |
|
|
|
|
name: "", |
|
|
|
|
value: "" |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
buildingId: _data[0].buildingId |
|
|
|
|
} |
|
|
|
|
if (i.propertyName == "火灾危险性") { |
|
|
|
|
zhuangzhiinfodatasource[index].danger = i.propertyValue |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
data[0].buildingtypeId = n.buildingTypes[0].id |
|
|
|
|
data[0].buildtype = n.buildingTypes[0].name |
|
|
|
|
data[0].name = n.name |
|
|
|
|
data[0].username = n.name |
|
|
|
|
data[0].tongyong = true |
|
|
|
|
data[0].index = this.houses.length //////////////////
|
|
|
|
|
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 (i.propertyName == "灭火注意事项") { |
|
|
|
|
zhuangzhiinfodatasource[index].payattentionto = i.propertyValue |
|
|
|
|
if(!(item.tag in map)){ |
|
|
|
|
map[item.tag] = [] |
|
|
|
|
} |
|
|
|
|
map[item.tag].push(item) |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
this.newzhuangzhiinfodatasource =[] //数据去空
|
|
|
|
|
zhuangzhiinfodatasource.forEach(item=>{ |
|
|
|
|
if(item !== "" && item != undefined){ |
|
|
|
|
this.newzhuangzhiinfodatasource.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) |
|
|
|
|
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))); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
this.devicedataSourcebox[data[0].buildingId] = new MatTableDataSource<any>(this.newzhuangzhiinfodatasource) //强制渲染表格
|
|
|
|
|
data[0].newzhuangzhiinfodatasource = this.newzhuangzhiinfodatasource |
|
|
|
|
var map2 = [] |
|
|
|
|
let tankdetailindo = [] |
|
|
|
|
let noemptyArr = [] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//把bigfor分组取出来 先大循环 (储罐信息---储罐信息/罐区情况)为一组
|
|
|
|
|
let bigtankgroups = data[0].buildingBasicGroups.slice(2) |
|
|
|
|
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))); |
|
|
|
|
} |
|
|
|
|
//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 |
|
|
|
|
} |
|
|
|
|
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 |
|
|
|
|
} |
|
|
|
|
if(data[0].buildtype == "地铁类"){ |
|
|
|
|
data[0].tongyong = false |
|
|
|
|
data[0].ditie = true |
|
|
|
|
} |
|
|
|
|
yyy = data[0] |
|
|
|
|
yyy = data[0] |
|
|
|
|
resolve(yyy)
|
|
|
|
|
})
|
|
|
|
|
}) |
|
|
|
|
return yyy |
|
|
|
|
return result |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//点击+号 增加建筑
|
|
|
|
|
addhouseinfo() { |
|
|
|
|
const dialogRef = this.dialog.open(AddHouseInfo, {//调用open方法打开对话框并且携带参数过去
|
|
|
|
|
width: '260px', |
|
|
|
|
data: {unitinfo:this.unitinfo} |
|
|
|
|
}); |
|
|
|
|
dialogRef.afterClosed().subscribe( |
|
|
|
|
async data => { |
|
|
|
|
if(data){ |
|
|
|
|
let newbuilding = await this.changebuildingdata(data) |
|
|
|
|
this.houses.push(newbuilding) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ggg:any = [1] |
|
|
|
|
//在模板中增加地铁线路分组
|
|
|
|
|
addloadgroup(){ |
|
|
|
@ -809,7 +814,7 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
this.isspinner = false |
|
|
|
|
let tempRes = JSON.parse(response); |
|
|
|
|
this.imgUrl = tempRes.objectName
|
|
|
|
|
this.imgsrc = `/api/Objects/PlanPlatform/${this.imgUrl}` |
|
|
|
|
this.imgsrc = `/api/Objects/PlanPlatform/${this.imgUrl}?x-oss-process=image/resize,m_fill,h_170,w_299` |
|
|
|
|
}else {
|
|
|
|
|
// 上传文件后获取服务器返回的数据错误
|
|
|
|
|
} |
|
|
|
@ -866,12 +871,16 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
//删除具体建筑
|
|
|
|
|
deletedbuilding(node){ |
|
|
|
|
deletedbuilding(item){ |
|
|
|
|
var isdeleted = confirm("确定要删除此建筑吗?") |
|
|
|
|
if(isdeleted){ |
|
|
|
|
//请求删除接口
|
|
|
|
|
this.http.delete(`/api/CompanyAccount/Buildings/${node.buildingId}`).subscribe(data=>{ |
|
|
|
|
this.getunitallbuilding() |
|
|
|
|
this.http.delete(`/api/CompanyAccount/Buildings/${item.buildingId}`).subscribe(data=>{ |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('删除成功','确定',config); |
|
|
|
|
this.houses.splice(item.index,1)
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -885,28 +894,28 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
this.snackBar.open('请填写必填项','确定',config); |
|
|
|
|
}else{ |
|
|
|
|
let time =new Date() |
|
|
|
|
let body = { |
|
|
|
|
id: this.unitinfo.id, |
|
|
|
|
name: this.unitinfo.name, |
|
|
|
|
usci: value.creditcode, |
|
|
|
|
contacts: value.linkman, |
|
|
|
|
phone: value.linkphone, |
|
|
|
|
address: value.unitaddress, |
|
|
|
|
imageUrl: this.imgsrc, |
|
|
|
|
location: { |
|
|
|
|
x: 0, |
|
|
|
|
y: 0 |
|
|
|
|
}, |
|
|
|
|
modifiedTime: time, |
|
|
|
|
organizationId: this.selectedorganizationid, |
|
|
|
|
organizationName: null, |
|
|
|
|
buildingTypes: [ |
|
|
|
|
{ |
|
|
|
|
id: value.unittype, |
|
|
|
|
name: this.buildingTypesname |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
} |
|
|
|
|
let body = { |
|
|
|
|
id: this.unitinfo.id, |
|
|
|
|
name: this.unitinfo.name, |
|
|
|
|
usci: value.creditcode, |
|
|
|
|
contacts: value.linkman, |
|
|
|
|
phone: value.linkphone, |
|
|
|
|
address: value.unitaddress, |
|
|
|
|
imageUrl: this.imgsrc, |
|
|
|
|
location: { |
|
|
|
|
x: 0, |
|
|
|
|
y: 0 |
|
|
|
|
}, |
|
|
|
|
modifiedTime: time, |
|
|
|
|
organizationId: this.selectedorganizationid, |
|
|
|
|
organizationName: null, |
|
|
|
|
buildingTypes: [ |
|
|
|
|
{ |
|
|
|
|
id: value.unittype, |
|
|
|
|
name: this.buildingTypesname |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
} |
|
|
|
|
this.http.put("/api/CompanyAccount/Company",body).subscribe((data:any)=>{ //修改单位基本信息
|
|
|
|
|
this.getunitinfo() |
|
|
|
|
if(!this.houses.length){ |
|
|
|
@ -932,13 +941,18 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
this.getunitallbuilding() |
|
|
|
|
}) |
|
|
|
|
}else{ |
|
|
|
|
// alert("保存成功")
|
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功','确定',config); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}), |
|
|
|
|
err=>{ |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('请填写正确信息','确定',config); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|