Browse Source

回收限制

seimin 1 year ago
parent
commit
a921e24fb5

+ 5 - 0
src/app/views/main/main-routing.module.ts

@@ -423,6 +423,11 @@ const routes: Routes = [
423 423
         path: "medicalWasteType",
424 424
         loadChildren: () => import("../medical-waste-type/medical-waste-type.module").then((m) => m.MedicalWasteTypeModule),
425 425
       },
426
+      // 回收限制管理
427
+      {
428
+        path: "recyclingRestriction",
429
+        loadChildren: () => import("../recycling-restriction/recycling-restriction.module").then((m) => m.RecyclingRestrictionModule),
430
+      },
426 431
     ],
427 432
   },
428 433
 ];

+ 0 - 4
src/app/views/medical-waste-type/medical-waste-type.component.html

@@ -26,7 +26,6 @@
26 26
             <td>{{ data.inventoryDays }}</td>
27 27
             <td>
28 28
               <div class="coop">
29
-                <span *ngIf="coopBtns.look" (click)="detail(data.id)">查看</span>
30 29
                 <span *ngIf="coopBtns.edit" (click)="edit(data)">修改</span>
31 30
                 <span *ngIf="coopBtns.del" (click)="del(data)">删除</span>
32 31
               </div>
@@ -102,8 +101,5 @@
102 101
 <app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
103 102
   [info]="promptInfo"></app-prompt-modal>
104 103
 
105
-<!-- 查看详情 -->
106
-<router-outlet (deactivate)="getList()"></router-outlet>
107
-
108 104
 <!-- 遮罩 -->
109 105
 <app-mask *ngIf="maskFlag"></app-mask>

+ 0 - 4
src/app/views/medical-waste-type/medical-waste-type.component.ts

@@ -211,9 +211,5 @@ export class MedicalWasteTypeComponent implements OnInit {
211 211
     this.getList();
212 212
   }
213 213
 
214
-  // 查看
215
-  detail(id) {
216
-    this.router.navigateByUrl("/main/serialNumberSetting/serialNumberSettingDetail/" + id);
217
-  }
218 214
   isLoading = false;
219 215
 }

+ 17 - 0
src/app/views/recycling-restriction/recycling-restriction-routing.module.ts

@@ -0,0 +1,17 @@
1
+import { NgModule } from '@angular/core';
2
+import { Routes, RouterModule } from '@angular/router';
3
+import { RecyclingRestrictionComponent } from './recycling-restriction.component';
4
+
5
+
6
+const routes: Routes = [
7
+  {
8
+    path: '',
9
+    component: RecyclingRestrictionComponent,
10
+  }
11
+];
12
+
13
+@NgModule({
14
+  imports: [RouterModule.forChild(routes)],
15
+  exports: [RouterModule]
16
+})
17
+export class RecyclingRestrictionRoutingModule { }

+ 112 - 0
src/app/views/recycling-restriction/recycling-restriction.component.html

