-
-
-
-
{{i.rulevalue}}
+
+
+
+
+
+
+
+
自定义信息
@@ -510,119 +520,7 @@
-
-
-
-
-
- 建筑名称:
-
-
-
- *
-
-
- 建筑类型:
-
-
- {{n.name}}
-
-
- *
-
-
{{item.buildingBasicGroups[0].name}}
-
-
-
{{item.buildingBasicGroups[1].name}}
-
-
-
-
-
-
-
自定义信息
-
-
-
+
diff --git a/src/app/ui/basicinfo/basicinfo.component.ts b/src/app/ui/basicinfo/basicinfo.component.ts
index e16496c..5d3658d 100644
--- a/src/app/ui/basicinfo/basicinfo.component.ts
+++ b/src/app/ui/basicinfo/basicinfo.component.ts
@@ -91,6 +91,7 @@ export class BasicinfoComponent implements OnInit {
// this.getorganization()
this.getunitinfo()
this.getunitallbuilding()
+
}
//获得所有单位类型
getallunittype() {
@@ -113,6 +114,13 @@ export class BasicinfoComponent implements OnInit {
this.getorganization()
setTimeout(() => {
this.http.get("/api/CompanyAccount/Company").subscribe((data:any)=>{
+ // console.log(111,data.buildingTypes.length)
+ if(data.buildingTypes.length){
+ sessionStorage.setItem('buildingTypeId',data.buildingTypes[0].id)
+ }else{
+ sessionStorage.setItem('buildingTypeId',"")
+ }
+
let node
this.allorganizing.forEach(item => {
if(item.id == data.organizationId){
@@ -156,7 +164,7 @@ export class BasicinfoComponent implements OnInit {
this.buildingTypesname = data.buildingTypes[0].name
}
})
- }, 500);
+ }, 1000);
}
//获得建筑自定义信息
@@ -168,6 +176,7 @@ export class BasicinfoComponent implements OnInit {
//石油化工 装置信息 勾选框
checkboxchange(item,e){
+ // console.log(122,item)
if(item.buildingBasicGroups){
item.buildingBasicGroups.forEach(item=>{
if(item.name != "基本信息" && item.name != "装置信息"){
@@ -299,7 +308,15 @@ export class BasicinfoComponent implements OnInit {
//把bigfor分组取出来 先大循环 (储罐信息---储罐信息/罐区情况)为一组
- let bigtankgroups = data[0].buildingBasicGroups.slice(2)
+ let noemptybigfordata = data[0].buildingBasicGroups
+ // if(noemptybigfordata.length > 4){
+ // noemptybigfordata.forEach((item,index) => {
+ // if(!item.submitted && item.name !="装置信息"){
+ // noemptybigfordata.splice(index, 1)
+ // }
+ // })
+ // }
+ let bigtankgroups = noemptybigfordata.slice(2)
// console.log("bigtankgroups",bigtankgroups)
let proportion = 2; //按照比例切割
let num = 0;
@@ -331,8 +348,8 @@ export class BasicinfoComponent implements OnInit {
data[0].bigfor = bigfor
}
if(data[0].buildtype == "地铁类"){
- data[0].tongyong = false
- data[0].ditie = true
+ data[0].tongyong = true
+ // data[0].ditie = true
}
return data[0]
}
@@ -405,12 +422,22 @@ export class BasicinfoComponent implements OnInit {
data[0].tongyong = false
data[0].isshiyou = true
- this.deviceinfodata = data[0].buildingBasicGroups[1].propertyInfos //存储装置信息的初始数据,需要转换成datasource形式
+
+ let noemptydeviceArr = data[0].buildingBasicGroups[1].propertyInfos
+ noemptydeviceArr.forEach((item,index) => {
+ if(item.tag == ""){
+ noemptydeviceArr.splice(index,1)
+ }
+ });
+ this.deviceinfodata = noemptydeviceArr //存储装置信息的初始数据,需要转换成datasource形式
var map = []
this.deviceinfodata.forEach((item,index) => {
- if(item.tag == ""){
- item.tag = "1"
+ if(!data[0].buildingBasicGroups[1].submitted){
+ if(item.tag == ""){
+ item.tag = "1"
+ }
}
+
if(!(item.tag in map)){
map[item.tag] = []
}
@@ -444,7 +471,15 @@ export class BasicinfoComponent implements OnInit {
data[0].newzhuangzhiinfodatasource = this.newzhuangzhiinfodatasource
//把bigfor分组取出来 先大循环 (储罐信息---储罐信息/罐区情况)为一组
- let bigtankgroups = data[0].buildingBasicGroups.slice(2)
+ let noemptybigfordata = data[0].buildingBasicGroups
+ // if(noemptybigfordata.length > 4){
+ // noemptybigfordata.forEach((item,index) => {
+ // if(!item.submitted && item.name !="装置信息"){
+ // noemptybigfordata.splice(index, 1)
+ // }
+ // })
+ // }
+ let bigtankgroups = noemptybigfordata.slice(2)
// console.log("bigtankgroups",bigtankgroups)
let proportion = 2; //按照比例切割
let num = 0;
@@ -458,24 +493,33 @@ export class BasicinfoComponent implements OnInit {
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)
+ // console.log(bigfor)
+ bigfor.forEach((item,index)=>{
+ // if(item.length != 2){
+ // bigfor.splice(index,1)
+ // }else{
+ // if(item[1].propertyInfos){
+ // 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
+ data[0].tongyong = true
+ // data[0].ditie = true
}
resolve(data[0]) //把数据传递出去
})
@@ -519,15 +563,19 @@ export class BasicinfoComponent implements OnInit {
item.bigfor[e][1].propertyInfos = [...item.bigfor[e][1].propertyInfos]
}
removedeviceinfo3(e,item){//点击减一行
- if(item.bigfor[e][1].propertyInfos.length > 1){
- item.bigfor[e][1].propertyInfos.pop()
- }else{
- const config = new MatSnackBarConfig();
- config.verticalPosition = 'top';
- config.duration = 3000
- this.snackBar.open('只剩一行,无法删除','确定',config);
+ var isdeleted = confirm("确定要删除末行吗?")
+ if(isdeleted){
+ if(item.bigfor[e][1].propertyInfos.length > 1){
+ item.bigfor[e][1].propertyInfos.pop()
+ }else{
+ const config = new MatSnackBarConfig();
+ config.verticalPosition = 'top';
+ config.duration = 3000
+ this.snackBar.open('只剩一行,无法删除','确定',config);
+ }
+ item.bigfor[e][1].propertyInfos = [...item.bigfor[e][1].propertyInfos]
}
- item.bigfor[e][1].propertyInfos = [...item.bigfor[e][1].propertyInfos]
+
}
@@ -545,7 +593,7 @@ export class BasicinfoComponent implements OnInit {
}
}).subscribe((data:any)=>{
// console.log(1314,data)
- console.log(777,data[0])
+ // console.log(777,data[0])
item.bigfor.push([
{
id: "",
@@ -570,7 +618,7 @@ export class BasicinfoComponent implements OnInit {
enabled: true,
basicGroupId:'',
id: "",
- name: "罐区" + (item.bigfor.length+ 1) +"/罐区情况",
+ name: "罐区" + (item.bigfor.length+ 1) +"/储罐信息",
order: item.bigfor.length+3,
propertyInfos: [
{
@@ -725,8 +773,8 @@ export class BasicinfoComponent implements OnInit {
data[0].bigfor = bigfor
}
if(data[0].buildtype == "地铁类"){
- data[0].tongyong = false
- data[0].ditie = true
+ data[0].tongyong = true
+ // data[0].ditie = true
}
yyy = data[0]
resolve(yyy)
@@ -986,6 +1034,7 @@ export class BasicinfoComponent implements OnInit {
config.duration = 3000
this.snackBar.open('请填写必填项','确定',config);
}else{
+ sessionStorage.setItem('buildingTypeId',value.unittype)
let time =new Date()
let body = {
id: this.unitinfo.id,
@@ -1159,7 +1208,6 @@ export class BasicinfoComponent implements OnInit {
]
}).subscribe((data:any)=>{
this.houses[item.index].username = item.name
-
},
err=>{
alert("名称和类型保存失败")
@@ -1208,10 +1256,6 @@ export class BasicinfoComponent implements OnInit {
alert("自定义信息保存失败")
})
}
-
-
-
-
if(item.buildtype != "石油化工类" && item.buildtype != "地铁类"){
@@ -1241,7 +1285,7 @@ export class BasicinfoComponent implements OnInit {
let body = newObj
let newbody = []
newbody.push(body)
- console.log(123,newbody)
+ // console.log(123,newbody)
if(newbody[0].buildingBasicGroups.length){
this.http.post("/api/CompanyAccount/BasicInfos",newbody,{
params:{
@@ -1276,6 +1320,7 @@ export class BasicinfoComponent implements OnInit {
delete bodyObj.index
delete bodyObj.isCustomData
delete bodyObj.buildingCustomData
+ // console.log(456,bodyObj)
bodyObj.buildingBasicGroups[0].propertyInfos.forEach(item => {
delete item.isshowrule
delete item.rulevalue
@@ -1411,7 +1456,7 @@ export class BasicinfoComponent implements OnInit {
- if(bodyObj.buildingBasicGroups[2].submitted){ //如果没有勾选储罐信息 则直接提交当前bodyObj
+ if(bodyObj.buildingBasicGroups[2].submitted){ //如果勾选了储罐信息 则直接提交当前bodyObj
var map = {}; //用于存储石油化工要提交的储罐信息表单
for (let key in value) {
if (key.indexOf('tanker') != -1) {
@@ -1454,7 +1499,7 @@ export class BasicinfoComponent implements OnInit {
tag: ""
},
{
- propertyName: "罐区位置",
+ propertyName: "辖区位置",
propertyValue: map[key][1],
propertyType: 0,
required: true,
@@ -1480,7 +1525,7 @@ export class BasicinfoComponent implements OnInit {
tag: ""
},
{
- propertyName: "电话",
+ propertyName: "部门负责人电话",
propertyValue: map[key][3],
propertyType: 0,
required: true,
@@ -1506,7 +1551,7 @@ export class BasicinfoComponent implements OnInit {
tag: ""
},
{
- propertyName: "电话",
+ propertyName: "罐区负责人电话",
propertyValue: map[key][5],
propertyType: 0,
required: true,
@@ -1540,9 +1585,7 @@ export class BasicinfoComponent implements OnInit {
bodyObj.buildingBasicGroups.push(basictankinfobody)
}
-
-
-
+
let basictankchildinfobody:any = []//-------------后续储罐信息以及储罐信息/罐区情况都push到这个数组中
item.bigfor.forEach(item => {
basictankchildinfobody.push(item[1].propertyInfos)
@@ -1764,7 +1807,7 @@ export class BasicinfoComponent implements OnInit {
});
basictankchildinfobody={//
id: null,
- name: "罐区" + Number(index+1) + "/罐区情况",
+ name: "罐区" + Number(index+1) + "/储罐信息",
type: 1,
addMode: 2,
basicGroupId:'',
@@ -1781,6 +1824,8 @@ export class BasicinfoComponent implements OnInit {
bodyObj.buildingBasicGroups.push(basictankchildinfobody)
});
}else{
+
+
bodyObj.buildingBasicGroups[2].buildingId = item.buildingId
bodyObj.buildingBasicGroups[2].companyId = this.unitinfo.id
bodyObj.buildingBasicGroups[2].propertyInfos.forEach(item=>{
@@ -1997,14 +2042,16 @@ export class BasicinfoComponent implements OnInit {
visible: true,
tag:"1"
}
- ]
+ ]
+ // console.log(888,bodyObj)
+ bodyObj.buildingBasicGroups.splice(4,bodyObj.buildingBasicGroups.length)
}
let newbodyObj = []
newbodyObj.push(bodyObj)
-
+ // console.log(1111,newbodyObj)
this.http.post("/api/CompanyAccount/BasicInfos",newbodyObj,{
params:{
buildingId :item.buildingId