seimin il y a 9 mois
Parent
commit
908bd8073d

+ 14 - 0
src/app/views/inspection-batch/inspection-batch-routing.module.ts

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

+ 85 - 0
src/app/views/inspection-batch/inspection-batch.component.html

@@ -0,0 +1,85 @@
1
+<div class="list-template">
2
+  <div class="list-template__content">
3
+    <div class="list-template__top" nz-row>
4
+      <div nz-col nzXl='17' class="list-template__searchBox">
5
+        <div class="list-template__searchItem">
6
+          <span class="label">计划主题</span>:
7
+          <nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch
8
+            (nzOnSearch)="changeInp('search', 'incidentPlan', $event)" nzAllowClear nzPlaceHolder="请选择计划主题" [(ngModel)]="searchDto.inspectionId">
9
+            <ng-container *ngFor="let option of incidentPlanSearchList">
10
+              <nz-option *ngIf="!isLoading" [nzLabel]="option.name" [nzValue]="option.id"></nz-option>
11
+            </ng-container>
12
+            <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
13
+              <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
14
+            </nz-option>
15
+          </nz-select>
16
+        </div>
17
+        <div class="list-template__searchItem">
18
+          <span class="label">时间范围</span>:
19
+          <nz-range-picker nzShowTime [(ngModel)]="dateRange" (nzOnCalendarChange)="onCalendarChangeDate($event)" (ngModelChange)="changeDate($event)"></nz-range-picker>
20
+        </div>
21
+        <div class="list-template__searchItem">
22
+          <span class="label">状态</span>:
23
+          <nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" nzShowSearch nzAllowClear nzPlaceHolder="请选择状态" [(ngModel)]="searchDto.statusId">
24
+            <ng-container *ngFor="let option of statusSearchList">
25
+              <nz-option *ngIf="!isLoading" [nzLabel]="option.name" [nzValue]="option.id"></nz-option>
26
+            </ng-container>
27
+            <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
28
+              <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
29
+            </nz-option>
30
+          </nz-select>
31
+        </div>
32
+      </div>
33
+      <div nz-col nzXl="7" class="list-template__btns">
34
+        <button nz-button class="btn default ml8" (click)='search()'>搜索</button>
35
+        <button nz-button class="btn default ml8" (click)='reset()'>重置</button>
36
+      </div>
37
+    </div>
38
+    <div class="list-template__bottom">
39
+      <nz-table class="list-template__nzTable" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false"
40
+        [nzLoading]="loading1">
41
+        <thead>
42
+          <tr class="thead">
43
+            <th nzWidth="14%">计划主题</th>
44
+            <th nzWidth="14%">批次号</th>
45
+            <th nzWidth="14%">创建时间</th>
46
+            <th nzWidth="14%">生成人</th>
47
+            <th nzWidth="14%">状态</th>
48
+            <th nzWidth="14%">完成百分比</th>
49
+            <th nzWidth="16%">操作</th>
50
+          </tr>
51
+        </thead>
52
+        <tbody>
53
+          <tr *ngFor="let data of listOfData;let i = index">
54
+            <td>{{data.inspectionDTO?.name}}</td>
55
+            <td>{{data.batchNo}}</td>
56
+            <td>{{data.addTime | date:'yyyy-MM-dd HH:mm'}}</td>
57
+            <td>{{data.addUserDTO?.name}}</td>
58
+            <td>{{data.status?.name}}</td>
59
+            <td><nz-progress [nzPercent]="data.percent" nzStatus="active" nzStrokeColor="#49b856"></nz-progress></td>
60
+            <td>
61
+              <div class="coop">
62
+                <span *ngIf="coopBtns.del" (click)="showDelModal(data,'删除批次同时会删除相关巡检任务,您确认要删除吗?','删除','del')">删除</span>
63
+              </div>
64
+            </td>
65
+          </tr>
66
+        </tbody>
67
+      </nz-table>
68
+      <div class="list-template__pagination">
69
+        <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize" nzShowSizeChanger
70
+          (nzPageIndexChange)="getList(0)" (nzPageSizeChange)="getList(0)">
71
+        </nz-pagination>
72
+      </div>
73
+    </div>
74
+  </div>
75
+</div>
76
+<!-- 模态框 -->
77
+<app-dialog-delete [delModal]="delModal" (hideDelModalEvent)="hideDelModal()" [btnLoading]="btnLoading"
78
+(confirmDelEvent)="confirmDel()" [content]="tipsMsg1"></app-dialog-delete>
79
+<!-- 操作成功/失败提示框 -->
80
+<app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
81
+  [info]="promptInfo">
82
+</app-prompt-modal>
83
+
84
+<!-- 遮罩 -->
85
+<app-mask *ngIf="maskFlag"></app-mask>