@@ -0,0 +1,112 @@
1
+<div class="list-template">
2
+  <div class="list-template__content">
3
+    <div class="list-template__top" nz-row>
4
+      <div nz-col nzXl='18' class="list-template__searchBox"></div>
5
+      <div nz-col nzXl='6' class="list-template__btns">
6
+        <button nz-button *ngIf="coopBtns.add" class="btn ml8 default" (click)="showModal()">新增</button>
7
+      </div>
8
+    </div>
9
+    <div class="list-template__bottom">
10
+      <nz-table class="list-template__nzTable" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false"
11
+        [nzLoading]="loading1">
12
+        <thead>
13
+          <tr class="thead">
14
+            <th nzWidth="20%">医废类型</th>
15
+            <th nzWidth="20%">限制科室</th>
16
+            <th nzWidth="20%">最小重量(kg)</th>
17
+            <th nzWidth="20%">最大重量(kg)</th>
18
+            <th nzWidth="20%">操作</th>
19
+          </tr>
20
+        </thead>
21
+        <tbody>
22
+          <tr *ngFor="let data of listOfData;let index=index;">
23
+            <td>{{ data.clinicalWasteType ? data.clinicalWasteType.typeName : '' }}</td>
24
+            <td>{{ data.deptNames }}</td>
25
+            <td>{{ data.minWeight }}</td>
26
+            <td>{{ data.maxWeight }}</td>
27
+            <td>
28
+              <div class="coop">
29
+                <span *ngIf="coopBtns.edit" (click)="edit(data)">修改</span>
30
+                <span *ngIf="coopBtns.del" (click)="del(data)">删除</span>
31
+              </div>
32
+            </td>
33
+          </tr>
34
+        </tbody>
35
+      </nz-table>
36
+      <div class="list-template__pagination">
37
+        <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" nzShowSizeChanger [(nzPageSize)]="pageSize"
38
+          (nzPageIndexChange)="getList()" (nzPageSizeChange)="getList()">
39
+        </nz-pagination>
40
+      </div>
41
+    </div>
42
+  </div>
43
+</div>
44
+<!-- 新增/编辑模态框 -->
45
+<div class="save add display_flex align-items_center justify-content_flex-center" *ngIf="modal">
46
+  <div class="modalBody">
47
+    <div class="title">{{add?"新增":"编辑"}}回收限制<i class="icon_transport transport-guanbi" (click)="hideModal()"></i>
48
+    </div>
49
+    <overlay-scrollbars #osComponentRef1 class="content">
50
+      <form nz-form [formGroup]="validateForm" class="addForm" (ngSubmit)="submitForm()">
51
+        <nz-form-item>
52
+          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="clinicalWasteType">医废类型</nz-form-label>
53
+          <nz-form-control nzErrorTip="请选择医废类型!">
54
+            <nz-select (nzOnSearch)="changeInp('clinicalWasteType', $event)" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch nzAllowClear formControlName="clinicalWasteType" nzPlaceHolder="请选择医废类型">
55
+              <ng-container *ngFor="let option of clinicalWasteTypes">
56
+                <nz-option *ngIf="!isLoading" [nzLabel]="option.typeName" [nzValue]="option.id"></nz-option>
57
+              </ng-container>
58
+              <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
59
+                <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
60
+              </nz-option>
61
+            </nz-select>
62
+          </nz-form-control>
63
+        </nz-form-item>
64
+        <nz-form-item>
65
+          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="deptIds">限制科室</nz-form-label>
66
+          <nz-form-control nzErrorTip="请选择限制科室!">
67
+            <nz-select nzMode="multiple" (nzOnSearch)="changeInp('deptIds', $event)" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch nzAllowClear formControlName="deptIds" nzPlaceHolder="请选择限制科室">
68
+              <ng-container *ngFor="let option of deptIdsList">
69
+                <nz-option *ngIf="!isLoading" [nzLabel]="option.dept" [nzValue]="option.id"></nz-option>
70
+              </ng-container>
71
+              <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
72
+                <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
73
+              </nz-option>
74
+            </nz-select>
75
+          </nz-form-control>
76
+        </nz-form-item>
77
+        <nz-form-item>
78
+          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="minWeight">最小重量</nz-form-label>
79
+          <nz-form-control nzErrorTip="请填写最小重量!">
80
+            <div style="margin-top: 15px;">
81
+              <nz-input-number nz-input formControlName="minWeight" nzPlaceHolder="请填写最小重量" [nzMin]="0" [nzStep]="0.01" [nzPrecision]="2"></nz-input-number>
82
+              <span class="red">(kg)</span>
83
+            </div>
84
+          </nz-form-control>
85
+        </nz-form-item>
86
+        <nz-form-item>
87
+          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="maxWeight">最大重量</nz-form-label>
88
+          <nz-form-control nzErrorTip="请填写最大重量!">
89
+            <div style="margin-top: 15px;">
90
+              <nz-input-number nz-input formControlName="maxWeight" nzPlaceHolder="请填写最大重量" [nzMin]="0" [nzStep]="0.01" [nzPrecision]="2"></nz-input-number>
91
+              <span class="red">(kg)</span>
92
+            </div>
93
+          </nz-form-control>
94
+        </nz-form-item>
95
+      </form>
96
+    </overlay-scrollbars>
97
+    <div class="display_flex justify-content_flex-center">
98
+      <button nzType="primary" nz-button (click)="submitForm()" [nzLoading]="btnLoading">确认</button>
99
+      <button class="btn cancel" nz-button nzType="default" (click)="hideModal()">取消</button>
100
+    </div>
101
+  </div>
102
+</div>
103
+<!-- 删除模态框 -->
104
+<app-dialog-delete [delModal]="delModal" (hideDelModalEvent)="hideDelModal()" [btnLoading]="btnLoading"
105
+  (confirmDelEvent)="confirmDel()" content="您确认要删除吗?">
106
+</app-dialog-delete>
107
+<!-- 操作成功/失败提示框 -->
108
+<app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
109
+  [info]="promptInfo"></app-prompt-modal>
110
+
111
+<!-- 遮罩 -->
112
+<app-mask *ngIf="maskFlag"></app-mask>

