浏览代码

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

seimin 3 年之前
父节点
当前提交
6d7e060b47

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

@@ -24,43 +24,37 @@ export class ToolService {
24
   }
24
   }
25
   //获取当前菜单的权限
25
   //获取当前菜单的权限
26
   initCoopBtns(route) {
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
     this.menu.forEach((e) => {
31
     this.menu.forEach((e) => {
37
       e.childrens.forEach((el) => {
32
       e.childrens.forEach((el) => {
38
         secondMenus.push(el);
33
         secondMenus.push(el);
39
       });
34
       });
40
     });
35
     });
41
-    let link = route.parent.snapshot.routeConfig.path;
42
-    let btns = [];
43
     secondMenus.forEach((e) => {
36
     secondMenus.forEach((e) => {
44
       if (e.link == link) {
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
       switch (e.link) {
42
       switch (e.link) {
50
         case "look":
43
         case "look":
51
-          coopBtns.look = true;
44
+          coopBtns.look = true; //查看
52
           break;
45
           break;
53
         case "add":
46
         case "add":
54
-          coopBtns.add = true;
47
+          coopBtns.add = true; //新增
55
           break;
48
           break;
56
         case "edit":
49
         case "edit":
57
-          coopBtns.edit = true;
50
+          coopBtns.edit = true; //编辑
58
           break;
51
           break;
59
         case "del":
52
         case "del":
60
-          coopBtns.del = true;
53
+          coopBtns.del = true; //删除
61
           break;
54
           break;
62
       }
55
       }
63
     });
56
     });
57
+    console.log(coopBtns);
64
     return coopBtns;
58
     return coopBtns;
65
   }
59
   }
66
 }
60
 }

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

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

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

@@ -266,7 +266,9 @@
266
             <div nz-col nzSpan="6" *ngIf="orderInfo.urgentDetails">加急状态:{{orderInfo.urgentDetails.checkStatus.name}}
266
             <div nz-col nzSpan="6" *ngIf="orderInfo.urgentDetails">加急状态:{{orderInfo.urgentDetails.checkStatus.name}}
267
             </div>
267
             </div>
268
             <div nz-col nzSpan="6" *ngIf="orderInfo.drugs">
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
           </div>
272
           </div>
271
           <div class="info" nz-row *ngIf="orderInfo.urgentDetails">
273
           <div class="info" nz-row *ngIf="orderInfo.urgentDetails">
272
             <div nz-col nzSpan="24" class="jiaji">加急原因:{{orderInfo.urgentDetails.urgentReason}}</div>
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
       <div *ngIf="coopBtns.edit" class="edit item" (click)="showCoopModal('edit')">编辑</div>
6
       <div *ngIf="coopBtns.edit" class="edit item" (click)="showCoopModal('edit')">编辑</div>
7
       <div *ngIf="coopBtns.del" class="del item" (click)="showDelModal()">删除</div>
7
       <div *ngIf="coopBtns.del" class="del item" (click)="showDelModal()">删除</div>
8
     </div>
8
     </div>
9
-    <div class="groups" [ngStyle]="{display:!loading1?'block':'none'}">
9
+    <div class="groups" [ngStyle]="{display:!buildingsLoading?'block':'none'}">
10
       <overlay-scrollbars #osComponentRef1 [ngStyle]="{ height:'100%' }">
10
       <overlay-scrollbars #osComponentRef1 [ngStyle]="{ height:'100%' }">
11
         <div [ngClass]="{'item':true,'checked':data.id==checkedBuilding.id}" *ngFor="let data of buildingList"
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
       </overlay-scrollbars>
13
       </overlay-scrollbars>
14
     </div>
14
     </div>
15
-    <div class="groups" *ngIf="loading1">
15
+    <div class="groups" *ngIf="buildingsLoading">
16
       <div class="loadingFull display_flex justify-content_flex-center align-items_center">
16
       <div class="loadingFull display_flex justify-content_flex-center align-items_center">
17
         <div class="loadingFullInner">
17
         <div class="loadingFullInner">
18
           <img src="../../../assets/images/loading.gif" alt="">
18
           <img src="../../../assets/images/loading.gif" alt="">
@@ -24,18 +24,17 @@
24
   <div class="userInfo">
24
   <div class="userInfo">
25
     <div class="top display_flex justify-content_flex-end align-items_center">
25
     <div class="top display_flex justify-content_flex-end align-items_center">
26
       <div class="display_flex align-items_center">
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
           (click)="showFloorModal($event,'add')">新增</button>
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
           (click)="showDelFloorModal($event)">批量删除</button>
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
       </div>
33
       </div>
35
     </div>
34
     </div>
36
-    <div class="table" *ngIf="!loading1">
35
+    <div class="table" *ngIf="!buildingsLoading">
37
       <nz-table class="groupManagementTable" #rowSelectionTable [nzPageSize]="9999" [nzData]="allFloorList"
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
         <tbody>
