验证中...
片段 1 片段 2 片段 3
初始化查询数据
原始数据 复制代码
ngOnInit() {
this.items = [
{label: '添加子机构', icon: 'fa-plus-square', command: (event) => this.addOrganization(this.selectedOrg)},
{label: '删除', icon: 'fa-trash-o', command: (event) => this.deleteOrganization(this.selectedOrg)}
];
this.orgType = [
{label:"内部部门",value:"1"},
{label: "外部部门",value:"2"}
];
this.organization.organizationType = 1;
this.organizationService.getOrganizationTreeByParent().subscribe(
data => {this.orgTree = data["responseData"];}
);
}
service 层
原始数据 复制代码
constructor(private httpUtil : HttpUtil) { }
public getOrganizationTreeByParent() : Observable<Object>{
return this.httpUtil.httpPost(User_Organization_Tree_URL, "parentId=");
}
httpPost 请求
原始数据 复制代码
@Injectable()
export class HttpUtil {
private http:any;
constructor(http:HttpClient){
this.http = http;
}
public httpPost(url,data):Observable<Object>{
let header = null;
if(Cookie.get("token") != null){
header = new HttpHeaders({
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8',
'Authorization': Cookie.get("token")
});
}else{
header = new HttpHeaders({
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8'
});
}
return this.http.post(
url,
data,
{
headers: header
});
}

评论列表( 0 )

你可以在登录后,发表评论

搜索帮助

12_float_left_people 12_float_left_close