Browse Source

系统设置中增加业务视图科室类型

seimin 3 years ago
parent
commit
10f05cce6f

+ 2 - 2
src/app/views/main/main.component.html

@@ -36,8 +36,8 @@
36 36
           <button nz-button nzType="primary" *ngIf="nurseRole" (click)="toHuShi()">护士端</button>
37 37
           <button nz-button nzType="primary" *ngIf="pharmacyRole" (click)="toPharmacy()">药房端</button>
38 38
           <button nz-button nzType="primary" *ngIf="largeScreenRole" (click)="toBigScreen('largeScreen')">大屏端</button>
39
-          <button nz-button nzType="primary" *ngIf="specimenViewRole"
40
-            (click)="toBigScreen('specimenView')">业务视图</button>
39
+          <button nz-button nzType="primary" *ngIf="specimenViewRole" (click)="toBigScreen('specimenView')"
40
+            [nzLoading]="deptTypeLoading">业务视图</button>
41 41
         </div>
42 42
         <div class="right">
43 43
           <div class="msg">

+ 31 - 12
src/app/views/main/main.component.ts

@@ -201,7 +201,6 @@ export class MainComponent implements OnInit {
201 201
   screenType;
202 202
   hosFlag = false;
203 203
   toBigScreen(type): void {
204
-    // this.hosFlag = true;
205 204
     this.screenType = type;
206 205
     this.submitFormHand(this.currentHospital.id);
207 206
   }
@@ -209,18 +208,38 @@ export class MainComponent implements OnInit {
209 208
     if (this.screenType === "largeScreen") {
210 209
       window.open(http.bigScreenHost + "/#/" + id);
211 210
     } else if (this.screenType === "specimenView") {
212
-      let remember = JSON.parse(localStorage.getItem("remember"));
213
-      window.open(
214
-        http.specimenViewHost +
215
-          "/#/" +
216
-          id +
217
-          "/" +
218
-          encodeURIComponent(remember.username) +
219
-          "/" +
220
-          encodeURIComponent(remember.password)
221
-      );
211
+      this.getTypeByDept(id);
222 212
     }
223 213
   }
214
+  //获取系统设置中的科室类型
215
+  deptTypeLoading = false;
216
+  getTypeByDept(id) {
217
+    let postData = {
218
+      idx: 0,
219
+      sum: 1,
220
+      systemConfiguration: { keyconfig: "busiViewDeptId" },
221
+    };
222
+    this.deptTypeLoading = true;
223
+    this.mainService
224
+      .getFetchDataList("simple/data", "systemConfiguration", postData)
225
+      .subscribe((result) => {
226
+        this.deptTypeLoading = false;
227
+        if (result.status == 200) {
228
+          let remember = JSON.parse(localStorage.getItem("remember"));
229
+          window.open(
230
+            http.specimenViewHost +
231
+              "/#/" +
232
+              id +
233
+              "/" +
234
+              encodeURIComponent(remember.username) +
235
+              "/" +
236
+              encodeURIComponent(remember.password) +
237
+              "/" +
238
+              result.list[0].valueconfig
239
+          );
240
+        }
241
+      });
242
+  }
224 243
   hosFlagHand(flag) {
225 244
     if (!flag) {
226 245
       this.hosFlag = false;
@@ -357,7 +376,7 @@ export class MainComponent implements OnInit {
357 376
           localStorage.setItem("user", JSON.stringify(result.user));
358 377
           location.reload(true);
359 378
         } else {
360
-          this.msg.create("error",'切换院区失败');
379
+          this.msg.create("error", "切换院区失败");
361 380
         }
362 381
       });
363 382
   }

+ 20 - 9
src/app/views/sys-config/sys-config.component.html

@@ -1,4 +1,4 @@
1
-<div class="sysConfig" *ngIf="!loading1">
1
+<div class="sysConfig" *ngIf="!loading1&&!loading4">
2 2
   <div class="main">
3 3
     <h2>系统配置</h2>
4 4
     <form nz-form [formGroup]="validateForm" class="forms">
@@ -17,7 +17,8 @@
17 17
           </nz-form-control>
18 18
         </nz-form-item>
19 19
         <nz-form-item class="formItem">
20
-          <nz-form-label [nzSpan]="12" nzFor="orderClearUserSwitch" nzRequired class="label">下班后是否自动调度重新分派</nz-form-label>
20
+          <nz-form-label [nzSpan]="12" nzFor="orderClearUserSwitch" nzRequired class="label">下班后是否自动调度重新分派
21
+          </nz-form-label>
21 22
           <nz-form-control [nzSpan]="12" nzErrorTip="下班后是否自动调度重新分派是必填项!">
