浏览代码

二维码管理增删改查

seimin 1 年之前
父节点
当前提交
619c064f43

+ 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.241",
4 4
     "logLevel": "debug",
5 5
     "changeOrigin": true,
6 6
     "pathRewrite": {

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

@@ -58,6 +58,11 @@ const routes: Routes = [
58 58
         path: "officeManagement",
59 59
         loadChildren: () => import("../office-management/office-management.module").then((m) => m.OfficeManagementModule),
60 60
       },
61
+      // 二维码配置
62
+      {
63
+        path: "QRCodeConfiguration",
64
+        loadChildren: () => import("../qrcode-configuration/qrcode-configuration.module").then((m) => m.QRCodeConfigurationModule),
65
+      },
61 66
       // 任务类型管理
62 67
       {
63 68
         path: "taskTypeManagement",

+ 15 - 0
src/app/views/qrcode-configuration/qrcode-configuration-routing.module.ts

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

+ 88 - 0
src/app/views/qrcode-configuration/qrcode-configuration.component.html

@@ -0,0 +1,88 @@
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">
5
+      </div>
6
+      <div nz-col nzXl='6' class="list-template__btns">
7
+        <button nz-button class="btn default" (click)='search()'>搜索</button>
8
+        <button nz-button *ngIf="coopBtns.add" class="btn ml8 default" (click)="showModal()">新增</button>
9
+      </div>
10
+    </div>
11
+    <div class="list-template__bottom">
12
+      <nz-table class="list-template__nzTable" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false"
13
+        [nzLoading]="loading1">
14
+        <thead>
15
+          <tr class="thead">
16
+            <th nzWidth="10%">映射名称</th>
17
+            <th nzWidth="10%">关联科室</th>
18
+            <th nzWidth="5%">二维码CODE</th>
19
+            <th nzWidth="20%">操作</th>
20
+          </tr>
21
+        </thead>
22
+        <tbody>
23
+          <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>
27
+            <td>
28
+              <div class="coop">
29
+                <span *ngIf="coopBtns.edit" (click)="edit(data)">编辑</span>
30
+                <span *ngIf="coopBtns.del" (click)="del(data)">删除</span>
31
+              </div>
32
+            </td>
33
+          </tr>
34
+        </tbody>
35
+      </nz-table>
36
+      <div class="list-template__pagination">
37
+        <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" nzShowSizeChanger [(nzPageSize)]="pageSize"
38
+          (nzPageIndexChange)="getList()" (nzPageSizeChange)="getList()">
39
+        </nz-pagination>
40
+      </div>
41
+    </div>
42
+  </div>
43
+</div>
44
+<!-- 新增/编辑模态框 -->
45
+<div class="save add display_flex align-items_center justify-content_flex-center" *ngIf="modal">
46
+  <div class="modalBody">
47
+    <div class="title">{{add?"新增":"编辑"}}<i class="icon_transport transport-guanbi" (click)="hideModal()"></i>
48
+    </div>
49
+    <overlay-scrollbars #osComponentRef1 class="content">
50
+      <form nz-form [formGroup]="validateForm" class="addForm" (ngSubmit)="submitForm()">
51
+        <nz-form-item>
52
+          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="name">映射名称</nz-form-label>
53
+          <nz-form-control nzErrorTip="请填写映射名称!">
54
+            <nz-input-group>
55
+              <input type="text" nz-input formControlName="name" placeholder="请填写映射名称" />
56
+            </nz-input-group>
57
+          </nz-form-control>
58
+        </nz-form-item>
59
+        <nz-form-item>
60
+          <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="deptId">关联科室</nz-form-label>
61
+          <nz-form-control nzErrorTip="请选择关联科室!">
62
+            <nz-select [nzDropdownMatchSelectWidth]="false" formControlName="deptId" nzShowSearch nzAllowClear nzPlaceHolder="请选择关联科室" nzServerSearch (nzOnSearch)="changeInp($event)" (nzOpenChange)="openOtherTasktype($event)" [nzDisabled]="tabTypeListDisabled">
63
+              <ng-container *ngFor="let data of deptList">
64
+                <nz-option *ngIf="!isLoading" [nzLabel]="data.dept" [nzValue]="data.id">
65
+                </nz-option>
66
+              </ng-container>
67
+              <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
68
+                <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
69
+              </nz-option>
70
+            </nz-select>
71
+          </nz-form-control>
72
+        </nz-form-item>
73
+      </form>
74
+    </overlay-scrollbars>
75
+    <div class="display_flex justify-content_flex-center">
76
+      <button nzType="primary" nz-button (click)="submitForm()" [nzLoading]="btnLoading">确认</button>
77
+      <button class="btn cancel" nz-button nzType="default" (click)="hideModal()">取消</button>
78
+    </div>
79
+  </div>
80
+</div>
81
+<!-- 删除模态框 -->
82
+<app-dialog-delete [delModal]="delModal" (hideDelModalEvent)="hideDelModal()" [btnLoading]="btnLoading" (confirmDelEvent)="confirmDel()" content="是否确认删除?"></app-dialog-delete>
83
+
84
+<!-- 操作成功/失败提示框 -->
85
+<app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow" [info]="promptInfo"></app-prompt-modal>
86
+
87
+<!-- 遮罩 -->
88
+<app-mask *ngIf="maskFlag"></app-mask>

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

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

+ 239 - 0
src/app/views/qrcode-configuration/qrcode-configuration.component.ts

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

+ 23 - 0
src/app/views/qrcode-configuration/qrcode-configuration.module.ts

@@ -0,0 +1,23 @@
1
+import { NgModule } from '@angular/core';
2
+import { CommonModule } from '@angular/common';
3
+
4
+import { QRCodeConfigurationRoutingModule } from './qrcode-configuration-routing.module';
5
+import { ShareModule } from 'src/app/share/share.module';
6
+import { QRCodeConfigurationComponent } from './qrcode-configuration.component';
7
+import { QRCodeConfigurationService } from './qrcode-configuration.service';
8
+
9
+
10
+@NgModule({
11
+  declarations: [
12
+    QRCodeConfigurationComponent,
13
+  ],
14
+  imports: [
15
+    CommonModule,
16
+    QRCodeConfigurationRoutingModule,
17
+    ShareModule,
18
+  ],
19
+  providers: [
20
+    QRCodeConfigurationService,
21
+  ]
22
+})
23
+export class QRCodeConfigurationModule { }

+ 68 - 0
src/app/views/qrcode-configuration/qrcode-configuration.service.ts

@@ -0,0 +1,68 @@
1
+import { Injectable } from '@angular/core';
2
+import { MainService } from 'src/app/services/main.service';
3
+import { map, pluck, flatMap } from 'rxjs/operators';
4
+
5
+@Injectable()
6
+export class QRCodeConfigurationService {
7
+  constructor(
8
+    private mainService: MainService,
9
+  ) { }
10
+
11
+  // 列表-查
12
+  query({pageIndex, pageSize, hosId}) {
13
+    let data = {
14
+      idx: pageIndex - 1,
15
+      sum: pageSize,
16
+      qrCode: {
17
+        hosId,
18
+      },
19
+    };
20
+    return this.mainService.getFetchDataList("simple/data", "qrCode", data);
21
+  }
22
+
23
+  // 列表-删
24
+  delete({id}) {
25
+    return this.mainService.simplePost("rmvData", "qrCode", [id]);
26
+  }
27
+
28
+  // 列表-增
29
+  add({name, deptId, hosId}) {
30
+    let data = {
31
+      name,
32
+      deptId,
33
+      hosId,
34
+    };
35
+
36
+    return this.mainService.simplePost("addData", "qrCode", data);
37
+  }
38
+
39
+  // 列表-改
40
+  update({name, deptId, coopData}) {
41
+    let data = {
42
+      name,
43
+      deptId,
44
+    };
45
+    data = {...coopData, ...data};
46
+    return this.mainService.simplePost("addData", "qrCode", data);
47
+  }
48
+
49
+  // 查询科室
50
+  queryOtherTasktype({hosId, keywords}){
51
+    let postData = {
52
+      department: {
53
+        hospital: {
54
+          id: hosId
55
+        },
56
+        dept: keywords,
57
+      },
58
+      idx: 0,
59
+      sum: 9999,
60
+    };
61
+    return this.mainService.getFetchDataList("data", "department", postData).pipe(map((v:any) => {
62
+      if(Array.isArray(v.list)){
63
+        v.list = v.list.map(vv => ({id: vv.id, dept: vv.dept}));
64
+      }
65
+      return v;
66
+    }));
67
+  }
68
+}

+ 5 - 5
src/app/views/tab-custom/tab-custom.component.ts

@@ -70,19 +70,19 @@ export class TabCustomComponent implements OnInit {
70 70
     this.coopBtns = this.tool.initCoopBtns(this.route);
71 71
     this.initForm();
72 72
     this.hosId = this.tool.getCurrentHospital().id;
73
-    this.getList();
73
+    this.getList(true);
74 74
   }
75 75
 
76 76
   // 初始化增删改按钮
77 77
   coopBtns: any = {};
78 78
   // 搜索
79 79
   search() {
80
-    this.pageIndex = 1;
81
-    this.getList();
80
+    this.getList(true);
82 81
   }
83 82
   // 表格数据
84 83
   loading1 = false;
85
-  getList() {
84
+  getList(isResetPageIndex = false) {
85
+    isResetPageIndex && (this.pageIndex = 1);
86 86
     let data = {
87 87
       idx: this.pageIndex - 1,
88 88
       sum: this.pageSize,
@@ -258,7 +258,7 @@ export class TabCustomComponent implements OnInit {
258 258
     setTimeout(() => {
259 259
       this.promptModalShow = true;
260 260
     }, 100);
261
-    this.getList();
261
+    this.getList(true);
262 262
   }
263 263
 
264 264
   // 边输边搜节流阀