|
@@ -30,6 +30,7 @@ export class MainComponent implements OnInit {
|
30
|
30
|
specimenViewRole: boolean = false; //业务视图权限
|
31
|
31
|
specimenViewRole2: boolean = false; //标本视图权限
|
32
|
32
|
disinfectionSupplyRole: boolean = false; //全局业务查看权限
|
|
33
|
+ PCCommutesToWork: boolean = false; //PC上下班权限
|
33
|
34
|
@ViewChild("osComponentRef1", {
|
34
|
35
|
read: OverlayScrollbarsComponent,
|
35
|
36
|
static: false,
|
|
@@ -63,6 +64,158 @@ export class MainComponent implements OnInit {
|
63
|
64
|
// 断掉连接
|
64
|
65
|
this.webs.closeWs(true);
|
65
|
66
|
}
|
|
67
|
+
|
|
68
|
+ //上下班
|
|
69
|
+ loading3 = false;
|
|
70
|
+ workModal: boolean = false; //模态框
|
|
71
|
+ showWorkModal() {
|
|
72
|
+ this.workModal = true;
|
|
73
|
+ }
|
|
74
|
+ hideWorkModal() {
|
|
75
|
+ this.workModal = false;
|
|
76
|
+ }
|
|
77
|
+ confirmWork() {
|
|
78
|
+ this.loading3 = true;
|
|
79
|
+ if (this.userInfo.user.online) {
|
|
80
|
+ // 判断当前启用的工作方案是自主还是综合排班
|
|
81
|
+ this.getUserWorkDept().then((ress:any) => {
|
|
82
|
+ if (ress.status == 200) {
|
|
83
|
+ let workType = ress.settings ? ress.settings.workType : -1; //1是综合,2是自主
|
|
84
|
+ // 自主下班,并且是科室绑定人员,科室绑定分组,绑定分组
|
|
85
|
+ if (workType == 2) {
|
|
86
|
+ this.loading3 = false;
|
|
87
|
+ this.msg.info('不支持此上班模式!');
|
|
88
|
+ } else {
|
|
89
|
+ this.mainService.onOrOffLine({
|
|
90
|
+ type: "off",
|
|
91
|
+ }).subscribe((res:any) => {
|
|
92
|
+ if (res.status == 200) {
|
|
93
|
+ this.getCurrentUserNow();
|
|
94
|
+ } else {
|
|
95
|
+ this.loading3 = false;
|
|
96
|
+ this.msg.error('操作失败');
|
|
97
|
+ }
|
|
98
|
+ });
|
|
99
|
+ }
|
|
100
|
+ } else if (ress.status == 500) {
|
|
101
|
+ //500的时候自选下班
|
|
102
|
+ this.customOff();
|
|
103
|
+ } else {
|
|
104
|
+ this.loading3 = false;
|
|
105
|
+ this.msg.error('操作失败');
|
|
106
|
+ }
|
|
107
|
+ });
|
|
108
|
+ } else {
|
|
109
|
+ this.getWorkScheme();
|
|
110
|
+ }
|
|
111
|
+ }
|
|
112
|
+
|
|
113
|
+ // 获取启动中的工作分配方案
|
|
114
|
+ workSchemeType:any = ""; //启动中工作分配方案类型
|
|
115
|
+ getWorkScheme() {
|
|
116
|
+ let postData = {
|
|
117
|
+ idx: 0,
|
|
118
|
+ workScheme: {
|
|
119
|
+ status: 1,
|
|
120
|
+ hosId: this.currentHospital.id
|
|
121
|
+ },
|
|
122
|
+ sum: 1,
|
|
123
|
+ };
|
|
124
|
+ this.mainService.getFetchDataList("simple/data", "workScheme", postData).subscribe((res) => {
|
|
125
|
+ if (res.status == 200) {
|
|
126
|
+ if(Array.isArray(res.list) && res.list.length){
|
|
127
|
+ this.workSchemeType = res.list[0].workType;
|
|
128
|
+ if (this.workSchemeType == 2) {
|
|
129
|
+ this.loading3 = false;
|
|
130
|
+ this.msg.info('不支持此上班模式!');
|
|
131
|
+ } else if (this.workSchemeType == 1) {
|
|
132
|
+ this.mainService.onOrOffLine({
|
|
133
|
+ type: "on",
|
|
134
|
+ }).subscribe((res:any) => {
|
|
135
|
+ if (res.status == 200) {
|
|
136
|
+ this.getCurrentUserNow();
|
|
137
|
+ } else {
|
|
138
|
+ this.loading3 = false;
|
|
139
|
+ this.msg.error('操作失败');
|
|
140
|
+ }
|
|
141
|
+ });
|
|
142
|
+ }
|
|
143
|
+ }
|
|
144
|
+ } else {
|
|
145
|
+ this.loading3 = false;
|
|
146
|
+ this.msg.error('操作失败');
|
|
147
|
+ }
|
|
148
|
+ });
|
|
149
|
+ }
|
|
150
|
+
|
|
151
|
+ // 下班
|
|
152
|
+ customOff() {
|
|
153
|
+ this.mainService.onOrOffLine({
|
|
154
|
+ type: "off",
|
|
155
|
+ customWorking: "off",
|
|
156
|
+ }).subscribe((res:any) => {
|
|
157
|
+ if (res.status == 200) {
|
|
158
|
+ this.getCurrentUserNow();
|
|
159
|
+ } else {
|
|
160
|
+ this.loading3 = false;
|
|
161
|
+ this.msg.error('操作失败');
|
|
162
|
+ }
|
|
163
|
+ });
|
|
164
|
+ }
|
|
165
|
+
|
|
166
|
+ // 获取执行中列表
|
|
167
|
+ getWorkingNum() {
|
|
168
|
+ return this.mainService.coopWorkerOrder("executingOrders", {
|
|
169
|
+ idx: 0,
|
|
170
|
+ sum: 1,
|
|
171
|
+ }).toPromise();
|
|
172
|
+ }
|
|
173
|
+
|
|
174
|
+ // 获取启动中的工作分配方案
|
|
175
|
+ getUserWorkDept() {
|
|
176
|
+ return this.mainService.getUserWorkDept({}).toPromise();
|
|
177
|
+ }
|
|
178
|
+
|
|
179
|
+ // 获取当前用户信息
|
|
180
|
+ getCurrentUserNow() {
|
|
181
|
+ this.mainService.getCurrentUser1().subscribe((data:any) => {
|
|
182
|
+ this.loading3 = false;
|
|
183
|
+ if (data.status == 200) {
|
|
184
|
+ let user = JSON.parse(localStorage.getItem("user"));
|
|
185
|
+ user.user = data.data;
|
|
186
|
+ this.userInfo.user = data.data;
|
|
187
|
+ localStorage.setItem("user", JSON.stringify(user));
|
|
188
|
+ this.hideWorkModal();
|
|
189
|
+ this.msg.success('操作成功!');
|
|
190
|
+ }
|
|
191
|
+ });
|
|
192
|
+ }
|
|
193
|
+
|
|
194
|
+ // 上下班
|
|
195
|
+ types = "";
|
|
196
|
+ async GoWork() {
|
|
197
|
+ let workingNum = 0;
|
|
198
|
+ if (this.userInfo.user.online) {
|
|
199
|
+ this.maskFlag = this.msg.loading("正在加载中..", {
|
|
200
|
+ nzDuration: 0,
|
|
201
|
+ }).messageId;
|
|
202
|
+ let workingNumResult = await this.getWorkingNum();
|
|
203
|
+ this.msg.remove(this.maskFlag);
|
|
204
|
+ this.maskFlag = false;
|
|
205
|
+ if (workingNumResult.status == 200) {
|
|
206
|
+ workingNum = workingNumResult.data.data.length;
|
|
207
|
+ }
|
|
208
|
+ if (workingNum) {
|
|
209
|
+ this.types = "您还<b style='color:red'>有未完成的工单</b>,确定下班后,<b style='color:red'>未完成工单将不计算积分。</b>";
|
|
210
|
+ } else {
|
|
211
|
+ this.types = "确定是否下班 ?";
|
|
212
|
+ }
|
|
213
|
+ } else {
|
|
214
|
+ this.types = "确定是否上班 ?";
|
|
215
|
+ }
|
|
216
|
+ this.showWorkModal();
|
|
217
|
+ }
|
|
218
|
+
|
66
|
219
|
// 根据url高亮菜单baba
|
67
|
220
|
highlightMenuByUrl() {
|
68
|
221
|
console.log(this.router.url);
|
|
@@ -130,6 +283,10 @@ export class MainComponent implements OnInit {
|
130
|
283
|
this.disinfectionSupplyRole = true;
|
131
|
284
|
console.log("全局业务查看权限");
|
132
|
285
|
}
|
|
286
|
+ if (e.link == "PCCommutesToWork") {
|
|
287
|
+ this.PCCommutesToWork = true;
|
|
288
|
+ console.log("PC上下班");
|
|
289
|
+ }
|
133
|
290
|
if (!e.link) {
|
134
|
291
|
arr.push(e);
|
135
|
292
|
}
|