浏览代码

获取权限的方法提取到工具服务模块中

seimin 3 年之前
父节点
当前提交
d48710e336
共有 29 个文件被更改,包括 3425 次插入3828 次删除
  1. 30 1
      src/app/services/tool.service.ts
  2. 95 125
      src/app/views/advice-management/advice-management.component.ts
  3. 146 160
      src/app/views/appraise-management/appraise-management.component.ts
  4. 91 99
      src/app/views/building-distance/building-distance.component.ts
  5. 2 42
      src/app/views/classes-management/classes-management.component.ts
  6. 420 427
      src/app/views/compre-statistics/compre-statistics.component.ts
  7. 131 115
      src/app/views/data-building/data-building.component.ts
  8. 23 44
      src/app/views/data-dictionary/data-dictionary.component.ts
  9. 184 135
      src/app/views/data-floor/data-floor.component.ts
  10. 128 144
      src/app/views/dept-statistics/dept-statistics.component.ts
  11. 2 40
      src/app/views/group-management/group-management.component.ts
  12. 5 44
      src/app/views/holidays-management/holidays-management.component.ts
  13. 9 29
      src/app/views/hospital-config/hospital-config.component.ts
  14. 79 107
      src/app/views/hospital-management/hospital-management.component.ts
  15. 535 516
      src/app/views/job-assignment/job-assignment.component.ts
  16. 437 452
      src/app/views/jurisdiction-management/jurisdiction-management.component.ts
  17. 3 42
      src/app/views/office-management/office-management.component.ts
  18. 2 38
      src/app/views/order-management/order-management.component.ts
  19. 211 225
      src/app/views/order-statistics/order-statistics.component.ts
  20. 2 28
      src/app/views/round-robin/round-robin.component.ts
  21. 3 34
      src/app/views/shortcut-build-orders/shortcut-build-orders.component.ts
  22. 6 27
      src/app/views/sys-config/sys-config.component.ts
  23. 2 40
      src/app/views/task-type-management/task-type-management.component.ts
  24. 128 144
      src/app/views/task-type-statistics/task-type-statistics.component.ts
  25. 2 25
      src/app/views/timing-message-sending/timing-message-sending.component.ts
  26. 255 254
      src/app/views/users-management/users-management.component.ts
  27. 122 115
      src/app/views/wechat-config/wechat-config.component.ts
  28. 229 224
      src/app/views/work-assignment/work-assignment.component.ts
  29. 143 152
      src/app/views/worker-statistics/worker-statistics.component.ts

+ 30 - 1
src/app/services/tool.service.ts

@@ -24,7 +24,12 @@ export class ToolService {
24
   }
24
   }
25
   //获取当前菜单的权限
25
   //获取当前菜单的权限
26
   initCoopBtns(route) {
26
   initCoopBtns(route) {
27
-    let link = route.parent.snapshot.routeConfig.path; //当前路由
27
+    let link;
28
+    if (route === "dataDictionary") {
29
+      link = route;
30
+    } else {
31
+      link = route.parent.snapshot.routeConfig.path; //当前路由
32
+    }
28
     let secondMenus = []; // 二级菜单
33
     let secondMenus = []; // 二级菜单
29
     let jurisdiction = []; //当前菜单的权限列表
34
     let jurisdiction = []; //当前菜单的权限列表
30
     let coopBtns: any = {}; // 初始化权限
35
     let coopBtns: any = {}; // 初始化权限
@@ -52,6 +57,30 @@ export class ToolService {
52
         case "del":
57
         case "del":
53
           coopBtns.del = true; //删除
58
           coopBtns.del = true; //删除
54
           break;
59
           break;
60
+        case "reply":
61
+          coopBtns.reply = true; //回复
62
+          break;
63
+        case "mediate":
64
+          coopBtns.mediate = true; //调解
65
+          break;
66
+        case "designate":
67
+          coopBtns.designate = true; //指派
68
+          break;
69
+        case "export":
70
+          coopBtns.export = true; //导出
71
+          break;
72
+        case "isStartUp":
73
+          coopBtns.isStartUp = true; //是否启用
74
+          break;
75
+        case "isTimedStartUp":
76
+          coopBtns.isTimedStartUp = true; //是否定时启用
77
+          break;
78
+        case "copy":
79
+          coopBtns.copy = true; //复制
80
+          break;
81
+        case "generateQRcode":
82
+          coopBtns.generateQRcode = true; //生成二维码
83
+          break;
55
       }
84
       }
56
     });
85
     });
57
     console.log(coopBtns);
86
     console.log(coopBtns);

+ 95 - 125
src/app/views/advice-management/advice-management.component.ts

@@ -1,99 +1,68 @@
1
-import { ActivatedRoute, Router } from "@angular/router"
2
-import { Component, OnInit } from '@angular/core';
1
+import { ActivatedRoute, Router } from "@angular/router";
2
+import { Component, OnInit } from "@angular/core";
3
 
3
 
4
 import { MainService } from "../../services/main.service";
4
 import { MainService } from "../../services/main.service";
5
-import { ToolService } from '../../services/tool.service';
6
-import { Subject } from 'rxjs';
7
-import { debounceTime } from 'rxjs/operators';
5
+import { ToolService } from "../../services/tool.service";
6
+import { Subject } from "rxjs";
7
+import { debounceTime } from "rxjs/operators";
8
 
8
 
9
 @Component({
9
 @Component({
10
-  selector: 'app-advice-management',
11
-  templateUrl: './advice-management.component.html',
12
-  styleUrls: ['./advice-management.component.less']
10
+  selector: "app-advice-management",
11
+  templateUrl: "./advice-management.component.html",
12
+  styleUrls: ["./advice-management.component.less"],
13
 })
13
 })
14
 export class AdviceManagementComponent implements OnInit {
14
 export class AdviceManagementComponent implements OnInit {
15
-
16
-  constructor(private route: ActivatedRoute, private router: Router, private mainService: MainService, private tool: ToolService) { }
15
+  constructor(
16
+    private route: ActivatedRoute,
17
+    private router: Router,
18
+    private mainService: MainService,
19
+    private tool: ToolService
20
+  ) {}
17
   changeInpSubject = new Subject();
21
   changeInpSubject = new Subject();
18
   ngOnInit() {
22
   ngOnInit() {
19
-    this.changeInpSubject.pipe(debounceTime(500)).subscribe(v => {
23
+    this.changeInpSubject.pipe(debounceTime(500)).subscribe((v) => {
20
       this.getDeparts(v);
24
       this.getDeparts(v);
21
-    })
22
-    this.initCoopBtns();
23
-    this.getAllHos()
25
+    });
26
+    this.coopBtns = this.tool.initCoopBtns(this.route);
27
+    this.getAllHos();
24
     this.getReplyTypes();
28
     this.getReplyTypes();
25
   }
29
   }
26
 
30
 
27
-  menu: any = JSON.parse(localStorage.getItem('menu')) || [];//菜单
28
-  listOfData: any[] = [];//表格数据
29
-
30
-  modal: boolean = false;//回复模态框
31
-  coopId: number;//表格中执行操作的id
32
-  department: any;//所属科室
33
-  num;//工号
34
-  name;//姓名
35
-  replyType: any;//选择状态
36
-  alldepart: any = [];//所有所属科室
37
-  replyTypes: any;//所有状态
38
-  pageIndex: number = 1;//页码
39
-  listLength: number = 10;//总条数
40
-  pageSize: number = 10;//每页条数
41
-
42
-  promptContent: string;//操作提示框提示信息
43
-  ifSuccess: boolean;//操作成功/失败
44
-  promptInfo: string;//操作结果提示信息
45
-  promptModalShow: boolean;//操作提示框是否展示
31
+  listOfData: any[] = []; //表格数据
46
 
32
 
47
-  btnLoading: boolean = false;//提交按钮loading状态
33
+  modal: boolean = false; //回复模态框
34
+  coopId: number; //表格中执行操作的id
35
+  department: any; //所属科室
36
+  num; //工号
37
+  name; //姓名
38
+  replyType: any; //选择状态
39
+  alldepart: any = []; //所有所属科室
40
+  replyTypes: any; //所有状态
41
+  pageIndex: number = 1; //页码
42
+  listLength: number = 10; //总条数
43
+  pageSize: number = 10; //每页条数
48
 
44
 
45
+  promptContent: string; //操作提示框提示信息
46
+  ifSuccess: boolean; //操作成功/失败
47
+  promptInfo: string; //操作结果提示信息
48
+  promptModalShow: boolean; //操作提示框是否展示
49
 
49
 
50
+  btnLoading: boolean = false; //提交按钮loading状态
50
 
51
 
51
   // 初始化增删改按钮
52
   // 初始化增删改按钮
52
-  coopBtns: any = {
53
-    look: false,
54
-    reply: false
55
-  };
56
-
57
-  initCoopBtns() {
58
-    // 二级菜单
59
-    let secondMenus = []
60
-    this.menu.forEach(e => {
61
-      e.childrens.forEach(el => {
62
-        secondMenus.push(el)
63
-      });
64
-    });
65
-    console.log(secondMenus)
66
-    let link = this.route.parent.snapshot.routeConfig.path;
67
-    let btns = []
68
-    secondMenus.forEach(e => {
69
-      if (e.link == link) {
70
-        btns = e.childrens || [];
71
-      }
72
-    });
73
-    btns.forEach(e => {
74
-      switch (e.link) {
75
-        case 'look':
76
-          this.coopBtns.look = true;
77
-          break;
78
-        case 'reply':
79
-          this.coopBtns.reply = true;
80
-          break;
81
-      }
82
-    })
83
-    console.log(this.coopBtns);
84
-  }
53
+  coopBtns: any = {};
85
 
54
 
86
   // 获取院区
55
   // 获取院区
87
-  hospital: string;//选中院区
56
+  hospital: string; //选中院区
88
   getAllHos() {
57
   getAllHos() {
89
-    this.hospital = this.tool.getCurrentHospital().id + '';
58
+    this.hospital = this.tool.getCurrentHospital().id + "";
90
     this.changeHos();
59
     this.changeHos();
91
     this.getList();
60
     this.getList();
92
   }
61
   }
93
   // 修改院区获取对应科室
62
   // 修改院区获取对应科室
94
   changeHos() {
63
   changeHos() {
95
     this.department = null;
64
     this.department = null;
96
-    this.getDeparts()
65
+    this.getDeparts();
97
   }
66
   }
98
   // 搜索
67
   // 搜索
99
   search() {
68
   search() {
@@ -105,8 +74,7 @@ export class AdviceManagementComponent implements OnInit {
105
     this.pageIndex = 1;
74
     this.pageIndex = 1;
106
     this.replyType = null;
75
     this.replyType = null;
107
     this.department = null;
76
     this.department = null;
108
-    this.getList()
109
-
77
+    this.getList();
110
   }
78
   }
111
   // 表格数据
79
   // 表格数据
112
   loading1 = false;
80
   loading1 = false;
@@ -116,50 +84,52 @@ export class AdviceManagementComponent implements OnInit {
116
       idx: that.pageIndex - 1,
84
       idx: that.pageIndex - 1,
117
       sum: that.pageSize,
85
       sum: that.pageSize,
118
       advice: {
86
       advice: {
119
-        replaceFlag: that.replyType || '',
87
+        replaceFlag: that.replyType || "",
120
         hosId: that.hospital,
88
         hosId: that.hospital,
121
         creatDepartment: {
89
         creatDepartment: {
122
-          id: that.department || '',
123
-        }
90
+          id: that.department || "",
91
+        },
124
       },
92
       },
125
-    }
93
+    };
126
     if (!data.advice.replaceFlag) {
94
     if (!data.advice.replaceFlag) {
127
-      delete data.advice.replaceFlag
95
+      delete data.advice.replaceFlag;
128
     }
96
     }
129
     if (!data.advice.creatDepartment || !data.advice.creatDepartment.id) {
97
     if (!data.advice.creatDepartment || !data.advice.creatDepartment.id) {
130
-      delete data.advice.creatDepartment
98
+      delete data.advice.creatDepartment;
131
     }
99
     }
132
     this.loading1 = true;
100
     this.loading1 = true;
133
-    that.mainService.getFetchDataList('adviceCollection', 'advice', data).subscribe(data => {
134
-      this.loading1 = false;
135
-      that.listOfData = data.list;
136
-      that.listLength = data.totalNum;
137
-    })
138
-
101
+    that.mainService
102
+      .getFetchDataList("adviceCollection", "advice", data)
103
+      .subscribe((data) => {
104
+        this.loading1 = false;
105
+        that.listOfData = data.list;
106
+        that.listLength = data.totalNum;
107
+      });
139
   }
108
   }
140
 
109
 
141
-
142
   // 获取所有科室
110
   // 获取所有科室
143
-  timerNum = 0;//边输入边搜索的定时器
111
+  timerNum = 0; //边输入边搜索的定时器
144
   getDeparts(dept?) {
112
   getDeparts(dept?) {
145
     var that = this;
113
     var that = this;
146
     let data = {
114
     let data = {
147
       department: {
115
       department: {
148
         hospital: { id: that.hospital },
116
         hospital: { id: that.hospital },
149
-        dept: dept || ''
117
+        dept: dept || "",
150
       },
118
       },
151
       idx: 0,
119
       idx: 0,
152
-      sum: 20
153
-    }
120
+      sum: 20,
121
+    };
154
     this.timerNum++;
122
     this.timerNum++;
155
-    that.mainService.getFetchDataList('data', 'department', data).subscribe(data => {
156
-      console.log(data);
157
-      that.alldepart = data.list;
158
-      this.timerNum--;
159
-      if (this.timerNum === 0) {
160
-        that.isLoading = false;
161
-      }
162
-    })
123
+    that.mainService
124
+      .getFetchDataList("data", "department", data)
125
+      .subscribe((data) => {
126
+        console.log(data);
127
+        that.alldepart = data.list;
128
+        this.timerNum--;
129
+        if (this.timerNum === 0) {
130
+          that.isLoading = false;
131
+        }
132
+      });
163
   }
133
   }
164
 
134
 
165
   // 获取所属组
135
   // 获取所属组
@@ -168,17 +138,17 @@ export class AdviceManagementComponent implements OnInit {
168
     that.replyTypes = [
138
     that.replyTypes = [
169
       {
139
       {
170
         value: 0,
140
         value: 0,
171
-        label: '未回复'
172
-      }, {
141
+        label: "未回复",
142
+      },
143
+      {
173
         value: 1,
144
         value: 1,
174
-        label: '已回复'
175
-      }
176
-    ]
145
+        label: "已回复",
146
+      },
147
+    ];
177
   }
148
   }
178
 
149
 
179
-
180
   // 新增弹框
150
   // 新增弹框
181
-  replyCon: any;//意见内容
151
+  replyCon: any; //意见内容
182
   reply(data) {
152
   reply(data) {
183
     this.modal = true;
153
     this.modal = true;
184
     this.replyCon = data;
154
     this.replyCon = data;
@@ -187,9 +157,9 @@ export class AdviceManagementComponent implements OnInit {
187
     this.modal = false;
157
     this.modal = false;
188
   }
158
   }
189
   // 回复
159
   // 回复
190
-  adviceSubContent: string;//回复内容
160
+  adviceSubContent: string; //回复内容
191
   submitForm() {
161
   submitForm() {
192
-    console.log(this.adviceSubContent)
162
+    console.log(this.adviceSubContent);
193
     let that = this;
163
     let that = this;
194
     if (!that.adviceSubContent) return;
164
     if (!that.adviceSubContent) return;
195
     that.btnLoading = true;
165
     that.btnLoading = true;
@@ -197,21 +167,22 @@ export class AdviceManagementComponent implements OnInit {
197
       advice: {
167
       advice: {
198
         id: that.replyCon.id,
168
         id: that.replyCon.id,
199
         replyUser: { id: that.replyCon.createUser.id },
169
         replyUser: { id: that.replyCon.createUser.id },
200
-        replyContent: that.adviceSubContent
201
-      }
202
-    }
203
-    that.mainService.postCustom('adviceCollection', 'updData/advice', postData).subscribe(data => {
204
-      that.btnLoading = false;
205
-      that.adviceSubContent = '';
206
-      if (data.status == 200) {
207
-        that.showPromptModal('回复', true, '');
208
-        that.getList()
209
-        that.hideModal()
210
-      } else {
211
-        that.showPromptModal('回复', false, data.msg);
212
-      }
213
-    })
214
-
170
+        replyContent: that.adviceSubContent,
171
+      },
172
+    };
173
+    that.mainService
174
+      .postCustom("adviceCollection", "updData/advice", postData)
175
+      .subscribe((data) => {
176
+        that.btnLoading = false;
177
+        that.adviceSubContent = "";
178
+        if (data.status == 200) {
179
+          that.showPromptModal("回复", true, "");
180
+          that.getList();
181
+          that.hideModal();
182
+        } else {
183
+          that.showPromptModal("回复", false, data.msg);
184
+        }
185
+      });
215
   }
186
   }
216
 
187
 
217
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
188
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
@@ -228,7 +199,7 @@ export class AdviceManagementComponent implements OnInit {
228
 
199
 
229
   // 查看
200
   // 查看
230
   detail(id) {
201
   detail(id) {
231
-    this.router.navigateByUrl('/main/adviceManagement/adviceDetail/' + id);
202
+    this.router.navigateByUrl("/main/adviceManagement/adviceDetail/" + id);
232
   }
203
   }
233
 
204
 
234
   // 边输边搜节流阀
205
   // 边输边搜节流阀
@@ -240,11 +211,10 @@ export class AdviceManagementComponent implements OnInit {
240
 
211
 
241
   // 截取意见内容(ie内核截取)
212
   // 截取意见内容(ie内核截取)
242
   spliceContent(con) {
213
   spliceContent(con) {
243
-    if (con.length >= 41 && navigator.userAgent.indexOf('Trident') > -1) {
244
-      return con.slice(0, 20) + '...'
214
+    if (con.length >= 41 && navigator.userAgent.indexOf("Trident") > -1) {
215
+      return con.slice(0, 20) + "...";
245
     } else {
216
     } else {
246
       return con;
217
       return con;
247
     }
218
     }
248
   }
219
   }
249
-
250
 }
220
 }

+ 146 - 160
src/app/views/appraise-management/appraise-management.component.ts

@@ -1,98 +1,66 @@
1
-import { Component, OnInit } from '@angular/core';
2
-import { ActivatedRoute, Router } from "@angular/router"
3
-import { FormBuilder, Validators, FormGroup } from '@angular/forms';
1
+import { Component, OnInit } from "@angular/core";
2
+import { ActivatedRoute, Router } from "@angular/router";
3
+import { FormBuilder, Validators, FormGroup } from "@angular/forms";
4
 
4
 
5
 import { MainService } from "../../services/main.service";
5
 import { MainService } from "../../services/main.service";
6
-import { ToolService } from '../../services/tool.service';
7
-import { Subject } from 'rxjs';
8
-import { debounceTime } from 'rxjs/operators';
6
+import { ToolService } from "../../services/tool.service";
7
+import { Subject } from "rxjs";
8
+import { debounceTime } from "rxjs/operators";
9
 
9
 
10
 @Component({
10
 @Component({
11
-  selector: 'app-appraise-management',
12
-  templateUrl: './appraise-management.component.html',
13
-  styleUrls: ['./appraise-management.component.less']
11
+  selector: "app-appraise-management",
12
+  templateUrl: "./appraise-management.component.html",
13
+  styleUrls: ["./appraise-management.component.less"],
14
 })
14
 })
15
 export class AppraiseManagementComponent implements OnInit {
15
 export class AppraiseManagementComponent implements OnInit {
16
+  constructor(
17
+    private fb: FormBuilder,
18
+    private route: ActivatedRoute,
19
+    private router: Router,
20
+    private mainService: MainService,
21
+    private tool: ToolService
22
+  ) {}
16
 
23
 
17
-  constructor(private fb: FormBuilder, private route: ActivatedRoute, private router: Router, private mainService: MainService, private tool: ToolService) { }
24
+  listOfData: any[] = []; //表格数据
18
 
25
 
19
-  menu: any = JSON.parse(localStorage.getItem('menu')) || [];//菜单
20
-  listOfData: any[] = [];//表格数据
26
+  modal: boolean = false; //新增/编辑模态框
27
+  validateForm: FormGroup; //新增/编辑表单
28
+  coopId: number; //表格中执行操作的id
29
+  department: any; //所属科室
30
+  mediUser: number; //调解人
31
+  taskType: number; //工单类型
32
+  allTaskType: any; //所有工单类型
33
+  allHospital: any; //所有院区
34
+  pageIndex: number = 1; //页码
35
+  listLength: number = 10; //总条数
36
+  pageSize: number = 10; //每页条数
21
 
37
 
22
-  modal: boolean = false;//新增/编辑模态框
23
-  validateForm: FormGroup;//新增/编辑表单
24
-  coopId: number;//表格中执行操作的id
25
-  department: any;//所属科室
26
-  mediUser: number;//调解人
27
-  taskType: number;//工单类型
28
-  allTaskType: any;//所有工单类型
29
-  allHospital: any;//所有院区
30
-  pageIndex: number = 1;//页码
31
-  listLength: number = 10;//总条数
32
-  pageSize: number = 10;//每页条数
38
+  promptContent: string; //操作提示框提示信息
39
+  ifSuccess: boolean; //操作成功/失败
40
+  promptInfo: string; //操作结果提示信息
41
+  promptModalShow: boolean; //操作提示框是否展示
33
 
42
 
34
-  promptContent: string;//操作提示框提示信息
35
-  ifSuccess: boolean;//操作成功/失败
36
-  promptInfo: string;//操作结果提示信息
37
-  promptModalShow: boolean;//操作提示框是否展示
38
-
39
-  btnLoading: boolean = false;//提交按钮loading状态
43
+  btnLoading: boolean = false; //提交按钮loading状态
40
   searchTimerSubject = new Subject();
44
   searchTimerSubject = new Subject();
41
 
45
 
42
   ngOnInit() {
46
   ngOnInit() {
43
-    this.searchTimerSubject.pipe(debounceTime(500)).subscribe(v => {
47
+    this.searchTimerSubject.pipe(debounceTime(500)).subscribe((v) => {
44
       let fun = v[0];
48
       let fun = v[0];
45
       fun(v[1], v[2]);
49
       fun(v[1], v[2]);
46
-    })
47
-    this.initCoopBtns();
48
-    this.getAllHos()
49
-    this.getStatus()
50
-    this.initForm()
50
+    });
51
+    this.coopBtns = this.tool.initCoopBtns(this.route);
52
+    this.getAllHos();
53
+    this.getStatus();
54
+    this.initForm();
51
   }
55
   }
52
 
56
 
53
   // 初始化增删改按钮
57
   // 初始化增删改按钮
54
-  coopBtns: any = {
55
-    look: false,
56
-    mediate: false,//调解
57
-    designate: false,//指派
58
-  };
59
-
60
-  initCoopBtns() {
61
-    // 二级菜单
62
-    let secondMenus = []
63
-    this.menu.forEach(e => {
64
-      e.childrens.forEach(el => {
65
-        secondMenus.push(el)
66
-      });
67
-    });
68
-    console.log(secondMenus)
69
-    let link = this.route.parent.snapshot.routeConfig.path;
70
-    let btns = []
71
-    secondMenus.forEach(e => {
72
-      if (e.link == link) {
73
-        btns = e.childrens || [];
74
-      }
75
-    });
76
-    btns.forEach(e => {
77
-      switch (e.link) {
78
-        case 'look':
79
-          this.coopBtns.look = true;
80
-          break;
81
-        case 'mediate':
82
-          this.coopBtns.mediate = true;
83
-          break;
84
-        case 'designate':
85
-          this.coopBtns.designate = true;
86
-          break;
87
-      }
88
-    })
89
-    console.log(this.coopBtns);
90
-  }
58
+  coopBtns: any = {};
91
 
59
 
92
   // 获取院区
60
   // 获取院区
93
-  hospital: string;//选中院区
61
+  hospital: string; //选中院区
94
   getAllHos() {
62
   getAllHos() {
95
-    this.hospital = this.tool.getCurrentHospital().id + '';
63
+    this.hospital = this.tool.getCurrentHospital().id + "";
96
     this.changeHos();
64
     this.changeHos();
97
     this.getList();
65
     this.getList();
98
   }
66
   }
@@ -102,68 +70,74 @@ export class AppraiseManagementComponent implements OnInit {
102
     this.worker = null;
70
     this.worker = null;
103
     this.mediUser = null;
71
     this.mediUser = null;
104
     this.status = null;
72
     this.status = null;
105
-    this.getAllTaskType()
106
-    this.getAllWorker()
107
-    this.getAllMediUser()
73
+    this.getAllTaskType();
74
+    this.getAllWorker();
75
+    this.getAllMediUser();
108
   }
76
   }
109
 
77
 
110
   // 获取支助人员
78
   // 获取支助人员
111
-  worker: number;//支助人员
112
-  allWorker: any = [];//所有支助人员
79
+  worker: number; //支助人员
80
+  allWorker: any = []; //所有支助人员
113
   snum1 = 0;
81
   snum1 = 0;
114
   getAllWorker(e?, those?) {
82
   getAllWorker(e?, those?) {
115
     let that = those || this;
83
     let that = those || this;
116
     let postData = {
84
     let postData = {
117
       user: {
85
       user: {
118
-        name: e || '',
86
+        name: e || "",
119
         hospital: { id: that.hospital },
87
         hospital: { id: that.hospital },
120
-        usertype: { id: 106 }//支助人员
88
+        usertype: { id: 106 }, //支助人员
121
       },
89
       },
122
       idx: 0,
90
       idx: 0,
123
-      sum: 20
124
-    }
91
+      sum: 20,
92
+    };
125
     that.snum1++;
93
     that.snum1++;
126
-    that.mainService.getFetchDataList('data', 'user', postData).subscribe(data => {
127
-      that.allWorker = data.list;
128
-      that.snum1--;
129
-      if (that.snum1 === 0) {
130
-        that.isLoading = false;
131
-      }
132
-    })
94
+    that.mainService
95
+      .getFetchDataList("data", "user", postData)
96
+      .subscribe((data) => {
97
+        that.allWorker = data.list;
98
+        that.snum1--;
99
+        if (that.snum1 === 0) {
100
+          that.isLoading = false;
101
+        }
102
+      });
133
   }
103
   }
134
 
104
 
135
   // 指派人员
105
   // 指派人员
136
-  allDesUser: any = [];//所有支助人员
106
+  allDesUser: any = []; //所有支助人员
137
   getAllDesUser(id) {
107
   getAllDesUser(id) {
138
     this.isLoading = true;
108
     this.isLoading = true;
139
-    this.mainService.getHosUser('getUsersByPermission', id).subscribe(data => {
140
-      this.isLoading = false;
141
-      this.allDesUser = data.data || []
142
-    })
109
+    this.mainService
110
+      .getHosUser("getUsersByPermission", id)
111
+      .subscribe((data) => {
112
+        this.isLoading = false;
113
+        this.allDesUser = data.data || [];
114
+      });
143
   }
115
   }
144
 
116
 
145
   // 获取所有调解人
117
   // 获取所有调解人
146
-  allMediUser: any = [];//所有调解人
118
+  allMediUser: any = []; //所有调解人
147
   snum2 = 0;
119
   snum2 = 0;
148
   getAllMediUser(e?, those?) {
120
   getAllMediUser(e?, those?) {
149
     let that = those || this;
121
     let that = those || this;
150
     let postData = {
122
     let postData = {
151
       user: {
123
       user: {
152
-        name: e || '',
124
+        name: e || "",
153
         hospital: { id: that.hospital },
125
         hospital: { id: that.hospital },
154
-        usertype: { id: 107 }//服务台
126
+        usertype: { id: 107 }, //服务台
155
       },
127
       },
156
       idx: 0,
128
       idx: 0,
157
-      sum: 20
158
-    }
129
+      sum: 20,
130
+    };
159
     that.snum2++;
131
     that.snum2++;
160
-    that.mainService.getFetchDataList('data', 'user', postData).subscribe(data => {
161
-      that.allMediUser = data.list;
162
-      that.snum2--;
163
-      if (that.snum2 === 0) {
164
-        that.isLoading = false;
165
-      }
166
-    })
132
+    that.mainService
133
+      .getFetchDataList("data", "user", postData)
134
+      .subscribe((data) => {
135
+        that.allMediUser = data.list;
136
+        that.snum2--;
137
+        if (that.snum2 === 0) {
138
+          that.isLoading = false;
139
+        }
140
+      });
167
   }
141
   }
168
 
142
 
169
   // 用户输入搜索
143
   // 用户输入搜索
@@ -184,13 +158,15 @@ export class AppraiseManagementComponent implements OnInit {
184
   }
158
   }
185
 
159
 
186
   // 获取处理状态
160
   // 获取处理状态
187
-  status: number;//处理状态
188
-  handleStatus: any = [];//所有处理状态
161
+  status: number; //处理状态
162
+  handleStatus: any = []; //所有处理状态
189
   getStatus() {
163
   getStatus() {
190
     var that = this;
164
     var that = this;
191
-    that.mainService.getDictionary('list', 'bad_evaluation_handle_status').subscribe(data => {
192
-      that.handleStatus = data
193
-    })
165
+    that.mainService
166
+      .getDictionary("list", "bad_evaluation_handle_status")
167
+      .subscribe((data) => {
168
+        that.handleStatus = data;
169
+      });
194
   }
170
   }
195
 
171
 
196
   // 搜索
172
   // 搜索
@@ -205,8 +181,7 @@ export class AppraiseManagementComponent implements OnInit {
205
     this.worker = null;
181
     this.worker = null;
206
     this.mediUser = null;
182
     this.mediUser = null;
207
     this.status = null;
183
     this.status = null;
208
-    this.getList()
209
-
184
+    this.getList();
210
   }
185
   }
211
   // 表格数据
186
   // 表格数据
212
   loading1 = false;
187
   loading1 = false;
@@ -216,35 +191,35 @@ export class AppraiseManagementComponent implements OnInit {
216
       idx: that.pageIndex - 1,
191
       idx: that.pageIndex - 1,
217
       sum: that.pageSize,
192
       sum: that.pageSize,
218
       badEvaluationHandle: {
193
       badEvaluationHandle: {
219
-        taskType: that.taskType || '',
220
-        worker: { id: that.worker || '' },
221
-        handleStatus: { id: that.status || '' },
194
+        taskType: that.taskType || "",
195
+        worker: { id: that.worker || "" },
196
+        handleStatus: { id: that.status || "" },
222
         hosId: that.hospital,
197
         hosId: that.hospital,
223
-        mediationUser: { id: that.mediUser }
198
+        mediationUser: { id: that.mediUser },
224
       },
199
       },
225
-    }
200
+    };
226
     if (!data.badEvaluationHandle.taskType) {
201
     if (!data.badEvaluationHandle.taskType) {
227
-      delete data.badEvaluationHandle.taskType
202
+      delete data.badEvaluationHandle.taskType;
228
     }
203
     }
229
     if (!data.badEvaluationHandle.worker.id) {
204
     if (!data.badEvaluationHandle.worker.id) {
230
-      delete data.badEvaluationHandle.worker
205
+      delete data.badEvaluationHandle.worker;
231
     }
206
     }
232
     if (!data.badEvaluationHandle.handleStatus.id) {
207
     if (!data.badEvaluationHandle.handleStatus.id) {
233
-      delete data.badEvaluationHandle.handleStatus
208
+      delete data.badEvaluationHandle.handleStatus;
234
     }
209
     }
235
     if (!data.badEvaluationHandle.mediationUser.id) {
210
     if (!data.badEvaluationHandle.mediationUser.id) {
236
-      delete data.badEvaluationHandle.mediationUser
211
+      delete data.badEvaluationHandle.mediationUser;
237
     }
212
     }
238
     this.loading1 = true;
213
     this.loading1 = true;
239
-    that.mainService.getFetchDataList('adviceCollection', 'badEvaluationHandle', data).subscribe(data => {
240
-      this.loading1 = false;
241
-      that.listOfData = data.list;
242
-      that.listLength = data.totalNum;
243
-    })
244
-
214
+    that.mainService
215
+      .getFetchDataList("adviceCollection", "badEvaluationHandle", data)
216
+      .subscribe((data) => {
217
+        this.loading1 = false;
218
+        that.listOfData = data.list;
219
+        that.listLength = data.totalNum;
220
+      });
245
   }
221
   }
246
 
222
 
247
-
248
   // 获取工单类型
223
   // 获取工单类型
249
   getAllTaskType() {
224
   getAllTaskType() {
250
     let that = this;
225
     let that = this;
@@ -253,11 +228,13 @@ export class AppraiseManagementComponent implements OnInit {
253
         hosId: { id: that.hospital },
228
         hosId: { id: that.hospital },
254
       },
229
       },
255
       idx: 0,
230
       idx: 0,
256
-      sum: 30
257
-    }
258
-    that.mainService.getFetchDataList('configuration', 'taskType', postData).subscribe(data => {
259
-      that.allTaskType = data.list;
260
-    })
231
+      sum: 30,
232
+    };
233
+    that.mainService
234
+      .getFetchDataList("configuration", "taskType", postData)
235
+      .subscribe((data) => {
236
+        that.allTaskType = data.list;
237
+      });
261
   }
238
   }
262
 
239
 
263
   // 初始化新增form表单
240
   // 初始化新增form表单
@@ -278,32 +255,33 @@ export class AppraiseManagementComponent implements OnInit {
278
       badEvaluationHandle: {
255
       badEvaluationHandle: {
279
         id: that.coopId,
256
         id: that.coopId,
280
         mediationUser: { id: that.validateForm.value.user },
257
         mediationUser: { id: that.validateForm.value.user },
281
-      }
282
-    }
283
-    that.mainService.postCustom('adviceCollection', 'updData/badEvaluationHandle', postData).subscribe(data => {
284
-      that.hideModal()
285
-      that.btnLoading = false;
286
-      if (data.status == 200) {
287
-        that.showPromptModal('指派', true, '');
288
-        that.initForm()
289
-        that.getList()
290
-      } else {
291
-        that.showPromptModal('指派', false, data.msg);
292
-      }
293
-    })
258
+      },
259
+    };
260
+    that.mainService
261
+      .postCustom("adviceCollection", "updData/badEvaluationHandle", postData)
262
+      .subscribe((data) => {
263
+        that.hideModal();
264
+        that.btnLoading = false;
265
+        if (data.status == 200) {
266
+          that.showPromptModal("指派", true, "");
267
+          that.initForm();
268
+          that.getList();
269
+        } else {
270
+          that.showPromptModal("指派", false, data.msg);
271
+        }
272
+      });
294
   }
273
   }
295
 
274
 
296
   // 指派
275
   // 指派
297
   designate(id, hosId) {
276
   designate(id, hosId) {
298
     this.modal = true;
277
     this.modal = true;
299
     this.coopId = id;
278
     this.coopId = id;
300
-    this.getAllDesUser(hosId)
279
+    this.getAllDesUser(hosId);
301
   }
280
   }
302
   hideModal() {
281
   hideModal() {
303
     this.modal = false;
282
     this.modal = false;
304
   }
283
   }
305
 
284
 