22 23
             <nz-radio-group formControlName="orderClearUserSwitch">
23 24
               <label nz-radio nzValue="1">是</label>
@@ -26,15 +27,23 @@
26 27
           </nz-form-control>
27 28
         </nz-form-item>
28 29
         <nz-form-item class="formItem">
30
+          <nz-form-label [nzSpan]="24" nzFor="busiViewDeptId" nzRequired class="label">业务视图科室类型</nz-form-label>
31
+          <nz-form-control [nzSpan]="24" nzErrorTip="业务视图科室类型是必填项!">
32
+            <nz-select nzPlaceHolder="请选择业务视图科室类型" formControlName="busiViewDeptId">
33
+              <nz-option nzValue="{{item.id}}" nzLabel="{{item.name}}" *ngFor="let item of deptTypes"></nz-option>
34
+            </nz-select>
35
+          </nz-form-control>
36
+        </nz-form-item>
37
+        <nz-form-item class="formItem">
29 38
           <nz-form-label [nzSpan]="24" nzFor="formUrl" nzRequired class="label">FORMURL</nz-form-label>
30 39
           <nz-form-control [nzSpan]="24" nzErrorTip="请输入FORMURL!">
31
-            <input nz-input formControlName="formUrl" id="formUrl" placeholder="请输入FORMURL" disabled>
40
+            <input nz-input formControlName="formUrl" id="formUrl" placeholder="请输入FORMURL">
32 41
           </nz-form-control>
33 42
         </nz-form-item>
34 43
         <nz-form-item class="formItem">
35 44
           <nz-form-label [nzSpan]="24" nzFor="serviceUrl" nzRequired class="label">服务地址</nz-form-label>
36 45
           <nz-form-control [nzSpan]="24" nzErrorTip="请输入服务地址!">
37
-            <input nz-input formControlName="serviceUrl" id="serviceUrl" placeholder="请输入服务地址" disabled>
46
+            <input nz-input formControlName="serviceUrl" id="serviceUrl" placeholder="请输入服务地址">
38 47
           </nz-form-control>
39 48
         </nz-form-item>
40 49
       </div>
@@ -43,24 +52,26 @@
43 52
         <nz-form-item class="formItem">
44 53
           <nz-form-label [nzSpan]="24" nzFor="cachePath" nzRequired class="label">用户缓存地址</nz-form-label>
45 54
           <nz-form-control [nzSpan]="24" nzErrorTip="请输入用户缓存地址!">
46
-            <input nz-input formControlName="cachePath" id="cachePath" placeholder="请输入用户缓存地址" disabled>
55
+            <input nz-input formControlName="cachePath" id="cachePath" placeholder="请输入用户缓存地址">
47 56
           </nz-form-control>
48 57
         </nz-form-item>
49 58
         <nz-form-item class="formItem">
50 59
           <nz-form-label [nzSpan]="24" nzFor="cachePort" nzRequired class="label">用户缓存端口</nz-form-label>
51 60
           <nz-form-control [nzSpan]="24" nzErrorTip="请输入用户缓存端口!">
52
-            <input nz-input formControlName="cachePort" id="cachePort" placeholder="请输入用户缓存端口" disabled>
61
+            <input nz-input formControlName="cachePort" id="cachePort" placeholder="请输入用户缓存端口">
53 62
           </nz-form-control>
54 63
         </nz-form-item>
55 64
       </div>
56 65
     </form>
57 66
   </div>
58 67
   <div class="submit">
59
-    <button [disabled]="!coopBtns.edit" nz-button nzType="primary" class="save" (click)="submitForm()" [nzLoading]="loading2">保存</button>
60
-    <button [disabled]="!coopBtns.edit" nz-button nzType="primary" class="refresh" (click)="refresh()" [nzLoading]="loading3">刷新字典缓存</button>
68
+    <button [disabled]="!coopBtns.edit" nz-button nzType="primary" class="save" (click)="submitForm()"
69
+      [nzLoading]="loading2">保存</button>
70
+    <button [disabled]="!coopBtns.edit" nz-button nzType="primary" class="refresh" (click)="refresh()"
71
+      [nzLoading]="loading3">刷新字典缓存</button>
61 72
   </div>