+ 173 - 0
src/app/views/inspection-batch/inspection-batch.component.less

@@ -0,0 +1,173 @@
1
+@import "../../../../src/theme.less";
2
+
3
+:host {
4
+  .list-template__top{
5
+    overflow: visible!important;
6
+  }
7
+}
8
+.save {
9
+  position: fixed;
10
+  left: 0;
11
+  top: 0;
12
+  width: 100%;
13
+  height: 100%;
14
+  background: rgba(0, 0, 0, 0.4);
15
+  z-index: 99;
16
+
17
+  .modalBody {
18
+    width: 350px;
19
+    background: #fff;
20
+    border-radius: 5px;
21
+    padding: 10px 20px;
22
+    color: #333;
23
+
24
+    .title {
25
+      width: 100%;
26
+      text-align: center;
27
+      font-size: 18px;
28
+      position: relative;
29
+
30
+      i {
31
+        position: absolute;
32
+        right: 0;
33
+        top: 0;
34
+        font-size: 20px;
35
+        color: #666;
36
+        cursor: pointer;
37
+        padding: 0 5px;
38
+      }
39
+    }
40
+
41
+    .content {
42
+      width: 310px;
43
+      background: #f9fafb;
44
+      border: 1px solid #e5e9ed;
45
+      border-radius: 5px;
46
+      overflow: hidden;
47
+      margin-top: 12px;
48
+      padding: 16px 0;
49
+
50
+      .busyList{
51
+        display: flex;
52
+        margin-bottom: 8px;
53
+        .busyContent{
54
+          margin-right: 8px;
55
+          flex: 1;
56
+        }
57
+      }
58
+
59
+      & > div {
60
+        text-align: center;
61
+        margin: 0;
62
+
63
+        &.icon {
64
+          // margin-top: 17px;
65
+
66
+          i {
67
+            color: #34b349;
68
+            font-size: 30px !important;
69
+
70
+            &.transport-wenhao {
71
+              color: #f5a523;
72
+            }
73
+
74
+            &.transport-shibai {
75
+              color: #ff3a52;
76
+            }
77
+          }
78
+        }
79
+
80
+        &.defeat {
81
+          color: #333;
82
+          font-size: 14px;
83
+        }
84
+
85
+        &:nth-child(3) {
86
+          font-size: 14px;
87
+          color: #666;
88
+        }
89
+      }
90
+      .workAssignmentTips {
91
+        font-size: 12px;
92
+      }
93
+    }
94
+
95
+    button {
96
+      margin-top: 10px;
97
+
98
+      &.btn {
99
+        margin-left: 8px;
100
+      }
101
+    }
102
+  }
103
+
104
+  // 新增
105
+  &.add {
106
+    .modalBody {
107
+      width: 480px;
108
+      height: auto;
109
+
110
+      .content {
111
+        width: 100%;
112
+        height: auto;
113
+        padding: 16px;
114
+        max-height: 497px;
115
+        overflow-y: auto;
116
+
117
+        .addForm {
118
+          .ant-form-item {
119
+            margin-bottom: 0;
120
+
121
+            .ant-form-item-label {
122
+              text-align: left;
123
+            }
124
+
125
+            .desc {
126
+              margin-top: 5px;
127
+            }
128
+          }
129
+
130
+          .datesControl {
131
+            margin-top: -16px;
132
+
133
+            .ant-form-item-label {
134
+              line-height: 40px;
135
+            }
136
+          }
137
+
138
+          .timer {
139
+            .ant-form-item-label {
140
+              width: 100%;
141
+              text-align: left;
142
+            }
143
+
144
+            .numInp {
145
+              margin-right: 5px;
146
+            }
147
+
148
+            .line {
149
+              margin-right: 5px;
150
+            }
151
+          }
152
+
153
+          .timer2 {
154
+            .ant-form-item-label {
155
+              line-height: 20px;
156
+            }
157
+          }
158
+        }
159
+
160
+        .editForm {
161
+          .ant-form-item {
162
+            margin-bottom: 15px;
163
+
164
+            .ant-form-item-label {
165
+              line-height: 14px;
166
+              text-align: left;
167
+            }
168
+          }
169
+        }
170
+      }
171
+    }
172
+  }
173
+}

