seimin 9 місяців тому
батько
коміт
29e62fd934

+ 3 - 1
src/app/share/inspection-address-tag-prompt-modal/inspection-address-tag-prompt-modal.component.ts

@@ -49,6 +49,7 @@ export class InspectionAddressTagPromptModalComponent implements OnInit {
49 49
     let postData = {
50 50
       tag: {
51 51
         hosId: this.currentHospital.id,
52
+        modelType: { value: 'inspection' },
52 53
       },
53 54
       idx: 0,
54 55
       sum: 50,
@@ -88,7 +89,8 @@ export class InspectionAddressTagPromptModalComponent implements OnInit {
88 89
         this.isLoading = false;
89 90
         console.log(result);
90 91
         if(result.status == 200){
91
-
92
+          this.tagListCopy.unshift(result.data)
93
+          console.log(this.tagListCopy);
92 94
         } else if (result.status == 10001){
93 95
           // 名称重复
94 96
           this.tagListCopy.unshift(result.data)

+ 87 - 0
src/app/share/inspection-template-prompt-modal/inspection-template-prompt-modal.component.html

@@ -0,0 +1,87 @@
1
+<div class="modal display_flex justify-content_flex-center align-items_center" *ngIf="show">
2
+  <div class="modalBody">
3
+    <div class="title">引入模板<i class="icon_transport transport-guanbi" (click)="hideModal()"></i></div>
4
+    <div class="list-template content">
5
+      <div class="list-template__content">
6
+        <!-- <div class="list-template__top" nz-row>
7
+          <div nz-col nzXl='19' class="list-template__searchBox">
8
+            <div class="list-template__searchItem">
9
+              <span class="label">科室名称</span>:
10
+              <input nz-input class="formItem" placeholder="请输入科室名称" [(ngModel)]="searchDto.dept" />
11
+            </div>
12
+            <div class="list-template__searchItem">
13
+              <span class="label">科室类型</span>:
14
+              <nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" nzShowSearch
15
+                nzAllowClear nzPlaceHolder="请选择科室类型" [(ngModel)]="searchDto.deptTypeId">
16
+                <ng-container *ngFor="let option of deptTypeList">
17
+                  <nz-option *ngIf="!isLoading" [nzLabel]="option.name" [nzValue]="option.id"></nz-option>
18
+                </ng-container>
19
+                <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
20
+                  <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
21
+                </nz-option>
22
+              </nz-select>
23
+            </div>
24
+            <div class="list-template__searchItem">
25
+              <span class="label">楼栋</span>:
26
+              <nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch
27
+                (nzOnSearch)="changeInp('search', 'building', $event)" nzAllowClear nzPlaceHolder="请选择楼栋" [(ngModel)]="searchDto.buildId">
28
+                <ng-container *ngFor="let option of buildingSearchList">
29
+                  <nz-option *ngIf="!isLoading" [nzLabel]="option.buildingName" [nzValue]="option.id"></nz-option>
30
+                </ng-container>
31
+                <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
32
+                  <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
33
+                </nz-option>
34
+              </nz-select>
35
+            </div>
36
+          </div>
37
+          <div nz-col nzLg="5" class="list-template__btns">
38
+            <button nz-button class="btn default mr8" (click)='search()'>搜索</button>
39
+            <button nz-button class="btn default mr8" (click)='reset()'>重置</button>
40
+          </div>
41
+        </div> -->
42
+        <div class="list-template__bottom">
43
+          <nz-table class="hospitalTable" [nzData]="historySpecimenList" nzSize="middle" [nzShowPagination]="false"
44
+            [nzLoading]="hsLoading" [nzScroll]="{ y: '506px' }">
45
+            <thead>
46
+              <tr class="thead">
47
+                <th nzWidth="20%">模板名称</th>
48
+                <th nzWidth="60%">操作时间</th>
49
+                <th nzWidth="20%">操作</th>
50
+              </tr>
51
+            </thead>
52
+            <tbody>
53
+              <tr *ngFor="let data of historySpecimenList;let i = index;">
54
+                <td>{{ data.name }}</td>
55
+                <td>{{ data.addTime | date: 'yyyy-MM-dd HH:mm' }}</td>
56
+                <td>
57
+                  <div class="coop">
58
+                    <span (click)="bringIn(data)">引入</span>
59
+                    <span (click)="showDelModal(data,'您确认要删除此模板吗?','删除','del')">删除</span>
60
+                  </div>
61
+                </td>
62
+              </tr>
63
+            </tbody>
64
+          </nz-table>
65
+          <div class="list-template__pagination">
66
+            <nz-pagination [(nzPageIndex)]="historySpecimenPageIndex" [(nzTotal)]="historySpecimenListLength"
67
+              [(nzPageSize)]="historySpecimenPageSize" (nzPageIndexChange)="getList()"
68
+              (nzPageSizeChange)="getList()" nzShowSizeChanger [nzPageSizeOptions]="[10,100]">
69
+            </nz-pagination>
70
+          </div>
71
+        </div>
72
+      </div>
73
+    </div>
74
+    <div class="display_flex justify-content_flex-center">
75
+      <button class="btn know" nz-button nzType="primary" (click)="hideModal()">
76
+        知道了
77
+      </button>
78
+    </div>
79
+  </div>
80
+</div>
81
+<!-- 模态框 -->
82
+<app-dialog-delete [delModal]="delModal" (hideDelModalEvent)="hideDelModal()" [btnLoading]="btnLoading"
83
+(confirmDelEvent)="confirmDel()" [content]="tipsMsg1"></app-dialog-delete>
84
+<!-- 操作成功/失败提示框 -->
85
+<app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
86
+  [info]="promptInfo">
87
+</app-prompt-modal>

+ 190 - 0
src/app/share/inspection-template-prompt-modal/inspection-template-prompt-modal.component.less

@@ -0,0 +1,190 @@
1
+@import "../../../../src/theme.less";
2
+.modal {
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: 999;
10
+  .hospitalTable {
11
+    width: 100%;
12
+    td {
13
+      text-align: center !important;
14
+    }
15
+    .thead {
16
+      background-image: linear-gradient(to right, @bg-start, @bg-end);
17
+      th {
18
+        text-align: center !important;
19
+        color: #fff;
20
+        background: transparent;
21
+      }
22
+    }
23
+  }
24
+
25
+  .coop {
26
+    text-align: center;
27
+    button{
28
+      color: #333;
29
+    }
30
+    span,button {
31
+      display: inline-block;
32
+      padding: 0 8px;
33
+      cursor: pointer;
34
+      position: relative;
35
+
36
+      &::after {
37
+        content: "|";
38
+        position: absolute;
39
+        top: 0;
40
+        right: 0;
41
+      }
42
+
43
+      &:hover,
44
+      &:active {
45
+        color: @primary-color;
46
+      }
47
+
48
+      &:nth-last-child(1) {
49
+        &::after {
50
+          content: "";
51
+        }
52
+      }
53
+    }
54
+  }
55
+
56
+  .modalBody {
57
+    width: 950px;
58
+    min-height: 220px;
59
+    background: #fff;
60
+    border-radius: 5px;
61
+    padding: 10px 20px;
62
+    color: #333;
63
+    &.modalBody-search {
64
+      width: 480px;
65
+      min-height: 250px;
66
+    }
67
+
68
+    .title {
69
+      width: 100%;
70
+      text-align: center;
71
+      font-size: 18px;
72
+      position: relative;
73
+
74
+      i {
75
+        position: absolute;
76
+        right: 0;
77
+        top: 0;
78
+        font-size: 20px;
79
+        color: #666;
80
+        cursor: pointer;
81
+        padding: 0 5px;
82
+      }
83
+    }
84
+
85
+    .list-template{
86
+      padding: 0!important;
87
+    }
88
+
89
+    .list-template__bottom{
90
+      border: none!important;
91
+    }
92
+
93
+    .content {
94
+      min-height: 117px;
95
+      background: #f9fafb;
96
+      border: 1px solid #e5e9ed;
97
+      border-radius: 5px;
98
+      overflow: hidden;
99
+      margin-top: 12px;
100
+      display: flex;
101
+      flex-direction: column;
102
+      justify-content: center;
103
+      // align-items: center;
104
+      &.content-search {
105
+        min-height: 147px;
106
+        justify-content: start;
107
+        .defeat-search {
108
+          width: 100%;
109
+          height: 52px;
110
+          display: flex;
111
+          justify-content: center;
112
+          align-items: center;
113
+          border-bottom: solid 1px #e5e9ed;
114
+          em {
115
+            color: #666;
116
+            font-style: normal;
117
+          }
118
+        }
119
+        .form {
120
+          width: 100%;
121
+          padding: 0 16px;
122
+          .ant-form-item-label,
123
+          .ant-form-explain {
124
+            text-align: left !important;
125
+          }
126
+        }
127
+      }
128
+
129
+      div {
130
+        text-align: right;
131
+        margin: 0;
132
+      }
133
+      button{
134
+        margin-top: 0!important;
135
+        margin-left: 0!important;
136
+      }
137
+      .formItem{
138
+        text-align: left!important;
139
+      }
140
+    }
141
+
142
+    button {
143
+      margin-top: 10px;
144
+
145
+      &.btn {
146
+        margin-left: 8px;
147
+      }
148
+    }
149
+  }
150
+
151
+  // 新增
152
+  &.add {
153
+    .modalBody {
154
+      width: 480px;
155
+      height: auto;
156
+
157
+      .content {
158
+        width: 100%;
159
+        height: auto;
160
+        padding: 18px 14px 0 14px;
161
+
162
+        .addForm {
163
+          .ant-form-item {
164
+            margin-bottom: 15px;
165
+
166
+            .ant-form-item-label {
167
+              line-height: 0;
168
+            }
169
+          }
170
+        }
171
+
172
+        .editForm {
173
+          .ant-form-item {
174
+            margin-bottom: 15px;
175
+
176
+            .ant-form-item-label {
177
+              line-height: 0;
178
+            }
179
+          }
180
+        }
181
+      }
182
+
183
+      button {
184
+        &:nth-child(1) {
185
+          margin-right: 20px;
186
+        }
187
+      }
188
+    }
189
+  }
190
+}

+ 225 - 0
src/app/share/inspection-template-prompt-modal/inspection-template-prompt-modal.component.ts

@@ -0,0 +1,225 @@
1
+import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
2
+import { MainService } from '../../services/main.service';
3
+import { ToolService } from 'src/app/services/tool.service';
4
+import { Subject } from 'rxjs';
5
+import { debounceTime } from 'rxjs/operators';
6
+import { NzMessageService } from 'ng-zorro-antd';
7
+
8
+@Component({
9
+  selector: 'app-inspection-template-prompt-modal',
10
+  templateUrl: './inspection-template-prompt-modal.component.html',
11
+  styleUrls: ['./inspection-template-prompt-modal.component.less']
12
+})
13
+export class InspectionTemplatePromptModalComponent implements OnInit {
14
+  // 切换科室,切换弹窗
15
+  hsLoading = false;
16
+  historySpecimenList: any = [];
17
+  historySpecimenPageIndex: number = 1;//表格当前页码
18
+  historySpecimenPageSize: number = 10;//表格每页展示条数
19
+  historySpecimenListLength: number = 0;//表格总数据量
20
+
21
+  currentHospital; //当前院区
22
+  searchDto: any = {};
23
+
24
+  changeInpSubject = new Subject(); //防抖
25
+
26
+  @Input() show: Boolean;
27
+
28
+  @Output() confirmModelHs = new EventEmitter<any>();//1.组件暴露一个 EventEmitter 属性,当事件发生时,子组件利用该属性 emits(向上弹射)事件
29
+  @Output() closeModelHs = new EventEmitter<any>();//1.组件暴露一个 EventEmitter 属性,当事件发生时,子组件利用该属性 emits(向上弹射)事件
30
+
31
+  constructor(
32
+    private mainService: MainService,
33
+    private tool: ToolService,
34
+    private message: NzMessageService,
35
+  ) { }
36
+
37
+  ngOnInit() {
38
+    //防抖
39
+    this.changeInpSubject.pipe(debounceTime(500)).subscribe((v) => {
40
+      if(v[1] === 'building'){
41
+        this.getBuildings(v[0], v[2]);
42
+      }
43
+    });
44
+    this.currentHospital = this.tool.getCurrentHospital();
45
+    this.getList();
46
+    // this.getBuildings('search', '');
47
+    // this.getDeptTypeList();
48
+  }
49
+
50
+  // 搜索
51
+  search() {
52
+    this.getList();
53
+  }
54
+  // 重置
55
+  reset() {
56
+    this.searchDto = {};
57
+    this.mapOfCheckedId = {};
58
+    this.checkedDepIds = [];
59
+    this.isAllDisplayDataChecked = false;
60
+    this.getList(1);
61
+  }
62
+
63
+  //获取科室类型
64
+  deptTypeList:any[] = [];
65
+  getDeptTypeList() {
66
+    this.mainService
67
+    .getDictionary('list', 'dept_type')
68
+    .subscribe((data) => {
69
+      this.deptTypeList = data || [];
70
+    });
71
+  }
72
+
73
+  // 边输边搜节流阀
74
+  isLoading = false;
75
+  changeInp(type, model, e) {
76
+    this.isLoading = true;
77
+    this.changeInpSubject.next([type, model, e]);
78
+  }
79
+
80
+  // 获取楼栋
81
+  buildingSearchList: any = [];
82
+  getBuildings(type, keyword, init = false) {
83
+    let postData = {
84
+      building: {
85
+        simpleQuery: true,
86
+        buildingName: keyword,
87
+        cascadeHosId: this.currentHospital.id,
88
+      },
89
+      idx: 0,
90
+      sum: 20,
91
+    };
92
+    this.mainService
93
+      .getFetchDataList("simple/data", "building", postData)
94
+      .subscribe((data) => {
95
+        this.buildingSearchList = data.list;
96
+        this.isLoading = false;
97
+      });
98
+  }
99
+
100
+  // 选中表格单列
101
+  mapOfCheckedId: { [key: string]: boolean } = {};
102
+  checkedDepIds = []; //已选中单列id
103
+  refreshStatus(): void {
104
+    let listOfData = this.historySpecimenList;
105
+    this.isAllDisplayDataChecked = listOfData.every(
106
+      (item) => this.mapOfCheckedId[item.id]
107
+    );
108
+    let arr = [];
109
+    for (var k in this.mapOfCheckedId) {
110
+      if (this.mapOfCheckedId[k]) {
111
+        arr.push(Number(k));
112
+      }
113
+    }
114
+    this.checkedDepIds = arr;
115
+  }
116
+  // 整行操作
117
+  selectedListData(data) {
118
+    this.mapOfCheckedId[data.id] = !this.mapOfCheckedId[data.id];
119
+    this.refreshStatus();
120
+  }
121
+  // 全选
122
+  isAllDisplayDataChecked = false; //当前页是否全选
123
+  checkAll(value: boolean): void {
124
+    this.historySpecimenList.forEach((item) => {
125
+      this.mapOfCheckedId[item.id] = value;
126
+    });
127
+    this.refreshStatus();
128
+  }
129
+  // 关闭弹窗
130
+  hideModal() {
131
+    this.closeModelHs.emit(JSON.stringify({ show: false }));//emits(向上弹射)事件
132
+  }
133
+  // 获取列表数据
134
+  getList(idx?) {
135
+    if (idx) {
136
+      this.historySpecimenPageIndex = 1;
137
+    }
138
+    let postData = {
139
+      idx: this.historySpecimenPageIndex - 1,
140
+      sum: this.historySpecimenPageSize,
141
+      inspectionTemplate: {
142
+        hosId: this.currentHospital.id,
143
+      }
144
+    }
145
+    this.hsLoading = true;
146
+    this.mainService.getFetchDataList("simple/data", "inspectionTemplate", postData).subscribe(data => {
147
+      this.hsLoading = false;
148
+      this.historySpecimenList = data.list || [];
149
+      this.historySpecimenListLength = data.totalNum || 0;
150
+    })
151
+  }
152
+  // 添加表单提交
153
+  btnLoading: boolean = false; //提交按钮loading状态
154
+  submitForm(): void {
155
+    console.log(this.checkedDepIds);
156
+    if(this.checkedDepIds.length === 0){
157
+      this.message.warning('请选择科室');
158
+      return;
159
+    }
160
+    this.confirmModelHs.emit(this.checkedDepIds);//emits(向上弹射)事件
161
+  }
162
+
163
+  // 引入
164
+  bringIn(data){
165
+    this.confirmModelHs.emit(data.id);//emits(向上弹射)事件
166
+  }
167
+
168
+  // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
169
+  promptContent: string; //操作提示框提示信息
170
+  ifSuccess: boolean; //操作成功/失败
171
+  promptInfo: string; //操作结果提示信息
172
+  promptModalShow: boolean; //操作提示框是否展示
173
+  showPromptModal(con, success, promptInfo?) {
174
+    this.promptModalShow = false;
175
+    this.promptContent = con;
176
+    this.ifSuccess = success;
177
+    this.promptInfo = promptInfo;
178
+    setTimeout(() => {
179
+      this.promptModalShow = true;
180
+    }, 100);
181
+    this.getList();
182
+  }
183
+
184
+  delModal: boolean = false; //删除模态框
185
+  tipsMsg1: string; //提示框信息
186
+  tipsMsg2: string; //操作后信息
187
+  confirmDelType: string; //确认的类型(启用/停用,删除)
188
+  coopData: any; //当前操作列
189
+  showDelModal(
190
+    data,
191
+    tipsMsg1: string,
192
+    tipsMsg2: string,
193
+    type: string,
194
+  ) {
195
+    this.confirmDelType = type;
196
+    this.delModal = true;
197
+    this.coopData = data;
198
+    this.tipsMsg1 = tipsMsg1;
199
+    this.tipsMsg2 = tipsMsg2;
200
+  }
201
+  // 隐藏删除框
202
+  hideDelModal() {
203
+    this.delModal = false;
204
+  }
205
+  // 确认删除
206
+  confirmDel() {
207
+    this.btnLoading = true;
208
+    if (this.confirmDelType === "del") {
209
+      //删除
210
+      this.mainService
211
+        .simplePost("rmvData", "inspectionTemplate", [this.coopData.id])
212
+        .subscribe((data) => {
213
+          this.btnLoading = false;
214
+          this.delModal = false;
215
+          if (data.status == 200) {
216
+            this.showPromptModal(this.tipsMsg2, true, "");
217
+          } else {
218
+            this.showPromptModal(this.tipsMsg2, false, data.msg);
219
+          }
220
+        });
221
+    }
222
+  }
223
+}
224
+
225
+

+ 3 - 0
src/app/share/share.module.ts

@@ -13,6 +13,7 @@ import { HsPromptModalComponent } from './hs-prompt-modal/hs-prompt-modal.compon
13 13
 import { HistoryPromptModalComponent } from './history-prompt-modal/history-prompt-modal.component';
14 14
 import { InspectionConfigurationItemPromptModalComponent } from './inspection-configuration-item-prompt-modal/inspection-configuration-item-prompt-modal.component';
15 15
 import { InspectionAddressDepartmentPromptModalComponent } from './inspection-address-department-prompt-modal/inspection-address-department-prompt-modal.component';
16
+import { InspectionTemplatePromptModalComponent } from './inspection-template-prompt-modal/inspection-template-prompt-modal.component';
16 17
 import { InspectionAddressTagPromptModalComponent } from './inspection-address-tag-prompt-modal/inspection-address-tag-prompt-modal.component';
17 18
 import { DetailSampleComponent } from './detail-sample/detail-sample.component';
18 19
 import { DetailPatientsComponent } from './detail-patients/detail-patients.component';
@@ -67,6 +68,7 @@ import { OutgoingRecordDetailComponent } from './outgoing-record-detail/outgoing
67 68
     HistoryPromptModalComponent,
68 69
     InspectionConfigurationItemPromptModalComponent,
69 70
     InspectionAddressDepartmentPromptModalComponent,
71
+    InspectionTemplatePromptModalComponent,
70 72
     InspectionAddressTagPromptModalComponent,
71 73
     BusinessDataDetailModalComponent,
72 74
     RelationTransDetailModalComponent,
@@ -125,6 +127,7 @@ import { OutgoingRecordDetailComponent } from './outgoing-record-detail/outgoing
125 127
     HistoryPromptModalComponent,
126 128
     InspectionConfigurationItemPromptModalComponent,
127 129
     InspectionAddressDepartmentPromptModalComponent,
130
+    InspectionTemplatePromptModalComponent,
128 131
     InspectionAddressTagPromptModalComponent,
129 132
     BusinessDataDetailModalComponent,
130 133
     RelationTransDetailModalComponent,

+ 4 - 3
src/app/share/template-name/template-name.component.html

@@ -3,12 +3,13 @@
3 3
     <div class="title">保存并存为模板<i class="icon_transport transport-guanbi" (click)="hideModal()"></i>
4 4
     </div>
5 5
     <div class="content">
6
+      <div class="tips">您确认将本次相关配置存为模板吗?</div>
6 7
       <form nz-form [formGroup]="validateForm" class="addForm">
7 8
         <nz-form-item>
8
-          <nz-form-label class="line_height_normal" [nzSpan]="5" nzRequired nzFor="name">名&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;称</nz-form-label>
9
-          <nz-form-control [nzSpan]="19" nzErrorTip="请输入名称!">
9
+          <nz-form-label class="line_height_normal" [nzSpan]="5" nzRequired nzFor="name">模板名称</nz-form-label>
10
+          <nz-form-control [nzSpan]="19" nzErrorTip="请输入模板名称!">
10 11
             <nz-input-group>
11
-              <textarea formControlName="name" nz-input placeholder="请输入名称"></textarea>
12
+              <textarea formControlName="name" nz-input placeholder="请输入模板名称"></textarea>
12 13
             </nz-input-group>
13 14
           </nz-form-control>
14 15
         </nz-form-item>

+ 4 - 0
src/app/share/template-name/template-name.component.less

@@ -39,6 +39,10 @@
39 39
       border-radius: 5px;
40 40
       overflow: hidden;
41 41
       margin-top: 12px;
42
+      
43
+      .tips{
44
+        margin-bottom: 19px;
45
+      }
42 46
 
43 47
       div {
44 48
         text-align: center;

+ 4 - 1
src/app/views/inspection-address/inspection-address.component.ts

@@ -301,6 +301,7 @@ export class InspectionAddressComponent implements OnInit {
301 301
     let postData = {
302 302
       tag: {
303 303
         hosId: this.currentHospital.id,
304
+        modelType: { value: 'inspection' },
304 305
       },
305 306
       idx: 0,
306 307
       sum: 50,
@@ -454,7 +455,8 @@ export class InspectionAddressComponent implements OnInit {
454 455
         this.isLoading = false;
455 456
         console.log(result);
456 457
         if(result.status == 200){
457
-
458
+          this.tagListCopy.unshift(result.data)
459
+          console.log(this.tagListCopy);
458 460
         } else if (result.status == 10001){
459 461
           // 名称重复
460 462
           this.tagListCopy.unshift(result.data)
@@ -586,6 +588,7 @@ export class InspectionAddressComponent implements OnInit {
586 588
       this.promptModalShow = true;
587 589
     }, 100);
588 590
     this.getList(0);
591
+    this.getTags('add', '');
589 592
   }
590 593
 
591 594
   delModal: boolean = false; //删除模态框

+ 10 - 48
src/app/views/inspection-plan-config/inspection-plan-config.component.html

@@ -2,56 +2,10 @@
2 2
   <div class="tagsAndTemplete">
3 3
     <div class="tags">
4 4
       <i class="icon_transport transport-24gf-tags"></i>
5
-      <span>数量核对</span>
6
-      <span>数量核对</span>
7
-      <span>数量核对</span>
8
-      <span>数量核对</span>
9
-      <span>数量核对</span>
10
-      <span>数量核对</span>
11
-      <span>数量核对</span>
12
-      <span>数量核对</span>
13
-      <span>数量核对</span>
14
-      <span>数量核对</span>
15
-      <span>数量核对</span>
16
-      <span>数量核对</span>
17
-      <span>数量核对</span>
18
-      <span>数量核对</span>
19
-      <span>数量核对</span>
20
-      <span>数量核对</span>
21
-      <span>数量核对</span>
22
-      <span>数量核对</span>
23
-      <span>数量核对</span>
24
-      <span>数量核对</span>
25
-      <span>数量核对</span>
26
-      <span>数量核对</span>
27
-      <span>数量核对</span>
28
-      <span>数量核对</span>
29
-      <span>数量核对</span>
30
-      <span>数量核对</span>
31
-      <span>数量核对</span>
32
-      <span>数量核对</span>
33
-      <span>数量核对</span>
34
-      <span>数量核对</span>
35
-      <span>数量核对</span>
36
-      <span>数量核对</span>
37
-      <span>数量核对</span>
38
-      <span>数量核对</span>
39
-      <span>数量核对</span>
40
-      <span>数量核对</span>
41
-      <span>数量核对</span>
42
-      <span>数量核对</span>
43
-      <span>数量核对</span>
44
-      <span>数量核对</span>
45
-      <span>数量核对</span>
46
-      <span>数量核对</span>
47
-      <span>数量核对</span>
48
-      <span>数量核对</span>
49
-      <span>数量核对</span>
50
-      <span>数量核对</span>
51
-      <span>数量核对</span>
5
+      <span *ngFor="let tag of tagList" (click)="clickTag(tag)">{{ tag.name }}</span>
52 6
     </div>
53 7
     <div class="template">
54
-      <button nz-button class="btn default">引入模板</button>
8
+      <button nz-button class="btn default" (click)="showInspectionTemplate()">引入模板</button>
55 9
     </div>
56 10
   </div>
57 11
 
@@ -133,5 +87,13 @@
133 87
 (submitFormHand)="submitFormHand($event)"
134 88
 (cancelFlagHand)="cancelFlagHand($event)"
135 89
 *ngIf="templateFlag"></app-template-name>
90
+
91
+<!-- 引入模板 -->
92
+<app-inspection-template-prompt-modal
93
+  *ngIf="inspectionTemplatePromptModalShow"
94
+  [show]="inspectionTemplatePromptModalShow"
95
+  (closeModelHs)="closeModelInspectionTemplate($event)"
96
+  (confirmModelHs)="confirmModelInspectionTemplate($event)"
97
+></app-inspection-template-prompt-modal>
136 98
 <!-- 遮罩 -->
137 99
 <app-mask *ngIf="maskFlag"></app-mask>

+ 1 - 1
src/app/views/inspection-plan-config/inspection-plan-config.component.less

@@ -20,7 +20,6 @@
20 20
         flex: 1;
21 21
         padding: 16px 64px;
22 22
         display: flex;
23
-        justify-content: space-between;
24 23
         align-items: center;
25 24
         flex-wrap: wrap;
26 25
         gap: 16px;
@@ -62,6 +61,7 @@
62 61
       background: #F9FAFB;
63 62
       border: 1px solid #EEF3F9;
64 63
       border-radius: 16px;
64
+      margin-top: 16px;
65 65
       .contentInner{
66 66
         flex: 1;
67 67
         display: flex;

+ 204 - 53
src/app/views/inspection-plan-config/inspection-plan-config.component.ts

@@ -6,7 +6,7 @@ import uniqBy from 'lodash-es/uniqBy'
6 6
 import cloneDeep from 'lodash-es/cloneDeep'
7 7
 import { OverlayScrollbarsComponent } from 'overlayscrollbars-ngx';
8 8
 import { Router, ActivatedRoute } from '@angular/router';
9
-import { Subject } from 'rxjs';
9
+import { Subject, forkJoin } from 'rxjs';
10 10
 import { debounceTime } from 'rxjs/operators';
11 11
 
12 12
 @Component({
@@ -52,10 +52,45 @@ export class InspectionPlanConfigComponent implements OnInit, AfterViewInit {
52 52
       }
53 53
     });
54 54
     this.currentHospital = this.tool.getCurrentHospital();
55
-    this.getPlanDetail();
56
-    this.getAddressList();
57 55
     this.getUsers();
58 56
     this.getGroups();
57
+    this.getInfo();
58
+  }
59
+
60
+  getInfo(){
61
+    let getPlanDetail$ = this.getPlanDetail();
62
+    let getAddressList$ = this.getAddressList();
63
+    let getTagList$ = this.getTagList();
64
+    this.maskFlag = this.message.loading("正在加载中..", {
65
+      nzDuration: 0,
66
+    }).messageId;
67
+    forkJoin(getPlanDetail$, getAddressList$, getTagList$).subscribe((res:any) => {
68
+      this.message.remove(this.maskFlag);
69
+      this.maskFlag = false;
70
+      // getPlanDetail
71
+      {
72
+        this.planDetail = res[0].data || {};
73
+        let nodeList = res[0].data ? (res[0].data.nodeList || []) : [];
74
+        this.generateTree(nodeList);
75
+      }
76
+      // getAddressList
77
+      {
78
+        if (res[1].status == 200) {
79
+          let addressList = res[1].list || [];
80
+          let buildingAndAddressList = this.generateList(addressList);
81
+          this.buildingAndAddressList = this.tool.tranListToTreeData(buildingAndAddressList, undefined, "parentId", "key");
82
+          console.log(this.buildingAndAddressList);
83
+        }else{
84
+          this.message.error(res[1].msg || "请求数据失败");
85
+        }
86
+      }
87
+      // getTagList
88
+      {
89
+        if (res[2].status == 200) {
90
+          this.tagList = res[2].list || [];
91
+        }
92
+      }
93
+    });
59 94
   }
60 95
 
61 96
   // 表格数据
@@ -70,43 +105,8 @@ export class InspectionPlanConfigComponent implements OnInit, AfterViewInit {
70 105
         hosId: this.currentHospital.id,
71 106
       },
72 107
     };
73
-    this.isLoading = true;
74
-    this.mainService
75
-      .getFetchDataList("simple/data", "inspectionNode", data)
76
-      .subscribe((data) => {
77
-        this.isLoading = false;
78
-        if (data.status == 200) {
79
-          let addressList = data.list || [];
80
-          // 楼栋
81
-          let buildingList = addressList.map((item) => {
82
-            return {
83
-              title: item.buildingDTO.buildingName,
84
-              key: 'b-' + item.buildingDTO.id,
85
-              children: [],
86
-              selectable: false,
87
-              hosId: this.currentHospital.id,
88
-            }
89
-          })
90
-          buildingList = uniqBy(buildingList, "key");
91
-          // 巡检点
92
-          addressList = addressList.map((item) => {
93
-            return {
94
-              title: item.name,
95
-              key: item.id.toString(),
96
-              parentId: 'b-' + item.buildingDTO.id,
97
-              isLeaf: true,
98
-              selectable: false,
99
-              hosId: this.currentHospital.id,
100
-            }
101
-          })
102
-          let buildingAndAddressList = buildingList.concat(addressList);
103
-          console.log(buildingAndAddressList);
104
-          this.buildingAndAddressList = this.tool.tranListToTreeData(buildingAndAddressList, undefined, "parentId", "key");
105
-          console.log(this.buildingAndAddressList);
106
-        }else{
107
-          this.message.error(data.msg || "请求数据失败");
108
-        }
109
-      });
108
+
109
+    return this.mainService.getFetchDataList("simple/data", "inspectionNode", data)
110 110
   }
111 111
 
112 112
   nzCheck(event: NzFormatEmitEvent): void {
@@ -188,7 +188,7 @@ export class InspectionPlanConfigComponent implements OnInit, AfterViewInit {
188 188
         menuId: 414,
189 189
       },
190 190
       idx: 0,
191
-      sum: 20,
191
+      sum: 10,
192 192
     };
193 193
     this.mainService
194 194
       .getFetchDataList("data", "user", postData)
@@ -208,7 +208,7 @@ export class InspectionPlanConfigComponent implements OnInit, AfterViewInit {
208 208
         type: 1,
209 209
       },
210 210
       idx: 0,
211
-      sum: 20,
211
+      sum: 10,
212 212
     };
213 213
     this.mainService
214 214
       .getFetchDataList("data", "group2", postData)
@@ -226,36 +226,129 @@ export class InspectionPlanConfigComponent implements OnInit, AfterViewInit {
226 226
     this.activeAddress = event.node;
227 227
     this.activeAddressId = event.selectedKeys[0];
228 228
     this.activeAddress.origin.radioValue = event.node.origin.userId ? 1 : (event.node.origin.groupId ? 2 : undefined);
229
+    if(event.node.origin.userId){
230
+      let flag = this.userList.find(v => v.id === event.node.origin.userId);
231
+      if(!flag){
232
+        this.userList.unshift({ id: event.node.origin.userId, name: event.node.origin.userName })
233
+      }
234
+    }
235
+
236
+    if(event.node.origin.groupId){
237
+      let flag = this.groupList.find(v => v.id === event.node.origin.groupId);
238
+      if(!flag){
239
+        this.groupList.unshift({ id: event.node.origin.groupId, groupName: event.node.origin.groupName })
240
+      }
241
+    }
229 242
   }
230 243
 
231 244
   // 计划详情
232 245
   planDetail:any = {};
233
-  nodeList:any[] = [];
234 246
   getPlanDetail(){
247
+    return this.mainService.getFetchData("simple/data", "inspection", +this.route.snapshot.paramMap.get('id'));
248
+  }
249
+
250
+  // 标签
251
+  tagList:any = [];
252
+  getTagList(){
253
+    let postData = {
254
+      idx: 0,
255
+      sum: 99,
256
+      tag: {
257
+        hosId: this.currentHospital.id,
258
+        onlyBind: 1,
259
+        modelType: { value: 'inspection' },
260
+      }
261
+    }
262
+    return this.mainService.getFetchDataList("simple/data", "tag", postData)
263
+  }
264
+
265
+  // 点击标签
266
+  clickTag(tag){
267
+    this.maskFlag = this.message.loading("正在加载中..", {
268
+      nzDuration: 0,
269
+    }).messageId;
270
+    let postData = {
271
+      inspectionNode: {
272
+        hosId: this.currentHospital.id,
273
+        tagIds: tag.id.toString(),
274
+      },
275
+      idx: 0,
276
+      sum: 9999,
277
+    };
235 278
     this.mainService
236
-      .getFetchData("simple/data", "inspection", +this.route.snapshot.paramMap.get('id'))
237
-      .subscribe((data) => {
238
-        this.planDetail = data.data || {};
239
-        let nodeList = data.data ? (data.data.nodeList || []) : [];
240
-        this.generateTree(nodeList);
279
+      .getFetchDataList("simple/data", "inspectionNode", postData)
280
+      .subscribe((result) => {
281
+        this.message.remove(this.maskFlag);
282
+        this.maskFlag = false;
283
+        let addressList = result.list || [];
284
+        let buildingAndAddressListCopy = this.generateList(addressList, true);
285
+        console.log(buildingAndAddressListCopy);
286
+        this.defaultCheckedKeys = buildingAndAddressListCopy.map(v => v.key).filter(v => !(/b-/.test(v)));
287
+        this.buildingAndAddressListCopy = this.tool.tranListToTreeData(buildingAndAddressListCopy, undefined, "parentId", "key");
288
+        console.log(this.buildingAndAddressListCopy);
241 289
       });
242 290
   }
243 291
 
244 292
   // 回显树形结构
245 293
   generateTree(nodeList){
246
-    console.log('nodeList:' + nodeList);
294
+    console.log('nodeList:', nodeList);
247 295
     let buildingAndAddressList = nodeList.map(v => ({
248 296
       title: v.nodeId ? v.inspectionNodeDTO.name : v.buildingDTO.buildingName,
249 297
       key: v.nodeId ? `${v.nodeId}` : `b-${v.buildId}`,
250
-      parentId: v.buildId ? `b-${v.buildId}` : undefined,
298
+      parentId: v.nodeId ? `b-${v.buildId}` : undefined,
299
+      hosId: v.hosId,
300
+      children: [],
301
+      selectable: false,
302
+      isLeaf: Boolean(v.nodeId),
303
+      checked: false,
304
+    }));
305
+    this.defaultCheckedKeys = buildingAndAddressList.map(v => v.key).filter(v => !(/b-/.test(v)));
306
+    let buildingAndAddressListCopy = nodeList.map(v => ({
307
+      title: v.nodeId ? v.inspectionNodeDTO.name : v.buildingDTO.buildingName,
308
+      key: v.nodeId ? `${v.nodeId}` : `b-${v.buildId}`,
309
+      parentId: v.nodeId ? `b-${v.buildId}` : undefined,
251 310
       userId: v.userId,
311
+      userName: v.userDTO ? v.userDTO.name : undefined,
252 312
       groupId: v.groupId,
313
+      groupName: v.groupDTO ? v.groupDTO.name : undefined,
253 314
       hosId: v.hosId,
254 315
       children: [],
255
-      selectable: false,
316
+      selectable: true,
256 317
       isLeaf: Boolean(v.nodeId),
318
+      checked: false,
257 319
     }));
258
-    console.log('buildingAndAddressList:' + buildingAndAddressList);
320
+    console.log('buildingAndAddressList:', buildingAndAddressList);
321
+    this.buildingAndAddressListCopy = this.tool.tranListToTreeData(buildingAndAddressListCopy, undefined, "parentId", "key");
322
+    console.log('this.buildingAndAddressListCopy', this.buildingAndAddressListCopy);
323
+  }
324
+
325
+  // 处理巡检点数据
326
+  generateList(addressList, selectableFlag = false){
327
+    // 楼栋
328
+    let buildingList = addressList.map((item) => {
329
+      return {
330
+        title: item.buildingDTO.buildingName,
331
+        key: 'b-' + item.buildingDTO.id,
332
+        children: [],
333
+        selectable: selectableFlag,
334
+        hosId: this.currentHospital.id,
335
+      }
336
+    })
337
+    buildingList = uniqBy(buildingList, "key");
338
+    // 巡检点
339
+    addressList = addressList.map((item) => {
340
+      return {
341
+        title: item.name,
342
+        key: item.id.toString(),
343
+        parentId: 'b-' + item.buildingDTO.id,
344
+        isLeaf: true,
345
+        selectable: selectableFlag,
346
+        hosId: this.currentHospital.id,
347
+      }
348
+    })
349
+    let buildingAndAddressList = buildingList.concat(addressList);
350
+    console.log(buildingAndAddressList);
351
+    return buildingAndAddressList;
259 352
   }
260 353
 
261 354
   // 填写模板名称-确定
@@ -295,7 +388,7 @@ export class InspectionPlanConfigComponent implements OnInit, AfterViewInit {
295 388
           this.message.success("保存成功");
296 389
           this.router.navigateByUrl("/main/inspectionPlan");
297 390
         } else {
298
-          this.message.success(result.msg || '保存失败');
391
+          this.message.error(result.msg || '保存失败');
299 392
         }
300 393
       });
301 394
   }
@@ -324,7 +417,65 @@ export class InspectionPlanConfigComponent implements OnInit, AfterViewInit {
324 417
 
325 418
   // 保存
326 419
   save(){
420
+    this.maskFlag = this.message.loading("正在加载中..", {
421
+      nzDuration: 0,
422
+    }).messageId;
423
+    let nodeList = this.tool.tranTreeToListData(this.buildingAndAddressListCopy).map(v => ({
424
+      nodeId: v.parentId ? Number(v.key) : undefined,
425
+      userId: v.userId,
426
+      groupId: v.groupId,
427
+      hosId: v.hosId,
428
+      buildId: v.parentId ? Number(v.parentId.replace(/b-/, '')): Number(v.key.replace(/b-/, '')),
429
+    }));
430
+    console.log(nodeList);
327 431
     console.log('保存');
432
+    let postData = {
433
+      ...this.planDetail,
434
+      nodeList,
435
+    };
436
+    console.log(postData);
437
+    this.mainService
438
+      .simplePost("addData", "inspection", postData)
439
+      .subscribe((result) => {
440
+        this.message.remove(this.maskFlag);
441
+        this.maskFlag = false;
442
+        if (result.status == 200) {
443
+          this.message.success("保存成功");
444
+          this.router.navigateByUrl("/main/inspectionPlan");
445
+        } else {
446
+          this.message.error(result.msg || '保存失败');
447
+        }
448
+      });
449
+  }
450
+
451
+  // 引入模板
452
+  inspectionTemplatePromptModalShow = false;
453
+  showInspectionTemplate() {
454
+    this.inspectionTemplatePromptModalShow = true;
455
+  }
456
+  // 关闭弹窗
457
+  closeModelInspectionTemplate(e) {
458
+    this.inspectionTemplatePromptModalShow = JSON.parse(e).show;
459
+  }
460
+  // 确认弹窗
461
+  confirmModelInspectionTemplate(tempId) {
462
+    this.inspectionTemplatePromptModalShow = false;
463
+    this.maskFlag = this.message.loading("正在加载中..", {
464
+      nzDuration: 0,
465
+    }).messageId;
466
+    let postData = {
467
+      idx: 0,
468
+      sum: 9999,
469
+      inspectionTempNodes: {
470
+        tempId,
471
+      }
472
+    }
473
+    this.mainService.getFetchDataList("simple/data", "inspectionTempNodes", postData).subscribe((result:any) => {
474
+      this.message.remove(this.maskFlag);
475
+      this.maskFlag = false;
476
+      let nodeList = result.list || [];
477
+      this.generateTree(nodeList);
478
+    })
328 479
   }
329 480
 
330 481
   ngAfterViewInit(): void {

+ 1 - 4
src/app/views/inspection-plan/inspection-plan.component.html

@@ -63,7 +63,7 @@
63 63
                 <span *ngIf="coopBtns.edit" (click)="edit(data)">编辑</span>
64 64
                 <span *ngIf="coopBtns.edit" (click)="planConfig(data)">配置</span>
65 65
                 <span *ngIf="coopBtns.isStartUp && data.planType.value != 'none' && (data.status.value == '2' || data.status.value == '3')" (click)="showDelModal(data.id, data.status.value == 2 ? '您确认要停止巡检计划吗?' : '您确认要启动巡检计划吗?', data.status.value == 2 ? '停用' : '启用', 'switch', data.status.value == 2)">{{data.status.value == 2 ? '停用' : '启用'}}</span>
66
-                <span *ngIf="coopBtns.executeNow && data.status.value != '1'" (click)="openExecModal(data)">执行一次</span>
66
+                <span *ngIf="coopBtns.executeNow && data.status.value != '1'" (click)="showDelModal(data.id, '您确认立即执行计划一次吗?确认后会立即生成计划内配置的巡检任务', '执行一次', 'once')">执行一次</span>
67 67
               </div>
68 68
             </td>
69 69
           </tr>
@@ -209,8 +209,5 @@
209 209
 </app-prompt-modal>
210 210
 <!-- 查看详情 -->
211 211
 <router-outlet></router-outlet>
212
-<!-- 立即执行 -->
213
-<app-dialog-delete [delModal]="execModal" (hideDelModalEvent)="closeExecModal()" [btnLoading]="btnLoading"
214
-  (confirmDelEvent)="confirmExec()" content="您确认立即执行计划一次吗?确认后会立即生成计划内配置的巡检任务"></app-dialog-delete>
215 212
 <!-- 遮罩 -->
216 213
 <app-mask *ngIf="maskFlag"></app-mask>

+ 25 - 4
src/app/views/inspection-plan/inspection-plan.component.ts

@@ -397,7 +397,6 @@ export class InspectionPlanComponent implements OnInit {
397 397
     }
398 398
     //执行时间 end
399 399
   }
400
-  // 立即执行
401 400
   coopItem: any = {};
402 401
   execModal: boolean = false;
403 402
   // 打开立即执行模态框
@@ -488,9 +487,31 @@ export class InspectionPlanComponent implements OnInit {
488 487
     } else if (this.confirmDelType === "switch") {
489 488
       //启用/停用
490 489
       this.mainService
491
-        .switchRoundRobin(
492
-          this.confirmDelIsSwitch ? "stop" : "active",
493
-          this.coopId
490
+        .inspectionPost(
491
+          'inspectionPublish',
492
+          {
493
+            inspectionId: this.coopId,
494
+            type: this.confirmDelIsSwitch ? "disable" : "active",
495
+          }
496
+        )
497
+        .subscribe((data) => {
498
+          this.btnLoading = false;
499
+          this.delModal = false;
500
+          if (data.status == 200) {
501
+            this.showPromptModal(this.tipsMsg2, true, "");
502
+          } else {
503
+            this.showPromptModal(this.tipsMsg2, false, data.msg);
504
+          }
505
+        });
506
+    } else if (this.confirmDelType === "once") {
507
+      //执行一次
508
+      this.mainService
509
+        .inspectionPost(
510
+          'inspectionPublish',
511
+          {
512
+            inspectionId: this.coopId,
513
+            type: "executeOnece",
514
+          }
494 515
         )
495 516
         .subscribe((data) => {
496 517
           this.btnLoading = false;