浏览代码

整改上周的

seimin 1 年之前
父节点
当前提交
0a087a6c4b

+ 1 - 1
proxy.conf.json

@@ -1,6 +1,6 @@
1 1
 {
2 2
   "/service": {
3
-    "target": "http://192.168.3.108",
3
+    "target": "http://192.168.4.223",
4 4
     "logLevel": "debug",
5 5
     "changeOrigin": true,
6 6
     "pathRewrite": {

+ 23 - 11
src/app/views/data-dictionary/data-dictionary.component.html

@@ -1,23 +1,24 @@
1 1
 <div class="groupManagement">
2 2
   <div class="groupInfo">
3 3
     <div class="title">数据字典</div>
4
-    <div class="groups" [ngStyle]="{display:!dictionaryLoading?'block':'none'}">
4
+    <div class="groups">
5 5
       <overlay-scrollbars #osComponentRef1 [ngStyle]="{ height:'100%' }">
6 6
         <div [ngClass]="{'item':true,'checked':data.id == checkedDictionary.id}" *ngFor="let data of dictionaryList"
7 7
           (click)="checkDictionary(data)" [title]="data.dictionaryName">{{data.dictionaryName}}</div>
8 8
       </overlay-scrollbars>
9 9
     </div>
10
-    <div class="groups" *ngIf="dictionaryLoading">
11
-      <div class="loadingFull display_flex justify-content_flex-center align-items_center">
12
-        <div class="loadingFullInner">
13
-          <img src="../../../assets/images/loading.gif" alt="">
14
-          <div>加载中...</div>
15
-        </div>
16
-      </div>
17
-    </div>
18 10
   </div>
19 11
   <div class="userInfo">
20
-    <div class="top display_flex justify-content_flex-end align-items_center">
12
+    <div class="top display_flex justify-content_space-between align-items_center">
13
+      <div class="searchItem">
14
+        <span class="label">父级被服分类</span>:
15
+        <nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" [nzShowSearch]="false" nzAllowClear
16
+          nzPlaceHolder="请选择父级被服分类" [(ngModel)]="searchDto.parent" (ngModelChange)="getAll()">
17
+          <ng-container *ngFor="let data of parentList">
18
+            <nz-option [nzLabel]="data.name" [nzValue]="data.id"></nz-option>
19
+          </ng-container>
20
+        </nz-select>
21
+      </div>
21 22
       <div class="display_flex align-items_center">
22 23
         <span>已选择 {{selectedDictionary.length}} 个</span>
23 24
         <button class="btn default" *ngIf="coopBtns.add&&dictionaryList.length" nzType="primary" nz-button
@@ -34,10 +35,11 @@
34 35
             <th nzWidth="5%" nzShowCheckbox [(nzChecked)]="isAllDisplayDataChecked"
35 36
               (nzCheckedChange)="checkAll($event)"></th>
36 37
             <th nzWidth="15%">名称</th>
38
+            <th nzWidth="15%">父级被服分类</th>
37 39
             <th nzWidth="10%">值</th>
38 40
             <th nzWidth="10%">排序号</th>
39 41
             <th nzWidth="10%">单价</th>
40
-            <th nzWidth="30%">附加说明</th>
42
+            <th nzWidth="15%">附加说明</th>
41 43
             <th nzWidth="20%">操作</th>
42 44
           </tr>
43 45
         </thead>
@@ -46,6 +48,7 @@
46 48
             <td nzShowCheckbox [(nzDisabled)]="!coopBtns.edit" [(nzChecked)]="mapOfCheckedId[data.id]"
47 49
               (nzCheckedChange)="refreshStatus()"></td>
48 50
             <td>{{ data.name }}</td>
51
+            <td>{{ data.parentName }}</td>
49 52
             <td>{{ data.value }}</td>
50 53
             <td>{{ data.orders }}</td>
51 54
             <td>{{ data.extra3 }}</td>
@@ -78,6 +81,15 @@
78 81
             </nz-form-control>
79 82
           </nz-form-item>
80 83
           <nz-form-item>
84
+            <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="parent">父级被服分类</nz-form-label>
85
+            <nz-form-control nzErrorTip="请选择父级被服分类!">
86
+              <nz-select formControlName="parent" nzPlaceHolder="请选择父级被服分类">
87
+                <nz-option *ngFor="let option of parentList" [nzLabel]="option.name" nzValue="{{option.id}}">
88
+                </nz-option>
89
+              </nz-select>
90
+            </nz-form-control>
91
+          </nz-form-item>
92
+          <nz-form-item>
81 93
             <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="name">名称</nz-form-label>
82 94
             <nz-form-control nzErrorTip="请输入名称!">
83 95
               <nz-input-group>

+ 17 - 0
src/app/views/data-dictionary/data-dictionary.component.less

@@ -12,6 +12,23 @@
12 12
   min-height: 532px;
13 13
   overflow: hidden;
14 14
 
15
+  .searchItem {
16
+    .label {
17
+      margin-left: 16px;
18
+      color: #333;
19
+      display: inline-block;
20
+      width: 100px;
21
+      text-align-last: justify;
22
+      text-align: justify;
23
+      &.label--big {
24
+        width: 100px;
25
+      }
26
+    }
27
+    .formItem {
28
+      width: 135px;
29
+    }
30
+  }
31
+
15 32
   .groupInfo {
16 33
     float: left;
17 34
     width: 24%;

+ 43 - 5
src/app/views/data-dictionary/data-dictionary.component.ts

@@ -18,6 +18,7 @@ export class DataDictionaryComponent implements OnInit {
18 18
   mapOfCheckedId: { [key: string]: boolean } = {};
19 19
   checkedDictionary: any = {}; //选中
20 20
   dictionaryList: Array<any> = []; //数据字典信息
21
+  parentList: Array<any> = []; //父级数据字典信息
21 22
   hosId: any; //当前选择的院区id
22 23
   promptContent: string; //操作提示框提示信息
23 24
   ifSuccess: boolean; //操作成功/失败
@@ -53,6 +54,7 @@ export class DataDictionaryComponent implements OnInit {
53 54
     this.coopBtns = this.tool.initCoopBtns(this.route);
54 55
     this.hosId = this.tool.getCurrentHospital().id;
55 56
     this.getDictionaryList();
57
+    this.getParentList();
56 58
     this.tableHeight = document.body.clientHeight - 312;
57 59
   }
58 60
 
@@ -76,19 +78,47 @@ export class DataDictionaryComponent implements OnInit {
76 78
     }
77 79
   }
78 80
 
81
+  searchDto:any = {
82
+    parent: null,
83
+  }
84
+
85
+  // 获取父级分类
86
+  getParentList() {
87
+    let postData = {
88
+      idx: 0,
89
+      sum: 9999,
90
+      dictionaryTree: {
91
+        hosId: this.hosId,
92
+        level: 1,
93
+        key: 'clothes_type_parent',
94
+        deleted: 0,
95
+      },
96
+    };
97
+    this.mainService
98
+      .getFetchDataList("simple/data", "dictionaryTree", postData)
99
+      .subscribe((result) => {
100
+        if(result.status == 200){
101
+          this.parentList = result.list || [];
102
+        }
103
+      });
104
+  }
105
+
79 106
   // 获取选中数据字典列表
80 107
   getAll() {
81
-    // 初始化的时候搜索一次,然后前端过滤
82 108
     this.dictionaryLoading = true;
83 109
     let postData = {
84 110
       idx: 0,
85 111
       sum: 9999,
86
-      dictionary: {
112
+      dictionaryTree: {
113
+        hosId: this.hosId,
114
+        level: 2,
115
+        parent: this.searchDto.parent || undefined,
87 116
         key: this.checkedDictionary.key,
117
+        deleted: 0,
88 118
       },
89 119
     };
90 120
     this.mainService
91
-      .getFetchDataList("simple/data", "dictionary", postData)
121
+      .getFetchDataList("simple/data", "dictionaryTree", postData)
92 122
       .subscribe((result) => {
93 123
         this.dictionaryLoading = false;
94 124
         if (result.status == 200) {
@@ -137,6 +167,7 @@ export class DataDictionaryComponent implements OnInit {
137 167
       this.initForm();
138 168
       this.dataEdit = data;
139 169
       this.validateForm.controls.key.setValue(data.key);
170
+      this.validateForm.controls.parent.setValue(data.parent);
140 171
       this.validateForm.controls.name.setValue(data.name);
141 172
       this.validateForm.controls.value.setValue(data.value);
142 173
       this.validateForm.controls.orders.setValue(data.orders);
@@ -157,6 +188,7 @@ export class DataDictionaryComponent implements OnInit {
157 188
   initForm() {
158 189
     this.validateForm = this.fb.group({
159 190
       key: [this.checkedDictionary.key, [Validators.required]],
191
+      parent: [null, [Validators.required]],
160 192
       name: [null, [Validators.required]],
161 193
       value: [null, [Validators.required]],
162 194
       orders: [0, [Validators.required]],
@@ -177,22 +209,28 @@ export class DataDictionaryComponent implements OnInit {
177 209
 
178 210
     if (this.add) {
179 211
       postData = {
212
+        hosId: this.hosId,
180 213
         key: this.validateForm.value.key,
214
+        parent: this.validateForm.value.parent,
181 215
         name: this.validateForm.value.name,
182 216
         value: this.validateForm.value.value,
183 217
         orders: this.validateForm.value.orders,
184 218
         extra3: this.validateForm.value.extra3,
185 219
         desc: this.validateForm.value.desc,
220
+        level: 2,
186 221
       };
187 222
     } else {
188 223
       postData = {
224
+        hosId: this.hosId,
189 225
         key: this.validateForm.value.key,
226
+        parent: this.validateForm.value.parent,
190 227
         name: this.validateForm.value.name,
191 228
         value: this.validateForm.value.value,
192 229
         orders: this.validateForm.value.orders,
193 230
         extra3: this.validateForm.value.extra3,
194 231
         desc: this.validateForm.value.desc,
195 232
         id: this.dataEdit.id,
233
+        level: 2,
196 234
       };
197 235
     }
198 236
     this.addHandler(postData);
@@ -201,7 +239,7 @@ export class DataDictionaryComponent implements OnInit {
201 239
   //新增/编辑
202 240
   addHandler(postData) {
203 241
     this.mainService
204
-      .simplePost("addData", "dictionary", postData)
242
+      .simplePost("addData", "dictionaryTree", postData)
205 243
       .subscribe((result) => {
206 244
         this.hideModal();
207 245
         this.btnLoading = false;
@@ -240,7 +278,7 @@ export class DataDictionaryComponent implements OnInit {
240 278
     this.btnLoading = true;
241 279
     let selectedDictionary = this.selectedDictionary.map((item) => item.id);
242 280
     let postData = this.isDelSingle ? [this.dataEdit.id] : selectedDictionary;
243
-    this.mainService.simplePost("rmvData", "dictionary", postData).subscribe((result) => {
281
+    this.mainService.simplePost("rmvData", "dictionaryTree", postData).subscribe((result) => {
244 282
       this.hideDelDictionaryModal();
245 283
       this.btnLoading = false;
246 284
       if (result.status == 200) {

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

@@ -338,6 +338,11 @@ const routes: Routes = [
338 338
         path: "buildingFloor",
339 339
         loadChildren: () => import("../building-floor/building-floor.module").then((m) => m.BuildingFloorModule),
340 340
       },
341
+      // 被服科室绑定
342
+      {
343
+        path: "quiltDepartmentBind",
344
+        loadChildren: () => import("../quilt-department-bind/quilt-department-bind.module").then((m) => m.QuiltDepartmentBindModule),
345
+      },
341 346
       // 检查自动建单
342 347
       {
343 348
         path: "inspectAuto",

+ 14 - 0
src/app/views/quilt-department-bind/quilt-department-bind-routing.module.ts

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

+ 100 - 0
src/app/views/quilt-department-bind/quilt-department-bind.component.html

@@ -0,0 +1,100 @@
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 nzLg="6" class="list-template__btns">
6
+        <button nz-button *ngIf="coopBtns.add" class="btn default" (click)="addModal()">新增</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="5%">序号</th>
15
+            <th nzWidth="10%">分类名称</th>
16
+            <th nzWidth="30%">科室</th>
17
+            <th nzWidth="30%">被服种类</th>
18
+            <th nzWidth="25%">操作</th>
19
+          </tr>
20
+        </thead>
21
+        <tbody>
22
+          <tr *ngFor="let data of listOfData;let index = index">
23
+            <td>{{index+(pageIndex-1) * pageSize + 1}}</td>
24
+            <td>{{data.typeName || ''}}</td>
25
+            <td>{{data.deptNames || ''}}</td>
26
+            <td>{{data.clothesTypeNames || ''}}</td>
27
+            <td>
28
+              <div class="coop">
29
+                <span *ngIf="coopBtns.del&&!data.status" (click)="showDelModal(data,'您确认要删除吗?','删除','del')">删除</span>
30
+                <span *ngIf="coopBtns.edit" (click)="edit(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" [(nzPageSize)]="pageSize"
38
+          (nzPageIndexChange)="getList(0)" (nzPageSizeChange)="getList(0)">
39
+        </nz-pagination>
40
+      </div>
41
+    </div>
42
+  </div>
43
+
44
+  <!-- 新增/编辑/复制模态框 -->
45
+  <div class="save display_flex justify-content_flex-center align-items_center add" *ngIf="modal">
46
+    <div class="modalBody">
47
+      <div class="title">{{modelName}}<i class="icon_transport transport-guanbi" (click)="hideAddModal()"></i></div>
48
+      <div class="content">
49
+        <form nz-form [formGroup]="validateForm" class="addForm">
50
+          <nz-form-item>
51
+            <nz-form-label [nzSpan]="24" nzRequired nzFor="typeName">分类名称</nz-form-label>
52
+            <nz-form-control nzErrorTip="请输入分类名称!">
53
+              <nz-input-group>
54
+                <input nz-input formControlName="typeName" placeholder="请输入分类名称" />
55
+              </nz-input-group>
56
+            </nz-form-control>
57
+          </nz-form-item>
58
+          <nz-form-item>
59
+            <nz-form-label [nzSpan]="24" nzRequired nzFor="deptIds">科室</nz-form-label>
60
+            <nz-form-control nzErrorTip="请选择科室!">
61
+              <nz-select class="formItem" (nzOnSearch)="changeInp($event, 'deptIds')" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch nzPlaceHolder="请选择科室" formControlName="deptIds" (nzOpenChange)="getDeptList($event)" nzMode="multiple">
62
+                <ng-container *ngFor="let option of deptList">
63
+                  <nz-option *ngIf="!isLoading" [nzLabel]="option.dept" [nzValue]="option.id"></nz-option>
64
+                </ng-container>
65
+                <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
66
+                  <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
67
+                </nz-option>
68
+              </nz-select>
69
+            </nz-form-control>
70
+          </nz-form-item>
71
+          <nz-form-item>
72
+            <nz-form-label [nzSpan]="24" nzRequired nzFor="clothesTypeIds">被服种类</nz-form-label>
73
+            <nz-form-control nzErrorTip="请选择被服种类!">
74
+              <nz-select class="formItem" (nzOnSearch)="changeInp($event, 'clothesTypeIds')" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch nzPlaceHolder="请选择被服种类" formControlName="clothesTypeIds" (nzOpenChange)="getClothesTypeIdsList($event)" nzMode="multiple">
75
+                <ng-container *ngFor="let option of clothesTypeIdsList">
76
+                  <nz-option *ngIf="!isLoading" [nzLabel]="option.name" [nzValue]="option.id"></nz-option>
77
+                </ng-container>
78
+                <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
79
+                  <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
80
+                </nz-option>
81
+              </nz-select>
82
+            </nz-form-control>
83
+          </nz-form-item>
84
+        </form>
85
+      </div>
86
+      <div class=" display_flex justify-content_flex-center">
87
+        <button nzType="primary" nz-button (click)="submitForm()" [nzLoading]="btnLoading">确认</button>
88
+        <button class="btn cancel" nz-button nzType="default" (click)="hideAddModal()">取消</button>
89
+      </div>
90
+    </div>
91
+  </div>
92
+  <!-- 删除模态框 -->
93
+  <app-dialog-delete [delModal]="delModal" (hideDelModalEvent)="hideDelModal()" [btnLoading]="btnLoading"
94
+    (confirmDelEvent)="confirmDel()" [content]="tipsMsg1"></app-dialog-delete>
95
+</div>
96
+<!-- 操作成功/失败提示框 -->
97
+<app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
98
+  [info]="promptInfo">
99
+</app-prompt-modal>
100
+

+ 167 - 0
src/app/views/quilt-department-bind/quilt-department-bind.component.less

@@ -0,0 +1,167 @@
1
+@import "../../../../src/theme.less";
2
+
3
+:host {
4
+  ::ng-deep .ant-calendar-picker {
5
+    width: 100% !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
+      & > div {
51
+        text-align: center;
52
+        margin: 0;
53
+
54
+        &.icon {
55
+          // margin-top: 17px;
56
+
57
+          i {
58
+            color: #34b349;
59
+            font-size: 30px !important;
60
+
61
+            &.transport-wenhao {
62
+              color: #f5a523;
63
+            }
64
+
65
+            &.transport-shibai {
66
+              color: #ff3a52;
67
+            }
68
+          }
69
+        }
70
+
71
+        &.defeat {
72
+          color: #333;
73
+          font-size: 14px;
74
+        }
75
+
76
+        &:nth-child(3) {
77
+          font-size: 14px;
78
+          color: #666;
79
+        }
80
+      }
81
+      .workAssignmentTips {
82
+        font-size: 12px;
83
+      }
84
+    }
85
+
86
+    button {
87
+      margin-top: 10px;
88
+
89
+      &.btn {
90
+        margin-left: 8px;
91
+      }
92
+    }
93
+  }
94
+
95
+  // 新增
96
+  &.add {
97
+    .modalBody {
98
+      width: 480px;
99
+      height: auto;
100
+
101
+      .content {
102
+        width: 100%;
103
+        height: auto;
104
+        padding: 16px;
105
+        max-height: 497px;
106
+        overflow-y: auto;
107
+
108
+        .addForm {
109
+          .workAssignmentDescribe {
110
+            margin-top: 8px;
111
+          }
112
+          .ant-form-item {
113
+            margin-bottom: 0;
114
+
115
+            .ant-form-item-label {
116
+              text-align: left;
117
+            }
118
+
119
+            .desc {
120
+              margin-top: 5px;
121
+            }
122
+          }
123
+
124
+          .datesControl {
125
+            margin-top: -16px;
126
+
127
+            .ant-form-item-label {
128
+              line-height: 40px;
129
+            }
130
+          }
131
+
132
+          .timer {
133
+            .ant-form-item-label {
134
+              width: 100%;
135
+              text-align: left;
136
+            }
137
+
138
+            .numInp {
139
+              margin-right: 5px;
140
+            }
141
+
142
+            .line {
143
+              margin-right: 5px;
144
+            }
145
+          }
146
+
147
+          .timer2 {
148
+            .ant-form-item-label {
149
+              line-height: 20px;
150
+            }
151
+          }
152
+        }
153
+
154
+        .editForm {
155
+          .ant-form-item {
156
+            margin-bottom: 15px;
157
+
158
+            .ant-form-item-label {
159
+              line-height: 14px;
160
+              text-align: left;
161
+            }
162
+          }
163
+        }
164
+      }
165
+    }
166
+  }
167
+}

+ 307 - 0
src/app/views/quilt-department-bind/quilt-department-bind.component.ts

@@ -0,0 +1,307 @@
1
+import { Component, OnInit } from "@angular/core";
2
+import { ActivatedRoute } from "@angular/router";
3
+import { FormBuilder, Validators, FormGroup } from "@angular/forms";
4
+
5
+import { ToolService } from "../../services/tool.service";
6
+import { QuiltDepartmentBindService } from './quilt-department-bind.service';
7
+import { Subject } from 'rxjs';
8
+import { debounceTime } from 'rxjs/operators';
9
+import { NzMessageService } from 'ng-zorro-antd/message';
10
+@Component({
11
+  selector: "app-quilt-department-bind",
12
+  templateUrl: "./quilt-department-bind.component.html",
13
+  styleUrls: ["./quilt-department-bind.component.less"],
14
+})
15
+export class QuiltDepartmentBindComponent implements OnInit {
16
+  constructor(
17
+    private fb: FormBuilder,
18
+    private quiltDepartmentBindService: QuiltDepartmentBindService,
19
+    private route: ActivatedRoute,
20
+    private tool: ToolService,
21
+    private message: NzMessageService,
22
+  ) {}
23
+
24
+  userInfo: any = JSON.parse(localStorage.getItem("user")) || {}; //登录用户信息
25
+  listOfData: any[] = []; //表格数据
26
+  pageIndex: number = 1; //表格当前页码
27
+  pageSize: number = 10; //表格每页展示条数
28
+  listLength: number = 10; //表格总数据量
29
+  tableHeight: number; //表格动态高
30
+  modal: boolean = false; //新增/编辑模态框
31
+  add: boolean; //true:新增;false:编辑
32
+  validateForm: FormGroup; //新增/编辑表单
33
+  coopId: any; //当前操作列
34
+  currentHospital; //当前院区
35
+
36
+  btnLoading: boolean = false; //提交按钮loading状态
37
+
38
+  promptContent: string; //操作提示框提示信息
39
+  ifSuccess: boolean; //操作成功/失败
40
+  promptInfo: string; //操作结果提示信息
41
+  promptModalShow: boolean; //操作提示框是否展示
42
+  modelName = ""; //模态框名称
43
+
44
+  changeInpSubject = new Subject(); //防抖
45
+
46
+  ngOnInit() {
47
+    //防抖
48
+    this.changeInpSubject.pipe(debounceTime(500)).subscribe((v) => {
49
+      if(v[1] === 'clothesTypeIds'){
50
+        this.getClothesTypeIdsList(true, v[0]);
51
+      }else if(v[1] === 'deptIds'){
52
+        this.getDeptList(true, v[0]);
53
+      }
54
+    });
55
+    this.currentHospital = this.tool.getCurrentHospital();
56
+    this.coopBtns = this.tool.initCoopBtns(this.route);
57
+    this.initForm();
58
+    this.getList(1);
59
+  }
60
+
61
+  // 初始化增删改按钮
62
+  coopBtns: any = {};
63
+
64
+  // 表格数据
65
+  loading1 = false;
66
+  getList(type) {
67
+    if (type == 1) {
68
+      this.pageIndex = 1;
69
+    }
70
+    let data = {
71
+      idx: this.pageIndex - 1,
72
+      sum: this.pageSize,
73
+      clothesDept: {
74
+        hosId: this.currentHospital.id,
75
+      },
76
+    };
77
+    this.loading1 = true;
78
+    this.quiltDepartmentBindService
79
+      .getFetchDataList(data)
80
+      .subscribe((data) => {
81
+        this.loading1 = false;
82
+        if (data.status == 200) {
83
+          data.list.forEach(v => {
84
+            v.deptIds = v.depts.map(v => v.id);
85
+            v.deptNames = v.depts.map(v => v.dept).toString();
86
+            v.clothesTypeIds = v.clothesTypes.map(v => v.id);
87
+            v.clothesTypeNames = v.clothesTypes.map(v => v.name).toString();
88
+          });
89
+          this.listOfData = data.list;
90
+          this.listLength = data.totalNum;
91
+        }
92
+      });
93
+  }
94
+
95
+  //打开查询被服种类下拉框
96
+  isLoading:boolean = false;
97
+  clothesTypeIdsList:any[] = [];
98
+  getClothesTypeIdsList(flag, keyWord = '') {
99
+    if (flag) {
100
+      let postData = {
101
+        idx: 0,
102
+        sum: 9999,
103
+        dictionaryTree: {
104
+          hosId: this.currentHospital.id,
105
+          level: 2,
106
+          key: 'clothes_type',
107
+          deleted: 0,
108
+        },
109
+      };
110
+      this.isLoading = true;
111
+      this.quiltDepartmentBindService
112
+      .getClothesTypes(postData)
113
+      .subscribe((data) => {
114
+        this.isLoading = false;
115
+        if (data.status == 200) {
116
+          this.clothesTypeIdsList = data.list;
117
+        }
118
+      });
119
+    }
120
+  }
121
+
122
+  //打开查询科室下拉框
123
+  deptList:any[] = [];
124
+  getDeptList(flag, keyWord = '') {
125
+    if (flag) {
126
+      let postData = {
127
+        idx: 0,
128
+        sum: 9999,
129
+        department: {
130
+          searchType: 1,// 简单查询
131
+          dept: keyWord,
132
+          cascadeHosId: this.currentHospital.id,
133
+        }
134
+      };
135
+      this.isLoading = true;
136
+      this.quiltDepartmentBindService
137
+      .getDepts(postData)
138
+      .subscribe((data) => {
139
+        this.isLoading = false;
140
+        if (data.status == 200) {
141
+          this.deptList = data.list;
142
+        }
143
+      });
144
+    }
145
+  }
146
+
147
+  //搜索
148
+  changeInp(e, type) {
149
+    this.isLoading = true;
150
+    this.changeInpSubject.next([e, type]);
151
+  }
152
+
153
+  // 新增弹框
154
+  addModal() {
155
+    this.modelName = "新增";
156
+    this.add = true; //新增
157
+    this.modal = true;
158
+    this.initForm();
159
+  }
160
+  //关闭新增/编辑弹框
161
+  hideAddModal() {
162
+    this.modal = false;
163
+    this.initForm();
164
+  }
165
+
166
+  // 初始化新增form表单
167
+  initForm() {
168
+    this.validateForm = this.fb.group({
169
+      typeName: ['', [Validators.required]],
170
+      clothesTypeIds: [[], [Validators.required]],
171
+      deptIds: [[], [Validators.required]],
172
+    });
173
+  }
174
+
175
+  // 新增/编辑表单提交
176
+  submitForm(): void {
177
+    for (const i in this.validateForm.controls) {
178
+      this.validateForm.controls[i].markAsDirty();
179
+      this.validateForm.controls[i].updateValueAndValidity();
180
+    }
181
+    if (this.validateForm.invalid) {
182
+      return;
183
+    }
184
+    if((/^\s+/.test(this.validateForm.value.typeName) || /\s+$/.test(this.validateForm.value.typeName)) && !this.validateForm.value.typeName.trim()){
185
+      this.message.info('请设置业务名称!');
186
+      return;
187
+    }
188
+
189
+    this.btnLoading = true;
190
+    let data = {};
191
+
192
+    if (this.add) {
193
+      //增加
194
+      data = {
195
+        typeName: this.validateForm.value.typeName.trim(),
196
+        clothesTypeIds: this.validateForm.value.clothesTypeIds.toString(),
197
+        deptIds: this.validateForm.value.deptIds.toString(),
198
+        hosId: this.currentHospital.id,
199
+      };
200
+    } else {
201
+      //编辑
202
+      data = {
203
+        ...this.coopId,
204
+        typeName: this.validateForm.value.typeName.trim(),
205
+        clothesTypeIds: this.validateForm.value.clothesTypeIds.toString(),
206
+        deptIds: this.validateForm.value.deptIds.toString(),
207
+        hosId: this.currentHospital.id,
208
+      };
209
+    }
210
+    this.quiltDepartmentBindService
211
+      .simplePost("addData", "clothesDept", data)
212
+      .subscribe((result) => {
213
+        this.btnLoading = false;
214
+        this.hideAddModal();
215
+        this.initForm();
216
+        if (result.status == 200) {
217
+          if (this.add) {
218
+            this.showPromptModal("新增", true, "");
219
+            this.listLength++;
220
+          }else{
221
+            this.showPromptModal("编辑", true, "");
222
+          }
223
+        } else {
224
+          this.showPromptModal(this.add ? '新增' : '修改', false, result.msg);
225
+        }
226
+      });
227
+  }
228
+
229
+  // 编辑
230
+  edit(data) {
231
+    console.log(data);
232
+    this.modelName = "编辑";
233
+    this.add = false;
234
+    this.modal = true;
235
+    this.coopId = data;
236
+
237
+    this.deptList = data.depts ? data.depts : [];
238
+    this.clothesTypeIdsList = data.clothesTypes ? data.clothesTypes : [];
239
+    this.validateForm.controls.typeName.setValue(data.typeName);
240
+    this.validateForm.controls.clothesTypeIds.setValue(data.clothesTypeIds);
241
+    this.validateForm.controls.deptIds.setValue(data.deptIds);
242
+  }
243
+
244
+  // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
245
+  showPromptModal(con, success, promptInfo?) {
246
+    this.promptModalShow = false;
247
+    this.promptContent = con;
248
+    this.ifSuccess = success;
249
+    this.promptInfo = promptInfo;
250
+    setTimeout(() => {
251
+      this.promptModalShow = true;
252
+    }, 100);
253
+    this.getList(0);
254
+  }
255
+
256
+  delModal: boolean = false; //删除模态框
257
+  tipsMsg1: string; //提示框信息
258
+  tipsMsg2: string; //操作后信息
259
+  confirmDelType: string; //确认的类型(启用/停用,删除)
260
+  showDelModal(
261
+    data,
262
+    tipsMsg1: string,
263
+    tipsMsg2: string,
264
+    type: string,
265
+  ) {
266
+    this.confirmDelType = type;
267
+    this.delModal = true;
268
+    this.coopId = data;
269
+    this.tipsMsg1 = tipsMsg1;
270
+    this.tipsMsg2 = tipsMsg2;
271
+  }
272
+  // 隐藏删除框
273
+  hideDelModal() {
274
+    this.delModal = false;
275
+  }
276
+  // 确认删除
277
+  confirmDel() {
278
+    this.btnLoading = true;
279
+    if (this.confirmDelType === "del") {
280
+      //删除
281
+      this.quiltDepartmentBindService
282
+        .simplePost("rmvData", "clothesDept", [this.coopId.id])
283
+        .subscribe((data) => {
284
+          this.btnLoading = false;
285
+          this.delModal = false;
286
+          if (data.status == 200) {
287
+            if (
288
+              this.listOfData.length == 1 &&
289
+              this.pageIndex == Math.ceil(this.listLength / this.pageSize)
290
+            ) {
291
+              this.listLength--;
292
+              if (this.listLength === 0) {
293
+                this.pageIndex = 1;
294
+              } else {
295
+                this.pageIndex = Math.ceil(this.listLength / this.pageSize);
296
+              }
297
+            }
298
+            this.showPromptModal(this.tipsMsg2, true, "");
299
+          } else {
300
+            this.showPromptModal(this.tipsMsg2, false, data.msg);
301
+          }
302
+        });
303
+    }
304
+  }
305
+}
306
+
307
+

+ 19 - 0
src/app/views/quilt-department-bind/quilt-department-bind.module.ts

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

+ 65 - 0
src/app/views/quilt-department-bind/quilt-department-bind.service.ts

@@ -0,0 +1,65 @@
1
+import { Injectable } from '@angular/core';
2
+import { MainService } from 'src/app/services/main.service';
3
+import { map } from 'rxjs/operators';
4
+
5
+@Injectable({
6
+  providedIn: 'root'
7
+})
8
+export class QuiltDepartmentBindService {
9
+
10
+  constructor(
11
+    private mainService: MainService,
12
+  ) { }
13
+
14
+  // simple增删改
15
+  simplePost(type, model, postData) {
16
+    return this.mainService.simplePost(type, model, postData);
17
+  }
18
+
19
+  // 获取被服种类列表
20
+  getClothesTypes(postData) {
21
+    return this.mainService.getFetchDataList("simple/data", "dictionaryTree", postData).pipe(map((v:any) => {
22
+      if(Array.isArray(v.list)){
23
+        v.list = v.list.map(vv => ({id: vv.id, name: vv.name}));
24
+      }else{
25
+        v.list = [];
26
+      }
27
+      return v;
28
+    }));
29
+  }
30
+
31
+  // 获取科室列表
32
+  getDepts(postData) {
33
+    return this.mainService.getFetchDataList("simple/data", "department", postData).pipe(map((v:any) => {
34
+      if(Array.isArray(v.list)){
35
+        v.list = v.list.map(vv => ({id: vv.id, dept: vv.dept}));
36
+      }else{
37
+        v.list = [];
38
+      }
39
+      return v;
40
+    }));
41
+  }
42
+
43
+  // 查询
44
+  getFetchDataList(postData) {
45
+    return this.mainService.getFetchDataList("simple/data", "clothesDept", postData).pipe(map((v:any) => {
46
+      if(Array.isArray(v.list)){
47
+        v.list = v.list.map(vv => ({
48
+          ...vv,
49
+          buildingListNames: vv.buildingList ? vv.buildingList.map(v => v.buildingName).toString() : '',
50
+          deptListNames: vv.deptList ? vv.deptList.map(v => v.dept).toString() : '',
51
+        }));
52
+      }else{
53
+        v.list = [];
54
+      }
55
+      return v;
56
+    }));;
57
+  }
58
+
59
+  // 字典
60
+  getDictionary(type) {
61
+    return this.mainService.getDictionary("list", type);
62
+  }
63
+}
64
+
65
+