Browse Source

问卷调查

seimin 2 years ago
parent
commit
d65d020e32
29 changed files with 1968 additions and 251 deletions
  1. 5 0
      src/app/app-routing.module.ts
  2. 40 0
      src/app/services/main.service.ts
  3. 16 0
      src/app/views/main/main-routing.module.ts
  4. 9 4
      src/app/views/order-management/order-management.component.html
  5. 13 4
      src/app/views/order-management/order-management.component.ts
  6. 14 0
      src/app/views/preview/preview-routing.module.ts
  7. 51 0
      src/app/views/preview/preview.component.html
  8. 51 0
      src/app/views/preview/preview.component.less
  9. 103 0
      src/app/views/preview/preview.component.ts
  10. 17 0
      src/app/views/preview/preview.module.ts
  11. 17 0
      src/app/views/questionnaire-answer/questionnaire-answer-routing.module.ts
  12. 42 0
      src/app/views/questionnaire-answer/questionnaire-answer.component.html
  13. 170 0
      src/app/views/questionnaire-answer/questionnaire-answer.component.less
  14. 94 0
      src/app/views/questionnaire-answer/questionnaire-answer.component.ts
  15. 17 0
      src/app/views/questionnaire-answer/questionnaire-answer.module.ts
  16. 14 0
      src/app/views/questionnaire-management-detail/questionnaire-management-detail-routing.module.ts
  17. 30 0
      src/app/views/questionnaire-management-detail/questionnaire-management-detail.component.html
  18. 152 0
      src/app/views/questionnaire-management-detail/questionnaire-management-detail.component.less
  19. 52 0
      src/app/views/questionnaire-management-detail/questionnaire-management-detail.component.ts
  20. 19 0
      src/app/views/questionnaire-management-detail/questionnaire-management-detail.module.ts
  21. 19 7
      src/app/views/questionnaire-management/questionnaire-management-routing.module.ts
  22. 39 37
      src/app/views/questionnaire-management/questionnaire-management.component.html
  23. 3 0
      src/app/views/questionnaire-management/questionnaire-management.component.less
  24. 189 199
      src/app/views/questionnaire-management/questionnaire-management.component.ts
  25. 14 0
      src/app/views/questions/questions-routing.module.ts
  26. 138 0
      src/app/views/questions/questions.component.html
  27. 200 0
      src/app/views/questions/questions.component.less
  28. 423 0
      src/app/views/questions/questions.component.ts
  29. 17 0
      src/app/views/questions/questions.module.ts

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

@@ -50,6 +50,11 @@ const routes: Routes = [
50 50
     loadChildren: () => import('./views/specimen-view2/specimen-view2.module').then(m => m.SpecimenView2Module),
51 51
     canActivate: [SpecimenView2Guard]
52 52
   },
53
+  {
54
+    // 问卷预览
55
+    path: "preview",
56
+    loadChildren: () => import("./views/preview/preview.module").then((m) => m.PreviewModule),
57
+  },
53 58
   { path: '**', redirectTo: 'main/home' }
54 59
 
55 60
 ];

+ 40 - 0
src/app/services/main.service.ts

@@ -568,4 +568,44 @@ export class MainService {
568 568
       { headers: this.headers }
569 569
     );
570 570
   }
571
+  //问卷发布
572
+  managerQuestionnaire(data) {
573
+    return this.http.post(
574
+      host.host + "/user/data/managerQuestionnaire",
575
+      data,
576
+      {
577
+        headers: this.headers,
578
+      }
579
+    );
580
+  }
581
+  //问卷预览
582
+  managerQuestionnairePreview(data,token) {
583
+    return this.http.post(
584
+      host.host + "/api/survey/" + token,
585
+      data,
586
+      {
587
+        headers: this.headers,
588
+      }
589
+    );
590
+  }
591
+  //问卷提交答案
592
+  surveyCommit(data) {
593
+    return this.http.post(
594
+      host.host + "/api/survey/commit",
595
+      data,
596
+      {
597
+        headers: this.headers,
598
+      }
599
+    );
600
+  }
601
+  //查询回收数据
602
+  listQuestionnaire(data) {
603
+    return this.http.post(
604
+      host.host + "/user/data/listQuestionnaire",
605
+      data,
606
+      {
607
+        headers: this.headers,
608
+      }
609
+    );
610
+  }
571 611
 }

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

@@ -375,6 +375,22 @@ const routes: Routes = [
375 375
             (m) => m.QuestionnaireManagementModule
376 376
           ),
377 377
       },
378
+      {
379
+        // 问卷问题列表
380
+        path: "questions",
381
+        loadChildren: () =>
382
+          import("../questions/questions.module").then(
383
+            (m) => m.QuestionsModule
384
+          ),
385
+      },
386
+      {
387
+        // 问卷回收数据列表
388
+        path: "questionnaireAnswer",
389
+        loadChildren: () =>
390
+          import("../questionnaire-answer/questionnaire-answer.module").then(
391
+            (m) => m.QuestionnaireAnswerModule
392
+          ),
393
+      },
378 394
     ],
379 395
   },
380 396
 ];

+ 9 - 4
src/app/views/order-management/order-management.component.html

@@ -66,13 +66,16 @@
66 66
         </div>
67 67
         <div class="list-template__searchItem">
68 68
           <span class="label">发起时间</span>:
69
-          <nz-range-picker [(ngModel)]="dateRange" (ngModelChange)="changeDate($event)"
70
-            [nzDisabled]="checkOptionsOne[2].checked"></nz-range-picker>
69
+          <!-- <nz-range-picker [(ngModel)]="dateRange" (ngModelChange)="changeDate($event)"
70
+            [nzDisabled]="checkOptionsOne[2]?.checked"></nz-range-picker> -->
71
+          <nz-range-picker [(ngModel)]="dateRange" (ngModelChange)="changeDate($event)"></nz-range-picker>
71 72
         </div>
72 73
       </div>
73 74
       <div nz-col nzXl='7' class="list-template__btns">
75
+        <!-- <button nz-button class="btn default" *ngIf="coopBtns.del"
76
+          [disabled]="!checkedDepIds.length||(checkOptionsOne[3]?.checked)" (click)='showDelModals($event)'>批量删除</button> -->
74 77
         <button nz-button class="btn default" *ngIf="coopBtns.del"
75
-          [disabled]="!checkedDepIds.length||(checkOptionsOne[3]?.checked)" (click)='showDelModals($event)'>批量删除</button>
78
+          [disabled]="!checkedDepIds.length||(checkOptionsOne[2]?.checked)" (click)='showDelModals($event)'>批量删除</button>
76 79
         <button nz-button class="btn default ml8" (click)='search()'>搜索</button>
77 80
         <button nz-button *ngIf="coopBtns.export" class="btn default ml8" (click)='export()'
78 81
           [nzLoading]="loading2">导出</button>
@@ -121,7 +124,9 @@
121 124
             <td>
122 125
               <div class="coop">
123 126
                 <span *ngIf="coopBtns.look" (click)="detail($event,data.id)">查看</span>
124
-                <span *ngIf="coopBtns.del&&data.gdState.value!=6&&data.gdState.value!=7&&!(checkOptionsOne[3]?.checked)"
127
+                <!-- <span *ngIf="coopBtns.del&&data.gdState.value!=6&&data.gdState.value!=7&&!(checkOptionsOne[3]?.checked)"
128
+                  (click)="showDelModal($event,data.id)">删除</span> -->
129
+                <span *ngIf="coopBtns.del&&data.gdState.value!=6&&data.gdState.value!=7&&!(checkOptionsOne[2]?.checked)"
125 130
                   (click)="showDelModal($event,data.id)">删除</span>
126 131
               </div>
127 132
             </td>

+ 13 - 4
src/app/views/order-management/order-management.component.ts

@@ -202,8 +202,15 @@ export class OrderManagementComponent implements OnInit {
202 202
         timeOut: that.checkOptionsOne[0].checked ? 1 : 0,
203 203
       },
204 204
     };
