|
|
|
import { Component, OnInit } from "@angular/core";
|
|
|
|
import { HttpClient } from "@angular/common/http";
|
|
|
|
import { MatSnackBar } from "@angular/material/snack-bar";
|
|
|
|
import { Router } from "@angular/router";
|
|
|
|
import { TreeService } from "src/app/http-interceptors/tree.service";
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: "app-station-examinee",
|
|
|
|
templateUrl: "./station-examinee.component.html",
|
|
|
|
styleUrls: ["./station-examinee.component.scss"],
|
|
|
|
})
|
|
|
|
export class StationExamineeComponent implements OnInit {
|
|
|
|
constructor(
|
|
|
|
private router: Router,
|
|
|
|
public http: HttpClient,
|
|
|
|
public snackBar: MatSnackBar,
|
|
|
|
private tree: TreeService
|
|
|
|
) {}
|
|
|
|
|
|
|
|
ngOnInit(): void {
|
|
|
|
//获得登陆组织机构id
|
|
|
|
this.getProfiles().then((res) => {
|
|
|
|
//过滤得到正确的组织机构tree
|
|
|
|
this.getOrganizations();
|
|
|
|
});
|
|
|
|
this.getAlltabledate();
|
|
|
|
}
|
|
|
|
//获取登录账号的个人资料
|
|
|
|
Profiles: any;
|
|
|
|
getProfiles() {
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
this.http.get("/api/ExamAccounts/Profiles").subscribe((data: any) => {
|
|
|
|
this.Profiles = data;
|
|
|
|
sessionStorage.setItem("creatorData", JSON.stringify(data));
|
|
|
|
resolve(data);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
//获得所有组织机构
|
|
|
|
allorganizations;
|
|
|
|
treedata;
|
|
|
|
nodes;
|
|
|
|
expandedKeys = [];
|
|
|
|
getOrganizations() {
|
|
|
|
this.http.get("/api/Organizations").subscribe((data: any) => {
|
|
|
|
this.allorganizations = data;
|
|
|
|
this.treedata = this.tree.toTree(data);
|
|
|
|
this.getpresentOrganization();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
//得到当前单位所在组织机构的tree型数据
|
|
|
|
organizationName;
|
|
|
|
newallorganizations;
|
|
|
|
getpresentOrganization() {
|
|
|
|
this.newallorganizations = this.allorganizations;
|
|
|
|
this.newallorganizations.forEach((item) => {
|
|
|
|
item.children = [];
|
|
|
|
this.newallorganizations.forEach((element) => {
|
|
|
|
if (element.parentId == item.id) {
|
|
|
|
item.children.push(element);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
this.organizationName = this.Profiles.organizationName;
|
|
|
|
if (this.organizationName) {
|
|
|
|
this.newallorganizations.forEach((item) => {
|
|
|
|
if (item.name == this.organizationName) {
|
|
|
|
this.nodes = [item];
|
|
|
|
this.expandedKeys = [item.key];
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
this.nodes = this.tree.toTree(this.treedata);
|
|
|
|
this.expandedKeys = this.nodes[0].key;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//获取表格信息
|
|
|
|
PageNumber = 1;
|
|
|
|
PageSize = 10;
|
|
|
|
name;
|
|
|
|
orId;
|
|
|
|
orIdChecked;
|
|
|
|
tabledataSource;
|
|
|
|
length;
|
|
|
|
getAlltabledate() {
|
|
|
|
let paramsdata: any = {
|
|
|
|
PageNumber: this.PageNumber,
|
|
|
|
PageSize: this.PageSize,
|
|
|
|
OrganizationId: this.orId || "",
|
|
|
|
HasChildren: this.orIdChecked || "",
|
|
|
|
};
|
|
|
|
this.http
|
|
|
|
.get("/api/Papers", { params: paramsdata })
|
|
|
|
.subscribe((data: any) => {
|
|
|
|
this.tabledataSource = data.items;
|
|
|
|
this.length = data.totalCount;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
//分页事件
|
|
|
|
chagePage(e) {
|
|
|
|
this.PageNumber = e.pageIndex + 1;
|
|
|
|
this.getAlltabledate();
|
|
|
|
}
|
|
|
|
To() {
|
|
|
|
this.router.navigate(["/home/statistic-examination/examinee-papers"]); //登陆成功跳转页面
|
|
|
|
}
|
|
|
|
//查询按钮
|
|
|
|
Submit() {}
|
|
|
|
//重置按钮
|
|
|
|
Reset() {}
|
|
|
|
}
|