306
-
307
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
285
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
308
   showPromptModal(con, success, promptInfo?) {
286
   showPromptModal(con, success, promptInfo?) {
309
     this.promptModalShow = false;
287
     this.promptModalShow = false;
@@ -319,22 +297,30 @@ export class AppraiseManagementComponent implements OnInit {
319
   // 查看
297
   // 查看
320
   detail(id, tj?) {
298
   detail(id, tj?) {
321
     if (tj) {
299
     if (tj) {
322
-      this.router.navigate(['/main/appraiseManagement/appraiseDetail/' + id], { fragment: 'tj' });
300
+      this.router.navigate(["/main/appraiseManagement/appraiseDetail/" + id], {
301
+        fragment: "tj",
302
+      });
323
     } else {
303
     } else {
324
-      this.router.navigate(['/main/appraiseManagement/appraiseDetail/' + id]);
304
+      this.router.navigate(["/main/appraiseManagement/appraiseDetail/" + id]);
325
     }
305
     }
326
   }
306
   }
327
 
307
 
328
   // 格式化时间戳
308
   // 格式化时间戳
329
   timestampToTime(timestamp) {
309
   timestampToTime(timestamp) {
330
-    var date = new Date(timestamp);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
331
-    let Y = date.getFullYear() + '-';
332
-    let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
333
-    let D = date.getDate() < 10 ? '0' + date.getDate() + ' ' : date.getDate() + ' ';
334
-    let h = date.getHours() < 10 ? '0' + date.getHours() + ':' : date.getHours() + ':';
335
-    let m = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
310
+    var date = new Date(timestamp); //时间戳为10位需*1000,时间戳为13位的话不需乘1000
311
+    let Y = date.getFullYear() + "-";
312
+    let M =
313
+      (date.getMonth() + 1 < 10
314
+        ? "0" + (date.getMonth() + 1)
315
+        : date.getMonth() + 1) + "-";
316
+    let D =
317
+      date.getDate() < 10 ? "0" + date.getDate() + " " : date.getDate() + " ";
318
+    let h =
319
+      date.getHours() < 10
320
+        ? "0" + date.getHours() + ":"
321
+        : date.getHours() + ":";
322
+    let m =
323
+      date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
336
     return Y + M + D + h + m;
324
     return Y + M + D + h + m;
337
   }
325
   }
338
-
339
 }
326
 }
340
-

+ 91 - 99
src/app/views/building-distance/building-distance.component.ts

@@ -1,80 +1,63 @@
1
-import { Component, OnInit } from '@angular/core';
2
-import { ActivatedRoute } from '@angular/router';
3
-import { NzMessageService } from 'ng-zorro-antd';
4
-import { MainService } from 'src/app/services/main.service';
5
-import { ToolService } from 'src/app/services/tool.service';
1
+import { Component, OnInit } from "@angular/core";
2
+import { ActivatedRoute } from "@angular/router";
3
+import { NzMessageService } from "ng-zorro-antd";
4
+import { MainService } from "src/app/services/main.service";
5
+import { ToolService } from "src/app/services/tool.service";
6
 
6
 
7
 @Component({
7
 @Component({
8
-  selector: 'app-building-distance',
9
-  templateUrl: './building-distance.component.html',
10
-  styleUrls: ['./building-distance.component.less'],
8
+  selector: "app-building-distance",
9
+  templateUrl: "./building-distance.component.html",
10
+  styleUrls: ["./building-distance.component.less"],
11
 })
11
 })
12
 export class BuildingDistanceComponent implements OnInit {
12
 export class BuildingDistanceComponent implements OnInit {
13
-  menu: any = JSON.parse(localStorage.getItem('menu')) || [];//菜单
14
-  coopBtns: any = {//权限
15
-    add: false,
16
-    edit: false,
17
-    del: false,
18
-  };
19
-  id: number = 0;//id
20
-  hosId;//当前院区id
21
-  buildingList: [];//当前院区所有的楼栋
22
-  buildings = [];//所有楼栋距离组合
23
-  loading1: boolean = false;//获取所有楼栋的loading
24
-  loading2: boolean = false;//获取所有楼栋配置的loading
25
-  loading3: boolean = false;//保存所有楼栋配置的loading
26
-  loading4: boolean = false;//删除楼栋配置的loading
27
-  delModal: boolean = false;//删除的模态框
28
-  delObj;//要删除的元素
29
-  constructor(private route: ActivatedRoute, private mainService: MainService, private tool: ToolService, private message: NzMessageService) { }
13
+  coopBtns: any = {};
14
+  id: number = 0; //id
15
+  hosId; //当前院区id
16
+  buildingList: []; //当前院区所有的楼栋
17
+  buildings = []; //所有楼栋距离组合
18
+  loading1: boolean = false; //获取所有楼栋的loading
19
+  loading2: boolean = false; //获取所有楼栋配置的loading
20
+  loading3: boolean = false; //保存所有楼栋配置的loading
21
+  loading4: boolean = false; //删除楼栋配置的loading
22
+  delModal: boolean = false; //删除的模态框
23
+  delObj; //要删除的元素
24
+  constructor(
25
+    private route: ActivatedRoute,
26
+    private mainService: MainService,
27
+    private tool: ToolService,
28
+    private message: NzMessageService
29
+  ) {}
30
   formatterPercent = (value: number) => `${value} %`;
30
   formatterPercent = (value: number) => `${value} %`;
31
-  parserPercent = (value: string) => value.replace(' %', '')
31
+  parserPercent = (value: string) => value.replace(" %", "");
32
   ngOnInit() {
32
   ngOnInit() {
33
     this.hosId = this.tool.getCurrentHospital().id;
33
     this.hosId = this.tool.getCurrentHospital().id;
34
-    this.initCoopBtns();
34
+    this.coopBtns = this.tool.initCoopBtns(this.route);
35
     this.getBuildingList(this.hosId);
35
     this.getBuildingList(this.hosId);
36
     this.getBuildingConfig(this.hosId);
36
     this.getBuildingConfig(this.hosId);
37
   }
37
   }
38
-  // 初始化增删改按钮
39
-  initCoopBtns() {
40
-    // 二级菜单
41
-    let secondMenus = []
42
-    this.menu.forEach(e => {
43
-      e.childrens.forEach(el => {
44
-        secondMenus.push(el)
45
-      });
46
-    });
47
-    let link = this.route.parent.snapshot.routeConfig.path;
48
-    let btns = []
49
-    secondMenus.forEach(e => {
50
-      if (e.link == link) {
51
-        btns = e.childrens || [];
52
-      }
53
-    });
54
-    btns.forEach(e => {
55
-      this.coopBtns[e.link] = true;
56
-    })
57
-  }
38
+
58
   //获取楼栋距离配置
39
   //获取楼栋距离配置
59
   getBuildingConfig(hosId) {
40
   getBuildingConfig(hosId) {
60
-    let postData = { "idx": 0, "sum": 9999, "workOrderGradeBuilding": { hosId } };
41
+    let postData = { idx: 0, sum: 9999, workOrderGradeBuilding: { hosId } };
61
     this.loading2 = true;
42
     this.loading2 = true;
62
-    this.mainService.getFetchDataList('simple/data', 'workOrderGradeBuilding', postData).subscribe(result => {
63
-      this.loading2 = false;
64
-      if (result.status == 200) {
65
-        this.buildings = result.list.map(item => {
66
-          return {
67
-            id: item.id,
68
-            buildingStart: item.source.id,
69
-            buildingEnd: item.dest.id,
70
-            percentage: item.percent,
71
-            border: 'none'
72
-          }
73
-        })
74
-      } else {
75
-        this.message.error('请求数据失败')
76
-      }
77
-    })
43
+    this.mainService
44
+      .getFetchDataList("simple/data", "workOrderGradeBuilding", postData)
45
+      .subscribe((result) => {
46
+        this.loading2 = false;
47
+        if (result.status == 200) {
48
+          this.buildings = result.list.map((item) => {
49
+            return {
50
+              id: item.id,
51
+              buildingStart: item.source.id,
52
+              buildingEnd: item.dest.id,
53
+              percentage: item.percent,
54
+              border: "none",
55
+            };
56
+          });
57
+        } else {
58
+          this.message.error("请求数据失败");
59
+        }
60
+      });
78
   }
61
   }
79
   //新增
62
   //新增
80
   addBuilding() {
63
   addBuilding() {
@@ -83,8 +66,8 @@ export class BuildingDistanceComponent implements OnInit {
83
       buildingStart: null,
66
       buildingStart: null,
84
       buildingEnd: null,
67
       buildingEnd: null,
85
       percentage: 0,
68
       percentage: 0,
86
-      border: 'none'
87
-    })
69
+      border: "none",
70
+    });
88
   }
71
   }
89
   // 删除
72
   // 删除