+ 125 - 0
src/app/views/recycling-restriction/recycling-restriction.component.less

@@ -0,0 +1,125 @@
1
+@import "../../../../src/theme.less";
2
+.save {
3
+  position: fixed;
4
+  left: 0;
5
+  top: 0;
6
+  width: 100%;
7
+  height: 100%;
8
+  background: rgba(0, 0, 0, 0.4);
9
+  z-index: 99;
10
+
11
+  .modalBody {
12
+    width: 350px;
13
+    background: #fff;
14
+    border-radius: 5px;
15
+    padding: 10px 20px;
16
+    color: #333;
17
+
18
+    .title {
19
+      width: 100%;
20
+      text-align: center;
21
+      font-size: 18px;
22
+      position: relative;
23
+
24
+      i {
25
+        position: absolute;
26
+        right: 0;
27
+        top: 0;
28
+        font-size: 20px;
29
+        color: #666;
30
+        cursor: pointer;
31
+        padding: 0 5px;
32
+      }
33
+    }
34
+
35
+    .content {
36
+      width: 100%;
37
+      height: 117px;
38
+      background: #f9fafb;
39
+      border: 1px solid #e5e9ed;
40
+      border-radius: 5px;
41
+      overflow: hidden;
42
+      margin-top: 12px;
43
+
44
+      div {
45
+        margin: 0;
46
+
47
+        &.icon {
48
+          margin-top: 17px;
49
+
50
+          i {
51
+            color: #34b349;
52
+            font-size: 30px !important;
53
+
54
+            &.transport-wenhao {
55
+              color: #f5a523;
56
+            }
57
+
58
+            &.transport-shibai {
59
+              color: #ff3a52;
60
+            }
61
+          }
62
+        }
63
+
64
+        &.defeat {
65
+          color: #333;
66
+          font-size: 18px;
67
+        }
68
+
69
+        &:nth-child(3) {
70
+          font-size: 14px;
71
+          color: #666;
72
+        }
73
+      }
74
+    }
75
+
76
+    button {
77
+      margin-top: 10px;
78
+
79
+      &.btn {
80
+        margin-left: 8px;
81
+      }
82
+    }
83
+  }
84
+
85
+  // 新增
86
+  &.add {
87
+    .modalBody {
88
+      width: 480px;
89
+      height: auto;
90
+
91
+      .content {
92
+        width: 100%;
93
+        height: auto;
94
+        padding: 19px 14px 0 14px;
95
+        max-height: 500px;
96
+        overflow-y: auto;
97
+
98
+        .addForm {
99
+          .ant-form-item {
100
+            margin-bottom: 8px;
101
+
102
+            .ant-form-item-label {
103
+              line-height: 14px;
104
+              text-align: left;
105
+            }
106
+          }
107
+        }
108
+
109
+        .editForm {
110
+          .ant-form-item {
111
+            margin-bottom: 14px;
112
+
113
+            .ant-form-item-label {
114
+              line-height: 0;
115
+            }
116
+          }
117
+        }
118
+      }
119
+
120
+      button:nth-child(1) {
121
+        margin-right: 20px;
122
+      }
123
+    }
124
+  }
125
+}

+ 242 - 0
src/app/views/recycling-restriction/recycling-restriction.component.ts

