|
|
@ -19,6 +19,7 @@ import * as _ from 'lodash'; |
|
|
|
// import Swiper from 'swiper';
|
|
|
|
// import Swiper from 'swiper';
|
|
|
|
import { LookMaster2 } from './lookmaster.component' |
|
|
|
import { LookMaster2 } from './lookmaster.component' |
|
|
|
import { Router,ActivatedRoute } from '@angular/router' |
|
|
|
import { Router,ActivatedRoute } from '@angular/router' |
|
|
|
|
|
|
|
import {CacheTokenService} from '../../http-interceptors/cache-token.service' |
|
|
|
|
|
|
|
|
|
|
|
@Component({ |
|
|
|
@Component({ |
|
|
|
selector: 'app-basicinfo-look', |
|
|
|
selector: 'app-basicinfo-look', |
|
|
@ -83,16 +84,26 @@ export class BasicinfoLookComponent implements OnInit { |
|
|
|
buildingCustomData:any //存储当前建筑的自定义信息
|
|
|
|
buildingCustomData:any //存储当前建筑的自定义信息
|
|
|
|
allunittype: any //所有单位类型
|
|
|
|
allunittype: any //所有单位类型
|
|
|
|
allorganizing:any = [] //所有组织机构
|
|
|
|
allorganizing:any = [] //所有组织机构
|
|
|
|
constructor(private router:Router,private route:ActivatedRoute,private http: HttpClient, private tree: TreeService, private sanitizer: DomSanitizer, public dialog: MatDialog,public snackBar: MatSnackBar) { } |
|
|
|
constructor(private router:Router,private route:ActivatedRoute,private http: HttpClient, private tree: TreeService, private sanitizer: DomSanitizer, public dialog: MatDialog,public snackBar: MatSnackBar,public isLogin:CacheTokenService) { } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
unitId : any //当前单位id
|
|
|
|
unitId = sessionStorage.getItem('companyId') //当前单位id
|
|
|
|
ngOnInit(): void { |
|
|
|
ngOnInit(): void { |
|
|
|
this.getallunittype() |
|
|
|
let token = sessionStorage.getItem('token') |
|
|
|
this.getorganization() |
|
|
|
if (token) { |
|
|
|
// this.getunitinfo()
|
|
|
|
this.unitId = sessionStorage.getItem('companyId'); |
|
|
|
this.getunitallbuilding() |
|
|
|
this.getallunittype() |
|
|
|
this.unitId = this.route.snapshot.queryParams.id |
|
|
|
this.getorganization() |
|
|
|
|
|
|
|
this.getunitallbuilding() |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.isLogin.login().then(res=>{ |
|
|
|
|
|
|
|
this.unitId = sessionStorage.getItem('companyId'); |
|
|
|
|
|
|
|
this.getallunittype() |
|
|
|
|
|
|
|
this.getorganization() |
|
|
|
|
|
|
|
this.getunitallbuilding() |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
//获得所有单位类型
|
|
|
|
//获得所有单位类型
|
|
|
|
getallunittype() { |
|
|
|
getallunittype() { |
|
|
@ -112,14 +123,13 @@ export class BasicinfoLookComponent implements OnInit { |
|
|
|
} |
|
|
|
} |
|
|
|
//获得当前单位的基本信息
|
|
|
|
//获得当前单位的基本信息
|
|
|
|
getunitinfo(){ |
|
|
|
getunitinfo(){ |
|
|
|
|
|
|
|
this.http.get(`/api/Companies/${sessionStorage.getItem('companyId')}`).subscribe((data:any)=>{ |
|
|
|
|
|
|
|
|
|
|
|
this.http.get(`/api/Companies/${this.unitId}`).subscribe((data:any)=>{ |
|
|
|
// if(data.buildingTypes.length){
|
|
|
|
|
|
|
|
// sessionStorage.setItem('buildingTypeId',data.buildingTypes[0].id)
|
|
|
|
if(data.buildingTypes.length){ |
|
|
|
// }else{
|
|
|
|
sessionStorage.setItem('buildingTypeId',data.buildingTypes[0].id) |
|
|
|
// sessionStorage.setItem('buildingTypeId',"")
|
|
|
|
}else{ |
|
|
|
// }
|
|
|
|
sessionStorage.setItem('buildingTypeId',"") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
let node |
|
|
|
let node |
|
|
|
this.allorganizing.forEach(item => { |
|
|
|
this.allorganizing.forEach(item => { |
|
|
|
if(item.id == data.organizationId){ |
|
|
|
if(item.id == data.organizationId){ |
|
|
@ -323,7 +333,7 @@ export class BasicinfoLookComponent implements OnInit { |
|
|
|
allBuildings:any |
|
|
|
allBuildings:any |
|
|
|
getunitallbuilding(){ |
|
|
|
getunitallbuilding(){ |
|
|
|
this.houses = [] |
|
|
|
this.houses = [] |
|
|
|
this.unitId = this.route.snapshot.queryParams.id |
|
|
|
this.unitId = sessionStorage.getItem('companyId') |
|
|
|
this.http.get("/api/Buildings",{ |
|
|
|
this.http.get("/api/Buildings",{ |
|
|
|
params:{ |
|
|
|
params:{ |
|
|
|
companyId:this.unitId |
|
|
|
companyId:this.unitId |
|
|
@ -952,7 +962,7 @@ export class BasicinfoLookComponent implements OnInit { |
|
|
|
config.duration = 3000 |
|
|
|
config.duration = 3000 |
|
|
|
this.snackBar.open('请填写必填项','确定',config); |
|
|
|
this.snackBar.open('请填写必填项','确定',config); |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
sessionStorage.setItem('buildingTypeId',value.unittype) |
|
|
|
// sessionStorage.setItem('buildingTypeId',value.unittype)
|
|
|
|
let time =new Date() |
|
|
|
let time =new Date() |
|
|
|
let body = { |
|
|
|
let body = { |
|
|
|
id: this.unitinfo.id, |
|
|
|
id: this.unitinfo.id, |
|
|
|