seimin пре 3 година
родитељ
комит
abd3c1b06a
1 измењених фајлова са 15 додато и 5 уклоњено
  1. 15 5
      src/app/views/wechat-config/wechat-config.component.ts

+ 15 - 5
src/app/views/wechat-config/wechat-config.component.ts

@@ -132,9 +132,18 @@ export class WechatConfigComponent implements OnInit {
132 132
                   this.validateForm.controls.defaultHospital.setValue(
133 133
                     config.hospital
134 134
                   );
135
-                  this.validateForm.controls.defaultDept.setValue(
136
-                    config.defaultDept
137
-                  );
135
+                  this.getDeptList(this.hosId, '',999).subscribe((result) => {
136
+                    if (result.status == 200) {
137
+                      let item1 = this.deptList.find(v=>v.id == config.defaultDept);
138
+                      if(!item1){
139
+                        let item2 = result.list.find(v=>v.id == config.defaultDept);
140
+                        this.deptList.unshift(item2);
141
+                      }
142
+                      this.validateForm.controls.defaultDept.setValue(
143
+                        config.defaultDept
144
+                      );
145
+                    }
146
+                  });
138 147
                   this.validateForm.controls.defaultGroup.setValue(
139 148
                     config.defaultGroup
140 149
                   );
@@ -195,10 +204,11 @@ export class WechatConfigComponent implements OnInit {
195 204
     });
196 205
   }
197 206
   // 获取科室列表
198
-  getDeptList(hosId, value?) {
207
+  getDeptList(hosId, value?, num?) {
208
+    let sum = num || 20;
199 209
     const postData: any = {
200 210
       idx: 0,
201
-      sum: 20,
211
+      sum,
202 212
       department: { hospital: { id: hosId } },
203 213
     };
204 214
     if (value) {