Просмотр исходного кода

药品和静配工单需要显示药包编码

seimin лет назад: 3
Родитель
Сommit
6d7e060b47

+ 11 - 17
src/app/services/tool.service.ts

@@ -24,43 +24,37 @@ export class ToolService {
24 24
   }
25 25
   //获取当前菜单的权限
26 26
   initCoopBtns(route) {
27
-    // 二级菜单
28
-    let secondMenus = [];
29
-    // 初始化增删改权限
30
-    let coopBtns: any = {
31
-      look: false,
32
-      add: false,
33
-      edit: false,
34
-      del: false,
35
-    };
27
+    let link = route.parent.snapshot.routeConfig.path; //当前路由
28
+    let secondMenus = []; // 二级菜单
29
+    let jurisdiction = []; //当前菜单的权限列表
30
+    let coopBtns: any = {}; // 初始化权限
36 31
     this.menu.forEach((e) => {
37 32
       e.childrens.forEach((el) => {
38 33
         secondMenus.push(el);
39 34
       });
40 35
     });
41
-    let link = route.parent.snapshot.routeConfig.path;
42
-    let btns = [];
43 36
     secondMenus.forEach((e) => {
44 37
       if (e.link == link) {
45
-        btns = e.childrens || [];
38
+        jurisdiction = e.childrens || []; //匹配路由后,取得对应的权限
46 39
       }
47 40
     });
48
-    btns.forEach((e) => {
41
+    jurisdiction.forEach((e) => {
49 42
       switch (e.link) {
50 43
         case "look":
51
-          coopBtns.look = true;
44
+          coopBtns.look = true; //查看
52 45
           break;
53 46
         case "add":
54
-          coopBtns.add = true;
47
+          coopBtns.add = true; //新增
55 48
           break;
56 49
         case "edit":
57
-          coopBtns.edit = true;
50
+          coopBtns.edit = true; //编辑
58 51
           break;
59 52
         case "del":
60
-          coopBtns.del = true;
53
+          coopBtns.del = true; //删除
61 54
           break;
62 55
       }
63 56
     });
57
+    console.log(coopBtns);
64 58
     return coopBtns;
65 59
   }
66 60
 }

+ 2 - 0
src/app/share/detail-drug/detail-drug.component.html

@@ -14,6 +14,8 @@
14 14
         <div nz-col nzSpan="8">申请科室:{{orderInfo.createDeptDTO?orderInfo.createDeptDTO.dept:''}}</div>
15 15
         <div nz-col nzSpan="8">目标科室:{{(orderInfo.endDepts&&orderInfo.endDepts[0])?orderInfo.endDepts[0].dept:''}}</div>
16 16
         <div nz-col nzSpan="8" *ngIf="orderInfo.worker">支助人员信息:{{orderInfo.worker.name}}</div>
17
+        <div nz-col nzSpan="8" *ngIf="orderInfo.drugs">药包编码:{{orderInfo.drugs.packid}}</div>
18
+        <div nz-col nzSpan="8" *ngIf="orderInfo.staticDistri">药包编码:{{orderInfo.staticDistri.packid}}</div>
17 19
         <div nz-col nzSpan="24" *ngIf="orderInfo.specialCloseReason">
18 20
           特殊情况关闭原因:{{orderInfo.specialCloseReason}}
19 21
         </div>

+ 3 - 1
src/app/share/order-detail/order-detail.component.html

@@ -266,7 +266,9 @@
266 266
             <div nz-col nzSpan="6" *ngIf="orderInfo.urgentDetails">加急状态:{{orderInfo.urgentDetails.checkStatus.name}}
267 267
             </div>
268 268
             <div nz-col nzSpan="6" *ngIf="orderInfo.drugs">
269
-              药包编码:{{orderInfo.drugs.batchNo}}</div>
269
+              药包编码:{{orderInfo.drugs.packid}}</div>
270
+            <div nz-col nzSpan="6" *ngIf="orderInfo.staticDistri">
271
+              药包编码:{{orderInfo.staticDistri.packid}}</div>
270 272
           </div>
271 273
           <div class="info" nz-row *ngIf="orderInfo.urgentDetails">
272 274
             <div nz-col nzSpan="24" class="jiaji">加急原因:{{orderInfo.urgentDetails.urgentReason}}</div>

+ 9 - 10
src/app/views/building-floor/building-floor.component.html

@@ -6,13 +6,13 @@
6 6
       <div *ngIf="coopBtns.edit" class="edit item" (click)="showCoopModal('edit')">编辑</div>
7 7
       <div *ngIf="coopBtns.del" class="del item" (click)="showDelModal()">删除</div>
8 8
     </div>
9
-    <div class="groups" [ngStyle]="{display:!loading1?'block':'none'}">
9
+    <div class="groups" [ngStyle]="{display:!buildingsLoading?'block':'none'}">
10 10
       <overlay-scrollbars #osComponentRef1 [ngStyle]="{ height:'100%' }">
11 11
         <div [ngClass]="{'item':true,'checked':data.id==checkedBuilding.id}" *ngFor="let data of buildingList"
12
-          (click)="checkGroup(data)" [title]="data.buildingName">{{data.buildingName}}</div>
12
+          (click)="checkBuilding(data)" [title]="data.buildingName">{{data.buildingName}}</div>
13 13
       </overlay-scrollbars>
14 14
     </div>
15
-    <div class="groups" *ngIf="loading1">
15
+    <div class="groups" *ngIf="buildingsLoading">
16 16
       <div class="loadingFull display_flex justify-content_flex-center align-items_center">
17 17
         <div class="loadingFullInner">
18 18
           <img src="../../../assets/images/loading.gif" alt="">
@@ -24,18 +24,17 @@
24 24
   <div class="userInfo">
25 25
     <div class="top display_flex justify-content_flex-end align-items_center">
26 26
       <div class="display_flex align-items_center">
27
-        <span>已选择 {{usersArr.length}} 个楼层</span>
28
-        <button class="btn default" *ngIf="coopBtns.add" nzType="primary" nz-button [nzLoading]="saveLoading"
27
+        <span>已选择 {{selectedFloor.length}} 个楼层</span>
28
+        <button class="btn default" *ngIf="coopBtns.add" nzType="primary" nz-button
29 29
           (click)="showFloorModal($event,'add')">新增</button>
30
-        <button class="btn default" *ngIf="coopBtns.del" nzType="primary" nz-button [nzLoading]="saveLoading"
30
+        <button class="btn default" *ngIf="coopBtns.del" nzType="primary" nz-button
31 31
           (click)="showDelFloorModal($event)">批量删除</button>
32
-        <button class="btn default" *ngIf="coopBtns.add" nzType="primary" nz-button [nzLoading]="saveLoading"
33
-          (click)="generate()">生成楼层</button>
32
+        <button class="btn default" *ngIf="coopBtns.add" nzType="primary" nz-button (click)="generate()">生成楼层</button>
34 33
       </div>
35 34
     </div>
36
-    <div class="table" *ngIf="!loading1">
35
+    <div class="table" *ngIf="!buildingsLoading">
37 36
       <nz-table class="groupManagementTable" #rowSelectionTable [nzPageSize]="9999" [nzData]="allFloorList"
38
-        [nzShowPagination]="false" #fixedTable [nzScroll]="{ y: tableHeight+'px' }" [nzLoading]="loading2">
37
+        [nzShowPagination]="false" [nzScroll]="{ y: tableHeight+'px' }" [nzLoading]="floorsLoading">
39 38
         <tbody>
40 39
           <tr *ngFor="let data of rowSelectionTable.data" (click)="selectedUser(data)">
41 40
             <td style="width:5%" nzShowCheckbox [(nzDisabled)]="!coopBtns.edit" [(nzChecked)]="mapOfCheckedId[data.id]"

+ 94 - 98
src/app/views/building-floor/building-floor.component.ts

@@ -1,7 +1,6 @@
1 1
 import { Component, OnInit, ViewChild } from "@angular/core";
2 2
 import { ActivatedRoute } from "@angular/router";
3 3
 import { FormBuilder, Validators, FormGroup } from "@angular/forms";
4
-import { NzMessageService } from "ng-zorro-antd/message";
5 4
 
6 5
 import { MainService } from "../../services/main.service";
7 6
 import { OverlayScrollbarsComponent } from "overlayscrollbars-ngx";
@@ -15,14 +14,40 @@ import { GenerateFloorComponent } from "src/app/share/generate-floor/generate-fl
15 14
 })
