Browse Source

[修正]修正基本信息页面切换建筑类型自定义属性框自动勾选问题以及新添basicGroupId字段

develop
邵佳豪 5 years ago
parent
commit
2afb625d55
  1. 75
      src/app/ui/basicinfo/basicinfo.component.ts

75
src/app/ui/basicinfo/basicinfo.component.ts

@ -119,28 +119,30 @@ export class BasicinfoComponent implements OnInit {
node = item
}
});
if(!node.parentId){
this.selectedorganization = node.name
}else{
let namearr = [node.name]
let targetId = node.parentId; // 临时变量
for(let i = 0; i < node.level ; i++){
this.allorganizing.forEach(item => {
if(item.id == targetId ){
namearr.push(item.name)
targetId = item.parentId; // 临时变量更新没有副作用
}
});
if(node){
if(!node.parentId){
this.selectedorganization = node.name
}else{
let namearr = [node.name]
let targetId = node.parentId; // 临时变量
for(let i = 0; i < node.level ; i++){
this.allorganizing.forEach(item => {
if(item.id == targetId ){
namearr.push(item.name)
targetId = item.parentId; // 临时变量更新没有副作用
}
});
}
namearr.reverse()
let str = ''
namearr.forEach(item=>{
str += '/' + item
})
this.selectedorganization = str.substr(1)
}
namearr.reverse()
let str = ''
namearr.forEach(item=>{
str += '/' + item
})
this.selectedorganization = str.substr(1)
}
this.unitinfo = data
@ -543,27 +545,20 @@ export class BasicinfoComponent implements OnInit {
}
}).subscribe((data:any)=>{
// console.log(1314,data)
console.log(777,data[0])
item.bigfor.push([
{
id: "",
name: "储罐信息"+ (item.bigfor.length+ 1),
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:[
// {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: 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: 1, required: false, ruleName: "",ruleValue: "",physicalUnit: "",order: 0,enabled: true,visible: true,tag: "1"}
// ]
propertyInfos:data[0].buildingBasicGroups[2].propertyInfos
},
{
@ -573,8 +568,9 @@ export class BasicinfoComponent implements OnInit {
buildingId: item.buildingId,
companyId: this.unitinfo.id,
enabled: true,
basicGroupId:'',
id: "",
name: "储罐信息" + (item.bigfor.length+ 1) +"/罐区情况",
name: "罐区" + (item.bigfor.length+ 1) +"/罐区情况",
order: item.bigfor.length+3,
propertyInfos: [
{
@ -1091,7 +1087,8 @@ export class BasicinfoComponent implements OnInit {
//切换建筑类型
templatebuildtype(n ,item){
this.http.put(`/api/CompanyAccount/Buildings/${item.buildingId}`,{ //(通用)只修改建筑名称和建筑类型
// console.log(n,item)
this.http.put(`/api/CompanyAccount/Buildings/${item.buildingId}`,{ //修改当前建筑类型
id: item.buildingId,
name: item.housename,
order: 0,
@ -1104,7 +1101,7 @@ export class BasicinfoComponent implements OnInit {
}
]
}).subscribe(data=>{
this.http.get("/api/CompanyAccount/BasicInfos",{//请求当前建筑的模板信息保存到数组中
this.http.get("/api/CompanyAccount/BasicInfos",{//请求当前建筑类型的模板信息保存到数组中
params:{
buildingId:item.buildingId,
buildingType:n.id
@ -1116,10 +1113,9 @@ export class BasicinfoComponent implements OnInit {
let _data = data
this.http.get("/api/CompanyAccount/BuildingCustomData",{params:{
buildingId:item.buildingId
}}).subscribe(data=>{
// console.log(456,n.id)
}}).subscribe((data:any)=>{
_data[0].buildingCustomData = data
if(data){
if(data && data.customProperties.length != 0){
_data[0].isCustomData = true
}else{
_data[0].isCustomData = false
@ -1245,6 +1241,7 @@ export class BasicinfoComponent implements OnInit {
let body = newObj
let newbody = []
newbody.push(body)
console.log(123,newbody)
if(newbody[0].buildingBasicGroups.length){
this.http.post("/api/CompanyAccount/BasicInfos",newbody,{
params:{
@ -1434,9 +1431,10 @@ export class BasicinfoComponent implements OnInit {
for(let key in map){//------------------------------------------------------------石油化工 储罐信息
basictankinfobody = {
id: null,
name: "储罐信息" + (Number(key)-1),
name: "罐区" + (Number(key)-1),
type: 0,
addMode: 2,
basicGroupId:'',
submitted:true,
isOptional:true,
order: Number(key),
@ -1766,9 +1764,10 @@ export class BasicinfoComponent implements OnInit {
});
basictankchildinfobody={//
id: null,
name: "储罐信息" + Number(index+1) + "/罐区情况",
name: "罐区" + Number(index+1) + "/罐区情况",
type: 1,
addMode: 2,
basicGroupId:'',
order: Number(index + 2),
enabled: true,
submitted:true,

Loading…
Cancel
Save