Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import { Component} from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { Response } from '@angular/http';
import { AppService } from '../../../service/appHttpService';
@IonicPage()
@Component({
selector: 'page-search',
templateUrl: 'search.html'
})
export class SearchPage {
searchValue:string;
contactPersons: Array<string>[];
//组织部门id
orgId:string = '';
orgName:string = '';
constructor(
public navCtrl: NavController,
public navParams: NavParams,
public appService:AppService
) {
if(!typeof(this.navParams.get("orgid")) == undefined){
this.orgId = this.navParams.get("orgid");
}
if(!typeof(this.navParams.get("orgName")) == undefined){
this.orgName = this.navParams.get("orgName");
}
}
clearValue(){
this.searchValue="";
}
searchUser(){
console.log("searchValue:"+this.searchValue);
// let nameval = encodeURIComponent(this.searchValue) ;
// this.appService.ObserverHttpPost("/wisdomgroup/app/getUserByName",{"name":nameval,"orgId":this.orgId})
// .subscribe((res: Response) => {
// let data = res.json();
// this.contactPersons = data;
// if(this.orgId !=null && this.orgId !=''){
// //同组织部门下
// this.contactPersons.forEach(element => {
// element["orgName"] = this.orgName;
// element["hasgeneralpersonsflag"] = false;
// });
// }else{
// this.contactPersons.forEach(element => {
// this.getOrgName(element["id"],result=>{
// element["orgName"] = result["orgName"];
// element["hasgeneralpersonsflag"] = false;
// });
// });
// }
// }, error => {
// this.appService.alert('网络异常!');
// }
// );
const data = {
name:this.searchValue,
pageNumber:1,
pageSize:100,
};
this.appService.ObserverHttpNoForm('/wisdomgroup/app/getUserByName',data)
.subscribe((res)=>{
this.contactPersons = res.json().list;
})
}
//跳转联系人信息页面
contactPersonInfo(contactPerson){
this.navCtrl.push("ContractPersoninfoPage",{"id":contactPerson.id});
}
//根据用户id获取部门信息
getOrgName(id,callback?): any {
this.appService.ObserverHttpPost("/wisdomgroup/app/getOrgName",{"userid":id})
.toPromise()
.then(res => {
var data = res.json();
callback(data == null ? "[]" : data);
})
.catch(error => {
});
}
}