16 15
 export class BuildingFloorComponent implements OnInit {
17 16
   tableHeight;
17
+  validateForm: FormGroup;
18
+  validateFloorForm: FormGroup;
19
+  allFloorList: any[] = []; //当前选中的楼栋包含的所有楼层
20
+  mapOfCheckedId: { [key: string]: boolean } = {};
21
+  checkedBuilding: any = {}; //选中楼栋
22
+  buildingList: Array<any> = []; //楼栋信息
23
+  hosId: any; //当前选择的院区id
24
+  promptContent: string; //操作提示框提示信息
25
+  ifSuccess: boolean; //操作成功/失败
26
+  promptInfo: string; //操作结果提示信息
27
+  promptModalShow: boolean; //是否展示提示框
28
+  btnLoading: boolean = false; //确认按钮loading状态
29
+  coopBtns: any = {}; // 初始化增删改按钮
30
+  buildingsLoading = false; //获取楼栋列表的loading
31
+  floorsLoading = false; //获取楼层列表的loading
32
+  positionY = 0; //记录Y轴滚动距离
33
+  selectedFloor = []; //选中的楼层
34
+  coopModal: boolean = false; //楼栋模态框是否展示
35
+  add: boolean = true; //楼栋新增的标识,true:新增;false:编辑
36
+  floorModal: boolean = false; //楼层模态框是否展示
37
+  addFloor: boolean = true; //楼层,true:新增;false:编辑
38
+  floorDataEdit; //正在编辑的楼层
39
+  delModal: boolean = false; //删除楼栋,模态框是否显示
40
+  delFloorModal: boolean = false; //删除楼层,模态框是否显示
41
+  isDelSingle: boolean = false; //是否单个删除楼层
42
+  generateModal: boolean = false; //生成楼层的模态框
18 43
 
19 44
   constructor(
20 45
     private fb: FormBuilder,
21 46
     private route: ActivatedRoute,
22 47
     private mainService: MainService,
23
-    private msg: NzMessageService,
24 48
     private tool: ToolService
25 49
   ) {}
50
+
26 51
   @ViewChild("osComponentRef1", {
27 52
     read: OverlayScrollbarsComponent,
28 53
     static: false,
@@ -30,67 +55,42 @@ export class BuildingFloorComponent implements OnInit {
30 55
   osComponentRef1: OverlayScrollbarsComponent;
31 56
   @ViewChild(GenerateFloorComponent, { static: false })
32 57
   generate1: GenerateFloorComponent;
58
+
33 59
   ngOnInit() {
34 60
     this.coopBtns = this.tool.initCoopBtns(this.route);
35
-    console.log(this.coopBtns);
36
-    this.initForm();
37
-    this.initFormFloor();
38
-    this.getHospitalList();
61
+    this.hosId = this.tool.getCurrentHospital().id;
39 62
     this.getBuildingList();
40 63
     this.tableHeight = document.body.clientHeight - 267;
41 64
   }
42
-  isAllDisplayDataChecked = false;
43
-  isIndeterminate = false;
44
-  listOfDisplayData: any[] = [];
45
-  allFloorList: any[] = []; //当前选中的楼栋包含的所有楼层
46
-  mapOfCheckedId: { [key: string]: boolean } = {};
47
-  checkedBuilding: any = {}; //选中楼栋
48
-  buildingList: Array<any> = []; //楼栋信息
49
-  hospitalList: Array<any> = []; //院区列表
50
-  hosId: any; //当前选择的院区id
51
-
52
-  promptContent: string; //操作提示框提示信息
53
-  ifSuccess: boolean; //操作成功/失败
54
-  promptInfo: string; //操作结果提示信息
55
-  promptModalShow: boolean; //是否展示提示框
56
-
57
-  btnLoading: boolean = false; //确认按钮loading状态
58
-  saveLoading: boolean = false; //批量打印按钮loading状态
59 65
 
60
-  // 初始化增删改按钮
61
-  coopBtns: any = {};
62
-
63
-  // 分组列表
64
-  loading1 = false;
66
+  // 楼栋列表
65 67
   getBuildingList() {
66 68
     let postData = {
67 69
       idx: 0,
68 70
       sum: 9999,
69 71
       building: { hosId: this.hosId },
70 72
     };
71
-    this.loading1 = true;
73
+    this.buildingsLoading = true;
72 74
     this.mainService
73 75
       .getFetchDataList("simple/data", "building", postData)
74 76
       .subscribe((result) => {
75
-        this.loading1 = false;
77
+        this.buildingsLoading = false;
76 78
         if (result.status == 200) {
77 79
           this.buildingList = result.list;
78 80
           if (Object.keys(this.checkedBuilding).length) {
79 81
             result.list.forEach((item) => {
80 82
               if (item.id == this.checkedBuilding.id) {
81
-                this.checkGroup(item);
83
+                this.checkBuilding(item);
82 84
               }
83 85
             });
84 86
           } else {
85
-            this.checkGroup(result.list[0]);
87
+            this.checkBuilding(result.list[0]);
86 88
           }
87 89
         }
88 90
       });
89 91
   }
90 92
 
91 93
   // 获取选中楼栋下楼层列表
92
-  loading2 = false;
93
-  allUsers = [];
94 94
   getAllFloor() {
95 95
     // 初始化的时候搜索一次,然后前端过滤
96 96
     let postData = {
@@ -98,83 +98,75 @@ export class BuildingFloorComponent implements OnInit {
98 98
       sum: 9999,
99 99
       floor: { hosId: this.hosId, buildId: this.checkedBuilding.id },
100 100
     };
101
-    this.loading2 = true;
101
+    this.floorsLoading = true;
102 102
     this.mainService
103 103
       .getFetchDataList("simple/data", "floor", postData)
104 104
       .subscribe((result) => {
105
-        this.loading2 = false;
105
+        this.floorsLoading = false;
106 106
         if (result.status == 200) {
107 107
           this.allFloorList = result.list;
108
-          this.allUsers = JSON.parse(JSON.stringify(result.list));
109
-          this.refreshStatus(true);
108
+          this.refreshStatus();
110 109
         }
111 110
       });
112 111
   }
113 112
 
114
-  // 院区列表
115
-  getHospitalList() {
116
-    this.hosId = this.tool.getCurrentHospital().id;
117
-    this.hospitalList = [this.tool.getCurrentHospital()];
118
-  }
119
-  // 选中分组
120
-  positionY = 0; //记录其他建单Y轴滚动距离
121
-  checkGroup(data) {
113
+  // 选中楼栋
114
+  checkBuilding(data) {
122 115
     this.positionY = this.osComponentRef1.osInstance().scroll().position.y; //内容滚动的距离
123 116
     this.checkedBuilding = data;
124 117
     this.mapOfCheckedId = {};
125 118
     this.getAllFloor();
126 119
   }
120
+
127 121
   selectedUser(data) {
128 122
     this.mapOfCheckedId[data.id] = !this.mapOfCheckedId[data.id];
129 123
     this.refreshStatus();
130 124
   }
131
-  // 选中列表中当前分组用户
132
-  usersArr = [];
133
-  refreshStatus(first?): void {
125
+  // 选中列表中楼层
126
+  refreshStatus(): void {
134 127
     let arr = [];
135 128
     for (var m in this.mapOfCheckedId) {
136 129
       if (this.mapOfCheckedId[m]) {
137 130
         arr.push({ id: m });
138 131
       }
139 132
     }
140
-    this.usersArr = arr;
133
+    this.selectedFloor = arr;
141 134
   }
142 135
 
143 136
   // 新增/编辑楼栋模态框
144
-  coopModal: boolean = false; //模态框是否展示
145
-  add: boolean = true; //true:新增;false:编辑
146 137
   showCoopModal(type) {
147 138
     this.coopModal = true;
148 139
     this.add = type == "add";
149 140
     if (type == "edit") {
141
+      this.initForm();
150 142
       this.validateForm.controls.buildingName.setValue(
151 143
         this.checkedBuilding["buildingName"]
152 144
       );
153 145
     } else {
154
-      this.validateForm.controls.buildingName.setValue(null);
146
+      this.initForm();
155 147
     }
156 148
   }
149
+
157 150
   // 新增/编辑楼层模态框
158
-  floorModal: boolean = false; //模态框是否展示
159
-  addFloor: boolean = true; //true:新增;false:编辑
160
-  floorDataEdit; //正在编辑的楼层
161 151
   showFloorModal(e, type, data?) {
162 152
     this.floorModal = true;
163 153
     this.addFloor = type == "add";
164 154
     if (type == "edit") {
155
+      this.initFormFloor();
165 156
       this.floorDataEdit = data;
166 157
       this.validateFloorForm.controls.buildId.setValue(data.buildId);
167 158
       this.validateFloorForm.controls.floorName.setValue(data.floorName);
168 159
     } else {
169
-      this.validateFloorForm.controls.buildId.setValue(this.checkedBuilding.id);
170
-      this.validateFloorForm.controls.floorName.setValue(null);
160
+      this.initFormFloor();
171 161
     }
172 162
     e.stopPropagation();
173 163
   }
164
+
174 165
   // 隐藏楼栋模态框
175 166
   hideCoopModal() {
176 167
     this.coopModal = false;
177 168
   }
169
+
178 170
   // 隐藏楼层模态框
179 171
   hideFloorModal() {
180 172
     this.floorModal = false;
@@ -186,17 +178,16 @@ export class BuildingFloorComponent implements OnInit {
186 178
       buildingName: [null, [Validators.required]],
187 179
     });
188 180
   }
181
+
189 182
   // 初始化新增form表单floor
190
-  validateFloorForm: FormGroup;
191 183
   initFormFloor() {
192 184
     this.validateFloorForm = this.fb.group({
193
-      buildId: [null, [Validators.required]],
185
+      buildId: [this.checkedBuilding.id, [Validators.required]],
194 186
       floorName: [null, [Validators.required]],
195 187
     });
196 188
   }
197 189
 
198 190
   // 新增/编辑楼栋提交
199
-  validateForm: FormGroup;
200 191
   submitForm(): void {
201 192
     for (const i in this.validateForm.controls) {
202 193
       this.validateForm.controls[i].markAsDirty();
@@ -205,20 +196,20 @@ export class BuildingFloorComponent implements OnInit {
205 196
     if (this.validateForm.invalid) return;
206 197
     this.btnLoading = true;
207 198
     let postData;
208
-    if (this.add) {
209
-      let arr = this.buildingList.filter(
210
-        (item) => item.buildingName == this.validateForm.value.buildingName
199
+    let arr = this.buildingList.filter(
200
+      (item) => item.buildingName == this.validateForm.value.buildingName
201
+    );
202
+    //有重复名称
203
+    if (arr.length > 0) {
204
+      this.btnLoading = false;
205
+      this.showPromptModal(
206
+        "新增",
207
+        false,
208
+        `存在重复的楼栋名称【${this.validateForm.value.buildingName}】请修改后再保存!`
211 209
       );
212
-      //有重复名称
213
-      if (arr.length > 0) {
214
-        this.btnLoading = false;
215
-        this.showPromptModal(
216
-          "新增",
217
-          false,
218
-          `存在重复的楼栋名称【${this.validateForm.value.buildingName}】请修改后再保存!`
219
-        );
220
-        return;
221
-      }
210
+      return;
211
+    }
212
+    if (this.add) {
222 213
       postData = {
223 214
         buildingName: this.validateForm.value.buildingName,
224 215
         deleted: false,
@@ -248,6 +239,7 @@ export class BuildingFloorComponent implements OnInit {
248 239
         }
249 240
       });
250 241
   }
242
+
251 243
   // 新增/编辑楼层提交
252 244
   submitFormFloor(): void {
253 245
     for (const i in this.validateFloorForm.controls) {
@@ -257,20 +249,20 @@ export class BuildingFloorComponent implements OnInit {
257 249
     if (this.validateFloorForm.invalid) return;
258 250
     this.btnLoading = true;
259 251
     let postData;
260
-    if (this.addFloor) {
261
-      let arr = this.allFloorList.filter(
262
-        (item) => item.floorName == this.validateFloorForm.value.floorName
252
+    let arr = this.allFloorList.filter(
253
+      (item) => item.floorName == this.validateFloorForm.value.floorName
254
+    );
255
+    //有重复名称
256
+    if (arr.length > 0) {
257
+      this.btnLoading = false;
258
+      this.showPromptModal(
259
+        "新增",
260
+        false,
261
+        `同一个楼栋存在重复的楼层名称【${this.validateFloorForm.value.floorName}】请修改后再保存!`
263 262
       );
264
-      //有重复名称
265
-      if (arr.length > 0) {
266
-        this.btnLoading = false;
267
-        this.showPromptModal(
268
-          "新增",
269
-          false,
270
-          `同一个楼栋存在重复的楼层名称【${this.validateFloorForm.value.floorName}】请修改后再保存!`
271
-        );
272
-        return;
273
-      }
263
+      return;
264
+    }
265
+    if (this.addFloor) {
274 266
       postData = {
275 267
         buildId: this.validateFloorForm.value.buildId,
276 268
         floorName: this.validateFloorForm.value.floorName,
@@ -288,13 +280,14 @@ export class BuildingFloorComponent implements OnInit {
288 280
     }
289 281
     this.addFloorHandler(postData, false);
290 282
   }
283
+
291 284
   //新增楼层
292 285
   addFloorHandler(postData, flag) {
293 286
     this.mainService
294 287
       .simplePost(flag ? "addListData" : "addData", "floor", postData)
295 288
       .subscribe((result) => {
296 289
         this.hideFloorModal();
297
-        this.generate1.delModal = false;
290
+        this.generate1 && (this.generate1.delModal = false);
298 291
         this.hideGenerateModal();
299 292
         this.btnLoading = false;
300 293
         if (result["status"] == 200) {
@@ -310,7 +303,6 @@ export class BuildingFloorComponent implements OnInit {
310 303
   }
311 304
 
312 305
   //删除楼栋
313
-  delModal: boolean = false;
314 306
   showDelModal() {
315 307
     this.delModal = true;
316 308
   }
@@ -336,8 +328,6 @@ export class BuildingFloorComponent implements OnInit {
336 328
    * @param e 事件对象
337 329
    * @param data 有值就是单个删除,无值就是批量删除
338 330
    */
339
-  delFloorModal: boolean = false;
340
-  isDelSingle: boolean = false; //是否单个删除
341 331
   showDelFloorModal(e, data?) {
342 332
     if (data) {
343 333
       this.isDelSingle = true;
@@ -354,8 +344,9 @@ export class BuildingFloorComponent implements OnInit {
354 344
   // 确认删除
355 345
   confirmFloorDel() {
356 346
     this.btnLoading = true;
357
-    let ids = Object.keys(this.mapOfCheckedId); //批量删除选中的楼层
358
-    let postData = this.isDelSingle ? [this.floorDataEdit.id] : ids;
347
+    let postData = this.isDelSingle
348
+      ? [this.floorDataEdit.id]
349
+      : this.selectedFloor;
359 350
     this.mainService.delFloorList(postData).subscribe((result) => {
360 351
       this.hideDelFloorModal();
361 352
       this.btnLoading = false;
@@ -374,13 +365,18 @@ export class BuildingFloorComponent implements OnInit {
374 365
     this.ifSuccess = success;
375 366
     this.promptInfo = promptInfo;
376 367
     this.osComponentRef1.osInstance().scroll({ x: 0, y: this.positionY });
377
-    setTimeout(() => {
378
-      this.promptModalShow = true;
379
-      this.getBuildingList();
380
-    }, 100);
368
+    if (success) {
369
+      setTimeout(() => {
370
+        this.promptModalShow = true;
371
+        this.getBuildingList();
372
+      }, 100);
373
+    } else {
374
+      setTimeout(() => {
375
+        this.promptModalShow = true;
376
+      }, 100);
377
+    }
381 378
   }
382 379
   // 生成楼层
383
-  generateModal: boolean = false;
384 380
   generate() {
385 381
     this.generateModal = true;
386 382
   }