205
-    if (that.checkOptionsOne[3]) {
206
-      if (that.checkOptionsOne[3].checked) {
205
+    // if (that.checkOptionsOne[3]) {
206
+    //   if (that.checkOptionsOne[3].checked) {
207
+    //     data.workOrder.deleteFlag = 1;
208
+    //   } else {
209
+    //     delete data.workOrder.deleteFlag;
210
+    //   }
211
+    // }
212
+    if (that.checkOptionsOne[2]) {
213
+      if (that.checkOptionsOne[2].checked) {
207 214
         data.workOrder.deleteFlag = 1;
208 215
       } else {
209 216
         delete data.workOrder.deleteFlag;
@@ -235,7 +242,8 @@ export class OrderManagementComponent implements OnInit {
235 242
     delete data.workOrder.overdueTime24;
236 243
     delete data.workOrder.startTime1;
237 244
     delete data.workOrder.endTime1;
238
-    if (that.checkOptionsOne[2].checked) {
245
+    // if (that.checkOptionsOne[2] && that.checkOptionsOne[2].checked) {
246
+    if (false) {
239 247
       data.workOrder.overdueTime24 = true;
240 248
     } else if (that.startDate && that.endDate) {
241 249
       data.workOrder.startTime1 = that.startDate;
@@ -411,7 +419,8 @@ export class OrderManagementComponent implements OnInit {
411 419
     delete postData.workOrder.overdueTime24;
412 420
     delete postData.workOrder.startTime1;
413 421
     delete postData.workOrder.endTime1;
414
-    if (that.checkOptionsOne[2].checked) {
422
+    // if (that.checkOptionsOne[2] && that.checkOptionsOne[2].checked) {
423
+    if (false) {
415 424
       postData.workOrder.overdueTime24 = true;
416 425
     } else if (that.startDate && that.endDate) {
417 426
       postData.workOrder.startTime1 = that.startDate;

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

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

+ 51 - 0
src/app/views/preview/preview.component.html

@@ -0,0 +1,51 @@
1
+<div class="preview" [ngStyle]="{margin:isM?0:'',minHeight:isM?'100vh':''}">
2
+  <ng-container *ngIf="!success">
3
+    <ng-container *ngIf="!failure">
4
+      <div *ngIf="!loading">
5
+        <h1>{{qm.title}}</h1>
6
+        <p>{{qm.surveyDescribe}}</p>
7
+        <form nz-form [formGroup]="validateForm">
8
+          <ng-container *ngFor="let item of listOfData;let i=index;">
9
+            <!-- 单选 -->
10
+            <nz-form-item *ngIf="item.answerMode && item.answerMode.value == 1">
11
+              <nz-form-label [nzSpan]="24" nzRequired>Q{{i+1}}.{{item.describe}}</nz-form-label>
12
+              <nz-form-control [nzSpan]="24" nzErrorTip="请选择!">
13
+                <nz-radio-group [formControlName]="item.propName">
14
+                  <label nz-radio [nzValue]="radioItem" *ngFor="let radioItem of item.radioItems" class="radioItem">{{radioItem}}</label>
15
+                </nz-radio-group>
16
+              </nz-form-control>
17
+            </nz-form-item>
18
+            <!-- 单行填空 -->
19
+            <nz-form-item *ngIf="item.answerMode && item.answerMode.value == 2">
20
+              <nz-form-label [nzSpan]="24" nzRequired>Q{{i+1}}.{{item.describe}}</nz-form-label>
21
+              <nz-form-control [nzSpan]="24" nzErrorTip="请填写!">
22
+                <input nz-input [formControlName]="item.propName" placeholder="请填写!" maxlength="200" />
23
+              </nz-form-control>
24
+            </nz-form-item>
25
+            <!-- 多行填空 -->
26
+            <nz-form-item *ngIf="item.answerMode && item.answerMode.value == 3">
27
+              <nz-form-label [nzSpan]="24" nzRequired>Q{{i+1}}.{{item.describe}}</nz-form-label>
28
+              <nz-form-control [nzSpan]="24" nzErrorTip="请填写!">
29
+                <textarea nz-input rows="4" [formControlName]="item.propName" placeholder="请填写!" maxlength="200"></textarea>
30
+              </nz-form-control>
31
+            </nz-form-item>
32
+          </ng-container>
33
+          <nz-form-item nz-row class="submit" *ngIf="listOfData.length && qm.state.value == 2">
34
+            <nz-form-control>
35
+              <button nz-button nzType="primary" [nzLoading]="loading" (click)="submitForm()">提交</button>
36
+            </nz-form-control>
37
+          </nz-form-item>
38
+        </form>
39
+      </div>
40
+      <div class="loading" *ngIf="loading">
41
+        <nz-spin nzSimple></nz-spin>
42
+      </div>
43
+    </ng-container>
44
+    <div class="failure" *ngIf="failure">
45
+      该链接不存在!
46
+    </div>
47
+  </ng-container>
48
+  <div class="success" *ngIf="success">
49
+    感谢您的参与!
50
+  </div>
51
+</div>

+ 51 - 0
src/app/views/preview/preview.component.less

@@ -0,0 +1,51 @@
1
+:host{
2
+    width: 100%;
3
+    min-height: 100vh;
4
+    background-color: #f4f5f7;
5
+    ::ng-deep .ant-form label,
6
+    ::ng-deep .ant-input,
7
+    ::ng-deep .ant-btn{
8
+        font-size: 16px!important;
9
+    }
10
+}
11
+.preview{
12
+    width: 100%;
13
+    max-width: 750px;
14
+    background-color: #fff;
15
+    padding: 0.3rem;
16
+    margin: 0.3rem auto;
17
+    h1{
18
+        font-size: 18px;
19
+    }
20
+    p{
21
+        font-size: 14px;
22
+    }
23
+    .loading{
24
+        text-align: center;
25
+    }
26
+    .failure{
27
+        text-align: center;
28
+    }
29
+    .success{
30
+        text-align: center;
31
+    }
32
+    textarea{
33
+        resize: none;
34
+    }
35
+    .radioItem{
36
+        display: block;
37
+        width: 100%;
38
+        margin-top: 0.1rem;
39
+        padding: 0.1rem;
40
+        border: 1px solid #ebeef5;
41
+    }
42
+    .ant-radio-group{
43
+        width: 100%;
44
+    }
45
+    .submit{
46
+        text-align: center;
47
+        button{
48
+            width: 1.6rem;
49
+        }
50
+    }
51
+}

+ 103 - 0
src/app/views/preview/preview.component.ts

@@ -0,0 +1,103 @@
1
+import { Component, OnInit } from '@angular/core';
2
+import { ActivatedRoute } from '@angular/router';
3
+import { MainService } from 'src/app/services/main.service';
4
+import { FormGroup, FormBuilder, Validators, FormControl } from '@angular/forms';
5
+import { NzMessageService } from 'ng-zorro-antd';
6
+
7
+@Component({
8
+  selector: 'app-preview',
9
+  templateUrl: './preview.component.html',
10
+  styleUrls: ['./preview.component.less']
11
+})
12
+export class PreviewComponent implements OnInit {
13
+  validateForm: FormGroup;
14
+  qm:any = {};
15
+  loading:boolean = false;
16
+  failure:boolean = false;
17
+  listOfData:any[] = [];
18
+  success:boolean = false;
19
+  isM:boolean = false;
20
+
21
+  constructor(
22
+    private route: ActivatedRoute,
23
+    private mainService:MainService,
24
+    private fb: FormBuilder,
25
+    private message: NzMessageService,
26
+  ) {}
27
+
28
+  ngOnInit() {
29
+    this.isM = this.isMobile();
30
+    this.initForm();
31
+    if(this.isM){
32
+      document.documentElement.style.fontSize = '13.33333vw';
33
+    }else{
34
+      document.documentElement.style.fontSize = '100px';
35
+    }
36
+    this.getList();
37
+  }
38
+  // 初始化Form
39
+  initForm(){
40
+    this.validateForm = this.fb.group({});
41
+  }
42
+  // 提交
43
+  submitForm(): void {
44
+    for (const i in this.validateForm.controls) {
45
+      this.validateForm.controls[i].markAsDirty();
46
+      this.validateForm.controls[i].updateValueAndValidity();
47
+    }
48
+    if (this.validateForm.invalid) {
49
+      return;
50
+    }
51
+    console.log(this.validateForm.value);
52
+    const postData:any ={
53
+      qmId: this.qm.id,
54
+      answerList: Object.entries(this.validateForm.value).map(v=>({
55
+        managementId: this.qm.id,
56
+        infoId: v[0],
57
+        answer: v[1],
58
+        hosId: this.qm.hosId,
59
+      }))
60
+    };
61
+    const mid = this.message.loading('loading..', { nzDuration: 0 }).messageId;
62
+    this.mainService.surveyCommit(postData).subscribe((res:any)=>{
63
+      this.message.remove(mid);
64
+      if (res.status == 200) {
65
+        this.message.create('success', `提交成功`);
66
+        this.success = true;
67
+      }else{
68
+        this.message.create('error', res.msg || `提交失败`);
69
+      }
70
+    })
71
+  }
72
+  // 判断是否是移动端
73
+  isMobile(){
74
+      const reg = /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i;
75
+      return reg.test(navigator.userAgent);
76
+  }
77
+  // 问卷数据
78
+  getList() {
79
+    let token = this.route.snapshot.queryParams.token;
80
+    if(token){
81
+      let postData = {};
82
+      this.loading = true;
83
+      this.mainService
84
+      .managerQuestionnairePreview(postData,token)
85
+      .subscribe((data:any) => {
86
+        this.loading = false;
87
+        if (data.status == 200) {
88
+          this.qm = data.data.qm;
89
+          let list = data.data.qi.map((v,i)=>({...v,propName:v.id,radioItems:[v.option1,v.option2,v.option3,v.option4,v.option5,v.option6,v.option7,v.option8,v.option9,v.option10]}));
90
+          list.forEach(v=>{
91
+            v.radioItems = v.radioItems.filter(Boolean);
92
+            this.validateForm.addControl(v.propName,new FormControl(null, Validators.required));
93
+          })
94
+          this.listOfData = list;
95
+        }else{
96
+          this.failure = true;
97
+        }
98
+      });
99
+    }else{
100
+      this.failure = true;
101
+    }
102
+  }
103
+}

+ 17 - 0
src/app/views/preview/preview.module.ts

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

+ 17 - 0
src/app/views/questionnaire-answer/questionnaire-answer-routing.module.ts

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

+ 42 - 0
src/app/views/questionnaire-answer/questionnaire-answer.component.html

@@ -0,0 +1,42 @@
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 class="btn default" (click)='export()' [nzLoading]="loading2">导出</button>
7
+      </div>
8
+    </div>
9
+    <div class="list-template__bottom">
10
+      <nz-table
11
+        class="list-template__nzTable"
12
+        [nzData]="listOfData"
13
+        nzSize="middle"
14
+        [nzShowPagination]="false"
15
+        [nzLoading]="loading1"
16
+      >
17
+        <thead>
18
+          <tr class="thead">
19
+            <th nzWidth="50px">序号</th>
20
+            <th *ngFor="let item of listOfDataTh">{{item.describe}}</th>
21
+          </tr>
22
+        </thead>
23
+        <tbody>
24
+          <tr *ngFor="let data of listOfData; let i = index">
25
+            <td>{{ i + 1 }}</td>
26
+            <td *ngFor="let item of data">{{ item.answer }}</td>
27
+          </tr>
28
+        </tbody>
29
+      </nz-table>
30
+      <div class="list-template__pagination">
31
+        <nz-pagination
32
+          [(nzPageIndex)]="pageIndex"
33
+          [(nzTotal)]="listLength"
34
+          [(nzPageSize)]="pageSize"
35
+          (nzPageIndexChange)="getList(0)"
36
+          (nzPageSizeChange)="getList(0)"
37
+        >
38
+        </nz-pagination>
39
+      </div>
40
+    </div>
41
+  </div>
42
+</div>

+ 170 - 0
src/app/views/questionnaire-answer/questionnaire-answer.component.less

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

+ 94 - 0
src/app/views/questionnaire-answer/questionnaire-answer.component.ts

@@ -0,0 +1,94 @@
1
+import { Component, OnInit } from "@angular/core";
2
+import { ActivatedRoute, Router } from "@angular/router";
3
+import { MainService } from "../../services/main.service";
4
+import { ToolService } from "../../services/tool.service";
5
+import { NzMessageService } from 'ng-zorro-antd';
6
+import { THIS_EXPR } from '@angular/compiler/src/output/output_ast';
7
+@Component({
8
+  selector: "app-questionnaire-answer",
9
+  templateUrl: "./questionnaire-answer.component.html",
10
+  styleUrls: ["./questionnaire-answer.component.less"],
11
+})
12
+export class QuestionnaireAnswerComponent implements OnInit {
13
+  constructor(
14
+    private mainService: MainService,
15
+    private route: ActivatedRoute,
16
+    private router: Router,
17
+    private tool: ToolService,
18
+    private message: NzMessageService
19
+  ) {}
20
+
21
+  userInfo: any = JSON.parse(localStorage.getItem("user")) || {}; //登录用户信息
22
+  listOfData: any[] = []; //表格数据
23
+  listOfDataTh: any[] = []; //表格数据
24
+  pageIndex: number = 1; //表格当前页码
25
+  pageSize: number = 10; //表格每页展示条数
26
+  listLength: number = 10; //表格总数据量
27
+  currentHospital; //当前院区
28
+
29
+  ngOnInit() {
30
+    this.currentHospital = this.tool.getCurrentHospital();
31
+    this.getList(1);
32
+  }
33
+
34
+  // 初始化增删改按钮
35
+  coopBtns: any = {};
36
+  // 导出
37
+  loading2 = false;
38
+  export() {
39
+    let postData = {
40
+      idx: 0,
41
+      sum: 99999,
42
+      qmId: this.route.snapshot.queryParams.id,
43
+    };
44
+    this.loading2 = true;
45
+    this.mainService.exportReport("survey", postData).subscribe(
46
+      (data) => {
47
+        this.loading2 = false;
48
+        this.message.create('success', `导出成功`);
49
+        var file = new Blob([data], {
50
+          type: "application/vnd.ms-excel",
51
+        });
52
+        //trick to download store a file having its URL
53
+        var fileURL = URL.createObjectURL(file);
54
+        var a = document.createElement("a");
55
+        a.href = fileURL;
56
+        a.target = "_blank";
57
+        a.download = `回收数据.xls`;
58
+        document.body.appendChild(a);
59
+        a.click();
60
+      },
61
+      (err) => {
62
+        this.loading2 = false;
63
+        this.message.create('error', `导出失败`);
64
+      }
65
+    );
66
+  }
67
+  // 表格数据
68
+  loading1 = false;
69
+  getList(type) {
70
+    if (type == 1) {
71
+      this.pageIndex = 1;
72
+    }
73
+    let postData = {
74
+      idx: this.pageIndex - 1,
75
+      sum: this.pageSize,
76
+      qmId: this.route.snapshot.queryParams.id
77
+    };
78
+    this.loading1 = true;
79
+    this.mainService
80
+      .listQuestionnaire(postData)
81
+      .subscribe((data:any) => {
82
+        this.loading1 = false;
83
+        if (data.status == 200) {
84
+          this.listOfData = data.data?data.data.answers:[];
85
+          // if(data.data && data.data.answers){
86
+          //   data.data.answers
87
+          // }
88
+          this.listOfDataTh = data.data?data.data.infos:[];
89
+          this.listLength = data.totalNum;
90
+        }
91
+      });
92
+  }
93
+}
94
+

+ 17 - 0
src/app/views/questionnaire-answer/questionnaire-answer.module.ts

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

+ 14 - 0
src/app/views/questionnaire-management-detail/questionnaire-management-detail-routing.module.ts

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

+ 30 - 0
src/app/views/questionnaire-management-detail/questionnaire-management-detail.component.html

@@ -0,0 +1,30 @@
1
+<div class="detail display_flex justify-content_flex-center align-items_center" *ngIf="!maskFlag">
2
+    <div class="modalBody">
3
+      <div class="title">问卷详情<i class="icon_transport transport-guanbi" (click)="hideModal()"></i></div>
4
+      <div class="content">
5
+        <div class="info">
6
+          <div nz-row>
7
+            <div nz-col nzSpan="24">
8
+              <div class="item display_flex align-items_flex-start">
9
+                <span>问卷标题</span>
10
+                <span>{{detail.title || '无'}}</span>
11
+              </div>
12
+            </div>
13
+            <div nz-col nzSpan="24">
14
+              <div class="item display_flex align-items_flex-start">
15
+                <span>问卷内容</span>
16
+                <span>{{detail.surveyDescribe || '无'}}</span>
17
+              </div>
18
+            </div>
19
+          </div>
20
+        </div>
21
+      </div>
22
+      <div class="display_flex justify-content_flex-center">
23
+        <button class="know" nz-button nzType="primary" (click)="goToQuestions(detail)">查看问题</button>
24
+        <button class="know ml8" nz-button nzType="primary" nzGhost (click)="hideModal()">知道了</button>
25
+      </div>
26
+    </div>
27
+  </div>
28
+  <!-- 遮罩 -->
29
+  <app-mask *ngIf="maskFlag"></app-mask>
30
+  

+ 152 - 0
src/app/views/questionnaire-management-detail/questionnaire-management-detail.component.less

@@ -0,0 +1,152 @@
1
+@import "../../../../src/theme.less";
2
+
3
+.detail {
4
+  position: fixed;
5
+  left: 0;
6
+  top: 0;
7
+  width: 100%;
8
+  height: 100%;
9
+  background: rgba(0, 0, 0, 0.4);
10
+  z-index: 99;
11
+
12
+  .modalBody {
13
+    width: 480px;
14
+    background: #fff;
15
+    border-radius: 5px;
16
+    padding: 10px 20px;
17
+    color: #333;
18
+
19
+    .title {
20
+      width: 100%;
21
+      text-align: center;
22
+      font-size: 18px;
23
+      position: relative;
24
+
25
+      i {
26
+        position: absolute;
27
+        right: 0;
28
+        top: 0;
29
+        font-size: 20px;
30
+        color: #666;
31
+        cursor: pointer;
32
+        padding: 0 5px;
33
+      }
34
+    }
35
+
36
+    .content {
37
+      width: 100%;
38
+      background: #f9fafb;
39
+      border: 1px solid #e5e9ed;
40
+      border-radius: 5px;
41
+      overflow: hidden;
42
+      margin-top: 12px;
43
+      padding: 9px 24px;
44
+
45
+      .bottom,.top {
46
+        span:nth-child(1) {
47
+          font-size: 14px;
48
+          color: @primary-color;
49
+        }
50
+
51
+        span:nth-child(2) {
52
+          font-size: 12px;
53
+          color: #999;
54
+        }
55
+        .roundRobinTips{
56
+          font-size: 12px;
57
+          margin-bottom: 0;
58
+        }
59
+      }
60
+      .top{
61
+        border-top: 2px solid #eff2f4;
62
+        padding: 16px 0;
63
+      }
64
+      .bottom{
65
+        border-bottom: 2px solid #eff2f4;
66
+        height: 35px;
67
+      }
68
+
69
+      .info {
70
+        margin-top: 15px;
71
+        margin-bottom: 4px;
72
+
73
+        .left {
74
+          border-right: 2px dashed #eff2f4;
75
+          padding-right: 23px;
76
+        }
77
+
78
+        .right {
79
+          padding-left: 23px;
80
+        }
81
+
82
+        .item {
83
+          // display: flex;
84
+          // justify-content: space-between;
85
+          // align-items: flex-start;
86
+          margin-bottom: 5px;
87
+
88
+          & > span:nth-child(1) {
89
+            color: #666;
90
+            min-width: 70px;
91
+          }
92
+
93
+          & > span:nth-child(2) {
94
+            color: #333;
95
+          }
96
+        }
97
+      }
98
+    }
99
+
100
+    .know {
101
+      margin-top: 10px;
102
+    }
103
+  }
104
+
105
+  // 新增
106
+  &.add {
107
+    .modalBody {
108
+      width: 480px;
109
+      height: auto;
110
+
111
+      .content {
112
+        width: 100%;
113
+        height: auto;
114
+        padding: 18px 14px 0 14px;
115
+
116
+        .addForm {
117
+          .ant-form-item {
118
+            margin-bottom: 14px;
119
+
120
+            .ant-form-item-label {
121
+              line-height: 0;
122
+            }
123
+          }
124
+        }
125
+
126
+        .editForm {
127
+          .ant-form-item {
128
+            margin-bottom: 14px;
129
+
130
+            .ant-form-item-label {
131
+              line-height: 0;
132
+            }
133
+          }
134
+        }
135
+      }
136
+
137
+      .btn {
138
+        button {
139
+          // width: 80px;
140
+
141
+          &:nth-child(1) {
142
+            margin-right: 20px;
143
+          }
144
+        }
145
+      }
146
+    }
147
+  }
148
+}
149
+
150
+.txtC {
151
+  text-align: center;
152
+}

+ 52 - 0
src/app/views/questionnaire-management-detail/questionnaire-management-detail.component.ts

@@ -0,0 +1,52 @@
1
+import { Component, OnInit } from "@angular/core";
2
+import { Router, ActivatedRoute } from "@angular/router";
3
+import { NzMessageService } from "ng-zorro-antd";
4
+
5
+import { MainService } from "../../services/main.service";
6
+
7
+@Component({
8
+  selector: "app-questionnaire-management-detail",
9
+  templateUrl: "./questionnaire-management-detail.component.html",
10
+  styleUrls: ["./questionnaire-management-detail.component.less"],
11
+})
12
+export class QuestionnaireManagementDetailComponent implements OnInit {
13
+  constructor(
14
+    private message: NzMessageService,
15
+    private router: Router,
16
+    private mainService: MainService,
17
+    private routerInfo: ActivatedRoute
18
+  ) {}
19
+
20
+  id: number;
21
+  detail: any = null;
22
+  ngOnInit() {
23
+    this.getDetail();
24
+  }
25
+  hideModal() {
26
+    this.router.navigateByUrl("/main/questionnaireManagement");
27
+  }
28
+
29
+  // 查看问题
30
+  goToQuestions(data){
31
+    this.router.navigateByUrl(`/main/questions?id=${data.id}&title=${data.title}`);
32
+  }
33
+
34
+  // 获取详情
35
+  maskFlag: any = false;
36
+  getDetail() {
37
+    this.id = this.routerInfo.snapshot.params["id"];
38
+    this.maskFlag = this.message.loading("正在加载中..", {
39
+      nzDuration: 0,
40
+    }).messageId;
41
+    this.mainService
42
+      .getFetchData("api", "questionnaireManagement", this.id)
43
+      .subscribe((data) => {
44
+        this.message.remove(this.maskFlag);
45
+        this.maskFlag = false;
46
+        if (data.status == 200) {
47
+          this.detail = data.data;
48
+        }
49
+      });
50
+  }
51
+}
52
+

+ 19 - 0
src/app/views/questionnaire-management-detail/questionnaire-management-detail.module.ts

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

+ 19 - 7
src/app/views/questionnaire-management/questionnaire-management-routing.module.ts

@@ -1,14 +1,26 @@
1
-import { NgModule } from '@angular/core';
2
-import { Routes, RouterModule } from '@angular/router';
3
-import { QuestionnaireManagementComponent } from './questionnaire-management.component';
4
-
1
+import { NgModule } from "@angular/core";
2
+import { Routes, RouterModule } from "@angular/router";
3
+import { QuestionnaireManagementComponent } from "./questionnaire-management.component";
5 4
 
6 5
 const routes: Routes = [
7
-  { path: '', component: QuestionnaireManagementComponent }
6
+  {
7
+    path: "",
8
+    component: QuestionnaireManagementComponent,
9
+    children: [
10
+      {
11
+        // 查看详情
12
+        path: "questionnaireManagementDetail/:id",
13
+        loadChildren: () =>
14
+          import("../questionnaire-management-detail/questionnaire-management-detail.module").then(
15
+            (m) => m.QuestionnaireManagementDetailModule
16
+          ),
17
+      },
18
+    ],
19
+  },
8 20
 ];
9 21
 
10 22
 @NgModule({
11 23
   imports: [RouterModule.forChild(routes)],
12
-  exports: [RouterModule]
24
+  exports: [RouterModule],
13 25
 })
14
-export class QuestionnaireManagementRoutingModule { }
26
+export class QuestionnaireManagementRoutingModule {}

+ 39 - 37
src/app/views/questionnaire-management/questionnaire-management.component.html

@@ -11,30 +11,33 @@
11 11
           [nzLoading]="loading1">
12 12
           <thead>
13 13
             <tr class="thead">
14
+              <th nzWidth="50px">序号</th>
14 15
               <th nzWidth="15%">问卷标题</th>
15
-              <th nzWidth="27%">调查目标</th>
16
-              <th nzWidth="7%">创建时间</th>
17
-              <th nzWidth="8%">状态</th>
16
+              <th nzWidth="15%">调查目标</th>
17
+              <th nzWidth="15%">创建时间</th>
18
+              <th nzWidth="15%">状态</th>
18 19
               <th nzWidth="15%">答题数量</th>
19
-              <th nzWidth="28%">操作</th>
20
+              <th nzWidth="15%">操作</th>
20 21
             </tr>
21 22
           </thead>
22 23
           <tbody>
23 24
             <tr *ngFor="let data of listOfData;let i = index">
24
-              <td>{{data.name}}</td>
25
-              <td>{{data.describe}}</td>
26
-              <td>{{data.workType == 1?'综合排班':'自选排班'}}</td>
27
-              <td>{{data.status?'启用中':'停用中'}}</td>
28
-              <td>{{data.startTime?data.startTime:'-'}}</td>
25
+              <td>{{i+1}}</td>
26
+              <td>{{data.title}}</td>
27
+              <td>{{data.surveyTarget?data.surveyTarget.name:'无'}}</td>
28
+              <td>{{data.createTime|date:'yyyy-MM-dd HH:mm'}}</td>
29
+              <td>{{data.state?data.state.name:'无'}}</td>
30
+              <td>{{data.answerNum}}</td>
29 31
               <td>
30 32
                 <div class="coop">
31
-                  <span *ngIf="coopBtns.isStartUp"
32
-                    (click)="showDelModal(data,'启用【'+data.name+'】将会停用正在使用的方案,您是否确定启用【'+data.name+'】?','启用','switch',data.status)">启用</span>
33
-                  <span *ngIf="coopBtns.isTimedStartUp&&!data.status"
34
-                    (click)="addDateModal(data)">{{data.timingStatus?'关闭定时启用':'定时启用'}}</span>
35
-                  <span *ngIf="coopBtns.del&&!data.status" (click)="showDelModal(data,'您确认要删除此方案吗?','删除','del')">删除</span>
36
-                  <span *ngIf="coopBtns.copy" (click)="copy(data)">复制</span>
37
-                  <span *ngIf="coopBtns.edit" (click)="edit(data)">编辑</span>
33
+                  <span *ngIf="coopBtns.look" (click)="detail(data.id)">查看</span>
34
+                  <span *ngIf="coopBtns.edit&&data.state&&(data.state.value == 1 || data.state.value == 2)" (click)="edit(data)">编辑</span>
35
+                  <span *ngIf="coopBtns.del&&!data.status" (click)="showDelModal(data,'您确认要删除此问卷吗?','删除','del')">删除</span>
36
+                  <span *ngIf="coopBtns.look&&data.state&&(data.state.value == 2 || data.state.value == 3)" (click)="recovery(data)">回收数据</span>
37
+                  <span *ngIf="coopBtns.look&&data.state&&data.state.value == 1" (click)="publish(data)">发布</span>
38
+                  <span *ngIf="coopBtns.look&&data.state&&data.state.value == 2" (click)="generateLink(data)">链接生成</span>
39
+                  <span *ngIf="coopBtns.look&&data.state&&data.state.value == 2" (click)="researchCompleted(data)">调研完成</span>
40
+                  <!-- <span *ngIf="coopBtns.copy" (click)="copy(data)">复制</span> -->
38 41
                 </div>
39 42
               </td>
40 43
             </tr>
@@ -73,8 +76,8 @@
73 76
             </nz-form-item>
74 77
             <nz-form-item>
75 78
               <nz-form-label [nzSpan]="6" [nzXs]="24" nzRequired nzFor="surveyTarget">调查目标</nz-form-label>
76
-              <nz-form-control nzErrorTip="请输入调查目标!">
77
-                <nz-select [nzDropdownMatchSelectWidth]="false" formControlName="surveyTarget" nzShowSearch nzPlaceHolder="请选择调研目标">
79
+              <nz-form-control nzErrorTip="请选择调查目标!">
80
+                <nz-select [nzDisabled]="!add" [nzDropdownMatchSelectWidth]="false" formControlName="surveyTarget" nzShowSearch nzPlaceHolder="请选择调研目标">
78 81
                   <nz-option nzLabel="{{data.name}}" nzValue="{{data.id}}" *ngFor="let data of surveyTargets"></nz-option>
79 82
                 </nz-select>
80 83
               </nz-form-control>
@@ -83,32 +86,31 @@
83 86
         </div>
84 87
         <div class=" display_flex justify-content_flex-center">
85 88
           <button nzType="primary" nz-button (click)="submitForm()" [nzLoading]="btnLoading">配置问题</button>
86
-          <!-- <button class="btn" nzGhost nzType="primary" nz-button (click)="submitForm(true)" [nzLoading]="btnLoading1"
87
-            *ngIf="copyModel||!add">完成配置</button> -->
89
+          <button class="btn" nzGhost nzType="primary" nz-button (click)="submitForm(true)" [nzLoading]="btnLoading1"
90
+            *ngIf="!add">保存</button>
88 91
           <button class="btn cancel" nz-button nzType="default" (click)="hideAddModal()">取消</button>
89 92
         </div>
90 93
       </div>
91 94
     </div>
92
-    <!-- 定时启用设置日期模态框 -->
93
-    <div class="save display_flex justify-content_flex-center align-items_center add" *ngIf="dateModal">
94
-      <div class="modalBody">
95
-        <div class="title">定时启用<i class="icon_transport transport-guanbi" (click)="hideDateModal()"></i>
95
+    <!-- 显示生成链接模态框 -->
96
+    <div class="save display_flex justify-content_flex-center align-items_center add" *ngIf="linkModal">
97
+      <div class="modalBody" style="width: 640px;">
98
+        <div class="title">提示<i class="icon_transport transport-guanbi" (click)="hideLinkModal()"></i>
96 99
         </div>
97
-        <div class="content">
98
-          <form nz-form [formGroup]="validateDateForm" class="addForm" (ngSubmit)="submitDateForm()">
99
-            <nz-form-item>
100
-              <nz-form-label [nzSm]="24" [nzXs]="24" nzRequired nzFor="datePickerTime">选择日期</nz-form-label>
101
-              <nz-form-control [nzSm]="24" [nzXs]="24" nzErrorTip="请选择日期!">
102
-                <nz-date-picker [ngModel]="datePicker" (ngModelChange)="datePickerChange($event)"
103
-                  [nzShowTime]="{ nzDefaultOpenValue: timeDefaultValue }" formControlName="datePickerTime"
104
-                  [nzDisabledTime]="disabledDateTime"></nz-date-picker>
105
-              </nz-form-control>
106
-            </nz-form-item>
107
-          </form>
100
+        <div class="content" style="display: flex;">
101
+          <div style="flex: 1;border-right: 2px solid #e5e9ed;">
102
+            <div>内网链接:<a [href]="coopId.innerLink" target="_blank">{{coopId.innerLink}}</a></div>
103
+            <div><img style="width: 70%;" [src]="coopId.innerQrcode"></div>
104
+            <button nz-button nzType="default" (click)="downLoadQrCode(coopId.innerQrcode)">下载二维码</button>
105
+          </div>
106
+          <div style="flex: 1;">
107
+            <div>外网链接:<a [href]="coopId.outLink" target="_blank">{{coopId.outLink}}</a></div>
108
+            <div><img style="width: 70%;" [src]="coopId.outQrcode"></div>
109
+            <button nz-button nzType="default" (click)="downLoadQrCode(coopId.innerQrcode)">下载二维码</button>
110
+          </div>
108 111
         </div>
109 112
         <div class=" display_flex justify-content_flex-center">
110
-          <button nzType="primary" nz-button (click)="submitDateForm()" [nzLoading]="btnLoading">确定</button>
111
-          <button class="btn cancel" nz-button nzType="default" (click)="hideDateModal()">取消</button>
113
+          <button class="btn cancel" nz-button nzType="default" (click)="hideLinkModal()">知道了</button>
112 114
         </div>
113 115
       </div>
114 116
     </div>

+ 3 - 0
src/app/views/questionnaire-management/questionnaire-management.component.less

@@ -46,6 +46,9 @@
46 46
       overflow: hidden;
47 47
       margin-top: 12px;
48 48
       padding: 16px 0;
49
+      a:hover{
50
+        text-decoration: underline;
51
+      }
49 52
 
50 53
       & > div {
51 54
         text-align: center;

+ 189 - 199
src/app/views/questionnaire-management/questionnaire-management.component.ts

@@ -6,8 +6,8 @@ import setMinutes from "date-fns/setMinutes";
6 6
 import setHours from "date-fns/setHours";
7 7
 
8 8
 import { MainService } from "../../services/main.service";
9
-import { DisabledTimeFn } from "ng-zorro-antd/date-picker/standard-types";
10 9
 import { ToolService } from "../../services/tool.service";
10
+import { NzMessageService } from 'ng-zorro-antd';
11 11
 @Component({
12 12
   selector: "app-questionnaire-management",
13 13
   templateUrl: "./questionnaire-management.component.html",
@@ -19,7 +19,8 @@ export class QuestionnaireManagementComponent implements OnInit {
19 19
     private mainService: MainService,
20 20
     private route: ActivatedRoute,
21 21
     private router: Router,
22
-    private tool: ToolService
22
+    private tool: ToolService,
23
+    private message: NzMessageService
23 24
   ) {}
24 25
 
25 26
   userInfo: any = JSON.parse(localStorage.getItem("user")) || {}; //登录用户信息
@@ -29,10 +30,9 @@ export class QuestionnaireManagementComponent implements OnInit {
29 30
   listLength: number = 10; //表格总数据量
30 31
   tableHeight: number; //表格动态高
31 32
   modal: boolean = false; //新增/编辑模态框
32
-  dateModal: boolean = false; //定时启用设置日期模态框
33
+  linkModal: boolean = false; //显示生成链接模态框
33 34
   add: boolean; //true:新增;false:编辑
34 35
   validateForm: FormGroup; //新增/编辑表单
35
-  validateDateForm: FormGroup; //定时启动设置日期表单
36 36
   coopId: any; //当前操作列
37 37
   currentHospital; //当前院区
38 38
   timeDefaultValue = setHours(setMinutes(setSeconds(new Date(), 0), 0), 0);
@@ -76,13 +76,13 @@ export class QuestionnaireManagementComponent implements OnInit {
76 76
     let data = {
77 77
       idx: this.pageIndex - 1,
78 78
       sum: this.pageSize,
79
-      workScheme: {
79
+      questionnaireManagement: {
80 80
         hosId: this.currentHospital.id,
81 81
       },
82 82
     };
83 83
     this.loading1 = true;
84 84
     this.mainService
85
-      .getFetchDataList("configuration", "workScheme", data)
85
+      .getFetchDataList("api", "questionnaireManagement", data)
86 86
       .subscribe((data) => {
87 87
         this.loading1 = false;
88 88
         if (data.status == 200) {
@@ -107,28 +107,14 @@ export class QuestionnaireManagementComponent implements OnInit {
107 107
   }
108 108
   // 新增/编辑弹框
109 109
   timeFlag = ""; //open开启,close关闭
110
-  addDateModal(data) {
111
-    if (!data.timingStatus) {
112
-      this.datePicker = "";
113
-    }
114
-    this.timeFlag = data.timingStatus ? "close" : "open";
110
+  addLinkModal(data) {
115 111
     this.coopId = data;
116
-    if (this.timeFlag == "close") {
117
-      this.showDelModal(
118
-        data,
119
-        "是否确定关闭定时启用?确定后该方案将不会执行!",
120
-        "关闭定时启用",
121
-        "switchTime"
122
-      );
123
-    } else {
124
-      this.dateModal = true;
125
-    }
126
-    this.initDateForm();
112
+    this.linkModal = true;
127 113
   }
128 114
   //关闭定时启用设置日期弹框
129
-  hideDateModal() {
130
-    this.dateModal = false;
131
-    this.initDateForm();
115
+  hideLinkModal() {
116
+    this.linkModal = false;
117
+    this.getList(0);
132 118
   }
133 119
   // 初始化新增form表单
134 120
   initForm() {
@@ -138,16 +124,34 @@ export class QuestionnaireManagementComponent implements OnInit {
138 124
       surveyDescribe: [null, [Validators.required]],
139 125
     });
140 126
   }
141
-  // 初始化新增form表单
142
-  initDateForm() {
143
-    this.validateDateForm = this.fb.group({
144
-      datePickerTime: [null, [Validators.required]],
145
-    });
127
+  // 查看问题
128
+  goToQuestions(data){
129
+    // this.router.navigateByUrl(`/main/questions?id=${data.id}&title=${data.title}&token=${data.token}`);
130
+    this.router.navigateByUrl(`/main/questions?id=${data.id}`);
131
+  }
132
+  // 回收数据
133
+  recovery(data){
134
+    console.log(data);
135
+    this.router.navigateByUrl(`/main/questionnaireAnswer?id=${data.id}`);
136
+  }
137
+  // 发布
138
+  publish(data){
139
+    console.log(data);
140
+    this.showDelModal(data,`您确认【${data.title}】要发布进行调研吗?`,'操作','publish')
141
+  }
142
+  // 链接生成
143
+  generateLink(data){
144
+    console.log(data);
145
+    this.addLinkModal(data);
146
+  }
147
+  // 调研完成
148
+  researchCompleted(data){
149
+    console.log(data);
150
+    this.showDelModal(data,`您确认【${data.title}】已调研完成了吗?`,'操作','complete')
146 151
   }
147
-
148 152
   // 新增/编辑表单提交
149
-  btnLoading1 = false; //完成
150
-  submitForm(noGoTo?): void {
153
+  btnLoading1 = false;
154
+  submitForm(noGoTo=false): void {
151 155
     for (const i in this.validateForm.controls) {
152 156
       this.validateForm.controls[i].markAsDirty();
153 157
       this.validateForm.controls[i].updateValueAndValidity();
@@ -155,19 +159,19 @@ export class QuestionnaireManagementComponent implements OnInit {
155 159
     if (this.validateForm.invalid) {
156 160
       return;
157 161
     }
158
-    if (noGoTo) {
162
+    if(noGoTo){
159 163
       this.btnLoading1 = true;
160
-    } else {
164
+    }else{
161 165
       this.btnLoading = true;
162 166
     }
163
-    let data = {};
167
+    let data:any = {};
164 168
 
165 169
     if (this.add) {
166 170
       //增加
167 171
       data = {
168 172
         questionnaireManagement: {
169 173
           title: this.validateForm.value.title,
170
-          surveyTarget: { id: parseInt(this.validateForm.value.surveyTarget) },
174
+          surveyTarget: { id: this.validateForm.value.surveyTarget },
171 175
           surveyDescribe: this.validateForm.value.surveyDescribe,
172 176
           hosId: this.currentHospital.id,
173 177
         },
@@ -176,67 +180,60 @@ export class QuestionnaireManagementComponent implements OnInit {
176 180
       //编辑
177 181
       data = {
178 182
         questionnaireManagement: {
179
-          id: this.coopId.id,
180 183
           title: this.validateForm.value.title,
181
-          surveyTarget: this.validateForm.value.surveyTarget,
184
+          surveyTarget: { id: this.validateForm.value.surveyTarget },
182 185
           surveyDescribe: this.validateForm.value.surveyDescribe,
183
-          hosId: this.currentHospital.id,
184
-        },
185
-      };
186
-    }
187
-    if (this.copyModel) {
188
-      //复制
189
-      data = {
190
-        workScheme: {
191
-          name: this.validateForm.value.title,
192
-          workType: this.validateForm.value.surveyTarget,
193
-          describe: this.validateForm.value.surveyDescribe,
194
-          status: 0,
195
-          copy: 1,
196
-          copySchemeId: this.coopId.id,
197
-          hosId: this.currentHospital.id,
198 186
         },
199 187
       };
188
+      data.questionnaireManagement = Object.assign(this.coopId,data.questionnaireManagement);
200 189
     }
190
+    // if (this.copyModel) {
191
+    //   //复制
192
+    //   data = {
193
+    //     workScheme: {
194
+    //       name: this.validateForm.value.title,
195
+    //       workType: this.validateForm.value.surveyTarget,
196
+    //       describe: this.validateForm.value.surveyDescribe,
197
+    //       status: 0,
198
+    //       copy: 1,
199
+    //       copySchemeId: this.coopId.id,
200
+    //       hosId: this.currentHospital.id,
201
+    //     },
202
+    //   };
203
+    // }
201 204
     this.mainService
202
-      .apiPost("addData", "questionnaireManagement", data)
205
+      .apiPost(this.add?"addData":'updData', "questionnaireManagement", data)
203 206
       .subscribe((result) => {
204
-        if (noGoTo) {
207
+        if(noGoTo){
205 208
           this.btnLoading1 = false;
206
-        } else {
209
+        }else{
207 210
           this.btnLoading = false;
208 211
         }
209 212
         this.hideAddModal();
210 213
         this.initForm();
211 214
         if (result.status == 200) {
212
-          if (this.copyModel) {
213
-            //复制
214
-            this.listLength++;
215
-            this.showPromptModal("复制", true, "");
216
-            if (!noGoTo) {
217
-              this.router.navigateByUrl(
218
-                `/main/quickCombination?id=${result.data.id}&name=${result.data.name}&type=${result.data.workType}`
219
-              );
220
-            }
221
-            return;
222
-          }
215
+          // if (this.copyModel) {
216
+          //   //复制
217
+          //   this.listLength++;
218
+          //   this.showPromptModal("复制", true, "");
219
+          //   if (!noGoTo) {
220
+          //     this.router.navigateByUrl(
221
+          //       `/main/quickCombination?id=${result.data.id}&name=${result.data.name}&type=${result.data.workType}`
222
+          //     );
223
+          //   }
224
+          //   return;
225
+          // }
223 226
           if (!this.add) {
224 227
             //编辑
225 228
             this.showPromptModal("编辑", true, "");
226
-            if (!noGoTo) {
227
-              this.router.navigateByUrl(
228
-                `/main/quickCombination?id=${result.data.id}&name=${result.data.name}&type=${result.data.workType}`
229
-              );
230
-            }
229
+            !noGoTo && this.goToQuestions(this.coopId);
231 230
             return;
232 231
           }
233 232
           if (this.add) {
234 233
             this.listLength++;
235 234
           }
236
-          return;
237
-          this.router.navigateByUrl(
238
-            `/main/quickCombination?id=${result.data.id}&name=${result.data.name}&type=${result.data.workType}`
239
-          );
235
+          this.message.create('success', `问卷新增成功`);
236
+          this.goToQuestions(result.data);
240 237
         } else {
241 238
           let msg = "";
242 239
           if (this.add) {
@@ -251,62 +248,6 @@ export class QuestionnaireManagementComponent implements OnInit {
251 248
         }
252 249
       });
253 250
   }
254
-  // 时间选择范围
255
-  disabledDateTime: DisabledTimeFn = () => {
256
-    return {
257
-      nzDisabledHours: () => [],
258
-      nzDisabledMinutes: () => [],
259
-      nzDisabledSeconds: () => this.range(1, 60),
260
-    };
261
-  };
262
-  range(start: number, end: number): number[] {
263
-    const result: number[] = [];
264
-    for (let i = start; i < end; i++) {
265
-      result.push(i);
266
-    }
267
-    return result;
268
-  }
269
-  // 选择日期表单提交
270
-  submitDateForm(): void {
271
-    this.btnLoading = true;
272
-    for (const i in this.validateDateForm.controls) {
273
-      this.validateDateForm.controls[i].markAsDirty();
274
-      this.validateDateForm.controls[i].updateValueAndValidity();
275
-    }
276
-    if (this.validateDateForm.invalid) {
277
-      this.btnLoading = false;
278
-      return;
279
-    }
280
-    let data = {};
281
-    let todayDate = new Date(this.validateDateForm.value.datePickerTime);
282
-    let year = todayDate.getFullYear();
283
-    let month = (todayDate.getMonth() + 1).toString().padStart(2, "0");
284
-    let date = todayDate.getDate().toString().padStart(2, "0");
285
-    let hour = todayDate.getHours().toString().padStart(2, "0");
286
-    let minutes = todayDate.getMinutes().toString().padStart(2, "0");
287
-    // 2020-07-28 16:45:00
288
-    data = {
289
-      workScheme: {
290
-        id: this.coopId.id,
291
-        timingStatus: 1,
292
-        startTime: `${year}-${month}-${date} ${hour}:${minutes}:00`,
293
-        hosId: this.currentHospital.id,
294
-      },
295
-    };
296
-    this.mainService
297
-      .coopTypeConfig("addData", "workScheme", data)
298
-      .subscribe((data) => {
299
-        this.btnLoading = false;
300
-        this.hideDateModal();
301
-        this.initDateForm();
302
-        if (data.status == 200) {
303
-          this.listLength++;
304
-          this.showPromptModal("定时启用时间设置", true, "");
305
-        } else {
306
-          this.showPromptModal("定时启用时间设置", false, data.msg);
307
-        }
308
-      });
309
-  }
310 251
 
311 252
   // 编辑
312 253
   edit(data) {
@@ -316,9 +257,9 @@ export class QuestionnaireManagementComponent implements OnInit {
316 257
     this.modal = true;
317 258
     this.coopId = data;
318 259
     this.copyModel = false;
319
-    this.validateForm.controls.title.setValue(data.name); //名称
320
-    this.validateForm.controls.surveyTarget.setValue(data.workType + ""); //类型
321
-    this.validateForm.controls.surveyDescribe.setValue(data.describe); //描述
260
+    this.validateForm.controls.title.setValue(data.title); //问卷标题
261
+    this.validateForm.controls.surveyTarget.setValue(data.surveyTarget?data.surveyTarget.id.toString():''); //调查目标
262
+    this.validateForm.controls.surveyDescribe.setValue(data.surveyDescribe); //问卷描述
322 263
   }
323 264
   //复制
324 265
   copyModel = false; //复制
@@ -357,26 +298,33 @@ export class QuestionnaireManagementComponent implements OnInit {
357 298
     tipsMsg1: string,
358 299
     tipsMsg2: string,
359 300
     type: string,
360
-    isSwitch?: boolean
361 301
   ) {
362
-    this.confirmDelIsSwitch = isSwitch;
363 302
     this.confirmDelType = type;
364 303
     this.delModal = true;
365 304
     this.coopId = data;
366 305
     this.tipsMsg1 = tipsMsg1;
367 306
     this.tipsMsg2 = tipsMsg2;
368 307
   }
369
-  // 隐藏删除
308
+  // 隐藏框
370 309
   hideDelModal() {
371 310
     this.delModal = false;
372 311
   }
373
-  // 确认删除
312
+  // 下载二维码
313
+  downLoadQrCode(base64Img){
314
+    let link = document.createElement('a')
315
+    link.href = base64Img
316
+    link.download = 'qrCode-'+ Date.now()
317
+    let event = document.createEvent('MouseEvents')
318
+    event.initMouseEvent('click',true,false,window,0,0,0,0,0,false,false,false,false,0,null)
319
+    link.dispatchEvent(event);
320
+  }
321
+  // 确认
374 322
   confirmDel() {
375 323
     this.btnLoading = true;
376 324
     if (this.confirmDelType === "del") {
377 325
       //删除
378 326
       this.mainService
379
-        .coopTypeConfig("rmvData", "workScheme", [this.coopId.id])
327
+        .apiPost("rmvData", "questionnaireManagement", [this.coopId.id])
380 328
         .subscribe((data) => {
381 329
           this.btnLoading = false;
382 330
           this.delModal = false;
@@ -397,70 +345,112 @@ export class QuestionnaireManagementComponent implements OnInit {
397 345
             this.showPromptModal(this.tipsMsg2, false, data.msg);
398 346
           }
399 347
         });
400
-    } else if (this.confirmDelType === "switch") {
401
-      //启用
402
-      let data = {
403
-        workScheme: {
404
-          id: this.coopId.id,
405
-          hosId: this.currentHospital.id,
406
-          status: 1,
407
-          workType: this.coopId.workType,
408
-        },
409
-      };
348
+    }else if (this.confirmDelType === "publish"){
349
+      // 发布
410 350
       this.mainService
411
-        .coopConfig("activeWorkScheme", data)
412
-        .subscribe((result) => {
413
-          this.btnLoading = false;
414
-          this.delModal = false;
415
-          if (result.status == 200) {
416
-            this.showPromptModal(this.tipsMsg2, true, "");
417
-          } else {
418
-            this.showPromptModal(this.tipsMsg2, false, result.msg);
419
-          }
420
-        });
421
-    } else if (this.confirmDelType === "switchTime") {
422
-      //关闭定时启用
423
-      let data = {
424
-        workScheme: {
425
-          id: this.coopId.id,
426
-          hosId: this.currentHospital.id,
427
-          timingStatus: 0,
428
-        },
429
-      };
351
+      .managerQuestionnaire({
352
+        survey_state: 2,//已发布
353
+        qmId:this.coopId.id
354
+      })
355
+      .subscribe((data:any) => {
356
+        this.btnLoading = false;
357
+        this.delModal = false;
358
+        if (data.status == 200) {
359
+          this.message.create('success', `操作成功`);
360
+          this.addLinkModal(data.data);
361
+          this.getList(0);
362
+        } else {
363
+          this.showPromptModal(this.tipsMsg2, false, data.msg);
364
+        }
365
+      });
366
+    }else if (this.confirmDelType === "complete"){
367
+      // 发布
430 368
       this.mainService
431
-        .coopTypeConfig("addData", "workScheme", data)
432
-        .subscribe((result) => {
433
-          this.btnLoading = false;
434
-          this.delModal = false;
435
-          if (result.status == 200) {
436
-            this.showPromptModal(this.tipsMsg2, true, "");
437
-          } else {
438
-            this.showPromptModal(this.tipsMsg2, false, result.msg);
439
-          }
440
-        });
369
+      .managerQuestionnaire({
370
+        survey_state: 3,//调研完成
371
+        qmId:this.coopId.id
372
+      })
373
+      .subscribe((data:any) => {
374
+        this.btnLoading = false;
375
+        this.delModal = false;
376
+        if (data.status == 200) {
377
+          this.message.create('success', `操作成功`);
378
+          this.getList(0);
379
+        } else {
380
+          this.showPromptModal(this.tipsMsg2, false, data.msg);
381
+        }
382
+      });
441 383
     }
384
+    // if (this.confirmDelType === "del") {
385
+    //   //删除
386
+    //   this.mainService
387
+    //     .apiPost("rmvData", "questionnaireManagement", [this.coopId.id])
388
+    //     .subscribe((data) => {
389
+    //       this.btnLoading = false;
390
+    //       this.delModal = false;
391
+    //       if (data.status == 200) {
392
+    //         if (
393
+    //           this.listOfData.length == 1 &&
394
+    //           this.pageIndex == Math.ceil(this.listLength / this.pageSize)
395
+    //         ) {
396
+    //           this.listLength--;
397
+    //           if (this.listLength === 0) {
398
+    //             this.pageIndex = 1;
399
+    //           } else {
400
+    //             this.pageIndex = Math.ceil(this.listLength / this.pageSize);
401
+    //           }
402
+    //         }
403
+    //         this.showPromptModal(this.tipsMsg2, true, "");
404
+    //       } else {
405
+    //         this.showPromptModal(this.tipsMsg2, false, data.msg);
406
+    //       }
407
+    //     });
408
+    // } else if (this.confirmDelType === "switch") {
409
+    //   //启用
410
+    //   let data = {
411
+    //     workScheme: {
412
+    //       id: this.coopId.id,
413
+    //       hosId: this.currentHospital.id,
414
+    //       status: 1,
415
+    //       workType: this.coopId.workType,
416
+    //     },
417
+    //   };
418
+    //   this.mainService
419
+    //     .coopConfig("activeWorkScheme", data)
420
+    //     .subscribe((result) => {
421
+    //       this.btnLoading = false;
422
+    //       this.delModal = false;
423
+    //       if (result.status == 200) {
424
+    //         this.showPromptModal(this.tipsMsg2, true, "");
425
+    //       } else {
426
+    //         this.showPromptModal(this.tipsMsg2, false, result.msg);
427
+    //       }
428
+    //     });
429
+    // } else if (this.confirmDelType === "switchTime") {
430
+    //   //关闭定时启用
431
+    //   let data = {
432
+    //     workScheme: {
433
+    //       id: this.coopId.id,
434
+    //       hosId: this.currentHospital.id,
435
+    //       timingStatus: 0,
436
+    //     },
437
+    //   };
438
+    //   this.mainService
439
+    //     .coopTypeConfig("addData", "workScheme", data)
440
+    //     .subscribe((result) => {
441
+    //       this.btnLoading = false;
442
+    //       this.delModal = false;
443
+    //       if (result.status == 200) {
444
+    //         this.showPromptModal(this.tipsMsg2, true, "");
445
+    //       } else {
446
+    //         this.showPromptModal(this.tipsMsg2, false, result.msg);
447
+    //       }
448
+    //     });
449
+    // }
442 450
   }
443 451
 
444 452
   // 查看
445 453
   detail(id) {
446
-    this.router.navigateByUrl(
447
-      "/main/workAssignment/workAssignmentDetail/" + id
448
-    );
449
-  }
450
-  //时间选择框相关
451
-  defaultTimePickerOpenValue = new Date();
452
-  // 更改日期
453
-  datePicker;
454
-  datePickerChange(e) {
455
-    if (!e) {
456
-      return;
457
-    }
458
-    let todayDate = new Date(e);
459
-    let year = todayDate.getFullYear();
460
-    let month = (todayDate.getMonth() + 1).toString().padStart(2, "0");
461
-    let date = todayDate.getDate().toString().padStart(2, "0");
462
-    let hour = todayDate.getHours().toString().padStart(2, "0");
463
-    let minutes = todayDate.getMinutes().toString().padStart(2, "0");
464
-    this.datePicker = `${year}-${month}-${date} ${hour}:${minutes}:00`;
454
+    this.router.navigateByUrl("/main/questionnaireManagement/questionnaireManagementDetail/" + id);
465 455
   }
466 456
 }

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

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

+ 138 - 0
src/app/views/questions/questions.component.html

@@ -0,0 +1,138 @@
1
+<div class="list-template">
2
+    <div class="list-template__content">
3
+      <div class="list-template__top" nz-row>
4
+        <div nz-col nzXl="15" class="list-template__btns justify-content_flex-start">
5
+          <h2 class="qName">问卷名称:{{queryParamsName}}</h2>
6
+          <button class="btn default" nz-button (click)="goToWorkAssignment()">返回</button>
7
+        </div>
8
+        <div nz-col nzXl="9" class="list-template__btns">
9
+          <button class="btn default" nzType="primary" nz-button (click)="addModal()">新增问题</button>
10
+          <button [disabled]="!checkedDepIds.length||!listOfData.length" class="btn default ml8" nzType="primary"
11
+            nz-button (click)="showDelModal($event,checkedDepIds,'是否确定批量删除选中的问题?','删除','del')">批量删除</button>
12
+        </div>
13
+      </div>
14
+      <div class="list-template__top" nz-row>
15
+        <div nz-col nzXl='15' class="list-template__searchBox">
16
+          <!-- <div class="list-template__searchItem">
17
+            <span class="label label--big">快捷组合名称:</span>
18
+            <input nz-input class="formItem" placeholder="请输入关键字" [(ngModel)]="searchCriteria.name" />
19
+          </div>
20
+          <div class="list-template__searchItem">
21
+            <span class="label">工作模式:</span>
22
+            <nz-select [nzDropdownMatchSelectWidth]="false" class="formItem" nzShowSearch nzPlaceHolder="请选择工作模式"
23
+              [(ngModel)]="searchCriteria.workModel">
24
+              <nz-option nzLabel="{{data.name}}" nzValue="{{data.id}}" *ngFor="let data of allWorkModel"></nz-option>
25
+            </nz-select>
26
+          </div> -->
27
+        </div>
28
+        <div nz-col nzXl="9" class="list-template__btns">
29
+          <!-- <button class="btn default" nzType="primary" nz-button (click)="reset()">重置</button> -->
30
+          <button class="btn default ml8" nzType="primary" nz-button (click)="getList(1)">搜索</button>
31
+          <!-- <a class="btn default ml8" style="text-align: center;" [routerLink]="'/preview?token='+ queryParamsToken" target="_blank">预览</a> -->
32
+          <a class="btn default ml8" style="text-align: center;" [queryParams]="{'token': queryParamsToken}" [routerLink]="['/preview']" target="_blank">预览</a>
33
+        </div>
34
+      </div>
35
+      <div class="list-template__bottom">
36
+        <nz-table class="list-template__nzTable" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false"
37
+          [nzLoading]="loading1">
38
+          <thead>
39
+            <tr class="thead">
40
+              <th nzWidth="5%" nzShowCheckbox [(nzChecked)]="isAllDisplayDataChecked"
41
+                (nzCheckedChange)="checkAll($event)"></th>
42
+              <th nzWidth="5%">排序号</th>
43
+              <th nzWidth="60%">问题描述</th>
44
+              <th nzWidth="10%">答题方式</th>
45
+              <th nzWidth="20%">操作</th>
46
+            </tr>
47
+          </thead>
48
+          <tbody>
49
+            <tr *ngFor="let data of listOfData;let i = index" (click)="selectedListData(data.id)">
50
+              <td nzShowCheckbox [(nzChecked)]="mapOfCheckedId[data.id]" (nzCheckedChange)="refreshStatus()"></td>
51
+              <td>{{data.orders || '无'}}</td>
52
+              <td>{{data.describe || '无'}}</td>
53
+              <td>{{data.answerMode?data.answerMode.name:'无'}}</td>
54
+              <td>
55
+                <div class="coop">
56
+                  <!-- <span (click)="copy($event,data)">复制</span> -->
57
+                  <span (click)="edit($event,data)">修改</span>
58
+                  <span (click)="showDelModal($event,data.id,'是否确定删除该问题?','删除','del')">删除</span>
59
+                </div>
60
+              </td>
61
+            </tr>
62
+          </tbody>
63
+        </nz-table>
64
+        <div class="list-template__pagination">
65
+          <nz-pagination nzShowSizeChanger [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize"
66
+            (nzPageIndexChange)="getList(0)" (nzPageSizeChange)="getList(0)">
67
+          </nz-pagination>
68
+        </div>
69
+      </div>
70
+    </div>
71
+  
72
+    <!-- 新增/编辑模态框 -->
73
+    <div class="save display_flex justify-content_flex-center align-items_center add" *ngIf="modal">
74
+      <div class="modalBody">
75
+        <div class="title">{{add?"新增":"编辑"}}问题<i class="icon_transport transport-guanbi" (click)="hideAddModal()"></i>
76
+        </div>
77
+        <div class="content">
78
+          <form nz-form [formGroup]="validateForm" class="addForm">
79
+            <nz-form-item>
80
+              <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="describe">问题描述</nz-form-label>
81
+              <nz-form-control nzErrorTip="请输入问题描述!">
82
+                <textarea rows="2" class="mt8" formControlName="describe" nz-input placeholder="请输入问题描述"></textarea>
83
+              </nz-form-control>
84
+            </nz-form-item>
85
+            <nz-form-item>
86
+            <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="orders">排序号</nz-form-label>
87
+              <nz-form-control nzErrorTip="请输入排序号!">
88
+                <input #inputElement nz-input placeholder="输入一个整数" formControlName="orders" (ngModelChange)="onChange($event)" />
89
+              </nz-form-control>
90
+            </nz-form-item>
91
+            <nz-form-item>
92
+              <nz-form-label [nzSpan]="6" [nzXs]="24" nzRequired nzFor="answerMode">答题方式</nz-form-label>
93
+              <nz-form-control nzErrorTip="请选择答题方式!">
94
+                <nz-select [nzDropdownMatchSelectWidth]="false" formControlName="answerMode" nzShowSearch nzPlaceHolder="请选择答题方式">
95
+                  <nz-option nzLabel="{{data.name}}" nzValue="{{data.id}}" *ngFor="let data of answerModes"></nz-option>
96
+                </nz-select>
97
+              </nz-form-control>
98
+            </nz-form-item>
99
+          </form>
100
+          <ng-container *ngIf="validateForm.value.answerMode == answerModesRadioValue">
101
+            <div *ngFor="let item of qItems;let i = index;">
102
+              <input nz-input [placeholder]="'选项'+ (i + 1)" class="mb8" [(ngModel)]="item.value" />
103
+            </div>
104
+          </ng-container>
105
+        </div>
106
+        <div class=" display_flex justify-content_flex-center">
107
+          <button nzType="primary" nz-button (click)="submitForm()" [nzLoading]="btnLoading">保存</button>
108
+          <button class="btn cancel" nz-button nzType="default" (click)="hideAddModal()">取消</button>
109
+        </div>
110
+      </div>
111
+    </div>
112
+    <!-- 删除模态框 -->
113
+    <app-dialog-delete [delModal]="delModal" (hideDelModalEvent)="hideDelModal()" [btnLoading]="btnLoading"
114
+      (confirmDelEvent)="confirmDel()" [content]="tipsMsg1"></app-dialog-delete>
115
+  </div>
116
+  <!-- 提示模态框 -->
117
+  <div class="save display_flex justify-content_flex-center align-items_center" *ngIf="tipModal">
118
+    <div class="modalBody">
119
+      <div class="title">提示<i class="icon_transport transport-guanbi" (click)="hideTipModal()"></i></div>
120
+      <div class="content">
121
+        <div class="icon"><i class="icon_transport transport-wenhao"></i></div>
122
+        <div class="defeat" style="font-size: 16px;">是否确定离开该界面,如果未点击生效,数据可能会遗失?</div>
123
+      </div>
124
+      <div class="display_flex justify-content_flex-center">
125
+        <button nz-button nzType="primary" (click)="confirmTip()">确认</button>
126
+        <button class="btn cancel " nz-button nzType="default" (click)="hideTipModal()">关闭</button>
127
+      </div>
128
+    </div>
129
+  </div>
130
+  <!-- 操作成功/失败提示框 -->
131
+  <app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
132
+    [info]="promptInfo" [loading]="showLoading">
133
+  </app-prompt-modal>
134
+  <!-- 查看详情 -->
135
+  <router-outlet></router-outlet>
136
+  <!-- 遮罩 -->
137
+  <app-mask *ngIf="maskFlag"></app-mask>
138
+  

+ 200 - 0
src/app/views/questions/questions.component.less

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

+ 423 - 0
src/app/views/questions/questions.component.ts

@@ -0,0 +1,423 @@
1
+import { Component, OnInit, ViewChild, ElementRef } from "@angular/core";
2
+import { ActivatedRoute, Router } from "@angular/router";
3
+import { FormBuilder, Validators, FormGroup } from "@angular/forms";
4
+import setSeconds from "date-fns/setSeconds";
5
+import setMinutes from "date-fns/setMinutes";
6
+import setHours from "date-fns/setHours";
7
+
8
+import { MainService } from "../../services/main.service";
9
+import { ToolService } from "../../services/tool.service";
10
+import { NzMessageService } from "ng-zorro-antd";
11
+@Component({
12
+  selector: "app-questions",
13
+  templateUrl: "./questions.component.html",
14
+  styleUrls: ["./questions.component.less"],
15
+})
16
+export class QuestionsComponent implements OnInit {
17
+  @ViewChild("inputElement", { static: false }) inputElement: ElementRef;
18
+  constructor(
19
+    private message: NzMessageService,
20
+    private fb: FormBuilder,
21
+    private mainService: MainService,
22
+    private route: ActivatedRoute,
23
+    private router: Router,
24
+    private tool: ToolService
25
+  ) {
26
+    this.route.queryParams.subscribe((res) => {
27
+      this.queryParamsId = res.id;
28
+      this.queryParamsToken = res.token;
29
+      this.queryParamsName = res.title;
30
+    });
31
+  }
32
+  searchCriteria = {
33
+    //搜索条件
34
+    name: "",
35
+    workModel: null,
36
+  };
37
+  allWorkModel = [
38
+    { id: 1, name: "自由抢单" },
39
+    { id: 2, name: "指定分组" },
40
+    { id: 3, name: "科室绑定人员" },
41
+    { id: 4, name: "科室绑定分组" },
42
+  ];
43
+  quickCombinationModel;
44
+  requireGroup = false;
45
+  requireDept = false;
46
+  queryParamsId = ""; //方案id
47
+  queryParamsToken = ""; //方案token
48
+  queryParamsName = ""; //方案名称
49
+  userInfo: any = JSON.parse(localStorage.getItem("user")) || {}; //登录用户信息
50
+  listOfData: any[] = []; //表格数据
51
+  pageIndex: number = 1; //表格当前页码
52
+  pageSize: number = 10; //表格每页展示条数
53
+  listLength: number = 10; //表格总数据量
54
+  tableHeight: number; //表格动态高
55
+  modal: boolean = false; //新增/编辑模态框
56
+  personModal: boolean = false; //定时启用设置日期模态框
57
+  groupsModal: boolean = false; //定时启用设置日期模态框
58
+  add: boolean; //true:新增;false:编辑
59
+  validateForm: FormGroup; //新增/编辑表单
60
+  validateDateForm: FormGroup; //定时启动设置日期表单
61
+  validatePersonForm: FormGroup; //
62
+  validateGroupForm: FormGroup; //
63
+  coopId: number; //当前操作列id
64
+  timeDefaultValue = setHours(setMinutes(setSeconds(new Date(), 0), 0), 0);
65
+
66
+  btnLoading: boolean = false; //提交按钮loading状态
67
+  currentHospital; //当前院区
68
+
69
+  promptContent: string; //操作提示框提示信息
70
+  ifSuccess: boolean; //操作成功/失败
71
+  promptInfo: string; //操作结果提示信息
72
+  promptModalShow: boolean; //操作提示框是否展示
73
+  showLoading = false; //操作是否显示loading
74
+
75
+  classList = []; //班次列表
76
+  maskFlag: any = false;
77
+  qItems: any = []; //10个选项
78
+  // -----------------------
79
+
80
+  ngOnInit() {
81
+    this.getOneQuestionnaireManagement();
82
+    Array(10).fill('').forEach((v, i)=>{
83
+      this.qItems.push({id:i+1, value:''});
84
+    })
85
+    console.log(this.qItems)
86
+    this.currentHospital = this.tool.getCurrentHospital();
87
+    this.initForm();
88
+    this.getList(1);
89
+    this.getAnswerModes();
90
+  }
91
+  // 获取问卷数据
92
+  getOneQuestionnaireManagement(){
93
+    this.mainService.getFetchData('api', "questionnaireManagement", this.queryParamsId).subscribe(res=>{
94
+      if(res.status == 200){
95
+        this.queryParamsToken = res.data.token;
96
+        this.queryParamsName = res.data.title;
97
+      }
98
+    })
99
+  }
100
+  // 重置
101
+  reset() {
102
+    this.searchCriteria = {
103
+      //搜索条件
104
+      name: "",
105
+      workModel: null,
106
+    };
107
+    this.getList(1);
108
+  }
109
+  // 表格数据
110
+  loading1 = false;
111
+  getList(type) {
112
+    if (type == 1) {
113
+      this.pageIndex = 1;
114
+    }
115
+    let data = {
116
+      questionnaireInfo: {
117
+        managementId: this.queryParamsId,
118
+      },
119
+      idx: this.pageIndex - 1,
120
+      sum: this.pageSize,
121
+    };
122
+    this.loading1 = true;
123
+    this.mainService
124
+      .getFetchDataList("api", "questionnaireInfo", data)
125
+      .subscribe((data) => {
126
+        this.loading1 = false;
127
+        if (data.status == 200) {
128
+          this.listOfData = data.list;
129
+          this.listLength = data.totalNum;
130
+        }
131
+      });
132
+  }
133
+
134
+  // 新增/编辑弹框
135
+  addModal() {
136
+    this.add = true; //新增
137
+    this.modal = true;
138
+    this.initForm();
139
+  }
140
+  //关闭新增/编辑弹框
141
+  hideAddModal() {
142
+    this.modal = false;
143
+    this.copyFlag = false;
144
+    this.initForm();
145
+  }
146
+  // 修改排序号
147
+  onChange(value: string): void {
148
+    if (value !== "") {
149
+      let oValue = parseInt(value);
150
+      this.inputElement.nativeElement.value = isNaN(oValue)?'':(oValue?oValue:'');
151
+    }
152
+  }
153
+  // 获取字典数据-答题方式
154
+  answerModes: any[] = [];
155
+  answerModesRadioValue;
156
+  getAnswerModes() {
157
+    this.mainService.getDictionary("list", "answer_mode").subscribe((data) => {
158
+      this.answerModes = data;
159
+      this.answerModesRadioValue = data.find((v) => v.value == 1).id;
160
+    });
161
+  }
162
+  // 初始化新增form表单
163
+  initForm() {
164
+    this.quickCombinationModel = "";
165
+    this.validateForm = this.fb.group({
166
+      describe: [null, [Validators.required]],
167
+      orders: [null, [Validators.required]],
168
+      answerMode: [null, [Validators.required]],
169
+    });
170
+  }
171
+  // 初始化新增form表单
172
+  initPersonForm() {
173
+    this.validatePersonForm = this.fb.group({
174
+      quickCombinationPerson: [null, [Validators.required]],
175
+    });
176
+  }
177
+  // 初始化新增form表单
178
+  initGroupsForm() {
179
+    this.validateGroupForm = this.fb.group({
180
+      quickCombinationGroups: [null, [Validators.required]],
181
+    });
182
+  }
183
+  // 新增/编辑表单提交
184
+  submitForm(): void {
185
+    for (const i in this.validateForm.controls) {
186
+      this.validateForm.controls[i].markAsDirty();
187
+      this.validateForm.controls[i].updateValueAndValidity();
188
+    }
189
+    console.log(this.validateForm);
190
+    this.btnLoading = true;
191
+
192
+    if (this.validateForm.invalid) {
193
+      this.btnLoading = false;
194
+      return;
195
+    }
196
+    let data:any = {};
197
+    if(this.add){
198
+      data = { 
199
+        questionnaireInfo: {
200
+          hosId: this.currentHospital.id,
201
+          managementId: this.queryParamsId,
202
+          describe: this.validateForm.value.describe,
203
+          orders: this.validateForm.value.orders,
204
+          answerMode: {id: this.validateForm.value.answerMode},
205
+        }
206
+      };
207
+      if(this.validateForm.value.answerMode == this.answerModesRadioValue){
208
+        this.qItems.forEach((v, i)=>{
209
+          data.questionnaireInfo['option' + (i + 1)] = v.value;
210
+        })
211
+      }
212
+    }else{
213
+      data = { 
214
+        questionnaireInfo: {
215
+          describe: this.validateForm.value.describe,
216
+          orders: this.validateForm.value.orders,
217
+          answerMode: {id: this.validateForm.value.answerMode},
218
+        }
219
+      };
220
+      if(this.validateForm.value.answerMode == this.answerModesRadioValue){
221
+        this.qItems.forEach((v, i)=>{
222
+          data.questionnaireInfo['option' + (i + 1)] = v.value;
223
+        })
224
+      }else{
225
+        Array(10).fill('').forEach((v, i)=>{
226
+          data.questionnaireInfo['option' + (i + 1)] = v
227
+        })
228
+      }
229
+      data.questionnaireInfo = Object.assign(this.info,data.questionnaireInfo);
230
+      console.log(data);
231
+    }
232
+    this.mainService
233
+      .coopTypeConfig(
234
+        this.add || (!this.add && this.copyFlag) ? "addData" : "updData",
235
+        "questionnaireInfo",
236
+        data
237
+      )
238
+      .subscribe((result) => {
239
+        this.btnLoading = false;
240
+        if (result.status == 200) {
241
+          console.log(this.copyFlag);
242
+          if (this.add) {
243
+            this.showPromptModal("新增", true, "");
244
+            this.listLength++;
245
+          } else if (this.copyFlag) {
246
+            this.showPromptModal("复制", true, "");
247
+            this.listLength++;
248
+          } else if (!this.copyFlag) {
249
+            //编辑
250
+            this.showPromptModal("编辑", true, "");
251
+          }
252
+        } else {
253
+          let msg = "";
254
+          if (this.add) {
255
+            msg = "新增";
256
+          } else if (!this.copyFlag) {
257
+            msg = "修改";
258
+          } else if (this.copyFlag) {
259
+            msg = "复制";
260
+          }
261
+          this.showPromptModal(msg, false, result.msg);
262
+        }
263
+        this.hideAddModal();
264
+        this.initForm();
265
+      });
266
+  }
267
+  // 复制
268
+  copyFlag = false;
269
+  copy(e, data) {
270
+    e.stopPropagation();
271
+    console.log(data);
272
+    this.add = false;
273
+    this.copyFlag = true;
274
+    this.coopId = data.id;
275
+    this.info = data;
276
+  }
277
+  // 编辑
278
+  info; //编辑时候保存的信息
279
+  edit(e, data) {
280
+    e.stopPropagation();
281
+    console.log(data);
282
+    this.add = false;
283
+    this.coopId = data.id;
284
+    this.info = data;
285
+    this.validateForm.controls.describe.setValue(data.describe); //问卷描述
286
+    this.validateForm.controls.orders.setValue(data.orders); //排序号
287
+    this.validateForm.controls.answerMode.setValue(data.answerMode?data.answerMode.id.toString():''); //答题方式
288
+    if(data.answerMode && data.answerMode.id){
289
+      this.qItems.forEach((v, i)=>{
290
+        v.value = data['option'+ (i+1)]
291
+      })
292
+    }
293
+    this.modal = true;
294
+  }
295
+
296
+  // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
297
+  // promptModalUrl = '';
298
+  showPromptModal(con, success, promptInfo?, loading?) {
299
+    this.promptModalShow = false;
300
+    this.promptContent = con;
301
+    this.ifSuccess = success;
302
+    this.promptInfo = promptInfo;
303
+    if (loading !== undefined) {
304
+      this.showLoading = loading;
305
+    } else {
306
+      this.showLoading = false;
307
+      this.getList(0);
308
+    }
309
+    // this.promptModalUrl = url;
310
+    setTimeout(() => {
311
+      this.promptModalShow = true;
312
+    }, 100);
313
+  }
314
+  // 选中表格中快捷建单
315
+  isAllDisplayDataChecked = false; //当前页是否全选
316
+  mapOfCheckedId = {};
317
+  checkedDepIds = []; //已选中快捷建单id
318
+  refreshStatus(): void {
319
+    this.isAllDisplayDataChecked = this.listOfData.every(
320
+      (item) => this.mapOfCheckedId[item.id]
321
+    );
322
+    let arr = [];
323
+    for (var k in this.mapOfCheckedId) {
324
+      if (this.mapOfCheckedId[k]) {
325
+        arr.push(Number(k));
326
+      }
327
+    }
328
+    this.checkedDepIds = arr;
329
+    console.log(this.checkedDepIds, this.isAllDisplayDataChecked);
330
+  }
331
+  // 整行选中或不选中
332
+  selectedListData(id) {
333
+    this.mapOfCheckedId[id] = !this.mapOfCheckedId[id];
334
+    this.refreshStatus();
335
+  }
336
+  // 全选
337
+  checkAll(value: boolean): void {
338
+    this.listOfData.forEach((item) => (this.mapOfCheckedId[item.id] = value));
339
+    this.refreshStatus();
340
+  }
341
+
342
+  // 删除轮巡计划
343
+  delModal: boolean = false; //删除模态框
344
+  tipsMsg1: string; //提示框信息
345
+  tipsMsg2: string; //操作后信息
346
+  confirmDelType: string; //确认的类型(启用/停用,删除)
347
+  confirmDelIsSwitch: boolean; //启用/停用
348
+  showDelModal(
349
+    e,
350
+    id: any,
351
+    tipsMsg1: string,
352
+    tipsMsg2: string,
353
+    type: string,
354
+    isSwitch?: boolean
355
+  ) {
356
+    e.stopPropagation();
357
+    this.confirmDelIsSwitch = isSwitch;
358
+    this.confirmDelType = type;
359
+    this.delModal = true;
360
+    this.coopId = id;
361
+    this.tipsMsg1 = tipsMsg1;
362
+    this.tipsMsg2 = tipsMsg2;
363
+  }
364
+  // 隐藏删除框
365
+  hideDelModal() {
366
+    this.delModal = false;
367
+  }
368
+  // 确认删除
369
+  confirmDel() {
370
+    this.btnLoading = true;
371
+    if (this.confirmDelType === "del") {
372
+      //删除
373
+      let arrData = [];
374
+      if (Array.isArray(this.coopId)) {
375
+        arrData = this.coopId;
376
+      } else {
377
+        arrData = [this.coopId];
378
+      }
379
+      this.mainService
380
+        .coopTypeConfig("rmvData", "questionnaireInfo", arrData)
381
+        .subscribe((data) => {
382
+          this.btnLoading = false;
383
+          this.delModal = false;
384
+          if (data.status == 200) {
385
+            if (
386
+              this.listOfData.length == 1 &&
387
+              this.pageIndex == Math.ceil(this.listLength / this.pageSize)
388
+            ) {
389
+              this.listLength--;
390
+              if (this.listLength === 0) {
391
+                this.pageIndex = 1;
392
+              } else {
393
+                this.pageIndex = Math.ceil(this.listLength / this.pageSize);
394
+              }
395
+            }
396
+            this.showPromptModal(this.tipsMsg2, true, "");
397
+            this.isAllDisplayDataChecked = false;
398
+            this.checkedDepIds = [];
399
+            this.mapOfCheckedId = {};
400
+          } else {
401
+            this.showPromptModal(this.tipsMsg2, false, data.msg);
402
+          }
403
+        });
404
+    }
405
+  }
406
+  // ----------返回拦截------------
407
+  tipModal = false;
408
+  // tipMsg1 = '是否确定离开该界面,如果未点击生效,数据可能会遗失?';
409
+  // 隐藏模态框
410
+  hideTipModal() {
411
+    // this.tipModal = false;
412
+  }
413
+  // 返回
414
+  goToWorkAssignment() {
415
+    // this.tipModal = true;
416
+    this.router.navigateByUrl(`/main/questionnaireManagement`);
417
+  }
418
+  // 模态框确认
419
+  confirmTip() {
420
+    // this.tipModal = false;
421
+    // this.router.navigateByUrl(`/main/workAssignment`);
422
+  }
423
+}

+ 17 - 0
src/app/views/questions/questions.module.ts

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