|
@@ -17,8 +17,10 @@ export class AllocationWorkerComponent implements OnInit {
|
17
|
17
|
) {}
|
18
|
18
|
|
19
|
19
|
ngOnInit() {
|
|
20
|
+ this.groupList = JSON.parse(
|
|
21
|
+ localStorage.getItem("user")
|
|
22
|
+ ).user.scope.groupIds;
|
20
|
23
|
this.getWorkerList();
|
21
|
|
- // this.getGroupList();
|
22
|
24
|
}
|
23
|
25
|
// 支助人员数据
|
24
|
26
|
workerList = [];
|
|
@@ -42,13 +44,13 @@ export class AllocationWorkerComponent implements OnInit {
|
42
|
44
|
|
43
|
45
|
// 支助人员数据
|
44
|
46
|
groupList: Array<{ groupName: string; id: string }> = []; //分组下拉框
|
45
|
|
- groupIds;
|
46
|
47
|
snum = 0;
|
47
|
48
|
loading1 = false;
|
|
49
|
+ nameMask = false; //是否禁用
|
|
50
|
+ groupMask = false; //是否禁用
|
48
|
51
|
getWorkerList(pageIndex?) {
|
49
|
|
- let that = this;
|
50
|
|
- that.id = that.route.snapshot.paramMap.get("id");
|
51
|
|
- that.stateId = that.route.snapshot.paramMap.get("stateId");
|
|
52
|
+ this.id = this.route.snapshot.paramMap.get("id");
|
|
53
|
+ this.stateId = this.route.snapshot.paramMap.get("stateId");
|
52
|
54
|
this.pageIndex = pageIndex ? pageIndex : this.pageIndex;
|
53
|
55
|
|
54
|
56
|
let groupsId = [];
|
|
@@ -58,18 +60,25 @@ export class AllocationWorkerComponent implements OnInit {
|
58
|
60
|
}
|
59
|
61
|
);
|
60
|
62
|
|
61
|
|
- let postData = {
|
|
63
|
+ let postData: any = {
|
62
|
64
|
idx: this.pageIndex - 1,
|
63
|
|
- sum: that.pageSize,
|
64
|
|
- // workOrderId: that.id,
|
65
|
|
- groupId: that.checkedGroup ? that.checkedGroup : "",
|
66
|
|
- groupIds: that.groupIds ? that.groupIds : "",
|
67
|
|
- name: that.searchName,
|
|
65
|
+ sum: this.pageSize,
|
|
66
|
+ groupIds: "",
|
68
|
67
|
hosId: this.route.snapshot.paramMap.get("hosId"),
|
69
|
68
|
};
|
|
69
|
+ if (this.searchName) {
|
|
70
|
+ postData.name = this.searchName;
|
|
71
|
+ } else {
|
|
72
|
+ delete postData.name;
|
|
73
|
+ }
|
|
74
|
+ if (this.checkedGroup) {
|
|
75
|
+ postData.groupId = this.checkedGroup;
|
|
76
|
+ } else {
|
|
77
|
+ delete postData.groupId;
|
|
78
|
+ }
|
70
|
79
|
this.snum++;
|
71
|
80
|
this.loading1 = true;
|
72
|
|
- that.mainService
|
|
81
|
+ this.mainService
|
73
|
82
|
.getSerInfo("getOnlineWorker", postData)
|
74
|
83
|
.subscribe((data) => {
|
75
|
84
|
this.snum--;
|
|
@@ -77,36 +86,29 @@ export class AllocationWorkerComponent implements OnInit {
|
77
|
86
|
this.loading1 = false;
|
78
|
87
|
}
|
79
|
88
|
console.log(data);
|
80
|
|
- that.workerList = data.data;
|
81
|
|
- that.listLength = data.totalNum;
|
82
|
|
- if (data.groupIds) {
|
83
|
|
- // 获取分组
|
84
|
|
- that.groupIds = data.groupIds;
|
85
|
|
- that.mainService
|
86
|
|
- .coopData("group", "findGroup", { groupIds: data.groupIds })
|
87
|
|
- .subscribe((res) => {
|
88
|
|
- that.groupList = res.data;
|
89
|
|
- });
|
90
|
|
- } else {
|
91
|
|
- that.groupList = [];
|
92
|
|
- }
|
|
89
|
+ this.workerList = data.data;
|
|
90
|
+ this.listLength = data.totalNum;
|
93
|
91
|
});
|
94
|
92
|
}
|
95
|
93
|
|
96
|
94
|
// 输入用户信息搜索节流阀
|
97
|
95
|
time: any;
|
98
|
|
- searchInp() {
|
99
|
|
- let that = this;
|
100
|
|
- // clearTimeout(that.time);
|
101
|
|
- // that.time = setTimeout(() => {
|
102
|
|
- that.getWorkerList(1);
|
103
|
|
- // }, 2000);
|
|
96
|
+ searchInp(type) {
|
|
97
|
+ this.getWorkerList(1);
|
|
98
|
+ console.log(type);
|
|
99
|
+ if (type == "worker") {
|
|
100
|
+ this.groupMask = Boolean(this.searchName);
|
|
101
|
+ } else if (type == "group") {
|
|
102
|
+ this.nameMask = Boolean(this.checkedGroup);
|
|
103
|
+ }
|
104
|
104
|
}
|
105
|
105
|
|
106
|
106
|
// 选择分配支助人员
|
107
|
107
|
worderId = 0; //支助人员id
|
108
|
108
|
checkAllotWorker(id, flag?): void {
|
109
|
|
- this.mapOfCheckedId = { [id]: flag?!this.mapOfCheckedId[id]:this.mapOfCheckedId[id] };
|
|
109
|
+ this.mapOfCheckedId = {
|
|
110
|
+ [id]: flag ? !this.mapOfCheckedId[id] : this.mapOfCheckedId[id],
|
|
111
|
+ };
|
110
|
112
|
this.worderId = id;
|
111
|
113
|
}
|
112
|
114
|
|