38
         <tbody>
40
           <tr *ngFor="let data of rowSelectionTable.data" (click)="selectedUser(data)">
39
           <tr *ngFor="let data of rowSelectionTable.data" (click)="selectedUser(data)">
41
             <td style="width:5%" nzShowCheckbox [(nzDisabled)]="!coopBtns.edit" [(nzChecked)]="mapOfCheckedId[data.id]"
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
 import { Component, OnInit, ViewChild } from "@angular/core";
1
 import { Component, OnInit, ViewChild } from "@angular/core";
2
 import { ActivatedRoute } from "@angular/router";
2
 import { ActivatedRoute } from "@angular/router";
3
 import { FormBuilder, Validators, FormGroup } from "@angular/forms";
3
 import { FormBuilder, Validators, FormGroup } from "@angular/forms";
4
-import { NzMessageService } from "ng-zorro-antd/message";
5
 
4
 
6
 import { MainService } from "../../services/main.service";
5
 import { MainService } from "../../services/main.service";
7
 import { OverlayScrollbarsComponent } from "overlayscrollbars-ngx";
6
 import { OverlayScrollbarsComponent } from "overlayscrollbars-ngx";
@@ -15,14 +14,40 @@ import { GenerateFloorComponent } from "src/app/share/generate-floor/generate-fl
15
 })
14
 })