62 73
 </div>
63
-<div class="sysConfig" *ngIf="loading1">
74
+<div class="sysConfig" *ngIf="loading1&&loading4">
64 75
   <div class="loadingFull display_flex justify-content_flex-center align-items_center">
65 76
     <div class="loadingFullInner">
66 77
       <img src="../../assets/images/loading.gif" alt="">

+ 136 - 101
src/app/views/sys-config/sys-config.component.ts

@@ -1,77 +1,86 @@
1
-import { Component, OnInit } from '@angular/core';
2
-import { FormBuilder, FormGroup, Validators } from '@angular/forms';
3
-import { ActivatedRoute } from '@angular/router';
1
+import { Component, OnInit } from "@angular/core";
2
+import { FormBuilder, FormGroup, Validators } from "@angular/forms";
3
+import { ActivatedRoute } from "@angular/router";
4 4
 import { MainService } from "../../services/main.service";
5 5
 
6 6
 @Component({
7
-  selector: 'app-sys-config',
8
-  templateUrl: './sys-config.component.html',
9
-  styleUrls: ['./sys-config.component.less']
7
+  selector: "app-sys-config",
8
+  templateUrl: "./sys-config.component.html",
9
+  styleUrls: ["./sys-config.component.less"],
10 10
 })
11 11
 export class SysConfigComponent implements OnInit {
12 12
   validateForm: FormGroup;
13
-  loading1 = false;//查询信息的loading
14
-  loading2 = false;//保存信息的loading
15
-  loading3 = false;//刷新字典缓存信息的loading
16
-  initConfig = [];//接口配置列表
17
-  config = [];//配置列表[key,value,id]
18
-  promptContent: string;//操作提示框提示信息
19
-  ifSuccess: boolean;//操作成功/失败
20
-  promptInfo: string;//操作结果提示信息
21
-  promptModalShow: boolean;//操作提示框是否展示
22
-  coopBtns = { //初始化权限
13
+  loading1 = false; //查询信息的loading
14
+  loading2 = false; //保存信息的loading
15
+  loading3 = false; //刷新字典缓存信息的loading
16
+  initConfig = []; //接口配置列表
17
+  config = []; //配置列表[key,value,id]
18
+  promptContent: string; //操作提示框提示信息
19
+  ifSuccess: boolean; //操作成功/失败
20
+  promptInfo: string; //操作结果提示信息
21
+  promptModalShow: boolean; //操作提示框是否展示
22
+  coopBtns = {
23
+    //初始化权限
23 24
     edit: false,
24 25
   };
25
-  menu = JSON.parse(localStorage.getItem('menu')) || [];//菜单
26
-  constructor(private mainService: MainService, private fb: FormBuilder, private route: ActivatedRoute) { }
26
+  menu = JSON.parse(localStorage.getItem("menu")) || []; //菜单
27
+  constructor(
28
+    private mainService: MainService,
29
+    private fb: FormBuilder,
30
+    private route: ActivatedRoute
31
+  ) {}
27 32
 
28 33
   ngOnInit() {
29 34
     this.validateForm = this.fb.group({
30 35
       defaultPwd: [null, [Validators.required]],
31 36
       effectiveDuration: [null, [Validators.required]],
32 37
       orderClearUserSwitch: [null, [Validators.required]],
33
-      formUrl: [null, [Validators.required]],
34
-      serviceUrl: [null, [Validators.required]],
35
-      cachePath: [null, [Validators.required]],
36
-      cachePort: [null, [Validators.required]],
38
+      formUrl: [{ value: null, disabled: true }, [Validators.required]],
39
+      serviceUrl: [{ value: null, disabled: true }, [Validators.required]],
40
+      cachePath: [{ value: null, disabled: true }, [Validators.required]],
41
+      cachePort: [{ value: null, disabled: true }, [Validators.required]],
42
+      busiViewDeptId: [null, [Validators.required]],
37 43
     });
38
-    this.getSysConfig();
44
+    this.getDeptType();
39 45
     this.initCoopBtns();
40 46
   }
41 47
   // 获取当前菜单权限
42 48
   initCoopBtns() {
43 49
     // 二级菜单
44
-    let secondMenus = []
45
-    this.menu.forEach(e => {
46
-      e.childrens.forEach(el => {
47
-        secondMenus.push(el)
50
+    let secondMenus = [];
51
+    this.menu.forEach((e) => {
52
+      e.childrens.forEach((el) => {
53
+        secondMenus.push(el);
48 54
       });
49 55
     });
50 56
     let link = this.route.parent.snapshot.routeConfig.path;
51
-    let btns = []
52
-    secondMenus.forEach(e => {
57
+    let btns = [];
58
+    secondMenus.forEach((e) => {
53 59
       if (e.link == link) {
54 60
         btns = e.childrens || [];
55 61
       }
56 62
     });
57
-    btns.forEach(e => {
63
+    btns.forEach((e) => {
58 64
       this.coopBtns[e.link] = true;
59
-    })
65
+    });
60 66
   }
61 67
   // 刷新字典缓存
62
-  refresh(){
68
+  refresh() {
63 69
     this.loading3 = true;
64
-    this.mainService.refreshDic().subscribe(result => {
65
-      this.loading3 = false;
66
-      if(result.status == 200){
67
-        this.showPromptModal('刷新', true, '');
68
-      }else{
69
-        this.showPromptModal('刷新', false, '');
70
+    this.mainService.refreshDic().subscribe(
71
+      (result) => {
72
+        this.loading3 = false;
73
+        if (result.status == 200) {
74
+          this.showPromptModal("刷新", true, "");
75
+        } else {
76
+          this.showPromptModal("刷新", false, "");
77
+        }
78
+      },
79
+      (error) => {
80
+        this.loading3 = false;
81
+        this.showPromptModal("刷新", false, "");
70 82
       }
71
-    }, error => {
72
-      this.loading3 = false;
73
-      this.showPromptModal('刷新', false, '');
74
-    })
83
+    );
75 84
   }
76 85
   // 保存
77 86
   submitForm(): void {
@@ -79,73 +88,100 @@ export class SysConfigComponent implements OnInit {
79 88
       this.validateForm.controls[i].markAsDirty();
80 89
       this.validateForm.controls[i].updateValueAndValidity();
81 90
     }
82
-    let filterData = this.initConfig.filter(item => item.keyconfig === 'pwd' || item.keyconfig === 'conversationSeconds' || item.keyconfig === 'orderClearUserSwitch');
83
-    filterData.forEach(item => {
84
-      if (item.keyconfig === 'pwd') {
91
+    let filterData = this.initConfig.filter(
92
+      (item) =>
93
+        item.keyconfig === "pwd" ||
94
+        item.keyconfig === "conversationSeconds" ||
95
+        item.keyconfig === "orderClearUserSwitch" ||
96
+        item.keyconfig === "busiViewDeptId"
97
+    );
98
+    filterData.forEach((item) => {
99
+      if (item.keyconfig === "pwd") {
85 100
         item.valueconfig = this.validateForm.controls.defaultPwd.value;
86
-      } else if (item.keyconfig === 'conversationSeconds') {
101
+      } else if (item.keyconfig === "conversationSeconds") {
87 102
         item.valueconfig = this.validateForm.controls.effectiveDuration.value;
88
-      } else if (item.keyconfig === 'orderClearUserSwitch') {
89
-        item.valueconfig = this.validateForm.controls.orderClearUserSwitch.value;
103
+      } else if (item.keyconfig === "orderClearUserSwitch") {
104
+        item.valueconfig =
105
+          this.validateForm.controls.orderClearUserSwitch.value;
106
+      } else if (item.keyconfig === "busiViewDeptId") {
107
+        item.valueconfig = this.validateForm.controls.busiViewDeptId.value;
90 108
       }
91
-    })
109
+    });
92 110
     const postData = filterData;
93 111
     this.loading2 = true;
94
-    this.mainService.changeSysConfig(postData).subscribe(result => {
95
-      this.loading2 = false;
96
-      if (result['status'] == 200) {
97
-        this.showPromptModal('保存', true, '');
98
-      } else {
99
-        this.showPromptModal('保存', false, '');
112
+    this.mainService.changeSysConfig(postData).subscribe(
113
+      (result) => {
114
+        this.loading2 = false;
115
+        if (result["status"] == 200) {
116
+          this.showPromptModal("保存", true, "");
117
+        } else {
118
+          this.showPromptModal("保存", false, "");
119
+        }
120
+      },
121
+      (error) => {
122
+        this.loading2 = false;
123
+        this.showPromptModal("保存", false, "");
100 124
       }
101
-    }, error => {
102
-      this.loading2 = false;
103
-      this.showPromptModal('保存', false, '');
104
-    })
125
+    );
126
+  }
127
+  // 获取科室类型
128
+  deptTypes: any = [];
129
+  getDeptType() {
130
+    this.loading1 = true;
131
+    this.mainService.getDictionary("list", "dept_type").subscribe((result) => {
132
+      this.deptTypes = result;
133
+      this.getSysConfig();
134
+    });
105 135
   }
106 136
   // 获取系统配置
107 137
   getSysConfig() {
108
-    const postData = { "idx": 0, "sum": 99 };
109
-    this.loading1 = true;
110
-    this.mainService.getFetchDataList('simple/data', 'systemConfiguration', postData).subscribe(result => {
111
-      this.loading1 = false;
112
-      if (result.status == 200) {
113
-        if (result.list && Array.isArray(result.list)) {
114
-          this.initConfig = JSON.parse(JSON.stringify(result.list));
115
-          this.config = result.list.map(item => {
116
-            return [item.keyconfig, item.valueconfig, item.id, item.label];
117
-          })
118
-          this.config.forEach(c => {
119
-            switch (c[0]) {
120
-              case 'pwd':
121
-                this.validateForm.controls.defaultPwd.setValue(c[1]);
122
-                break;
123
-              case 'conversationSeconds':
124
-                this.validateForm.controls.effectiveDuration.setValue(c[1]);
125
-                break;
126
-              case 'orderClearUserSwitch':
127
-                this.validateForm.controls.orderClearUserSwitch.setValue(c[1]);
128
-                break;
129
-              case 'formUri':
130
-                this.validateForm.controls.formUrl.setValue(c[1]);
131
-                break;
132
-              case 'serviceUrl':
133
-                this.validateForm.controls.serviceUrl.setValue(c[1]);
134
-                break;
135
-              case 'userRedisIp':
136
-                this.validateForm.controls.cachePath.setValue(c[1]);
137
-                break;
138
-              case 'userRedisPort':
139
-                this.validateForm.controls.cachePort.setValue(c[1]);
140
-                break;
141
-            }
142
-          })
143
-        } else {
144
-          this.initConfig = [];
145
-          this.config = [];
138
+    const postData = { idx: 0, sum: 99 };
139
+    this.mainService
140
+      .getFetchDataList("simple/data", "systemConfiguration", postData)
141
+      .subscribe((result) => {
142
+        this.loading1 = false;
143
+        if (result.status == 200) {
144
+          if (result.list && Array.isArray(result.list)) {
145
+            this.initConfig = JSON.parse(JSON.stringify(result.list));
146
+            this.config = result.list.map((item) => {
147
+              return [item.keyconfig, item.valueconfig, item.id, item.label];
148
+            });
149
+            this.config.forEach((c) => {
150
+              switch (c[0]) {
151
+                case "pwd":
152
+                  this.validateForm.controls.defaultPwd.setValue(c[1]);
153
+                  break;
154
+                case "conversationSeconds":
155
+                  this.validateForm.controls.effectiveDuration.setValue(c[1]);
156
+                  break;
157
+                case "orderClearUserSwitch":
158
+                  this.validateForm.controls.orderClearUserSwitch.setValue(
159
+                    c[1]
160
+                  );
161
+                  break;
162
+                case "formUri":
163
+                  this.validateForm.controls.formUrl.setValue(c[1]);
164
+                  break;
165
+                case "serviceUrl":
166
+                  this.validateForm.controls.serviceUrl.setValue(c[1]);
167
+                  break;
168
+                case "userRedisIp":
169
+                  this.validateForm.controls.cachePath.setValue(c[1]);
170
+                  break;
171
+                case "userRedisPort":
172
+                  this.validateForm.controls.cachePort.setValue(c[1]);
173
+                  break;
174
+                case "busiViewDeptId":
175
+                  this.validateForm.controls.busiViewDeptId.setValue(c[1]+'');
176
+                  break;
177
+              }
178
+            });
179
+          } else {
180
+            this.initConfig = [];
181
+            this.config = [];
182
+          }
146 183
         }
147
-      }
148
-    })
184
+      });
149 185
   }
150 186
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
151 187
   showPromptModal(con, success, promptInfo) {
@@ -156,7 +192,6 @@ export class SysConfigComponent implements OnInit {
156 192
     setTimeout(() => {
157 193
       this.promptModalShow = true;
158 194
     }, 100);
159
-    this.getSysConfig();
195
+    this.getDeptType();
160 196
   }
161 197
 }
162
-