|
@@ -4,6 +4,8 @@ import { OverlayScrollbarsComponent } from 'overlayscrollbars-ngx';
|
4
|
4
|
import { FormGroup, FormBuilder, FormControl } from '@angular/forms';
|
5
|
5
|
import { MainService } from 'src/app/services/main.service';
|
6
|
6
|
import { ToolService } from 'src/app/services/tool.service';
|
|
7
|
+import { Subject } from 'rxjs';
|
|
8
|
+import { debounceTime } from 'rxjs/operators';
|
7
|
9
|
|
8
|
10
|
@Component({
|
9
|
11
|
selector: 'app-build-quick-confirm',
|
|
@@ -21,9 +23,9 @@ export class BuildQuickConfirmComponent implements OnInit {
|
21
|
23
|
@Output() confirmModal = new EventEmitter();
|
22
|
24
|
@Input() buildQuickConfirmData: any = {};//数据
|
23
|
25
|
@Input() loading5: boolean = false;//loading
|
24
|
|
- allHospital: any;//所有院区
|
25
|
26
|
hosLoading: boolean = false;//确定按钮的loading
|
26
|
27
|
configurationCenterMenus: any[] = [];//配置中心菜单
|
|
28
|
+ searchAccountSubject = new Subject(); //查工号防抖
|
27
|
29
|
constructor(
|
28
|
30
|
private mainService: MainService,
|
29
|
31
|
private fb: FormBuilder,
|
|
@@ -31,11 +33,12 @@ export class BuildQuickConfirmComponent implements OnInit {
|
31
|
33
|
) { }
|
32
|
34
|
|
33
|
35
|
ngOnInit() {
|
34
|
|
- this.buildQuickConfirmData.taskTypeList = this.buildQuickConfirmData.taskTypeList || [];
|
35
|
|
- if(this.buildQuickConfirmData.taskTypeList.length > 0){
|
36
|
|
- this.clickTab(this.buildQuickConfirmData.taskTypeList[0]);
|
37
|
|
- }
|
38
|
|
- console.log(this.buildQuickConfirmData)
|
|
36
|
+ this.getPagePermissionConfigById();
|
|
37
|
+ //防抖
|
|
38
|
+ this.getAccountList();
|
|
39
|
+ this.searchAccountSubject.pipe(debounceTime(500)).subscribe((v:any) => {
|
|
40
|
+ this.getAccountList(v);
|
|
41
|
+ });
|
39
|
42
|
}
|
40
|
43
|
|
41
|
44
|
activeTabId:any;
|
|
@@ -182,13 +185,76 @@ export class BuildQuickConfirmComponent implements OnInit {
|
182
|
185
|
});
|
183
|
186
|
}
|
184
|
187
|
|
|
188
|
+ // 工号输入搜索
|
|
189
|
+ searchAccount(e) {
|
|
190
|
+ this.searchAccountSubject.next(e);
|
|
191
|
+ }
|
|
192
|
+
|
|
193
|
+ // 根据工号获取用户
|
|
194
|
+ account = null;
|
|
195
|
+ accountList = [];
|
|
196
|
+ getAccountList(key = ''): void {
|
|
197
|
+ let postData = {
|
|
198
|
+ idx: 0,
|
|
199
|
+ sum: 10,
|
|
200
|
+ user: {
|
|
201
|
+ account: key,
|
|
202
|
+ hospital: {
|
|
203
|
+ id: this.tool.getCurrentHospital().id
|
|
204
|
+ }
|
|
205
|
+ }
|
|
206
|
+ };
|
|
207
|
+ this.isLoading = true;
|
|
208
|
+ this.mainService
|
|
209
|
+ .getFetchDataList("data", "user", postData)
|
|
210
|
+ .subscribe((data) => {
|
|
211
|
+ this.isLoading = false;
|
|
212
|
+ this.accountList = data.list || [];
|
|
213
|
+ });
|
|
214
|
+ }
|
|
215
|
+
|
|
216
|
+ // 修改工号
|
|
217
|
+ userAccount = null;
|
|
218
|
+ changeAccount(e){
|
|
219
|
+ this.userAccount =this.accountList.find(v => v.id == e);
|
|
220
|
+ }
|
|
221
|
+
|
|
222
|
+ // 根据ID获取快捷配置
|
|
223
|
+ pagePermissionConfig: any = {};
|
|
224
|
+ getPagePermissionConfigById() {
|
|
225
|
+ let data = {
|
|
226
|
+ idx: 0,
|
|
227
|
+ sum: 99999,
|
|
228
|
+ pagePermissionConfig: {
|
|
229
|
+ id: this.buildQuickConfirmData.id,
|
|
230
|
+ taskTypeDeptId: this.tool.getCurrentUserDept().id,
|
|
231
|
+ },
|
|
232
|
+ };
|
|
233
|
+ this.mainService
|
|
234
|
+ .getFetchDataList("simple/data", "pagePermissionConfig", data)
|
|
235
|
+ .subscribe((data) => {
|
|
236
|
+ let pagePermissionConfigList = data.list || [];
|
|
237
|
+ if(pagePermissionConfigList.length){
|
|
238
|
+ this.pagePermissionConfig = pagePermissionConfigList[0];
|
|
239
|
+
|
|
240
|
+ // 默认选中第一项
|
|
241
|
+ this.pagePermissionConfig.taskTypeList = this.pagePermissionConfig.taskTypeList || [];
|
|
242
|
+ if(this.pagePermissionConfig.taskTypeList.length > 0){
|
|
243
|
+ this.clickTab(this.pagePermissionConfig.taskTypeList[0]);
|
|
244
|
+ }
|
|
245
|
+ }else{
|
|
246
|
+ this.pagePermissionConfig = {};
|
|
247
|
+ }
|
|
248
|
+ });
|
|
249
|
+ }
|
|
250
|
+
|
185
|
251
|
// 取消
|
186
|
252
|
cancel() {
|
187
|
253
|
this.cancelModal.emit(false)
|
188
|
254
|
}
|
189
|
255
|
// 确认
|
190
|
256
|
confirm() {
|
191
|
|
- let taskType = this.buildQuickConfirmData.taskTypeList.find(item => item.id == this.activeTabId);
|
192
|
|
- this.confirmModal.emit({taskType, shortcutForm: this.shortcutForm, buildMsg: this.buildMsg, workOrderRemark: this.workOrderRemark})
|
|
257
|
+ let taskType = this.pagePermissionConfig.taskTypeList.find(item => item.id == this.activeTabId);
|
|
258
|
+ this.confirmModal.emit({taskType, shortcutForm: this.shortcutForm, buildMsg: this.buildMsg, workOrderRemark: this.workOrderRemark, userAccount: this.userAccount})
|
193
|
259
|
}
|
194
|
260
|
}
|