16
 export class BuildingFloorComponent implements OnInit {
15
 export class BuildingFloorComponent implements OnInit {
17
   tableHeight;
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
   constructor(
44
   constructor(
20
     private fb: FormBuilder,
45
     private fb: FormBuilder,
21
     private route: ActivatedRoute,
46
     private route: ActivatedRoute,
22
     private mainService: MainService,
47
     private mainService: MainService,
23
-    private msg: NzMessageService,
24
     private tool: ToolService
48
     private tool: ToolService
25
   ) {}
49
   ) {}
50
+
26
   @ViewChild("osComponentRef1", {
51
   @ViewChild("osComponentRef1", {
27
     read: OverlayScrollbarsComponent,
52
     read: OverlayScrollbarsComponent,
28
     static: false,
53
     static: false,
@@ -30,67 +55,42 @@ export class BuildingFloorComponent implements OnInit {
30
   osComponentRef1: OverlayScrollbarsComponent;
55
   osComponentRef1: OverlayScrollbarsComponent;
31
   @ViewChild(GenerateFloorComponent, { static: false })
56
   @ViewChild(GenerateFloorComponent, { static: false })
32
   generate1: GenerateFloorComponent;
57
   generate1: GenerateFloorComponent;
58
+
33
   ngOnInit() {
59
   ngOnInit() {
34
     this.coopBtns = this.tool.initCoopBtns(this.route);
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
     this.getBuildingList();
62
     this.getBuildingList();
40
     this.tableHeight = document.body.clientHeight - 267;
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
   getBuildingList() {
67
   getBuildingList() {
66
     let postData = {
68
     let postData = {
67
       idx: 0,
69
       idx: 0,
68
       sum: 9999,
70
       sum: 9999,
69
       building: { hosId: this.hosId },
71
       building: { hosId: this.hosId },
70
     };
72
     };
71
-    this.loading1 = true;
73
+    this.buildingsLoading = true;
72
     this.mainService
74
     this.mainService
73
       .getFetchDataList("simple/data", "building", postData)
75
       .getFetchDataList("simple/data", "building", postData)
74
       .subscribe((result) => {
76
       .subscribe((result) => {
75
-        this.loading1 = false;
77
+        this.buildingsLoading = false;
76
         if (result.status == 200) {
78
         if (result.status == 200) {
77
           this.buildingList = result.list;
79
           this.buildingList = result.list;
78
           if (Object.keys(this.checkedBuilding).length) {
80
           if (Object.keys(this.checkedBuilding).length) {
79
             result.list.forEach((item) => {
81
             result.list.forEach((item) => {
80
               if (item.id == this.checkedBuilding.id) {
82
               if (item.id == this.checkedBuilding.id) {
81
-                this.checkGroup(item);
83
+                this.checkBuilding(item);
82
               }
84
               }
83
             });
85
             });
84
           } else {
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
   getAllFloor() {
94
   getAllFloor() {
95
     // 初始化的时候搜索一次,然后前端过滤
95
     // 初始化的时候搜索一次,然后前端过滤
96
     let postData = {
96
     let postData = {
@@ -98,83 +98,75 @@ export class BuildingFloorComponent implements OnInit {
98
       sum: 9999,
98
       sum: 9999,
99
       floor: { hosId: this.hosId, buildId: this.checkedBuilding.id },
99
       floor: { hosId: this.hosId, buildId: this.checkedBuilding.id },
100
     };
100
     };
101
-    this.loading2 = true;
101
+    this.floorsLoading = true;
102
     this.mainService
102
     this.mainService
103
       .getFetchDataList("simple/data", "floor", postData)
103
       .getFetchDataList("simple/data", "floor", postData)
104
       .subscribe((result) => {
104
       .subscribe((result) => {
105
-        this.loading2 = false;
105
+        this.floorsLoading = false;
106
         if (result.status == 200) {
106
         if (result.status == 200) {
107
           this.allFloorList = result.list;
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
     this.positionY = this.osComponentRef1.osInstance().scroll().position.y; //内容滚动的距离
115
     this.positionY = this.osComponentRef1.osInstance().scroll().position.y; //内容滚动的距离
123
     this.checkedBuilding = data;
116
     this.checkedBuilding = data;
124
     this.mapOfCheckedId = {};
117
     this.mapOfCheckedId = {};
125
     this.getAllFloor();
118
     this.getAllFloor();
126
   }
119
   }
120
+
127
   selectedUser(data) {
121
   selectedUser(data) {
128
     this.mapOfCheckedId[data.id] = !this.mapOfCheckedId[data.id];
122
     this.mapOfCheckedId[data.id] = !this.mapOfCheckedId[data.id];
129
     this.refreshStatus();
123
     this.refreshStatus();
130
   }
124
   }
131
-  // 选中列表中当前分组用户
132
-  usersArr = [];
133
-  refreshStatus(first?): void {
125
+  // 选中列表中楼层
126
+  refreshStatus(): void {
134
     let arr = [];
127
     let arr = [];
135
     for (var m in this.mapOfCheckedId) {
128
     for (var m in this.mapOfCheckedId) {
136
       if (this.mapOfCheckedId[m]) {
129
       if (this.mapOfCheckedId[m]) {
137
         arr.push({ id: m });
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
   showCoopModal(type) {
137
   showCoopModal(type) {
147
     this.coopModal = true;
138
     this.coopModal = true;
148
     this.add = type == "add";
139
     this.add = type == "add";
149
     if (type == "edit") {
140
     if (type == "edit") {
141
+      this.initForm();
150
       this.validateForm.controls.buildingName.setValue(
142
       this.validateForm.controls.buildingName.setValue(
151
         this.checkedBuilding["buildingName"]
143
         this.checkedBuilding["buildingName"]
152
       );
144
       );
153
     } else {
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
   showFloorModal(e, type, data?) {
151
   showFloorModal(e, type, data?) {
162
     this.floorModal = true;
152
     this.floorModal = true;
163
     this.addFloor = type == "add";
153
     this.addFloor = type == "add";
164
     if (type == "edit") {
154
     if (type == "edit") {
155
+      this.initFormFloor();
165
       this.floorDataEdit = data;
156
       this.floorDataEdit = data;
166
       this.validateFloorForm.controls.buildId.setValue(data.buildId);
157
       this.validateFloorForm.controls.buildId.setValue(data.buildId);
167
       this.validateFloorForm.controls.floorName.setValue(data.floorName);
158
       this.validateFloorForm.controls.floorName.setValue(data.floorName);
168
     } else {
159
     } else {
169
-      this.validateFloorForm.controls.buildId.setValue(this.checkedBuilding.id);
170
-      this.validateFloorForm.controls.floorName.setValue(null);
160
+      this.initFormFloor();
171
     }
161
     }
172
     e.stopPropagation();
162
     e.stopPropagation();
173
   }
163
   }
164
+
174
   // 隐藏楼栋模态框
165
   // 隐藏楼栋模态框
175
   hideCoopModal() {
166
   hideCoopModal() {
176
     this.coopModal = false;
167
     this.coopModal = false;
177
   }
168
   }
169
+
178
   // 隐藏楼层模态框
170
   // 隐藏楼层模态框
179
   hideFloorModal() {
171
   hideFloorModal() {
180
     this.floorModal = false;
172
     this.floorModal = false;
@@ -186,17 +178,16 @@ export class BuildingFloorComponent implements OnInit {
186
       buildingName: [null, [Validators.required]],
178
       buildingName: [null, [Validators.required]],
187
     });
179
     });
188
   }
180
   }
181
+
189
   // 初始化新增form表单floor
182
   // 初始化新增form表单floor
190
-  validateFloorForm: FormGroup;
191
   initFormFloor() {
183
   initFormFloor() {
192
     this.validateFloorForm = this.fb.group({
184
     this.validateFloorForm = this.fb.group({
193
-      buildId: [null, [Validators.required]],
185
+      buildId: [this.checkedBuilding.id, [Validators.required]],
194
       floorName: [null, [Validators.required]],
186
       floorName: [null, [Validators.required]],
195
     });
187
     });
196
   }
188
   }
197
 
189
 
198
   // 新增/编辑楼栋提交
190
   // 新增/编辑楼栋提交
199
-  validateForm: FormGroup;
200
   submitForm(): void {
191
   submitForm(): void {
201
     for (const i in this.validateForm.controls) {
192
     for (const i in this.validateForm.controls) {
202
       this.validateForm.controls[i].markAsDirty();
193
       this.validateForm.controls[i].markAsDirty();
@@ -205,20 +196,20 @@ export class BuildingFloorComponent implements OnInit {
205
     if (this.validateForm.invalid) return;
196
     if (this.validateForm.invalid) return;
206
     this.btnLoading = true;
197
     this.btnLoading = true;
207
     let postData;
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
       postData = {
213
       postData = {
223
         buildingName: this.validateForm.value.buildingName,
214
         buildingName: this.validateForm.value.buildingName,
224
         deleted: false,
215
         deleted: false,
@@ -248,6 +239,7 @@ export class BuildingFloorComponent implements OnInit {
248
         }
239
         }
249
       });
240
       });
250
   }
241
   }
242
+
251
   // 新增/编辑楼层提交
243
   // 新增/编辑楼层提交
252
   submitFormFloor(): void {
244
   submitFormFloor(): void {
253
     for (const i in this.validateFloorForm.controls) {
245
     for (const i in this.validateFloorForm.controls) {
@@ -257,20 +249,20 @@ export class BuildingFloorComponent implements OnInit {
257
     if (this.validateFloorForm.invalid) return;
249
     if (this.validateFloorForm.invalid) return;
258
     this.btnLoading = true;
250
     this.btnLoading = true;
259
     let postData;
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
       postData = {
266
       postData = {
275
         buildId: this.validateFloorForm.value.buildId,
267
         buildId: this.validateFloorForm.value.buildId,
276
         floorName: this.validateFloorForm.value.floorName,
268
         floorName: this.validateFloorForm.value.floorName,
@@ -288,13 +280,14 @@ export class BuildingFloorComponent implements OnInit {
288
     }
280
     }
289
     this.addFloorHandler(postData, false);
281
     this.addFloorHandler(postData, false);
290
   }
282
   }
283
+
291
   //新增楼层
284
   //新增楼层
292
   addFloorHandler(postData, flag) {
285
   addFloorHandler(postData, flag) {
293
     this.mainService
286
     this.mainService
294
       .simplePost(flag ? "addListData" : "addData", "floor", postData)
287
       .simplePost(flag ? "addListData" : "addData", "floor", postData)
295
       .subscribe((result) => {
288
       .subscribe((result) => {
296
         this.hideFloorModal();
289
         this.hideFloorModal();
297
-        this.generate1.delModal = false;
290
+        this.generate1 && (this.generate1.delModal = false);
298
         this.hideGenerateModal();
291
         this.hideGenerateModal();
299
         this.btnLoading = false;
292
         this.btnLoading = false;
300
         if (result["status"] == 200) {
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
   showDelModal() {
306
   showDelModal() {
315
     this.delModal = true;
307
     this.delModal = true;
316
   }
308
   }
@@ -336,8 +328,6 @@ export class BuildingFloorComponent implements OnInit {
336
    * @param e 事件对象
328
    * @param e 事件对象
337
    * @param data 有值就是单个删除,无值就是批量删除
329
    * @param data 有值就是单个删除,无值就是批量删除
338
    */
330
    */
339
-  delFloorModal: boolean = false;
340
-  isDelSingle: boolean = false; //是否单个删除
341
   showDelFloorModal(e, data?) {
331
   showDelFloorModal(e, data?) {
342
     if (data) {
332
     if (data) {
343
       this.isDelSingle = true;
333
       this.isDelSingle = true;
@@ -354,8 +344,9 @@ export class BuildingFloorComponent implements OnInit {
354
   // 确认删除
344
   // 确认删除
355
   confirmFloorDel() {
345
   confirmFloorDel() {
356
     this.btnLoading = true;
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
     this.mainService.delFloorList(postData).subscribe((result) => {
350
     this.mainService.delFloorList(postData).subscribe((result) => {
360
       this.hideDelFloorModal();
351
       this.hideDelFloorModal();
361
       this.btnLoading = false;
352
       this.btnLoading = false;
@@ -374,13 +365,18 @@ export class BuildingFloorComponent implements OnInit {
374
     this.ifSuccess = success;
365
     this.ifSuccess = success;
375
     this.promptInfo = promptInfo;
366
     this.promptInfo = promptInfo;
376
     this.osComponentRef1.osInstance().scroll({ x: 0, y: this.positionY });
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
   generate() {
380
   generate() {
385
     this.generateModal = true;
381
     this.generateModal = true;
386
   }
382
   }