+ 283 - 0
src/app/views/inspection-batch/inspection-batch.component.ts

@@ -0,0 +1,283 @@
1
+import { Component, OnInit } 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 { ToolService } from "../../services/tool.service";
7
+import { NzMessageService } from 'ng-zorro-antd';
8
+import { Subject } from 'rxjs';
9
+import { debounceTime } from 'rxjs/operators';
10
+import { format } from 'date-fns';
11
+@Component({
12
+  selector: "app-inspection-batch",
13
+  templateUrl: "./inspection-batch.component.html",
14
+  styleUrls: ["./inspection-batch.component.less"],
15
+})
16
+export class InspectionBatchComponent implements OnInit {
17
+  constructor(
18
+    private fb: FormBuilder,
19
+    private mainService: MainService,
20
+    private route: ActivatedRoute,
21
+    private router: Router,
22
+    private tool: ToolService,
23
+    private message: NzMessageService,
24
+  ) {}
25
+
26
+  listOfData: any[] = []; //表格数据
27
+  pageIndex: number = 1; //表格当前页码
28
+  pageSize: number = 10; //表格每页展示条数
29
+  listLength: number = 10; //表格总数据量
30
+  modal: boolean = false; //新增/编辑模态框
31
+  add: boolean; //true:新增;false:编辑
32
+  validateForm: FormGroup; //新增/编辑表单
33
+  coopData: any; //当前操作列
34
+  currentHospital; //当前院区
35
+
36
+  btnLoading: boolean = false; //提交按钮loading状态
37
+
38
+  promptContent: string; //操作提示框提示信息
39
+  ifSuccess: boolean; //操作成功/失败
40
+  promptInfo: string; //操作结果提示信息
41
+  promptModalShow: boolean; //操作提示框是否展示
42
+  nextSchemeName = ""; //下一个开启的方案名称
43
+  modelName = ""; //模态框名称
44
+
45
+  changeInpSubject = new Subject(); //防抖
46
+  showDropdown:boolean = false;
47
+
48
+  ngOnInit() {
49
+    //防抖
50
+    this.changeInpSubject.pipe(debounceTime(500)).subscribe((v) => {
51
+      if(v[1] === 'incidentPlan'){
52
+        this.getIncidentPlans(v[0], v[2]);
53
+      }
54
+    });
55
+    this.currentHospital = this.tool.getCurrentHospital();
56
+    this.coopBtns = this.tool.initCoopBtns(this.route);
57
+    this.getList(1);
58
+    this.getIncidentPlans('search', '');
59
+    this.getStatus();
60
+  }
61
+
62
+  // 初始化增删改按钮
63
+  coopBtns: any = {};
64
+
65
+  // 批量关联科室
66
+  inspectionAddressDepartmentPromptModalShow = false; //标本历史记录弹窗开关
67
+  showInspectionAddressDepartment() {
68
+    this.inspectionAddressDepartmentPromptModalShow = true;
69
+  }
70
+  // 关闭弹窗
71
+  closeModelInspectionAddressDepartment(e) {
72
+    this.inspectionAddressDepartmentPromptModalShow = JSON.parse(e).show;
73
+  }
74
+  // 确认弹窗
75
+  checkedDepIdsModel = [];
76
+  confirmModelInspectionAddressDepartment(checkedDepIds) {
77
+    this.inspectionAddressDepartmentPromptModalShow = true;
78
+    this.checkedDepIdsModel = checkedDepIds;
79
+    console.log(checkedDepIds)
80
+    this.showInspectionAddressTag();
81
+  }
82
+
83
+  // 批量关联科室-标签
84
+  inspectionAddressTagPromptModalShow = false; //标本历史记录弹窗开关
85
+  showInspectionAddressTag() {
86
+    this.inspectionAddressTagPromptModalShow = true;
87
+  }
88
+  // 关闭弹窗
89
+  closeModelInspectionAddressTag(e) {
90
+    this.inspectionAddressTagPromptModalShow = JSON.parse(e).show;
91
+  }
92
+  // 确认弹窗
93
+  maskFlag: any = false;
94
+  confirmModelInspectionAddressTag(tags) {
95
+    this.maskFlag = this.message.loading("正在加载中..", {
96
+      nzDuration: 0,
97
+    }).messageId;
98
+    this.inspectionAddressTagPromptModalShow = true;
99
+    console.log(this.checkedDepIdsModel, tags);
100
+    let postData:any = {
101
+      deptIds: this.checkedDepIdsModel.toString(),
102
+      hosId: this.currentHospital.id,
103
+      tagIds: tags.toString(),
104
+    };
105
+    console.log(postData);
106
+    this.btnLoading = true;
107
+    this.mainService
108
+      .inspectionPost("batchBindFormNode", postData)
109
+      .subscribe((result) => {
110
+        this.message.remove(this.maskFlag);
111
+        this.maskFlag = false;
112
+        this.btnLoading = false;
113
+        if (result.status == 200) {
114
+          this.inspectionAddressDepartmentPromptModalShow = false;
115
+          this.inspectionAddressTagPromptModalShow = false;
116
+          this.showPromptModal('操作', true, '');
117
+        } else if (result.status == 501) {
118
+          this.inspectionAddressDepartmentPromptModalShow = false;
119
+          this.inspectionAddressTagPromptModalShow = false;
120
+          this.showPromptModal('操作', true, result.msg);
121
+        } else {
122
+          this.showPromptModal('操作', false, result.msg);
123
+        }
124
+      });
125
+  }
126
+
127
+  // 搜索
128
+  search() {
129
+    this.getList(0);
130
+  }
131
+  // 重置
132
+  reset() {
133
+    this.dateRange = [];
134
+    this.changeDate();
135
+    this.searchDto = {};
136
+    this.getList(1);
137
+  }
138
+
139
+  // 表格数据
140
+  searchDto: any = {};
141
+  loading1 = false;
142
+  getList(type) {
143
+    if (type == 1) {
144
+      this.pageIndex = 1;
145
+    }
146
+    let data:any = {
147
+      idx: this.pageIndex - 1,
148
+      sum: this.pageSize,
149
+      inspectionBatch: {
150
+        hosId: this.currentHospital.id,
151
+        inspectionId: this.searchDto.inspectionId || undefined,
152
+        status: this.searchDto.statusId ? { id: this.searchDto.statusId } : undefined,
153
+      },
154
+    };
155
+    if (this.startDate && this.endDate) {
156
+      data.inspectionBatch.addTimeStart = this.startDate;
157
+      data.inspectionBatch.addTimeEnd = this.endDate;
158
+    }
159
+    this.loading1 = true;
160
+    this.mainService
161
+      .getFetchDataList("simple/data", "inspectionBatch", data)
162
+      .subscribe((data) => {
163
+        this.loading1 = false;
164
+        if (data.status == 200) {
165
+          this.listOfData = data.list;
166
+          this.listLength = data.totalNum;
167
+        }else{
168
+          this.message.error(data.msg || "请求数据失败");
169
+        }
170
+      });
171
+  }
172
+
173
+  // 边输边搜节流阀
174
+  isLoading = false;
175
+  changeInp(type, model, e) {
176
+    this.isLoading = true;
177
+    this.changeInpSubject.next([type, model, e]);
178
+  }
179
+
180
+  // 获取巡检计划
181
+  incidentPlanSearchList: any = [];
182
+  getIncidentPlans(type, keyword, init = false) {
183
+    let postData = {
184
+      inspection: {
185
+        name: keyword,
186
+        hosId: this.currentHospital.id,
187
+      },
188
+      idx: 0,
189
+      sum: 20,
190
+    };
191
+    this.mainService
192
+      .getFetchDataList("data", "inspection", postData)
193
+      .subscribe((data) => {
194
+        this.incidentPlanSearchList = data.list;
195
+        this.isLoading = false;
196
+      });
197
+  }
198
+
199
+  // 获取状态
200
+  statusSearchList: any = [];
201
+  getStatus() {
202
+    this.mainService
203
+    .getDictionary('list', 'inspection_batch_status')
204
+    .subscribe((data) => {
205
+      this.statusSearchList = data || [];
206
+    });
207
+  }
208
+
209
+  dateRange: any = []; //时间范围
210
+  onCalendarChangeDate(dateArr){
211
+    console.log(dateArr)
212
+    if(dateArr.length == 2){
213
+      let dateStart = new Date(dateArr[0]);
214
+      let dateEnd = new Date(dateArr[1]);
215
+      dateStart.setHours(0,0,0);
216
+      dateEnd.setHours(23,59,59);
217
+      this.dateRange = [dateStart,dateEnd];
218
+    }
219
+  }
220
+
221
+  // 日期选择
222
+  startDate: string; //发起时间开始
223
+  endDate: string; //发起时间结束
224
+  changeDate(result?): void {
225
+    if (!result) {
226
+      this.startDate = this.endDate = "";
227
+      return;
228
+    }
229
+    this.startDate = format(result[0], 'yyyy-MM-dd HH:mm:ss');
230
+    this.endDate = format(result[1], 'yyyy-MM-dd HH:mm:ss');
231
+  }
232
+
233
+  // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
234
+  showPromptModal(con, success, promptInfo?) {
235
+    this.promptModalShow = false;
236
+    this.promptContent = con;
237
+    this.ifSuccess = success;
238
+    this.promptInfo = promptInfo;
239
+    setTimeout(() => {
240
+      this.promptModalShow = true;
241
+    }, 100);
242
+    this.getList(0);
243
+  }
244
+
245
+  delModal: boolean = false; //删除模态框
246
+  tipsMsg1: string; //提示框信息
247
+  tipsMsg2: string; //操作后信息
248
+  confirmDelType: string; //确认的类型(启用/停用,删除)
249
+  showDelModal(
250
+    data,
251
+    tipsMsg1: string,
252
+    tipsMsg2: string,
253
+    type: string,
254
+  ) {
255
+    this.confirmDelType = type;
256
+    this.delModal = true;
257
+    this.coopData = data;
258
+    this.tipsMsg1 = tipsMsg1;
259
+    this.tipsMsg2 = tipsMsg2;
260
+  }
261
+  // 隐藏删除框
262
+  hideDelModal() {
263
+    this.delModal = false;
264
+  }
265
+  // 确认删除
266
+  confirmDel() {
267
+    this.btnLoading = true;
268
+    if (this.confirmDelType === "del") {
269
+      //删除
270
+      this.mainService
271
+        .simplePost("rmvData", "inspectionBatch", [this.coopData.id])
272
+        .subscribe((data) => {
273
+          this.btnLoading = false;
274
+          this.delModal = false;
275
+          if (data.status == 200) {
276
+            this.showPromptModal(this.tipsMsg2, true, "");
277
+          } else {
278
+            this.showPromptModal(this.tipsMsg2, false, data.msg);
279
+          }
280
+        });
281
+    }
282
+  }
283
+}

+ 19 - 0
src/app/views/inspection-batch/inspection-batch.module.ts

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

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

@@ -523,6 +523,11 @@ const routes: Routes = [
523 523
         path: "inspectionPlan",
524 524
         loadChildren: () => import("../inspection-plan/inspection-plan.module").then((m) => m.InspectionPlanModule),
525 525
       },
526
+      // 巡检批次
527
+      {
528
+        path: "inspectionBatch",
529
+        loadChildren: () => import("../inspection-batch/inspection-batch.module").then((m) => m.InspectionBatchModule),
530
+      },
526 531
     ],
527 532
   },
528 533
 ];