Browse Source

[完善]保存基本信息更新分数

zhuzhou
邵佳豪 4 years ago
parent
commit
9d96ad28dc
  1. 18
      src/app/key-unit/basicinfo/basicinfo.component.ts

18
src/app/key-unit/basicinfo/basicinfo.component.ts

@ -19,6 +19,7 @@ import * as _ from 'lodash';
import Swiper from 'swiper'; import Swiper from 'swiper';
import { LookMaster } from './lookmaster.component' import { LookMaster } from './lookmaster.component'
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { TabbarAndScoreService } from 'src/app/http-interceptors/tabbar-and-score.service';
declare var AMap: any; declare var AMap: any;
@Component({ @Component({
@ -81,7 +82,7 @@ export class BasicinfoComponent implements OnInit {
buildingCustomData:any //存储当前建筑的自定义信息 buildingCustomData:any //存储当前建筑的自定义信息
allunittype: any //所有单位类型 allunittype: any //所有单位类型
allorganizing:any = [] //所有组织机构 allorganizing:any = [] //所有组织机构
constructor(private route:ActivatedRoute,private elementRef: ElementRef,public renderer2: Renderer2,private http: HttpClient, private tree: TreeService, private sanitizer: DomSanitizer, public dialog: MatDialog,public snackBar: MatSnackBar) { } constructor(private tabbarService: TabbarAndScoreService,private route:ActivatedRoute,private elementRef: ElementRef,public renderer2: Renderer2,private http: HttpClient, private tree: TreeService, private sanitizer: DomSanitizer, public dialog: MatDialog,public snackBar: MatSnackBar) { }
houses: any = [] //存储当前单位的建筑信息 houses: any = [] //存储当前单位的建筑信息
unitId : any //当前单位id unitId : any //当前单位id
@ -410,7 +411,7 @@ export class BasicinfoComponent implements OnInit {
async data => { async data => {
if(data){ if(data){
this.houses.push(data) this.houses.push(data)
// console.log('新增了',this.houses) this.tabbarService.sendMessage('changeScore');//通知服务改变分数
} }
} }
); );
@ -823,9 +824,9 @@ export class BasicinfoComponent implements OnInit {
config.duration = 3000 config.duration = 3000
this.snackBar.open('删除成功','确定',config); this.snackBar.open('删除成功','确定',config);
this.houses.splice(this.houses.findIndex(items=>items==item),1) this.houses.splice(this.houses.findIndex(items=>items==item),1)
let obj ={index:key} let obj ={index:key}
this.selectedTabChange(obj) this.selectedTabChange(obj)
this.tabbarService.sendMessage('changeScore');//通知服务改变分数
}) })
} }
} }
@ -884,13 +885,16 @@ export class BasicinfoComponent implements OnInit {
companyId : this.unitId companyId : this.unitId
}}).subscribe(data=>{//首先创建建筑成功了,需要刷出当前建筑类型的模板 }}).subscribe(data=>{//首先创建建筑成功了,需要刷出当前建筑类型的模板
// alert('创建主体建筑成功') // alert('创建主体建筑成功')
this.tabbarService.sendMessage('changeScore');//通知服务改变分数
this.getUnitAllBuildings() this.getUnitAllBuildings()
}) })
this.tabbarService.sendMessage('changeScore');//通知服务改变分数
}else{ }else{
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.snackBar.open('保存成功','确定',config); this.snackBar.open('保存成功','确定',config);
this.tabbarService.sendMessage('changeScore');//通知服务改变分数
} }
}), }),
err=>{ err=>{
@ -1056,12 +1060,14 @@ export class BasicinfoComponent implements OnInit {
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.snackBar.open('建筑信息保存成功','确定',config); this.snackBar.open('建筑信息保存成功','确定',config);
this.tabbarService.sendMessage('changeScore');//通知服务改变分数
}, },
err=>{ err=>{
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.snackBar.open('请检查输入数据是否有误','确定',config); this.snackBar.open('建筑信息保存失败','确定',config);
this.tabbarService.sendMessage('changeScore');//通知服务改变分数
}) })
//保存建筑自定义信息 //保存建筑自定义信息
@ -1070,7 +1076,7 @@ export class BasicinfoComponent implements OnInit {
companyId :this.unitId, companyId :this.unitId,
buildingId:item.id buildingId:item.id
}}).subscribe(data=>{ }}).subscribe(data=>{
this.tabbarService.sendMessage('changeScore');//通知服务改变分数
}) })
}else{ }else{
item.customData.customProperties = [] item.customData.customProperties = []
@ -1078,7 +1084,7 @@ export class BasicinfoComponent implements OnInit {
companyId :this.unitId, companyId :this.unitId,
buildingId:item.id buildingId:item.id
}}).subscribe(data=>{ }}).subscribe(data=>{
this.tabbarService.sendMessage('changeScore');//通知服务改变分数
}) })
} }

Loading…
Cancel
Save