90
   delete(obj) {
73
   delete(obj) {
@@ -98,48 +81,52 @@ export class BuildingDistanceComponent implements OnInit {
98
   // 确定删除
81
   // 确定删除
99
   confirmDel() {
82
   confirmDel() {
100
     this.loading4 = true;
83
     this.loading4 = true;
101
-    this.mainService.delBuildings([this.delObj.id]).subscribe(result => {
84
+    this.mainService.delBuildings([this.delObj.id]).subscribe((result) => {
102
       this.loading4 = false;
85
       this.loading4 = false;
103
-      if (result['status'] == 200) {
104
-        this.message.success('删除成功');
105
-        this.buildings = this.buildings.filter(item => item.id !== this.delObj.id);
86
+      if (result["status"] == 200) {
87
+        this.message.success("删除成功");
88
+        this.buildings = this.buildings.filter(
89
+          (item) => item.id !== this.delObj.id
90
+        );
106
       } else {
91
       } else {
107
-        this.message.error('删除失败');
92
+        this.message.error("删除失败");
108
       }
93
       }
109
       this.hideDelModal();
94
       this.hideDelModal();
110
-    })
95
+    });
111
   }
96
   }
112
   //保存
97
   //保存
113
   save() {
98
   save() {
114
-    this.buildings = this.buildings.filter(item => (item.buildingStart && item.buildingEnd));
115
-    let postData = this.buildings.map(item => {
99
+    this.buildings = this.buildings.filter(
100
+      (item) => item.buildingStart && item.buildingEnd
101
+    );
102
+    let postData = this.buildings.map((item) => {
116
       return {
103
       return {
117
         id: item.id,
104
         id: item.id,
118
         source: { id: item.buildingStart },
105
         source: { id: item.buildingStart },
119
         dest: { id: item.buildingEnd },
106
         dest: { id: item.buildingEnd },
120
         percent: item.percentage,
107
         percent: item.percentage,
121
-        hosId: this.hosId
122
-      }
123
-    })
124
-    postData.forEach(item => {
108
+        hosId: this.hosId,
109
+      };
110
+    });
111
+    postData.forEach((item) => {
125
       if (item.id < 0) {
112
       if (item.id < 0) {
126
         delete item.id;
113
         delete item.id;
127
       }
114
       }
128
-    })
115
+    });
129
     this.loading3 = true;
116
     this.loading3 = true;
130
-    this.mainService.saveBuildings(postData).subscribe(result => {
117
+    this.mainService.saveBuildings(postData).subscribe((result) => {
131
       this.loading3 = false;
118
       this.loading3 = false;
132
-      if (result['status'] == 200) {
133
-        this.message.success('保存成功');
119
+      if (result["status"] == 200) {
120
+        this.message.success("保存成功");
134
         this.getBuildingConfig(this.hosId);
121
         this.getBuildingConfig(this.hosId);
135
       } else {
122
       } else {
136
-        this.message.error('保存失败');
137
-        result['data'].forEach(item => {
138
-          let i = this.buildings.findIndex(v => v.id === item.id);
139
-          this.buildings[i].border = 'red';
140
-        })
123
+        this.message.error("保存失败");
124
+        result["data"].forEach((item) => {
125
+          let i = this.buildings.findIndex((v) => v.id === item.id);
126
+          this.buildings[i].border = "red";
127
+        });
141
       }
128
       }
142
-    })
129
+    });
143
   }
130
   }
144
   //trackBy
131
   //trackBy
145
   trackById(index, item) {
132
   trackById(index, item) {
@@ -149,16 +136,21 @@ export class BuildingDistanceComponent implements OnInit {
149
   getBuildingList(hosId) {
136
   getBuildingList(hosId) {
150
     let postData = { idx: 0, sum: 9999, building: { hosId } };
137
     let postData = { idx: 0, sum: 9999, building: { hosId } };
151
     this.loading1 = true;
138
     this.loading1 = true;
152
-    this.mainService.getFetchDataList('simple/data', 'building', postData).subscribe(result => {
153
-      this.loading1 = false;
154
-      if (result.status == 200) {
155
-        this.buildingList = result.list;
156
-      } else {
157
-        this.message.error('获取楼栋失败!');
158
-      }
159
-    }, err => {
160
-      this.loading1 = false;
161
-      this.message.error('获取楼栋失败!');
162
-    })
139
+    this.mainService
140
+      .getFetchDataList("simple/data", "building", postData)
141
+      .subscribe(
142
+        (result) => {
143
+          this.loading1 = false;
144
+          if (result.status == 200) {
145
+            this.buildingList = result.list;
146
+          } else {
147
+            this.message.error("获取楼栋失败!");
148
+          }
149
+        },
150
+        (err) => {
151
+          this.loading1 = false;
152
+          this.message.error("获取楼栋失败!");
153
+        }
154
+      );
163
   }
155
   }
164
 }
156
 }

+ 2 - 42
src/app/views/classes-management/classes-management.component.ts

@@ -23,7 +23,6 @@ export class ClassesManagementComponent implements OnInit {
23
   ) { }
23
   ) { }
24
 
24
 
25
   userInfo: any = JSON.parse(localStorage.getItem('user')) || {};//登录用户信息
25
   userInfo: any = JSON.parse(localStorage.getItem('user')) || {};//登录用户信息
26
-  menu: any = JSON.parse(localStorage.getItem('menu')) || [];//菜单
27
 
26
 
28
   hospital: any = null;//院区搜索框
27
   hospital: any = null;//院区搜索框
29
   listOfData: any[] = [];//表格数据
28
   listOfData: any[] = [];//表格数据
@@ -44,52 +43,13 @@ export class ClassesManagementComponent implements OnInit {
44
   demoValue: number = 0;
43
   demoValue: number = 0;
45
 
44
 
46
   ngOnInit() {
45
   ngOnInit() {
47
-    this.initCoopBtns();
46
+    this.coopBtns = this.tool.initCoopBtns(this.route);
48
     this.getAllHospital()
47
     this.getAllHospital()
49
     this.initForm();
48
     this.initForm();
50
   }
49
   }
51
 
50
 
52
   // 初始化增删改按钮
51
   // 初始化增删改按钮
53
-  coopBtns: any = {
54
-    look: false,
55
-    add: false,
56
-    edit: false,
57
-    del: false
58
-  };
59
-  initCoopBtns() {
60
-    // 二级菜单
61
-    let secondMenus = []
62
-    this.menu.forEach(e => {
63
-      e.childrens.forEach(el => {
64
-        secondMenus.push(el)
65
-      });
66
-    });
67
-    console.log(secondMenus)
68
-    let link = this.route.parent.snapshot.routeConfig.path;
69
-    let btns = []
70
-    secondMenus.forEach(e => {
71
-      if (e.link == link) {
72
-        btns = e.childrens || [];
73
-      }
74
-    });
75
-    btns.forEach(e => {
76
-      switch (e.link) {
77
-        case 'look':
78
-          this.coopBtns.look = true;
79
-          break;
80
-        case 'add':
81
-          this.coopBtns.add = true;
82
-          break;
83
-        case 'edit':
84
-          this.coopBtns.edit = true;
85
-          break;
86
-        case 'del':
87
-          this.coopBtns.del = true;
88
-          break;
89
-      }
90
-    })
91
-    console.log(this.coopBtns);
92
-  }
52
+  coopBtns: any = {};
93
   // 修改适用日期类型
53
   // 修改适用日期类型
94
   logDateType(value: object[]): void {
54
   logDateType(value: object[]): void {
95
     console.log(value);
55
     console.log(value);

文件差异内容过多而无法显示
+ 420 - 427
src/app/views/compre-statistics/compre-statistics.component.ts


+ 131 - 115
src/app/views/data-building/data-building.component.ts

@@ -1,77 +1,59 @@
1
-import { Component, OnInit, ViewChild } from '@angular/core';
2
-import { ActivatedRoute, ParamMap } from '@angular/router';
3
-import { OverlayScrollbarsComponent } from 'overlayscrollbars-ngx';
4
-import { MainService } from '../../services/main.service';
5
-import { ToolService } from '../../services/tool.service';
1
+import { Component, OnInit, ViewChild } from "@angular/core";
2
+import { ActivatedRoute, ParamMap } from "@angular/router";
3
+import { OverlayScrollbarsComponent } from "overlayscrollbars-ngx";
4
+import { MainService } from "../../services/main.service";
5
+import { ToolService } from "../../services/tool.service";
6
 
6
 
7
 @Component({
7
 @Component({
8
-  selector: 'app-data-building',
9
-  templateUrl: './data-building.component.html',
10
-  styleUrls: ['./data-building.component.less']
8
+  selector: "app-data-building",
9
+  templateUrl: "./data-building.component.html",
10
+  styleUrls: ["./data-building.component.less"],
11
 })
11
 })
12
 export class DataBuildingComponent implements OnInit {
12
 export class DataBuildingComponent implements OnInit {
13
-  @ViewChild('osComponentRef1', { read: OverlayScrollbarsComponent, static: false })
13
+  @ViewChild("osComponentRef1", {
14
+    read: OverlayScrollbarsComponent,
15
+    static: false,
16
+  })
14
   osComponentRef1: OverlayScrollbarsComponent;
17
   osComponentRef1: OverlayScrollbarsComponent;
15
-  hosId: any;//院区id
16
-  loading1 = false;//获取楼栋信息列表加载状态
17
-  loading3 = false;//保存
18
-  id: number = 0;//自定义id,负整数
19
-  buildingList: Array<any> = [];//楼栋信息列表
20
-  promptContent: string;//操作提示框提示信息
21
-  ifSuccess: boolean;//操作成功/失败
22
-  promptInfo: string;//操作结果提示信息
23
-  promptModalShow: boolean;//操作提示框是否展示
24
-  delModal: boolean = false;//删除模态框
25
-  tipsMsg1: string;//提示框信息
26
-  tips: string;//提示框信息(附注)
27
-  coop: any;//当前操作列
28
-  loading2 = false;//删除接口
29
-  mainWidth: any = '100%';
30
-  coopBtns = { //初始化权限
31
-    edit: false,
32
-    add: false,
33
-    del: false,
34
-  };
35
-  menu = JSON.parse(localStorage.getItem('menu')) || [];//菜单
36
-  constructor(private mainService: MainService, private route: ActivatedRoute, private tool: ToolService) { }
18
+  hosId: any; //院区id
19
+  loading1 = false; //获取楼栋信息列表加载状态
20
+  loading3 = false; //保存
21
+  id: number = 0; //自定义id,负整数
22
+  buildingList: Array<any> = []; //楼栋信息列表
23
+  promptContent: string; //操作提示框提示信息
24
+  ifSuccess: boolean; //操作成功/失败
25
+  promptInfo: string; //操作结果提示信息
26
+  promptModalShow: boolean; //操作提示框是否展示
27
+  delModal: boolean = false; //删除模态框
28
+  tipsMsg1: string; //提示框信息
29
+  tips: string; //提示框信息(附注)
30
+  coop: any; //当前操作列
31
+  loading2 = false; //删除接口
32
+  mainWidth: any = "100%";
33
+  coopBtns = {};
34
+  constructor(
35
+    private mainService: MainService,
36
+    private route: ActivatedRoute,
37
+    private tool: ToolService
38
+  ) {}
37
   ngOnInit() {
39
   ngOnInit() {
38
     this.route.queryParamMap.subscribe((params: ParamMap) => {
40
     this.route.queryParamMap.subscribe((params: ParamMap) => {
39
-      this.hosId = params.get('id');
41
+      this.hosId = params.get("id");
40
       if (!this.hosId) {
42
       if (!this.hosId) {
41
         this.hosId = this.tool.getCurrentHospital().id;
43
         this.hosId = this.tool.getCurrentHospital().id;
42
       }
44
       }
43
       this.getBuildingList();
45
       this.getBuildingList();
44
     });
46
     });
45
-    this.initCoopBtns();
47
+    this.coopBtns = this.tool.initCoopBtns("dataDictionary");
46
     this.changeSize();
48
     this.changeSize();
47
-    window.addEventListener('resize', () => {
49
+    window.addEventListener("resize", () => {
48
       this.changeSize();
50
       this.changeSize();
49
     });
51
     });
50
   }
52
   }
51
-  // 获取当前菜单权限
52
-  initCoopBtns() {
53
-    // 二级菜单
54
-    let secondMenus = []
55
-    this.menu.forEach(e => {
56
-      e.childrens.forEach(el => {
57
-        secondMenus.push(el)
58
-      });
59
-    });
60
-    let link = 'dataDictionary';
61
-    let btns = []
62
-    secondMenus.forEach(e => {
63
-      if (e.link == link) {
64
-        btns = e.childrens || [];
65
-      }
66
-    });
67
-    btns.forEach(e => {
68
-      this.coopBtns[e.link] = true;
69
-    })
70
-  }
71
   // 改变窗口大小
53
   // 改变窗口大小
72
   changeSize() {
54
   changeSize() {
73
-    let w = window.innerWidth - 582;//屏幕宽-其他元素宽度
74
-    this.mainWidth = Math.floor(w / 360) * 360 + 'px';
55
+    let w = window.innerWidth - 582; //屏幕宽-其他元素宽度
56
+    this.mainWidth = Math.floor(w / 360) * 360 + "px";
75
   }
57
   }
76
   // 新增
58
   // 新增
77
   add() {
59
   add() {
@@ -79,14 +61,18 @@ export class DataBuildingComponent implements OnInit {
79
   }
61
   }
80
   // 删除
62
   // 删除
81
   delete(data) {
63
   delete(data) {
82
-    this.showDelModal(data, '您确认要删除此楼栋吗?', '删除后对应的楼栋积分配置也会删除');
64
+    this.showDelModal(
65
+      data,
66
+      "您确认要删除此楼栋吗?",
67
+      "删除后对应的楼栋积分配置也会删除"
68
+    );
83
   }
69
   }
84
   // 删除楼栋
70
   // 删除楼栋
85
   showDelModal(data: any, tipsMsg1: string, tips?) {
71
   showDelModal(data: any, tipsMsg1: string, tips?) {
86
     this.delModal = true;
72
     this.delModal = true;
87
     this.coop = data;
73
     this.coop = data;
88
     this.tipsMsg1 = tipsMsg1;
74
     this.tipsMsg1 = tipsMsg1;
89
-    this.tips = tips ? tips : '';
75
+    this.tips = tips ? tips : "";
90
   }
76
   }
91
   // 隐藏删除框
77
   // 隐藏删除框
92
   hideDelModal() {
78
   hideDelModal() {
@@ -95,50 +81,57 @@ export class DataBuildingComponent implements OnInit {
95
   // 确认删除
81
   // 确认删除
96
   confirmDel() {
82
   confirmDel() {
97
     this.loading2 = true;
83
     this.loading2 = true;
98
-    if (this.coop.id > 0) {//接口删除
84
+    if (this.coop.id > 0) {
85
+      //接口删除
99
       let postData = [this.coop.id];
86
       let postData = [this.coop.id];
100
-      this.mainService.delBuildingList(postData).subscribe(result => {
101
-        this.loading2 = false;
102
-        this.delModal = false;
103
-        if (result['status'] == 200 && !result['data'][0].msg) {
104
-          this.showPromptModal('删除', true, '', false);
105
-          // 过滤掉当前这一条
106
-          this.buildingList = this.buildingList.filter(item => item.id !== this.coop.id);
107
-        } else {
108
-          this.showPromptModal('删除', false, result['data'][0].msg, false);
87
+      this.mainService.delBuildingList(postData).subscribe(
88
+        (result) => {
89
+          this.loading2 = false;
90
+          this.delModal = false;
91
+          if (result["status"] == 200 && !result["data"][0].msg) {
92
+            this.showPromptModal("删除", true, "", false);
93
+            // 过滤掉当前这一条
94
+            this.buildingList = this.buildingList.filter(
95
+              (item) => item.id !== this.coop.id
96
+            );
97
+          } else {
98
+            this.showPromptModal("删除", false, result["data"][0].msg, false);
99
+          }
100
+        },
101
+        (err) => {
102
+          this.loading2 = false;
103
+          this.delModal = false;
104
+          this.showPromptModal("删除", false, "", false);
109
         }
105
         }
110
-      }, err => {
111
-        this.loading2 = false;
112
-        this.delModal = false;
113
-        this.showPromptModal('删除', false, '', false);
114
-      })
106
+      );
115
     } else {
107
     } else {
116
       this.loading2 = false;
108
       this.loading2 = false;
117
       this.delModal = false;
109
       this.delModal = false;
118
-      this.showPromptModal('删除', true, '', false);
110
+      this.showPromptModal("删除", true, "", false);
119
       // 过滤掉当前这一条
111
       // 过滤掉当前这一条
120
-      this.buildingList = this.buildingList.filter(item => item.id !== this.coop.id);
112
+      this.buildingList = this.buildingList.filter(
113
+        (item) => item.id !== this.coop.id
114
+      );
121
     }
115
     }
122
-
123
   }
116
   }
124
   // 保存
117
   // 保存
125
   save() {
118
   save() {
126
-    let arr = [];//排查是否有重复的名称的容器
127
-    let arrStr = '';//重复名称
119
+    let arr = []; //排查是否有重复的名称的容器
120
+    let arrStr = ""; //重复名称
128
     // 过滤空值
121
     // 过滤空值
129
-    this.buildingList = this.buildingList.filter(item => {
130
-      return (item.buildingName !== '');
131
-    })
122
+    this.buildingList = this.buildingList.filter((item) => {
123
+      return item.buildingName !== "";
124
+    });
132
     // 数据处理
125
     // 数据处理
133
     let postData = JSON.parse(JSON.stringify(this.buildingList));
126
     let postData = JSON.parse(JSON.stringify(this.buildingList));
134
-    postData.forEach(item => {
127
+    postData.forEach((item) => {
135
       arr.push(item.buildingName);
128
       arr.push(item.buildingName);
136
       item.deleted = false;
129
       item.deleted = false;
137
       item.hosId = this.hosId;
130
       item.hosId = this.hosId;
138
       if (item.id < 0) {
131
       if (item.id < 0) {
139
         delete item.id;
132
         delete item.id;
140
       }
133
       }
141
-    })
134
+    });
142
     if (arr.length > 1) {
135
     if (arr.length > 1) {
143
       arr.sort();
136
       arr.sort();
144
       for (let i = 0; i < arr.length - 1; i++) {
137
       for (let i = 0; i < arr.length - 1; i++) {
@@ -147,22 +140,31 @@ export class DataBuildingComponent implements OnInit {
147
         }
140
         }
148
       }
141
       }
149
     }
142
     }
150
-    if (arrStr) {//有重复名称
151
-      arrStr = [...new Set(arrStr.split(','))].join();//去重
152
-      this.showPromptModal('保存', false, `存在重复的楼栋名称${arrStr}请修改后再保存!`, false);
143
+    if (arrStr) {
144
+      //有重复名称
145
+      arrStr = [...new Set(arrStr.split(","))].join(); //去重
146
+      this.showPromptModal(
147
+        "保存",
148
+        false,
149
+        `存在重复的楼栋名称${arrStr}请修改后再保存!`,
150
+        false
151
+      );
153
     } else {
152
     } else {
154
       this.loading3 = true;
153
       this.loading3 = true;
155
-      this.mainService.saveBuildingList(postData).subscribe(result => {
156
-        this.loading3 = false;
157
-        if (result['status'] == 200) {
158
-          this.showPromptModal('保存', true, '');
159
-        } else {
160
-          this.showPromptModal('保存', false, result['msg']);
154
+      this.mainService.saveBuildingList(postData).subscribe(
155
+        (result) => {
156
+          this.loading3 = false;
157
+          if (result["status"] == 200) {
158
+            this.showPromptModal("保存", true, "");
159
+          } else {
160
+            this.showPromptModal("保存", false, result["msg"]);
161
+          }
162
+        },
163
+        (err) => {
164
+          this.loading3 = false;
165
+          this.showPromptModal("保存", false, "");
161
         }
166
         }
162
-      }, err => {
163
-        this.loading3 = false;
164
-        this.showPromptModal('保存', false, '');
165
-      })
167
+      );
166
     }
168
     }
167
   }
169
   }
168
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
170
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
@@ -181,26 +183,40 @@ export class DataBuildingComponent implements OnInit {
181
   // 获取楼栋信息列表
183
   // 获取楼栋信息列表
182
   getBuildingList() {
184
   getBuildingList() {
183
     this.loading1 = true;
185
     this.loading1 = true;
184
-    this.mainService.getFetchDataList('simple/data', 'building', { idx: 0, sum: 9999, building: { hosId: this.hosId } }).subscribe(result => {
185
-      this.loading1 = false;
186
-      if (result['status'] == 200) {
187
-        if (result['list'] && Array.isArray(result['list']) && result['list'].length < 6) {
188
-          let arr = result['list'];
189
-          let len = 6 - arr.length;
190
-          for (let i = 0; i < len; i++) {
191
-            arr.push({ id: --this.id, buildingName: "" });
192
-          }
193
-          this.buildingList = arr;
194
-        } else if (result['list'] && Array.isArray(result['list']) && result['list'].length >= 6) {
195
-          this.buildingList = result['list'];
196
-        } else {
197
-          let arr = [];
198
-          for (let i = 0; i < 6; i++) {
199
-            arr.push({ id: --this.id, buildingName: "" });
186
+    this.mainService
187
+      .getFetchDataList("simple/data", "building", {
188
+        idx: 0,
189
+        sum: 9999,
190
+        building: { hosId: this.hosId },
191
+      })
192
+      .subscribe((result) => {
193
+        this.loading1 = false;
194
+        if (result["status"] == 200) {
195
+          if (
196
+            result["list"] &&
197
+            Array.isArray(result["list"]) &&
198
+            result["list"].length < 6
199
+          ) {
200
+            let arr = result["list"];
201
+            let len = 6 - arr.length;
202
+            for (let i = 0; i < len; i++) {
203
+              arr.push({ id: --this.id, buildingName: "" });
204
+            }
205
+            this.buildingList = arr;
206
+          } else if (
207
+            result["list"] &&
208
+            Array.isArray(result["list"]) &&
209
+            result["list"].length >= 6
210
+          ) {
211
+            this.buildingList = result["list"];
212
+          } else {
213
+            let arr = [];
214
+            for (let i = 0; i < 6; i++) {
215
+              arr.push({ id: --this.id, buildingName: "" });
216
+            }
217
+            this.buildingList = arr;
200
           }
218
           }
201
-          this.buildingList = arr;
202
         }
219
         }
203
-      }
204
-    })
220
+      });
205
   }
221
   }
206
 }
222
 }

+ 23 - 44
src/app/views/data-dictionary/data-dictionary.component.ts

@@ -1,41 +1,40 @@
1
-import { Component, OnInit } from '@angular/core';
2
-import { ActivatedRoute, Router } from '@angular/router';
3
-import { ToolService } from '../../services/tool.service';
1
+import { Component, OnInit } from "@angular/core";
2
+import { ActivatedRoute, Router } from "@angular/router";
3
+import { ToolService } from "../../services/tool.service";
4
 
4
 
5
 @Component({
5
 @Component({
6
-  selector: 'app-data-dictionary',
7
-  templateUrl: './data-dictionary.component.html',
8
-  styleUrls: ['./data-dictionary.component.less']
6
+  selector: "app-data-dictionary",
7
+  templateUrl: "./data-dictionary.component.html",
8
+  styleUrls: ["./data-dictionary.component.less"],
9
 })
9
 })
10
 export class DataDictionaryComponent implements OnInit {
10
 export class DataDictionaryComponent implements OnInit {
11
   navList: Array<any> = [
11
   navList: Array<any> = [
12
-    { name: '楼栋', url: '/main/dataDictionary/dataBuilding' },
13
-    { name: '楼层', url: '/main/dataDictionary/dataFloor' },
12
+    { name: "楼栋", url: "/main/dataDictionary/dataBuilding" },
13
+    { name: "楼层", url: "/main/dataDictionary/dataFloor" },
14
   ];
14
   ];
15
-  coopBtns = { //初始化权限
16
-    edit: false,
17
-    add: false,
18
-    del: false,
19
-  };
20
-  menu = JSON.parse(localStorage.getItem('menu')) || [];//菜单
21
-  hospitalList = [];//权限下的院区列表
22
-  selectedHospital: any;//权限下的选中的院区
23
-  currentIndex = 0;//当前高亮的导航
24
-  constructor(private route: ActivatedRoute, private tool: ToolService, private router: Router) { }
15
+  coopBtns = {};
16
+  hospitalList = []; //权限下的院区列表
17
+  selectedHospital: any; //权限下的选中的院区
18
+  currentIndex = 0; //当前高亮的导航
19
+  constructor(
20
+    private route: ActivatedRoute,
21
+    private tool: ToolService,
22
+    private router: Router
23
+  ) {}
25
 
24
 
26
   ngOnInit() {
25
   ngOnInit() {
27
     console.log(this.router.url);
26
     console.log(this.router.url);
28
     this.hospitalList = this.tool.getHospitalList();
27
     this.hospitalList = this.tool.getHospitalList();
29
-    let urlArr = this.router.url.split('?');
28
+    let urlArr = this.router.url.split("?");
30
     let url = urlArr[0];
29
     let url = urlArr[0];
31
     let id = urlArr[1];
30
     let id = urlArr[1];
32
-    this.currentIndex = this.navList.findIndex(item => item.url == url);
31
+    this.currentIndex = this.navList.findIndex((item) => item.url == url);
33
     if (id) {
32
     if (id) {
34
-      this.selectedHospital = parseInt(id.split('=')[1]);
33
+      this.selectedHospital = parseInt(id.split("=")[1]);
35
     } else {
34
     } else {
36
       this.selectedHospital = this.tool.getCurrentHospital().id;
35
       this.selectedHospital = this.tool.getCurrentHospital().id;
37
     }
36
     }
38
-    this.initCoopBtns();
37
+    this.coopBtns = this.tool.initCoopBtns(this.route);
39
   }
38
   }
40
   // 导航跳转
39
   // 导航跳转
41
   selectedNav(index) {
40
   selectedNav(index) {
@@ -43,27 +42,7 @@ export class DataDictionaryComponent implements OnInit {
43
   }
42
   }
44
   // 切换院区
43
   // 切换院区
45
   selectedHospitalChange() {
44
   selectedHospitalChange() {
46
-    let url = this.router.url.split('?')[0];
47
-    this.router.navigate([url], { queryParams: { id: this.selectedHospital } })
48
-  }
49
-  // 获取当前菜单权限
50
-  initCoopBtns() {
51
-    // 二级菜单
52
-    let secondMenus = []
53
-    this.menu.forEach(e => {
54
-      e.childrens.forEach(el => {
55
-        secondMenus.push(el)
56
-      });
57
-    });
58
-    let link = this.route.parent.snapshot.routeConfig.path;
59
-    let btns = []
60
-    secondMenus.forEach(e => {
61
-      if (e.link == link) {
62
-        btns = e.childrens || [];
63
-      }
64
-    });
65
-    btns.forEach(e => {
66
-      this.coopBtns[e.link] = true;
67
-    })
45
+    let url = this.router.url.split("?")[0];
46
+    this.router.navigate([url], { queryParams: { id: this.selectedHospital } });
68
   }
47
   }
69
 }
48
 }

+ 184 - 135
src/app/views/data-floor/data-floor.component.ts

@@ -1,95 +1,83 @@
1
-import { Component, OnInit, ViewChild } from '@angular/core';
2
-import { ActivatedRoute, ParamMap } from '@angular/router';
3
-import { OverlayScrollbarsComponent } from 'overlayscrollbars-ngx';
4
-import { GenerateFloorComponent } from '../../share/generate-floor/generate-floor.component';
5
-import { MainService } from '../../services/main.service';
6
-import { ToolService } from '../../services/tool.service';
1
+import { Component, OnInit, ViewChild } from "@angular/core";
2
+import { ActivatedRoute, ParamMap } from "@angular/router";
3
+import { OverlayScrollbarsComponent } from "overlayscrollbars-ngx";
4
+import { GenerateFloorComponent } from "../../share/generate-floor/generate-floor.component";
5
+import { MainService } from "../../services/main.service";
6
+import { ToolService } from "../../services/tool.service";
7
 
7
 
8
 @Component({
8
 @Component({
9
-  selector: 'app-data-floor',
10
-  templateUrl: './data-floor.component.html',
11
-  styleUrls: ['./data-floor.component.less']
9
+  selector: "app-data-floor",
10
+  templateUrl: "./data-floor.component.html",
11
+  styleUrls: ["./data-floor.component.less"],
12
 })
12
 })
13
 export class DataFloorComponent implements OnInit {
13
 export class DataFloorComponent implements OnInit {
14
-  @ViewChild('osComponentRef1', { read: OverlayScrollbarsComponent, static: false })
15
-  @ViewChild(GenerateFloorComponent, { static: false }) generate1: GenerateFloorComponent
14
+  @ViewChild("osComponentRef1", {
15
+    read: OverlayScrollbarsComponent,
16
+    static: false,
17
+  })
18
+  @ViewChild(GenerateFloorComponent, { static: false })
19
+  generate1: GenerateFloorComponent;
16
   osComponentRef1: OverlayScrollbarsComponent;
20
   osComponentRef1: OverlayScrollbarsComponent;
17
-  loading1 = false;//获取楼栋,楼层信息列表加载状态
18
-  loading3 = false;//保存
19
-  hosId: any;//院区id
20
-  id: number = 0;//自定义id,负整数
21
-  buildingList: Array<any> = [];//楼栋信息列表
22
-  floorList: Array<any> = [];//楼层信息列表
23
-  promptContent: string;//操作提示框提示信息
24
-  ifSuccess: boolean;//操作成功/失败
25
-  promptInfo: string;//操作结果提示信息
26
-  promptModalShow: boolean;//操作提示框是否展示
27
-  delModal: boolean = false;//删除模态框
28
-  tipsMsg1: string;//提示框信息
29
-  coop: any;//当前操作列
30
-  loading2 = false;//删除接口
31
-  mainWidth = '100%';
32
-  coopBtns = { //初始化权限
33
-    edit: false,
34
-    add: false,
35
-    del: false,
36
-  };
37
-  menu = JSON.parse(localStorage.getItem('menu')) || [];//菜单
38
-  constructor(private mainService: MainService, private route: ActivatedRoute, private tool: ToolService) { }
21
+  loading1 = false; //获取楼栋,楼层信息列表加载状态
22
+  loading3 = false; //保存
23
+  hosId: any; //院区id
24
+  id: number = 0; //自定义id,负整数
25
+  buildingList: Array<any> = []; //楼栋信息列表
26
+  floorList: Array<any> = []; //楼层信息列表
27
+  promptContent: string; //操作提示框提示信息
28
+  ifSuccess: boolean; //操作成功/失败
29
+  promptInfo: string; //操作结果提示信息
30
+  promptModalShow: boolean; //操作提示框是否展示
31
+  delModal: boolean = false; //删除模态框
32
+  tipsMsg1: string; //提示框信息
33
+  coop: any; //当前操作列
34
+  loading2 = false; //删除接口
35
+  mainWidth = "100%";
36
+  coopBtns = {};
37
+  constructor(
38
+    private mainService: MainService,
39
+    private route: ActivatedRoute,
40
+    private tool: ToolService
41
+  ) {}
39
   ngOnInit() {
42
   ngOnInit() {
40
     this.route.queryParamMap.subscribe((params: ParamMap) => {
43
     this.route.queryParamMap.subscribe((params: ParamMap) => {
41
-      this.hosId = params.get('id');
44
+      this.hosId = params.get("id");
42
       if (!this.hosId) {
45
       if (!this.hosId) {
43
         this.hosId = this.tool.getCurrentHospital().id;
46
         this.hosId = this.tool.getCurrentHospital().id;
44
       }
47
       }
45
       this.getBuildingList();
48
       this.getBuildingList();
46
     });
49
     });
47
-    this.initCoopBtns();
50
+    this.coopBtns = this.tool.initCoopBtns("dataDictionary");
48
     this.changeSize();
51
     this.changeSize();
49
-    window.addEventListener('resize', () => {
52
+    window.addEventListener("resize", () => {
50
       this.changeSize();
53
       this.changeSize();
51
     });
54
     });
52
   }
55
   }
53
   // 选择楼栋(获取楼栋名称)
56
   // 选择楼栋(获取楼栋名称)
54
   selectBuild(data) {
57
   selectBuild(data) {
55
-    this.buildingList.forEach(item => {
58
+    this.buildingList.forEach((item) => {
56
       if (item.id == data.buildId) {
59
       if (item.id == data.buildId) {
57
         data.building.buildingName = item.buildingName;
60
         data.building.buildingName = item.buildingName;
58
       }
61
       }
59
-    })
60
-  }
61
-  // 获取当前菜单权限
62
-  initCoopBtns() {
63
-    // 二级菜单
64
-    let secondMenus = []
65
-    this.menu.forEach(e => {
66
-      e.childrens.forEach(el => {
67
-        secondMenus.push(el)
68
-      });
69
-    });
70
-    let link = 'dataDictionary';
71
-    let btns = []
72
-    secondMenus.forEach(e => {
73
-      if (e.link == link) {
74
-        btns = e.childrens || [];
75
-      }
76
     });
62
     });
77
-    btns.forEach(e => {
78
-      this.coopBtns[e.link] = true;
79
-    })
80
   }
63
   }
81
   // 改变窗口大小
64
   // 改变窗口大小
82
   changeSize() {
65
   changeSize() {
83
-    let w = window.innerWidth - 582;//屏幕宽-其他元素宽度
84
-    this.mainWidth = Math.floor(w / 370) * 370 + 'px';
66
+    let w = window.innerWidth - 582; //屏幕宽-其他元素宽度
67
+    this.mainWidth = Math.floor(w / 370) * 370 + "px";
85
   }
68
   }
86
   // 新增
69
   // 新增
87
   add() {
70
   add() {
88
-    this.floorList.push({ id: --this.id, buildId: null, building: { buildingName: '' }, floorName: "" });
71
+    this.floorList.push({
72
+      id: --this.id,
73
+      buildId: null,
74
+      building: { buildingName: "" },
75
+      floorName: "",
76
+    });
89
   }
77
   }
90
   // 删除
78
   // 删除
91
   delete(data) {
79
   delete(data) {
92
-    this.showDelModal(data, '您确认要删除此楼层吗?');
80
+    this.showDelModal(data, "您确认要删除此楼层吗?");
93
   }
81
   }
94
   // 删除快捷建单
82
   // 删除快捷建单
95
   showDelModal(data: any, tipsMsg1: string) {
83
   showDelModal(data: any, tipsMsg1: string) {
@@ -104,29 +92,37 @@ export class DataFloorComponent implements OnInit {
104
   // 确认删除
92
   // 确认删除
105
   confirmDel() {
93
   confirmDel() {
106
     this.loading2 = true;
94
     this.loading2 = true;
107
-    if (this.coop.id > 0) {//接口删除
95
+    if (this.coop.id > 0) {
96
+      //接口删除
108
       let postData = [this.coop.id];
97
       let postData = [this.coop.id];
109
-      this.mainService.delFloorList(postData).subscribe(result => {
110
-        this.loading2 = false;
111
-        this.delModal = false;
112
-        if (result['status'] == 200 && !result['data'][0].msg) {
113
-          this.showPromptModal('删除', true, '', false);
114
-          // 过滤掉当前这一条
115
-          this.floorList = this.floorList.filter(item => item.id !== this.coop.id);
116
-        } else {
117
-          this.showPromptModal('删除', false, result['data'][0].msg, false);
98
+      this.mainService.delFloorList(postData).subscribe(
99
+        (result) => {
100
+          this.loading2 = false;
101
+          this.delModal = false;
102
+          if (result["status"] == 200 && !result["data"][0].msg) {
103
+            this.showPromptModal("删除", true, "", false);
104
+            // 过滤掉当前这一条
105
+            this.floorList = this.floorList.filter(
106
+              (item) => item.id !== this.coop.id
107
+            );
108
+          } else {
109
+            this.showPromptModal("删除", false, result["data"][0].msg, false);
110
+          }
111
+        },
112
+        (err) => {
113
+          this.loading2 = false;
114
+          this.delModal = false;
115
+          this.showPromptModal("删除", false, "", false);
118
         }
116
         }
119
-      }, err => {
120
-        this.loading2 = false;
121
-        this.delModal = false;
122
-        this.showPromptModal('删除', false, '', false);
123
-      })
117
+      );
124
     } else {
118
     } else {
125
       this.loading2 = false;
119
       this.loading2 = false;
126
       this.delModal = false;
120
       this.delModal = false;
127
-      this.showPromptModal('删除', true, '', false);
121
+      this.showPromptModal("删除", true, "", false);
128
       // 过滤掉当前这一条
122
       // 过滤掉当前这一条
129
-      this.floorList = this.floorList.filter(item => item.id !== this.coop.id);
123
+      this.floorList = this.floorList.filter(
124
+        (item) => item.id !== this.coop.id
125
+      );
130
     }
126
     }
131
   }
127
   }
132
   // 生成楼层baba
128
   // 生成楼层baba
@@ -141,17 +137,27 @@ export class DataFloorComponent implements OnInit {
141
   // 确认生成baba
137
   // 确认生成baba
142
   loading4: boolean = false;
138
   loading4: boolean = false;
143
   confirmGenerate(e) {
139
   confirmGenerate(e) {
144
-    let arr = [];//生成的楼层
140
+    let arr = []; //生成的楼层
145
     for (let i = e[1]; i <= e[2]; i++) {
141
     for (let i = e[1]; i <= e[2]; i++) {
146
-      arr.push({ id: --this.id, buildId: e[0].id, building: { buildingName: e[0].buildingName }, floorName: i + '' });
142
+      arr.push({
143
+        id: --this.id,
144
+        buildId: e[0].id,
145
+        building: { buildingName: e[0].buildingName },
146
+        floorName: i + "",
147
+      });
147
     }
148
     }
148
     // 去重
149
     // 去重
149
-    this.floorList.forEach(item1 => {
150
-      arr = arr.filter(item2 => !(item1.buildId == item2.buildId && item1.floorName == item2.floorName));
151
-    })
150
+    this.floorList.forEach((item1) => {
151
+      arr = arr.filter(
152
+        (item2) =>
153
+          !(
154
+            item1.buildId == item2.buildId && item1.floorName == item2.floorName
155
+          )
156
+      );
157
+    });
152
     this.floorList = [...this.floorList, ...arr];
158
     this.floorList = [...this.floorList, ...arr];
153
-    console.log(this.floorList, 'seimin');
154
-    this.save('生成楼层', 'loading4');
159
+    console.log(this.floorList, "seimin");
160
+    this.save("生成楼层", "loading4");
155
   }
161
   }
156
   // 保存
162
   // 保存
157
   /**
163
   /**
@@ -160,16 +166,21 @@ export class DataFloorComponent implements OnInit {
160
    * @param loadingName string 保存还是生成楼层,取值'loading3','loading4'
166
    * @param loadingName string 保存还是生成楼层,取值'loading3','loading4'
161
    */
167
    */
162
   save(type, loadingName) {
168
   save(type, loadingName) {
163
-    let arr = [];//排查是否有重复的名称的容器
164
-    let arrStr = '';//重复名称
165
-    console.log(this.floorList, 'seimin')
169
+    let arr = []; //排查是否有重复的名称的容器
170
+    let arrStr = ""; //重复名称
171
+    console.log(this.floorList, "seimin");
166
     // 过滤空值
172
     // 过滤空值
167
-    this.floorList = this.floorList.filter(item => {
168
-      return (item.buildId !== null && item.floorName !== '' && item.building && item.building.buildingName !== '');
169
-    })
173
+    this.floorList = this.floorList.filter((item) => {
174
+      return (
175
+        item.buildId !== null &&
176
+        item.floorName !== "" &&
177
+        item.building &&
178
+        item.building.buildingName !== ""
179
+      );
180
+    });
170
     // 数据处理
181
     // 数据处理
171
     let postData = JSON.parse(JSON.stringify(this.floorList));
182
     let postData = JSON.parse(JSON.stringify(this.floorList));
172
-    postData.forEach(item => {
183
+    postData.forEach((item) => {
173
       arr.push([item.building.buildingName, item.floorName]);
184
       arr.push([item.building.buildingName, item.floorName]);
174
       item.hosId = this.hosId;
185
       item.hosId = this.hosId;
175
       item.deleted = false;
186
       item.deleted = false;
@@ -177,33 +188,42 @@ export class DataFloorComponent implements OnInit {
177
       if (item.id < 0) {
188
       if (item.id < 0) {
178
         delete item.id;
189
         delete item.id;
179
       }
190
       }
180
-    })
191
+    });
181
     if (arr.length > 1) {
192
     if (arr.length > 1) {
182
-      arr.sort((a, b) => (a[1] - b[1]));
193
+      arr.sort((a, b) => a[1] - b[1]);
183
       for (let i = 0; i < arr.length - 1; i++) {
194
       for (let i = 0; i < arr.length - 1; i++) {
184
         if (arr[i][1] === arr[i + 1][1] && arr[i][0] === arr[i + 1][0]) {
195
         if (arr[i][1] === arr[i + 1][1] && arr[i][0] === arr[i + 1][0]) {
185
           arrStr += `【${arr[i][0]}-${arr[i][1]}】,`;
196
           arrStr += `【${arr[i][0]}-${arr[i][1]}】,`;
186
         }
197
         }
187
       }
198
       }
188
     }
199
     }
189
-    if (arrStr) {//有重复名称
190
-      arrStr = [...new Set(arrStr.split(','))].join();//去重
191
-      this.showPromptModal(type, false, `同一个楼栋存在重复的楼层名称${arrStr}请修改后再保存!`, false);
200
+    if (arrStr) {
201
+      //有重复名称
202
+      arrStr = [...new Set(arrStr.split(","))].join(); //去重
203
+      this.showPromptModal(
204
+        type,
205
+        false,
206
+        `同一个楼栋存在重复的楼层名称${arrStr}请修改后再保存!`,
207
+        false
208
+      );
192
     } else {
209
     } else {
193
       this[loadingName] = true;
210
       this[loadingName] = true;
194
-      this.mainService.saveFloorList(postData).subscribe(result => {
195
-        this[loadingName] = false;
196
-        if (result['status'] == 200) {
197
-          this.showPromptModal(type, true, '');
198
-          this.hideGenerateModal();//隐藏
199
-          this.generate1.delModal = false;
200
-        } else {
201
-          this.showPromptModal(type, false, result['msg']);
211
+      this.mainService.saveFloorList(postData).subscribe(
212
+        (result) => {
213
+          this[loadingName] = false;
214
+          if (result["status"] == 200) {
215
+            this.showPromptModal(type, true, "");
216
+            this.hideGenerateModal(); //隐藏
217
+            this.generate1.delModal = false;
218
+          } else {
219
+            this.showPromptModal(type, false, result["msg"]);
220
+          }
221
+        },
222
+        (err) => {
223
+          this[loadingName] = false;
224
+          this.showPromptModal(type, false, "");
202
         }
225
         }
203
-      }, err => {
204
-        this[loadingName] = false;
205
-        this.showPromptModal(type, false, '');
206
-      })
226
+      );
207
     }
227
     }
208
   }
228
   }
209
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
229
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
@@ -221,37 +241,66 @@ export class DataFloorComponent implements OnInit {
221
   }
241
   }
222
   // 获取楼层信息列表
242
   // 获取楼层信息列表
223
   getFloorList() {
243
   getFloorList() {
224
-    this.mainService.getFetchDataList('simple/data', 'floor', { idx: 0, sum: 9999, floor: { hosId: this.hosId } }).subscribe(result => {
225
-      this.loading1 = false;
226
-      if (result['status'] == 200) {
227
-        if (result['list'] && Array.isArray(result['list']) && result['list'].length < 6) {
228
-          let arr = result['list'];
229
-          let len = 6 - arr.length;
230
-          for (let i = 0; i < len; i++) {
231
-            arr.push({ id: --this.id, buildId: null, building: { buildingName: '' }, floorName: "" });
232
-          }
233
-          this.floorList = arr;
234
-        } else if (result['list'] && Array.isArray(result['list']) && result['list'].length >= 6) {
235
-          this.floorList = result['list'];
236
-        } else {
237
-          let arr = [];
238
-          for (let i = 0; i < 6; i++) {
239
-            arr.push({ id: --this.id, buildId: null, building: { buildingName: '' }, floorName: "" });
244
+    this.mainService
245
+      .getFetchDataList("simple/data", "floor", {
246
+        idx: 0,
247
+        sum: 9999,
248
+        floor: { hosId: this.hosId },
249
+      })
250
+      .subscribe((result) => {
251
+        this.loading1 = false;
252
+        if (result["status"] == 200) {
253
+          if (
254
+            result["list"] &&
255
+            Array.isArray(result["list"]) &&
256
+            result["list"].length < 6
257
+          ) {
258
+            let arr = result["list"];
259
+            let len = 6 - arr.length;
260
+            for (let i = 0; i < len; i++) {
261
+              arr.push({
262
+                id: --this.id,
263
+                buildId: null,
264
+                building: { buildingName: "" },
265
+                floorName: "",
266
+              });
267
+            }
268
+            this.floorList = arr;
269
+          } else if (
270
+            result["list"] &&
271
+            Array.isArray(result["list"]) &&
272
+            result["list"].length >= 6
273
+          ) {
274
+            this.floorList = result["list"];
275
+          } else {
276
+            let arr = [];
277
+            for (let i = 0; i < 6; i++) {
278
+              arr.push({
279
+                id: --this.id,
280
+                buildId: null,
281
+                building: { buildingName: "" },
282
+                floorName: "",
283
+              });
284
+            }
285
+            this.floorList = arr;
240
           }
286
           }
241
-          this.floorList = arr;
242
         }
287
         }
243
-      }
244
-    })
288
+      });
245
   }
289
   }
246
   // 获取楼栋信息列表
290
   // 获取楼栋信息列表
247
   getBuildingList() {
291
   getBuildingList() {
248
     this.loading1 = true;
292
     this.loading1 = true;
249
-    this.mainService.getFetchDataList('simple/data', 'building', { idx: 0, sum: 9999, building: { hosId: this.hosId } }).subscribe(result => {
250
-      if (result['status'] == 200) {
251
-        this.buildingList = result['list'];
252
-        this.getFloorList();
253
-      }
254
-    })
293
+    this.mainService
294
+      .getFetchDataList("simple/data", "building", {
295
+        idx: 0,
296
+        sum: 9999,
297
+        building: { hosId: this.hosId },
298
+      })
299
+      .subscribe((result) => {
300
+        if (result["status"] == 200) {
301
+          this.buildingList = result["list"];
302
+          this.getFloorList();
303
+        }
304
+      });
255
   }
305
   }
256
 }
306
 }
257
-

+ 128 - 144
src/app/views/dept-statistics/dept-statistics.component.ts

@@ -1,122 +1,95 @@
1
-import { Component, OnInit } from '@angular/core';
2
-import { ActivatedRoute, Router } from "@angular/router"
1
+import { Component, OnInit } from "@angular/core";
2
+import { ActivatedRoute, Router } from "@angular/router";
3
 
3
 
4
 import { MainService } from "../../services/main.service";
4
 import { MainService } from "../../services/main.service";
5
 import { DateService } from "../../services/date.service";
5
 import { DateService } from "../../services/date.service";
6
 import { MyServiceService } from "../../services/my-service.service";
6
 import { MyServiceService } from "../../services/my-service.service";
7
-import { ToolService } from '../../services/tool.service';
7
+import { ToolService } from "../../services/tool.service";
8
 
8
 
9
 @Component({
9
 @Component({
10
-  selector: 'app-dept-statistics',
11
-  templateUrl: './dept-statistics.component.html',
12
-  styleUrls: ['./dept-statistics.component.less']
10
+  selector: "app-dept-statistics",
11
+  templateUrl: "./dept-statistics.component.html",
12
+  styleUrls: ["./dept-statistics.component.less"],
13
 })
13
 })
14
 export class DeptStatisticsComponent implements OnInit {
14
 export class DeptStatisticsComponent implements OnInit {
15
-
16
-  constructor(private route: ActivatedRoute, private router: Router, private mainService: MainService, private dateService: DateService, private myService: MyServiceService, private tool: ToolService) { }
15
+  constructor(
16
+    private route: ActivatedRoute,
17
+    private router: Router,
18
+    private mainService: MainService,
19
+    private dateService: DateService,
20
+    private myService: MyServiceService,
21
+    private tool: ToolService
22
+  ) {}
17
 
23
 
18
   ngOnInit() {
24
   ngOnInit() {
19
-    this.getSearchData()
20
-    this.initCoopBtns();
21
-    this.getAllHos()
25
+    this.getSearchData();
26
+    this.coopBtns = this.tool.initCoopBtns(this.route);
27
+    this.getAllHos();
22
   }
28
   }
23
 
29
 
24
-  menu: any = JSON.parse(localStorage.getItem('menu')) || [];//菜单
25
-
26
-  defRange = '1';//默认上周
30
+  defRange = "1"; //默认上周
27
   defRanges = [
31
   defRanges = [
28
     {
32
     {
29
-      label: '上周',
30
-      id: 1
31
-    }, {
32
-      label: '上月',
33
-      id: 2
34
-    }, {
35
-      label: '上年',
36
-      id: 3
33
+      label: "上周",
34
+      id: 1,
37
     },
35
     },
38
-  ];//时间默认区间
39
-
40
-  listOfData: any[] = [];//表格数据
41
-  pageIndex: number = 1;//表格当前页码
42
-  pageSize: number = 10;//表格每页展示条数
43
-  listLength: number = 10;//表格总数据量
36
+    {
37
+      label: "上月",
38
+      id: 2,
39
+    },
40
+    {
41
+      label: "上年",
42
+      id: 3,
43
+    },
44
+  ]; //时间默认区间
44
 
45
 
45
-  alldepart: any = [];//当前院区所属科室
46
-  dateRange: any = [];//发起时间区间 天
46
+  listOfData: any[] = []; //表格数据
47
+  pageIndex: number = 1; //表格当前页码
48
+  pageSize: number = 10; //表格每页展示条数
49
+  listLength: number = 10; //表格总数据量
47
 
50
 
48
-  promptContent: string;//操作提示框提示信息
49
-  ifSuccess: boolean;//操作成功/失败
50
-  promptInfo: string;//操作结果提示信息
51
-  promptModalShow: boolean;//操作提示框是否展示
51
+  alldepart: any = []; //当前院区所属科室
52
+  dateRange: any = []; //发起时间区间 天
52
 
53
 
54
+  promptContent: string; //操作提示框提示信息
55
+  ifSuccess: boolean; //操作成功/失败
56
+  promptInfo: string; //操作结果提示信息
57
+  promptModalShow: boolean; //操作提示框是否展示
53
 
58
 
54
   // 初始化增删改按钮
59
   // 初始化增删改按钮
55
-  coopBtns: any = {
56
-    look: false,
57
-    export: false
58
-  };
59
-  initCoopBtns() {
60
-    // 二级菜单
61
-    let secondMenus = []
62
-    this.menu.forEach(e => {
63
-      e.childrens.forEach(el => {
64
-        secondMenus.push(el)
65
-      });
66
-    });
67
-    // console.log(secondMenus)
68
-    let link = this.route.parent.snapshot.routeConfig.path;
69
-    let btns = []
70
-    secondMenus.forEach(e => {
71
-      if (e.link == link) {
72
-        btns = e.childrens || [];
73
-      }
74
-    });
75
-    btns.forEach(e => {
76
-      switch (e.link) {
77
-        case 'look':
78
-          this.coopBtns.look = true;
79
-          break;
80
-        case 'export':
81
-          this.coopBtns.export = true;
82
-          break;
83
-      }
84
-    })
85
-    // console.log(this.coopBtns);
86
-  }
87
-  searchData: any = {} // 综合统计页面带过来的参数
60
+  coopBtns: any = {};
61
+  searchData: any = {}; // 综合统计页面带过来的参数
88
   getSearchData() {
62
   getSearchData() {
89
     let that = this;
63
     let that = this;
90
-    let sub = that.myService.getMsg().subscribe(msg => {
64
+    let sub = that.myService.getMsg().subscribe((msg) => {
91
       // 从综合报表跳转过来
65
       // 从综合报表跳转过来
92
-      that.searchData = msg
93
-      console.log(that.searchData)
94
-      console.log(66)
95
-      sub.unsubscribe()//取消订阅,否则订阅函数会累加执行
96
-      that.hospital = that.searchData['hosId']
97
-      that.changeDate(that.searchData['range'])
98
-      that.defRange = that.searchData['defRange']
99
-      that.search()
100
-    })
66
+      that.searchData = msg;
67
+      console.log(that.searchData);
68
+      console.log(66);
69
+      sub.unsubscribe(); //取消订阅,否则订阅函数会累加执行
70
+      that.hospital = that.searchData["hosId"];
71
+      that.changeDate(that.searchData["range"]);
72
+      that.defRange = that.searchData["defRange"];
73
+      that.search();
74
+    });
101
     // 不是从综合报表页面跳转过来的
75
     // 不是从综合报表页面跳转过来的
102
     setTimeout(() => {
76
     setTimeout(() => {
103
-      if (!sub['isStopped']) {
104
-        that.changeDateRange(that.defRange)
105
-        that.search()
77
+      if (!sub["isStopped"]) {
78
+        that.changeDateRange(that.defRange);
79
+        that.search();
106
       }
80
       }
107
     }, 100);
81
     }, 100);
108
-
109
   }
82
   }
110
   // 搜索
83
   // 搜索
111
   search(num?: number) {
84
   search(num?: number) {
112
     if (this.hospital) {
85
     if (this.hospital) {
113
-      this.searchData['hosId'] = this.hospital;
86
+      this.searchData["hosId"] = this.hospital;
114
     }
87
     }
115
     if (this.startDate) {
88
     if (this.startDate) {
116
-      this.searchData['dateRange'] = {
117
-        start: this.startDate + ' ' + '00:00:00',
118
-        end: this.endDate + ' ' + '23:59:59'
119
-      }
89
+      this.searchData["dateRange"] = {
90
+        start: this.startDate + " " + "00:00:00",
91
+        end: this.endDate + " " + "23:59:59",
92
+      };
120
     }
93
     }
121
     if (num !== undefined) {
94
     if (num !== undefined) {
122
       this.getList(num);
95
       this.getList(num);
@@ -130,33 +103,36 @@ export class DeptStatisticsComponent implements OnInit {
130
     let that = this;
103
     let that = this;
131
     let postData = {
104
     let postData = {
132
       hosId: that.hospital,
105
       hosId: that.hospital,
133
-      startTime: this.startDate + ' ' + '00:00:00',
134
-      endTime: this.endDate + ' ' + '23:59:59',
135
-    }
106
+      startTime: this.startDate + " " + "00:00:00",
107
+      endTime: this.endDate + " " + "23:59:59",
108
+    };
136
     this.loading2 = true;
109
     this.loading2 = true;
137
-    that.mainService.exportReport('dept', postData).subscribe(data => {
138
-      this.loading2 = false;
139
-      this.showPromptModal('导出', true, '');
140
-      var file = new Blob([data], {
141
-        type: 'application/vnd.ms-excel'
142
-      });
143
-      //trick to download store a file having its URL
144
-      var fileURL = URL.createObjectURL(file);
145
-      var a = document.createElement('a');
146
-      a.href = fileURL;
147
-      a.target = '_blank';
148
-      a.download = '科室统计.xls';
149
-      document.body.appendChild(a);
150
-      a.click();
151
-    }, err => {
152
-      this.loading2 = false;
153
-      this.showPromptModal('导出', false, '');
154
-    })
110
+    that.mainService.exportReport("dept", postData).subscribe(
111
+      (data) => {
112
+        this.loading2 = false;
113
+        this.showPromptModal("导出", true, "");
114
+        var file = new Blob([data], {
115
+          type: "application/vnd.ms-excel",
116
+        });
117
+        //trick to download store a file having its URL
118
+        var fileURL = URL.createObjectURL(file);
119
+        var a = document.createElement("a");
120
+        a.href = fileURL;
121
+        a.target = "_blank";
122
+        a.download = "科室统计.xls";
123
+        document.body.appendChild(a);
124
+        a.click();
125
+      },
126
+      (err) => {
127
+        this.loading2 = false;
128
+        this.showPromptModal("导出", false, "");
129
+      }
130
+    );
155
   }
131
   }
156
   // 重置
132
   // 重置
157
   reset() {
133
   reset() {
158
-    this.changeDateRange('1')
159
-    this.search()
134
+    this.changeDateRange("1");
135
+    this.search();
160
   }
136
   }
161
   // 表格数据
137
   // 表格数据
162
   loading1 = false;
138
   loading1 = false;
@@ -169,39 +145,50 @@ export class DeptStatisticsComponent implements OnInit {
169
       sum: this.pageSize,
145
       sum: this.pageSize,
170
       startTime: this.searchData.dateRange.start,
146
       startTime: this.searchData.dateRange.start,
171
       endTime: this.searchData.dateRange.end,
147
       endTime: this.searchData.dateRange.end,
172
-      hosId: this.searchData.hosId
173
-    }
148
+      hosId: this.searchData.hosId,
149
+    };
174
     this.loading1 = true;
150
     this.loading1 = true;
175
-    this.mainService.postCustom('report', 'dept', postData).subscribe(result => {
176
-      this.loading1 = false;
177
-      this.listOfData = result.list || [];
178
-      this.listLength = result.totalNum;
179
-    })
180
-
151
+    this.mainService
152
+      .postCustom("report", "dept", postData)
153
+      .subscribe((result) => {
154
+        this.loading1 = false;
155
+        this.listOfData = result.list || [];
156
+        this.listLength = result.totalNum;
157
+      });
181
   }
158
   }
182
   // 获取院区
159
   // 获取院区
183
-  hospital: string;//选中院区
160
+  hospital: string; //选中院区
184
   getAllHos() {
161
   getAllHos() {
185
-    this.hospital = this.tool.getCurrentHospital().id + '';
162
+    this.hospital = this.tool.getCurrentHospital().id + "";
186
   }
163
   }
187
 
164
 
188
   // 日期选择 日
165
   // 日期选择 日
189
-  startDate: string;//发起时间开始
190
-  endDate: string;//发起时间结束
166
+  startDate: string; //发起时间开始
167
+  endDate: string; //发起时间结束
191
   changeDate(result?): void {
168
   changeDate(result?): void {
192
-    console.log(this.dateRange)
193
-    console.log(result)
169
+    console.log(this.dateRange);
170
+    console.log(result);
194
     this.dateRange = result;
171
     this.dateRange = result;
195
     if (!this.quick) {
172
     if (!this.quick) {
196
       // 不是快捷选择
173
       // 不是快捷选择
197
       this.defRange = null;
174
       this.defRange = null;
198
     }
175
     }
199
     if (!result || !result.length) {
176
     if (!result || !result.length) {
200
-      this.startDate = this.endDate = '';
177
+      this.startDate = this.endDate = "";
201
       return;
178
       return;
202
     }
179
     }
203
-    this.startDate = result[0].getFullYear() + '-' + (result[0].getMonth() + 1) + '-' + result[0].getDate();
204
-    this.endDate = result[1].getFullYear() + '-' + (result[1].getMonth() + 1) + '-' + result[1].getDate();
180
+    this.startDate =
181
+      result[0].getFullYear() +
182
+      "-" +
183
+      (result[0].getMonth() + 1) +
184
+      "-" +
185
+      result[0].getDate();
186
+    this.endDate =
187
+      result[1].getFullYear() +
188
+      "-" +
189
+      (result[1].getMonth() + 1) +
190
+      "-" +
191
+      result[1].getDate();
205
   }
192
   }
206
 
193
 
207
   // 日期选择 快速修改时间区间
194
   // 日期选择 快速修改时间区间
@@ -212,38 +199,37 @@ export class DeptStatisticsComponent implements OnInit {
212
     console.log(res);
199
     console.log(res);
213
     this.quick = true;
200
     this.quick = true;
214
     switch (res) {
201
     switch (res) {
215
-      case '1':
202
+      case "1":
216
         // 上周
203
         // 上周
217
         let lastweekstartdate = this.dateService.date().lastWeekStartDate;
204
         let lastweekstartdate = this.dateService.date().lastWeekStartDate;
218
         let lastweekenddate = this.dateService.date().lastWeekEndDate;
205
         let lastweekenddate = this.dateService.date().lastWeekEndDate;
219
-        console.log(lastweekstartdate, lastweekenddate)
220
-        this.changeDate([lastweekstartdate, lastweekenddate])
206
+        console.log(lastweekstartdate, lastweekenddate);
207
+        this.changeDate([lastweekstartdate, lastweekenddate]);
221
         break;
208
         break;
222
-      case '2':
209
+      case "2":
223
         // 上月
210
         // 上月
224
         let lastmonthstartdate = this.dateService.date().lastMonthStartDate;
211
         let lastmonthstartdate = this.dateService.date().lastMonthStartDate;
225
         let lastmonthenddate = this.dateService.date().lastMonthEndDate;
212
         let lastmonthenddate = this.dateService.date().lastMonthEndDate;
226
-        console.log(lastmonthstartdate, lastmonthenddate)
227
-        this.changeDate([lastmonthstartdate, lastmonthenddate])
213
+        console.log(lastmonthstartdate, lastmonthenddate);
214
+        this.changeDate([lastmonthstartdate, lastmonthenddate]);
228
         break;
215
         break;
229
-      case '3':
216
+      case "3":
230
         // 上年
217
         // 上年
231
         let lastyearstartdate = this.dateService.date().lastYearStartDate;
218
         let lastyearstartdate = this.dateService.date().lastYearStartDate;
232
         let lastyearenddate = this.dateService.date().lastYearEndDate;
219
         let lastyearenddate = this.dateService.date().lastYearEndDate;
233
-        console.log(lastyearstartdate, lastyearenddate)
234
-        this.changeDate([lastyearstartdate, lastyearenddate])
220
+        console.log(lastyearstartdate, lastyearenddate);
221
+        this.changeDate([lastyearstartdate, lastyearenddate]);
235
         break;
222
         break;
236
     }
223
     }
237
     this.quick = false;
224
     this.quick = false;
238
-
239
   }
225
   }
240
 
226
 
241
   // 更多
227
   // 更多
242
   toMore(type) {
228
   toMore(type) {
243
     let sendData = this.searchData;
229
     let sendData = this.searchData;
244
-    console.log(sendData)
245
-    this.myService.sendMsg(sendData)
246
-    this.router.navigateByUrl('/main/' + type);
230
+    console.log(sendData);
231
+    this.myService.sendMsg(sendData);
232
+    this.router.navigateByUrl("/main/" + type);
247
   }
233
   }
248
 
234
 
249
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
235
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
@@ -262,17 +248,15 @@ export class DeptStatisticsComponent implements OnInit {
262
   searchTimer(fun, e, those) {
248
   searchTimer(fun, e, those) {
263
     let that = this;
249
     let that = this;
264
     that.isLoading = true;
250
     that.isLoading = true;
265
-    fun(e, those)
251
+    fun(e, those);
266
   }
252
   }
267
 
253
 
268
   // 截取意见内容(ie内核截取)
254
   // 截取意见内容(ie内核截取)
269
   spliceContent(con) {
255
   spliceContent(con) {
270
-    if (con.length >= 41 && navigator.userAgent.indexOf('Trident') > -1) {
271
-      return con.slice(0, 20) + '...'
256
+    if (con.length >= 41 && navigator.userAgent.indexOf("Trident") > -1) {
257
+      return con.slice(0, 20) + "...";
272
     } else {
258
     } else {
273
       return con;
259
       return con;
274
     }
260
     }
275
   }
261
   }
276
-
277
 }
262
 }
278
-

+ 2 - 40
src/app/views/group-management/group-management.component.ts

@@ -28,14 +28,13 @@ export class GroupManagementComponent implements OnInit {
28
   })
28
   })
29
   osComponentRef1: OverlayScrollbarsComponent;
29
   osComponentRef1: OverlayScrollbarsComponent;
30
   ngOnInit() {
30
   ngOnInit() {
31
-    this.initCoopBtns();
31
+    this.coopBtns = this.tool.initCoopBtns(this.route);
32
     this.initForm();
32
     this.initForm();
33
     this.getHospitalList();
33
     this.getHospitalList();
34
     this.getGroupList();
34
     this.getGroupList();
35
     this.getScheduleList();
35
     this.getScheduleList();
36
     this.tableHeight = document.body.clientHeight - 267;
36
     this.tableHeight = document.body.clientHeight - 267;
37
   }
37
   }
38
-  menu: any = JSON.parse(localStorage.getItem("menu")) || []; //菜单
39
   isAllDisplayDataChecked = false;
38
   isAllDisplayDataChecked = false;
40
   isIndeterminate = false;
39
   isIndeterminate = false;
41
   listOfDisplayData: any[] = [];
40
   listOfDisplayData: any[] = [];
@@ -58,45 +57,8 @@ export class GroupManagementComponent implements OnInit {
58
   saveLoading: boolean = false; //批量打印按钮loading状态
57
   saveLoading: boolean = false; //批量打印按钮loading状态
59
 
58
 
60
   // 初始化增删改按钮
59
   // 初始化增删改按钮
61
-  coopBtns: any = {
62
-    look: false,
63
-    add: false,
64
-    edit: false,
65
-    del: false,
66
-  };
60
+  coopBtns: any = {};
67
 
61
 
68
-  initCoopBtns() {
69
-    // 二级菜单
70
-    let secondMenus = [];
71
-    this.menu.forEach((e) => {
72
-      e.childrens.forEach((el) => {
73
-        secondMenus.push(el);
74
-      });
75
-    });
76
-    let link = this.route.parent.snapshot.routeConfig.path;
77
-    let btns = [];
78
-    secondMenus.forEach((e) => {
79
-      if (e.link == link) {
80
-        btns = e.childrens || [];
81
-      }
82
-    });
83
-    btns.forEach((e) => {
84
-      switch (e.link) {
85
-        case "look":
86
-          this.coopBtns.look = true;
87
-          break;
88
-        case "add":
89
-          this.coopBtns.add = true;
90
-          break;
91
-        case "edit":
92
-          this.coopBtns.edit = true;
93
-          break;
94
-        case "del":
95
-          this.coopBtns.del = true;
96
-          break;
97
-      }
98
-    });
99
-  }
100
   // 分组列表
62
   // 分组列表
101
   loading1 = false;
63
   loading1 = false;
102
   getGroupList() {
64
   getGroupList() {

+ 5 - 44
src/app/views/holidays-management/holidays-management.component.ts

@@ -3,6 +3,7 @@ import { MainService } from "../../services/main.service";
3
 import { ActivatedRoute, Router } from "@angular/router";
3
 import { ActivatedRoute, Router } from "@angular/router";
4
 
4
 
5
 import { NzMessageService } from "ng-zorro-antd/message";
5
 import { NzMessageService } from "ng-zorro-antd/message";
6
+import { ToolService } from "src/app/services/tool.service";
6
 
7
 
7
 @Component({
8
 @Component({
8
   selector: "app-holidays-management",
9
   selector: "app-holidays-management",
@@ -13,16 +14,16 @@ export class HolidaysManagementComponent implements OnInit {
13
   constructor(
14
   constructor(
14
     private mainService: MainService,
15
     private mainService: MainService,
15
     private msg: NzMessageService,
16
     private msg: NzMessageService,
16
-    private route: ActivatedRoute
17
+    private route: ActivatedRoute,
18
+    private tool: ToolService
17
   ) {}
19
   ) {}
18
 
20
 
19
   ngOnInit() {
21
   ngOnInit() {
20
-    this.initCoopBtns();
22
+    this.coopBtns = this.tool.initCoopBtns(this.route);
21
     this.initDates(); //初始化日历选中情况
23
     this.initDates(); //初始化日历选中情况
22
     this.getSyncWorkDay();
24
     this.getSyncWorkDay();
23
   }
25
   }
24
 
26
 
25
-  menu: any = JSON.parse(localStorage.getItem("menu")) || []; //菜单
26
   promptContent: string; //操作提示框提示信息
27
   promptContent: string; //操作提示框提示信息
27
   ifSuccess: boolean; //操作成功/失败
28
   ifSuccess: boolean; //操作成功/失败
28
   promptInfo: string; //操作结果提示信息
29
   promptInfo: string; //操作结果提示信息
@@ -44,47 +45,7 @@ export class HolidaysManagementComponent implements OnInit {
44
   btnLoading: boolean = false; //提交按钮loading状态
45
   btnLoading: boolean = false; //提交按钮loading状态
45
 
46
 
46
   // 初始化增删改按钮
47
   // 初始化增删改按钮
47
-  coopBtns: any = {
48
-    look: false,
49
-    add: false,
50
-    edit: false,
51
-    del: false,
52
-  };
53
-
54
-  initCoopBtns() {
55
-    // 二级菜单
56
-    let secondMenus = [];
57
-    this.menu.forEach((e) => {
58
-      e.childrens.forEach((el) => {
59
-        secondMenus.push(el);
60
-      });
61
-    });
62
-    console.log(secondMenus);
63
-    let link = this.route.parent.snapshot.routeConfig.path;
64
-    let btns = [];
65
-    secondMenus.forEach((e) => {
66
-      if (e.link == link) {
67
-        btns = e.childrens || [];
68
-      }
69
-    });
70
-    btns.forEach((e) => {
71
-      switch (e.link) {
72
-        case "look":
73
-          this.coopBtns.look = true;
74
-          break;
75
-        case "add":
76
-          this.coopBtns.add = true;
77
-          break;
78
-        case "edit":
79
-          this.coopBtns.edit = true;
80
-          break;
81
-        case "del":
82
-          this.coopBtns.del = true;
83
-          break;
84
-      }
85
-    });
86
-    console.log(this.coopBtns);
87
-  }
48
+  coopBtns: any = {};
88
   //设置自动同步国家法定节假日
49
   //设置自动同步国家法定节假日
89
   setSyncWorkDay(e) {
50
   setSyncWorkDay(e) {
90
     this.syncWorkDayObj.syncWorkDay = e;
51
     this.syncWorkDayObj.syncWorkDay = e;

+ 9 - 29
src/app/views/hospital-config/hospital-config.component.ts

@@ -23,11 +23,7 @@ export class HospitalConfigComponent implements OnInit {
23
   deptList = []; //科室列表
23
   deptList = []; //科室列表
24
   groupList = []; //组列表
24
   groupList = []; //组列表
25
   onSearchSubject = new Subject(); //搜索防抖
25
   onSearchSubject = new Subject(); //搜索防抖
26
-  coopBtns = {
27
-    //初始化权限
28
-    edit: false,
29
-  };
30
-  menu = JSON.parse(localStorage.getItem("menu")) || []; //菜单
26
+  coopBtns = {};
31
   constructor(
27
   constructor(
32
     private mainService: MainService,
28
     private mainService: MainService,
33
     private fb: FormBuilder,
29
     private fb: FormBuilder,
@@ -46,7 +42,7 @@ export class HospitalConfigComponent implements OnInit {
46
         }
42
         }
47
       });
43
       });
48
     });
44
     });
49
-    this.initCoopBtns();
45
+    this.coopBtns = this.tool.initCoopBtns(this.route);
50
     this.getInit();
46
     this.getInit();
51
   }
47
   }
52
   // 根据科室id查科室
48
   // 根据科室id查科室
@@ -125,7 +121,7 @@ export class HospitalConfigComponent implements OnInit {
125
                 this.validateForm.controls[config.key].setValue(config.value);
121
                 this.validateForm.controls[config.key].setValue(config.value);
126
               }
122
               }
127
             });
123
             });
128
-          }else{
124
+          } else {
129
             this.isLoading = false;
125
             this.isLoading = false;
130
           }
126
           }
131
         });
127
         });
@@ -137,8 +133,11 @@ export class HospitalConfigComponent implements OnInit {
137
   // 获取系统配置列表
133
   // 获取系统配置列表
138
   getHospitalConfigList(hosId) {
134
   getHospitalConfigList(hosId) {
139
     let postData = { idx: 0, sum: 100, hospitalConfig: { hosId } };
135
     let postData = { idx: 0, sum: 100, hospitalConfig: { hosId } };
140
-    return this.mainService
141
-      .getFetchDataList("simple/data", "hospitalConfig", postData);
136
+    return this.mainService.getFetchDataList(
137
+      "simple/data",
138
+      "hospitalConfig",
139
+      postData
140
+    );
142
   }
141
   }
143
   // 获取角色列表
142
   // 获取角色列表
144
   getRoleList() {
143
   getRoleList() {
@@ -182,26 +181,7 @@ export class HospitalConfigComponent implements OnInit {
182
     this.searchLoading = true;
181
     this.searchLoading = true;
183
     this.onSearchSubject.next(e);
182
     this.onSearchSubject.next(e);
184
   }
183
   }
185
-  // 获取当前菜单权限
186
-  initCoopBtns() {
187
-    // 二级菜单
188
-    let secondMenus = [];
189
-    this.menu.forEach((e) => {
190
-      e.childrens.forEach((el) => {
191
-        secondMenus.push(el);
192
-      });
193
-    });
194
-    let link = this.route.parent.snapshot.routeConfig.path;
195
-    let btns = [];
196
-    secondMenus.forEach((e) => {
197
-      if (e.link == link) {
198
-        btns = e.childrens || [];
199
-      }
200
-    });
201
-    btns.forEach((e) => {
202
-      this.coopBtns[e.link] = true;
203
-    });
204
-  }
184
+
205
   // 保存
185
   // 保存
206
   submitForm(): void {
186
   submitForm(): void {
207
     for (const i in this.validateForm.controls) {
187
     for (const i in this.validateForm.controls) {

+ 79 - 107
src/app/views/hospital-management/hospital-management.component.ts

@@ -1,113 +1,82 @@
1
-import { Component, OnInit } from '@angular/core';
2
-import { FormBuilder, Validators, FormGroup, FormControl } from '@angular/forms';
3
-import { ActivatedRoute, Router } from "@angular/router"
1
+import { Component, OnInit } from "@angular/core";
2
+import { FormBuilder, Validators, FormGroup } from "@angular/forms";
3
+import { ActivatedRoute } from "@angular/router";
4
 
4
 
5
-import { MainService } from "../../services/main.service"
5
+import { MainService } from "../../services/main.service";
6
+import { ToolService } from "src/app/services/tool.service";
6
 
7
 
7
 @Component({
8
 @Component({
8
-  selector: 'app-hospital-management',
9
-  templateUrl: './hospital-management.component.html',
10
-  styleUrls: ['./hospital-management.component.less']
9
+  selector: "app-hospital-management",
10
+  templateUrl: "./hospital-management.component.html",
11
+  styleUrls: ["./hospital-management.component.less"],
11
 })
12
 })
12
 export class HospitalManagementComponent implements OnInit {
13
 export class HospitalManagementComponent implements OnInit {
13
-
14
-  constructor(private fb: FormBuilder, private mainService: MainService, private route: ActivatedRoute, private router: Router) { }
14
+  constructor(
15
+    private fb: FormBuilder,
16
+    private mainService: MainService,
17
+    private route: ActivatedRoute,
18
+    private tool: ToolService
19
+  ) {}
15
 
20
 
16
   ngOnInit() {
21
   ngOnInit() {
17
-    this.initCoopBtns();
18
-    this.getList()
22
+    this.coopBtns = this.tool.initCoopBtns(this.route);
23
+    this.getList();
19
     this.initForm();
24
     this.initForm();
20
   }
25
   }
21
 
26
 
22
-  menu: any = JSON.parse(localStorage.getItem('menu')) || [];//菜单
23
-  currentUserAccount: any = JSON.parse(localStorage.getItem('user')).user.account;//当前登录人账号
24
-  listOfData: any[] = [];//表格数据
25
-  pageIndex: number = 1;//表格当前页码
26
-  pageSize: number = 10;//表格每页展示条数
27
-  listLength: number = 10;//表格总数据量
28
-  modal: boolean = false;//新增/编辑模态框
29
-  add: boolean;//true:新增;false:编辑
30
-  validateForm: FormGroup;//新增/编辑表单
31
-  coopId: number;//当前操作列id
27
+  currentUserAccount: any = JSON.parse(localStorage.getItem("user")).user
28
+    .account; //当前登录人账号
29
+  listOfData: any[] = []; //表格数据
30
+  pageIndex: number = 1; //表格当前页码
31
+  pageSize: number = 10; //表格每页展示条数
32
+  listLength: number = 10; //表格总数据量
33
+  modal: boolean = false; //新增/编辑模态框
34
+  add: boolean; //true:新增;false:编辑
35
+  validateForm: FormGroup; //新增/编辑表单
36
+  coopId: number; //当前操作列id
32
 
37
 
33
-  promptContent: string;//操作提示框提示信息
34
-  ifSuccess: boolean;//操作成功/失败
35
-  promptInfo: string;//操作结果提示信息
36
-  promptModalShow: boolean;//操作提示框是否展示
38
+  promptContent: string; //操作提示框提示信息
39
+  ifSuccess: boolean; //操作成功/失败
40
+  promptInfo: string; //操作结果提示信息
41
+  promptModalShow: boolean; //操作提示框是否展示
37
 
42
 
38
-  btnLoading: boolean = false;//确认按钮loading状态
43
+  btnLoading: boolean = false; //确认按钮loading状态
39
 
44
 
40
   // 初始化增删改按钮
45
   // 初始化增删改按钮
41
-  coopBtns: any = {
42
-    look: false,
43
-    add: false,
44
-    edit: false,
45
-    del: false
46
-  };
47
-  initCoopBtns() {
48
-    // 二级菜单
49
-    let secondMenus = []
50
-    this.menu.forEach(e => {
51
-      e.childrens.forEach(el => {
52
-        secondMenus.push(el)
53
-      });
54
-    });
55
-    console.log(secondMenus)
56
-    let link = this.route.parent.snapshot.routeConfig.path;
57
-    let btns = []
58
-    secondMenus.forEach(e => {
59
-      if (e.link == link) {
60
-        btns = e.childrens || [];
61
-      }
62
-    });
63
-    btns.forEach(e => {
64
-      switch (e.link) {
65
-        case 'look':
66
-          this.coopBtns.look = true;
67
-          break;
68
-        case 'add':
69
-          this.coopBtns.add = true;
70
-          break;
71
-        case 'edit':
72
-          this.coopBtns.edit = true;
73
-          break;
74
-        case 'del':
75
-          this.coopBtns.del = true;
76
-          break;
77
-      }
78
-    })
79
-    console.log(this.coopBtns);
80
-  }
46
+  coopBtns: any = {};
47
+
81
   // 表格数据
48
   // 表格数据
82
   loading1 = false;
49
   loading1 = false;
83
   getList() {
50
   getList() {
84
     let data = {
51
     let data = {
85
       idx: this.pageIndex - 1,
52
       idx: this.pageIndex - 1,
86
-      sum: this.pageSize
87
-    }
53
+      sum: this.pageSize,
54
+    };
88
     this.loading1 = true;
55
     this.loading1 = true;
89
-    this.mainService.getFetchDataList('data', 'hospital', data).subscribe(data => {
90
-      this.loading1 = false;
91
-      this.listOfData = data.list;
92
-      this.listLength = data.totalNum;
93
-    })
56
+    this.mainService
57
+      .getFetchDataList("data", "hospital", data)
58
+      .subscribe((data) => {
59
+        this.loading1 = false;
60
+        this.listOfData = data.list;
61
+        this.listLength = data.totalNum;
62
+      });
94
   }
63
   }
95
 
64
 
96
   addModal() {
65
   addModal() {
97
     this.add = true;
66
     this.add = true;
98
     this.modal = true;
67
     this.modal = true;
99
-    this.validateForm.controls.hospitalName.setValue('');
100
-    this.validateForm.controls.hospitalNum.setValue('');
68
+    this.validateForm.controls.hospitalName.setValue("");
69
+    this.validateForm.controls.hospitalNum.setValue("");
101
   }
70
   }
102
   hideAddModal() {
71
   hideAddModal() {
103
     this.modal = false;
72
     this.modal = false;
104
-    this.initForm()
73
+    this.initForm();
105
   }
74
   }
106
   // 初始化新增form表单
75
   // 初始化新增form表单
107
   initForm() {
76
   initForm() {
108
     this.validateForm = this.fb.group({
77
     this.validateForm = this.fb.group({
109
       hospitalName: [null, [Validators.required]],
78
       hospitalName: [null, [Validators.required]],
110
-      hospitalNum: [null, [Validators.required]]
79
+      hospitalNum: [null, [Validators.required]],
111
     });
80
     });
112
   }
81
   }
113
 
82
 
@@ -123,22 +92,24 @@ export class HospitalManagementComponent implements OnInit {
123
     let data = {
92
     let data = {
124
       hospital: {
93
       hospital: {
125
         hosName: that.validateForm.value.hospitalName,
94
         hosName: that.validateForm.value.hospitalName,
126
-        hosNo: that.validateForm.value.hospitalNum
127
-      }
128
-    }
95
+        hosNo: that.validateForm.value.hospitalNum,
96
+      },
97
+    };
129
     if (!that.add) {
98
     if (!that.add) {
130
-      data.hospital['id'] = that.coopId;
99
+      data.hospital["id"] = that.coopId;
131
     }
100
     }
132
-    that.mainService.coopData((that.add ? 'addData' : 'updData'), 'hospital', data).subscribe(data => {
133
-      that.btnLoading = false;
134
-      that.hideAddModal();
135
-      if (data.status == 200) {
136
-        that.showPromptModal((that.add ? '新增' : '编辑'), true, '');
137
-        that.initForm();
138
-      } else {
139
-        that.showPromptModal((that.add ? '新增' : '编辑'), false, data.msg);
140
-      }
141
-    })
101
+    that.mainService
102
+      .coopData(that.add ? "addData" : "updData", "hospital", data)
103
+      .subscribe((data) => {
104
+        that.btnLoading = false;
105
+        that.hideAddModal();
106
+        if (data.status == 200) {
107
+          that.showPromptModal(that.add ? "新增" : "编辑", true, "");
108
+          that.initForm();
109
+        } else {
110
+          that.showPromptModal(that.add ? "新增" : "编辑", false, data.msg);
111
+        }
112
+      });
142
   }
113
   }
143
 
114
 
144
   // 编辑
115
   // 编辑
@@ -150,7 +121,7 @@ export class HospitalManagementComponent implements OnInit {
150
     this.validateForm.controls.hospitalNum.setValue(data.hosNo);
121
     this.validateForm.controls.hospitalNum.setValue(data.hosNo);
151
   }
122
   }
152
 
123
 
153
-  delModal: boolean = false;//删除模态框
124
+  delModal: boolean = false; //删除模态框
154
   showDelModal(id) {
125
   showDelModal(id) {
155
     this.delModal = true;
126
     this.delModal = true;
156
     this.coopId = id;
127
     this.coopId = id;
@@ -162,22 +133,25 @@ export class HospitalManagementComponent implements OnInit {
162
     this.delModal = false;
133
     this.delModal = false;
163
     var that = this;
134
     var that = this;
164
     that.btnLoading = true;
135
     that.btnLoading = true;
165
-    that.mainService.coopData('rmvData', 'hospital', [that.coopId]).subscribe(data => {
166
-      that.btnLoading = false;
167
-      if (data.status == 200) {
168
-        if (that.listOfData.length == 1 && that.pageIndex == Math.ceil(that.listLength / that.pageSize)) {
169
-          that.listLength--;
170
-          that.pageIndex = Math.ceil(that.listLength / that.pageSize);
136
+    that.mainService
137
+      .coopData("rmvData", "hospital", [that.coopId])
138
+      .subscribe((data) => {
139
+        that.btnLoading = false;
140
+        if (data.status == 200) {
141
+          if (
142
+            that.listOfData.length == 1 &&
143
+            that.pageIndex == Math.ceil(that.listLength / that.pageSize)
144
+          ) {
145
+            that.listLength--;
146
+            that.pageIndex = Math.ceil(that.listLength / that.pageSize);
147
+          }
148
+          this.showPromptModal("删除", true, "");
149
+        } else {
150
+          this.showPromptModal("删除", false, data.msg);
171
         }
151
         }
172
-        this.showPromptModal('删除', true, '');
173
-      } else {
174
-        this.showPromptModal('删除', false, data.msg);
175
-      }
176
-    })
152
+      });
177
   }
153
   }
178
 
154
 
179
-
180
-
181
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
155
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
182
   showPromptModal(con, success, promptInfo?) {
156
   showPromptModal(con, success, promptInfo?) {
183
     this.promptModalShow = false;
157
     this.promptModalShow = false;
@@ -189,6 +163,4 @@ export class HospitalManagementComponent implements OnInit {
189
     }, 100);
163
     }, 100);
190
     this.getList();
164
     this.getList();
191
   }
165
   }
192
-
193
-
194
 }
166
 }

文件差异内容过多而无法显示
+ 535 - 516
src/app/views/job-assignment/job-assignment.component.ts


文件差异内容过多而无法显示
+ 437 - 452
src/app/views/jurisdiction-management/jurisdiction-management.component.ts


+ 3 - 42
src/app/views/office-management/office-management.component.ts

@@ -34,12 +34,11 @@ export class OfficeManagementComponent implements OnInit {
34
   ) {}
34
   ) {}
35
 
35
 
36
   ngOnInit() {
36
   ngOnInit() {
37
-    this.initCoopBtns();
37
+    this.coopBtns = this.tool.initCoopBtns(this.route);
38
     this.initForm();
38
     this.initForm();
39
     this.getAllHospital();
39
     this.getAllHospital();
40
     this.getType();
40
     this.getType();
41
   }
41
   }
42
-  menu: any = JSON.parse(localStorage.getItem("menu")) || []; //菜单
43
   listOfData: any[] = []; //表格数据
42
   listOfData: any[] = []; //表格数据
44
   promptContent: string; //操作提示框提示信息
43
   promptContent: string; //操作提示框提示信息
45
   ifSuccess: boolean; //操作成功/失败
44
   ifSuccess: boolean; //操作成功/失败
@@ -65,12 +64,7 @@ export class OfficeManagementComponent implements OnInit {
65
   deptsPhoneId = 1; //科室电话自增id
64
   deptsPhoneId = 1; //科室电话自增id
66
 
65
 
67
   // 初始化增删改按钮
66
   // 初始化增删改按钮
68
-  coopBtns: any = {
69
-    look: false,
70
-    add: false,
71
-    edit: false,
72
-    del: false,
73
-  };
67
+  coopBtns: any = {};
74
   // 新添加科室号码
68
   // 新添加科室号码
75
   addDeptPhone(e: MouseEvent) {
69
   addDeptPhone(e: MouseEvent) {
76
     e.preventDefault();
70
     e.preventDefault();
@@ -96,40 +90,7 @@ export class OfficeManagementComponent implements OnInit {
96
     }
90
     }
97
     // -------------判断添加按钮是否禁用 end
91
     // -------------判断添加按钮是否禁用 end
98
   }
92
   }
99
-  initCoopBtns() {
100
-    // 二级菜单
101
-    let secondMenus = [];
102
-    this.menu.forEach((e) => {
103
-      e.childrens.forEach((el) => {
104
-        secondMenus.push(el);
105
-      });
106
-    });
107
-    console.log(secondMenus);
108
-    let link = this.route.parent.snapshot.routeConfig.path;
109
-    let btns = [];
110
-    secondMenus.forEach((e) => {
111
-      if (e.link == link) {
112
-        btns = e.childrens || [];
113
-      }
114
-    });
115
-    btns.forEach((e) => {
116
-      switch (e.link) {
117
-        case "look":
118
-          this.coopBtns.look = true;
119
-          break;
120
-        case "add":
121
-          this.coopBtns.add = true;
122
-          break;
123
-        case "edit":
124
-          this.coopBtns.edit = true;
125
-          break;
126
-        case "del":
127
-          this.coopBtns.del = true;
128
-          break;
129
-      }
130
-    });
131
-    console.log(this.coopBtns);
132
-  }
93
+
133
   // 搜索
94
   // 搜索
134
   search() {
95
   search() {
135
     this.pageIndex = 1;
96
     this.pageIndex = 1;

+ 2 - 38
src/app/views/order-management/order-management.component.ts

@@ -24,12 +24,11 @@ export class OrderManagementComponent implements OnInit {
24
       fun.call(this, v[1]);
24
       fun.call(this, v[1]);
25
     });
25
     });
26
     this.initOrderType();
26
     this.initOrderType();
27
-    this.initCoopBtns();
27
+    this.coopBtns = this.tool.initCoopBtns(this.route);
28
     this.getAllHos();
28
     this.getAllHos();
29
     this.getGdStates();
29
     this.getGdStates();
30
   }
30
   }
31
 
31
 
32
-  menu: any = JSON.parse(localStorage.getItem("menu")) || []; //菜单
33
   listOfData: any[] = []; //表格数据
32
   listOfData: any[] = []; //表格数据
34
 
33
 
35
   modal: boolean = false; //回复模态框
34
   modal: boolean = false; //回复模态框
@@ -74,43 +73,8 @@ export class OrderManagementComponent implements OnInit {
74
   }
73
   }
75
 
74
 
76
   // 初始化增删改按钮
75
   // 初始化增删改按钮
77
-  coopBtns: any = {
78
-    look: false,
79
-    export: false,
80
-    del: false,
81
-  };
76
+  coopBtns: any = {};
82
 
77
 
83
-  initCoopBtns() {
84
-    // 二级菜单
85
-    let secondMenus = [];
86
-    this.menu.forEach((e) => {
87
-      e.childrens.forEach((el) => {
88
-        secondMenus.push(el);
89
-      });
90
-    });
91
-    console.log(secondMenus);
92
-    let link = this.route.parent.snapshot.routeConfig.path;
93
-    let btns = [];
94
-    secondMenus.forEach((e) => {
95
-      if (e.link == link) {
96
-        btns = e.childrens || [];
97
-      }
98
-    });
99
-    btns.forEach((e) => {
100
-      switch (e.link) {
101
-        case "look":
102
-          this.coopBtns.look = true;
103
-          break;
104
-        case "export":
105
-          this.coopBtns.export = true;
106
-          break;
107
-        case "del":
108
-          this.coopBtns.del = true;
109
-          break;
110
-      }
111
-    });
112
-    console.log(this.coopBtns);
113
-  }
114
   // 搜索
78
   // 搜索
115
   search() {
79
   search() {
116
     this.pageIndex = 1;
80
     this.pageIndex = 1;

+ 211 - 225
src/app/views/order-statistics/order-statistics.component.ts

@@ -1,143 +1,116 @@
1
-import { Component, OnInit } from '@angular/core';
2
-import { ActivatedRoute, Router } from "@angular/router"
3
-import { differenceInCalendarDays, endOfMonth, endOfYear } from 'date-fns';
1
+import { Component, OnInit } from "@angular/core";
2
+import { ActivatedRoute, Router } from "@angular/router";
3
+import { differenceInCalendarDays, endOfMonth, endOfYear } from "date-fns";
4
 
4
 
5
 import { MainService } from "../../services/main.service";
5
 import { MainService } from "../../services/main.service";
6
 import { DateService } from "../../services/date.service";
6
 import { DateService } from "../../services/date.service";
7
 import { MyServiceService } from "../../services/my-service.service";
7
 import { MyServiceService } from "../../services/my-service.service";
8
-import { ToolService } from '../../services/tool.service';
8
+import { ToolService } from "../../services/tool.service";
9
 
9
 
10
 @Component({
10
 @Component({
11
-  selector: 'app-order-statistics',
12
-  templateUrl: './order-statistics.component.html',
13
-  styleUrls: ['./order-statistics.component.less']
11
+  selector: "app-order-statistics",
12
+  templateUrl: "./order-statistics.component.html",
13
+  styleUrls: ["./order-statistics.component.less"],
14
 })
14
 })
15
 export class OrderStatisticsComponent implements OnInit {
15
 export class OrderStatisticsComponent implements OnInit {
16
-
17
-  constructor(private route: ActivatedRoute, private router: Router, private mainService: MainService, private dateService: DateService, private myService: MyServiceService, private tool: ToolService) { }
16
+  constructor(
17
+    private route: ActivatedRoute,
18
+    private router: Router,
19
+    private mainService: MainService,
20
+    private dateService: DateService,
21
+    private myService: MyServiceService,
22
+    private tool: ToolService
23
+  ) {}
18
 
24
 
19
   ngOnInit() {
25
   ngOnInit() {
20
-    // this.getSearchData()
21
-    this.initCoopBtns();
22
-    this.getAllHos()
23
-    this.changeDateRange(this.defRange)
24
-    this.search()
25
-
26
+    this.coopBtns = this.tool.initCoopBtns(this.route);
27
+    this.getAllHos();
28
+    this.changeDateRange(this.defRange);
29
+    this.search();
26
   }
30
   }
27
 
31
 
28
-  menu: any = JSON.parse(localStorage.getItem('menu')) || [];//菜单
29
-
30
-  dateType: string = 'day';//选中时间维度
32
+  dateType: string = "day"; //选中时间维度
31
   dateTypes: any = [
33
   dateTypes: any = [
32
     {
34
     {
33
-      label: '按天统计',
34
-      value: 'day'
35
-    }, {
36
-      label: '按月统计',
37
-      value: 'month'
38
-    }, {
39
-      label: '按年统计',
40
-      value: 'year'
35
+      label: "按天统计",
36
+      value: "day",
37
+    },
38
+    {
39
+      label: "按月统计",
40
+      value: "month",
41
     },
41
     },
42
-  ];//时间维度
43
-  defRange = '1';//默认上周
42
+    {
43
+      label: "按年统计",
44
+      value: "year",
45
+    },
46
+  ]; //时间维度
47
+  defRange = "1"; //默认上周
44
   defRanges = [
48
   defRanges = [
45
     {
49
     {
46
-      label: '上周',
47
-      id: 1
48
-    }, {
49
-      label: '上月',
50
-      id: 2
51
-    }, {
52
-      label: '上年',
53
-      id: 3
50
+      label: "上周",
51
+      id: 1,
54
     },
52
     },
55
-  ];//时间默认区间
56
-
57
-  listOfData: any[] = [];//表格数据
58
-  pageIndex: number = 1;//表格当前页码
59
-  pageSize: number = 10;//表格每页展示条数
60
-  listLength: number = 10;//表格总数据量
53
+    {
54
+      label: "上月",
55
+      id: 2,
56
+    },
57
+    {
58
+      label: "上年",
59
+      id: 3,
60
+    },
61
+  ]; //时间默认区间
61
 
62
 
62
-  alldepart: any = [];//当前院区所属科室
63
-  dateRange: any = [];//发起时间区间 天
64
-  monthRangeStart: any;//发起时间 月 起
65
-  monthRangeEnd: any;//发起时间 月 止
66
-  yearRangeStart: any;//发起时间 年 起
67
-  yearRangeEnd: any;//发起时间 年 止
63
+  listOfData: any[] = []; //表格数据
64
+  pageIndex: number = 1; //表格当前页码
65
+  pageSize: number = 10; //表格每页展示条数
66
+  listLength: number = 10; //表格总数据量
68
 
67
 
69
-  promptContent: string;//操作提示框提示信息
70
-  ifSuccess: boolean;//操作成功/失败
71
-  promptInfo: string;//操作结果提示信息
72
-  promptModalShow: boolean;//操作提示框是否展示
68
+  alldepart: any = []; //当前院区所属科室
69
+  dateRange: any = []; //发起时间区间 天
70
+  monthRangeStart: any; //发起时间 月 起
71
+  monthRangeEnd: any; //发起时间 月 止
72
+  yearRangeStart: any; //发起时间 年 起
73
+  yearRangeEnd: any; //发起时间 年 止
73
 
74
 
75
+  promptContent: string; //操作提示框提示信息
76
+  ifSuccess: boolean; //操作成功/失败
77
+  promptInfo: string; //操作结果提示信息
78
+  promptModalShow: boolean; //操作提示框是否展示
74
 
79
 
75
   // 初始化增删改按钮
80
   // 初始化增删改按钮
76
-  coopBtns: any = {
77
-    look: false,
78
-    export: false
79
-  };
80
-  initCoopBtns() {
81
-    // 二级菜单
82
-    let secondMenus = []
83
-    this.menu.forEach(e => {
84
-      e.childrens.forEach(el => {
85
-        secondMenus.push(el)
86
-      });
87
-    });
88
-    // console.log(secondMenus)
89
-    let link = this.route.parent.snapshot.routeConfig.path;
90
-    let btns = []
91
-    secondMenus.forEach(e => {
92
-      if (e.link == link) {
93
-        btns = e.childrens || [];
94
-      }
95
-    });
96
-    btns.forEach(e => {
97
-      switch (e.link) {
98
-        case 'look':
99
-          this.coopBtns.look = true;
100
-          break;
101
-        case 'export':
102
-          this.coopBtns.export = true;
103
-          break;
104
-      }
105
-    })
106
-    // console.log(this.coopBtns);
107
-  }
108
-  searchData: any = {} // 综合统计页面带过来的参数
81
+  coopBtns: any = {};
82
+  searchData: any = {}; // 综合统计页面带过来的参数
109
   getSearchData() {
83
   getSearchData() {
110
     let that = this;
84
     let that = this;
111
-    let sub = that.myService.getMsg().subscribe(msg => {
85
+    let sub = that.myService.getMsg().subscribe((msg) => {
112
       // 从综合报表跳转过来
86
       // 从综合报表跳转过来
113
-      that.searchData = msg
114
-      console.log(that.searchData)
115
-      console.log(66)
116
-      sub.unsubscribe()//取消订阅,否则订阅函数会累加执行
117
-      that.hospital = that.searchData['hosId']
118
-      that.changeDate(that.searchData['range'])
119
-      that.defRange = that.searchData['defRange']
120
-      that.search()
121
-    })
87
+      that.searchData = msg;
88
+      console.log(that.searchData);
89
+      console.log(66);
90
+      sub.unsubscribe(); //取消订阅,否则订阅函数会累加执行
91
+      that.hospital = that.searchData["hosId"];
92
+      that.changeDate(that.searchData["range"]);
93
+      that.defRange = that.searchData["defRange"];
94
+      that.search();
95
+    });
122
     // 不是从综合报表页面跳转过来的
96
     // 不是从综合报表页面跳转过来的
123
     // setTimeout(() => {
97
     // setTimeout(() => {
124
     //   if (!sub['isStopped']) {
98
     //   if (!sub['isStopped']) {
125
-    that.changeDateRange(that.defRange)
126
-    that.search()
99
+    that.changeDateRange(that.defRange);
100
+    that.search();
127
     //   }
101
     //   }
128
     // }, 100);
102
     // }, 100);
129
-
130
   }
103
   }
131
   // 搜索
104
   // 搜索
132
   search(num?: number) {
105
   search(num?: number) {
133
     if (this.hospital) {
106
     if (this.hospital) {
134
-      this.searchData['hosId'] = this.hospital;
107
+      this.searchData["hosId"] = this.hospital;
135
     }
108
     }
136
     if (this.startDate) {
109
     if (this.startDate) {
137
-      this.searchData['dateRange'] = {
138
-        start: this.startDate + ' ' + '00:00:00',
139
-        end: this.endDate + ' ' + '23:59:59'
140
-      }
110
+      this.searchData["dateRange"] = {
111
+        start: this.startDate + " " + "00:00:00",
112
+        end: this.endDate + " " + "23:59:59",
113
+      };
141
     }
114
     }
142
     if (num !== undefined) {
115
     if (num !== undefined) {
143
       this.getList(num);
116
       this.getList(num);
@@ -151,35 +124,38 @@ export class OrderStatisticsComponent implements OnInit {
151
     let that = this;
124
     let that = this;
152
     let postData = {
125
     let postData = {
153
       hosId: that.hospital,
126
       hosId: that.hospital,
154
-      startTime: this.startDate + ' ' + '00:00:00',
155
-      endTime: this.endDate + ' ' + '23:59:59',
156
-      type: that.dateType
157
-    }
127
+      startTime: this.startDate + " " + "00:00:00",
128
+      endTime: this.endDate + " " + "23:59:59",
129
+      type: that.dateType,
130
+    };
158
     this.loading2 = true;
131
     this.loading2 = true;
159
-    that.mainService.exportReport('workOrder', postData).subscribe(data => {
160
-      this.loading2 = false;
161
-      this.showPromptModal('导出', true, '');
162
-      var file = new Blob([data], {
163
-        type: 'application/vnd.ms-excel'
164
-      });
165
-      //trick to download store a file having its URL
166
-      var fileURL = URL.createObjectURL(file);
167
-      var a = document.createElement('a');
168
-      a.href = fileURL;
169
-      a.target = '_blank';
170
-      a.download = '工单统计.xls';
171
-      document.body.appendChild(a);
172
-      a.click();
173
-    }, err => {
174
-      this.loading2 = false;
175
-      this.showPromptModal('导出', false, '');
176
-    })
132
+    that.mainService.exportReport("workOrder", postData).subscribe(
133
+      (data) => {
134
+        this.loading2 = false;
135
+        this.showPromptModal("导出", true, "");
136
+        var file = new Blob([data], {
137
+          type: "application/vnd.ms-excel",
138
+        });
139
+        //trick to download store a file having its URL
140
+        var fileURL = URL.createObjectURL(file);
141
+        var a = document.createElement("a");
142
+        a.href = fileURL;
143
+        a.target = "_blank";
144
+        a.download = "工单统计.xls";
145
+        document.body.appendChild(a);
146
+        a.click();
147
+      },
148
+      (err) => {
149
+        this.loading2 = false;
150
+        this.showPromptModal("导出", false, "");
151
+      }
152
+    );
177
   }
153
   }
178
   // 重置
154
   // 重置
179
   reset() {
155
   reset() {
180
-    this.changeDateType('day')
181
-    this.changeDateRange('1')
182
-    this.search()
156
+    this.changeDateType("day");
157
+    this.changeDateRange("1");
158
+    this.search();
183
   }
159
   }
184
   // 表格数据
160
   // 表格数据
185
   loading1 = false;
161
   loading1 = false;
@@ -193,74 +169,75 @@ export class OrderStatisticsComponent implements OnInit {
193
       startTime: this.searchData.dateRange.start,
169
       startTime: this.searchData.dateRange.start,
194
       endTime: this.searchData.dateRange.end,
170
       endTime: this.searchData.dateRange.end,
195
       hosId: this.searchData.hosId,
171
       hosId: this.searchData.hosId,
196
-      type: this.dateType
197
-    }
172
+      type: this.dateType,
173
+    };
198
     this.loading1 = true;
174
     this.loading1 = true;
199
-    this.mainService.postCustom('report', 'workOrder', postData).subscribe(result => {
200
-      this.loading1 = false;
201
-      this.listOfData = result.list || [];
202
-      this.listLength = result.totalNum;
203
-    })
204
-
175
+    this.mainService
176
+      .postCustom("report", "workOrder", postData)
177
+      .subscribe((result) => {
178
+        this.loading1 = false;
179
+        this.listOfData = result.list || [];
180
+        this.listLength = result.totalNum;
181
+      });
205
   }
182
   }
206
   // 获取院区
183
   // 获取院区
207
-  hospital: string;//选中院区
184
+  hospital: string; //选中院区
208
   getAllHos() {
185
   getAllHos() {
209
-    this.hospital = this.tool.getCurrentHospital().id + '';
186
+    this.hospital = this.tool.getCurrentHospital().id + "";
210
   }
187
   }
211
 
188
 
212
   // 修改时间展示维度
189
   // 修改时间展示维度
213
   changeDateType(res) {
190
   changeDateType(res) {
214
-    console.log(res, this.dateType)
191
+    console.log(res, this.dateType);
215
     this.dateType = res;
192
     this.dateType = res;
216
-    this.searchData['type'] = res;
217
-    console.log(this.searchData)
193
+    this.searchData["type"] = res;
194
+    console.log(this.searchData);
218
     switch (res) {
195
     switch (res) {
219
-      case 'day':
196
+      case "day":
220
         this.defRanges = [
197
         this.defRanges = [
221
           {
198
           {
222
-            label: '上周',
223
-            id: 1
224
-          }, {
225
-            label: '上月',
226
-            id: 2
227
-          }, {
228
-            label: '上年',
229
-            id: 3
199
+            label: "上周",
200
+            id: 1,
201
+          },
202
+          {
203
+            label: "上月",
204
+            id: 2,
230
           },
205
           },
231
-        ];//时间默认区间
232
-        this.defRange = '1';//默认上周
233
-        this.changeDateRange('1')
206
+          {
207
+            label: "上年",
208
+            id: 3,
209
+          },
210
+        ]; //时间默认区间
211
+        this.defRange = "1"; //默认上周
212
+        this.changeDateRange("1");
234
         break;
213
         break;
235
-      case 'month':
214
+      case "month":
236
         this.defRanges = [
215
         this.defRanges = [
237
           {
216
           {
238
-            label: '上月',
239
-            id: 2
240
-          }, {
241
-            label: '上年',
242
-            id: 3
217
+            label: "上月",
218
+            id: 2,
243
           },
219
           },
244
-        ];//时间默认区间
245
-        this.defRange = '2';//上月
246
-        this.changeDateRange('2')
220
+          {
221
+            label: "上年",
222
+            id: 3,
223
+          },
224
+        ]; //时间默认区间
225
+        this.defRange = "2"; //上月
226
+        this.changeDateRange("2");
247
         break;
227
         break;
248
-      case 'year':
228
+      case "year":
249
         this.defRanges = [
229
         this.defRanges = [
250
           {
230
           {
251
-            label: '上年',
252
-            id: 3
231
+            label: "上年",
232
+            id: 3,
253
           },
233
           },
254
-        ];//时间默认区间
255
-        this.defRange = '3';//默认上周
256
-        this.changeDateRange('3')
234
+        ]; //时间默认区间
235
+        this.defRange = "3"; //默认上周
236
+        this.changeDateRange("3");
257
         break;
237
         break;
258
-
259
     }
238
     }
260
-
261
   }
239
   }
262
 
240
 
263
-
264
   // 禁选日期
241
   // 禁选日期
265
   disabledDate = (current: Date): boolean => {
242
   disabledDate = (current: Date): boolean => {
266
     // Can not select days before today and today
243
     // Can not select days before today and today
@@ -271,108 +248,119 @@ export class OrderStatisticsComponent implements OnInit {
271
   disabledMonthStart = (current: Date): boolean => {
248
   disabledMonthStart = (current: Date): boolean => {
272
     // Can not select days before today and today
249
     // Can not select days before today and today
273
     let cur = differenceInCalendarDays(current, endOfMonth(this.today)) > 0;
250
     let cur = differenceInCalendarDays(current, endOfMonth(this.today)) > 0;
274
-    let staEnd = differenceInCalendarDays(current, this.monthRangeEnd) > 0
275
-    return (cur || staEnd);
251
+    let staEnd = differenceInCalendarDays(current, this.monthRangeEnd) > 0;
252
+    return cur || staEnd;
276
   };
253
   };
277
   // 禁选月份结束
254
   // 禁选月份结束
278
   disabledMonthEnd = (current: Date): boolean => {
255
   disabledMonthEnd = (current: Date): boolean => {
279
     // Can not select days before today and today
256
     // Can not select days before today and today
280
     let cur = differenceInCalendarDays(current, endOfMonth(this.today)) > 0;
257
     let cur = differenceInCalendarDays(current, endOfMonth(this.today)) > 0;
281
-    let staEnd = differenceInCalendarDays(this.monthRangeStart, current) > 0
282
-    return (cur || staEnd);
258
+    let staEnd = differenceInCalendarDays(this.monthRangeStart, current) > 0;
259
+    return cur || staEnd;
283
   };
260
   };
284
 
261
 
285
   // 禁选年份开始
262
   // 禁选年份开始
286
   disabledYearStart = (current: Date): boolean => {
263
   disabledYearStart = (current: Date): boolean => {
287
     // Can not select days before today and today
264
     // Can not select days before today and today
288
     let cur = differenceInCalendarDays(current, endOfYear(this.today)) > 0;
265
     let cur = differenceInCalendarDays(current, endOfYear(this.today)) > 0;
289
-    let staEnd = differenceInCalendarDays(current, this.yearRangeEnd) > 0
290
-    return (cur || staEnd);
266
+    let staEnd = differenceInCalendarDays(current, this.yearRangeEnd) > 0;
267
+    return cur || staEnd;
291
   };
268
   };
292
 
269
 
293
   // 禁选年份结束
270
   // 禁选年份结束
294
   disabledYearEnd = (current: Date): boolean => {
271
   disabledYearEnd = (current: Date): boolean => {
295
     // Can not select days before today and today
272
     // Can not select days before today and today
296
     let cur = differenceInCalendarDays(current, endOfYear(this.today)) > 0;
273
     let cur = differenceInCalendarDays(current, endOfYear(this.today)) > 0;
297
-    let staEnd = differenceInCalendarDays(this.yearRangeStart, current) > 0
298
-    return (cur || staEnd);
274
+    let staEnd = differenceInCalendarDays(this.yearRangeStart, current) > 0;
275
+    return cur || staEnd;
299
   };
276
   };
300
 
277
 
301
   // 日期选择 日
278
   // 日期选择 日
302
-  startDate: string;//发起时间开始
303
-  endDate: string;//发起时间结束
279
+  startDate: string; //发起时间开始
280
+  endDate: string; //发起时间结束
304
   changeDate(result?): void {
281
   changeDate(result?): void {
305
-    console.log(this.dateRange)
306
-    console.log(result)
282
+    console.log(this.dateRange);
283
+    console.log(result);
307
     this.dateRange = result;
284
     this.dateRange = result;
308
     if (!this.quick) {
285
     if (!this.quick) {
309
       // 不是快捷选择
286
       // 不是快捷选择
310
       this.defRange = null;
287
       this.defRange = null;
311
     }
288
     }
312
     if (!result || !result.length) {
289
     if (!result || !result.length) {
313
-      this.startDate = this.endDate = '';
290
+      this.startDate = this.endDate = "";
314
       return;
291
       return;
315
     }
292
     }
316
-    this.startDate = result[0].getFullYear() + '-' + (result[0].getMonth() + 1) + '-' + result[0].getDate();
317
-    this.endDate = result[1].getFullYear() + '-' + (result[1].getMonth() + 1) + '-' + result[1].getDate();
293
+    this.startDate =
294
+      result[0].getFullYear() +
295
+      "-" +
296
+      (result[0].getMonth() + 1) +
297
+      "-" +
298
+      result[0].getDate();
299
+    this.endDate =
300
+      result[1].getFullYear() +
301
+      "-" +
302
+      (result[1].getMonth() + 1) +
303
+      "-" +
304
+      result[1].getDate();
318
   }
305
   }
319
 
306
 
320
   // 月份选择
307
   // 月份选择
321
   changeMonthStart(result?) {
308
   changeMonthStart(result?) {
322
-    console.log(result)
323
-    this.monthRangeStart = result
309
+    console.log(result);
310
+    this.monthRangeStart = result;
324
     if (!this.quick) {
311
     if (!this.quick) {
325
       // 不是快捷选择
312
       // 不是快捷选择
326
       this.defRange = null;
313
       this.defRange = null;
327
     }
314
     }
328
     if (!result) {
315
     if (!result) {
329
-      this.startDate = this.endDate = '';
316
+      this.startDate = this.endDate = "";
330
       return;
317
       return;
331
     }
318
     }
332
-    this.startDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
319
+    this.startDate =
320
+      result.getFullYear() + "-" + (result.getMonth() + 1) + "-01";
333
     // this.endDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
321
     // this.endDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
334
   }
322
   }
335
   changeMonthEnd(result?) {
323
   changeMonthEnd(result?) {
336
-    console.log(result)
337
-    this.monthRangeEnd = result
324
+    console.log(result);
325
+    this.monthRangeEnd = result;
338
     if (!this.quick) {
326
     if (!this.quick) {
339
       // 不是快捷选择
327
       // 不是快捷选择
340
       this.defRange = null;
328
       this.defRange = null;
341
     }
329
     }
342
     if (!result) {
330
     if (!result) {
343
-      this.startDate = this.endDate = '';
331
+      this.startDate = this.endDate = "";
344
       return;
332
       return;
345
     }
333
     }
346
     // this.startDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
334
     // this.startDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
347
-    this.endDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-31';
335
+    this.endDate = result.getFullYear() + "-" + (result.getMonth() + 1) + "-31";
348
   }
336
   }
349
   // 年份选择
337
   // 年份选择
350
   changeYearStart(result?) {
338
   changeYearStart(result?) {
351
-    console.log(result)
352
-    this.yearRangeStart = result
339
+    console.log(result);
340
+    this.yearRangeStart = result;
353
     if (!this.quick) {
341
     if (!this.quick) {
354
       // 不是快捷选择
342
       // 不是快捷选择
355
       this.defRange = null;
343
       this.defRange = null;
356
     }
344
     }
357
     if (!result) {
345
     if (!result) {
358
-      this.startDate = this.endDate = '';
346
+      this.startDate = this.endDate = "";
359
       return;
347
       return;
360
     }
348
     }
361
-    this.startDate = result.getFullYear() + '-01-01';
349
+    this.startDate = result.getFullYear() + "-01-01";
362
     // this.endDate = result.getFullYear() + '-01-01';
350
     // this.endDate = result.getFullYear() + '-01-01';
363
   }
351
   }
364
   changeYearEnd(result?) {
352
   changeYearEnd(result?) {
365
-    console.log(result)
366
-    this.yearRangeEnd = result
353
+    console.log(result);
354
+    this.yearRangeEnd = result;
367
     if (!this.quick) {
355
     if (!this.quick) {
368
       // 不是快捷选择
356
       // 不是快捷选择
369
       this.defRange = null;
357
       this.defRange = null;
370
     }
358
     }
371
     if (!result) {
359
     if (!result) {
372
-      this.startDate = this.endDate = '';
360
+      this.startDate = this.endDate = "";
373
       return;
361
       return;
374
     }
362
     }
375
-    this.endDate = result.getFullYear() + '-12-31';
363
+    this.endDate = result.getFullYear() + "-12-31";
376
   }
364
   }
377
 
365
 
378
   // 日期选择 快速修改时间区间
366
   // 日期选择 快速修改时间区间
@@ -382,44 +370,43 @@ export class OrderStatisticsComponent implements OnInit {
382
     console.log(res);
370
     console.log(res);
383
     this.quick = true;
371
     this.quick = true;
384
     switch (res) {
372
     switch (res) {
385
-      case '1':
373
+      case "1":
386
         // 上周
374
         // 上周
387
         let lastweekstartdate = this.dateService.date().lastWeekStartDate;
375
         let lastweekstartdate = this.dateService.date().lastWeekStartDate;
388
         let lastweekenddate = this.dateService.date().lastWeekEndDate;
376
         let lastweekenddate = this.dateService.date().lastWeekEndDate;
389
-        console.log(lastweekstartdate, lastweekenddate)
390
-        this.changeDate([lastweekstartdate, lastweekenddate])
377
+        console.log(lastweekstartdate, lastweekenddate);
378
+        this.changeDate([lastweekstartdate, lastweekenddate]);
391
         break;
379
         break;
392
-      case '2':
380
+      case "2":
393
         // 上月
381
         // 上月
394
         let lastmonthstartdate = this.dateService.date().lastMonthStartDate;
382
         let lastmonthstartdate = this.dateService.date().lastMonthStartDate;
395
         let lastmonthenddate = this.dateService.date().lastMonthEndDate;
383
         let lastmonthenddate = this.dateService.date().lastMonthEndDate;
396
-        console.log(lastmonthstartdate, lastmonthenddate)
397
-        this.changeDate([lastmonthstartdate, lastmonthenddate])
398
-        this.changeMonthStart(lastmonthstartdate)
399
-        this.changeMonthEnd(lastmonthenddate)
384
+        console.log(lastmonthstartdate, lastmonthenddate);
385
+        this.changeDate([lastmonthstartdate, lastmonthenddate]);
386
+        this.changeMonthStart(lastmonthstartdate);
387
+        this.changeMonthEnd(lastmonthenddate);
400
         break;
388
         break;
401
-      case '3':
389
+      case "3":
402
         // 上年
390
         // 上年
403
         let lastyearstartdate = this.dateService.date().lastYearStartDate;
391
         let lastyearstartdate = this.dateService.date().lastYearStartDate;
404
         let lastyearenddate = this.dateService.date().lastYearEndDate;
392
         let lastyearenddate = this.dateService.date().lastYearEndDate;
405
-        console.log(lastyearstartdate, lastyearenddate)
406
-        this.changeDate([lastyearstartdate, lastyearenddate])
407
-        this.changeMonthStart(lastyearstartdate)
408
-        this.changeMonthEnd(lastyearenddate)
409
-        this.changeYearStart(lastyearstartdate)
410
-        this.changeYearEnd(lastyearenddate)
393
+        console.log(lastyearstartdate, lastyearenddate);
394
+        this.changeDate([lastyearstartdate, lastyearenddate]);
395
+        this.changeMonthStart(lastyearstartdate);
396
+        this.changeMonthEnd(lastyearenddate);
397
+        this.changeYearStart(lastyearstartdate);
398
+        this.changeYearEnd(lastyearenddate);
411
         break;
399
         break;
412
     }
400
     }
413
     this.quick = false;
401
     this.quick = false;
414
-
415
   }
402
   }
416
 
403
 
417
   // 更多
404
   // 更多
418
   toMore(type) {
405
   toMore(type) {
419
     let sendData = this.searchData;
406
     let sendData = this.searchData;
420
-    console.log(sendData)
421
-    this.myService.sendMsg(sendData)
422
-    this.router.navigateByUrl('/main/' + type);
407
+    console.log(sendData);
408
+    this.myService.sendMsg(sendData);
409
+    this.router.navigateByUrl("/main/" + type);
423
   }
410
   }
424
 
411
 
425
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
412
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
@@ -438,16 +425,15 @@ export class OrderStatisticsComponent implements OnInit {
438
   searchTimer(fun, e, those) {
425
   searchTimer(fun, e, those) {
439
     let that = this;
426
     let that = this;
440
     that.isLoading = true;
427
     that.isLoading = true;
441
-    fun(e, those)
428
+    fun(e, those);
442
   }
429
   }
443
 
430
 
444
   // 截取意见内容(ie内核截取)
431
   // 截取意见内容(ie内核截取)
445
   spliceContent(con) {
432
   spliceContent(con) {
446
-    if (con.length >= 41 && navigator.userAgent.indexOf('Trident') > -1) {
447
-      return con.slice(0, 20) + '...'
433
+    if (con.length >= 41 && navigator.userAgent.indexOf("Trident") > -1) {
434
+      return con.slice(0, 20) + "...";
448
     } else {
435
     } else {
449
       return con;
436
       return con;
450
     }
437
     }
451
   }
438
   }
452
-
453
 }
439
 }

+ 2 - 28
src/app/views/round-robin/round-robin.component.ts

@@ -34,7 +34,6 @@ export class RoundRobinComponent implements OnInit {
34
   ) {}
34
   ) {}
35
 
35
 
36
   userInfo: any = JSON.parse(localStorage.getItem("user")) || {}; //登录用户信息
36
   userInfo: any = JSON.parse(localStorage.getItem("user")) || {}; //登录用户信息
37
-  menu: any = JSON.parse(localStorage.getItem("menu")) || []; //菜单
38
 
37
 
39
   searchCriteria = {
38
   searchCriteria = {
40
     //搜索条件
39
     //搜索条件
@@ -80,7 +79,7 @@ export class RoundRobinComponent implements OnInit {
80
       .subscribe((v: any) => {
79
       .subscribe((v: any) => {
81
         this.getTasktypeByIds(v);
80
         this.getTasktypeByIds(v);
82
       });
81
       });
83
-    this.initCoopBtns();
82
+    this.coopBtns = this.tool.initCoopBtns(this.route);
84
     this.getAllHospital();
83
     this.getAllHospital();
85
     this.initForm();
84
     this.initForm();
86
     this.getHospitalList();
85
     this.getHospitalList();
@@ -214,32 +213,7 @@ export class RoundRobinComponent implements OnInit {
214
   }
213
   }
215
 
214
 
216
   // 初始化增删改按钮
215
   // 初始化增删改按钮
217
-  coopBtns: any = {
218
-    look: false,
219
-    add: false,
220
-    edit: false,
221
-    del: false,
222
-    isStartUp: false,
223
-  };
224
-  initCoopBtns() {
225
-    // 二级菜单
226
-    let secondMenus = [];
227
-    this.menu.forEach((e) => {
228
-      e.childrens.forEach((el) => {
229
-        secondMenus.push(el);
230
-      });
231
-    });
232
-    let link = this.route.parent.snapshot.routeConfig.path;
233
-    let btns = [];
234
-    secondMenus.forEach((e) => {
235
-      if (e.link == link) {
236
-        btns = e.childrens || [];
237
-      }
238
-    });
239
-    btns.forEach((e) => {
240
-      this.coopBtns[e.link] = true;
241
-    });
242
-  }
216
+  coopBtns: any = {};
243
 
217
 
244
   // 获取所有院区
218
   // 获取所有院区
245
   /**
219
   /**

+ 3 - 34
src/app/views/shortcut-build-orders/shortcut-build-orders.component.ts

@@ -1,11 +1,6 @@
1
 import { Component, OnInit } from "@angular/core";
1
 import { Component, OnInit } from "@angular/core";
2
 import { ActivatedRoute, Router } from "@angular/router";
2
 import { ActivatedRoute, Router } from "@angular/router";
3
-import {
4
-  FormBuilder,
5
-  Validators,
6
-  FormGroup,
7
-  FormControl,
8
-} from "@angular/forms";
3
+import { FormBuilder, Validators, FormGroup } from "@angular/forms";
9
 
4
 
10
 import { MainService } from "../../services/main.service";
5
 import { MainService } from "../../services/main.service";
11
 import { ToolService } from "../../services/tool.service";
6
 import { ToolService } from "../../services/tool.service";
@@ -28,7 +23,6 @@ export class ShortcutBuildOrdersComponent implements OnInit {
28
   ) {}
23
   ) {}
29
 
24
 
30
   userInfo: any = JSON.parse(localStorage.getItem("user")) || {}; //登录用户信息
25
   userInfo: any = JSON.parse(localStorage.getItem("user")) || {}; //登录用户信息
31
-  menu: any = JSON.parse(localStorage.getItem("menu")) || []; //菜单
32
 
26
 
33
   searchCriteria = {
27
   searchCriteria = {
34
     //搜索条件
28
     //搜索条件
@@ -70,7 +64,7 @@ export class ShortcutBuildOrdersComponent implements OnInit {
70
     this.changeInpSubject.pipe(debounceTime(500)).subscribe((v) => {
64
     this.changeInpSubject.pipe(debounceTime(500)).subscribe((v) => {
71
       this.searchDepartment(v[0], v[1]);
65
       this.searchDepartment(v[0], v[1]);
72
     });
66
     });
73
-    this.initCoopBtns();
67
+    this.coopBtns = this.tool.initCoopBtns(this.route);
74
     this.getAllHospital();
68
     this.getAllHospital();
75
     this.initForm();
69
     this.initForm();
76
     this.getHospitalList();
70
     this.getHospitalList();
@@ -286,32 +280,7 @@ export class ShortcutBuildOrdersComponent implements OnInit {
286
   }
280
   }
287
 
281
 
288
   // 初始化增删改按钮
282
   // 初始化增删改按钮
289
-  coopBtns: any = {
290
-    look: false,
291
-    add: false,
292
-    edit: false,
293
-    del: false,
294
-    generateQRcode: false,
295
-  };
296
-  initCoopBtns() {
297
-    // 二级菜单
298
-    let secondMenus = [];
299
-    this.menu.forEach((e) => {
300
-      e.childrens.forEach((el) => {
301
-        secondMenus.push(el);
302
-      });
303
-    });
304
-    let link = this.route.parent.snapshot.routeConfig.path;
305
-    let btns = [];
306
-    secondMenus.forEach((e) => {
307
-      if (e.link == link) {
308
-        btns = e.childrens || [];
309
-      }
310
-    });
311
-    btns.forEach((e) => {
312
-      this.coopBtns[e.link] = true;
313
-    });
314
-  }
283
+  coopBtns: any = {};
315
 
284
 
316
   // 获取所有院区
285
   // 获取所有院区
317
   /**
286
   /**

+ 6 - 27
src/app/views/sys-config/sys-config.component.ts

@@ -2,6 +2,7 @@ import { Component, OnInit } from "@angular/core";
2
 import { FormBuilder, FormGroup, Validators } from "@angular/forms";
2
 import { FormBuilder, FormGroup, Validators } from "@angular/forms";
3
 import { ActivatedRoute } from "@angular/router";
3
 import { ActivatedRoute } from "@angular/router";
4
 import { MainService } from "../../services/main.service";
4
 import { MainService } from "../../services/main.service";
5
+import { ToolService } from "src/app/services/tool.service";
5
 
6
 
6
 @Component({
7
 @Component({
7
   selector: "app-sys-config",
8
   selector: "app-sys-config",
@@ -19,15 +20,13 @@ export class SysConfigComponent implements OnInit {
19
   ifSuccess: boolean; //操作成功/失败
20
   ifSuccess: boolean; //操作成功/失败
20
   promptInfo: string; //操作结果提示信息
21
   promptInfo: string; //操作结果提示信息
21
   promptModalShow: boolean; //操作提示框是否展示
22
   promptModalShow: boolean; //操作提示框是否展示
22
-  coopBtns = {
23
-    //初始化权限
24
-    edit: false,
25
-  };
23
+  coopBtns = {};
26
   menu = JSON.parse(localStorage.getItem("menu")) || []; //菜单
24
   menu = JSON.parse(localStorage.getItem("menu")) || []; //菜单
27
   constructor(
25
   constructor(
28
     private mainService: MainService,
26
     private mainService: MainService,
29
     private fb: FormBuilder,
27
     private fb: FormBuilder,
30
-    private route: ActivatedRoute
28
+    private route: ActivatedRoute,
29
+    private tool: ToolService
31
   ) {}
30
   ) {}
32
 
31
 
33
   ngOnInit() {
32
   ngOnInit() {
@@ -42,27 +41,7 @@ export class SysConfigComponent implements OnInit {
42
       busiViewDeptId: [null, [Validators.required]],
41
       busiViewDeptId: [null, [Validators.required]],
43
     });
42
     });
44
     this.getDeptType();
43
     this.getDeptType();
45
-    this.initCoopBtns();
46
-  }
47
-  // 获取当前菜单权限
48
-  initCoopBtns() {
49
-    // 二级菜单
50
-    let secondMenus = [];
51
-    this.menu.forEach((e) => {
52
-      e.childrens.forEach((el) => {
53
-        secondMenus.push(el);
54
-      });
55
-    });
56
-    let link = this.route.parent.snapshot.routeConfig.path;
57
-    let btns = [];
58
-    secondMenus.forEach((e) => {
59
-      if (e.link == link) {
60
-        btns = e.childrens || [];
61
-      }
62
-    });
63
-    btns.forEach((e) => {
64
-      this.coopBtns[e.link] = true;
65
-    });
44
+    this.coopBtns = this.tool.initCoopBtns(this.route);
66
   }
45
   }
67
   // 刷新字典缓存
46
   // 刷新字典缓存
68
   refresh() {
47
   refresh() {
@@ -172,7 +151,7 @@ export class SysConfigComponent implements OnInit {
172
                   this.validateForm.controls.cachePort.setValue(c[1]);
151
                   this.validateForm.controls.cachePort.setValue(c[1]);
173
                   break;
152
                   break;
174
                 case "busiViewDeptId":
153
                 case "busiViewDeptId":
175
-                  this.validateForm.controls.busiViewDeptId.setValue(c[1]+'');
154
+                  this.validateForm.controls.busiViewDeptId.setValue(c[1] + "");
176
                   break;
155
                   break;
177
               }
156
               }
178
             });
157
             });

+ 2 - 40
src/app/views/task-type-management/task-type-management.component.ts

@@ -51,7 +51,6 @@ export class TaskTypeManagementComponent implements OnInit {
51
     static: false,
51
     static: false,
52
   })
52
   })
53
   osComponentRef1: OverlayScrollbarsComponent;
53
   osComponentRef1: OverlayScrollbarsComponent;
54
-  menu: any = JSON.parse(localStorage.getItem("menu")) || []; //菜单
55
   taskTypeLoading = false; //任务类型加载中
54
   taskTypeLoading = false; //任务类型加载中
56
   allTaskTypeOptions: any;
55
   allTaskTypeOptions: any;
57
   tabModalName = "jcxx"; //详情tab字段
56
   tabModalName = "jcxx"; //详情tab字段
@@ -264,7 +263,7 @@ export class TaskTypeManagementComponent implements OnInit {
264
     this.changeSearchTaskListSubject.pipe(debounceTime(500)).subscribe((v) => {
263
     this.changeSearchTaskListSubject.pipe(debounceTime(500)).subscribe((v) => {
265
       this.getSearchTaskList(v);
264
       this.getSearchTaskList(v);
266
     });
265
     });
267
-    this.initCoopBtns(); //获取增删改查按钮权限
266
+    this.coopBtns = this.tool.initCoopBtns(this.route);
268
     this.listOfData = [{ A: 1 }];
267
     this.listOfData = [{ A: 1 }];
269
     for (let i = 0; i < 100; i++) {
268
     for (let i = 0; i < 100; i++) {
270
       this.listOfAllData.push({
269
       this.listOfAllData.push({
@@ -383,44 +382,7 @@ export class TaskTypeManagementComponent implements OnInit {
383
   // 备注快速选择输入---------------------------------------------------------------------
382
   // 备注快速选择输入---------------------------------------------------------------------
384
 
383
 
385
   // 初始化增删改按钮
384
   // 初始化增删改按钮
386
-  coopBtns: any = {
387
-    look: false,
388
-    add: false,
389
-    edit: false,
390
-    del: false,
391
-  };
392
-  initCoopBtns() {
393
-    // 二级菜单
394
-    let secondMenus = [];
395
-    this.menu.forEach((e) => {
396
-      e.childrens.forEach((el) => {
397
-        secondMenus.push(el);
398
-      });
399
-    });
400
-    let link = this.route.parent.snapshot.routeConfig.path;
401
-    let btns = [];
402
-    secondMenus.forEach((e) => {
403
-      if (e.link == link) {
404
-        btns = e.childrens || [];
405
-      }
406
-    });
407
-    btns.forEach((e) => {
408
-      switch (e.link) {
409
-        case "look":
410
-          this.coopBtns.look = true;
411
-          break;
412
-        case "add":
413
-          this.coopBtns.add = true;
414
-          break;
415
-        case "edit":
416
-          this.coopBtns.edit = true;
417
-          break;
418
-        case "del":
419
-          this.coopBtns.del = true;
420
-          break;
421
-      }
422
-    });
423
-  }
385
+  coopBtns: any = {};
424
   // 获取所有院区
386
   // 获取所有院区
425
   getAllHospital() {
387
   getAllHospital() {
426
     this.hosId = this.tool.getCurrentHospital().id;
388
     this.hosId = this.tool.getCurrentHospital().id;

+ 128 - 144
src/app/views/task-type-statistics/task-type-statistics.component.ts

@@ -1,121 +1,94 @@
1
-import { Component, OnInit } from '@angular/core';
2
-import { ActivatedRoute, Router } from "@angular/router"
1
+import { Component, OnInit } from "@angular/core";
2
+import { ActivatedRoute, Router } from "@angular/router";
3
 
3
 
4
 import { MainService } from "../../services/main.service";
4
 import { MainService } from "../../services/main.service";
5
 import { DateService } from "../../services/date.service";
5
 import { DateService } from "../../services/date.service";
6
 import { MyServiceService } from "../../services/my-service.service";
6
 import { MyServiceService } from "../../services/my-service.service";
7
-import { ToolService } from '../../services/tool.service';
7
+import { ToolService } from "../../services/tool.service";
8
 
8
 
9
 @Component({
9
 @Component({
10
-  selector: 'app-task-type-statistics',
11
-  templateUrl: './task-type-statistics.component.html',
12
-  styleUrls: ['./task-type-statistics.component.less']
10
+  selector: "app-task-type-statistics",
11
+  templateUrl: "./task-type-statistics.component.html",
12
+  styleUrls: ["./task-type-statistics.component.less"],
13
 })
13
 })
14
 export class TaskTypeStatisticsComponent implements OnInit {
14
 export class TaskTypeStatisticsComponent implements OnInit {
15
-
16
-  constructor(private route: ActivatedRoute, private router: Router, private mainService: MainService, private dateService: DateService, private myService: MyServiceService, private tool: ToolService) { }
15
+  constructor(
16
+    private route: ActivatedRoute,
17
+    private router: Router,
18
+    private mainService: MainService,
19
+    private dateService: DateService,
20
+    private myService: MyServiceService,
21
+    private tool: ToolService
22
+  ) {}
17
 
23
 
18
   ngOnInit() {
24
   ngOnInit() {
19
-    this.getSearchData()
20
-    this.initCoopBtns();
21
-    this.getAllHos()
25
+    this.getSearchData();
26
+    this.coopBtns = this.tool.initCoopBtns(this.route);
27
+    this.getAllHos();
22
   }
28
   }
23
 
29
 
24
-  menu: any = JSON.parse(localStorage.getItem('menu')) || [];//菜单
25
-
26
-  defRange = '1';//默认上周
30
+  defRange = "1"; //默认上周
27
   defRanges = [
31
   defRanges = [
28
     {
32
     {
29
-      label: '上周',
30
-      id: 1
31
-    }, {
32
-      label: '上月',
33
-      id: 2
34
-    }, {
35
-      label: '上年',
36
-      id: 3
33
+      label: "上周",
34
+      id: 1,
37
     },
35
     },
38
-  ];//时间默认区间
39
-
40
-  listOfData: any[] = [];//表格数据
41
-  pageIndex: number = 1;//表格当前页码
42
-  pageSize: number = 10;//表格每页展示条数
43
-  listLength: number = 10;//表格总数据量
44
-  alldepart: any = [];//当前院区所属科室
45
-  dateRange: any = [];//发起时间区间 天
36
+    {
37
+      label: "上月",
38
+      id: 2,
39
+    },
40
+    {
41
+      label: "上年",
42
+      id: 3,
43
+    },
44
+  ]; //时间默认区间
46
 
45
 
47
-  promptContent: string;//操作提示框提示信息
48
-  ifSuccess: boolean;//操作成功/失败
49
-  promptInfo: string;//操作结果提示信息
50
-  promptModalShow: boolean;//操作提示框是否展示
46
+  listOfData: any[] = []; //表格数据
47
+  pageIndex: number = 1; //表格当前页码
48
+  pageSize: number = 10; //表格每页展示条数
49
+  listLength: number = 10; //表格总数据量
50
+  alldepart: any = []; //当前院区所属科室
51
+  dateRange: any = []; //发起时间区间 天
51
 
52
 
53
+  promptContent: string; //操作提示框提示信息
54
+  ifSuccess: boolean; //操作成功/失败
55
+  promptInfo: string; //操作结果提示信息
56
+  promptModalShow: boolean; //操作提示框是否展示
52
 
57
 
53
   // 初始化增删改按钮
58
   // 初始化增删改按钮
54
-  coopBtns: any = {
55
-    look: false,
56
-    export: false
57
-  };
58
-  initCoopBtns() {
59
-    // 二级菜单
60
-    let secondMenus = []
61
-    this.menu.forEach(e => {
62
-      e.childrens.forEach(el => {
63
-        secondMenus.push(el)
64
-      });
65
-    });
66
-    // console.log(secondMenus)
67
-    let link = this.route.parent.snapshot.routeConfig.path;
68
-    let btns = []
69
-    secondMenus.forEach(e => {
70
-      if (e.link == link) {
71
-        btns = e.childrens || [];
72
-      }
73
-    });
74
-    btns.forEach(e => {
75
-      switch (e.link) {
76
-        case 'look':
77
-          this.coopBtns.look = true;
78
-          break;
79
-        case 'export':
80
-          this.coopBtns.export = true;
81
-          break;
82
-      }
83
-    })
84
-    // console.log(this.coopBtns);
85
-  }
86
-  searchData: any = {} // 综合统计页面带过来的参数
59
+  coopBtns: any = {};
60
+  searchData: any = {}; // 综合统计页面带过来的参数
87
   getSearchData() {
61
   getSearchData() {
88
     let that = this;
62
     let that = this;
89
-    let sub = that.myService.getMsg().subscribe(msg => {
63
+    let sub = that.myService.getMsg().subscribe((msg) => {
90
       // 从综合报表跳转过来
64
       // 从综合报表跳转过来
91
-      that.searchData = msg
92
-      console.log(that.searchData)
93
-      console.log(66)
94
-      sub.unsubscribe()//取消订阅,否则订阅函数会累加执行
95
-      that.hospital = that.searchData['hosId']
96
-      that.changeDate(that.searchData['range'])
97
-      that.defRange = that.searchData['defRange']
98
-      that.search()
99
-    })
65
+      that.searchData = msg;
66
+      console.log(that.searchData);
67
+      console.log(66);
68
+      sub.unsubscribe(); //取消订阅,否则订阅函数会累加执行
69
+      that.hospital = that.searchData["hosId"];
70
+      that.changeDate(that.searchData["range"]);
71
+      that.defRange = that.searchData["defRange"];
72
+      that.search();
73
+    });
100
     // 不是从综合报表页面跳转过来的
74
     // 不是从综合报表页面跳转过来的
101
     setTimeout(() => {
75
     setTimeout(() => {
102
-      if (!sub['isStopped']) {
103
-        that.changeDateRange(that.defRange)
104
-        that.search()
76
+      if (!sub["isStopped"]) {
77
+        that.changeDateRange(that.defRange);
78
+        that.search();
105
       }
79
       }
106
     }, 100);
80
     }, 100);
107
-
108
   }
81
   }
109
   // 搜索
82
   // 搜索
110
   search(num?: number) {
83
   search(num?: number) {
111
     if (this.hospital) {
84
     if (this.hospital) {
112
-      this.searchData['hosId'] = this.hospital;
85
+      this.searchData["hosId"] = this.hospital;
113
     }
86
     }
114
     if (this.startDate) {
87
     if (this.startDate) {
115
-      this.searchData['dateRange'] = {
116
-        start: this.startDate + ' ' + '00:00:00',
117
-        end: this.endDate + ' ' + '23:59:59'
118
-      }
88
+      this.searchData["dateRange"] = {
89
+        start: this.startDate + " " + "00:00:00",
90
+        end: this.endDate + " " + "23:59:59",
91
+      };
119
     }
92
     }
120
     if (num !== undefined) {
93
     if (num !== undefined) {
121
       this.getList(num);
94
       this.getList(num);
@@ -129,33 +102,36 @@ export class TaskTypeStatisticsComponent implements OnInit {
129
     let that = this;
102
     let that = this;
130
     let postData = {
103
     let postData = {
131
       hosId: that.hospital,
104
       hosId: that.hospital,
132
-      startTime: this.startDate + ' ' + '00:00:00',
133
-      endTime: this.endDate + ' ' + '23:59:59',
134
-    }
105
+      startTime: this.startDate + " " + "00:00:00",
106
+      endTime: this.endDate + " " + "23:59:59",
107
+    };
135
     this.loading2 = true;
108
     this.loading2 = true;
136
-    that.mainService.exportReport('taskType', postData).subscribe(data => {
137
-      this.loading2 = false;
138
-      this.showPromptModal('导出', true, '');
139
-      var file = new Blob([data], {
140
-        type: 'application/vnd.ms-excel'
141
-      });
142
-      //trick to download store a file having its URL
143
-      var fileURL = URL.createObjectURL(file);
144
-      var a = document.createElement('a');
145
-      a.href = fileURL;
146
-      a.target = '_blank';
147
-      a.download = '任务类型统计.xls';
148
-      document.body.appendChild(a);
149
-      a.click();
150
-    }, err => {
151
-      this.loading2 = false;
152
-      this.showPromptModal('导出', false, '');
153
-    })
109
+    that.mainService.exportReport("taskType", postData).subscribe(
110
+      (data) => {
111
+        this.loading2 = false;
112
+        this.showPromptModal("导出", true, "");
113
+        var file = new Blob([data], {
114
+          type: "application/vnd.ms-excel",
115
+        });
116
+        //trick to download store a file having its URL
117
+        var fileURL = URL.createObjectURL(file);
118
+        var a = document.createElement("a");
119
+        a.href = fileURL;
120
+        a.target = "_blank";
121
+        a.download = "任务类型统计.xls";
122
+        document.body.appendChild(a);
123
+        a.click();
124
+      },
125
+      (err) => {
126
+        this.loading2 = false;
127
+        this.showPromptModal("导出", false, "");
128
+      }
129
+    );
154
   }
130
   }
155
   // 重置
131
   // 重置
156
   reset() {
132
   reset() {
157
-    this.changeDateRange('1')
158
-    this.search()
133
+    this.changeDateRange("1");
134
+    this.search();
159
   }
135
   }
160
   // 表格数据
136
   // 表格数据
161
   loading1 = false;
137
   loading1 = false;
@@ -168,39 +144,50 @@ export class TaskTypeStatisticsComponent implements OnInit {
168
       sum: this.pageSize,
144
       sum: this.pageSize,
169
       startTime: this.searchData.dateRange.start,
145
       startTime: this.searchData.dateRange.start,
170
       endTime: this.searchData.dateRange.end,
146
       endTime: this.searchData.dateRange.end,
171
-      hosId: this.searchData.hosId
172
-    }
147
+      hosId: this.searchData.hosId,
148
+    };
173
     this.loading1 = true;
149
     this.loading1 = true;
174
-    this.mainService.postCustom('report', 'taskType', postData).subscribe(result => {
175
-      this.loading1 = false;
176
-      this.listOfData = result.list || [];
177
-      this.listLength = result.totalNum;
178
-    })
179
-
150
+    this.mainService
151
+      .postCustom("report", "taskType", postData)
152
+      .subscribe((result) => {
153
+        this.loading1 = false;
154
+        this.listOfData = result.list || [];
155
+        this.listLength = result.totalNum;
156
+      });
180
   }
157
   }
181
   // 获取院区
158
   // 获取院区
182
-  hospital: string;//选中院区
159
+  hospital: string; //选中院区
183
   getAllHos() {
160
   getAllHos() {
184
-    this.hospital = this.tool.getCurrentHospital().id + '';
161
+    this.hospital = this.tool.getCurrentHospital().id + "";
185
   }
162
   }
186
 
163
 
187
   // 日期选择 日
164
   // 日期选择 日
188
-  startDate: string;//发起时间开始
189
-  endDate: string;//发起时间结束
165
+  startDate: string; //发起时间开始
166
+  endDate: string; //发起时间结束
190
   changeDate(result?): void {
167
   changeDate(result?): void {
191
-    console.log(this.dateRange)
192
-    console.log(result)
168
+    console.log(this.dateRange);
169
+    console.log(result);
193
     this.dateRange = result;
170
     this.dateRange = result;
194
     if (!this.quick) {
171
     if (!this.quick) {
195
       // 不是快捷选择
172
       // 不是快捷选择
196
       this.defRange = null;
173
       this.defRange = null;
197
     }
174
     }
198
     if (!result || !result.length) {
175
     if (!result || !result.length) {
199
-      this.startDate = this.endDate = '';
176
+      this.startDate = this.endDate = "";
200
       return;
177
       return;
201
     }
178
     }
202
-    this.startDate = result[0].getFullYear() + '-' + (result[0].getMonth() + 1) + '-' + result[0].getDate();
203
-    this.endDate = result[1].getFullYear() + '-' + (result[1].getMonth() + 1) + '-' + result[1].getDate();
179
+    this.startDate =
180
+      result[0].getFullYear() +
181
+      "-" +
182
+      (result[0].getMonth() + 1) +
183
+      "-" +
184
+      result[0].getDate();
185
+    this.endDate =
186
+      result[1].getFullYear() +
187
+      "-" +
188
+      (result[1].getMonth() + 1) +
189
+      "-" +
190
+      result[1].getDate();
204
   }
191
   }
205
 
192
 
206
   // 日期选择 快速修改时间区间
193
   // 日期选择 快速修改时间区间
@@ -211,38 +198,37 @@ export class TaskTypeStatisticsComponent implements OnInit {
211
     console.log(res);
198
     console.log(res);
212
     this.quick = true;
199
     this.quick = true;
213
     switch (res) {
200
     switch (res) {
214
-      case '1':
201
+      case "1":
215
         // 上周
202
         // 上周
216
         let lastweekstartdate = this.dateService.date().lastWeekStartDate;
203
         let lastweekstartdate = this.dateService.date().lastWeekStartDate;
217
         let lastweekenddate = this.dateService.date().lastWeekEndDate;
204
         let lastweekenddate = this.dateService.date().lastWeekEndDate;
218
-        console.log(lastweekstartdate, lastweekenddate)
219
-        this.changeDate([lastweekstartdate, lastweekenddate])
205
+        console.log(lastweekstartdate, lastweekenddate);
206
+        this.changeDate([lastweekstartdate, lastweekenddate]);
220
         break;
207
         break;
221
-      case '2':
208
+      case "2":
222
         // 上月
209
         // 上月
223
         let lastmonthstartdate = this.dateService.date().lastMonthStartDate;
210
         let lastmonthstartdate = this.dateService.date().lastMonthStartDate;
224
         let lastmonthenddate = this.dateService.date().lastMonthEndDate;
211
         let lastmonthenddate = this.dateService.date().lastMonthEndDate;
225
-        console.log(lastmonthstartdate, lastmonthenddate)
226
-        this.changeDate([lastmonthstartdate, lastmonthenddate])
212
+        console.log(lastmonthstartdate, lastmonthenddate);
213
+        this.changeDate([lastmonthstartdate, lastmonthenddate]);
227
         break;
214
         break;
228
-      case '3':
215
+      case "3":
229
         // 上年
216
         // 上年
230
         let lastyearstartdate = this.dateService.date().lastYearStartDate;
217
         let lastyearstartdate = this.dateService.date().lastYearStartDate;
231
         let lastyearenddate = this.dateService.date().lastYearEndDate;
218
         let lastyearenddate = this.dateService.date().lastYearEndDate;
232
-        console.log(lastyearstartdate, lastyearenddate)
233
-        this.changeDate([lastyearstartdate, lastyearenddate])
219
+        console.log(lastyearstartdate, lastyearenddate);
220
+        this.changeDate([lastyearstartdate, lastyearenddate]);
234
         break;
221
         break;
235
     }
222
     }
236
     this.quick = false;
223
     this.quick = false;
237
-
238
   }
224
   }
239
 
225
 
240
   // 更多
226
   // 更多
241
   toMore(type) {
227
   toMore(type) {
242
     let sendData = this.searchData;
228
     let sendData = this.searchData;
243
-    console.log(sendData)
244
-    this.myService.sendMsg(sendData)
245
-    this.router.navigateByUrl('/main/' + type);
229
+    console.log(sendData);
230
+    this.myService.sendMsg(sendData);
231
+    this.router.navigateByUrl("/main/" + type);
246
   }
232
   }
247
 
233
 
248
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
234
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
@@ -261,17 +247,15 @@ export class TaskTypeStatisticsComponent implements OnInit {
261
   searchTimer(fun, e, those) {
247
   searchTimer(fun, e, those) {
262
     let that = this;
248
     let that = this;
263
     that.isLoading = true;
249
     that.isLoading = true;
264
-    fun(e, those)
250
+    fun(e, those);
265
   }
251
   }
266
 
252
 
267
   // 截取意见内容(ie内核截取)
253
   // 截取意见内容(ie内核截取)
268
   spliceContent(con) {
254
   spliceContent(con) {
269
-    if (con.length >= 41 && navigator.userAgent.indexOf('Trident') > -1) {
270
-      return con.slice(0, 20) + '...'
255
+    if (con.length >= 41 && navigator.userAgent.indexOf("Trident") > -1) {
256
+      return con.slice(0, 20) + "...";
271
     } else {
257
     } else {
272
       return con;
258
       return con;
273
     }
259
     }
274
   }
260
   }
275
-
276
 }
261
 }
277
-

+ 2 - 25
src/app/views/timing-message-sending/timing-message-sending.component.ts

@@ -32,7 +32,6 @@ export class TimingMessageSendingComponent implements OnInit {
32
   ) {}
32
   ) {}
33
 
33
 
34
   userInfo: any = JSON.parse(localStorage.getItem("user")) || {}; //登录用户信息
34
   userInfo: any = JSON.parse(localStorage.getItem("user")) || {}; //登录用户信息
35
-  menu: any = JSON.parse(localStorage.getItem("menu")) || []; //菜单
36
   hosId;
35
   hosId;
37
   createUser = "";
36
   createUser = "";
38
   users = []; // 用户列表
37
   users = []; // 用户列表
@@ -57,7 +56,7 @@ export class TimingMessageSendingComponent implements OnInit {
57
   ngOnInit() {
56
   ngOnInit() {
58
     this.hosId = this.tool.getCurrentHospital().id;
57
     this.hosId = this.tool.getCurrentHospital().id;
59
     this.getList();
58
     this.getList();
60
-    this.initCoopBtns();
59
+    this.coopBtns = this.tool.initCoopBtns(this.route);
61
     this.initForm();
60
     this.initForm();
62
   }
61
   }
63
   changeForm(flag) {
62
   changeForm(flag) {
@@ -105,29 +104,7 @@ export class TimingMessageSendingComponent implements OnInit {
105
   }
104
   }
106
 
105
 
107
   // 初始化权限按钮
106
   // 初始化权限按钮
108
-  coopBtns: any = {
109
-    edit: false, //编辑
110
-    isStartUp: false, //是否启用
111
-  };
112
-  initCoopBtns() {
113
-    // 二级菜单
114
-    let secondMenus = [];
115
-    this.menu.forEach((e) => {
116
-      e.childrens.forEach((el) => {
117
-        secondMenus.push(el);
118
-      });
119
-    });
120
-    let link = this.route.parent.snapshot.routeConfig.path;
121
-    let btns = [];
122
-    secondMenus.forEach((e) => {
123
-      if (e.link == link) {
124
-        btns = e.childrens || [];
125
-      }
126
-    });
127
-    btns.forEach((e) => {
128
-      this.coopBtns[e.link] = true;
129
-    });
130
-  }
107
+  coopBtns: any = {};
131
 
108
 
132
   // 表格数据
109
   // 表格数据
133
   loading1 = false;
110
   loading1 = false;

+ 255 - 254
src/app/views/users-management/users-management.component.ts

@@ -1,110 +1,81 @@
1
-import { Component, OnInit, ViewChild } from '@angular/core';
2
-import { ActivatedRoute, Router } from "@angular/router"
3
-import { FormBuilder, Validators, FormGroup } from '@angular/forms';
1
+import { Component, OnInit, ViewChild } from "@angular/core";
2
+import { ActivatedRoute, Router } from "@angular/router";
3
+import { FormBuilder, Validators, FormGroup } from "@angular/forms";
4
 
4
 
5
 import { MainService } from "../../services/main.service";
5
 import { MainService } from "../../services/main.service";
6
-import { OverlayScrollbarsComponent } from 'overlayscrollbars-ngx';
7
-import { ToolService } from '../../services/tool.service';
8
-import { forkJoin, Subject } from 'rxjs';
9
-import { debounceTime } from 'rxjs/operators';
10
-import { NzMessageService } from 'ng-zorro-antd';
6
+import { OverlayScrollbarsComponent } from "overlayscrollbars-ngx";
7
+import { ToolService } from "../../services/tool.service";
8
+import { forkJoin, Subject } from "rxjs";
9
+import { debounceTime } from "rxjs/operators";
10
+import { NzMessageService } from "ng-zorro-antd";
11
 
11
 
12
 @Component({
12
 @Component({
13
-  selector: 'app-users-management',
14
-  templateUrl: './users-management.component.html',
15
-  styleUrls: ['./users-management.component.less']
13
+  selector: "app-users-management",
14
+  templateUrl: "./users-management.component.html",
15
+  styleUrls: ["./users-management.component.less"],
16
 })
16
 })
17
 export class UsersManagementComponent implements OnInit {
17
 export class UsersManagementComponent implements OnInit {
18
-  @ViewChild('osComponentRef1', { read: OverlayScrollbarsComponent, static: false })
18
+  @ViewChild("osComponentRef1", {
19
+    read: OverlayScrollbarsComponent,
20
+    static: false,
21
+  })
19
   osComponentRef1: OverlayScrollbarsComponent;
22
   osComponentRef1: OverlayScrollbarsComponent;
20
-  constructor(private message: NzMessageService, private fb: FormBuilder, private route: ActivatedRoute, private router: Router, private mainService: MainService, private tool: ToolService) { }
23
+  constructor(
24
+    private message: NzMessageService,
25
+    private fb: FormBuilder,
26
+    private route: ActivatedRoute,
27
+    private router: Router,
28
+    private mainService: MainService,
29
+    private tool: ToolService
30
+  ) {}
21
 
31
 
22
-  menu: any = JSON.parse(localStorage.getItem('menu')) || [];//菜单
23
-  listOfData: any[] = [];//表格数据
32
+  listOfData: any[] = []; //表格数据
24
 
33
 
25
-  modal: boolean = false;//新增/编辑模态框
26
-  add: boolean;//true:新增;false:编辑
27
-  validateForm: FormGroup;//新增/编辑表单
28
-  coopId: number;//表格中执行操作的id
29
-  department: any;//所属科室
30
-  num;//工号
31
-  name;//姓名
32
-  userType: any;//用户类型
33
-  hosId: any;//院区(搜索)
34
-  userGroup;//所属组
35
-  userGroup1;//所属组(搜索)
36
-  userTypes: Array<any>;//所有用户类型
37
-  alldepart: any = [];//所有所属科室
38
-  alldepart1: any = [];//所有所属科室(搜索)
39
-  allUserGroup: Array<any>;//所有用户组
40
-  allUserGroup1: Array<any>;//用户组(搜索)
41
-  allUserRole: Array<any>;//所有角色
42
-  pageIndex: number = 1;//页码
43
-  listLength: number = 10;//总条数
44
-  pageSize: number = 10;//每页条数
34
+  modal: boolean = false; //新增/编辑模态框
35
+  add: boolean; //true:新增;false:编辑
36
+  validateForm: FormGroup; //新增/编辑表单
37
+  coopId: number; //表格中执行操作的id
38
+  department: any; //所属科室
39
+  num; //工号
40
+  name; //姓名
41
+  userType: any; //用户类型
42
+  hosId: any; //院区(搜索)
43
+  userGroup; //所属组
44
+  userGroup1; //所属组(搜索)
45
+  userTypes: Array<any>; //所有用户类型
46
+  alldepart: any = []; //所有所属科室
47
+  alldepart1: any = []; //所有所属科室(搜索)
48
+  allUserGroup: Array<any>; //所有用户组
49
+  allUserGroup1: Array<any>; //用户组(搜索)
50
+  allUserRole: Array<any>; //所有角色
51
+  pageIndex: number = 1; //页码
52
+  listLength: number = 10; //总条数
53
+  pageSize: number = 10; //每页条数
45
 
54
 
46
-  promptContent: string;//操作提示框提示信息
47
-  ifSuccess: boolean;//操作成功/失败
48
-  promptInfo: string;//操作结果提示信息
49
-  promptModalShow: boolean;//操作提示框是否展示
55
+  promptContent: string; //操作提示框提示信息
56
+  ifSuccess: boolean; //操作成功/失败
57
+  promptInfo: string; //操作结果提示信息
58
+  promptModalShow: boolean; //操作提示框是否展示
50
 
59
 
51
-  btnLoading: boolean = false;//提交按钮loading状态
52
-  wxRequired = false;//新增或编辑用户的时候,微信号是否必填
53
-  changeInpSubject = new Subject();//防抖
60
+  btnLoading: boolean = false; //提交按钮loading状态
61
+  wxRequired = false; //新增或编辑用户的时候,微信号是否必填
62
+  changeInpSubject = new Subject(); //防抖
54
 
63
 
55
   ngOnInit() {
64
   ngOnInit() {
56
     //防抖
65
     //防抖
57
-    this.changeInpSubject.pipe(debounceTime(500)).subscribe(v => {
66
+    this.changeInpSubject.pipe(debounceTime(500)).subscribe((v) => {
58
       this.getDeparts(v[0], v[1], v[2]);
67
       this.getDeparts(v[0], v[1], v[2]);
59
-    })
60
-    this.initCoopBtns();
68
+    });
69
+    this.coopBtns = this.tool.initCoopBtns(this.route);
61
     this.initForm();
70
     this.initForm();
62
     this.getAllHospital();
71
     this.getAllHospital();
63
-    this.getAllRole()
72
+    this.getAllRole();
64
     this.getUserTypes();
73
     this.getUserTypes();
65
-    this.getGender()
74
+    this.getGender();
66
   }
75
   }
67
 
76
 
68
   // 初始化增删改按钮
77
   // 初始化增删改按钮
69
-  coopBtns: any = {
70
-    look: false,
71
-    add: false,
72
-    edit: false,
73
-    del: false
74
-  };
75
-
76
-  initCoopBtns() {
77
-    // 二级菜单
78
-    let secondMenus = []
79
-    this.menu.forEach(e => {
80
-      e.childrens.forEach(el => {
81
-        secondMenus.push(el)
82
-      });
83
-    });
84
-    let link = this.route.parent.snapshot.routeConfig.path;
85
-    let btns = []
86
-    secondMenus.forEach(e => {
87
-      if (e.link == link) {
88
-        btns = e.childrens || [];
89
-      }
90
-    });
91
-    btns.forEach(e => {
92
-      switch (e.link) {
93
-        case 'look':
94
-          this.coopBtns.look = true;
95
-          break;
96
-        case 'add':
97
-          this.coopBtns.add = true;
98
-          break;
99
-        case 'edit':
100
-          this.coopBtns.edit = true;
101
-          break;
102
-        case 'del':
103
-          this.coopBtns.del = true;
104
-          break;
105
-      }
106
-    })
107
-  }
78
+  coopBtns: any = {};
108
   // 搜索
79
   // 搜索
109
   search() {
80
   search() {
110
     this.pageIndex = 1;
81
     this.pageIndex = 1;
@@ -113,14 +84,13 @@ export class UsersManagementComponent implements OnInit {
113
   // 重置
84
   // 重置
114
   reset() {
85
   reset() {
115
     this.pageIndex = 1;
86
     this.pageIndex = 1;
116
-    this.name = '';
117
-    this.num = '';
87
+    this.name = "";
88
+    this.num = "";
118
     this.userType = null;
89
     this.userType = null;
119
     this.department = null;
90
     this.department = null;
120
     this.userGroup1 = null;
91
     this.userGroup1 = null;
121
     this.changeHosp1(this.hosId);
92
     this.changeHosp1(this.hosId);
122
     this.getList();
93
     this.getList();
123
-
124
   }
94
   }
125
   // 表格数据
95
   // 表格数据
126
   loading1 = false;
96
   loading1 = false;
@@ -129,46 +99,47 @@ export class UsersManagementComponent implements OnInit {
129
       idx: this.pageIndex - 1,
99
       idx: this.pageIndex - 1,
130
       sum: this.pageSize,
100
       sum: this.pageSize,
131
       user: {
101
       user: {
132
-        name: this.name || '',
133
-        dept: { id: this.department || '' },
134
-        usertype: { id: this.userType || '' },
135
-        account: this.num || '',
136
-        groupdata: { id: this.userGroup1 || '' },
137
-        hospital: { id: this.hosId || '' }
102
+        name: this.name || "",
103
+        dept: { id: this.department || "" },
104
+        usertype: { id: this.userType || "" },
105
+        account: this.num || "",
106
+        groupdata: { id: this.userGroup1 || "" },
107
+        hospital: { id: this.hosId || "" },
138
       },
108
       },
139
-    }
109
+    };
140
     if (!data.user.dept || !data.user.dept.id) {
110
     if (!data.user.dept || !data.user.dept.id) {
141
-      delete data.user.dept
111
+      delete data.user.dept;
142
     }
112
     }
143
     if (!data.user.usertype || !data.user.usertype.id) {
113
     if (!data.user.usertype || !data.user.usertype.id) {
144
-      delete data.user.usertype
114
+      delete data.user.usertype;
145
     }
115
     }
146
     if (!data.user.groupdata || !data.user.groupdata.id) {
116
     if (!data.user.groupdata || !data.user.groupdata.id) {
147
-      delete data.user.groupdata
117
+      delete data.user.groupdata;
148
     }
118
     }
149
     if (!data.user.hospital || !data.user.hospital.id) {
119
     if (!data.user.hospital || !data.user.hospital.id) {
150
-      delete data.user.hospital
120
+      delete data.user.hospital;
151
     }
121
     }
152
     this.loading1 = true;
122
     this.loading1 = true;
153
-    this.mainService.getFetchDataList('data', 'user', data).subscribe(data => {
154
-      this.loading1 = false;
155
-      this.listOfData = data.list;
156
-      this.listLength = data.totalNum;
157
-    })
158
-
123
+    this.mainService
124
+      .getFetchDataList("data", "user", data)
125
+      .subscribe((data) => {
126
+        this.loading1 = false;
127
+        this.listOfData = data.list;
128
+        this.listLength = data.totalNum;
129
+      });
159
   }
130
   }
160
 
131
 
161
   // 获取所有用户类型
132
   // 获取所有用户类型
162
   getUserTypes() {
133
   getUserTypes() {
163
     var that = this;
134
     var that = this;
164
-    that.mainService.getDictionary('list', 'usertype').subscribe(data => {
135
+    that.mainService.getDictionary("list", "usertype").subscribe((data) => {
165
       that.userTypes = data;
136
       that.userTypes = data;
166
-    })
137
+    });
167
   }
138
   }
168
 
139
 
169
   // 获取相应的院区
140
   // 获取相应的院区
170
   getAllHospital() {
141
   getAllHospital() {
171
-    this.hosId = this.tool.getCurrentHospital().id + '';
142
+    this.hosId = this.tool.getCurrentHospital().id + "";
172
     this.changeHosp1(this.hosId);
143
     this.changeHosp1(this.hosId);
173
     this.getList();
144
     this.getList();
174
   }
145
   }
@@ -178,42 +149,48 @@ export class UsersManagementComponent implements OnInit {
178
     var that = this;
149
     var that = this;
179
     let data = {
150
     let data = {
180
       idx: 0,
151
       idx: 0,
181
-      sum: 1000
182
-    }
183
-    that.mainService.getFetchDataList('data', 'role', data).subscribe(data => {
184
-      that.allUserRole = data.list;
185
-    })
152
+      sum: 1000,
153
+    };
154
+    that.mainService
155
+      .getFetchDataList("data", "role", data)
156
+      .subscribe((data) => {
157
+        that.allUserRole = data.list;
158
+      });
186
   }
159
   }
187
 
160
 
188
   // 切换院区选项获取对应科室列表
161
   // 切换院区选项获取对应科室列表
189
   changeHosp() {
162
   changeHosp() {
190
-    let hid = this.hosId - 0
163
+    let hid = this.hosId - 0;
191
     let data = {
164
     let data = {
192
       department: {
165
       department: {
193
         hospital: { id: hid },
166
         hospital: { id: hid },
194
       },
167
       },
195
       idx: 0,
168
       idx: 0,
196
-      sum: 20
197
-    }
169
+      sum: 20,
170
+    };
198
     let groupData = {
171
     let groupData = {
199
       group2: {
172
       group2: {
200
-        hospitals: hid
173
+        hospitals: hid,
201
       },
174
       },
202
       idx: 0,
175
       idx: 0,
203
-      sum: 9999
204
-    }
205
-    this.maskFlag = this.message.loading('正在加载中..', { nzDuration: 0 }).messageId;
206
-    let department$ = this.mainService.getFetchDataList('data', 'department', data);
207
-    let group$ = this.mainService.getFetchDataList('data', 'group2', groupData);
208
-    forkJoin(department$, group$).subscribe(
209
-      res => {
210
-        this.message.remove(this.maskFlag);
211
-        this.maskFlag = false;
212
-        this.modal = true;
213
-        this.alldepart = res[0]['list'];
214
-        this.allUserGroup = res[1]['list'];
215
-      }
176
+      sum: 9999,
177
+    };
178
+    this.maskFlag = this.message.loading("正在加载中..", {
179
+      nzDuration: 0,
180
+    }).messageId;
181
+    let department$ = this.mainService.getFetchDataList(
182
+      "data",
183
+      "department",
184
+      data
216
     );
185
     );
186
+    let group$ = this.mainService.getFetchDataList("data", "group2", groupData);
187
+    forkJoin(department$, group$).subscribe((res) => {
188
+      this.message.remove(this.maskFlag);
189
+      this.maskFlag = false;
190
+      this.modal = true;
191
+      this.alldepart = res[0]["list"];
192
+      this.allUserGroup = res[1]["list"];
193
+    });
217
   }
194
   }
218
   // 切换院区选项获取对应科室列表(搜索)seimin
195
   // 切换院区选项获取对应科室列表(搜索)seimin
219
   changeHosp1(id) {
196
   changeHosp1(id) {
@@ -224,30 +201,34 @@ export class UsersManagementComponent implements OnInit {
224
         hospital: { id },
201
         hospital: { id },
225
       },
202
       },
226
       idx: 0,
203
       idx: 0,
227
-      sum: 20
228
-    }
204
+      sum: 20,
205
+    };
229
     let groupData = {
206
     let groupData = {
230
       group2: {
207
       group2: {
231
         hospitals: id,
208
         hospitals: id,
232
       },
209
       },
233
       idx: 0,
210
       idx: 0,
234
-      sum: 9999
235
-    }
236
-    this.mainService.getFetchDataList('data', 'department', departmentData).subscribe(data => {
237
-      this.alldepart1 = data.list;
238
-    })
239
-    this.mainService.getFetchDataList('data', 'group2', groupData).subscribe(data => {
240
-      this.allUserGroup1 = data.list;
241
-    })
211
+      sum: 9999,
212
+    };
213
+    this.mainService
214
+      .getFetchDataList("data", "department", departmentData)
215
+      .subscribe((data) => {
216
+        this.alldepart1 = data.list;
217
+      });
218
+    this.mainService
219
+      .getFetchDataList("data", "group2", groupData)
220
+      .subscribe((data) => {
221
+        this.allUserGroup1 = data.list;
222
+      });
242
   }
223
   }
243
 
224
 
244
   // 获取性别
225
   // 获取性别
245
   genders: Array<any> = [];
226
   genders: Array<any> = [];
246
   getGender() {
227
   getGender() {
247
     var that = this;
228
     var that = this;
248
-    that.mainService.getDictionary('list', 'user_gender').subscribe(data => {
229
+    that.mainService.getDictionary("list", "user_gender").subscribe((data) => {
249
       that.genders = data;
230
       that.genders = data;
250
-    })
231
+    });
251
   }
232
   }
252
 
233
 
253
   // 新增弹框
234
   // 新增弹框
@@ -258,7 +239,7 @@ export class UsersManagementComponent implements OnInit {
258
   }
239
   }
259
   hideModal() {
240
   hideModal() {
260
     this.modal = false;
241
     this.modal = false;
261
-    this.initForm()
242
+    this.initForm();
262
   }
243
   }
263
 
244
 
264
   // 初始化新增form表单
245
   // 初始化新增form表单
@@ -276,22 +257,22 @@ export class UsersManagementComponent implements OnInit {
276
       gender: [null, [Validators.required]],
257
       gender: [null, [Validators.required]],
277
       userGroup: [null],
258
       userGroup: [null],
278
       role: [null, [Validators.required]],
259
       role: [null, [Validators.required]],
279
-      weixin: [null]
260
+      weixin: [null],
280
     });
261
     });
281
   }
262
   }
282
   // 选择用户类型
263
   // 选择用户类型
283
   usertypeChange() {
264
   usertypeChange() {
284
-    if (this.validateForm.value.usertype == 106) {//支助人员
285
-      this.wxRequired = true
286
-      this.validateForm.get('weixin')!.setValidators(Validators.required);
287
-      this.validateForm.get('weixin')!.markAsDirty();
265
+    if (this.validateForm.value.usertype == 106) {
266
+      //支助人员
267
+      this.wxRequired = true;
268
+      this.validateForm.get("weixin")!.setValidators(Validators.required);
269
+      this.validateForm.get("weixin")!.markAsDirty();
288
     } else {
270
     } else {
289
-      this.wxRequired = false
290
-      this.validateForm.get('weixin')!.clearValidators();
291
-      this.validateForm.get('weixin')!.markAsPristine();
292
-
271
+      this.wxRequired = false;
272
+      this.validateForm.get("weixin")!.clearValidators();
273
+      this.validateForm.get("weixin")!.markAsPristine();
293
     }
274
     }
294
-    this.validateForm.get('weixin')!.updateValueAndValidity();
275
+    this.validateForm.get("weixin")!.updateValueAndValidity();
295
   }
276
   }
296
   // 表单提交
277
   // 表单提交
297
   submitForm(): void {
278
   submitForm(): void {
@@ -302,14 +283,15 @@ export class UsersManagementComponent implements OnInit {
302
     }
283
     }
303
     if (that.validateForm.invalid) return;
284
     if (that.validateForm.invalid) return;
304
     that.btnLoading = true;
285
     that.btnLoading = true;
305
-    let groups = [], roles = [];
286
+    let groups = [],
287
+      roles = [];
306
     if (that.validateForm.value.userGroup) {
288
     if (that.validateForm.value.userGroup) {
307
-      that.validateForm.value.userGroup.forEach(element => {
308
-        groups.push({ 'id': element })
289
+      that.validateForm.value.userGroup.forEach((element) => {
290
+        groups.push({ id: element });
309
       });
291
       });
310
     }
292
     }
311
-    that.validateForm.value.role.forEach(element => {
312
-      roles.push({ 'id': element })
293
+    that.validateForm.value.role.forEach((element) => {
294
+      roles.push({ id: element });
313
     });
295
     });
314
     let data = {
296
     let data = {
315
       user: {
297
       user: {
@@ -323,27 +305,28 @@ export class UsersManagementComponent implements OnInit {
323
         phone: that.validateForm.value.deptPhone,
305
         phone: that.validateForm.value.deptPhone,
324
         hospital: { id: that.hosId },
306
         hospital: { id: that.hosId },
325
         weixin: that.validateForm.value.weixin,
307
         weixin: that.validateForm.value.weixin,
326
-      }
327
-    }
308
+      },
309
+    };
328
     if (!that.validateForm.value.userGroup) {
310
     if (!that.validateForm.value.userGroup) {
329
-      delete data.user.group
311
+      delete data.user.group;
330
     } else if (that.validateForm.value.userGroup.length === 0) {
312
     } else if (that.validateForm.value.userGroup.length === 0) {
331
-      delete data.user.group
313
+      delete data.user.group;
332
     }
314
     }
333
     if (!that.add) {
315
     if (!that.add) {
334
-      data.user['id'] = that.coopId;
316
+      data.user["id"] = that.coopId;
335
     }
317
     }
336
-    that.mainService.coopData((that.add ? 'addData' : 'updData'), 'user', data).subscribe(data => {
337
-      that.btnLoading = false;
338
-      that.hideModal();
339
-      that.initForm();
340
-      if (data.status == 200) {
341
-        that.showPromptModal((that.add ? '新增' : '编辑'), true, '');
342
-      } else {
343
-        that.showPromptModal((that.add ? '新增' : '编辑'), false, data.msg);
344
-      }
345
-    })
346
-
318
+    that.mainService
319
+      .coopData(that.add ? "addData" : "updData", "user", data)
320
+      .subscribe((data) => {
321
+        that.btnLoading = false;
322
+        that.hideModal();
323
+        that.initForm();
324
+        if (data.status == 200) {
325
+          that.showPromptModal(that.add ? "新增" : "编辑", true, "");
326
+        } else {
327
+          that.showPromptModal(that.add ? "新增" : "编辑", false, data.msg);
328
+        }
329
+      });
347
   }
330
   }
348
 
331
 
349
   // 编辑
332
   // 编辑
@@ -356,64 +339,75 @@ export class UsersManagementComponent implements OnInit {
356
         hospital: { id: hid },
339
         hospital: { id: hid },
357
       },
340
       },
358
       idx: 0,
341
       idx: 0,
359
-      sum: 20
360
-    }
342
+      sum: 20,
343
+    };
361
     let groupData = {
344
     let groupData = {
362
       group2: {
345
       group2: {
363
         hospitals: hid,
346
         hospitals: hid,
364
       },
347
       },
365
       idx: 0,
348
       idx: 0,
366
-      sum: 9999
367
-    }
368
-    this.maskFlag = this.message.loading('正在加载中..', { nzDuration: 0 }).messageId;
369
-    this.mainService.getFetchDataList('data', 'group2', groupData).subscribe(item1 => {
370
-      this.allUserGroup = item1.list;
371
-      this.mainService.getFetchDataList('data', 'department', departmentData).subscribe(item2 => {
372
-        this.message.remove(this.maskFlag);
373
-        this.maskFlag = false;
374
-        this.modal = true;
375
-        this.alldepart = item2.list;
376
-        if (data.dept) {
377
-          let has = item2.list.some(d => d.id == data.dept.id);
378
-          if (!has) {
379
-            this.alldepart = [data.dept, ...item2.list];
380
-          }
381
-        }
382
-        this.isLoading = false;
383
-        // ------------------------
384
-        this.add = false;
385
-        this.coopId = data.id;
386
-        let groups = [], roles = [];
387
-        if (data.group) {
388
-          data.group.forEach(element => {
389
-            groups.push(element['id'] + '');
390
-          });
391
-        }
392
-        if (data.role) {
393
-          data.role.forEach(element => {
394
-            roles.push(element['id'] + '');
349
+      sum: 9999,
350
+    };
351
+    this.maskFlag = this.message.loading("正在加载中..", {
352
+      nzDuration: 0,
353
+    }).messageId;
354
+    this.mainService
355
+      .getFetchDataList("data", "group2", groupData)
356
+      .subscribe((item1) => {
357
+        this.allUserGroup = item1.list;
358
+        this.mainService
359
+          .getFetchDataList("data", "department", departmentData)
360
+          .subscribe((item2) => {
361
+            this.message.remove(this.maskFlag);
362
+            this.maskFlag = false;
363
+            this.modal = true;
364
+            this.alldepart = item2.list;
365
+            if (data.dept) {
366
+              let has = item2.list.some((d) => d.id == data.dept.id);
367
+              if (!has) {
368
+                this.alldepart = [data.dept, ...item2.list];
369
+              }
370
+            }
371
+            this.isLoading = false;
372
+            // ------------------------
373
+            this.add = false;
374
+            this.coopId = data.id;
375
+            let groups = [],
376
+              roles = [];
377
+            if (data.group) {
378
+              data.group.forEach((element) => {
379
+                groups.push(element["id"] + "");
380
+              });
381
+            }
382
+            if (data.role) {
383
+              data.role.forEach((element) => {
384
+                roles.push(element["id"] + "");
385
+              });
386
+            }
387
+            this.validateForm.controls.name.setValue(data.name);
388
+            this.validateForm.controls.account.setValue(data.account);
389
+            this.validateForm.controls.usertype.setValue(data.usertype.id + "");
390
+            if (data.dept) {
391
+              this.validateForm.controls.dept.setValue(data.dept.id);
392
+            }
393
+            this.validateForm.controls.deptPhone.setValue(data.phone);
394
+            this.validateForm.controls.gender.setValue(data.gender.id + "");
395
+            this.validateForm.controls.userGroup.setValue(
396
+              groups.length ? groups : null
397
+            );
398
+            this.validateForm.controls.role.setValue(
399
+              roles.length ? roles : null
400
+            );
401
+            this.validateForm.controls.gender.setValue(data.gender.id + "");
402
+            this.validateForm.controls.weixin.setValue(data.weixin);
403
+            this.usertypeChange();
395
           });
404
           });
396
-        }
397
-        this.validateForm.controls.name.setValue(data.name);
398
-        this.validateForm.controls.account.setValue(data.account);
399
-        this.validateForm.controls.usertype.setValue(data.usertype.id + '');
400
-        if (data.dept) {
401
-          this.validateForm.controls.dept.setValue(data.dept.id);
402
-        }
403
-        this.validateForm.controls.deptPhone.setValue(data.phone);
404
-        this.validateForm.controls.gender.setValue(data.gender.id + '');
405
-        this.validateForm.controls.userGroup.setValue(groups.length ? groups : null);
406
-        this.validateForm.controls.role.setValue(roles.length ? roles : null);
407
-        this.validateForm.controls.gender.setValue(data.gender.id + '');
408
-        this.validateForm.controls.weixin.setValue(data.weixin);
409
-        this.usertypeChange()
410
-      })
411
-    })
405
+      });
412
     // ----------------
406
     // ----------------
413
   }
407
   }
414
 
408
 
415
   // 删除
409
   // 删除
416
-  delModal: boolean = false;//删除模态框
410
+  delModal: boolean = false; //删除模态框
417
   del(data) {
411
   del(data) {
418
     let that = this;
412
     let that = this;
419
     that.coopId = data.id;
413
     that.coopId = data.id;
@@ -423,19 +417,24 @@ export class UsersManagementComponent implements OnInit {
423
   confirmDel() {
417
   confirmDel() {
424
     let that = this;
418
     let that = this;
425
     that.btnLoading = true;
419
     that.btnLoading = true;
426
-    that.mainService.coopData('rmvData', 'user', [that.coopId]).subscribe(data => {
427
-      that.btnLoading = false;
428
-      that.hideDelModal();
429
-      if (data.status == 200) {
430
-        if (that.listOfData.length == 1 && that.pageIndex == Math.ceil(that.listLength / that.pageSize)) {
431
-          that.listLength--;
432
-          that.pageIndex = Math.ceil(that.listLength / that.pageSize);
420
+    that.mainService
421
+      .coopData("rmvData", "user", [that.coopId])
422
+      .subscribe((data) => {
423
+        that.btnLoading = false;
424
+        that.hideDelModal();
425
+        if (data.status == 200) {
426
+          if (
427
+            that.listOfData.length == 1 &&
428
+            that.pageIndex == Math.ceil(that.listLength / that.pageSize)
429
+          ) {
430
+            that.listLength--;
431
+            that.pageIndex = Math.ceil(that.listLength / that.pageSize);
432
+          }
433
+          that.showPromptModal("删除", true, "");
434
+        } else {
435
+          that.showPromptModal("删除", false, data.msg);
433
         }
436
         }
434
-        that.showPromptModal('删除', true, '');
435
-      } else {
436
-        that.showPromptModal('删除', false, data.msg);
437
-      }
438
-    })
437
+      });
439
   }
438
   }
440
   // 关闭删除模态框
439
   // 关闭删除模态框
441
   hideDelModal() {
440
   hideDelModal() {
@@ -456,21 +455,21 @@ export class UsersManagementComponent implements OnInit {
456
 
455
 
457
   // 查看
456
   // 查看
458
   detail(id) {
457
   detail(id) {
459
-    this.router.navigateByUrl('/main/usersManagement/userDetail/' + id);
458
+    this.router.navigateByUrl("/main/usersManagement/userDetail/" + id);
460
   }
459
   }
461
   // 边输边搜节流阀
460
   // 边输边搜节流阀
462
   isLoading = false;
461
   isLoading = false;
463
   changeInp(deptId, type, e) {
462
   changeInp(deptId, type, e) {
464
     if (!deptId) {
463
     if (!deptId) {
465
-      if (type == 'search') {
464
+      if (type == "search") {
466
         this.alldepart1 = [];
465
         this.alldepart1 = [];
467
-      } else if (type == 'add') {
466
+      } else if (type == "add") {
468
         this.alldepart = [];
467
         this.alldepart = [];
469
       }
468
       }
470
       return;
469
       return;
471
     }
470
     }
472
     this.isLoading = true;
471
     this.isLoading = true;
473
-    this.changeInpSubject.next([deptId, type, e])
472
+    this.changeInpSubject.next([deptId, type, e]);
474
   }
473
   }
475
   // 获取所有科室
474
   // 获取所有科室
476
   snum = 0;
475
   snum = 0;
@@ -480,23 +479,25 @@ export class UsersManagementComponent implements OnInit {
480
       department: {
479
       department: {
481
         dept,
480
         dept,
482
         hospital: {
481
         hospital: {
483
-          id: deptId
484
-        }
482
+          id: deptId,
483
+        },
485
       },
484
       },
486
       idx: 0,
485
       idx: 0,
487
-      sum: 20
488
-    }
486
+      sum: 20,
487
+    };
489
     this.snum++;
488
     this.snum++;
490
-    that.mainService.getFetchDataList('data', 'department', data).subscribe(data => {
491
-      this.snum--;
492
-      if (type == 'search') {
493
-        that.alldepart1 = data.list;
494
-      } else if (type == 'add') {
495
-        that.alldepart = data.list;
496
-      }
497
-      if (this.snum === 0) {
498
-        that.isLoading = false;
499
-      }
500
-    })
489
+    that.mainService
490
+      .getFetchDataList("data", "department", data)
491
+      .subscribe((data) => {
492
+        this.snum--;
493
+        if (type == "search") {
494
+          that.alldepart1 = data.list;
495
+        } else if (type == "add") {
496
+          that.alldepart = data.list;
497
+        }
498
+        if (this.snum === 0) {
499
+          that.isLoading = false;
500
+        }
501
+      });
501
   }
502
   }
502
 }
503
 }

+ 122 - 115
src/app/views/wechat-config/wechat-config.component.ts

@@ -1,76 +1,61 @@
1
-import { Component, OnInit, ViewChild } from '@angular/core';
2
-import { FormBuilder, FormGroup, Validators } from '@angular/forms';
3
-import { ActivatedRoute } from '@angular/router';
4
-import { OverlayScrollbarsComponent } from 'overlayscrollbars-ngx';
1
+import { Component, OnInit, ViewChild } from "@angular/core";
2
+import { FormBuilder, FormGroup, Validators } from "@angular/forms";
3
+import { ActivatedRoute } from "@angular/router";
4
+import { OverlayScrollbarsComponent } from "overlayscrollbars-ngx";
5
 import { MainService } from "../../services/main.service";
5
 import { MainService } from "../../services/main.service";
6
-import { ToolService } from '../../services/tool.service';
7
-import { Subject } from 'rxjs';
8
-import { debounceTime } from 'rxjs/operators';
6
+import { ToolService } from "../../services/tool.service";
7
+import { Subject } from "rxjs";
8
+import { debounceTime } from "rxjs/operators";
9
 
9
 
10
 @Component({
10
 @Component({
11
-  selector: 'app-wechat-config',
12
-  templateUrl: './wechat-config.component.html',
13
-  styleUrls: ['./wechat-config.component.less']
11
+  selector: "app-wechat-config",
12
+  templateUrl: "./wechat-config.component.html",
13
+  styleUrls: ["./wechat-config.component.less"],
14
 })
14
 })
15
 export class WechatConfigComponent implements OnInit {
15
 export class WechatConfigComponent implements OnInit {
16
   validateForm: FormGroup;
16
   validateForm: FormGroup;
17
-  loading1 = false;//查询信息的loading
18
-  loading2 = false;//保存信息的loading
19
-  roleList = [];//角色列表
20
-  groupList = [];//组列表
21
-  deptList = [];//科室列表
22
-  id = -1;//修改配置的id
23
-  promptContent: string;//操作提示框提示信息
24
-  ifSuccess: boolean;//操作成功/失败
25
-  promptInfo: string;//操作结果提示信息
26
-  promptModalShow: boolean;//操作提示框是否展示
27
-  coopBtns = { //初始化权限
28
-    edit: false,
29
-  };
30
-  hosId: '';//院区ID
31
-  hospitals = [];//所属院区
32
-  menu = JSON.parse(localStorage.getItem('menu')) || [];//菜单
33
-  loading3 = false;//科室
34
-  constructor(private mainService: MainService, private fb: FormBuilder, private route: ActivatedRoute, private tool: ToolService) { }
35
-  @ViewChild('osComponentRef1', { read: OverlayScrollbarsComponent, static: false })
17
+  loading1 = false; //查询信息的loading
18
+  loading2 = false; //保存信息的loading
19
+  roleList = []; //角色列表
20
+  groupList = []; //组列表
21
+  deptList = []; //科室列表
22
+  id = -1; //修改配置的id
23
+  promptContent: string; //操作提示框提示信息
24
+  ifSuccess: boolean; //操作成功/失败
25
+  promptInfo: string; //操作结果提示信息
26
+  promptModalShow: boolean; //操作提示框是否展示
27
+  coopBtns = {};
28
+  hosId: ""; //院区ID
29
+  hospitals = []; //所属院区
30
+  loading3 = false; //科室
31
+  constructor(
32
+    private mainService: MainService,
33
+    private fb: FormBuilder,
34
+    private route: ActivatedRoute,
35
+    private tool: ToolService
36
+  ) {}
37
+  @ViewChild("osComponentRef1", {
38
+    read: OverlayScrollbarsComponent,
39
+    static: false,
40
+  })
36
   osComponentRef1: OverlayScrollbarsComponent;
41
   osComponentRef1: OverlayScrollbarsComponent;
37
   onDeptSearchSubject = new Subject();
42
   onDeptSearchSubject = new Subject();
38
   ngOnInit() {
43
   ngOnInit() {
39
-    this.onDeptSearchSubject.pipe(debounceTime(500)).subscribe(v => {
44
+    this.onDeptSearchSubject.pipe(debounceTime(500)).subscribe((v) => {
40
       this.onDeptSearch(v);
45
       this.onDeptSearch(v);
41
-    })
46
+    });
42
     this.hospitals = this.tool.getHospitalList();
47
     this.hospitals = this.tool.getHospitalList();
43
     this.validateForm = this.fb.group({
48
     this.validateForm = this.fb.group({
44
       appid: [null, [Validators.required]],
49
       appid: [null, [Validators.required]],
45
       agentid: [null, [Validators.required]],
50
       agentid: [null, [Validators.required]],
46
-      autoCreateUser: ['1', [Validators.required]],
51
+      autoCreateUser: ["1", [Validators.required]],
47
       defaultRole: [null, [Validators.required]],
52
       defaultRole: [null, [Validators.required]],
48
       defaultHospital: [null, [Validators.required]],
53
       defaultHospital: [null, [Validators.required]],
49
       defaultDept: [null, [Validators.required]],
54
       defaultDept: [null, [Validators.required]],
50
       defaultGroup: [null, [Validators.required]],
55
       defaultGroup: [null, [Validators.required]],
51
     });
56
     });
52
     this.getRoleList();
57
     this.getRoleList();
53
-    this.initCoopBtns();
54
-  }
55
-  // 获取当前菜单权限
56
-  initCoopBtns() {
57
-    // 二级菜单
58
-    let secondMenus = []
59
-    this.menu.forEach(e => {
60
-      e.childrens.forEach(el => {
61
-        secondMenus.push(el)
62
-      });
63
-    });
64
-    let link = this.route.parent.snapshot.routeConfig.path;
65
-    let btns = []
66
-    secondMenus.forEach(e => {
67
-      if (e.link == link) {
68
-        btns = e.childrens || [];
69
-      }
70
-    });
71
-    btns.forEach(e => {
72
-      this.coopBtns[e.link] = true;
73
-    })
58
+    this.coopBtns = this.tool.initCoopBtns(this.route);
74
   }
59
   }
75
   // 保存
60
   // 保存
76
   submitForm(): void {
61
   submitForm(): void {
@@ -80,79 +65,97 @@ export class WechatConfigComponent implements OnInit {
80
     }
65
     }
81
     if (this.validateForm.invalid) {
66
     if (this.validateForm.invalid) {
82
       return;
67
       return;
83
-    };
68
+    }
84
     const postData = {
69
     const postData = {
85
       id: this.id,
70
       id: this.id,
86
-      createUser: this.validateForm.controls.autoCreateUser.value === '1' ? 1 : 0,
71
+      createUser:
72
+        this.validateForm.controls.autoCreateUser.value === "1" ? 1 : 0,
87
       defaultRole: this.validateForm.controls.defaultRole.value,
73
       defaultRole: this.validateForm.controls.defaultRole.value,
88
       hospital: this.validateForm.controls.defaultHospital.value,
74
       hospital: this.validateForm.controls.defaultHospital.value,
89
       defaultDept: this.validateForm.controls.defaultDept.value,
75
       defaultDept: this.validateForm.controls.defaultDept.value,
90
       defaultGroup: this.validateForm.controls.defaultGroup.value,
76
       defaultGroup: this.validateForm.controls.defaultGroup.value,
91
     };
77
     };
92
     this.loading2 = true;
78
     this.loading2 = true;
93
-    this.mainService.changeWechatConfig(postData).subscribe(result => {
94
-      this.loading2 = false;
95
-      if (result['status'] == 200) {
96
-        this.showPromptModal('保存', true, '');
97
-      } else {
98
-        this.showPromptModal('保存', false, '');
79
+    this.mainService.changeWechatConfig(postData).subscribe(
80
+      (result) => {
81
+        this.loading2 = false;
82
+        if (result["status"] == 200) {
83
+          this.showPromptModal("保存", true, "");
84
+        } else {
85
+          this.showPromptModal("保存", false, "");
86
+        }
87
+      },
88
+      (error) => {
89
+        this.loading2 = false;
90
+        this.showPromptModal("保存", false, "");
99
       }
91
       }
100
-    }, error => {
101
-      this.loading2 = false;
102
-      this.showPromptModal('保存', false, '');
103
-    })
92
+    );
104
   }
93
   }
105
   // 获取微信配置
94
   // 获取微信配置
106
   getWechatConfig() {
95
   getWechatConfig() {
107
-    const postData = { "idx": 0, "sum": 1 };
108
-    this.mainService.getFetchDataList('simple/data', 'wechatConfig', postData).subscribe(result => {
109
-      if (result.status == 200) {
110
-        const config = result.list[0];
111
-        if (!config) {
112
-          this.loading1 = false;
113
-          return;
114
-        }
115
-        this.hosId = config.hospital;
116
-        this.getGroupList(config.hospital).subscribe(result1 => {
117
-          if (result1.status == 200) {
118
-            this.groupList = result1.list;
119
-            this.getDeptList(config.hospital).subscribe(result2 => {
120
-              if (result2.status == 200) {
121
-                this.loading1 = false;
122
-                this.deptList = result2.list;
123
-                this.id = config.id;
124
-                this.validateForm.controls.appid.setValue(config.appId);
125
-                this.validateForm.controls.agentid.setValue(config.agentId);
126
-                this.validateForm.controls.autoCreateUser.setValue(config.createUser ? '1' : '0');
127
-                this.validateForm.controls.defaultRole.setValue(config.defaultRole);
128
-                this.validateForm.controls.defaultHospital.setValue(config.hospital);
129
-                this.validateForm.controls.defaultDept.setValue(config.defaultDept);
130
-                this.validateForm.controls.defaultGroup.setValue(config.defaultGroup);
131
-              } else {
132
-                this.loading1 = false;
133
-              }
134
-            });
135
-          } else {
96
+    const postData = { idx: 0, sum: 1 };
97
+    this.mainService
98
+      .getFetchDataList("simple/data", "wechatConfig", postData)
99
+      .subscribe((result) => {
100
+        if (result.status == 200) {
101
+          const config = result.list[0];
102
+          if (!config) {
136
             this.loading1 = false;
103
             this.loading1 = false;
104
+            return;
137
           }
105
           }
138
-        });
139
-      } else {
140
-        this.loading1 = false;
141
-      }
142
-    })
106
+          this.hosId = config.hospital;
107
+          this.getGroupList(config.hospital).subscribe((result1) => {
108
+            if (result1.status == 200) {
109
+              this.groupList = result1.list;
110
+              this.getDeptList(config.hospital).subscribe((result2) => {
111
+                if (result2.status == 200) {
112
+                  this.loading1 = false;
113
+                  this.deptList = result2.list;
114
+                  this.id = config.id;
115
+                  this.validateForm.controls.appid.setValue(config.appId);
116
+                  this.validateForm.controls.agentid.setValue(config.agentId);
117
+                  this.validateForm.controls.autoCreateUser.setValue(
118
+                    config.createUser ? "1" : "0"
119
+                  );
120
+                  this.validateForm.controls.defaultRole.setValue(
121
+                    config.defaultRole
122
+                  );
123
+                  this.validateForm.controls.defaultHospital.setValue(
124
+                    config.hospital
125
+                  );
126
+                  this.validateForm.controls.defaultDept.setValue(
127
+                    config.defaultDept
128
+                  );
129
+                  this.validateForm.controls.defaultGroup.setValue(
130
+                    config.defaultGroup
131
+                  );
132
+                } else {
133
+                  this.loading1 = false;
134
+                }
135
+              });
136
+            } else {
137
+              this.loading1 = false;
138
+            }
139
+          });
140
+        } else {
141
+          this.loading1 = false;
142
+        }
143
+      });
143
   }
144
   }
144
   // 获取角色列表
145
   // 获取角色列表
145
   getRoleList() {
146
   getRoleList() {
146
-    const postData = { "idx": 0, "sum": 1000 };
147
+    const postData = { idx: 0, sum: 1000 };
147
     this.loading1 = true;
148
     this.loading1 = true;
148
-    this.mainService.getFetchDataList('data', 'role', postData).subscribe(result => {
149
-      if (result.status == 200) {
150
-        this.roleList = result.list;
151
-        this.getWechatConfig();
152
-      } else {
153
-        this.loading1 = false;
154
-      }
155
-    })
149
+    this.mainService
150
+      .getFetchDataList("data", "role", postData)
151
+      .subscribe((result) => {
152
+        if (result.status == 200) {
153
+          this.roleList = result.list;
154
+          this.getWechatConfig();
155
+        } else {
156
+          this.loading1 = false;
157
+        }
158
+      });
156
   }
159
   }
157
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
160
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
158
   showPromptModal(con, success, promptInfo) {
161
   showPromptModal(con, success, promptInfo) {
@@ -168,10 +171,10 @@ export class WechatConfigComponent implements OnInit {
168
   //修改默认院区
171
   //修改默认院区
169
   hospitalChange(hosId) {
172
   hospitalChange(hosId) {
170
     this.hosId = hosId;
173
     this.hosId = hosId;
171
-    this.getGroupList(hosId).subscribe(result => {
174
+    this.getGroupList(hosId).subscribe((result) => {
172
       if (result.status == 200) {
175
       if (result.status == 200) {
173
         this.groupList = result.list;
176
         this.groupList = result.list;
174
-        this.getDeptList(hosId).subscribe(result1 => {
177
+        this.getDeptList(hosId).subscribe((result1) => {
175
           if (result1.status == 200) {
178
           if (result1.status == 200) {
176
             this.deptList = result1.list;
179
             this.deptList = result1.list;
177
           }
180
           }
@@ -181,16 +184,20 @@ export class WechatConfigComponent implements OnInit {
181
   }
184
   }
182
   // 获取科室列表
185
   // 获取科室列表
183
   getDeptList(hosId, value?) {
186
   getDeptList(hosId, value?) {
184
-    const postData: any = { "idx": 0, "sum": 20, "department": { "hospital": { "id": hosId } } };
187
+    const postData: any = {
188
+      idx: 0,
189
+      sum: 20,
190
+      department: { hospital: { id: hosId } },
191
+    };
185
     if (value) {
192
     if (value) {
186
       postData.department.dept = value;
193
       postData.department.dept = value;
187
     }
194
     }
188
-    return this.mainService.getFetchDataList('data', 'department', postData);
195
+    return this.mainService.getFetchDataList("data", "department", postData);
189
   }
196
   }
190
   // 获取组列表
197
   // 获取组列表
191
   getGroupList(hosId) {
198
   getGroupList(hosId) {
192
-    const postData = { "idx": 0, "sum": 9999, "group2": { "hospitals": hosId } };
193
-    return this.mainService.getFetchDataList('data', 'group2', postData);
199
+    const postData = { idx: 0, sum: 9999, group2: { hospitals: hosId } };
200
+    return this.mainService.getFetchDataList("data", "group2", postData);
194
   }
201
   }
195
   //搜索科室
202
   //搜索科室
196
   onDeptSearchNew(value) {
203
   onDeptSearchNew(value) {
@@ -199,7 +206,7 @@ export class WechatConfigComponent implements OnInit {
199
   }
206
   }
200
   //搜索科室
207
   //搜索科室
201
   onDeptSearch(value): void {
208
   onDeptSearch(value): void {
202
-    this.getDeptList(this.hosId, value).subscribe(result => {
209
+    this.getDeptList(this.hosId, value).subscribe((result) => {
203
       this.loading3 = false;
210
       this.loading3 = false;
204
       if (result.status == 200) {
211
       if (result.status == 200) {
205
         this.deptList = result.list;
212
         this.deptList = result.list;

+ 229 - 224
src/app/views/work-assignment/work-assignment.component.ts

@@ -1,116 +1,90 @@
1
-import { Component, OnInit } from '@angular/core';
2
-import { ActivatedRoute, Router } from '@angular/router';
3
-import { FormBuilder, Validators, FormGroup, FormControl } from '@angular/forms';
4
-import setSeconds from 'date-fns/setSeconds';
5
-import setMinutes from 'date-fns/setMinutes';
6
-import setHours from 'date-fns/setHours';
1
+import { Component, OnInit } from "@angular/core";
2
+import { ActivatedRoute, Router } from "@angular/router";
3
+import { FormBuilder, Validators, FormGroup } from "@angular/forms";
4
+import setSeconds from "date-fns/setSeconds";
5
+import setMinutes from "date-fns/setMinutes";
6
+import setHours from "date-fns/setHours";
7
 
7
 
8
-import { MainService } from "../../services/main.service"
9
-import { DisabledTimeFn } from 'ng-zorro-antd/date-picker/standard-types';
10
-import { ToolService } from '../../services/tool.service';
8
+import { MainService } from "../../services/main.service";
9
+import { DisabledTimeFn } from "ng-zorro-antd/date-picker/standard-types";
10
+import { ToolService } from "../../services/tool.service";
11
 @Component({
11
 @Component({
12
-  selector: 'app-work-assignment',
13
-  templateUrl: './work-assignment.component.html',
14
-  styleUrls: ['./work-assignment.component.less']
12
+  selector: "app-work-assignment",
13
+  templateUrl: "./work-assignment.component.html",
14
+  styleUrls: ["./work-assignment.component.less"],
15
 })
15
 })
16
 export class WorkAssignmentComponent implements OnInit {
16
 export class WorkAssignmentComponent implements OnInit {
17
-
18
   constructor(
17
   constructor(
19
     private fb: FormBuilder,
18
     private fb: FormBuilder,
20
     private mainService: MainService,
19
     private mainService: MainService,
21
     private route: ActivatedRoute,
20
     private route: ActivatedRoute,
22
     private router: Router,
21
     private router: Router,
23
-    private tool: ToolService,
24
-  ) { }
22
+    private tool: ToolService
23
+  ) {}
25
 
24
 
26
-  userInfo: any = JSON.parse(localStorage.getItem('user')) || {};//登录用户信息
27
-  menu: any = JSON.parse(localStorage.getItem('menu')) || [];//菜单
28
-  listOfData: any[] = [];//表格数据
29
-  pageIndex: number = 1;//表格当前页码
30
-  pageSize: number = 10;//表格每页展示条数
31
-  listLength: number = 10;//表格总数据量
32
-  tableHeight: number;//表格动态高
33
-  modal: boolean = false;//新增/编辑模态框
34
-  dateModal: boolean = false;//定时启用设置日期模态框
35
-  add: boolean;//true:新增;false:编辑
36
-  validateForm: FormGroup;//新增/编辑表单
37
-  validateDateForm: FormGroup;//定时启动设置日期表单
38
-  coopId: any;//当前操作列
39
-  currentHospital;//当前院区
25
+  userInfo: any = JSON.parse(localStorage.getItem("user")) || {}; //登录用户信息
26
+  listOfData: any[] = []; //表格数据
27
+  pageIndex: number = 1; //表格当前页码
28
+  pageSize: number = 10; //表格每页展示条数
29
+  listLength: number = 10; //表格总数据量
30
+  tableHeight: number; //表格动态高
31
+  modal: boolean = false; //新增/编辑模态框
32
+  dateModal: boolean = false; //定时启用设置日期模态框
33
+  add: boolean; //true:新增;false:编辑
34
+  validateForm: FormGroup; //新增/编辑表单
35
+  validateDateForm: FormGroup; //定时启动设置日期表单
36
+  coopId: any; //当前操作列
37
+  currentHospital; //当前院区
40
   timeDefaultValue = setHours(setMinutes(setSeconds(new Date(), 0), 0), 0);
38
   timeDefaultValue = setHours(setMinutes(setSeconds(new Date(), 0), 0), 0);
41
 
39
 
42
-  btnLoading: boolean = false;//提交按钮loading状态
40
+  btnLoading: boolean = false; //提交按钮loading状态
43
 
41
 
44
-  promptContent: string;//操作提示框提示信息
45
-  ifSuccess: boolean;//操作成功/失败
46
-  promptInfo: string;//操作结果提示信息
47
-  promptModalShow: boolean;//操作提示框是否展示
48
-  nextSchemeName = '';//下一个开启的方案名称
49
-  modelName = '';//模态框名称
42
+  promptContent: string; //操作提示框提示信息
43
+  ifSuccess: boolean; //操作成功/失败
44
+  promptInfo: string; //操作结果提示信息
45
+  promptModalShow: boolean; //操作提示框是否展示
46
+  nextSchemeName = ""; //下一个开启的方案名称
47
+  modelName = ""; //模态框名称
50
 
48
 
51
   ngOnInit() {
49
   ngOnInit() {
52
     this.currentHospital = this.tool.getCurrentHospital();
50
     this.currentHospital = this.tool.getCurrentHospital();
53
-    this.initCoopBtns();
51
+    this.coopBtns = this.tool.initCoopBtns(this.route);
54
     this.initForm();
52
     this.initForm();
55
     this.getList(1);
53
     this.getList(1);
56
   }
54
   }
57
 
55
 
58
   // 初始化增删改按钮
56
   // 初始化增删改按钮
59
-  coopBtns: any = {
60
-    add: false,
61
-    edit: false,
62
-    del: false,
63
-    isStartUp: false,
64
-    isTimedStartUp: false,
65
-    copy: false
66
-  };
67
-  initCoopBtns() {
68
-    // 二级菜单
69
-    let secondMenus = []
70
-    this.menu.forEach(e => {
71
-      e.childrens.forEach(el => {
72
-        secondMenus.push(el)
73
-      });
74
-    });
75
-    let link = this.route.parent.snapshot.routeConfig.path;
76
-    let btns = []
77
-    secondMenus.forEach(e => {
78
-      if (e.link == link) {
79
-        btns = e.childrens || [];
80
-      }
81
-    });
82
-    btns.forEach(e => {
83
-      this.coopBtns[e.link] = true;
84
-    })
85
-  }
57
+  coopBtns: any = {};
86
 
58
 
87
   // 表格数据
59
   // 表格数据
88
   loading1 = false;
60
   loading1 = false;
89
   getList(type) {
61
   getList(type) {
90
     if (type == 1) {
62
     if (type == 1) {
91
-      this.pageIndex = 1
63
+      this.pageIndex = 1;
92
     }
64
     }
93
     let data = {
65
     let data = {
94
       idx: this.pageIndex - 1,
66
       idx: this.pageIndex - 1,
95
       sum: this.pageSize,
67
       sum: this.pageSize,
96
       workScheme: {
68
       workScheme: {
97
-        "hosId": this.currentHospital.id
98
-      }
99
-    }
69
+        hosId: this.currentHospital.id,
70
+      },
71
+    };
100
     this.loading1 = true;
72
     this.loading1 = true;
101
-    this.mainService.getFetchDataList('configuration', 'workScheme', data).subscribe(data => {
102
-      this.loading1 = false;
103
-      if (data.status == 200) {
104
-        this.listOfData = data.list;
105
-        this.listLength = data.totalNum;
106
-      }
107
-    })
73
+    this.mainService
74
+      .getFetchDataList("configuration", "workScheme", data)
75
+      .subscribe((data) => {
76
+        this.loading1 = false;
77
+        if (data.status == 200) {
78
+          this.listOfData = data.list;
79
+          this.listLength = data.totalNum;
80
+        }
81
+      });
108
   }
82
   }
109
 
83
 
110
   // 新增弹框
84
   // 新增弹框
111
   addModal() {
85
   addModal() {
112
-    this.modelName = '新增';
113
-    this.add = true;//新增
86
+    this.modelName = "新增";
87
+    this.add = true; //新增
114
     this.modal = true;
88
     this.modal = true;
115
     this.copyModel = false;
89
     this.copyModel = false;
116
     this.initForm();
90
     this.initForm();
@@ -121,15 +95,20 @@ export class WorkAssignmentComponent implements OnInit {
121
     this.initForm();
95
     this.initForm();
122
   }
96
   }
123
   // 新增/编辑弹框
97
   // 新增/编辑弹框
124
-  timeFlag = '';//open开启,close关闭
98
+  timeFlag = ""; //open开启,close关闭
125
   addDateModal(data) {
99
   addDateModal(data) {
126
     if (!data.timingStatus) {
100
     if (!data.timingStatus) {
127
-      this.datePicker = '';
101
+      this.datePicker = "";
128
     }
102
     }
129
-    this.timeFlag = data.timingStatus ? 'close' : 'open';
103
+    this.timeFlag = data.timingStatus ? "close" : "open";
130
     this.coopId = data;
104
     this.coopId = data;
131
-    if (this.timeFlag == 'close') {
132
-      this.showDelModal(data, '是否确定关闭定时启用?确定后该方案将不会执行!', '关闭定时启用', 'switchTime')
105
+    if (this.timeFlag == "close") {
106
+      this.showDelModal(
107
+        data,
108
+        "是否确定关闭定时启用?确定后该方案将不会执行!",
109
+        "关闭定时启用",
110
+        "switchTime"
111
+      );
133
     } else {
112
     } else {
134
       this.dateModal = true;
113
       this.dateModal = true;
135
     }
114
     }
@@ -144,20 +123,19 @@ export class WorkAssignmentComponent implements OnInit {
144
   initForm() {
123
   initForm() {
145
     this.validateForm = this.fb.group({
124
     this.validateForm = this.fb.group({
146
       workAssignmentName: [null, [Validators.required]],
125
       workAssignmentName: [null, [Validators.required]],
147
-      workAssignmentType: ['1', [Validators.required]],
148
-      workAssignmentDescribe: [null, [Validators.required]]
126
+      workAssignmentType: ["1", [Validators.required]],
127
+      workAssignmentDescribe: [null, [Validators.required]],
149
     });
128
     });
150
   }
129
   }
151
   // 初始化新增form表单
130
   // 初始化新增form表单
152
   initDateForm() {
131
   initDateForm() {
153
     this.validateDateForm = this.fb.group({
132
     this.validateDateForm = this.fb.group({
154
-      datePickerTime: [null, [Validators.required]]
133
+      datePickerTime: [null, [Validators.required]],
155
     });
134
     });
156
   }
135
   }
157
 
136
 
158
-
159
   // 新增/编辑表单提交
137
   // 新增/编辑表单提交
160
-  btnLoading1 = false;//完成
138
+  btnLoading1 = false; //完成
161
   submitForm(noGoTo?): void {
139
   submitForm(noGoTo?): void {
162
     for (const i in this.validateForm.controls) {
140
     for (const i in this.validateForm.controls) {
163
       this.validateForm.controls[i].markAsDirty();
141
       this.validateForm.controls[i].markAsDirty();
@@ -165,7 +143,7 @@ export class WorkAssignmentComponent implements OnInit {
165
     }
143
     }
166
     if (this.validateForm.invalid) {
144
     if (this.validateForm.invalid) {
167
       return;
145
       return;
168
-    };
146
+    }
169
     if (noGoTo) {
147
     if (noGoTo) {
170
       this.btnLoading1 = true;
148
       this.btnLoading1 = true;
171
     } else {
149
     } else {
@@ -173,33 +151,33 @@ export class WorkAssignmentComponent implements OnInit {
173
     }
151
     }
174
     let data = {};
152
     let data = {};
175
 
153
 
176
-    if (this.add) {//增加
154
+    if (this.add) {
155
+      //增加
177
       data = {
156
       data = {
178
-        workScheme:
179
-        {
157
+        workScheme: {
180
           name: this.validateForm.value.workAssignmentName,
158
           name: this.validateForm.value.workAssignmentName,
181
           workType: this.validateForm.value.workAssignmentType,
159
           workType: this.validateForm.value.workAssignmentType,
182
           describe: this.validateForm.value.workAssignmentDescribe,
160
           describe: this.validateForm.value.workAssignmentDescribe,
183
           status: 0,
161
           status: 0,
184
-          hosId: this.currentHospital.id
185
-        }
162
+          hosId: this.currentHospital.id,
163
+        },
186
       };
164
       };
187
-    } else {//编辑
165
+    } else {
166
+      //编辑
188
       data = {
167
       data = {
189
-        workScheme:
190
-        {
168
+        workScheme: {
191
           id: this.coopId.id,
169
           id: this.coopId.id,
192
           name: this.validateForm.value.workAssignmentName,
170
           name: this.validateForm.value.workAssignmentName,
193
           workType: this.validateForm.value.workAssignmentType,
171
           workType: this.validateForm.value.workAssignmentType,
194
           describe: this.validateForm.value.workAssignmentDescribe,
172
           describe: this.validateForm.value.workAssignmentDescribe,
195
-          hosId: this.currentHospital.id
196
-        }
173
+          hosId: this.currentHospital.id,
174
+        },
197
       };
175
       };
198
     }
176
     }
199
-    if (this.copyModel) {//复制
177
+    if (this.copyModel) {
178
+      //复制
200
       data = {
179
       data = {
201
-        workScheme:
202
-        {
180
+        workScheme: {
203
           name: this.validateForm.value.workAssignmentName,
181
           name: this.validateForm.value.workAssignmentName,
204
           workType: this.validateForm.value.workAssignmentType,
182
           workType: this.validateForm.value.workAssignmentType,
205
           describe: this.validateForm.value.workAssignmentDescribe,
183
           describe: this.validateForm.value.workAssignmentDescribe,
@@ -207,57 +185,67 @@ export class WorkAssignmentComponent implements OnInit {
207
           copy: 1,
185
           copy: 1,
208
           copySchemeId: this.coopId.id,
186
           copySchemeId: this.coopId.id,
209
           hosId: this.currentHospital.id,
187
           hosId: this.currentHospital.id,
210
-        }
188
+        },
211
       };
189
       };
212
     }
190
     }
213
-    this.mainService.coopTypeConfig('addData', 'workScheme', data).subscribe(result => {
214
-      if (noGoTo) {
215
-        this.btnLoading1 = false;
216
-      } else {
217
-        this.btnLoading = false;
218
-      }
219
-      this.hideAddModal();
220
-      this.initForm();
221
-      if (result.status == 200) {
222
-        if (this.copyModel) {//复制
223
-          this.listLength++;
224
-          this.showPromptModal('复制', true, '');
225
-          if (!noGoTo) {
226
-            this.router.navigateByUrl(`/main/quickCombination?id=${result.data.id}&name=${result.data.name}&type=${result.data.workType}`);
227
-          }
228
-          return;
191
+    this.mainService
192
+      .coopTypeConfig("addData", "workScheme", data)
193
+      .subscribe((result) => {
194
+        if (noGoTo) {
195
+          this.btnLoading1 = false;
196
+        } else {
197
+          this.btnLoading = false;
229
         }
198
         }
230
-        if (!this.add) {//编辑
231
-          this.showPromptModal('编辑', true, '');
232
-          if (!noGoTo) {
233
-            this.router.navigateByUrl(`/main/quickCombination?id=${result.data.id}&name=${result.data.name}&type=${result.data.workType}`);
199
+        this.hideAddModal();
200
+        this.initForm();
201
+        if (result.status == 200) {
202
+          if (this.copyModel) {
203
+            //复制
204
+            this.listLength++;
205
+            this.showPromptModal("复制", true, "");
206
+            if (!noGoTo) {
207
+              this.router.navigateByUrl(
208
+                `/main/quickCombination?id=${result.data.id}&name=${result.data.name}&type=${result.data.workType}`
209
+              );
210
+            }
211
+            return;
234
           }
212
           }
235
-          return;
236
-        }
237
-        if (this.add) {
238
-          this.listLength++;
239
-        }
240
-        this.router.navigateByUrl(`/main/quickCombination?id=${result.data.id}&name=${result.data.name}&type=${result.data.workType}`);
241
-      } else {
242
-        let msg = '';
243
-        if (this.add) {
244
-          msg = '新增'
213
+          if (!this.add) {
214
+            //编辑
215
+            this.showPromptModal("编辑", true, "");
216
+            if (!noGoTo) {
217
+              this.router.navigateByUrl(
218
+                `/main/quickCombination?id=${result.data.id}&name=${result.data.name}&type=${result.data.workType}`
219
+              );
220
+            }
221
+            return;
222
+          }
223
+          if (this.add) {
224
+            this.listLength++;
225
+          }
226
+          this.router.navigateByUrl(
227
+            `/main/quickCombination?id=${result.data.id}&name=${result.data.name}&type=${result.data.workType}`
228
+          );
245
         } else {
229
         } else {
246
-          msg = '修改'
247
-        }
248
-        if (this.copyModel) {
249
-          msg = '复制';
230
+          let msg = "";
231
+          if (this.add) {
232
+            msg = "新增";
233
+          } else {
234
+            msg = "修改";
235
+          }
236
+          if (this.copyModel) {
237
+            msg = "复制";
238
+          }
239
+          this.showPromptModal(msg, false, result.msg);
250
         }
240
         }
251
-        this.showPromptModal(msg, false, result.msg);
252
-      }
253
-    })
241
+      });
254
   }
242
   }
255
   // 时间选择范围
243
   // 时间选择范围
256
   disabledDateTime: DisabledTimeFn = () => {
244
   disabledDateTime: DisabledTimeFn = () => {
257
     return {
245
     return {
258
       nzDisabledHours: () => [],
246
       nzDisabledHours: () => [],
259
       nzDisabledMinutes: () => [],
247
       nzDisabledMinutes: () => [],
260
-      nzDisabledSeconds: () => this.range(1, 60)
248
+      nzDisabledSeconds: () => this.range(1, 60),
261
     };
249
     };
262
   };
250
   };
263
   range(start: number, end: number): number[] {
251
   range(start: number, end: number): number[] {
@@ -277,59 +265,60 @@ export class WorkAssignmentComponent implements OnInit {
277
     if (this.validateDateForm.invalid) {
265
     if (this.validateDateForm.invalid) {
278
       this.btnLoading = false;
266
       this.btnLoading = false;
279
       return;
267
       return;
280
-    };
268
+    }
281
     let data = {};
269
     let data = {};
282
     let todayDate = new Date(this.validateDateForm.value.datePickerTime);
270
     let todayDate = new Date(this.validateDateForm.value.datePickerTime);
283
     let year = todayDate.getFullYear();
271
     let year = todayDate.getFullYear();
284
-    let month = (todayDate.getMonth() + 1).toString().padStart(2, '0');
285
-    let date = todayDate.getDate().toString().padStart(2, '0');
286
-    let hour = todayDate.getHours().toString().padStart(2, '0');
287
-    let minutes = todayDate.getMinutes().toString().padStart(2, '0');
272
+    let month = (todayDate.getMonth() + 1).toString().padStart(2, "0");
273
+    let date = todayDate.getDate().toString().padStart(2, "0");
274
+    let hour = todayDate.getHours().toString().padStart(2, "0");
275
+    let minutes = todayDate.getMinutes().toString().padStart(2, "0");
288
     // 2020-07-28 16:45:00
276
     // 2020-07-28 16:45:00
289
     data = {
277
     data = {
290
-      workScheme:
291
-      {
278
+      workScheme: {
292
         id: this.coopId.id,
279
         id: this.coopId.id,
293
         timingStatus: 1,
280
         timingStatus: 1,
294
         startTime: `${year}-${month}-${date} ${hour}:${minutes}:00`,
281
         startTime: `${year}-${month}-${date} ${hour}:${minutes}:00`,
295
         hosId: this.currentHospital.id,
282
         hosId: this.currentHospital.id,
296
-      }
283
+      },
297
     };
284
     };
298
-    this.mainService.coopTypeConfig('addData', 'workScheme', data).subscribe(data => {
299
-      this.btnLoading = false;
300
-      this.hideDateModal();
301
-      this.initDateForm();
302
-      if (data.status == 200) {
303
-        this.listLength++;
304
-        this.showPromptModal('定时启用时间设置', true, '');
305
-      } else {
306
-        this.showPromptModal('定时启用时间设置', false, data.msg);
307
-      }
308
-    })
285
+    this.mainService
286
+      .coopTypeConfig("addData", "workScheme", data)
287
+      .subscribe((data) => {
288
+        this.btnLoading = false;
289
+        this.hideDateModal();
290
+        this.initDateForm();
291
+        if (data.status == 200) {
292
+          this.listLength++;
293
+          this.showPromptModal("定时启用时间设置", true, "");
294
+        } else {
295
+          this.showPromptModal("定时启用时间设置", false, data.msg);
296
+        }
297
+      });
309
   }
298
   }
310
 
299
 
311
   // 编辑
300
   // 编辑
312
   edit(data) {
301
   edit(data) {
313
     console.log(data);
302
     console.log(data);
314
-    this.modelName = '编辑';
303
+    this.modelName = "编辑";
315
     this.add = false;
304
     this.add = false;
316
     this.modal = true;
305
     this.modal = true;
317
     this.coopId = data;
306
     this.coopId = data;
318
     this.copyModel = false;
307
     this.copyModel = false;
319
-    this.validateForm.controls.workAssignmentName.setValue(data.name);//名称
320
-    this.validateForm.controls.workAssignmentType.setValue(data.workType + '');//类型
321
-    this.validateForm.controls.workAssignmentDescribe.setValue(data.describe);//描述
308
+    this.validateForm.controls.workAssignmentName.setValue(data.name); //名称
309
+    this.validateForm.controls.workAssignmentType.setValue(data.workType + ""); //类型
310
+    this.validateForm.controls.workAssignmentDescribe.setValue(data.describe); //描述
322
   }
311
   }
323
   //复制
312
   //复制
324
-  copyModel = false;//复制
313
+  copyModel = false; //复制
325
   copy(data) {
314
   copy(data) {
326
-    this.modelName = '复制';
315
+    this.modelName = "复制";
327
     this.copyModel = true;
316
     this.copyModel = true;
328
     this.modal = true;
317
     this.modal = true;
329
     this.coopId = data;
318
     this.coopId = data;
330
-    this.validateForm.controls.workAssignmentName.setValue(data.name);//名称
331
-    this.validateForm.controls.workAssignmentType.setValue(data.workType + '');//类型
332
-    this.validateForm.controls.workAssignmentDescribe.setValue(data.describe);//描述
319
+    this.validateForm.controls.workAssignmentName.setValue(data.name); //名称
320
+    this.validateForm.controls.workAssignmentType.setValue(data.workType + ""); //类型
321
+    this.validateForm.controls.workAssignmentDescribe.setValue(data.describe); //描述
333
   }
322
   }
334
 
323
 
335
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
324
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
@@ -347,12 +336,18 @@ export class WorkAssignmentComponent implements OnInit {
347
   }
336
   }
348
 
337
 
349
   // 启用
338
   // 启用
350
-  delModal: boolean = false;//删除模态框
351
-  tipsMsg1: string;//提示框信息
352
-  tipsMsg2: string;//操作后信息
353
-  confirmDelType: string;//确认的类型(启用/停用,删除)
354
-  confirmDelIsSwitch: boolean;//启用/停用
355
-  showDelModal(data, tipsMsg1: string, tipsMsg2: string, type: string, isSwitch?: boolean) {
339
+  delModal: boolean = false; //删除模态框
340
+  tipsMsg1: string; //提示框信息
341
+  tipsMsg2: string; //操作后信息
342
+  confirmDelType: string; //确认的类型(启用/停用,删除)
343
+  confirmDelIsSwitch: boolean; //启用/停用
344
+  showDelModal(
345
+    data,
346
+    tipsMsg1: string,
347
+    tipsMsg2: string,
348
+    type: string,
349
+    isSwitch?: boolean
350
+  ) {
356
     this.confirmDelIsSwitch = isSwitch;
351
     this.confirmDelIsSwitch = isSwitch;
357
     this.confirmDelType = type;
352
     this.confirmDelType = type;
358
     this.delModal = true;
353
     this.delModal = true;
@@ -367,67 +362,79 @@ export class WorkAssignmentComponent implements OnInit {
367
   // 确认删除
362
   // 确认删除
368
   confirmDel() {
363
   confirmDel() {
369
     this.btnLoading = true;
364
     this.btnLoading = true;
370
-    if (this.confirmDelType === 'del') {//删除
371
-      this.mainService.coopTypeConfig('rmvData', 'workScheme', [this.coopId.id]).subscribe(data => {
372
-        this.btnLoading = false;
373
-        this.delModal = false;
374
-        if (data.status == 200) {
375
-          if (this.listOfData.length == 1 && this.pageIndex == Math.ceil(this.listLength / this.pageSize)) {
376
-            this.listLength--;
377
-            if (this.listLength === 0) {
378
-              this.pageIndex = 1;
379
-            } else {
380
-              this.pageIndex = Math.ceil(this.listLength / this.pageSize);
365
+    if (this.confirmDelType === "del") {
366
+      //删除
367
+      this.mainService
368
+        .coopTypeConfig("rmvData", "workScheme", [this.coopId.id])
369
+        .subscribe((data) => {
370
+          this.btnLoading = false;
371
+          this.delModal = false;
372
+          if (data.status == 200) {
373
+            if (
374
+              this.listOfData.length == 1 &&
375
+              this.pageIndex == Math.ceil(this.listLength / this.pageSize)
376
+            ) {
377
+              this.listLength--;
378
+              if (this.listLength === 0) {
379
+                this.pageIndex = 1;
380
+              } else {
381
+                this.pageIndex = Math.ceil(this.listLength / this.pageSize);
382
+              }
381
             }
383
             }
384
+            this.showPromptModal(this.tipsMsg2, true, "");
385
+          } else {
386
+            this.showPromptModal(this.tipsMsg2, false, data.msg);
382
           }
387
           }
383
-          this.showPromptModal(this.tipsMsg2, true, '');
384
-        } else {
385
-          this.showPromptModal(this.tipsMsg2, false, data.msg);
386
-        }
387
-      })
388
-    } else if (this.confirmDelType === 'switch') {//启用
388
+        });
389
+    } else if (this.confirmDelType === "switch") {
390
+      //启用
389
       let data = {
391
       let data = {
390
-        workScheme:
391
-        {
392
+        workScheme: {
392
           id: this.coopId.id,
393
           id: this.coopId.id,
393
           hosId: this.currentHospital.id,
394
           hosId: this.currentHospital.id,
394
           status: 1,
395
           status: 1,
395
-          workType: this.coopId.workType
396
-        }
396
+          workType: this.coopId.workType,
397
+        },
397
       };
398
       };
398
-      this.mainService.coopConfig('activeWorkScheme', data).subscribe(result => {
399
-        this.btnLoading = false;
400
-        this.delModal = false;
401
-        if (result.status == 200) {
402
-          this.showPromptModal(this.tipsMsg2, true, '');
403
-        } else {
404
-          this.showPromptModal(this.tipsMsg2, false, result.msg);
405
-        }
406
-      })
407
-    } else if (this.confirmDelType === 'switchTime') {//关闭定时启用
399
+      this.mainService
400
+        .coopConfig("activeWorkScheme", data)
401
+        .subscribe((result) => {
402
+          this.btnLoading = false;
403
+          this.delModal = false;
404
+          if (result.status == 200) {
405
+            this.showPromptModal(this.tipsMsg2, true, "");
406
+          } else {
407
+            this.showPromptModal(this.tipsMsg2, false, result.msg);
408
+          }
409
+        });
410
+    } else if (this.confirmDelType === "switchTime") {
411
+      //关闭定时启用
408
       let data = {
412
       let data = {
409
-        workScheme:
410
-        {
413
+        workScheme: {
411
           id: this.coopId.id,
414
           id: this.coopId.id,
412
           hosId: this.currentHospital.id,
415
           hosId: this.currentHospital.id,
413
           timingStatus: 0,
416
           timingStatus: 0,
414
-        }
417
+        },
415
       };
418
       };
416
-      this.mainService.coopTypeConfig('addData', 'workScheme', data).subscribe(result => {
417
-        this.btnLoading = false;
418
-        this.delModal = false;
419
-        if (result.status == 200) {
420
-          this.showPromptModal(this.tipsMsg2, true, '');
421
-        } else {
422
-          this.showPromptModal(this.tipsMsg2, false, result.msg);
423
-        }
424
-      })
419
+      this.mainService
420
+        .coopTypeConfig("addData", "workScheme", data)
421
+        .subscribe((result) => {
422
+          this.btnLoading = false;
423
+          this.delModal = false;
424
+          if (result.status == 200) {
425
+            this.showPromptModal(this.tipsMsg2, true, "");
426
+          } else {
427
+            this.showPromptModal(this.tipsMsg2, false, result.msg);
428
+          }
429
+        });
425
     }
430
     }
426
   }
431
   }
427
 
432
 
428
   // 查看
433
   // 查看
429
   detail(id) {
434
   detail(id) {
430
-    this.router.navigateByUrl('/main/workAssignment/workAssignmentDetail/' + id);
435
+    this.router.navigateByUrl(
436
+      "/main/workAssignment/workAssignmentDetail/" + id
437
+    );
431
   }
438
   }
432
   //时间选择框相关
439
   //时间选择框相关
433
   defaultTimePickerOpenValue = new Date();
440
   defaultTimePickerOpenValue = new Date();
@@ -439,12 +446,10 @@ export class WorkAssignmentComponent implements OnInit {
439
     }
446
     }
440
     let todayDate = new Date(e);
447
     let todayDate = new Date(e);
441
     let year = todayDate.getFullYear();
448
     let year = todayDate.getFullYear();
442
-    let month = (todayDate.getMonth() + 1).toString().padStart(2, '0');
443
-    let date = todayDate.getDate().toString().padStart(2, '0');
444
-    let hour = todayDate.getHours().toString().padStart(2, '0');
445
-    let minutes = todayDate.getMinutes().toString().padStart(2, '0');
449
+    let month = (todayDate.getMonth() + 1).toString().padStart(2, "0");
450
+    let date = todayDate.getDate().toString().padStart(2, "0");
451
+    let hour = todayDate.getHours().toString().padStart(2, "0");
452
+    let minutes = todayDate.getMinutes().toString().padStart(2, "0");
446
     this.datePicker = `${year}-${month}-${date} ${hour}:${minutes}:00`;
453
     this.datePicker = `${year}-${month}-${date} ${hour}:${minutes}:00`;
447
   }
454
   }
448
 }
455
 }
449
-
450
-

+ 143 - 152
src/app/views/worker-statistics/worker-statistics.component.ts

@@ -1,126 +1,99 @@
1
-import { Component, OnInit } from '@angular/core';
2
-import { ActivatedRoute, Router } from "@angular/router"
1
+import { Component, OnInit } from "@angular/core";
2
+import { ActivatedRoute, Router } from "@angular/router";
3
 
3
 
4
 import { MainService } from "../../services/main.service";
4
 import { MainService } from "../../services/main.service";
5
 import { DateService } from "../../services/date.service";
5
 import { DateService } from "../../services/date.service";
6
 import { MyServiceService } from "../../services/my-service.service";
6
 import { MyServiceService } from "../../services/my-service.service";
7
-import { ToolService } from '../../services/tool.service';
7
+import { ToolService } from "../../services/tool.service";
8
 
8
 
9
 @Component({
9
 @Component({
10
-  selector: 'app-worker-statistics',
11
-  templateUrl: './worker-statistics.component.html',
12
-  styleUrls: ['./worker-statistics.component.less']
10
+  selector: "app-worker-statistics",
11
+  templateUrl: "./worker-statistics.component.html",
12
+  styleUrls: ["./worker-statistics.component.less"],
13
 })
13
 })
14
 export class WorkerStatisticsComponent implements OnInit {
14
 export class WorkerStatisticsComponent implements OnInit {
15
-
16
-  constructor(private route: ActivatedRoute, private router: Router, private mainService: MainService, private dateService: DateService, private myService: MyServiceService, private tool: ToolService) { }
15
+  constructor(
16
+    private route: ActivatedRoute,
17
+    private router: Router,
18
+    private mainService: MainService,
19
+    private dateService: DateService,
20
+    private myService: MyServiceService,
21
+    private tool: ToolService
22
+  ) {}
17
 
23
 
18
   ngOnInit() {
24
   ngOnInit() {
19
-    this.getSearchData()
20
-    this.initCoopBtns();
21
-    this.getAllHos()
25
+    this.getSearchData();
26
+    this.coopBtns = this.tool.initCoopBtns(this.route);
27
+    this.getAllHos();
22
   }
28
   }
23
 
29
 
24
-  menu: any = JSON.parse(localStorage.getItem('menu')) || [];//菜单
25
-
26
-  defRange = '1';//默认上周
30
+  defRange = "1"; //默认上周
27
   defRanges = [
31
   defRanges = [
28
     {
32
     {
29
-      label: '上周',
30
-      id: 1
31
-    }, {
32
-      label: '上月',
33
-      id: 2
34
-    }, {
35
-      label: '上年',
36
-      id: 3
33
+      label: "上周",
34
+      id: 1,
37
     },
35
     },
38
-  ];//时间默认区间
39
-
40
-  listOfData: any[] = [];//表格数据
41
-  pageIndex: number = 1;//表格当前页码
42
-  pageSize: number = 10;//表格每页展示条数
43
-  listLength: number = 10;//表格总数据量
36
+    {
37
+      label: "上月",
38
+      id: 2,
39
+    },
40
+    {
41
+      label: "上年",
42
+      id: 3,
43
+    },
44
+  ]; //时间默认区间
44
 
45
 
45
-  dateRange: any = [];//发起时间区间 天
46
+  listOfData: any[] = []; //表格数据
47
+  pageIndex: number = 1; //表格当前页码
48
+  pageSize: number = 10; //表格每页展示条数
49
+  listLength: number = 10; //表格总数据量
46
 
50
 
47
-  promptContent: string;//操作提示框提示信息
48
-  ifSuccess: boolean;//操作成功/失败
49
-  promptInfo: string;//操作结果提示信息
50
-  promptModalShow: boolean;//操作提示框是否展示
51
+  dateRange: any = []; //发起时间区间 天
51
 
52
 
53
+  promptContent: string; //操作提示框提示信息
54
+  ifSuccess: boolean; //操作成功/失败
55
+  promptInfo: string; //操作结果提示信息
56
+  promptModalShow: boolean; //操作提示框是否展示
52
 
57
 
53
   // 初始化增删改按钮
58
   // 初始化增删改按钮
54
-  coopBtns: any = {
55
-    look: false,
56
-    export: false
57
-  };
58
-  initCoopBtns() {
59
-    // 二级菜单
60
-    let secondMenus = []
61
-    this.menu.forEach(e => {
62
-      e.childrens.forEach(el => {
63
-        secondMenus.push(el)
64
-      });
65
-    });
66
-    // console.log(secondMenus)
67
-    let link = this.route.parent.snapshot.routeConfig.path;
68
-    let btns = []
69
-    secondMenus.forEach(e => {
70
-      if (e.link == link) {
71
-        btns = e.childrens || [];
72
-      }
73
-    });
74
-    btns.forEach(e => {
75
-      switch (e.link) {
76
-        case 'look':
77
-          this.coopBtns.look = true;
78
-          break;
79
-        case 'export':
80
-          this.coopBtns.export = true;
81
-          break;
82
-      }
83
-    })
84
-    // console.log(this.coopBtns);
85
-  }
86
-  searchData: any = {} // 综合统计页面带过来的参数
59
+  coopBtns: any = {};
60
+  searchData: any = {}; // 综合统计页面带过来的参数
87
   getSearchData() {
61
   getSearchData() {
88
     let that = this;
62
     let that = this;
89
-    let sub = that.myService.getMsg().subscribe(msg => {
63
+    let sub = that.myService.getMsg().subscribe((msg) => {
90
       // 从综合报表跳转过来
64
       // 从综合报表跳转过来
91
-      that.searchData = msg
92
-      console.log(that.searchData)
93
-      console.log(66)
94
-      sub.unsubscribe()//取消订阅,否则订阅函数会累加执行
95
-      that.hospital = that.searchData['hosId']
96
-      that.changeDate(that.searchData['range'])
97
-      that.defRange = that.searchData['defRange']
98
-      that.search()
99
-    })
65
+      that.searchData = msg;
66
+      console.log(that.searchData);
67
+      console.log(66);
68
+      sub.unsubscribe(); //取消订阅,否则订阅函数会累加执行
69
+      that.hospital = that.searchData["hosId"];
70
+      that.changeDate(that.searchData["range"]);
71
+      that.defRange = that.searchData["defRange"];
72
+      that.search();
73
+    });
100
     // 不是从综合报表页面跳转过来的
74
     // 不是从综合报表页面跳转过来的
101
     setTimeout(() => {
75
     setTimeout(() => {
102
-      if (!sub['isStopped']) {
103
-        that.changeDateRange(that.defRange)
104
-        that.search()
76
+      if (!sub["isStopped"]) {
77
+        that.changeDateRange(that.defRange);
78
+        that.search();
105
       }
79
       }
106
     }, 100);
80
     }, 100);
107
-
108
   }
81
   }
109
   // 搜索
82
   // 搜索
110
   search(num?: number) {
83
   search(num?: number) {
111
     if (this.hospital) {
84
     if (this.hospital) {
112
-      this.searchData['hosId'] = this.hospital;
85
+      this.searchData["hosId"] = this.hospital;
113
     }
86
     }
114
     if (this.startDate) {
87
     if (this.startDate) {
115
-      this.searchData['dateRange'] = {
116
-        start: this.startDate + ' ' + '00:00:00',
117
-        end: this.endDate + ' ' + '23:59:59'
118
-      }
88
+      this.searchData["dateRange"] = {
89
+        start: this.startDate + " " + "00:00:00",
90
+        end: this.endDate + " " + "23:59:59",
91
+      };
119
     }
92
     }
120
     if (num !== undefined) {
93
     if (num !== undefined) {
121
       this.getList(num);
94
       this.getList(num);
122
     } else {
95
     } else {
123
-      this.getList()
96
+      this.getList();
124
     }
97
     }
125
   }
98
   }
126
   // 导出
99
   // 导出
@@ -129,35 +102,38 @@ export class WorkerStatisticsComponent implements OnInit {
129
     let that = this;
102
     let that = this;
130
     let postData = {
103
     let postData = {
131
       hosId: that.hospital,
104
       hosId: that.hospital,
132
-      startTime: this.startDate + ' ' + '00:00:00',
133
-      endTime: this.endDate + ' ' + '23:59:59',
134
-      groupId: that.group || ''
135
-    }
105
+      startTime: this.startDate + " " + "00:00:00",
106
+      endTime: this.endDate + " " + "23:59:59",
107
+      groupId: that.group || "",
108
+    };
136
     this.loading2 = true;
109
     this.loading2 = true;
137
-    that.mainService.exportReport('user', postData).subscribe(data => {
138
-      this.loading2 = false;
139
-      this.showPromptModal('导出', true, '');
140
-      var file = new Blob([data], {
141
-        type: 'application/vnd.ms-excel'
142
-      });
143
-      //trick to download store a file having its URL
144
-      var fileURL = URL.createObjectURL(file);
145
-      var a = document.createElement('a');
146
-      a.href = fileURL;
147
-      a.target = '_blank';
148
-      a.download = '支助人员统计.xls';
149
-      document.body.appendChild(a);
150
-      a.click();
151
-    }, err => {
152
-      this.loading2 = false;
153
-      this.showPromptModal('导出', false, '');
154
-    })
110
+    that.mainService.exportReport("user", postData).subscribe(
111
+      (data) => {
112
+        this.loading2 = false;
113
+        this.showPromptModal("导出", true, "");
114
+        var file = new Blob([data], {
115
+          type: "application/vnd.ms-excel",
116
+        });
117
+        //trick to download store a file having its URL
118
+        var fileURL = URL.createObjectURL(file);
119
+        var a = document.createElement("a");
120
+        a.href = fileURL;
121
+        a.target = "_blank";
122
+        a.download = "支助人员统计.xls";
123
+        document.body.appendChild(a);
124
+        a.click();
125
+      },
126
+      (err) => {
127
+        this.loading2 = false;
128
+        this.showPromptModal("导出", false, "");
129
+      }
130
+    );
155
   }
131
   }
156
   // 重置
132
   // 重置
157
   reset() {
133
   reset() {
158
-    this.changeDateRange('1')
134
+    this.changeDateRange("1");
159
     this.group = null;
135
     this.group = null;
160
-    this.search()
136
+    this.search();
161
   }
137
   }
162
   // 表格数据
138
   // 表格数据
163
   loading1 = false;
139
   loading1 = false;
@@ -171,21 +147,23 @@ export class WorkerStatisticsComponent implements OnInit {
171
       startTime: this.searchData.dateRange.start,
147
       startTime: this.searchData.dateRange.start,
172
       endTime: this.searchData.dateRange.end,
148
       endTime: this.searchData.dateRange.end,
173
       hosId: this.searchData.hosId,
149
       hosId: this.searchData.hosId,
174
-      groupId: this.group || '',
175
-    }
150
+      groupId: this.group || "",
151
+    };
176
     this.loading1 = true;
152
     this.loading1 = true;
177
-    this.mainService.postCustom('report', 'user', postData).subscribe(result => {
178
-      this.loading1 = false;
179
-      this.listOfData = result.list || [];
180
-      this.listLength = result.totalNum;
181
-    })
153
+    this.mainService
154
+      .postCustom("report", "user", postData)
155
+      .subscribe((result) => {
156
+        this.loading1 = false;
157
+        this.listOfData = result.list || [];
158
+        this.listLength = result.totalNum;
159
+      });
182
   }
160
   }
183
   // 获取院区/分组
161
   // 获取院区/分组
184
-  hospital: string;//选中院区
185
-  group: string;//选中组
186
-  groupList: any = []//分组
162
+  hospital: string; //选中院区
163
+  group: string; //选中组
164
+  groupList: any = []; //分组
187
   getAllHos() {
165
   getAllHos() {
188
-    this.hospital = this.tool.getCurrentHospital().id + '';
166
+    this.hospital = this.tool.getCurrentHospital().id + "";
189
     this.getGroupList(this.hospital);
167
     this.getGroupList(this.hospital);
190
   }
168
   }
191
   // 获取分组
169
   // 获取分组
@@ -195,30 +173,42 @@ export class WorkerStatisticsComponent implements OnInit {
195
         hospitals: id,
173
         hospitals: id,
196
       },
174
       },
197
       idx: 0,
175
       idx: 0,
198
-      sum: 9999
176
+      sum: 9999,
199
     };
177
     };
200
-    this.mainService.getFetchDataList('data', 'group2', groupData).subscribe(result => {
201
-      this.groupList = result.list;
202
-    })
178
+    this.mainService
179
+      .getFetchDataList("data", "group2", groupData)
180
+      .subscribe((result) => {
181
+        this.groupList = result.list;
182
+      });
203
   }
183
   }
204
 
184
 
205
   // 日期选择 日
185
   // 日期选择 日
206
-  startDate: string;//发起时间开始
207
-  endDate: string;//发起时间结束
186
+  startDate: string; //发起时间开始
187
+  endDate: string; //发起时间结束
208
   changeDate(result?): void {
188
   changeDate(result?): void {
209
-    console.log(this.dateRange)
210
-    console.log(result)
189
+    console.log(this.dateRange);
190
+    console.log(result);
211
     this.dateRange = result;
191
     this.dateRange = result;
212
     if (!this.quick) {
192
     if (!this.quick) {
213
       // 不是快捷选择
193
       // 不是快捷选择
214
       this.defRange = null;
194
       this.defRange = null;
215
     }
195
     }
216
     if (!result || !result.length) {
196
     if (!result || !result.length) {
217
-      this.startDate = this.endDate = '';
197
+      this.startDate = this.endDate = "";
218
       return;
198
       return;
219
     }
199
     }
220
-    this.startDate = result[0].getFullYear() + '-' + (result[0].getMonth() + 1) + '-' + result[0].getDate();
221
-    this.endDate = result[1].getFullYear() + '-' + (result[1].getMonth() + 1) + '-' + result[1].getDate();
200
+    this.startDate =
201
+      result[0].getFullYear() +
202
+      "-" +
203
+      (result[0].getMonth() + 1) +
204
+      "-" +
205
+      result[0].getDate();
206
+    this.endDate =
207
+      result[1].getFullYear() +
208
+      "-" +
209
+      (result[1].getMonth() + 1) +
210
+      "-" +
211
+      result[1].getDate();
222
     this.search();
212
     this.search();
223
   }
213
   }
224
   // 修改搜素条件工作组
214
   // 修改搜素条件工作组
@@ -234,38 +224,37 @@ export class WorkerStatisticsComponent implements OnInit {
234
     console.log(res);
224
     console.log(res);
235
     this.quick = true;
225
     this.quick = true;
236
     switch (res) {
226
     switch (res) {
237
-      case '1':
227
+      case "1":
238
         // 上周
228
         // 上周
239
         let lastweekstartdate = this.dateService.date().lastWeekStartDate;
229
         let lastweekstartdate = this.dateService.date().lastWeekStartDate;
240
         let lastweekenddate = this.dateService.date().lastWeekEndDate;
230
         let lastweekenddate = this.dateService.date().lastWeekEndDate;
241
-        console.log(lastweekstartdate, lastweekenddate)
242
-        this.changeDate([lastweekstartdate, lastweekenddate])
231
+        console.log(lastweekstartdate, lastweekenddate);
232
+        this.changeDate([lastweekstartdate, lastweekenddate]);
243
         break;
233
         break;
244
-      case '2':
234
+      case "2":
245
         // 上月
235
         // 上月
246
         let lastmonthstartdate = this.dateService.date().lastMonthStartDate;
236
         let lastmonthstartdate = this.dateService.date().lastMonthStartDate;
247
         let lastmonthenddate = this.dateService.date().lastMonthEndDate;
237
         let lastmonthenddate = this.dateService.date().lastMonthEndDate;
248
-        console.log(lastmonthstartdate, lastmonthenddate)
249
-        this.changeDate([lastmonthstartdate, lastmonthenddate])
238
+        console.log(lastmonthstartdate, lastmonthenddate);
239
+        this.changeDate([lastmonthstartdate, lastmonthenddate]);
250
         break;
240
         break;
251
-      case '3':
241
+      case "3":
252
         // 上年
242
         // 上年
253
         let lastyearstartdate = this.dateService.date().lastYearStartDate;
243
         let lastyearstartdate = this.dateService.date().lastYearStartDate;
254
         let lastyearenddate = this.dateService.date().lastYearEndDate;
244
         let lastyearenddate = this.dateService.date().lastYearEndDate;
255
-        console.log(lastyearstartdate, lastyearenddate)
256
-        this.changeDate([lastyearstartdate, lastyearenddate])
245
+        console.log(lastyearstartdate, lastyearenddate);
246
+        this.changeDate([lastyearstartdate, lastyearenddate]);
257
         break;
247
         break;
258
     }
248
     }
259
     this.quick = false;
249
     this.quick = false;
260
-
261
   }
250
   }
262
 
251
 
263
   // 更多
252
   // 更多
264
   toMore(type) {
253
   toMore(type) {
265
     let sendData = this.searchData;
254
     let sendData = this.searchData;
266
-    console.log(sendData)
267
-    this.myService.sendMsg(sendData)
268
-    this.router.navigateByUrl('/main/' + type);
255
+    console.log(sendData);
256
+    this.myService.sendMsg(sendData);
257
+    this.router.navigateByUrl("/main/" + type);
269
   }
258
   }
270
 
259
 
271
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
260
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
@@ -281,22 +270,24 @@ export class WorkerStatisticsComponent implements OnInit {
281
 
270
 
282
   // 边输入边搜索节流阀
271
   // 边输入边搜索节流阀
283
   searchTimer(fun, e, those) {
272
   searchTimer(fun, e, those) {
284
-    fun(e, those)
273
+    fun(e, those);
285
   }
274
   }
286
 
275
 
287
   // 截取意见内容(ie内核截取)
276
   // 截取意见内容(ie内核截取)
288
   spliceContent(con) {
277
   spliceContent(con) {
289
-    if (con.length >= 41 && navigator.userAgent.indexOf('Trident') > -1) {
290
-      return con.slice(0, 20) + '...'
278
+    if (con.length >= 41 && navigator.userAgent.indexOf("Trident") > -1) {
279
+      return con.slice(0, 20) + "...";
291
     } else {
280
     } else {
292
       return con;
281
       return con;
293
     }
282
     }
294
   }
283
   }
295
   //获取支助人员工单详情列表
284
   //获取支助人员工单详情列表
296
   personDetail(workerId) {
285
   personDetail(workerId) {
297
-    let startDate = this.startDate + ' ' + '00:00:00';
298
-    let endDate = this.endDate + ' ' + '23:59:59';
299
-    let group = this.group || 'null';
300
-    this.router.navigateByUrl(`/main/workerStatistics/workerStatisticsDetail/${workerId}/${startDate}/${endDate}/${group}`);
286
+    let startDate = this.startDate + " " + "00:00:00";
287
+    let endDate = this.endDate + " " + "23:59:59";
288
+    let group = this.group || "null";
289
+    this.router.navigateByUrl(
290
+      `/main/workerStatistics/workerStatisticsDetail/${workerId}/${startDate}/${endDate}/${group}`
291
+    );
301
   }
292
   }
302
 }
293
 }