|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
import { HttpClient } from '@angular/common/http'; |
|
|
|
|
import { Component, OnInit, Inject } from '@angular/core'; |
|
|
|
|
import { MatSnackBar } from '@angular/material/snack-bar'; |
|
|
|
|
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; |
|
|
|
|
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; |
|
|
|
|
@Component({ |
|
|
|
|
selector: 'app-add-six-familiar', |
|
|
|
|
templateUrl: './add-six-familiar.component.html', |
|
|
|
@ -11,15 +11,43 @@ export class AddSixFamiliarComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
constructor(private http:HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar) { } |
|
|
|
|
title:String = "新增六熟悉记录" |
|
|
|
|
|
|
|
|
|
unitname:any |
|
|
|
|
address:any |
|
|
|
|
contactname:any |
|
|
|
|
contactphone:any |
|
|
|
|
peoplenum:any |
|
|
|
|
leadname:any |
|
|
|
|
ngOnInit(): void { |
|
|
|
|
} |
|
|
|
|
//选择单位
|
|
|
|
|
openUnitList(){ |
|
|
|
|
let dialogRef = this.dialog.open(SelectUnit); |
|
|
|
|
dialogRef.afterClosed().subscribe(data=>{ |
|
|
|
|
|
|
|
|
|
if(data){ |
|
|
|
|
this.unitname = data.name |
|
|
|
|
this.address = data.address |
|
|
|
|
this.contactname = data.contacts |
|
|
|
|
this.contactphone = data.phone |
|
|
|
|
} |
|
|
|
|
});
|
|
|
|
|
} |
|
|
|
|
//确定
|
|
|
|
|
ok(){ |
|
|
|
|
console.log(this.unitname) |
|
|
|
|
if(this.unitname && this.address && this.contactname && this.contactphone && this.peoplenum && this.leadname){ |
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('存在未填项','确定',config) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//取消
|
|
|
|
|
cancel(){ |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -34,9 +62,43 @@ export class SelectUnit {
|
|
|
|
|
|
|
|
|
|
constructor(private http:HttpClient,public dialog: MatDialog,public dialogRef: MatDialogRef<SelectUnit>,@Inject(MAT_DIALOG_DATA) public data) { } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
unitName:any //输入的单位名
|
|
|
|
|
allUnitList:any |
|
|
|
|
ngOnInit(): void { |
|
|
|
|
this.getAllKeyUnit() |
|
|
|
|
} |
|
|
|
|
//获得所有单位
|
|
|
|
|
getAllKeyUnit(){ |
|
|
|
|
let paramsdata:any = { |
|
|
|
|
Name: this.unitName || '', |
|
|
|
|
OrganizationId: '', |
|
|
|
|
HasChildren: '', |
|
|
|
|
USCI:'', |
|
|
|
|
IsFollowed: '', |
|
|
|
|
BuildingTypeId: '', |
|
|
|
|
PageNumber:'1', |
|
|
|
|
PageSize: 100, |
|
|
|
|
Sort: '' |
|
|
|
|
} |
|
|
|
|
this.http.get("/api/Companies",{params:paramsdata}).subscribe((data:any)=>{ |
|
|
|
|
this.allUnitList = data.items |
|
|
|
|
console.log(789,data.items) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
selectedUnit:any//选中的单位
|
|
|
|
|
selected(item){ |
|
|
|
|
this.selectedUnit = item |
|
|
|
|
console.log(item) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//搜索
|
|
|
|
|
search(){ |
|
|
|
|
this.getAllKeyUnit() |
|
|
|
|
} |
|
|
|
|
//确定选择
|
|
|
|
|
ok(){ |
|
|
|
|
this.dialogRef.close(this.selectedUnit); |
|
|
|
|
} |
|
|
|
|
} |