diff --git a/src/app/ui/basicinfo/basicinfo.component.html b/src/app/ui/basicinfo/basicinfo.component.html index 1fa2434..01c6fd4 100644 --- a/src/app/ui/basicinfo/basicinfo.component.html +++ b/src/app/ui/basicinfo/basicinfo.component.html @@ -163,406 +163,590 @@
-
- - - -
+
+ + + + + + +
+
+ 建筑名称: + + + + * +
+
+ 建筑类型: + + + {{n.name}} + + + * +
+ +
+

{{item.name}}

+
+ {{i.propertyName}}({{i.physicalUnit}}) + + + + + + + + + + + + + + + 1级 + 2级 + 3级 + 其它 + + + + + + * +
+ {{i.rulevalue}} +
+
+
- -
-
+
+ +

自定义信息

+
+
+ + +
+ + + + : + + + + * +
+
+
+ + +
+
+
建筑名称: *
-
+
建筑类型: - - {{n.name}} + + {{n.name}} *
+

{{item.buildingBasicGroups[0].name}}

+
+ {{i.propertyName}} ({{i.physicalUnit}}) + + + + -
-

{{item.name}}

-
- {{i.propertyName}}({{i.physicalUnit}}) - - - - - - - - - - - - - - - 1级 - 2级 - 3级 - 其它 - - - - - - * -
- {{i.rulevalue}} -
-
+ + + + + + + + + 1级 + 2级 + 3级 + 其它 + + + + + * +
+ {{i.rulevalue}}
- -
- -

自定义信息

-
- - -
- - - - : - - - - * -
-
- - -
+ + +
+
+ +

{{item.buildingBasicGroups[1].name}}

+
-
-
- 建筑名称: - - - - * -
-
- 建筑类型: - - - {{n.name}} - - - * -
-

{{item.buildingBasicGroups[0].name}}

-
- {{i.propertyName}} ({{i.physicalUnit}}) + + + + + + + + + + + + + + + + + + + +
+ + + 装置区名称* + + 工艺流程* + + 火灾危险性* + + 灭火注意事项 + +
+
- - - - - + +
+ +

储罐信息

+
+ + + + +
+
+ +

{{x[0].name}}

+
+
+ {{i.propertyName}} {{i.physicalUnit}}: + + + + + * +
- - - - - - - - - 1级 - 2级 - 3级 - 其它 - - - - - * -
- {{i.rulevalue}}
+ +

{{x[1].name}}

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + 罐区 + + 罐区编号* + + 储存介质* + + 储罐类型* + + 容量(m³)* + + 直径(m)* + + 高度(m)* + + 顶盖形式 + + 浮盘材质 + + 浮盘类型 + + 泡沫产生器型号 + + 泡沫产生器形式 + + 是否设置氮封惰化保护装置 + + 防护堤高度(m)* + + 半固定泡沫灭火接口数量 + + 其它设施 + +
+
- - -
-
- -

{{item.buildingBasicGroups[1].name}}

-
- - - - - - - - - - - - - - - - - - - - -
- - - 装置区名称* - - 工艺流程* - - 火灾危险性* - - 灭火注意事项 - -
+
+ + +
+ +

自定义信息

+
+
+ + +
+ + + + : + + + + * +
+
+ +
+ +
+
+
+ 建筑名称: + + + + * +
+
+ 建筑类型: + + + {{n.name}} + + + *
+

{{item.buildingBasicGroups[0].name}}

+
+ {{i.propertyName}} ({{i.physicalUnit}}) + + + + -
- -

储罐信息

+ + + + + + + + + 1级 + 2级 + 3级 + 其它 + + + + + * +
+ {{i.rulevalue}}
+
+
+ + - - - + +
+ +

储罐信息

+
+ + + -
-
-

{{x[0].name}}

-
-
- {{i.propertyName}} {{i.physicalUnit}}: - - - - - * -
- +
+
+ +

{{x[0].name}}

+
+
+ {{i.propertyName}} {{i.physicalUnit}}: + + + + + *
-

{{x[1].name}}

-
- - - - - - - - - -
- + + + +

{{x[1].name}}

+
+ + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ - 罐区 - - 罐区编号* - - 储存介质* - - 储罐类型* - - 容量(m³)* - - 直径(m)* - - 高度(m)* - - 顶盖形式 - - 浮盘材质 - - 浮盘类型 - - 泡沫产生器型号 - - 泡沫产生器形式 - - 是否设置氮封惰化保护装置 - - 防护堤高度(m)* - - 半固定泡沫灭火接口数量 - * + + + 储存介质* + + 储罐类型* + + 容量(m³)* + + 直径(m)* + + 高度(m)* + + 其它设施 + +
- [(ngModel)]="element.portnum"> - - - -
其它设施 - -
-
- +
+ -
- -

自定义信息

-
-
- - -
- - - - : - - - - * -
-
- +
+ +

自定义信息