@@ -0,0 +1,242 @@
1
+import { Component, OnInit, ViewChild } from "@angular/core";
2
+import { ActivatedRoute, Router } from "@angular/router";
3
+import { FormBuilder, Validators, FormGroup } from "@angular/forms";
4
+
5
+import { MainService } from "../../services/main.service";
6
+import { OverlayScrollbarsComponent } from "overlayscrollbars-ngx";
7
+import { ToolService } from "../../services/tool.service";
8
+import { NzMessageService } from "ng-zorro-antd";
9
+import { debounceTime } from 'rxjs/operators';
10
+import { Subject } from 'rxjs';
11
+
12
+@Component({
13
+  selector: "app-recycling-restriction",
14
+  templateUrl: "./recycling-restriction.component.html",
15
+  styleUrls: ["./recycling-restriction.component.less"],
16
+})
17
+export class RecyclingRestrictionComponent implements OnInit {
18
+  @ViewChild("osComponentRef1", {
19
+    read: OverlayScrollbarsComponent,
20
+    static: false,
21
+  })
22
+  osComponentRef1: OverlayScrollbarsComponent;
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
+  ) {}
31
+
32
+  listOfData: any[] = []; //表格数据
33
+
34
+  modal: boolean = false; //新增/编辑模态框
35
+  add: boolean; //true:新增;false:编辑
36
+  validateForm: FormGroup; //新增/编辑表单
37
+  coopId: number; //表格中执行操作的id
38
+  hosId: any; //院区(搜索)
39
+  pageIndex: number = 1; //页码
40
+  listLength: number = 10; //总条数
41
+  pageSize: number = 10; //每页条数
42
+
43
+  promptContent: string; //操作提示框提示信息
44
+  ifSuccess: boolean; //操作成功/失败
45
+  promptInfo: string; //操作结果提示信息
46
+  promptModalShow: boolean; //操作提示框是否展示
47
+
48
+  btnLoading: boolean = false; //提交按钮loading状态
49
+
50
+  changeInpSubject = new Subject(); //防抖
51
+
52
+  ngOnInit() {
53
+    //防抖
54
+    this.changeInpSubject.pipe(debounceTime(500)).subscribe((v) => {
55
+      if(v[0] == 'clinicalWasteType'){
56
+        this.getClinicalWasteTypes(v[1]);
57
+      }else if(v[0] == 'deptIds'){
58
+        this.getDeptIds(v[1]);
59
+      }
60
+    });
61
+    this.coopBtns = this.tool.initCoopBtns(this.route);
62
+    this.initForm();
63
+    this.getAllHospital();
64
+    this.getClinicalWasteTypes();
65
+    this.getDeptIds();
66
+  }
67
+
68
+  // 初始化增删改按钮
69
+  coopBtns: any = {};
70
+  // 表格数据
71
+  loading1 = false;
72
+  getList() {
73
+    let data = {
74
+      idx: this.pageIndex - 1,
75
+      sum: this.pageSize,
76
+      clinicalWasteLimit: {
77
+        hosId: this.hosId,
78
+      },
79
+    };
80
+    this.loading1 = true;
81
+    this.mainService
82
+      .getFetchDataList("simple/data", "clinicalWasteLimit", data)
83
+      .subscribe((data) => {
84
+        this.loading1 = false;
85
+        let listOfData = data.list || [];
86
+        listOfData.forEach((item) => {
87
+          item.deptNames = item.depts.map(v => v.dept).toString();
88
+        })
89
+        this.listOfData = listOfData;
90
+        this.listLength = data.totalNum;
91
+      });
92
+  }
93
+
94
+  // 获取所有医废类型
95
+  clinicalWasteTypes: Array<any> = [];
96
+  getClinicalWasteTypes(keyword = "") {
97
+    this.mainService.getFetchDataList("simple/data", "clinicalWasteType", {idx: 0, sum: 9999, clinicalWasteType: { hosId: this.hosId, typeName: keyword }}).subscribe((data) => {
98
+      this.isLoading = false;
99
+      this.clinicalWasteTypes = data.list || [];
100
+    });
101
+  }
102
+
103
+  // 获取所有医废类型
104
+  deptIdsList: Array<any> = [];
105
+  getDeptIds(keyword = "") {
106
+    this.mainService.getFetchDataList("data", "department", {idx: 0, sum: 9999, department: { cascadeHosId: this.hosId, dept: keyword, searchType: 1 }}).subscribe((data) => {
107
+      this.isLoading = false;
108
+      this.deptIdsList = data.list || [];
109
+    });
110
+  }
111
+
112
+  // 边输边搜节流阀
113
+  isLoading = false;
114
+  changeInp(type, e) {
115
+    this.isLoading = true;
116
+    this.changeInpSubject.next([type, e]);
117
+  }
118
+
119
+  // 获取相应的院区
120
+  getAllHospital() {
121
+    this.hosId = this.tool.getCurrentHospital().id;
122
+    this.getList();
123
+  }
124
+
125
+  // 新增弹框
126
+  showModal() {
127
+    this.add = true;
128
+    this.initForm();
129
+    this.modal = true;
130
+  }
131
+  hideModal() {
132
+    this.modal = false;
133
+    this.initForm();
134
+  }
135
+
136
+  // 初始化新增form表单
137
+  initForm() {
138
+    this.validateForm = this.fb.group({
139
+      clinicalWasteType: [null, [Validators.required]],
140
+      deptIds: [[], [Validators.required]],
141
+      minWeight: [0, [Validators.required]],
142
+      maxWeight: [0, [Validators.required]],
143
+    });
144
+  }
145
+  // 表单提交
146
+  submitForm(): void {
147
+    var that = this;
148
+    for (const i in that.validateForm.controls) {
149
+      that.validateForm.controls[i].markAsDirty({ onlySelf: true });
150
+      that.validateForm.controls[i].updateValueAndValidity();
151
+    }
152
+    if (that.validateForm.invalid) return;
153
+    if(that.validateForm.value.minWeight > that.validateForm.value.maxWeight){
154
+      this.message.info('最小重量不能大于最大重量');
155
+      return;
156
+    }
157
+    that.btnLoading = true;
158
+    let data:any = {
159
+      clinicalWasteType: {id: that.validateForm.value.clinicalWasteType},
160
+      deptIds: that.validateForm.value.deptIds.toString(),
161
+      minWeight: that.validateForm.value.minWeight,
162
+      maxWeight: that.validateForm.value.maxWeight,
163
+      hosId: that.hosId,
164
+    };
165
+    if (!that.add) {
166
+      data = {...this.coopData, ...data};
167
+    }
168
+    console.log(data);
169
+    that.mainService
170
+      .simplePost("addData", "clinicalWasteLimit", data)
171
+      .subscribe((data) => {
172
+        that.btnLoading = false;
173
+        that.hideModal();
174
+        that.initForm();
175
+        if (data.status == 200) {
176
+          that.showPromptModal(that.add ? "新增" : "编辑", true, "");
177
+        } else {
178
+          that.showPromptModal(that.add ? "新增" : "编辑", false, data.msg);
179
+        }
180
+      });
181
+  }
182
+
183
+  // 编辑
184
+  maskFlag: any = false;
185
+  coopData:any = {};
186
+  edit(data) {
187
+    this.modal = true;
188
+    this.add = false;
189
+    this.coopId = data.id;
190
+    this.coopData = data;
191
+    this.validateForm.controls.clinicalWasteType.setValue(data.clinicalWasteType ? data.clinicalWasteType.id : null);
192
+    this.validateForm.controls.deptIds.setValue(data.depts.map(v => v.id));
193
+    this.validateForm.controls.minWeight.setValue(data.minWeight);
194
+    this.validateForm.controls.maxWeight.setValue(data.maxWeight);
195
+  }
196
+
197
+  // 删除
198
+  delModal: boolean = false; //删除模态框
199
+  del(data) {
200
+    this.coopId = data.id;
201
+    this.delModal = true;
202
+  }
203
+  // 确认删除
204
+  confirmDel() {
205
+    let that = this;
206
+    that.btnLoading = true;
207
+    that.mainService
208
+      .simplePost("rmvData", "clinicalWasteLimit", [that.coopId])
209
+      .subscribe((data) => {
210
+        that.btnLoading = false;
211
+        that.hideDelModal();
212
+        if (data["status"] == 200) {
213
+          if (
214
+            that.listOfData.length == 1 &&
215
+            that.pageIndex == Math.ceil(that.listLength / that.pageSize)
216
+          ) {
217
+            that.listLength--;
218
+            that.pageIndex = Math.ceil(that.listLength / that.pageSize) || 1;
219
+          }
220
+          that.showPromptModal("删除", true, "");
221
+        } else {
222
+          that.showPromptModal("删除", false, data["msg"]);
223
+        }
224
+      });
225
+  }
226
+  // 关闭删除模态框
227
+  hideDelModal() {
228
+    this.delModal = false;
229
+  }
230
+
231
+  // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
232
+  showPromptModal(con, success, promptInfo?) {
233
+    this.promptModalShow = false;
234
+    this.promptContent = con;
235
+    this.ifSuccess = success;
236
+    this.promptInfo = promptInfo;
237
+    setTimeout(() => {
238
+      this.promptModalShow = true;
239
+    }, 100);
240
+    this.getList();
241
+  }
242
+}

+ 19 - 0
src/app/views/recycling-restriction/recycling-restriction.module.ts

@@ -0,0 +1,19 @@
1
+import { NgModule } from '@angular/core';
2
+import { CommonModule } from '@angular/common';
3
+
4
+import { RecyclingRestrictionRoutingModule } from './recycling-restriction-routing.module';
5
+import { RecyclingRestrictionComponent } from './recycling-restriction.component';
6
+import { ShareModule } from 'src/app/share/share.module';
7
+
8
+
9
+@NgModule({
10
+  declarations: [
11
+    RecyclingRestrictionComponent,
12
+  ],
13
+  imports: [
14
+    CommonModule,
15
+    RecyclingRestrictionRoutingModule,
16
+    ShareModule
17
+  ]
18
+})
19
+export class RecyclingRestrictionModule { }