ソースを参照

二维码配置改为科室地点

seimin 4 ヶ月 前
コミット
cfe2af3464

+ 58 - 10
src/app/views/qrcode-configuration/qrcode-configuration.component.html

@@ -2,9 +2,27 @@
2 2
   <div class="list-template__content">
3 3
     <div class="list-template__top" nz-row>
4 4
       <div nz-col nzXl='18' class="list-template__searchBox">
5
+        <div class="list-template__searchItem">
6
+          <span class="label">关联科室</span>:
7
+          <nz-select class="formItem" (nzOnSearch)="changeInp($event)" (nzOpenChange)="openOtherTasktype($event)"
8
+            [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch nzAllowClear nzPlaceHolder="请选择关联科室"
9
+            [(ngModel)]="searchDto.deptId">
10
+            <ng-container *ngFor="let option of deptList">
11
+              <nz-option *ngIf="!isLoading" [nzLabel]="option.dept" [nzValue]="option.id"></nz-option>
12
+            </ng-container>
13
+            <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
14
+              <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
15
+            </nz-option>
16
+          </nz-select>
17
+        </div>
18
+        <div class="list-template__searchItem">
19
+          <span class="label">地点名称:</span>
20
+          <input nz-input class="formItem" [(ngModel)]="searchDto.name" placeholder="请输入地点名称" nzSize="default" />
21
+        </div>
5 22
       </div>
6 23
       <div nz-col nzXl='6' class="list-template__btns">
7 24
         <button nz-button class="btn default" (click)='search()'>搜索</button>
25
+        <button class="btn default ml8" (click)='reset()'>重置</button>
8 26
         <button nz-button *ngIf="coopBtns.add" class="btn ml8 default" (click)="showModal()">新增</button>
9 27
       </div>
10 28
     </div>
@@ -13,17 +31,21 @@
13 31
         [nzLoading]="loading1">
14 32
         <thead>
15 33
           <tr class="thead">
16
-            <th nzWidth="10%">映射名称</th>
17
-            <th nzWidth="10%">关联科室</th>
18
-            <th nzWidth="5%">二维码CODE</th>
19
-            <th nzWidth="20%">操作</th>
34
+            <th nzWidth="5%">序号</th>
35
+            <th nzWidth="19%">地点名称</th>
36
+            <th nzWidth="19%">关联科室</th>
37
+            <th nzWidth="19%">地点编码</th>
38
+            <th nzWidth="19%">地点电话</th>
39
+            <th nzWidth="19%">操作</th>
20 40
           </tr>
21 41
         </thead>
22 42
         <tbody>
23 43
           <tr *ngFor="let data of listOfData;let index=index;">
24
-            <td>{{ data.name || '' }}</td>
25
-            <td>{{ data.deptDTO ? data.deptDTO.dept : '' }}</td>
26
-            <td>{{ data.code || '' }}</td>
44
+            <td>{{index+(pageIndex-1) * pageSize + 1}}</td>
45
+            <td>{{ data.name }}</td>
46
+            <td>{{ data.deptDTO?.dept }}</td>
47
+            <td>{{ data.placeCode}}</td>
48
+            <td>{{ data.phones}}</td>
27 49
             <td>
28 50
               <div class="coop">
29 51
                 <span *ngIf="coopBtns.edit" (click)="edit(data)">编辑</span>
@@ -49,10 +71,10 @@
49 71
     <overlay-scrollbars #osComponentRef1 class="content">
50 72
       <form nz-form [formGroup]="validateForm" class="addForm" (ngSubmit)="submitForm()">
51 73
         <nz-form-item>
52
-          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="name">映射名称</nz-form-label>
53
-          <nz-form-control nzErrorTip="请填写映射名称!">
74
+          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="name">地点名称</nz-form-label>
75
+          <nz-form-control nzErrorTip="请填写地点名称!">
54 76
             <nz-input-group>
55
-              <input type="text" nz-input formControlName="name" placeholder="请填写映射名称" />
77
+              <input type="text" nz-input formControlName="name" placeholder="请填写地点名称" />
56 78
             </nz-input-group>
57 79
           </nz-form-control>
58 80
         </nz-form-item>
@@ -70,6 +92,32 @@
70 92
             </nz-select>
71 93
           </nz-form-control>
72 94
         </nz-form-item>
95
+        <nz-form-item>
96
+          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="placeCode">地点编码</nz-form-label>
97
+          <nz-form-control nzErrorTip="请填写地点编码!">
98
+            <nz-input-group>
99
+              <input type="text" nz-input formControlName="placeCode" placeholder="请填写地点编码" />
100
+            </nz-input-group>
101
+          </nz-form-control>
102
+        </nz-form-item>
103
+        <nz-form-item>
104
+          <nz-form-label [nzSm]="6" [nzXs]="24" nzFor="phones">地点电话</nz-form-label>
105
+          <nz-form-control nzErrorTip="请填写地点电话!">
106
+            <nz-input-group>
107
+              <input (ngModelChange)="deptsPhoneChange()" nz-input formControlName="phones" placeholder="请填写地点电话" />
108
+            </nz-input-group>
109
+          </nz-form-control>
110
+        </nz-form-item>
111
+        <nz-input-group *ngFor="let phone of deptPhones;let index = index" class="dynamic">
112
+          <input nz-input [ngModel]="phone.phone" [ngModelOptions]="{standalone: true}" placeholder="请填写科室电话"
113
+            (ngModelChange)="deptsPhoneChange($event,phone)" />
114
+          <i nz-icon nzType="minus-circle-o" (click)="removeDeptPhone(index, $event)"></i>
115
+        </nz-input-group>
116
+        <button nz-button nzType="dashed" [disabled]="isAddDeptsPhone" class="add-button"
117
+          (click)="addDeptPhone($event)">
118
+          <i nz-icon nzType="plus"></i>
119
+          添加科室号码
120
+        </button>
73 121
       </form>
74 122
     </overlay-scrollbars>
75 123
     <div class="display_flex justify-content_flex-center">

+ 18 - 0
src/app/views/qrcode-configuration/qrcode-configuration.component.less

@@ -1,4 +1,22 @@
1 1
 @import "../../../../src/theme.less";
2
+:host{
3
+  .add-button {
4
+    margin: 0 auto 16px !important;
5
+  }
6
+  .dynamic {
7
+    margin-bottom: 16px;
8
+    display: flex;
9
+    align-items: center;
10
+    input {
11
+      width: 90%;
12
+    }
13
+    i {
14
+      margin-left: 8px;
15
+      cursor: pointer;
16
+      font-size: 18px;
17
+    }
18
+  }
19
+}
2 20
 .save {
3 21
   position: fixed;
4 22
   left: 0;

+ 66 - 1
src/app/views/qrcode-configuration/qrcode-configuration.component.ts

@@ -61,11 +61,47 @@ export class QRCodeConfigurationComponent implements OnInit {
61 61
     this.getList(true);
62 62
   }
63 63
 
64
+  // 新添加地点号码
65
+  deptPhones: any = []; //新添加的地点电话列表
66
+  deptsPhoneId = 1; //地点电话自增id
67
+  isAddDeptsPhone = true; //添加新的地点电话是否禁用
68
+  addDeptPhone(e: MouseEvent) {
69
+    e.preventDefault();
70
+    this.deptPhones.push({ id: ++this.deptsPhoneId, phone: "" });
71
+    this.deptsPhoneChange();
72
+  }
73
+  // 删除新添加地点号码
74
+  removeDeptPhone(index: number, e: MouseEvent) {
75
+    e.preventDefault();
76
+    this.deptPhones.splice(index, 1);
77
+    this.deptsPhoneChange();
78
+  }
79
+  //监听科室电话输入事件
80
+  deptsPhoneChange(e?, phone?) {
81
+    if (e !== undefined && phone !== undefined) {
82
+      phone.phone = e;
83
+    }
84
+    // -------------判断添加按钮是否禁用 start
85
+    this.isAddDeptsPhone = !this.validateForm.value.phones;
86
+    if (!this.isAddDeptsPhone) {
87
+      //如果没禁用
88
+      this.isAddDeptsPhone = this.deptPhones.some((item) => item.phone === "");
89
+    }
90
+    // -------------判断添加按钮是否禁用 end
91
+  }
92
+
64 93
   // 搜索
65 94
   search() {
66 95
     this.getList(true);
67 96
   }
97
+  // 重置
98
+  reset() {
99
+    this.searchDto = {};
100
+    this.getList(true);
101
+  }
68 102
   // 表格数据
103
+  alldepart1: any = []; //所有所属科室(搜索)
104
+  searchDto:any =  {};
69 105
   loading1 = false;
70 106
   getList(isResetPageIndex = false) {
71 107
     isResetPageIndex && (this.pageIndex = 1);
@@ -73,6 +109,7 @@ export class QRCodeConfigurationComponent implements OnInit {
73 109
       pageIndex: this.pageIndex,
74 110
       pageSize: this.pageSize,
75 111
       hosId: this.hosId,
112
+      searchDto: this.searchDto,
76 113
     };
77 114
     this.loading1 = true;
78 115
     this.qrCodeConfigurationService
@@ -85,7 +122,7 @@ export class QRCodeConfigurationComponent implements OnInit {
85 122
       });
86 123
   }
87 124
 
88
-  // 获取任务类型列表-其他临床服务
125
+  // 获取科室列表
89 126
   getOtherTasktype(keywords = '') {
90 127
     let hosId = this.tool.getCurrentHospital().id;
91 128
     this.isLoading = true;
@@ -103,6 +140,8 @@ export class QRCodeConfigurationComponent implements OnInit {
103 140
     this.add = true;
104 141
     this.modal = true;
105 142
     this.initForm();
143
+    this.isAddDeptsPhone = true;
144
+    this.deptPhones = [];
106 145
   }
107 146
   hideModal() {
108 147
     this.modal = false;
@@ -117,6 +156,8 @@ export class QRCodeConfigurationComponent implements OnInit {
117 156
     this.validateForm = this.fb.group({
118 157
       name: ['', [Validators.required]],
119 158
       deptId: [null, [Validators.required]],
159
+      placeCode: ['', [Validators.required]],
160
+      phones: [null],
120 161
     });
121 162
   }
122 163
   // 表单提交
@@ -127,11 +168,14 @@ export class QRCodeConfigurationComponent implements OnInit {
127 168
     }
128 169
     if (this.validateForm.invalid) return;
129 170
     this.btnLoading = true;
171
+    let deptsPhone = this.deptPhones.map((item) => item.phone).join();
130 172
     if(this.add){
131 173
       this.qrCodeConfigurationService
132 174
       .add({
133 175
         name: this.validateForm.value.name,
134 176
         deptId: this.validateForm.value.deptId,
177
+        placeCode: this.validateForm.value.placeCode,
178
+        phones: deptsPhone ? this.validateForm.value.phones + "," + deptsPhone : this.validateForm.value.phones,
135 179
         hosId: this.hosId,
136 180
       })
137 181
       .subscribe((data) => {
@@ -149,6 +193,8 @@ export class QRCodeConfigurationComponent implements OnInit {
149 193
       .update({
150 194
         name: this.validateForm.value.name,
151 195
         deptId: this.validateForm.value.deptId,
196
+        placeCode: this.validateForm.value.placeCode,
197
+        phones: deptsPhone ? this.validateForm.value.phones + "," + deptsPhone : this.validateForm.value.phones,
152 198
         coopData: this.coopData,
153 199
       })
154 200
       .subscribe((data) => {
@@ -168,8 +214,27 @@ export class QRCodeConfigurationComponent implements OnInit {
168 214
   maskFlag: any = false;
169 215
   coopData = {};
170 216
   edit(data) {
217
+    this.isAddDeptsPhone = false;
218
+    this.deptPhones = [];
219
+    let phones = data.phones ? data.phones.split(",") : [];
220
+    if (phones.length === 0) {
221
+      this.validateForm.controls.phones.setValue("");
222
+      this.deptPhones = [];
223
+    } else if (phones.length === 1) {
224
+      this.validateForm.controls.phones.setValue(phones[0]);
225
+      this.deptPhones = [];
226
+    } else {
227
+      this.validateForm.controls.phones.setValue(phones[0]);
228
+      this.deptPhones = phones.slice(1).map((item) => {
229
+        return {
230
+          id: ++this.deptsPhoneId,
231
+          phone: item,
232
+        };
233
+      });
234
+    }
171 235
     this.validateForm.controls.name.setValue(data.name);
172 236
     this.validateForm.controls.deptId.setValue(data.deptId);
237
+    this.validateForm.controls.placeCode.setValue(data.placeCode);
173 238
     this.modal = true;
174 239
     this.add = false;
175 240
     this.coopId = data.id;

+ 8 - 3
src/app/views/qrcode-configuration/qrcode-configuration.service.ts

@@ -11,12 +11,13 @@ export class QRCodeConfigurationService {
11 11
   ) { }
12 12
 
13 13
   // 列表-查
14
-  query({pageIndex, pageSize, hosId}) {
14
+  query({pageIndex, pageSize, searchDto, hosId}) {
15 15
     let data = {
16 16
       idx: pageIndex - 1,
17 17
       sum: pageSize,
18 18
       qrCode: {
19 19
         hosId,
20
+        ...searchDto,
20 21
       },
21 22
     };
22 23
     return this.mainService.getFetchDataList("simple/data", "qrCode", data);
@@ -28,10 +29,12 @@ export class QRCodeConfigurationService {
28 29
   }
29 30
 
30 31
   // 列表-增
31
-  add({name, deptId, hosId}) {
32
+  add({name, deptId, placeCode, phones, hosId}) {
32 33
     let data = {
33 34
       name,
34 35
       deptId,
36
+      placeCode,
37
+      phones,
35 38
       hosId,
36 39
     };
37 40
 
@@ -39,10 +42,12 @@ export class QRCodeConfigurationService {
39 42
   }
40 43
 
41 44
   // 列表-改
42
-  update({name, deptId, coopData}) {
45
+  update({name, deptId, placeCode, phones, coopData}) {
43 46
     let data = {
44 47
       name,
45 48
       deptId,
49
+      placeCode,
50
+      phones,
46 51
     };
47 52
     data = {...coopData, ...data};
48 53
     return this.mainService.simplePost("addData", "qrCode", data);