Sfoglia il codice sorgente

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

seimin 3 anni fa
parent
commit
d48710e336
29 ha cambiato i file con 3425 aggiunte e 3828 eliminazioni
  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 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 33
     let secondMenus = []; // 二级菜单
29 34
     let jurisdiction = []; //当前菜单的权限列表
30 35
     let coopBtns: any = {}; // 初始化权限
@@ -52,6 +57,30 @@ export class ToolService {
52 57
         case "del":
53 58
           coopBtns.del = true; //删除
54 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 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 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 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 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 21
   changeInpSubject = new Subject();
18 22
   ngOnInit() {
19
-    this.changeInpSubject.pipe(debounceTime(500)).subscribe(v => {
23
+    this.changeInpSubject.pipe(debounceTime(500)).subscribe((v) => {
20 24
       this.getDeparts(v);
21
-    })
22
-    this.initCoopBtns();
23
-    this.getAllHos()
25
+    });
26
+    this.coopBtns = this.tool.initCoopBtns(this.route);
27
+    this.getAllHos();
24 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 57
   getAllHos() {
89
-    this.hospital = this.tool.getCurrentHospital().id + '';
58
+    this.hospital = this.tool.getCurrentHospital().id + "";
90 59
     this.changeHos();
91 60
     this.getList();
92 61
   }
93 62
   // 修改院区获取对应科室
94 63
   changeHos() {
95 64
     this.department = null;
96
-    this.getDeparts()
65
+    this.getDeparts();
97 66
   }
98 67
   // 搜索
99 68
   search() {
@@ -105,8 +74,7 @@ export class AdviceManagementComponent implements OnInit {
105 74
     this.pageIndex = 1;
106 75
     this.replyType = null;
107 76
     this.department = null;
108
-    this.getList()
109
-
77
+    this.getList();
110 78
   }
111 79
   // 表格数据
112 80
   loading1 = false;
@@ -116,50 +84,52 @@ export class AdviceManagementComponent implements OnInit {
116 84
       idx: that.pageIndex - 1,
117 85
       sum: that.pageSize,
118 86
       advice: {
119
-        replaceFlag: that.replyType || '',
87
+        replaceFlag: that.replyType || "",
120 88
         hosId: that.hospital,
121 89
         creatDepartment: {
122
-          id: that.department || '',
123
-        }
90
+          id: that.department || "",
91
+        },
124 92
       },
125
-    }
93
+    };
126 94
     if (!data.advice.replaceFlag) {
127
-      delete data.advice.replaceFlag
95
+      delete data.advice.replaceFlag;
128 96
     }
129 97
     if (!data.advice.creatDepartment || !data.advice.creatDepartment.id) {
130
-      delete data.advice.creatDepartment
98
+      delete data.advice.creatDepartment;
131 99
     }
132 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 112
   getDeparts(dept?) {
145 113
     var that = this;
146 114
     let data = {
147 115
       department: {
148 116
         hospital: { id: that.hospital },
149
-        dept: dept || ''
117
+        dept: dept || "",
150 118
       },
151 119
       idx: 0,
152
-      sum: 20
153
-    }
120
+      sum: 20,
121
+    };
154 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 138
     that.replyTypes = [
169 139
       {
170 140
         value: 0,
171
-        label: '未回复'
172
-      }, {
141
+        label: "未回复",
142
+      },
143
+      {
173 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 152
   reply(data) {
183 153
     this.modal = true;
184 154
     this.replyCon = data;
@@ -187,9 +157,9 @@ export class AdviceManagementComponent implements OnInit {
187 157
     this.modal = false;
188 158
   }
189 159
   // 回复
190
-  adviceSubContent: string;//回复内容
160
+  adviceSubContent: string; //回复内容
191 161
   submitForm() {
192
-    console.log(this.adviceSubContent)
162
+    console.log(this.adviceSubContent);
193 163
     let that = this;
194 164
     if (!that.adviceSubContent) return;
195 165
     that.btnLoading = true;
@@ -197,21 +167,22 @@ export class AdviceManagementComponent implements OnInit {
197 167
       advice: {
198 168
         id: that.replyCon.id,
199 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 188
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
@@ -228,7 +199,7 @@ export class AdviceManagementComponent implements OnInit {
228 199
 
229 200
   // 查看
230 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 212
   // 截取意见内容(ie内核截取)
242 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 216
     } else {
246 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 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 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 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 44
   searchTimerSubject = new Subject();
41 45
 
42 46
   ngOnInit() {
43
-    this.searchTimerSubject.pipe(debounceTime(500)).subscribe(v => {
47
+    this.searchTimerSubject.pipe(debounceTime(500)).subscribe((v) => {
44 48
       let fun = v[0];
45 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 62
   getAllHos() {
95
-    this.hospital = this.tool.getCurrentHospital().id + '';
63
+    this.hospital = this.tool.getCurrentHospital().id + "";
96 64
     this.changeHos();
97 65
     this.getList();
98 66
   }
@@ -102,68 +70,74 @@ export class AppraiseManagementComponent implements OnInit {
102 70
     this.worker = null;
103 71
     this.mediUser = null;
104 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 81
   snum1 = 0;
114 82
   getAllWorker(e?, those?) {
115 83
     let that = those || this;
116 84
     let postData = {
117 85
       user: {
118
-        name: e || '',
86
+        name: e || "",
119 87
         hospital: { id: that.hospital },
120
-        usertype: { id: 106 }//支助人员
88
+        usertype: { id: 106 }, //支助人员
121 89
       },
122 90
       idx: 0,
123
-      sum: 20
124
-    }
91
+      sum: 20,
92
+    };
125 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 107
   getAllDesUser(id) {
138 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 119
   snum2 = 0;
148 120
   getAllMediUser(e?, those?) {
149 121
     let that = those || this;
150 122
     let postData = {
151 123
       user: {
152
-        name: e || '',
124
+        name: e || "",
153 125
         hospital: { id: that.hospital },
154
-        usertype: { id: 107 }//服务台
126
+        usertype: { id: 107 }, //服务台
155 127
       },
156 128
       idx: 0,
157
-      sum: 20
158
-    }
129
+      sum: 20,
130
+    };
159 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 163
   getStatus() {
190 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 181
     this.worker = null;
206 182
     this.mediUser = null;
207 183
     this.status = null;
208
-    this.getList()
209
-
184
+    this.getList();
210 185
   }
211 186
   // 表格数据
212 187
   loading1 = false;
@@ -216,35 +191,35 @@ export class AppraiseManagementComponent implements OnInit {
216 191
       idx: that.pageIndex - 1,
217 192
       sum: that.pageSize,
218 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 197
         hosId: that.hospital,
223
-        mediationUser: { id: that.mediUser }
198
+        mediationUser: { id: that.mediUser },
224 199
       },
225
-    }
200
+    };
226 201
     if (!data.badEvaluationHandle.taskType) {
227
-      delete data.badEvaluationHandle.taskType
202
+      delete data.badEvaluationHandle.taskType;
228 203
     }
229 204
     if (!data.badEvaluationHandle.worker.id) {
230
-      delete data.badEvaluationHandle.worker
205
+      delete data.badEvaluationHandle.worker;
231 206
     }
232 207
     if (!data.badEvaluationHandle.handleStatus.id) {
233
-      delete data.badEvaluationHandle.handleStatus
208
+      delete data.badEvaluationHandle.handleStatus;
234 209
     }
235 210
     if (!data.badEvaluationHandle.mediationUser.id) {
236
-      delete data.badEvaluationHandle.mediationUser
211
+      delete data.badEvaluationHandle.mediationUser;
237 212
     }
238 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 224
   getAllTaskType() {
250 225
     let that = this;
@@ -253,11 +228,13 @@ export class AppraiseManagementComponent implements OnInit {
253 228
         hosId: { id: that.hospital },
254 229
       },
255 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 240
   // 初始化新增form表单
@@ -278,32 +255,33 @@ export class AppraiseManagementComponent implements OnInit {
278 255
       badEvaluationHandle: {
279 256
         id: that.coopId,
280 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 276
   designate(id, hosId) {
298 277
     this.modal = true;
299 278
     this.coopId = id;
300
-    this.getAllDesUser(hosId)
279
+    this.getAllDesUser(hosId);
301 280
   }
302 281
   hideModal() {
303 282
     this.modal = false;
304 283
   }
305 284
 
306
-
307 285
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
308 286
   showPromptModal(con, success, promptInfo?) {
309 287
     this.promptModalShow = false;
@@ -319,22 +297,30 @@ export class AppraiseManagementComponent implements OnInit {
319 297
   // 查看
320 298
   detail(id, tj?) {
321 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 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 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 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 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 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 30
   formatterPercent = (value: number) => `${value} %`;
31
-  parserPercent = (value: string) => value.replace(' %', '')
31
+  parserPercent = (value: string) => value.replace(" %", "");
32 32
   ngOnInit() {
33 33
     this.hosId = this.tool.getCurrentHospital().id;
34
-    this.initCoopBtns();
34
+    this.coopBtns = this.tool.initCoopBtns(this.route);
35 35
     this.getBuildingList(this.hosId);
36 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 40
   getBuildingConfig(hosId) {
60
-    let postData = { "idx": 0, "sum": 9999, "workOrderGradeBuilding": { hosId } };
41
+    let postData = { idx: 0, sum: 9999, workOrderGradeBuilding: { hosId } };
61 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 63
   addBuilding() {
@@ -83,8 +66,8 @@ export class BuildingDistanceComponent implements OnInit {
83 66
       buildingStart: null,
84 67
       buildingEnd: null,
85 68
       percentage: 0,
86
-      border: 'none'
87
-    })
69
+      border: "none",
70
+    });
88 71
   }
89 72
   // 删除
90 73
   delete(obj) {
@@ -98,48 +81,52 @@ export class BuildingDistanceComponent implements OnInit {
98 81
   // 确定删除
99 82
   confirmDel() {
100 83
     this.loading4 = true;
101
-    this.mainService.delBuildings([this.delObj.id]).subscribe(result => {
84
+    this.mainService.delBuildings([this.delObj.id]).subscribe((result) => {
102 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 91
       } else {
107
-        this.message.error('删除失败');
92
+        this.message.error("删除失败");
108 93
       }
109 94
       this.hideDelModal();
110
-    })
95
+    });
111 96
   }
112 97
   //保存
113 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 103
       return {
117 104
         id: item.id,
118 105
         source: { id: item.buildingStart },
119 106
         dest: { id: item.buildingEnd },
120 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 112
       if (item.id < 0) {
126 113
         delete item.id;
127 114
       }
128
-    })
115
+    });
129 116
     this.loading3 = true;
130
-    this.mainService.saveBuildings(postData).subscribe(result => {
117
+    this.mainService.saveBuildings(postData).subscribe((result) => {
131 118
       this.loading3 = false;
132
-      if (result['status'] == 200) {
133
-        this.message.success('保存成功');
119
+      if (result["status"] == 200) {
120
+        this.message.success("保存成功");
134 121
         this.getBuildingConfig(this.hosId);
135 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 131
   //trackBy
145 132
   trackById(index, item) {
@@ -149,16 +136,21 @@ export class BuildingDistanceComponent implements OnInit {
149 136
   getBuildingList(hosId) {
150 137
     let postData = { idx: 0, sum: 9999, building: { hosId } };
151 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 25
   userInfo: any = JSON.parse(localStorage.getItem('user')) || {};//登录用户信息
26
-  menu: any = JSON.parse(localStorage.getItem('menu')) || [];//菜单
27 26
 
28 27
   hospital: any = null;//院区搜索框
29 28
   listOfData: any[] = [];//表格数据
@@ -44,52 +43,13 @@ export class ClassesManagementComponent implements OnInit {
44 43
   demoValue: number = 0;
45 44
 
46 45
   ngOnInit() {
47
-    this.initCoopBtns();
46
+    this.coopBtns = this.tool.initCoopBtns(this.route);
48 47
     this.getAllHospital()
49 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 54
   logDateType(value: object[]): void {
95 55
     console.log(value);

File diff suppressed because it is too large
+ 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 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 12
 export class DataBuildingComponent implements OnInit {
13
-  @ViewChild('osComponentRef1', { read: OverlayScrollbarsComponent, static: false })
13
+  @ViewChild("osComponentRef1", {
14
+    read: OverlayScrollbarsComponent,
15
+    static: false,
16
+  })
14 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 39
   ngOnInit() {
38 40
     this.route.queryParamMap.subscribe((params: ParamMap) => {
39
-      this.hosId = params.get('id');
41
+      this.hosId = params.get("id");
40 42
       if (!this.hosId) {
41 43
         this.hosId = this.tool.getCurrentHospital().id;
42 44
       }
43 45
       this.getBuildingList();
44 46
     });
45
-    this.initCoopBtns();
47
+    this.coopBtns = this.tool.initCoopBtns("dataDictionary");
46 48
     this.changeSize();
47
-    window.addEventListener('resize', () => {
49
+    window.addEventListener("resize", () => {
48 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 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 59
   add() {
@@ -79,14 +61,18 @@ export class DataBuildingComponent implements OnInit {
79 61
   }
80 62
   // 删除
81 63
   delete(data) {
82
-    this.showDelModal(data, '您确认要删除此楼栋吗?', '删除后对应的楼栋积分配置也会删除');
64
+    this.showDelModal(
65
+      data,
66
+      "您确认要删除此楼栋吗?",
67
+      "删除后对应的楼栋积分配置也会删除"
68
+    );
83 69
   }
84 70
   // 删除楼栋
85 71
   showDelModal(data: any, tipsMsg1: string, tips?) {
86 72
     this.delModal = true;
87 73
     this.coop = data;
88 74
     this.tipsMsg1 = tipsMsg1;
89
-    this.tips = tips ? tips : '';
75
+    this.tips = tips ? tips : "";
90 76
   }
91 77
   // 隐藏删除框
92 78
   hideDelModal() {
@@ -95,50 +81,57 @@ export class DataBuildingComponent implements OnInit {
95 81
   // 确认删除
96 82
   confirmDel() {
97 83
     this.loading2 = true;
98
-    if (this.coop.id > 0) {//接口删除
84
+    if (this.coop.id > 0) {
85
+      //接口删除
99 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 107
     } else {
116 108
       this.loading2 = false;
117 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 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 126
     let postData = JSON.parse(JSON.stringify(this.buildingList));
134
-    postData.forEach(item => {
127
+    postData.forEach((item) => {
135 128
       arr.push(item.buildingName);
136 129
       item.deleted = false;
137 130
       item.hosId = this.hosId;
138 131
       if (item.id < 0) {
139 132
         delete item.id;
140 133
       }
141
-    })
134
+    });
142 135
     if (arr.length > 1) {
143 136
       arr.sort();
144 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 152
     } else {
154 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 170
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
@@ -181,26 +183,40 @@ export class DataBuildingComponent implements OnInit {
181 183
   // 获取楼栋信息列表
182 184
   getBuildingList() {
183 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 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 10
 export class DataDictionaryComponent implements OnInit {
11 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 25
   ngOnInit() {
27 26
     console.log(this.router.url);
28 27
     this.hospitalList = this.tool.getHospitalList();
29
-    let urlArr = this.router.url.split('?');
28
+    let urlArr = this.router.url.split("?");
30 29
     let url = urlArr[0];
31 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 32
     if (id) {
34
-      this.selectedHospital = parseInt(id.split('=')[1]);
33
+      this.selectedHospital = parseInt(id.split("=")[1]);
35 34
     } else {
36 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 40
   selectedNav(index) {
@@ -43,27 +42,7 @@ export class DataDictionaryComponent implements OnInit {
43 42
   }
44 43
   // 切换院区
45 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 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 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 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 42
   ngOnInit() {
40 43
     this.route.queryParamMap.subscribe((params: ParamMap) => {
41
-      this.hosId = params.get('id');
44
+      this.hosId = params.get("id");
42 45
       if (!this.hosId) {
43 46
         this.hosId = this.tool.getCurrentHospital().id;
44 47
       }
45 48
       this.getBuildingList();
46 49
     });
47
-    this.initCoopBtns();
50
+    this.coopBtns = this.tool.initCoopBtns("dataDictionary");
48 51
     this.changeSize();
49
-    window.addEventListener('resize', () => {
52
+    window.addEventListener("resize", () => {
50 53
       this.changeSize();
51 54
     });
52 55
   }
53 56
   // 选择楼栋(获取楼栋名称)
54 57
   selectBuild(data) {
55
-    this.buildingList.forEach(item => {
58
+    this.buildingList.forEach((item) => {
56 59
       if (item.id == data.buildId) {
57 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 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 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 79
   delete(data) {
92
-    this.showDelModal(data, '您确认要删除此楼层吗?');
80
+    this.showDelModal(data, "您确认要删除此楼层吗?");
93 81
   }
94 82
   // 删除快捷建单
95 83
   showDelModal(data: any, tipsMsg1: string) {
@@ -104,29 +92,37 @@ export class DataFloorComponent implements OnInit {
104 92
   // 确认删除
105 93
   confirmDel() {
106 94
     this.loading2 = true;
107
-    if (this.coop.id > 0) {//接口删除
95
+    if (this.coop.id > 0) {
96
+      //接口删除
108 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 118
     } else {
125 119
       this.loading2 = false;
126 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 128
   // 生成楼层baba
@@ -141,17 +137,27 @@ export class DataFloorComponent implements OnInit {
141 137
   // 确认生成baba
142 138
   loading4: boolean = false;
143 139
   confirmGenerate(e) {
144
-    let arr = [];//生成的楼层
140
+    let arr = []; //生成的楼层
145 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 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 166
    * @param loadingName string 保存还是生成楼层,取值'loading3','loading4'
161 167
    */
162 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 182
     let postData = JSON.parse(JSON.stringify(this.floorList));
172
-    postData.forEach(item => {
183
+    postData.forEach((item) => {
173 184
       arr.push([item.building.buildingName, item.floorName]);
174 185
       item.hosId = this.hosId;
175 186
       item.deleted = false;
@@ -177,33 +188,42 @@ export class DataFloorComponent implements OnInit {
177 188
       if (item.id < 0) {
178 189
         delete item.id;
179 190
       }
180
-    })
191
+    });
181 192
     if (arr.length > 1) {
182
-      arr.sort((a, b) => (a[1] - b[1]));
193
+      arr.sort((a, b) => a[1] - b[1]);
183 194
       for (let i = 0; i < arr.length - 1; i++) {
184 195
         if (arr[i][1] === arr[i + 1][1] && arr[i][0] === arr[i + 1][0]) {
185 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 209
     } else {
193 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 229
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
@@ -221,37 +241,66 @@ export class DataFloorComponent implements OnInit {
221 241
   }
222 242
   // 获取楼层信息列表
223 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 291
   getBuildingList() {
248 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 4
 import { MainService } from "../../services/main.service";
5 5
 import { DateService } from "../../services/date.service";
6 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 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 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 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 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 62
   getSearchData() {
89 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 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 81
     }, 100);
108
-
109 82
   }
110 83
   // 搜索
111 84
   search(num?: number) {
112 85
     if (this.hospital) {
113
-      this.searchData['hosId'] = this.hospital;
86
+      this.searchData["hosId"] = this.hospital;
114 87
     }
115 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 94
     if (num !== undefined) {
122 95
       this.getList(num);
@@ -130,33 +103,36 @@ export class DeptStatisticsComponent implements OnInit {
130 103
     let that = this;
131 104
     let postData = {
132 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 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 133
   reset() {
158
-    this.changeDateRange('1')
159
-    this.search()
134
+    this.changeDateRange("1");
135
+    this.search();
160 136
   }
161 137
   // 表格数据
162 138
   loading1 = false;
@@ -169,39 +145,50 @@ export class DeptStatisticsComponent implements OnInit {
169 145
       sum: this.pageSize,
170 146
       startTime: this.searchData.dateRange.start,
171 147
       endTime: this.searchData.dateRange.end,
172
-      hosId: this.searchData.hosId
173
-    }
148
+      hosId: this.searchData.hosId,
149
+    };
174 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 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 168
   changeDate(result?): void {
192
-    console.log(this.dateRange)
193
-    console.log(result)
169
+    console.log(this.dateRange);
170
+    console.log(result);
194 171
     this.dateRange = result;
195 172
     if (!this.quick) {
196 173
       // 不是快捷选择
197 174
       this.defRange = null;
198 175
     }
199 176
     if (!result || !result.length) {
200
-      this.startDate = this.endDate = '';
177
+      this.startDate = this.endDate = "";
201 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 199
     console.log(res);
213 200
     this.quick = true;
214 201
     switch (res) {
215
-      case '1':
202
+      case "1":
216 203
         // 上周
217 204
         let lastweekstartdate = this.dateService.date().lastWeekStartDate;
218 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 208
         break;
222
-      case '2':
209
+      case "2":
223 210
         // 上月
224 211
         let lastmonthstartdate = this.dateService.date().lastMonthStartDate;
225 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 215
         break;
229
-      case '3':
216
+      case "3":
230 217
         // 上年
231 218
         let lastyearstartdate = this.dateService.date().lastYearStartDate;
232 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 222
         break;
236 223
     }
237 224
     this.quick = false;
238
-
239 225
   }
240 226
 
241 227
   // 更多
242 228
   toMore(type) {
243 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 235
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
@@ -262,17 +248,15 @@ export class DeptStatisticsComponent implements OnInit {
262 248
   searchTimer(fun, e, those) {
263 249
     let that = this;
264 250
     that.isLoading = true;
265
-    fun(e, those)
251
+    fun(e, those);
266 252
   }
267 253
 
268 254
   // 截取意见内容(ie内核截取)
269 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 258
     } else {
273 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 29
   osComponentRef1: OverlayScrollbarsComponent;
30 30
   ngOnInit() {
31
-    this.initCoopBtns();
31
+    this.coopBtns = this.tool.initCoopBtns(this.route);
32 32
     this.initForm();
33 33
     this.getHospitalList();
34 34
     this.getGroupList();
35 35
     this.getScheduleList();
36 36
     this.tableHeight = document.body.clientHeight - 267;
37 37
   }
38
-  menu: any = JSON.parse(localStorage.getItem("menu")) || []; //菜单
39 38
   isAllDisplayDataChecked = false;
40 39
   isIndeterminate = false;
41 40
   listOfDisplayData: any[] = [];
@@ -58,45 +57,8 @@ export class GroupManagementComponent implements OnInit {
58 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 63
   loading1 = false;
102 64
   getGroupList() {

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

@@ -3,6 +3,7 @@ import { MainService } from "../../services/main.service";
3 3
 import { ActivatedRoute, Router } from "@angular/router";
4 4
 
5 5
 import { NzMessageService } from "ng-zorro-antd/message";
6
+import { ToolService } from "src/app/services/tool.service";
6 7
 
7 8
 @Component({
8 9
   selector: "app-holidays-management",
@@ -13,16 +14,16 @@ export class HolidaysManagementComponent implements OnInit {
13 14
   constructor(
14 15
     private mainService: MainService,
15 16
     private msg: NzMessageService,
16
-    private route: ActivatedRoute
17
+    private route: ActivatedRoute,
18
+    private tool: ToolService
17 19
   ) {}
18 20
 
19 21
   ngOnInit() {
20
-    this.initCoopBtns();
22
+    this.coopBtns = this.tool.initCoopBtns(this.route);
21 23
     this.initDates(); //初始化日历选中情况
22 24
     this.getSyncWorkDay();
23 25
   }
24 26
 
25
-  menu: any = JSON.parse(localStorage.getItem("menu")) || []; //菜单
26 27
   promptContent: string; //操作提示框提示信息
27 28
   ifSuccess: boolean; //操作成功/失败
28 29
   promptInfo: string; //操作结果提示信息
@@ -44,47 +45,7 @@ export class HolidaysManagementComponent implements OnInit {
44 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 50
   setSyncWorkDay(e) {
90 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 23
   deptList = []; //科室列表
24 24
   groupList = []; //组列表
25 25
   onSearchSubject = new Subject(); //搜索防抖
26
-  coopBtns = {
27
-    //初始化权限
28
-    edit: false,
29
-  };
30
-  menu = JSON.parse(localStorage.getItem("menu")) || []; //菜单
26
+  coopBtns = {};
31 27
   constructor(
32 28
     private mainService: MainService,
33 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 46
     this.getInit();
51 47
   }
52 48
   // 根据科室id查科室
@@ -125,7 +121,7 @@ export class HospitalConfigComponent implements OnInit {
125 121
                 this.validateForm.controls[config.key].setValue(config.value);
126 122
               }
127 123
             });
128
-          }else{
124
+          } else {
129 125
             this.isLoading = false;
130 126
           }
131 127
         });
@@ -137,8 +133,11 @@ export class HospitalConfigComponent implements OnInit {
137 133
   // 获取系统配置列表
138 134
   getHospitalConfigList(hosId) {
139 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 143
   getRoleList() {
@@ -182,26 +181,7 @@ export class HospitalConfigComponent implements OnInit {
182 181
     this.searchLoading = true;
183 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 186
   submitForm(): void {
207 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 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 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 21
   ngOnInit() {
17
-    this.initCoopBtns();
18
-    this.getList()
22
+    this.coopBtns = this.tool.initCoopBtns(this.route);
23
+    this.getList();
19 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 49
   loading1 = false;
83 50
   getList() {
84 51
     let data = {
85 52
       idx: this.pageIndex - 1,
86
-      sum: this.pageSize
87
-    }
53
+      sum: this.pageSize,
54
+    };
88 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 65
   addModal() {
97 66
     this.add = true;
98 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 71
   hideAddModal() {
103 72
     this.modal = false;
104
-    this.initForm()
73
+    this.initForm();
105 74
   }
106 75
   // 初始化新增form表单
107 76
   initForm() {
108 77
     this.validateForm = this.fb.group({
109 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 92
     let data = {
124 93
       hospital: {
125 94
         hosName: that.validateForm.value.hospitalName,
126
-        hosNo: that.validateForm.value.hospitalNum
127
-      }
128
-    }
95
+        hosNo: that.validateForm.value.hospitalNum,
96
+      },
97
+    };
129 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 121
     this.validateForm.controls.hospitalNum.setValue(data.hosNo);
151 122
   }
152 123
 
153
-  delModal: boolean = false;//删除模态框
124
+  delModal: boolean = false; //删除模态框
154 125
   showDelModal(id) {
155 126
     this.delModal = true;
156 127
     this.coopId = id;
@@ -162,22 +133,25 @@ export class HospitalManagementComponent implements OnInit {
162 133
     this.delModal = false;
163 134
     var that = this;
164 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 155
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
182 156
   showPromptModal(con, success, promptInfo?) {
183 157
     this.promptModalShow = false;
@@ -189,6 +163,4 @@ export class HospitalManagementComponent implements OnInit {
189 163
     }, 100);
190 164
     this.getList();
191 165
   }
192
-
193
-
194 166
 }

File diff suppressed because it is too large
+ 535 - 516
src/app/views/job-assignment/job-assignment.component.ts


File diff suppressed because it is too large
+ 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 36
   ngOnInit() {
37
-    this.initCoopBtns();
37
+    this.coopBtns = this.tool.initCoopBtns(this.route);
38 38
     this.initForm();
39 39
     this.getAllHospital();
40 40
     this.getType();
41 41
   }
42
-  menu: any = JSON.parse(localStorage.getItem("menu")) || []; //菜单
43 42
   listOfData: any[] = []; //表格数据
44 43
   promptContent: string; //操作提示框提示信息
45 44
   ifSuccess: boolean; //操作成功/失败
@@ -65,12 +64,7 @@ export class OfficeManagementComponent implements OnInit {
65 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 69
   addDeptPhone(e: MouseEvent) {
76 70
     e.preventDefault();
@@ -96,40 +90,7 @@ export class OfficeManagementComponent implements OnInit {
96 90
     }
97 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 95
   search() {
135 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 24
       fun.call(this, v[1]);
25 25
     });
26 26
     this.initOrderType();
27
-    this.initCoopBtns();
27
+    this.coopBtns = this.tool.initCoopBtns(this.route);
28 28
     this.getAllHos();
29 29
     this.getGdStates();
30 30
   }
31 31
 
32
-  menu: any = JSON.parse(localStorage.getItem("menu")) || []; //菜单
33 32
   listOfData: any[] = []; //表格数据
34 33
 
35 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 79
   search() {
116 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 5
 import { MainService } from "../../services/main.service";
6 6
 import { DateService } from "../../services/date.service";
7 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 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 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 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 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 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 83
   getSearchData() {
110 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 97
     // setTimeout(() => {
124 98
     //   if (!sub['isStopped']) {
125
-    that.changeDateRange(that.defRange)
126
-    that.search()
99
+    that.changeDateRange(that.defRange);
100
+    that.search();
127 101
     //   }
128 102
     // }, 100);
129
-
130 103
   }
131 104
   // 搜索
132 105
   search(num?: number) {
133 106
     if (this.hospital) {
134
-      this.searchData['hosId'] = this.hospital;
107
+      this.searchData["hosId"] = this.hospital;
135 108
     }
136 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 115
     if (num !== undefined) {
143 116
       this.getList(num);
@@ -151,35 +124,38 @@ export class OrderStatisticsComponent implements OnInit {
151 124
     let that = this;
152 125
     let postData = {
153 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 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 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 161
   loading1 = false;
@@ -193,74 +169,75 @@ export class OrderStatisticsComponent implements OnInit {
193 169
       startTime: this.searchData.dateRange.start,
194 170
       endTime: this.searchData.dateRange.end,
195 171
       hosId: this.searchData.hosId,
196
-      type: this.dateType
197
-    }
172
+      type: this.dateType,
173
+    };
198 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 185
   getAllHos() {
209
-    this.hospital = this.tool.getCurrentHospital().id + '';
186
+    this.hospital = this.tool.getCurrentHospital().id + "";
210 187
   }
211 188
 
212 189
   // 修改时间展示维度
213 190
   changeDateType(res) {
214
-    console.log(res, this.dateType)
191
+    console.log(res, this.dateType);
215 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 195
     switch (res) {
219
-      case 'day':
196
+      case "day":
220 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 213
         break;
235
-      case 'month':
214
+      case "month":
236 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 227
         break;
248
-      case 'year':
228
+      case "year":
249 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 237
         break;
258
-
259 238
     }
260
-
261 239
   }
262 240
 
263
-
264 241
   // 禁选日期
265 242
   disabledDate = (current: Date): boolean => {
266 243
     // Can not select days before today and today
@@ -271,108 +248,119 @@ export class OrderStatisticsComponent implements OnInit {
271 248
   disabledMonthStart = (current: Date): boolean => {
272 249
     // Can not select days before today and today
273 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 255
   disabledMonthEnd = (current: Date): boolean => {
279 256
     // Can not select days before today and today
280 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 263
   disabledYearStart = (current: Date): boolean => {
287 264
     // Can not select days before today and today
288 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 271
   disabledYearEnd = (current: Date): boolean => {
295 272
     // Can not select days before today and today
296 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 281
   changeDate(result?): void {
305
-    console.log(this.dateRange)
306
-    console.log(result)
282
+    console.log(this.dateRange);
283
+    console.log(result);
307 284
     this.dateRange = result;
308 285
     if (!this.quick) {
309 286
       // 不是快捷选择
310 287
       this.defRange = null;
311 288
     }
312 289
     if (!result || !result.length) {
313
-      this.startDate = this.endDate = '';
290
+      this.startDate = this.endDate = "";
314 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 308
   changeMonthStart(result?) {
322
-    console.log(result)
323
-    this.monthRangeStart = result
309
+    console.log(result);
310
+    this.monthRangeStart = result;
324 311
     if (!this.quick) {
325 312
       // 不是快捷选择
326 313
       this.defRange = null;
327 314
     }
328 315
     if (!result) {
329
-      this.startDate = this.endDate = '';
316
+      this.startDate = this.endDate = "";
330 317
       return;
331 318
     }
332
-    this.startDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
319
+    this.startDate =
320
+      result.getFullYear() + "-" + (result.getMonth() + 1) + "-01";
333 321
     // this.endDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
334 322
   }
335 323
   changeMonthEnd(result?) {
336
-    console.log(result)
337
-    this.monthRangeEnd = result
324
+    console.log(result);
325
+    this.monthRangeEnd = result;
338 326
     if (!this.quick) {
339 327
       // 不是快捷选择
340 328
       this.defRange = null;
341 329
     }
342 330
     if (!result) {
343
-      this.startDate = this.endDate = '';
331
+      this.startDate = this.endDate = "";
344 332
       return;
345 333
     }
346 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 338
   changeYearStart(result?) {
351
-    console.log(result)
352
-    this.yearRangeStart = result
339
+    console.log(result);
340
+    this.yearRangeStart = result;
353 341
     if (!this.quick) {
354 342
       // 不是快捷选择
355 343
       this.defRange = null;
356 344
     }
357 345
     if (!result) {
358
-      this.startDate = this.endDate = '';
346
+      this.startDate = this.endDate = "";
359 347
       return;
360 348
     }
361
-    this.startDate = result.getFullYear() + '-01-01';
349
+    this.startDate = result.getFullYear() + "-01-01";
362 350
     // this.endDate = result.getFullYear() + '-01-01';
363 351
   }
364 352
   changeYearEnd(result?) {
365
-    console.log(result)
366
-    this.yearRangeEnd = result
353
+    console.log(result);
354
+    this.yearRangeEnd = result;
367 355
     if (!this.quick) {
368 356
       // 不是快捷选择
369 357
       this.defRange = null;
370 358
     }
371 359
     if (!result) {
372
-      this.startDate = this.endDate = '';
360
+      this.startDate = this.endDate = "";
373 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 370
     console.log(res);
383 371
     this.quick = true;
384 372
     switch (res) {
385
-      case '1':
373
+      case "1":
386 374
         // 上周
387 375
         let lastweekstartdate = this.dateService.date().lastWeekStartDate;
388 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 379
         break;
392
-      case '2':
380
+      case "2":
393 381
         // 上月
394 382
         let lastmonthstartdate = this.dateService.date().lastMonthStartDate;
395 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 388
         break;
401
-      case '3':
389
+      case "3":
402 390
         // 上年
403 391
         let lastyearstartdate = this.dateService.date().lastYearStartDate;
404 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 399
         break;
412 400
     }
413 401
     this.quick = false;
414
-
415 402
   }
416 403
 
417 404
   // 更多
418 405
   toMore(type) {
419 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 412
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
@@ -438,16 +425,15 @@ export class OrderStatisticsComponent implements OnInit {
438 425
   searchTimer(fun, e, those) {
439 426
     let that = this;
440 427
     that.isLoading = true;
441
-    fun(e, those)
428
+    fun(e, those);
442 429
   }
443 430
 
444 431
   // 截取意见内容(ie内核截取)
445 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 435
     } else {
449 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 36
   userInfo: any = JSON.parse(localStorage.getItem("user")) || {}; //登录用户信息
37
-  menu: any = JSON.parse(localStorage.getItem("menu")) || []; //菜单
38 37
 
39 38
   searchCriteria = {
40 39
     //搜索条件
@@ -80,7 +79,7 @@ export class RoundRobinComponent implements OnInit {
80 79
       .subscribe((v: any) => {
81 80
         this.getTasktypeByIds(v);
82 81
       });
83
-    this.initCoopBtns();
82
+    this.coopBtns = this.tool.initCoopBtns(this.route);
84 83
     this.getAllHospital();
85 84
     this.initForm();
86 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 1
 import { Component, OnInit } from "@angular/core";
2 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 5
 import { MainService } from "../../services/main.service";
11 6
 import { ToolService } from "../../services/tool.service";
@@ -28,7 +23,6 @@ export class ShortcutBuildOrdersComponent implements OnInit {
28 23
   ) {}
29 24
 
30 25
   userInfo: any = JSON.parse(localStorage.getItem("user")) || {}; //登录用户信息
31
-  menu: any = JSON.parse(localStorage.getItem("menu")) || []; //菜单
32 26
 
33 27
   searchCriteria = {
34 28
     //搜索条件
@@ -70,7 +64,7 @@ export class ShortcutBuildOrdersComponent implements OnInit {
70 64
     this.changeInpSubject.pipe(debounceTime(500)).subscribe((v) => {
71 65
       this.searchDepartment(v[0], v[1]);
72 66
     });
73
-    this.initCoopBtns();
67
+    this.coopBtns = this.tool.initCoopBtns(this.route);
74 68
     this.getAllHospital();
75 69
     this.initForm();
76 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 2
 import { FormBuilder, FormGroup, Validators } from "@angular/forms";
3 3
 import { ActivatedRoute } from "@angular/router";
4 4
 import { MainService } from "../../services/main.service";
5
+import { ToolService } from "src/app/services/tool.service";
5 6
 
6 7
 @Component({
7 8
   selector: "app-sys-config",
@@ -19,15 +20,13 @@ export class SysConfigComponent implements OnInit {
19 20
   ifSuccess: boolean; //操作成功/失败
20 21
   promptInfo: string; //操作结果提示信息
21 22
   promptModalShow: boolean; //操作提示框是否展示
22
-  coopBtns = {
23
-    //初始化权限
24
-    edit: false,
25
-  };
23
+  coopBtns = {};
26 24
   menu = JSON.parse(localStorage.getItem("menu")) || []; //菜单
27 25
   constructor(
28 26
     private mainService: MainService,
29 27
     private fb: FormBuilder,
30
-    private route: ActivatedRoute
28
+    private route: ActivatedRoute,
29
+    private tool: ToolService
31 30
   ) {}
32 31
 
33 32
   ngOnInit() {
@@ -42,27 +41,7 @@ export class SysConfigComponent implements OnInit {
42 41
       busiViewDeptId: [null, [Validators.required]],
43 42
     });
44 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 47
   refresh() {
@@ -172,7 +151,7 @@ export class SysConfigComponent implements OnInit {
172 151
                   this.validateForm.controls.cachePort.setValue(c[1]);
173 152
                   break;
174 153
                 case "busiViewDeptId":
175
-                  this.validateForm.controls.busiViewDeptId.setValue(c[1]+'');
154
+                  this.validateForm.controls.busiViewDeptId.setValue(c[1] + "");
176 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 51
     static: false,
52 52
   })
53 53
   osComponentRef1: OverlayScrollbarsComponent;
54
-  menu: any = JSON.parse(localStorage.getItem("menu")) || []; //菜单
55 54
   taskTypeLoading = false; //任务类型加载中
56 55
   allTaskTypeOptions: any;
57 56
   tabModalName = "jcxx"; //详情tab字段
@@ -264,7 +263,7 @@ export class TaskTypeManagementComponent implements OnInit {
264 263
     this.changeSearchTaskListSubject.pipe(debounceTime(500)).subscribe((v) => {
265 264
       this.getSearchTaskList(v);
266 265
     });
267
-    this.initCoopBtns(); //获取增删改查按钮权限
266
+    this.coopBtns = this.tool.initCoopBtns(this.route);
268 267
     this.listOfData = [{ A: 1 }];
269 268
     for (let i = 0; i < 100; i++) {
270 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 387
   getAllHospital() {
426 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 4
 import { MainService } from "../../services/main.service";
5 5
 import { DateService } from "../../services/date.service";
6 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 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 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 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 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 61
   getSearchData() {
88 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 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 80
     }, 100);
107
-
108 81
   }
109 82
   // 搜索
110 83
   search(num?: number) {
111 84
     if (this.hospital) {
112
-      this.searchData['hosId'] = this.hospital;
85
+      this.searchData["hosId"] = this.hospital;
113 86
     }
114 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 93
     if (num !== undefined) {
121 94
       this.getList(num);
@@ -129,33 +102,36 @@ export class TaskTypeStatisticsComponent implements OnInit {
129 102
     let that = this;
130 103
     let postData = {
131 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 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 132
   reset() {
157
-    this.changeDateRange('1')
158
-    this.search()
133
+    this.changeDateRange("1");
134
+    this.search();
159 135
   }
160 136
   // 表格数据
161 137
   loading1 = false;
@@ -168,39 +144,50 @@ export class TaskTypeStatisticsComponent implements OnInit {
168 144
       sum: this.pageSize,
169 145
       startTime: this.searchData.dateRange.start,
170 146
       endTime: this.searchData.dateRange.end,
171
-      hosId: this.searchData.hosId
172
-    }
147
+      hosId: this.searchData.hosId,
148
+    };
173 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 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 167
   changeDate(result?): void {
191
-    console.log(this.dateRange)
192
-    console.log(result)
168
+    console.log(this.dateRange);
169
+    console.log(result);
193 170
     this.dateRange = result;
194 171
     if (!this.quick) {
195 172
       // 不是快捷选择
196 173
       this.defRange = null;
197 174
     }
198 175
     if (!result || !result.length) {
199
-      this.startDate = this.endDate = '';
176
+      this.startDate = this.endDate = "";
200 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 198
     console.log(res);
212 199
     this.quick = true;
213 200
     switch (res) {
214
-      case '1':
201
+      case "1":
215 202
         // 上周
216 203
         let lastweekstartdate = this.dateService.date().lastWeekStartDate;
217 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 207
         break;
221
-      case '2':
208
+      case "2":
222 209
         // 上月
223 210
         let lastmonthstartdate = this.dateService.date().lastMonthStartDate;
224 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 214
         break;
228
-      case '3':
215
+      case "3":
229 216
         // 上年
230 217
         let lastyearstartdate = this.dateService.date().lastYearStartDate;
231 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 221
         break;
235 222
     }
236 223
     this.quick = false;
237
-
238 224
   }
239 225
 
240 226
   // 更多
241 227
   toMore(type) {
242 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 234
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
@@ -261,17 +247,15 @@ export class TaskTypeStatisticsComponent implements OnInit {
261 247
   searchTimer(fun, e, those) {
262 248
     let that = this;
263 249
     that.isLoading = true;
264
-    fun(e, those)
250
+    fun(e, those);
265 251
   }
266 252
 
267 253
   // 截取意见内容(ie内核截取)
268 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 257
     } else {
272 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 34
   userInfo: any = JSON.parse(localStorage.getItem("user")) || {}; //登录用户信息
35
-  menu: any = JSON.parse(localStorage.getItem("menu")) || []; //菜单
36 35
   hosId;
37 36
   createUser = "";
38 37
   users = []; // 用户列表
@@ -57,7 +56,7 @@ export class TimingMessageSendingComponent implements OnInit {
57 56
   ngOnInit() {
58 57
     this.hosId = this.tool.getCurrentHospital().id;
59 58
     this.getList();
60
-    this.initCoopBtns();
59
+    this.coopBtns = this.tool.initCoopBtns(this.route);
61 60
     this.initForm();
62 61
   }
63 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 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 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 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 17
 export class UsersManagementComponent implements OnInit {
18
-  @ViewChild('osComponentRef1', { read: OverlayScrollbarsComponent, static: false })
18
+  @ViewChild("osComponentRef1", {
19
+    read: OverlayScrollbarsComponent,
20
+    static: false,
21
+  })
19 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 64
   ngOnInit() {
56 65
     //防抖
57
-    this.changeInpSubject.pipe(debounceTime(500)).subscribe(v => {
66
+    this.changeInpSubject.pipe(debounceTime(500)).subscribe((v) => {
58 67
       this.getDeparts(v[0], v[1], v[2]);
59
-    })
60
-    this.initCoopBtns();
68
+    });
69
+    this.coopBtns = this.tool.initCoopBtns(this.route);
61 70
     this.initForm();
62 71
     this.getAllHospital();
63
-    this.getAllRole()
72
+    this.getAllRole();
64 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 80
   search() {
110 81
     this.pageIndex = 1;
@@ -113,14 +84,13 @@ export class UsersManagementComponent implements OnInit {
113 84
   // 重置
114 85
   reset() {
115 86
     this.pageIndex = 1;
116
-    this.name = '';
117
-    this.num = '';
87
+    this.name = "";
88
+    this.num = "";
118 89
     this.userType = null;
119 90
     this.department = null;
120 91
     this.userGroup1 = null;
121 92
     this.changeHosp1(this.hosId);
122 93
     this.getList();
123
-
124 94
   }
125 95
   // 表格数据
126 96
   loading1 = false;
@@ -129,46 +99,47 @@ export class UsersManagementComponent implements OnInit {
129 99
       idx: this.pageIndex - 1,
130 100
       sum: this.pageSize,
131 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 110
     if (!data.user.dept || !data.user.dept.id) {
141
-      delete data.user.dept
111
+      delete data.user.dept;
142 112
     }
143 113
     if (!data.user.usertype || !data.user.usertype.id) {
144
-      delete data.user.usertype
114
+      delete data.user.usertype;
145 115
     }
146 116
     if (!data.user.groupdata || !data.user.groupdata.id) {
147
-      delete data.user.groupdata
117
+      delete data.user.groupdata;
148 118
     }
149 119
     if (!data.user.hospital || !data.user.hospital.id) {
150
-      delete data.user.hospital
120
+      delete data.user.hospital;
151 121
     }
152 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 133
   getUserTypes() {
163 134
     var that = this;
164
-    that.mainService.getDictionary('list', 'usertype').subscribe(data => {
135
+    that.mainService.getDictionary("list", "usertype").subscribe((data) => {
165 136
       that.userTypes = data;
166
-    })
137
+    });
167 138
   }
168 139
 
169 140
   // 获取相应的院区
170 141
   getAllHospital() {
171
-    this.hosId = this.tool.getCurrentHospital().id + '';
142
+    this.hosId = this.tool.getCurrentHospital().id + "";
172 143
     this.changeHosp1(this.hosId);
173 144
     this.getList();
174 145
   }
@@ -178,42 +149,48 @@ export class UsersManagementComponent implements OnInit {
178 149
     var that = this;
179 150
     let data = {
180 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 162
   changeHosp() {
190
-    let hid = this.hosId - 0
163
+    let hid = this.hosId - 0;
191 164
     let data = {
192 165
       department: {
193 166
         hospital: { id: hid },
194 167
       },
195 168
       idx: 0,
196
-      sum: 20
197
-    }
169
+      sum: 20,
170
+    };
198 171
     let groupData = {
199 172
       group2: {
200
-        hospitals: hid
173
+        hospitals: hid,
201 174
       },
202 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 195
   // 切换院区选项获取对应科室列表(搜索)seimin
219 196
   changeHosp1(id) {
@@ -224,30 +201,34 @@ export class UsersManagementComponent implements OnInit {
224 201
         hospital: { id },
225 202
       },
226 203
       idx: 0,
227
-      sum: 20
228
-    }
204
+      sum: 20,
205
+    };
229 206
     let groupData = {
230 207
       group2: {
231 208
         hospitals: id,
232 209
       },
233 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 226
   genders: Array<any> = [];
246 227
   getGender() {
247 228
     var that = this;
248
-    that.mainService.getDictionary('list', 'user_gender').subscribe(data => {
229
+    that.mainService.getDictionary("list", "user_gender").subscribe((data) => {
249 230
       that.genders = data;
250
-    })
231
+    });
251 232
   }
252 233
 
253 234
   // 新增弹框
@@ -258,7 +239,7 @@ export class UsersManagementComponent implements OnInit {
258 239
   }
259 240
   hideModal() {
260 241
     this.modal = false;
261
-    this.initForm()
242
+    this.initForm();
262 243
   }
263 244
 
264 245
   // 初始化新增form表单
@@ -276,22 +257,22 @@ export class UsersManagementComponent implements OnInit {
276 257
       gender: [null, [Validators.required]],
277 258
       userGroup: [null],
278 259
       role: [null, [Validators.required]],
279
-      weixin: [null]
260
+      weixin: [null],
280 261
     });
281 262
   }
282 263
   // 选择用户类型
283 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 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 278
   submitForm(): void {
@@ -302,14 +283,15 @@ export class UsersManagementComponent implements OnInit {
302 283
     }
303 284
     if (that.validateForm.invalid) return;
304 285
     that.btnLoading = true;
305
-    let groups = [], roles = [];
286
+    let groups = [],
287
+      roles = [];
306 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 296
     let data = {
315 297
       user: {
@@ -323,27 +305,28 @@ export class UsersManagementComponent implements OnInit {
323 305
         phone: that.validateForm.value.deptPhone,
324 306
         hospital: { id: that.hosId },
325 307
         weixin: that.validateForm.value.weixin,
326
-      }
327
-    }
308
+      },
309
+    };
328 310
     if (!that.validateForm.value.userGroup) {
329
-      delete data.user.group
311
+      delete data.user.group;
330 312
     } else if (that.validateForm.value.userGroup.length === 0) {
331
-      delete data.user.group
313
+      delete data.user.group;
332 314
     }
333 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 339
         hospital: { id: hid },
357 340
       },
358 341
       idx: 0,
359
-      sum: 20
360
-    }
342
+      sum: 20,
343
+    };
361 344
     let groupData = {
362 345
       group2: {
363 346
         hospitals: hid,
364 347
       },
365 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 411
   del(data) {
418 412
     let that = this;
419 413
     that.coopId = data.id;
@@ -423,19 +417,24 @@ export class UsersManagementComponent implements OnInit {
423 417
   confirmDel() {
424 418
     let that = this;
425 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 440
   hideDelModal() {
@@ -456,21 +455,21 @@ export class UsersManagementComponent implements OnInit {
456 455
 
457 456
   // 查看
458 457
   detail(id) {
459
-    this.router.navigateByUrl('/main/usersManagement/userDetail/' + id);
458
+    this.router.navigateByUrl("/main/usersManagement/userDetail/" + id);
460 459
   }
461 460
   // 边输边搜节流阀
462 461
   isLoading = false;
463 462
   changeInp(deptId, type, e) {
464 463
     if (!deptId) {
465
-      if (type == 'search') {
464
+      if (type == "search") {
466 465
         this.alldepart1 = [];
467
-      } else if (type == 'add') {
466
+      } else if (type == "add") {
468 467
         this.alldepart = [];
469 468
       }
470 469
       return;
471 470
     }
472 471
     this.isLoading = true;
473
-    this.changeInpSubject.next([deptId, type, e])
472
+    this.changeInpSubject.next([deptId, type, e]);
474 473
   }
475 474
   // 获取所有科室
476 475
   snum = 0;
@@ -480,23 +479,25 @@ export class UsersManagementComponent implements OnInit {
480 479
       department: {
481 480
         dept,
482 481
         hospital: {
483
-          id: deptId
484
-        }
482
+          id: deptId,
483
+        },
485 484
       },
486 485
       idx: 0,
487
-      sum: 20
488
-    }
486
+      sum: 20,
487
+    };
489 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 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 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 15
 export class WechatConfigComponent implements OnInit {
16 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 41
   osComponentRef1: OverlayScrollbarsComponent;
37 42
   onDeptSearchSubject = new Subject();
38 43
   ngOnInit() {
39
-    this.onDeptSearchSubject.pipe(debounceTime(500)).subscribe(v => {
44
+    this.onDeptSearchSubject.pipe(debounceTime(500)).subscribe((v) => {
40 45
       this.onDeptSearch(v);
41
-    })
46
+    });
42 47
     this.hospitals = this.tool.getHospitalList();
43 48
     this.validateForm = this.fb.group({
44 49
       appid: [null, [Validators.required]],
45 50
       agentid: [null, [Validators.required]],
46
-      autoCreateUser: ['1', [Validators.required]],
51
+      autoCreateUser: ["1", [Validators.required]],
47 52
       defaultRole: [null, [Validators.required]],
48 53
       defaultHospital: [null, [Validators.required]],
49 54
       defaultDept: [null, [Validators.required]],
50 55
       defaultGroup: [null, [Validators.required]],
51 56
     });
52 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 61
   submitForm(): void {
@@ -80,79 +65,97 @@ export class WechatConfigComponent implements OnInit {
80 65
     }
81 66
     if (this.validateForm.invalid) {
82 67
       return;
83
-    };
68
+    }
84 69
     const postData = {
85 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 73
       defaultRole: this.validateForm.controls.defaultRole.value,
88 74
       hospital: this.validateForm.controls.defaultHospital.value,
89 75
       defaultDept: this.validateForm.controls.defaultDept.value,
90 76
       defaultGroup: this.validateForm.controls.defaultGroup.value,
91 77
     };
92 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 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 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 146
   getRoleList() {
146
-    const postData = { "idx": 0, "sum": 1000 };
147
+    const postData = { idx: 0, sum: 1000 };
147 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 160
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
158 161
   showPromptModal(con, success, promptInfo) {
@@ -168,10 +171,10 @@ export class WechatConfigComponent implements OnInit {
168 171
   //修改默认院区
169 172
   hospitalChange(hosId) {
170 173
     this.hosId = hosId;
171
-    this.getGroupList(hosId).subscribe(result => {
174
+    this.getGroupList(hosId).subscribe((result) => {
172 175
       if (result.status == 200) {
173 176
         this.groupList = result.list;
174
-        this.getDeptList(hosId).subscribe(result1 => {
177
+        this.getDeptList(hosId).subscribe((result1) => {
175 178
           if (result1.status == 200) {
176 179
             this.deptList = result1.list;
177 180
           }
@@ -181,16 +184,20 @@ export class WechatConfigComponent implements OnInit {
181 184
   }
182 185
   // 获取科室列表
183 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 192
     if (value) {
186 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 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 203
   onDeptSearchNew(value) {
@@ -199,7 +206,7 @@ export class WechatConfigComponent implements OnInit {
199 206
   }
200 207
   //搜索科室
201 208
   onDeptSearch(value): void {
202
-    this.getDeptList(this.hosId, value).subscribe(result => {
209
+    this.getDeptList(this.hosId, value).subscribe((result) => {
203 210
       this.loading3 = false;
204 211
       if (result.status == 200) {
205 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 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 16
 export class WorkAssignmentComponent implements OnInit {
17
-
18 17
   constructor(
19 18
     private fb: FormBuilder,
20 19
     private mainService: MainService,
21 20
     private route: ActivatedRoute,
22 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 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 49
   ngOnInit() {
52 50
     this.currentHospital = this.tool.getCurrentHospital();
53
-    this.initCoopBtns();
51
+    this.coopBtns = this.tool.initCoopBtns(this.route);
54 52
     this.initForm();
55 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 60
   loading1 = false;
89 61
   getList(type) {
90 62
     if (type == 1) {
91
-      this.pageIndex = 1
63
+      this.pageIndex = 1;
92 64
     }
93 65
     let data = {
94 66
       idx: this.pageIndex - 1,
95 67
       sum: this.pageSize,
96 68
       workScheme: {
97
-        "hosId": this.currentHospital.id
98
-      }
99
-    }
69
+        hosId: this.currentHospital.id,
70
+      },
71
+    };
100 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 85
   addModal() {
112
-    this.modelName = '新增';
113
-    this.add = true;//新增
86
+    this.modelName = "新增";
87
+    this.add = true; //新增
114 88
     this.modal = true;
115 89
     this.copyModel = false;
116 90
     this.initForm();
@@ -121,15 +95,20 @@ export class WorkAssignmentComponent implements OnInit {
121 95
     this.initForm();
122 96
   }
123 97
   // 新增/编辑弹框
124
-  timeFlag = '';//open开启,close关闭
98
+  timeFlag = ""; //open开启,close关闭
125 99
   addDateModal(data) {
126 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 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 112
     } else {
134 113
       this.dateModal = true;
135 114
     }
@@ -144,20 +123,19 @@ export class WorkAssignmentComponent implements OnInit {
144 123
   initForm() {
145 124
     this.validateForm = this.fb.group({
146 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 130
   // 初始化新增form表单
152 131
   initDateForm() {
153 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 139
   submitForm(noGoTo?): void {
162 140
     for (const i in this.validateForm.controls) {
163 141
       this.validateForm.controls[i].markAsDirty();
@@ -165,7 +143,7 @@ export class WorkAssignmentComponent implements OnInit {
165 143
     }
166 144
     if (this.validateForm.invalid) {
167 145
       return;
168
-    };
146
+    }
169 147
     if (noGoTo) {
170 148
       this.btnLoading1 = true;
171 149
     } else {
@@ -173,33 +151,33 @@ export class WorkAssignmentComponent implements OnInit {
173 151
     }
174 152
     let data = {};
175 153
 
176
-    if (this.add) {//增加
154
+    if (this.add) {
155
+      //增加
177 156
       data = {
178
-        workScheme:
179
-        {
157
+        workScheme: {
180 158
           name: this.validateForm.value.workAssignmentName,
181 159
           workType: this.validateForm.value.workAssignmentType,
182 160
           describe: this.validateForm.value.workAssignmentDescribe,
183 161
           status: 0,
184
-          hosId: this.currentHospital.id
185
-        }
162
+          hosId: this.currentHospital.id,
163
+        },
186 164
       };
187
-    } else {//编辑
165
+    } else {
166
+      //编辑
188 167
       data = {
189
-        workScheme:
190
-        {
168
+        workScheme: {
191 169
           id: this.coopId.id,
192 170
           name: this.validateForm.value.workAssignmentName,
193 171
           workType: this.validateForm.value.workAssignmentType,
194 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 179
       data = {
201
-        workScheme:
202
-        {
180
+        workScheme: {
203 181
           name: this.validateForm.value.workAssignmentName,
204 182
           workType: this.validateForm.value.workAssignmentType,
205 183
           describe: this.validateForm.value.workAssignmentDescribe,
@@ -207,57 +185,67 @@ export class WorkAssignmentComponent implements OnInit {
207 185
           copy: 1,
208 186
           copySchemeId: this.coopId.id,
209 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 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 244
   disabledDateTime: DisabledTimeFn = () => {
257 245
     return {
258 246
       nzDisabledHours: () => [],
259 247
       nzDisabledMinutes: () => [],
260
-      nzDisabledSeconds: () => this.range(1, 60)
248
+      nzDisabledSeconds: () => this.range(1, 60),
261 249
     };
262 250
   };
263 251
   range(start: number, end: number): number[] {
@@ -277,59 +265,60 @@ export class WorkAssignmentComponent implements OnInit {
277 265
     if (this.validateDateForm.invalid) {
278 266
       this.btnLoading = false;
279 267
       return;
280
-    };
268
+    }
281 269
     let data = {};
282 270
     let todayDate = new Date(this.validateDateForm.value.datePickerTime);
283 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 276
     // 2020-07-28 16:45:00
289 277
     data = {
290
-      workScheme:
291
-      {
278
+      workScheme: {
292 279
         id: this.coopId.id,
293 280
         timingStatus: 1,
294 281
         startTime: `${year}-${month}-${date} ${hour}:${minutes}:00`,
295 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 301
   edit(data) {
313 302
     console.log(data);
314
-    this.modelName = '编辑';
303
+    this.modelName = "编辑";
315 304
     this.add = false;
316 305
     this.modal = true;
317 306
     this.coopId = data;
318 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 314
   copy(data) {
326
-    this.modelName = '复制';
315
+    this.modelName = "复制";
327 316
     this.copyModel = true;
328 317
     this.modal = true;
329 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 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 351
     this.confirmDelIsSwitch = isSwitch;
357 352
     this.confirmDelType = type;
358 353
     this.delModal = true;
@@ -367,67 +362,79 @@ export class WorkAssignmentComponent implements OnInit {
367 362
   // 确认删除
368 363
   confirmDel() {
369 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 391
       let data = {
390
-        workScheme:
391
-        {
392
+        workScheme: {
392 393
           id: this.coopId.id,
393 394
           hosId: this.currentHospital.id,
394 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 412
       let data = {
409
-        workScheme:
410
-        {
413
+        workScheme: {
411 414
           id: this.coopId.id,
412 415
           hosId: this.currentHospital.id,
413 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 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 440
   defaultTimePickerOpenValue = new Date();
@@ -439,12 +446,10 @@ export class WorkAssignmentComponent implements OnInit {
439 446
     }
440 447
     let todayDate = new Date(e);
441 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 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 4
 import { MainService } from "../../services/main.service";
5 5
 import { DateService } from "../../services/date.service";
6 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 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 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 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 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 61
   getSearchData() {
88 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 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 80
     }, 100);
107
-
108 81
   }
109 82
   // 搜索
110 83
   search(num?: number) {
111 84
     if (this.hospital) {
112
-      this.searchData['hosId'] = this.hospital;
85
+      this.searchData["hosId"] = this.hospital;
113 86
     }
114 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 93
     if (num !== undefined) {
121 94
       this.getList(num);
122 95
     } else {
123
-      this.getList()
96
+      this.getList();
124 97
     }
125 98
   }
126 99
   // 导出
@@ -129,35 +102,38 @@ export class WorkerStatisticsComponent implements OnInit {
129 102
     let that = this;
130 103
     let postData = {
131 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 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 133
   reset() {
158
-    this.changeDateRange('1')
134
+    this.changeDateRange("1");
159 135
     this.group = null;
160
-    this.search()
136
+    this.search();
161 137
   }
162 138
   // 表格数据
163 139
   loading1 = false;
@@ -171,21 +147,23 @@ export class WorkerStatisticsComponent implements OnInit {
171 147
       startTime: this.searchData.dateRange.start,
172 148
       endTime: this.searchData.dateRange.end,
173 149
       hosId: this.searchData.hosId,
174
-      groupId: this.group || '',
175
-    }
150
+      groupId: this.group || "",
151
+    };
176 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 165
   getAllHos() {
188
-    this.hospital = this.tool.getCurrentHospital().id + '';
166
+    this.hospital = this.tool.getCurrentHospital().id + "";
189 167
     this.getGroupList(this.hospital);
190 168
   }
191 169
   // 获取分组
@@ -195,30 +173,42 @@ export class WorkerStatisticsComponent implements OnInit {
195 173
         hospitals: id,
196 174
       },
197 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 188
   changeDate(result?): void {
209
-    console.log(this.dateRange)
210
-    console.log(result)
189
+    console.log(this.dateRange);
190
+    console.log(result);
211 191
     this.dateRange = result;
212 192
     if (!this.quick) {
213 193
       // 不是快捷选择
214 194
       this.defRange = null;
215 195
     }
216 196
     if (!result || !result.length) {
217
-      this.startDate = this.endDate = '';
197
+      this.startDate = this.endDate = "";
218 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 212
     this.search();
223 213
   }
224 214
   // 修改搜素条件工作组
@@ -234,38 +224,37 @@ export class WorkerStatisticsComponent implements OnInit {
234 224
     console.log(res);
235 225
     this.quick = true;
236 226
     switch (res) {
237
-      case '1':
227
+      case "1":
238 228
         // 上周
239 229
         let lastweekstartdate = this.dateService.date().lastWeekStartDate;
240 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 233
         break;
244
-      case '2':
234
+      case "2":
245 235
         // 上月
246 236
         let lastmonthstartdate = this.dateService.date().lastMonthStartDate;
247 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 240
         break;
251
-      case '3':
241
+      case "3":
252 242
         // 上年
253 243
         let lastyearstartdate = this.dateService.date().lastYearStartDate;
254 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 247
         break;
258 248
     }
259 249
     this.quick = false;
260
-
261 250
   }
262 251
 
263 252
   // 更多
264 253
   toMore(type) {
265 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 260
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
@@ -281,22 +270,24 @@ export class WorkerStatisticsComponent implements OnInit {
281 270
 
282 271
   // 边输入边搜索节流阀
283 272
   searchTimer(fun, e, those) {
284
-    fun(e, those)
273
+    fun(e, those);
285 274
   }
286 275
 
287 276
   // 截取意见内容(ie内核截取)
288 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 280
     } else {
292 281
       return con;
293 282
     }
294 283
   }
295 284
   //获取支助人员工单详情列表
296 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
 }