- - -
- - +
+ + +
+ + + + : + + + + * +
- - - - - +
+
+ + +
+ + + +
diff --git a/src/app/ui/basicinfo/basicinfo.component.scss b/src/app/ui/basicinfo/basicinfo.component.scss index a2e7969..c837bb2 100644 --- a/src/app/ui/basicinfo/basicinfo.component.scss +++ b/src/app/ui/basicinfo/basicinfo.component.scss @@ -208,7 +208,7 @@ margin-left: 203px; } .mat-table{ - width: 100%; + width: 99%; } table{ diff --git a/src/app/ui/basicinfo/basicinfo.component.ts b/src/app/ui/basicinfo/basicinfo.component.ts index f4876ab..9471553 100644 --- a/src/app/ui/basicinfo/basicinfo.component.ts +++ b/src/app/ui/basicinfo/basicinfo.component.ts @@ -429,14 +429,16 @@ export class BasicinfoComponent implements OnInit { } //数据格式化函数 将原始数据映射转化为表格需要的datasource - formatHandle(list) { + formatHandle(list,type) { const result = [{}]; // tag 是从1开始,因此预置索引为0的项 list.forEach((item) => { const { tag, propertyName, propertyValue } = item; if (result[tag] === undefined) { // 初始化对象 result[tag] = {}; } - const fieldMap = { // 字段映射,实现自动映射 + let fieldMap + if(type == '石油化工类'){ + fieldMap = { // 字段映射,实现自动映射 '罐区': 'tank', '储罐编号': 'tankid', '储存介质': 'tankmedium', @@ -453,7 +455,18 @@ export class BasicinfoComponent implements OnInit { '防护堤高度': 'fendinggroyneheight', '半固定泡沫灭火接口数量': 'portnum', '其它设施': 'else' - }; + }; + }else if(type == '加油站'){ + fieldMap = { // 字段映射,实现自动映射 + '储罐编号': 'tankid', + '储存介质': 'tankmedium', + '储罐类型': 'tanktype', + '容量': 'tankcapacity', + '直径': 'tankdiameter', + '高度': 'tankheight', + '其它设施': 'else' + }; + } result[tag][fieldMap[propertyName]] = propertyValue; }); result.shift(); // 移除预置的 索引为0 的值 @@ -545,15 +558,45 @@ export class BasicinfoComponent implements OnInit { item.tag = 1 } }); - item[1].propertyInfos = this.formatHandle(item[1].propertyInfos) - + item[1].propertyInfos = this.formatHandle(item[1].propertyInfos,'石油化工类') + }) + data[0].bigfor = bigfor + } + if(data[0].buildtype == "加油站"){ + data[0].tongyong = false + data[0].jiayou = true + + //把bigfor分组取出来 先大循环 (储罐信息---储罐信息/罐区情况)为一组 + let noemptybigfordata = data[0].buildingBasicGroups + let bigtankgroups = noemptybigfordata.slice(1) + let proportion = 2; //按照比例切割 + let num = 0; + let bigfor =[]; + for(let i=0;i{ + 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 = true - // // data[0].ditie = true - // } return data[0] } @@ -678,13 +721,6 @@ export class BasicinfoComponent implements OnInit { //把bigfor分组取出来 先大循环 (储罐信息---储罐信息/罐区情况)为一组 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) let proportion = 2; //按照比例切割 let num = 0; @@ -699,32 +735,43 @@ export class BasicinfoComponent implements OnInit { } } - - //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) - // } - - - + item[1].propertyInfos = this.formatHandle(item[1].propertyInfos,'石油化工类') + }) + data[0].bigfor = bigfor + } + if(data[0].buildtype == "加油站"){ + data[0].tongyong = false + data[0].jiayou = true + + //把bigfor分组取出来 先大循环 (储罐信息---储罐信息/罐区情况)为一组 + let noemptybigfordata = data[0].buildingBasicGroups + let bigtankgroups = noemptybigfordata.slice(1) + let proportion = 2; //按照比例切割 + let num = 0; + let bigfor =[]; + for(let i=0;i{ + 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 = true - // // data[0].ditie = true - // } resolve(data[0]) //把数据传递出去 }) }) @@ -740,31 +787,47 @@ export class BasicinfoComponent implements OnInit { unitinfotemplate:any //存储选择不同单位类型时的模板信息 displayedColumns: string[]=['name', 'flow','danger','payattentionto']; displayedColumns2: string[]=['tank','tankid', 'tankmedium','tanktype','tankcapacity','tankdiameter', 'tankheight','tanktectum','tanktexture','platetype', 'foamgeneratorid','foamgeneratortype','isprotect','fendinggroyneheight', 'portnum','else']; + displayedColumns3: string[]=['tankid', 'tankmedium','tanktype','tankcapacity','tankdiameter', 'tankheight','else']; devicedataSource:any; //存储石油化工模板中的装置信息表格 tankinfodatabox:any = [ [] ] - // dataSourceArr = [] + tankinfodata:any=[];//用于存储石油化工储罐信息的数组 - adddeviceinfo2(e,item){//点击加一行 视图上多一行 - item.bigfor[e][1].propertyInfos.push({ - tank:"", - tankid:"", - tankmedium:"", - tanktype:"", - tankcapacity:"", - tankdiameter:"", - tankheight:"", - tanktectum:"", - tanktexture:"", - platetype:"", - foamgeneratorid:"", - foamgeneratortype:"", - isprotect:"", - fendinggroyneheight:"", - portnum:"", - else:"" - }) + adddeviceinfo2(e,item,type){//点击加一行 视图上多一行 + let obj = {} + if(type == '石油化工类'){ + obj = { + tank:"", + tankid:"", + tankmedium:"", + tanktype:"", + tankcapacity:"", + tankdiameter:"", + tankheight:"", + tanktectum:"", + tanktexture:"", + platetype:"", + foamgeneratorid:"", + foamgeneratortype:"", + isprotect:"", + fendinggroyneheight:"", + portnum:"", + else:"" + } + }else if(type == '加油站'){ + obj = { + tankid: "", + tankmedium: "", + tanktype: "", + tankcapacity: "", + tankdiameter: "", + tankheight: "", + else: "" + } + } + item.bigfor[e][1].propertyInfos.push(obj) + item.bigfor[e][1].propertyInfos = [...item.bigfor[e][1].propertyInfos] } removedeviceinfo3(e,item){//点击减一行 @@ -784,7 +847,7 @@ export class BasicinfoComponent implements OnInit { } - //增加储罐大分组 + //在石油化工模板种点击增加储罐信息 //获得模板信息 templateinfo:any @@ -792,64 +855,107 @@ export class BasicinfoComponent implements OnInit { } - addtankbox(item,bigkey){ + //增加储罐大分组 + addtankbox(item,type){ this.http.get("/api/CompanyAccount/BasicInfos",{ params:{ buildingType:item.buildingtypeId } }).subscribe((data:any)=>{ - // console.log(1314,data) - // console.log(777,data[0]) - item.bigfor.push([ - { - id: "", - name: "罐区"+ (item.bigfor.length+ 1), - type: 0, - addMode: 2, - basicGroupId:'', - basicCategoryId: item.basicCategoryId, - buildingBasicId: null, - buildingId: item.buildingId, - companyId: this.unitinfo.id, - enabled: true, - order: item.bigfor.length+2, - propertyInfos:data[0].buildingBasicGroups[2].propertyInfos - }, - { - addMode: 2, - basicCategoryId:item.basicCategoryId, - buildingBasicId:null, - buildingId: item.buildingId, - companyId: this.unitinfo.id, - enabled: true, - basicGroupId:'', - id: "", - name: "罐区" + (item.bigfor.length+ 1) +"/储罐信息", - order: item.bigfor.length+3, - propertyInfos: [ - { - else: "", - fendinggroyneheight: "", - foamgeneratorid: "", - foamgeneratortype: "", - isprotect: "", - platetype: "", - portnum: "", - tank: "", - tankcapacity: "", - tankdiameter: "", - tankheight: "", - tankid: "", - tankmedium: "", - tanktectum: "", - tanktexture: "", - tanktype: "" - } - ], - type: 1 - } - - ]) + let arr = [] + if(type == '石油化工类'){ + arr = [ + { + id: "", + name: "罐区"+ (item.bigfor.length+ 1), + type: 0, + addMode: 2, + basicGroupId:'', + basicCategoryId: item.basicCategoryId, + buildingBasicId: null, + buildingId: item.buildingId, + companyId: this.unitinfo.id, + enabled: true, + order: item.bigfor.length+2, + propertyInfos:data[0].buildingBasicGroups[2].propertyInfos + }, + { + addMode: 2, + basicCategoryId:item.basicCategoryId, + buildingBasicId:null, + buildingId: item.buildingId, + companyId: this.unitinfo.id, + enabled: true, + basicGroupId:'', + id: "", + name: "罐区" + (item.bigfor.length+ 1) +"/储罐信息", + order: item.bigfor.length+3, + propertyInfos: [ + { + else: "", + fendinggroyneheight: "", + foamgeneratorid: "", + foamgeneratortype: "", + isprotect: "", + platetype: "", + portnum: "", + tank: "", + tankcapacity: "", + tankdiameter: "", + tankheight: "", + tankid: "", + tankmedium: "", + tanktectum: "", + tanktexture: "", + tanktype: "" + } + ], + type: 1 + } + ] + }else if(type == '加油站'){ + arr = [ + { + id: "", + name: "罐区"+ (item.bigfor.length+ 1), + type: 0, + addMode: 2, + basicGroupId:'', + basicCategoryId: item.basicCategoryId, + buildingBasicId: null, + buildingId: item.buildingId, + companyId: this.unitinfo.id, + enabled: true, + order: item.bigfor.length+2, + propertyInfos:data[0].buildingBasicGroups[1].propertyInfos + }, + { + addMode: 2, + basicCategoryId:item.basicCategoryId, + buildingBasicId:null, + buildingId: item.buildingId, + companyId: this.unitinfo.id, + enabled: true, + basicGroupId:'', + id: "", + name: "罐区" + (item.bigfor.length+ 1) +"/储罐信息", + order: item.bigfor.length+3, + propertyInfos: [ + { + tankid: "", + tankmedium: "", + tanktype: "", + tankcapacity: "", + tankdiameter: "", + tankheight: "", + else: "", + } + ], + type: 1 + } + ] + } + item.bigfor.push(arr) }) } @@ -867,7 +973,6 @@ export class BasicinfoComponent implements OnInit { this.snackBar.open('只剩唯一储罐,无法删除','确定',config); } } - //新建建筑时把原始建筑数据放进来进行加工处理成可用数据 async changebuildingdata(data){ let n = data @@ -900,6 +1005,7 @@ export class BasicinfoComponent implements OnInit { } } }) + console.log(789,data[0]) data[0].buildingtypeId = n.buildingTypes[0].id data[0].buildtype = n.buildingTypes[0].name data[0].name = n.name @@ -909,6 +1015,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) => { @@ -949,7 +1056,11 @@ export class BasicinfoComponent implements OnInit { //把bigfor分组取出来 先大循环 (储罐信息---储罐信息/罐区情况)为一组 - let bigtankgroups = data[0].buildingBasicGroups.slice(2) + console.log(1,data[0].buildingBasicGroups) + let bigtankgroups + bigtankgroups = data[0].buildingBasicGroups.slice(2) + + console.log(2,bigtankgroups) let proportion = 2; //按照比例切割 let num = 0; let bigfor =[]; @@ -962,22 +1073,53 @@ export class BasicinfoComponent implements OnInit { bigfor.push(bigtankgroups.slice(num,(i+1))); } } - var map2 = [] - let tankdetailindo = [] - let noemptyArr = [] //bigfor决定当前储罐分组有几个 - + console.log(258,bigfor) bigfor.forEach(item=>{ item[1].propertyInfos.forEach(item => { if(item.tag == ""){ item.tag = 1 } }); - item[1].propertyInfos = this.formatHandle(item[1].propertyInfos) + item[1].propertyInfos = this.formatHandle(item[1].propertyInfos,'石油化工类') }) data[0].bigfor = bigfor + } + + if(data[0].buildtype == "加油站"){ + data[0].tongyong = false + data[0].jiayou = true + + //把bigfor分组取出来 先大循环 (储罐信息---储罐信息/罐区情况)为一组 + let bigtankgroups + console.log(1,data[0].buildingBasicGroups) + bigtankgroups = data[0].buildingBasicGroups.slice(1) + console.log(2,bigtankgroups) + let proportion = 2; //按照比例切割 + let num = 0; + let bigfor =[]; + for(let i=0;i{ + 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 = true // data[0].ditie = true @@ -1466,7 +1608,7 @@ export class BasicinfoComponent implements OnInit { } - if(item.buildtype != "石油化工类" && item.buildtype != "地铁类"){ + if(item.buildtype != "石油化工类" && item.buildtype != "地铁类" && item.buildtype != "加油站"){ this.houses[key].buildingBasicGroups[0].propertyInfos.forEach(item => { @@ -1517,7 +1659,7 @@ export class BasicinfoComponent implements OnInit { } } if(item.buildtype == "石油化工类"){ - // console.log(888,item) + let buildType = item.buildtype let bodyObj = _.cloneDeep(item) delete bodyObj.name delete bodyObj.username @@ -1720,216 +1862,312 @@ export class BasicinfoComponent implements OnInit { basictankchildinfobody.forEach((item,index) => { let tankfieldArr = [] item.forEach((element,key) => { - tankfieldArr.push( - { - propertyName: "罐区", - propertyValue: element.tank, - propertyType: 0, - required: false, - ruleName: "", - ruleValue: "", - physicalUnit: "", - order: 0, - enabled: true, - visible: true, - tag:String(key + 1) - }, - { - propertyName: "储罐编号", - propertyValue: element.tankid, - propertyType: 0, - required: true, - ruleName: "", - ruleValue: "", - physicalUnit: "", - order: 0, - enabled: true, - visible: true, - tag:String(key + 1) - }, - { - propertyName: "储存介质", - propertyValue: element.tankmedium, - propertyType: 0, - required: true, - ruleName: "", - ruleValue: "", - physicalUnit: "", - order: 0, - enabled: true, - visible: true, - tag:String(key + 1) - }, - { - propertyName: "储罐类型", - propertyValue: element.tanktype, - propertyType: 0, - required: true, - ruleName: "", - ruleValue: "", - physicalUnit: "", - order: 0, - enabled: true, - visible: true, - tag:String(key + 1) - }, - { - propertyName: "容量", - propertyValue: element.tankcapacity, - propertyType: 2, - required: true, - ruleName: "", - ruleValue: "", - physicalUnit: "㎡", - order: 0, - enabled: true, - visible: true, - tag:String(key + 1) - }, - { - propertyName: "直径", - propertyValue:element.tankdiameter, - propertyType: 2, - required: true, - ruleName: "", - ruleValue: "", - physicalUnit: "m", - order: 0, - enabled: true, - visible: true, - tag:String(key + 1) - }, - { - propertyName: "高度", - propertyValue: element.tankheight, - propertyType: 2, - required: true, - ruleName: "", - ruleValue: "", - physicalUnit: "m", - order: 0, - enabled: true, - visible: true, - tag:String(key + 1) - }, - { - propertyName: "顶盖形式", - propertyValue: element.tanktectum, - propertyType: 0, - required: false, - ruleName: "", - ruleValue: "", - physicalUnit: "", - order: 0, - enabled: true, - visible: true, - tag:String(key + 1) - }, - { - propertyName: "浮盘材质", - propertyValue: element.tanktexture, - propertyType: 0, - required: false, - ruleName: "", - ruleValue: "", - physicalUnit: "", - order: 0, - enabled: true, - visible: true, - tag:String(key + 1) - }, - { - propertyName: "浮盘类型", - propertyValue: element.platetype, - propertyType: 0, - required: false, - ruleName: "", - ruleValue: "", - physicalUnit: "", - order: 0, - enabled: true, - visible: true, - tag:String(key + 1) - }, - { - propertyName: "泡沫产生器型号", - propertyValue: element.foamgeneratorid, - propertyType: 0, - required: false, - ruleName: "", - ruleValue: "", - physicalUnit: "", - order: 0, - enabled: true, - visible: true, - tag:String(key + 1) - }, - { - propertyName: "泡沫产生器形式", - propertyValue: element.foamgeneratortype, - propertyType: 0, - required: false, - ruleName: "", - ruleValue: "", - physicalUnit: "", - order: 0, - enabled: true, - visible: true, - tag:String(key + 1) - }, - { - propertyName: "是否设置氮封惰化保护装置", - propertyValue: element.isprotect, - propertyType: 0, - required: false, - ruleName: "", - ruleValue: "", - physicalUnit: "", - order: 0, - enabled: true, - visible: true, - tag:String(key + 1) - }, - { - propertyName: "防护堤高度", - propertyValue: element.fendinggroyneheight, - propertyType: 2, - required: true, - ruleName: "", - ruleValue: "", - physicalUnit: "m", - order: 0, - enabled: true, - visible: true, - tag:String(key + 1) - }, - { - propertyName: "半固定泡沫灭火接口数量", - propertyValue: element.portnum, - propertyType: 2, - required: false, - ruleName: "", - ruleValue: "", - physicalUnit: "个", - order: 0, - enabled: true, - visible: true, - tag:String(key + 1) - }, - { - propertyName: "其它设施", - propertyValue: element.else, - propertyType: 0, - required: false, - ruleName: "", - ruleValue: "", - physicalUnit: "", - order: 0, - enabled: true, - visible: true, - tag:String(key + 1) - } - ) + if(buildType == "石油化工类"){ + tankfieldArr.push( + { + propertyName: "罐区", + propertyValue: element.tank, + propertyType: 0, + required: false, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:String(key + 1) + }, + { + propertyName: "储罐编号", + propertyValue: element.tankid, + propertyType: 0, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:String(key + 1) + }, + { + propertyName: "储存介质", + propertyValue: element.tankmedium, + propertyType: 0, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:String(key + 1) + }, + { + propertyName: "储罐类型", + propertyValue: element.tanktype, + propertyType: 0, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:String(key + 1) + }, + { + propertyName: "容量", + propertyValue: element.tankcapacity, + propertyType: 2, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "㎡", + order: 0, + enabled: true, + visible: true, + tag:String(key + 1) + }, + { + propertyName: "直径", + propertyValue:element.tankdiameter, + propertyType: 2, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "m", + order: 0, + enabled: true, + visible: true, + tag:String(key + 1) + }, + { + propertyName: "高度", + propertyValue: element.tankheight, + propertyType: 2, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "m", + order: 0, + enabled: true, + visible: true, + tag:String(key + 1) + }, + { + propertyName: "顶盖形式", + propertyValue: element.tanktectum, + propertyType: 0, + required: false, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:String(key + 1) + }, + { + propertyName: "浮盘材质", + propertyValue: element.tanktexture, + propertyType: 0, + required: false, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:String(key + 1) + }, + { + propertyName: "浮盘类型", + propertyValue: element.platetype, + propertyType: 0, + required: false, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:String(key + 1) + }, + { + propertyName: "泡沫产生器型号", + propertyValue: element.foamgeneratorid, + propertyType: 0, + required: false, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:String(key + 1) + }, + { + propertyName: "泡沫产生器形式", + propertyValue: element.foamgeneratortype, + propertyType: 0, + required: false, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:String(key + 1) + }, + { + propertyName: "是否设置氮封惰化保护装置", + propertyValue: element.isprotect, + propertyType: 0, + required: false, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:String(key + 1) + }, + { + propertyName: "防护堤高度", + propertyValue: element.fendinggroyneheight, + propertyType: 2, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "m", + order: 0, + enabled: true, + visible: true, + tag:String(key + 1) + }, + { + propertyName: "半固定泡沫灭火接口数量", + propertyValue: element.portnum, + propertyType: 2, + required: false, + ruleName: "", + ruleValue: "", + physicalUnit: "个", + order: 0, + enabled: true, + visible: true, + tag:String(key + 1) + }, + { + propertyName: "其它设施", + propertyValue: element.else, + propertyType: 0, + required: false, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:String(key + 1) + } + ) + }else if(buildType == "加油站"){ + tankfieldArr.push( + { + propertyName: "储罐编号", + propertyValue: element.tankid, + propertyType: 0, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:String(key + 1) + }, + { + propertyName: "储存介质", + propertyValue: element.tankmedium, + propertyType: 0, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:String(key + 1) + }, + { + propertyName: "储罐类型", + propertyValue: element.tanktype, + propertyType: 0, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:String(key + 1) + }, + { + propertyName: "容量", + propertyValue: element.tankcapacity, + propertyType: 2, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "㎡", + order: 0, + enabled: true, + visible: true, + tag:String(key + 1) + }, + { + propertyName: "直径", + propertyValue:element.tankdiameter, + propertyType: 2, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "m", + order: 0, + enabled: true, + visible: true, + tag:String(key + 1) + }, + { + propertyName: "高度", + propertyValue: element.tankheight, + propertyType: 2, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "m", + order: 0, + enabled: true, + visible: true, + tag:String(key + 1) + }, + { + propertyName: "其它设施", + propertyValue: element.else, + propertyType: 0, + required: false, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:String(key + 1) + } + ) + } }); basictankchildinfobody={// id: null, @@ -1959,216 +2197,313 @@ export class BasicinfoComponent implements OnInit { }) bodyObj.buildingBasicGroups[3].buildingId = item.buildingId bodyObj.buildingBasicGroups[3].companyId = this.unitinfo.id - bodyObj.buildingBasicGroups[3].propertyInfos = [ + if(buildType == '石油化工类'){ + bodyObj.buildingBasicGroups[3].propertyInfos = [ + { + propertyName: "罐区", + propertyValue: "", + propertyType: 0, + required: false, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:"1" + }, { - propertyName: "罐区", - propertyValue: "", - propertyType: 0, - required: false, - ruleName: "", - ruleValue: "", - physicalUnit: "", - order: 0, - enabled: true, - visible: true, - tag:"1" - }, - { - propertyName: "储罐编号", - propertyValue: "", - propertyType: 0, - required: true, - ruleName: "", - ruleValue: "", - physicalUnit: "", - order: 0, - enabled: true, - visible: true, - tag:"1" - }, - { - propertyName: "储存介质", - propertyValue: "", - propertyType: 0, - required: true, - ruleName: "", - ruleValue: "", - physicalUnit: "", - order: 0, - enabled: true, - visible: true, - tag:"1" - }, - { - propertyName: "储罐类型", - propertyValue:"", - propertyType: 0, - required: true, - ruleName: "", - ruleValue: "", - physicalUnit: "", - order: 0, - enabled: true, - visible: true, - tag:"1" - }, - { - propertyName: "容量", - propertyValue: "", - propertyType: 2, - required: true, - ruleName: "", - ruleValue: "", - physicalUnit: "㎡", - order: 0, - enabled: true, - visible: true, - tag:"1" - }, - { - propertyName: "直径", - propertyValue:"", - propertyType: 2, - required: true, - ruleName: "", - ruleValue: "", - physicalUnit: "m", - order: 0, - enabled: true, - visible: true, - tag:"1" - }, - { - propertyName: "高度", - propertyValue: "", - propertyType: 2, - required: true, - ruleName: "", - ruleValue: "", - physicalUnit: "m", - order: 0, - enabled: true, - visible: true, - tag:"1" - }, - { - propertyName: "顶盖形式", - propertyValue: "", - propertyType: 0, - required: false, - ruleName: "", - ruleValue: "", - physicalUnit: "", - order: 0, - enabled: true, - visible: true, - tag:"1" - }, - { - propertyName: "浮盘材质", - propertyValue:"", - propertyType: 0, - required: false, - ruleName: "", - ruleValue: "", - physicalUnit: "", - order: 0, - enabled: true, - visible: true, - tag:"1" - }, - { - propertyName: "浮盘类型", - propertyValue: "", - propertyType: 0, - required: false, - ruleName: "", - ruleValue: "", - physicalUnit: "", - order: 0, - enabled: true, - visible: true, - tag:"1" - }, - { - propertyName: "泡沫产生器型号", - propertyValue:"", - propertyType: 0, - required: false, - ruleName: "", - ruleValue: "", - physicalUnit: "", - order: 0, - enabled: true, - visible: true, - tag:"1" - }, - { - propertyName: "泡沫产生器形式", - propertyValue: "", - propertyType: 0, - required: false, - ruleName: "", - ruleValue: "", - physicalUnit: "", - order: 0, - enabled: true, - visible: true, - tag:"1" - }, - { - propertyName: "是否设置氮封惰化保护装置", - propertyValue:"", - propertyType: 0, - required: false, - ruleName: "", - ruleValue: "", - physicalUnit: "", - order: 0, - enabled: true, - visible: true, - tag:"1" - }, - { - propertyName: "防护堤高度", - propertyValue:"", - propertyType: 2, - required: true, - ruleName: "", - ruleValue: "", - physicalUnit: "m", - order: 0, - enabled: true, - visible: true, - tag:"1" - }, - { - propertyName: "半固定泡沫灭火接口数量", - propertyValue: "", - propertyType: 2, - required: false, - ruleName: "", - ruleValue: "", - physicalUnit: "个", - order: 0, - enabled: true, - visible: true, - tag:"1" - }, - { - propertyName: "其它设施", - propertyValue: "", - propertyType: 0, - required: false, - ruleName: "", - ruleValue: "", - physicalUnit: "", - order: 0, - enabled: true, - visible: true, - tag:"1" + propertyName: "储罐编号", + propertyValue: "", + propertyType: 0, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:"1" + }, + { + propertyName: "储存介质", + propertyValue: "", + propertyType: 0, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:"1" + }, + { + propertyName: "储罐类型", + propertyValue:"", + propertyType: 0, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:"1" + }, + { + propertyName: "容量", + propertyValue: "", + propertyType: 2, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "㎡", + order: 0, + enabled: true, + visible: true, + tag:"1" + }, + { + propertyName: "直径", + propertyValue:"", + propertyType: 2, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "m", + order: 0, + enabled: true, + visible: true, + tag:"1" + }, + { + propertyName: "高度", + propertyValue: "", + propertyType: 2, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "m", + order: 0, + enabled: true, + visible: true, + tag:"1" + }, + { + propertyName: "顶盖形式", + propertyValue: "", + propertyType: 0, + required: false, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:"1" + }, + { + propertyName: "浮盘材质", + propertyValue:"", + propertyType: 0, + required: false, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:"1" + }, + { + propertyName: "浮盘类型", + propertyValue: "", + propertyType: 0, + required: false, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:"1" + }, + { + propertyName: "泡沫产生器型号", + propertyValue:"", + propertyType: 0, + required: false, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:"1" + }, + { + propertyName: "泡沫产生器形式", + propertyValue: "", + propertyType: 0, + required: false, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:"1" + }, + { + propertyName: "是否设置氮封惰化保护装置", + propertyValue:"", + propertyType: 0, + required: false, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:"1" + }, + { + propertyName: "防护堤高度", + propertyValue:"", + propertyType: 2, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "m", + order: 0, + enabled: true, + visible: true, + tag:"1" + }, + { + propertyName: "半固定泡沫灭火接口数量", + propertyValue: "", + propertyType: 2, + required: false, + ruleName: "", + ruleValue: "", + physicalUnit: "个", + order: 0, + enabled: true, + visible: true, + tag:"1" + }, + { + propertyName: "其它设施", + propertyValue: "", + propertyType: 0, + required: false, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:"1" + } + ] + }else if(buildType == '加油站'){ + bodyObj.buildingBasicGroups[3].propertyInfos = [ + { + propertyName: "储罐编号", + propertyValue: "", + propertyType: 0, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:"1" + }, + { + propertyName: "储存介质", + propertyValue: "", + propertyType: 0, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:"1" + }, + { + propertyName: "储罐类型", + propertyValue:"", + propertyType: 0, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:"1" + }, + { + propertyName: "容量", + propertyValue: "", + propertyType: 2, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "㎡", + order: 0, + enabled: true, + visible: true, + tag:"1" + }, + { + propertyName: "直径", + propertyValue:"", + propertyType: 2, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "m", + order: 0, + enabled: true, + visible: true, + tag:"1" + }, + { + propertyName: "高度", + propertyValue: "", + propertyType: 2, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "m", + order: 0, + enabled: true, + visible: true, + tag:"1" + }, + { + propertyName: "其它设施", + propertyValue: "", + propertyType: 0, + required: false, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:"1" + } + ] } - ] + // console.log(888,bodyObj) bodyObj.buildingBasicGroups.splice(4,bodyObj.buildingBasicGroups.length) } @@ -2197,6 +2532,329 @@ export class BasicinfoComponent implements OnInit { this.snackBar.open('请检查输入数据是否有误','确定',config); }) } + if(item.buildtype == "加油站"){ + let buildType = item.buildtype + let bodyObj = _.cloneDeep(item) + delete bodyObj.name + delete bodyObj.username + delete bodyObj.jiayou + delete bodyObj.newzhuangzhiinfodatasource + delete bodyObj.tongyong + delete bodyObj.buildtype + delete bodyObj.buildingtypeId + delete bodyObj.bigfor + delete bodyObj.index + delete bodyObj.isCustomData + delete bodyObj.buildingCustomData + bodyObj.buildingBasicGroups[0].propertyInfos.forEach(item => { + delete item.isshowrule + delete item.rulevalue + }); + //修改基本信息 + bodyObj.buildingBasicGroups[0].propertyInfos.forEach(item => { + for (const key in value) { + if (item.propertyName == key) { + if(item.propertyValue || item.propertyValue == 0){ + item.propertyValue = String(value[key]) + } + } + } + }); + bodyObj.buildingBasicGroups[0].submitted = true + bodyObj.buildingBasicGroups[0].buildingId = item.buildingId + bodyObj.buildingBasicGroups[0].companyId = this.unitinfo.id + + + + if(bodyObj.buildingBasicGroups[1].submitted){ //如果勾选了储罐信息 则直接提交当前bodyObj + var map = {}; //用于存储石油化工要提交的储罐信息表单 + for (let key in value) { + if (key.indexOf('tanker') != -1) { + const list = key.split('-'); // 2,tanker,1 + const orderKey = list[0]; // 2 or 3 + if (!(orderKey in map)) { + map[orderKey] = []; // map[2] or map[3] = []; + } + map[orderKey][list[2]] = value[key]; // map[2][1] = xxxxx + } + } + + bodyObj.buildingBasicGroups.splice(1 ,bodyObj.buildingBasicGroups.length) + console.log(1,bodyObj) + let basictankinfobody:any = {} + console.log(2,map) + console.log(3,item) + for(let key in map){//------------------------------------------------------------加油站 储罐信息 + basictankinfobody = { + id: null, + name: "罐区" + (Number(key)-1), + type: 0, + addMode: 2, + basicGroupId:'', + submitted:true, + isOptional:true, + order: Number(key), + enabled: true, + propertyInfos: item.bigfor[Number(key)-2][0].propertyInfos, + basicCategoryId: item.basicCategoryId, + buildingBasicId: null, + buildingId: item.buildingId,//当前建筑id + companyId: this.unitinfo.id//当前企业id + } + + bodyObj.buildingBasicGroups.push(basictankinfobody) + } + + + let basictankchildinfobody:any = []//-------------后续储罐信息以及储罐信息/罐区情况都push到这个数组中 + item.bigfor.forEach(item => { + basictankchildinfobody.push(item[1].propertyInfos) + }); + var _item = item + basictankchildinfobody.forEach((item,index) => { + let tankfieldArr = [] + item.forEach((element,key) => { + tankfieldArr.push( + { + propertyName: "储罐编号", + propertyValue: element.tankid, + propertyType: 0, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:String(key + 1) + }, + { + propertyName: "储存介质", + propertyValue: element.tankmedium, + propertyType: 0, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:String(key + 1) + }, + { + propertyName: "储罐类型", + propertyValue: element.tanktype, + propertyType: 0, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:String(key + 1) + }, + { + propertyName: "容量", + propertyValue: element.tankcapacity, + propertyType: 2, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "㎡", + order: 0, + enabled: true, + visible: true, + tag:String(key + 1) + }, + { + propertyName: "直径", + propertyValue:element.tankdiameter, + propertyType: 2, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "m", + order: 0, + enabled: true, + visible: true, + tag:String(key + 1) + }, + { + propertyName: "高度", + propertyValue: element.tankheight, + propertyType: 2, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "m", + order: 0, + enabled: true, + visible: true, + tag:String(key + 1) + }, + { + propertyName: "其它设施", + propertyValue: element.else, + propertyType: 0, + required: false, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:String(key + 1) + } + ) + }); + basictankchildinfobody = { + id: null, + name: "罐区" + Number(index+1) + "/储罐信息", + type: 1, + addMode: 2, + basicGroupId:'', + order: Number(index + 2), + enabled: true, + submitted:true, + isOptional:true, + propertyInfos: tankfieldArr, + basicCategoryId: _item.basicCategoryId, + buildingBasicId: null, + buildingId: _item.buildingId, + companyId: this.unitinfo.id + } + bodyObj.buildingBasicGroups.push(basictankchildinfobody) + }); + }else{ + bodyObj.buildingBasicGroups[1].buildingId = item.buildingId + bodyObj.buildingBasicGroups[1].companyId = this.unitinfo.id + bodyObj.buildingBasicGroups[1].propertyInfos.forEach(item=>{ + item.propertyValue = "" + }) + bodyObj.buildingBasicGroups[2].buildingId = item.buildingId + bodyObj.buildingBasicGroups[2].companyId = this.unitinfo.id + bodyObj.buildingBasicGroups[2].propertyInfos = [ + { + propertyName: "储罐编号", + propertyValue: "", + propertyType: 0, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:"1" + }, + { + propertyName: "储存介质", + propertyValue: "", + propertyType: 0, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:"1" + }, + { + propertyName: "储罐类型", + propertyValue:"", + propertyType: 0, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:"1" + }, + { + propertyName: "容量", + propertyValue: "", + propertyType: 2, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "㎡", + order: 0, + enabled: true, + visible: true, + tag:"1" + }, + { + propertyName: "直径", + propertyValue:"", + propertyType: 2, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "m", + order: 0, + enabled: true, + visible: true, + tag:"1" + }, + { + propertyName: "高度", + propertyValue: "", + propertyType: 2, + required: true, + ruleName: "", + ruleValue: "", + physicalUnit: "m", + order: 0, + enabled: true, + visible: true, + tag:"1" + }, + { + propertyName: "其它设施", + propertyValue: "", + propertyType: 0, + required: false, + ruleName: "", + ruleValue: "", + physicalUnit: "", + order: 0, + enabled: true, + visible: true, + tag:"1" + } + ] + + bodyObj.buildingBasicGroups.splice(3,bodyObj.buildingBasicGroups.length) + } + + + + let newbodyObj = [] + newbodyObj.push(bodyObj) + console.log(999,newbodyObj) + this.http.post("/api/CompanyAccount/BasicInfos",newbodyObj,{ + params:{ + buildingId :item.buildingId + } + }).subscribe((data:any)=>{ + this.houses[key].id = data[0].id + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('建筑信息保存成功','确定',config); + // alert("建筑信息保存成功") + }, + err=>{ + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('请检查输入数据是否有误','确定',config); + }) + } if(item.buildtype == "地铁类"){ let newObj = _.cloneDeep(item) delete newObj.username @@ -2218,22 +2876,6 @@ export class BasicinfoComponent implements OnInit { item.companyId = this.unitinfo.id item.submitted = true }); - // newObj.buildingBasicGroups[0].propertyInfos.forEach(item => { - // delete item.isshowrule - // delete item.rulevalue - // item.propertyValue = String(item.propertyValue) - // }); - // newObj.buildingBasicGroups[1].propertyInfos.forEach(item => { - // delete item.isshowrule - // delete item.rulevalue - // item.propertyValue = String(item.propertyValue) - // }); - // newObj.buildingBasicGroups[0].buildingId = newObj.buildingId - // newObj.buildingBasicGroups[0].companyId = this.unitinfo.id - // newObj.buildingBasicGroups[1].buildingId = newObj.buildingId - // newObj.buildingBasicGroups[1].companyId = this.unitinfo.id - // newObj.buildingBasicGroups[0].submitted = true - // newObj.buildingBasicGroups[1].submitted = true let newbodyObj2 = [] newbodyObj2.push(newObj) this.http.post("/api/CompanyAccount/BasicInfos",newbodyObj2,{