seimin месяцев назад: 9
Родитель
Сommit
ba22cdbe84
25 измененных файлов с 1917 добавлено и 11 удалено
  1. 5 0
      src/app/app-routing.module.ts
  2. 37 2
      src/app/services/tool.service.ts
  3. 3 0
      src/app/share/share.module.ts
  4. 22 0
      src/app/share/template-name/template-name.component.html
  5. 125 0
      src/app/share/template-name/template-name.component.less
  6. 47 0
      src/app/share/template-name/template-name.component.ts
  7. 2 2
      src/app/views/inspection-address/inspection-address.component.html
  8. 18 0
      src/app/views/inspection-plan-config/inspection-plan-config-routing.module.ts
  9. 137 0
      src/app/views/inspection-plan-config/inspection-plan-config.component.html
  10. 138 0
      src/app/views/inspection-plan-config/inspection-plan-config.component.less
  11. 341 0
      src/app/views/inspection-plan-config/inspection-plan-config.component.ts
  12. 19 0
      src/app/views/inspection-plan-config/inspection-plan-config.module.ts
  13. 25 0
      src/app/views/inspection-plan/inspection-plan-routing.module.ts
  14. 216 0
      src/app/views/inspection-plan/inspection-plan.component.html
  15. 198 0
      src/app/views/inspection-plan/inspection-plan.component.less
  16. 519 0
      src/app/views/inspection-plan/inspection-plan.component.ts
  17. 19 0
      src/app/views/inspection-plan/inspection-plan.module.ts
  18. 5 0
      src/app/views/main/main-routing.module.ts
  19. 26 3
      src/assets/iconfont/demo_index.html
  20. 7 3
      src/assets/iconfont/iconfont.css
  21. 1 1
      src/assets/iconfont/iconfont.js
  22. 7 0
      src/assets/iconfont/iconfont.json
  23. BIN
      src/assets/iconfont/iconfont.ttf
  24. BIN
      src/assets/iconfont/iconfont.woff
  25. BIN
      src/assets/iconfont/iconfont.woff2

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

@@ -83,6 +83,11 @@ const routes: Routes = [
83 83
     path: 'washingBatchView',
84 84
     loadChildren: () => import('./views/washing-batch-view/washing-batch-view.module').then(m => m.WashingBatchViewModule),
85 85
   },
86
+  // 洗涤批次视图
87
+  {
88
+    path: 'inspectionPlanConfig/:id',
89
+    loadChildren: () => import('./views/inspection-plan-config/inspection-plan-config.module').then(m => m.InspectionPlanConfigModule),
90
+  },
86 91
   // 管理端首页
87 92
   {
88 93
     path: '**',

+ 37 - 2
src/app/services/tool.service.ts

@@ -150,8 +150,8 @@ export class ToolService {
150 150
           coopBtns.oneClickRecovery = true; //一键恢复
151 151
           break;
152 152
         case "view":
153
-            coopBtns.view = true; //查看视图
154
-            break;
153
+          coopBtns.view = true; //查看视图
154
+          break;
155 155
         case "recount":
156 156
           coopBtns.recount = true; //重新统计
157 157
           break;
@@ -185,4 +185,39 @@ export class ToolService {
185 185
       postData
186 186
     );
187 187
   }
188
+
189
+  /**
190
+   * @description: 扁平化结构转成树形结构
191
+   * @param {*} list 扁平化的数组
192
+   * @param {*} rootValue 顶级parentKeyName的值
193
+   * @param {*} parentKeyName 父级字段名称
194
+   * @param {*} keyName 字段名称
195
+   * @return {*} 返回树形结构
196
+   * @author: seimin
197
+   */
198
+  tranListToTreeData(list:Array<any>, rootValue:any, parentKeyName:string, keyName:string = 'id'):Array<any> {
199
+    return list.filter((t) =>
200
+      t[parentKeyName] === rootValue
201
+        ? (t.children = this.tranListToTreeData(list, t[keyName], parentKeyName, keyName))
202
+        : false
203
+    );
204
+  }
205
+
206
+  /**
207
+   * @description: 树形结构转扁平化结构
208
+   * @param {*} tree 树形结构
209
+   * @return {*} 返回扁平化结构
210
+   * @author: seimin
211
+   */
212
+  tranTreeToListData(tree: Array<any>): Array<any> {
213
+    let res: Array<any> = [];
214
+    for (const item of tree) {
215
+      const { children, ...i } = item;
216
+      if (children && children.length) {
217
+        res = res.concat(this.tranTreeToListData(children));
218
+      }
219
+      res.push(i);
220
+    }
221
+    return res;
222
+  }
188 223
 }

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

@@ -6,6 +6,7 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
6 6
 import { OverlayscrollbarsModule } from 'overlayscrollbars-ngx';
7 7
 import { SelectHospitalComponent } from './select-hospital/select-hospital.component';
8 8
 import { SelectDeptComponent } from './select-dept/select-dept.component';
9
+import { TemplateNameComponent } from './template-name/template-name.component';
9 10
 import { PromptModalComponent } from './prompt-modal/prompt-modal.component';
10 11
 import { ReplicationSchemeComponent } from './replication-scheme/replication-scheme.component';
11 12
 import { HsPromptModalComponent } from './hs-prompt-modal/hs-prompt-modal.component';
@@ -59,6 +60,7 @@ import { OutgoingRecordDetailComponent } from './outgoing-record-detail/outgoing
59 60
     AllocationWorkerComponent,
60 61
     SelectHospitalComponent,
61 62
     SelectDeptComponent,
63
+    TemplateNameComponent,
62 64
     PromptModalComponent,
63 65
     ReplicationSchemeComponent,
64 66
     HsPromptModalComponent,
@@ -116,6 +118,7 @@ import { OutgoingRecordDetailComponent } from './outgoing-record-detail/outgoing
116 118
     AllocationWorkerComponent,
117 119
     SelectHospitalComponent,
118 120
     SelectDeptComponent,
121
+    TemplateNameComponent,
119 122
     PromptModalComponent,
120 123
     ReplicationSchemeComponent,
121 124
     HsPromptModalComponent,

+ 22 - 0
src/app/share/template-name/template-name.component.html

@@ -0,0 +1,22 @@
1
+<div class="save add display_flex align-items_center justify-content_flex-center" *ngIf="templateFlag">
2
+  <div class="modalBody">
3
+    <div class="title">保存并存为模板<i class="icon_transport transport-guanbi" (click)="hideModal()"></i>
4
+    </div>
5
+    <div class="content">
6
+      <form nz-form [formGroup]="validateForm" class="addForm">
7
+        <nz-form-item>
8
+          <nz-form-label class="line_height_normal" [nzSpan]="5" nzRequired nzFor="name">名&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;称</nz-form-label>
9
+          <nz-form-control [nzSpan]="19" nzErrorTip="请输入名称!">
10
+            <nz-input-group>
11
+              <textarea formControlName="name" nz-input placeholder="请输入名称"></textarea>
12
+            </nz-input-group>
13
+          </nz-form-control>
14
+        </nz-form-item>
15
+      </form>
16
+    </div>
17
+    <div class="display_flex justify-content_flex-center">
18
+      <button nzType="primary" nz-button (click)="submitForm()">确认</button>
19
+      <button class="btn cancel" nz-button nzType="default" (click)="hideModal()">取消</button>
20
+    </div>
21
+  </div>
22
+</div>

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

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

+ 47 - 0
src/app/share/template-name/template-name.component.ts

@@ -0,0 +1,47 @@
1
+import { Component, OnInit, Output, Input } from '@angular/core';
2
+import { FormGroup, FormBuilder, Validators } from '@angular/forms';
3
+import { EventEmitter } from '@angular/core';
4
+import { NzMessageService } from 'ng-zorro-antd';
5
+
6
+@Component({
7
+  selector: 'app-template-name',
8
+  templateUrl: './template-name.component.html',
9
+  styleUrls: ['./template-name.component.less']
10
+})
11
+export class TemplateNameComponent implements OnInit {
12
+  @Output() submitFormHand = new EventEmitter();
13
+  @Output() cancelFlagHand = new EventEmitter();
14
+  @Input() templateFlag: boolean = false;//模态框
15
+  @Input() hosId: any;//院区id
16
+  loading = false;//获取科室的loading
17
+  validateForm: FormGroup;//表单
18
+  constructor(
19
+    private fb: FormBuilder,
20
+    private message: NzMessageService,
21
+  ) { }
22
+
23
+  ngOnInit() {
24
+    this.initForm()
25
+  }
26
+  // 隐藏模态框
27
+  hideModal() {
28
+    this.cancelFlagHand.emit(false)
29
+    this.initForm()
30
+  }
31
+  // 初始化新增form表单
32
+  initForm() {
33
+    this.validateForm = this.fb.group({
34
+      name: ['', [Validators.required]]
35
+    });
36
+  }
37
+  // 表单提交
38
+  submitForm(): void {
39
+    for (const i in this.validateForm.controls) {
40
+      this.validateForm.controls[i].markAsDirty({ onlySelf: true });
41
+      this.validateForm.controls[i].updateValueAndValidity();
42
+    }
43
+    if (this.validateForm.invalid) return;
44
+    this.submitFormHand.emit(this.validateForm.value.name);
45
+  }
46
+}
47
+

+ 2 - 2
src/app/views/inspection-address/inspection-address.component.html

@@ -32,8 +32,7 @@
32 32
         </div>
33 33
       </div>
34 34
       <div nz-col nzLg="8" class="list-template__btns">
35
-        <button nz-button *ngIf="coopBtns.add" class="btn default" (click)="addModal()">新增</button>
36
-        <button nz-button *ngIf="coopBtns.add" class="btn default ml8" (click)="showInspectionAddressDepartment()">批量关联科室</button>
35
+        <button nz-button *ngIf="coopBtns.add" class="btn default" (click)="showInspectionAddressDepartment()">批量关联科室</button>
37 36
         <div class="dropdown">
38 37
           <button [disabled]="!checkedDepIds.length" nz-button class="btn default ml8" *ngIf="coopBtns.del || coopBtns.print || coopBtns.reset" (mouseenter)="showDropdown = (checkedDepIds.length ? true : false)" (mouseleave)="showDropdown = false">批量操作</button>
39 38
           <div class="dropdown-content" [hidden]="!showDropdown" (mouseenter)="showDropdown = true" (mouseleave)="showDropdown = false">
@@ -44,6 +43,7 @@
44 43
         </div>
45 44
         <button nz-button class="btn default ml8" (click)='search()'>搜索</button>
46 45
         <button nz-button class="btn default ml8" (click)='reset()'>重置</button>
46
+        <button nz-button *ngIf="coopBtns.add" class="btn default ml8" (click)="addModal()">新增</button>
47 47
       </div>
48 48
     </div>
49 49
     <div class="list-template__bottom">

+ 18 - 0
src/app/views/inspection-plan-config/inspection-plan-config-routing.module.ts

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

+ 137 - 0
src/app/views/inspection-plan-config/inspection-plan-config.component.html

@@ -0,0 +1,137 @@
1
+<div class="inspectionPlanConfig">
2
+  <div class="tagsAndTemplete">
3
+    <div class="tags">
4
+      <i class="icon_transport transport-24gf-tags"></i>
5
+      <span>数量核对</span>
6
+      <span>数量核对</span>
7
+      <span>数量核对</span>
8
+      <span>数量核对</span>
9
+      <span>数量核对</span>
10
+      <span>数量核对</span>
11
+      <span>数量核对</span>
12
+      <span>数量核对</span>
13
+      <span>数量核对</span>
14
+      <span>数量核对</span>
15
+      <span>数量核对</span>
16
+      <span>数量核对</span>
17
+      <span>数量核对</span>
18
+      <span>数量核对</span>
19
+      <span>数量核对</span>
20
+      <span>数量核对</span>
21
+      <span>数量核对</span>
22
+      <span>数量核对</span>
23
+      <span>数量核对</span>
24
+      <span>数量核对</span>
25
+      <span>数量核对</span>
26
+      <span>数量核对</span>
27
+      <span>数量核对</span>
28
+      <span>数量核对</span>
29
+      <span>数量核对</span>
30
+      <span>数量核对</span>
31
+      <span>数量核对</span>
32
+      <span>数量核对</span>
33
+      <span>数量核对</span>
34
+      <span>数量核对</span>
35
+      <span>数量核对</span>
36
+      <span>数量核对</span>
37
+      <span>数量核对</span>
38
+      <span>数量核对</span>
39
+      <span>数量核对</span>
40
+      <span>数量核对</span>
41
+      <span>数量核对</span>
42
+      <span>数量核对</span>
43
+      <span>数量核对</span>
44
+      <span>数量核对</span>
45
+      <span>数量核对</span>
46
+      <span>数量核对</span>
47
+      <span>数量核对</span>
48
+      <span>数量核对</span>
49
+      <span>数量核对</span>
50
+      <span>数量核对</span>
51
+      <span>数量核对</span>
52
+    </div>
53
+    <div class="template">
54
+      <button nz-button class="btn default">引入模板</button>
55
+    </div>
56
+  </div>
57
+
58
+  <div class="content">
59
+    <div class="contentInner">
60
+      <div class="address">
61
+        <div class="contentHead">选择巡检点</div>
62
+        <overlay-scrollbars #osComponentRef1 class="contentBody">
63
+          <nz-tree
64
+            #nzTreeComponent
65
+            [nzData]="buildingAndAddressList"
66
+            nzCheckable
67
+            [nzCheckedKeys]="defaultCheckedKeys"
68
+            [nzExpandedKeys]="defaultExpandedKeys"
69
+            [nzSelectedKeys]="defaultSelectedKeys"
70
+            (nzCheckBoxChange)="nzCheck($event)"
71
+          >
72
+          </nz-tree>
73
+        </overlay-scrollbars>
74
+      </div>
75
+      <div class="addressCopy">
76
+        <div class="contentHead">选中巡检点</div>
77
+        <overlay-scrollbars #osComponentRef2 class="contentBody">
78
+          <nz-tree #nzTreeComponentCopy [nzData]="buildingAndAddressListCopy" (nzClick)="nzClick($event)"></nz-tree>
79
+        </overlay-scrollbars>
80
+      </div>
81
+      <div class="addressAssign">
82
+        <div class="contentHead">巡检点分配</div>
83
+        <div class="contentBody" *ngIf="activeAddressId">
84
+          <div class="list-template__searchItem">
85
+            <nz-radio-group [(ngModel)]="activeAddress.origin.radioValue">
86
+              <label nz-radio [nzValue]="1">派单给人</label>
87
+              <label nz-radio [nzValue]="2">派单给组</label>
88
+            </nz-radio-group>
89
+          </div>
90
+          <div class="list-template__searchItem" *ngIf="activeAddress.origin.radioValue == 1">
91
+            <span class="label"><span class="red">*</span>处理人</span>:
92
+            <nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch
93
+              (nzOnSearch)="changeInp('user', $event)" nzAllowClear nzPlaceHolder="请选择处理人" [(ngModel)]="activeAddress.origin.userId" (ngModelChange)="changeUser($event)">
94
+              <ng-container *ngFor="let option of userList">
95
+                <nz-option *ngIf="!isLoading" [nzLabel]="option.name" [nzValue]="option.id"></nz-option>
96
+              </ng-container>
97
+              <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
98
+                <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
99
+              </nz-option>
100
+            </nz-select>
101
+          </div>
102
+          <div class="list-template__searchItem" *ngIf="activeAddress.origin.radioValue == 2">
103
+            <span class="label"><span class="red">*</span>处理组</span>:
104
+            <nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch
105
+              (nzOnSearch)="changeInp('group', $event)" nzAllowClear nzPlaceHolder="请选择处理组" [(ngModel)]="activeAddress.origin.groupId" (ngModelChange)="changeGroup($event)">
106
+              <ng-container *ngFor="let option of groupList">
107
+                <nz-option *ngIf="!isLoading" [nzLabel]="option.groupName" [nzValue]="option.id"></nz-option>
108
+              </ng-container>
109
+              <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
110
+                <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
111
+              </nz-option>
112
+            </nz-select>
113
+          </div>
114
+        </div>
115
+      </div>
116
+    </div>
117
+    <div class="contentBtns">
118
+      <button nz-button class="btn cancel" (click)="goBack()">返回</button>
119
+      <button nz-button nzType="primary" class="ml8" (click)="saveToTemplate()">保存并存为模板</button>
120
+      <button nz-button nzType="primary" class="ml8" (click)="save()">保存</button>
121
+    </div>
122
+  </div>
123
+</div>
124
+<!-- 操作成功/失败提示框 -->
125
+<app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
126
+  [info]="promptInfo">
127
+</app-prompt-modal>
128
+<!-- 删除模态框 -->
129
+<app-dialog-delete [delModal]="delModal" (hideDelModalEvent)="hideDelModal()" [btnLoading]="btnLoading"
130
+(confirmDelEvent)="confirmDel()" [content]="tipsMsg1"></app-dialog-delete>
131
+<!-- 模板名称 -->
132
+<app-template-name [templateFlag]="templateFlag"
133
+(submitFormHand)="submitFormHand($event)"
134
+(cancelFlagHand)="cancelFlagHand($event)"
135
+*ngIf="templateFlag"></app-template-name>
136
+<!-- 遮罩 -->
137
+<app-mask *ngIf="maskFlag"></app-mask>

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

@@ -0,0 +1,138 @@
1
+@import "../../../../src/theme.less";
2
+:host {
3
+  width: 100%;
4
+  .inspectionPlanConfig{
5
+    padding: 16px;
6
+    height: 100%;
7
+    display: flex;
8
+    flex-direction: column;
9
+    justify-content: space-between;
10
+    .tagsAndTemplete{
11
+      height: 88px;
12
+      display: flex;
13
+      justify-content: space-between;
14
+      align-items: center;
15
+      .tags{
16
+        height: 100%;
17
+        background: #F9FAFB;
18
+        border-radius: 16px;
19
+        border: 1px solid #E8EBEF;
20
+        flex: 1;
21
+        padding: 16px 64px;
22
+        display: flex;
23
+        justify-content: space-between;
24
+        align-items: center;
25
+        flex-wrap: wrap;
26
+        gap: 16px;
27
+        position: relative;
28
+        overflow: hidden;
29
+        .transport-24gf-tags{
30
+          width: 64px;
31
+          height: 86px;
32
+          position: absolute;
33
+          left: 0;
34
+          top: 50%;
35
+          transform: translateY(-50%);
36
+          font-size: 30px;
37
+          color: @primary-color;
38
+          display: flex;
39
+          justify-content: center;
40
+          align-items: center;
41
+        }
42
+        span{
43
+          cursor: pointer;
44
+          &:hover{
45
+            color: @primary-color;
46
+          }
47
+        }
48
+      }
49
+      .template{
50
+        height: 100%;
51
+        display: flex;
52
+        align-items: center;
53
+        margin-left: 16px;
54
+      }
55
+    }
56
+    .content{
57
+      flex: 1;
58
+      min-height: 0;
59
+      display: flex;
60
+      flex-direction: column;
61
+      justify-content: space-between;
62
+      background: #F9FAFB;
63
+      border: 1px solid #EEF3F9;
64
+      border-radius: 16px;
65
+      .contentInner{
66
+        flex: 1;
67
+        display: flex;
68
+        justify-content: space-between;
69
+        align-items: center;
70
+        padding: 16px;
71
+        gap: 16px;
72
+        .contentHead{
73
+          height: 45px;
74
+          display: flex;
75
+          align-items: center;
76
+          padding: 0 16px;
77
+          font-size: 16px;
78
+          color: @primary-color;
79
+          font-weight: bold;
80
+          border-bottom: 1px solid #D9D9D9;
81
+        }
82
+        .contentBody{
83
+          padding: 16px 32px;
84
+          flex: 1;
85
+        }
86
+        .address{
87
+          flex: 1;
88
+          height: 100%;
89
+          background: #FFFFFF;
90
+          border-radius: 16px;
91
+          border: 1px solid #E8EBEF;
92
+          display: flex;
93
+          flex-direction: column;
94
+        }
95
+        .addressCopy{
96
+          flex: 1;
97
+          height: 100%;
98
+          background: #FFFFFF;
99
+          border-radius: 16px;
100
+          border: 1px solid #E8EBEF;
101
+          display: flex;
102
+          flex-direction: column;
103
+        }
104
+        .addressAssign{
105
+          flex: 2;
106
+          height: 100%;
107
+          background: #FFFFFF;
108
+          border-radius: 16px;
109
+          border: 1px solid #E8EBEF;
110
+          display: flex;
111
+          flex-direction: column;
112
+        }
113
+        .list-template__searchItem {
114
+          margin-bottom: 16px;
115
+          .label {
116
+            color: #333;
117
+            display: inline-block;
118
+            width: 70px;
119
+            text-align-last: justify;
120
+            text-align: justify;
121
+            &.label--big {
122
+              width: 100px;
123
+            }
124
+          }
125
+          .formItem {
126
+            width: 135px;
127
+          }
128
+        }
129
+      }
130
+      .contentBtns{
131
+        margin-bottom: 16px;
132
+        display: flex;
133
+        justify-content: center;
134
+        align-items: center;
135
+      }
136
+    }
137
+  }
138
+}

+ 341 - 0
src/app/views/inspection-plan-config/inspection-plan-config.component.ts

@@ -0,0 +1,341 @@
1
+import { Component, OnInit, ViewChild, AfterViewInit } from "@angular/core";
2
+import { NzFormatEmitEvent, NzTreeNodeOptions, NzTreeComponent, NzMessageService } from 'ng-zorro-antd';
3
+import { ToolService } from 'src/app/services/tool.service';
4
+import { MainService } from 'src/app/services/main.service';
5
+import uniqBy from 'lodash-es/uniqBy'
6
+import cloneDeep from 'lodash-es/cloneDeep'
7
+import { OverlayScrollbarsComponent } from 'overlayscrollbars-ngx';
8
+import { Router, ActivatedRoute } from '@angular/router';
9
+import { Subject } from 'rxjs';
10
+import { debounceTime } from 'rxjs/operators';
11
+
12
+@Component({
13
+  selector: "app-inspection-plan-config",
14
+  templateUrl: "./inspection-plan-config.component.html",
15
+  styleUrls: ["./inspection-plan-config.component.less"],
16
+})
17
+export class InspectionPlanConfigComponent implements OnInit, AfterViewInit {
18
+  constructor(
19
+    private tool: ToolService,
20
+    private mainService: MainService,
21
+    private message: NzMessageService,
22
+    private router: Router,
23
+    private route: ActivatedRoute,
24
+  ){}
25
+  @ViewChild('nzTreeComponent', { static: false }) nzTreeComponent: NzTreeComponent;
26
+  @ViewChild('nzTreeComponentCopy', { static: false }) nzTreeComponentCopy: NzTreeComponent;
27
+  @ViewChild("osComponentRef1", {
28
+    read: OverlayScrollbarsComponent,
29
+    static: false,
30
+  })
31
+  osComponentRef1: OverlayScrollbarsComponent;
32
+  @ViewChild("osComponentRef2", {
33
+    read: OverlayScrollbarsComponent,
34
+    static: false,
35
+  })
36
+  osComponentRef2: OverlayScrollbarsComponent;
37
+  defaultCheckedKeys = [];
38
+  defaultSelectedKeys = [];
39
+  defaultExpandedKeys = [];
40
+  nodes: NzTreeNodeOptions[] = [];
41
+  currentHospital; //当前院区
42
+
43
+  changeInpSubject = new Subject(); //防抖
44
+
45
+  ngOnInit(): void {
46
+    //防抖
47
+    this.changeInpSubject.pipe(debounceTime(500)).subscribe((v) => {
48
+      if(v[0] === 'user'){
49
+        this.getUsers(v[1]);
50
+      } else if(v[0] === 'group'){
51
+        this.getGroups(v[1]);
52
+      }
53
+    });
54
+    this.currentHospital = this.tool.getCurrentHospital();
55
+    this.getPlanDetail();
56
+    this.getAddressList();
57
+    this.getUsers();
58
+    this.getGroups();
59
+  }
60
+
61
+  // 表格数据
62
+  isLoading = false;
63
+  buildingAndAddressList: NzTreeNodeOptions[] = [];
64
+  buildingAndAddressListCopy: NzTreeNodeOptions[] = [];
65
+  getAddressList() {
66
+    let data = {
67
+      idx: 0,
68
+      sum: 9999,
69
+      inspectionNode: {
70
+        hosId: this.currentHospital.id,
71
+      },
72
+    };
73
+    this.isLoading = true;
74
+    this.mainService
75
+      .getFetchDataList("simple/data", "inspectionNode", data)
76
+      .subscribe((data) => {
77
+        this.isLoading = false;
78
+        if (data.status == 200) {
79
+          let addressList = data.list || [];
80
+          // 楼栋
81
+          let buildingList = addressList.map((item) => {
82
+            return {
83
+              title: item.buildingDTO.buildingName,
84
+              key: 'b-' + item.buildingDTO.id,
85
+              children: [],
86
+              selectable: false,
87
+              hosId: this.currentHospital.id,
88
+            }
89
+          })
90
+          buildingList = uniqBy(buildingList, "key");
91
+          // 巡检点
92
+          addressList = addressList.map((item) => {
93
+            return {
94
+              title: item.name,
95
+              key: item.id.toString(),
96
+              parentId: 'b-' + item.buildingDTO.id,
97
+              isLeaf: true,
98
+              selectable: false,
99
+              hosId: this.currentHospital.id,
100
+            }
101
+          })
102
+          let buildingAndAddressList = buildingList.concat(addressList);
103
+          console.log(buildingAndAddressList);
104
+          this.buildingAndAddressList = this.tool.tranListToTreeData(buildingAndAddressList, undefined, "parentId", "key");
105
+          console.log(this.buildingAndAddressList);
106
+        }else{
107
+          this.message.error(data.msg || "请求数据失败");
108
+        }
109
+      });
110
+  }
111
+
112
+  nzCheck(event: NzFormatEmitEvent): void {
113
+    console.log(event);
114
+    console.log(event.node);
115
+    console.log(event.node.parentNode);
116
+    let buildingAndAddressListCopy = cloneDeep(this.buildingAndAddressListCopy);
117
+    if(event.eventName === 'check'){
118
+      if(event.node.isChecked){
119
+        // 选中
120
+        if(event.node.isLeaf){
121
+          // 叶子节点
122
+          let parent = buildingAndAddressListCopy.find(v => v.key === event.node.parentNode.key);
123
+          if(parent){
124
+            parent.children.push({ ...event.node.origin, selectable: true, checked: false });
125
+          }else{
126
+            let parent = cloneDeep({ ...event.node.parentNode.origin, selectable: true, checked: false });
127
+            parent.children = [{ ...event.node.origin, selectable: true, checked: false }];
128
+            buildingAndAddressListCopy.push(parent);
129
+          }
130
+          console.log("选中叶子节点");
131
+        }else{
132
+          // 非叶子节点
133
+          buildingAndAddressListCopy = buildingAndAddressListCopy.filter(v => v.key !== event.node.key);
134
+          event.node.origin.children.forEach( v => {
135
+            v.selectable = true;
136
+            v.checked = false;
137
+          })
138
+          buildingAndAddressListCopy.push({ ...event.node.origin, selectable: true, checked: false });
139
+          console.log("选中非叶子节点");
140
+        }
141
+      } else {
142
+        // 未选中
143
+        if(event.node.isLeaf){
144
+          // 叶子节点
145
+          let parent = buildingAndAddressListCopy.find(v => v.key === event.node.parentNode.key);
146
+          parent.children = parent.children.filter(v => v.key !== event.node.key);
147
+          if(!parent.children.length){
148
+            buildingAndAddressListCopy = [];
149
+          }
150
+          console.log("未选中叶子节点");
151
+        }else{
152
+          // 非叶子节点
153
+          buildingAndAddressListCopy = buildingAndAddressListCopy.filter(v => v.key !== event.node.key);
154
+          console.log("未选中非叶子节点");
155
+        }
156
+      }
157
+    }
158
+    this.buildingAndAddressListCopy = buildingAndAddressListCopy;
159
+    console.log('buildingAndAddressListCopy', this.buildingAndAddressListCopy);
160
+  }
161
+
162
+  // 边输边搜节流阀
163
+  changeInp(model, e) {
164
+    this.isLoading = true;
165
+    this.changeInpSubject.next([model, e]);
166
+  }
167
+
168
+  // 修改处理人
169
+  changeUser(userId){
170
+    this.activeAddress.origin.userId = userId;
171
+  }
172
+
173
+  // 修改处理组
174
+  changeGroup(groupId){
175
+    this.activeAddress.origin.groupId = groupId;
176
+  }
177
+
178
+  searchDto:any = {};
179
+  // 搜索
180
+  // 获取所有科室
181
+  userList: any = []; //所有所属科室(搜索)
182
+  getUsers(keyword = '') {
183
+    let postData = {
184
+      user: {
185
+        hospital: { id: this.currentHospital.id },
186
+        name: keyword,
187
+        simpleQuery: true,
188
+        menuId: 414,
189
+      },
190
+      idx: 0,
191
+      sum: 20,
192
+    };
193
+    this.mainService
194
+      .getFetchDataList("data", "user", postData)
195
+      .subscribe((data) => {
196
+        this.isLoading = false;
197
+        this.userList = data.list || [];
198
+      });
199
+  }
200
+
201
+  // 获取组
202
+  groupList: any = []; //所有所属科室(搜索)
203
+  getGroups(keyword = '') {
204
+    let postData = {
205
+      group2: {
206
+        groupName: keyword,
207
+        hospitals: this.currentHospital.id,
208
+        type: 1,
209
+      },
210
+      idx: 0,
211
+      sum: 20,
212
+    };
213
+    this.mainService
214
+      .getFetchDataList("data", "group2", postData)
215
+      .subscribe((data) => {
216
+        this.isLoading = false;
217
+        this.groupList = data.list || [];
218
+      });
219
+  }
220
+
221
+  // 选择单个巡检点
222
+  activeAddress:any;
223
+  activeAddressId:any;
224
+  nzClick(event: NzFormatEmitEvent): void {
225
+    console.log(event);
226
+    this.activeAddress = event.node;
227
+    this.activeAddressId = event.selectedKeys[0];
228
+    this.activeAddress.origin.radioValue = event.node.origin.userId ? 1 : (event.node.origin.groupId ? 2 : undefined);
229
+  }
230
+
231
+  // 计划详情
232
+  planDetail:any = {};
233
+  nodeList:any[] = [];
234
+  getPlanDetail(){
235
+    this.mainService
236
+      .getFetchData("simple/data", "inspection", +this.route.snapshot.paramMap.get('id'))
237
+      .subscribe((data) => {
238
+        this.planDetail = data.data || {};
239
+        let nodeList = data.data ? (data.data.nodeList || []) : [];
240
+        this.generateTree(nodeList);
241
+      });
242
+  }
243
+
244
+  // 回显树形结构
245
+  generateTree(nodeList){
246
+    console.log('nodeList:' + nodeList);
247
+    let buildingAndAddressList = nodeList.map(v => ({
248
+      title: v.nodeId ? v.inspectionNodeDTO.name : v.buildingDTO.buildingName,
249
+      key: v.nodeId ? `${v.nodeId}` : `b-${v.buildId}`,
250
+      parentId: v.buildId ? `b-${v.buildId}` : undefined,
251
+      userId: v.userId,
252
+      groupId: v.groupId,
253
+      hosId: v.hosId,
254
+      children: [],
255
+      selectable: false,
256
+      isLeaf: Boolean(v.nodeId),
257
+    }));
258
+    console.log('buildingAndAddressList:' + buildingAndAddressList);
259
+  }
260
+
261
+  // 填写模板名称-确定
262
+  templateLoading = false;
263
+  templateFlag = false;
264
+  submitFormHand(name){
265
+    this.maskFlag = this.message.loading("正在加载中..", {
266
+      nzDuration: 0,
267
+    }).messageId;
268
+    let nodeList = this.tool.tranTreeToListData(this.buildingAndAddressListCopy).map(v => ({
269
+      nodeId: v.parentId ? Number(v.key) : undefined,
270
+      userId: v.userId,
271
+      groupId: v.groupId,
272
+      hosId: v.hosId,
273
+      buildId: v.parentId ? Number(v.parentId.replace(/b-/, '')): Number(v.key.replace(/b-/, '')),
274
+    }));
275
+    console.log(name);
276
+    console.log(nodeList);
277
+    console.log('保存并存为模板');
278
+    let postData = {
279
+      inspection: {
280
+        ...this.planDetail,
281
+        nodeList,
282
+      },
283
+      template: {
284
+        hosId: this.currentHospital.id,
285
+        name,
286
+      },
287
+    };
288
+    console.log(postData);
289
+    this.mainService
290
+      .inspectionPost("templateToInspection", postData)
291
+      .subscribe((result) => {
292
+        this.message.remove(this.maskFlag);
293
+        this.maskFlag = false;
294
+        if (result.status == 200) {
295
+          this.message.success("保存成功");
296
+          this.router.navigateByUrl("/main/inspectionPlan");
297
+        } else {
298
+          this.message.success(result.msg || '保存失败');
299
+        }
300
+      });
301
+  }
302
+
303
+  // 填写模板名称-取消
304
+  cancelFlagHand(e) {
305
+    this.templateFlag = false;
306
+  }
307
+
308
+  // 返回
309
+  goBack(){
310
+    this.router.navigateByUrl("/main/inspectionPlan");
311
+  }
312
+
313
+  // 保存并存为模板
314
+  maskFlag: any = false;
315
+  saveToTemplate(){
316
+    let nodeList = this.tool.tranTreeToListData(this.buildingAndAddressListCopy);
317
+    console.log(nodeList);
318
+    if(!nodeList.length){
319
+      this.message.warning('请选择至少一个巡检点');
320
+      return;
321
+    }
322
+    this.templateFlag = true;
323
+  }
324
+
325
+  // 保存
326
+  save(){
327
+    console.log('保存');
328
+  }
329
+
330
+  ngAfterViewInit(): void {
331
+    // get node by key: '10011'
332
+    console.log(this.nzTreeComponent.getTreeNodeByKey('10011'));
333
+    // use tree methods
334
+    console.log(
335
+      this.nzTreeComponent.getTreeNodes(),
336
+      this.nzTreeComponent.getCheckedNodeList(),
337
+      this.nzTreeComponent.getSelectedNodeList(),
338
+      this.nzTreeComponent.getExpandedNodeList()
339
+    );
340
+  }
341
+}

+ 19 - 0
src/app/views/inspection-plan-config/inspection-plan-config.module.ts

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

+ 25 - 0
src/app/views/inspection-plan/inspection-plan-routing.module.ts

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

+ 216 - 0
src/app/views/inspection-plan/inspection-plan.component.html

@@ -0,0 +1,216 @@
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__searchBox">
5
+        <div class="list-template__searchItem">
6
+          <span class="label label--big">计划主题:</span>
7
+          <input nz-input class="formItem" placeholder="请输入关键字" [(ngModel)]="searchCriteria.name" />
8
+        </div>
9
+        <div class="list-template__searchItem">
10
+          <span class="label label--big">重复策略:</span>
11
+          <nz-select [nzDropdownMatchSelectWidth]="false" class="formItem" nzAllowClear nzPlaceHolder="请选择重复策略" [(ngModel)]="searchCriteria.planTypeId">
12
+            <ng-container *ngFor="let data of planTypes">
13
+              <nz-option *ngIf="!isLoading" [nzLabel]="data.name" [nzValue]="data.id"></nz-option>
14
+            </ng-container>
15
+            <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
16
+              <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
17
+            </nz-option>
18
+          </nz-select>
19
+        </div>
20
+      </div>
21
+      <div nz-col nzXl="9" class="list-template__btns">
22
+        <button nz-button class="btn default" (click)='getList(1)'>搜索</button>
23
+        <button nz-button class="btn default ml8" (click)='reset()'>重置</button>
24
+        <button nz-button *ngIf="coopBtns.add" class="btn default ml8" (click)="addModal()">新增</button>
25
+      </div>
26
+    </div>
27
+    <div class="list-template__bottom">
28
+      <nz-table class="list-template__nzTable" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false"
29
+        [nzLoading]="loading1">
30
+        <thead>
31
+          <tr class="thead">
32
+            <th nzWidth="10%">计划主题</th>
33
+            <th nzWidth="8%">重复策略</th>
34
+            <th nzWidth="12%">执行时间</th>
35
+            <th nzWidth="10%">执行时长(天)</th>
36
+            <th nzWidth="10%">巡检表</th>
37
+            <th nzWidth="10%">签到方式</th>
38
+            <th nzWidth="10%">巡检类型</th>
39
+            <th nzWidth="10%">状态</th>
40
+            <th nzWidth="20%">操作</th>
41
+          </tr>
42
+        </thead>
43
+        <tbody>
44
+          <tr *ngFor="let data of listOfData;let i = index">
45
+            <td>{{ data.name }}</td>
46
+            <td>{{ data.planType?.name }}</td>
47
+            <td [ngSwitch]="data.planType.value">
48
+              <ng-container *ngSwitchCase="'none'">{{ data.execTime|date:'yyyy年MM月dd日HH时mm分' }}</ng-container>
49
+              <ng-container *ngSwitchCase="'day'">{{ data.execTime|date:'HH时mm分' }}</ng-container>
50
+              <ng-container *ngSwitchCase="'week'">{{data.weekName}} {{ data.execTime|date:'HH时mm分' }}</ng-container>
51
+              <ng-container *ngSwitchCase="'month'">{{data.planDay}}日 {{ data.execTime|date:'HH时mm分' }}</ng-container>
52
+              <ng-container *ngSwitchCase="'year'">{{ data.execTime|date:'MM月dd日HH时mm分' }}</ng-container>
53
+            </td>
54
+            <td>{{ data.execDay }}</td>
55
+            <td>{{ data.inspectionFormDTO?.name }}</td>
56
+            <td>{{ data.signType?.name }}</td>
57
+            <td>{{ data.type?.name }}</td>
58
+            <td>{{ data.status?.name }}</td>
59
+            <td>
60
+              <div class="coop">
61
+                <!-- <span *ngIf="coopBtns.look" (click)="detail(data.id)">查看</span> -->
62
+                <span *ngIf="coopBtns.del" (click)="showDelModal(data.id,'您确认要删除吗?','删除','del')">删除</span>
63
+                <span *ngIf="coopBtns.edit" (click)="edit(data)">编辑</span>
64
+                <span *ngIf="coopBtns.edit" (click)="planConfig(data)">配置</span>
65
+                <span *ngIf="coopBtns.isStartUp && data.planType.value != 'none' && (data.status.value == '2' || data.status.value == '3')" (click)="showDelModal(data.id, data.status.value == 2 ? '您确认要停止巡检计划吗?' : '您确认要启动巡检计划吗?', data.status.value == 2 ? '停用' : '启用', 'switch', data.status.value == 2)">{{data.status.value == 2 ? '停用' : '启用'}}</span>
66
+                <span *ngIf="coopBtns.executeNow && data.status.value != '1'" (click)="openExecModal(data)">执行一次</span>
67
+              </div>
68
+            </td>
69
+          </tr>
70
+        </tbody>
71
+      </nz-table>
72
+      <div class="list-template__pagination">
73
+        <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" [(nzPageSize)]="pageSize"
74
+          (nzPageIndexChange)="getList(0)" (nzPageSizeChange)="getList(0)">
75
+        </nz-pagination>
76
+      </div>
77
+    </div>
78
+  </div>
79
+
80
+  <!-- 新增/编辑模态框 -->
81
+  <div class="save display_flex justify-content_flex-center align-items_center add" *ngIf="modal">
82
+    <div class="modalBody">
83
+      <div class="title">{{add?"新增":"编辑"}}巡检计划<i class="icon_transport transport-guanbi" (click)="hideAddModal()"></i>
84
+      </div>
85
+      <overlay-scrollbars #osComponentRef1 class="content">
86
+        <form nz-form [formGroup]="validateForm" class="addForm" (ngSubmit)="submitForm()">
87
+          <nz-form-item>
88
+            <nz-form-label [nzSpan]="5" nzRequired nzFor="name">计划主题</nz-form-label>
89
+            <nz-form-control [nzSpan]="19" nzErrorTip="请输入计划主题!">
90
+              <nz-input-group>
91
+                <input nz-input formControlName="name" placeholder="请输入计划主题" />
92
+              </nz-input-group>
93
+            </nz-form-control>
94
+          </nz-form-item>
95
+          <nz-form-item>
96
+            <nz-form-label class="line_height_normal" [nzSpan]="5" nzRequired nzFor="content">计划内容</nz-form-label>
97
+            <nz-form-control [nzSpan]="19" nzErrorTip="请输入计划内容!">
98
+              <nz-input-group>
99
+                <textarea formControlName="content" nz-input placeholder="请输入计划内容"></textarea>
100
+              </nz-input-group>
101
+            </nz-form-control>
102
+          </nz-form-item>
103
+          <nz-form-item>
104
+            <nz-form-label [nzSpan]="5" nzRequired nzFor="formId">巡&nbsp;&nbsp;检&nbsp;&nbsp;单</nz-form-label>
105
+            <nz-form-control [nzSpan]="19" nzErrorTip="请选择巡检单!">
106
+              <nz-select [nzDropdownMatchSelectWidth]="false" formControlName="formId" nzShowSearch nzAllowClear
107
+                nzPlaceHolder="请选择巡检单" nzServerSearch (nzOnSearch)="changeFormId($event)">
108
+                <ng-container *ngFor="let data of formIds">
109
+                  <nz-option *ngIf="!isLoading" [nzLabel]="data.name" [nzValue]="data.id">
110
+                  </nz-option>
111
+                </ng-container>
112
+                <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
113
+                  <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
114
+                </nz-option>
115
+              </nz-select>
116
+            </nz-form-control>
117
+          </nz-form-item>
118
+          <nz-form-item>
119
+            <nz-form-label [nzSpan]="5" nzRequired nzFor="type">巡检类型</nz-form-label>
120
+            <nz-form-control [nzSpan]="19" nzErrorTip="请选择巡检类型!">
121
+              <nz-select formControlName="type" nzPlaceHolder="请选择巡检类型">
122
+                <nz-option [nzValue]="data.value" [nzLabel]="data.name" *ngFor="let data of types"></nz-option>
123
+              </nz-select>
124
+            </nz-form-control>
125
+          </nz-form-item>
126
+          <nz-form-item>
127
+            <nz-form-label [nzSpan]="5" nzRequired nzFor="execDay">执行时长</nz-form-label>
128
+            <nz-form-control [nzSpan]="19" nzErrorTip="请填写执行时长!">
129
+              <nz-input-number nzPlaceHolder="请填写执行时长" class="w100" formControlName="execDay" [nzMin]="0" [nzStep]="1" [nzFormatter]="formatterExecDay" [nzParser]="parserExecDay"></nz-input-number>
130
+            </nz-form-control>
131
+          </nz-form-item>
132
+          <nz-form-item>
133
+            <nz-form-label [nzSpan]="5" nzRequired nzFor="planType">重复策略</nz-form-label>
134
+            <nz-form-control [nzSpan]="19" nzErrorTip="请选择重复策略!">
135
+              <nz-select formControlName="planType" nzPlaceHolder="请选择重复策略" (ngModelChange)="planTypeChange($event)">
136
+                <nz-option [nzValue]="data.value" [nzLabel]="data.name" *ngFor="let data of planTypes"></nz-option>
137
+              </nz-select>
138
+            </nz-form-control>
139
+          </nz-form-item>
140
+          <div style="display: flex;justify-content: space-between;">
141
+            <nz-form-item *ngIf="validateForm.value.planType == 'week'" style="flex: 1;" class="mr8">
142
+              <nz-form-label [nzSpan]="24" nzRequired nzFor="doWeek">执行时间(选择周)</nz-form-label>
143
+              <nz-form-control [nzSpan]="24" nzErrorTip="请选择周!">
144
+                <nz-select formControlName="doWeek" nzPlaceHolder="请选择周">
145
+                  <nz-option [nzValue]="1" nzLabel="周一"></nz-option>
146
+                  <nz-option [nzValue]="2" nzLabel="周二"></nz-option>
147
+                  <nz-option [nzValue]="3" nzLabel="周三"></nz-option>
148
+                  <nz-option [nzValue]="4" nzLabel="周四"></nz-option>
149
+                  <nz-option [nzValue]="5" nzLabel="周五"></nz-option>
150
+                  <nz-option [nzValue]="6" nzLabel="周六"></nz-option>
151
+                  <nz-option [nzValue]="7" nzLabel="周日"></nz-option>
152
+                </nz-select>
153
+              </nz-form-control>
154
+            </nz-form-item>
155
+            <nz-form-item *ngIf="validateForm.value.planType == 'month'" style="flex: 1;" class="mr8">
156
+              <nz-form-label [nzSpan]="24" nzRequired nzFor="doMonth">执行时间(选择日)</nz-form-label>
157
+              <nz-form-control [nzSpan]="24" nzErrorTip="请选择日!">
158
+                <nz-select formControlName="doMonth" nzPlaceHolder="请选择日">
159
+                  <nz-option [nzValue]="item" [nzLabel]="item + '号'" *ngFor="let item of months">
160
+                  </nz-option>
161
+                </nz-select>
162
+              </nz-form-control>
163
+            </nz-form-item>
164
+            <nz-form-item *ngIf="validateForm.value.planType == 'year'" style="flex: 1;" class="mr8">
165
+              <nz-form-label [nzSpan]="24" nzRequired nzFor="doYear">执行时间(选择月日)</nz-form-label>
166
+              <nz-form-control [nzSpan]="24" nzErrorTip="请选择月日!">
167
+                <nz-date-picker nzFormat="MM-dd" formControlName="doYear" nzPlaceHolder="请选择月日"></nz-date-picker>
168
+              </nz-form-control>
169
+            </nz-form-item>
170
+            <nz-form-item *ngIf="validateForm.value.planType == 'none'" style="flex: 1;" class="mr8">
171
+              <nz-form-label [nzSpan]="24" nzRequired nzFor="doNone">执行时间(选择年月日)</nz-form-label>
172
+              <nz-form-control [nzSpan]="24" nzErrorTip="请选择年月日!">
173
+                <nz-date-picker nzFormat="yyyy-MM-dd" formControlName="doNone" nzPlaceHolder="请选择年月日"></nz-date-picker>
174
+              </nz-form-control>
175
+            </nz-form-item>
176
+            <nz-form-item *ngIf="validateForm.value.planType" style="flex: 1;">
177
+              <nz-form-label [nzSpan]="validateForm.value.planType == 'day' ? 5 : 24" nzRequired nzFor="execTime">执行时间{{validateForm.value.planType == 'day' ? '' : '(选择时分)'}}</nz-form-label>
178
+              <nz-form-control [nzSpan]="validateForm.value.planType == 'day' ? 19 : 24" nzErrorTip="请选择时分!">
179
+                <nz-time-picker nzFormat="HH:mm" formControlName="execTime" class="w100" nzPlaceHolder="请选择时分"
180
+                  [nzAllowEmpty]="false">
181
+                </nz-time-picker>
182
+              </nz-form-control>
183
+            </nz-form-item>
184
+          </div>
185
+          <nz-form-item>
186
+            <nz-form-label [nzSpan]="5" nzRequired nzFor="signType">签到方式</nz-form-label>
187
+            <nz-form-control [nzSpan]="19" nzErrorTip="请选择签到方式!">
188
+              <nz-select formControlName="signType" nzPlaceHolder="请选择签到方式">
189
+                <nz-option [nzValue]="data.value" [nzLabel]="data.name" *ngFor="let data of signTypes"></nz-option>
190
+              </nz-select>
191
+            </nz-form-control>
192
+          </nz-form-item>
193
+        </form>
194
+      </overlay-scrollbars>
195
+      <div class=" display_flex justify-content_flex-center">
196
+        <button nzType="primary" nz-button (click)="submitForm()" [nzLoading]="btnLoading">确认</button>
197
+        <button class="btn cancel" nz-button nzType="default" (click)="hideAddModal()">取消</button>
198
+      </div>
199
+    </div>
200
+  </div>
201
+
202
+  <!-- 删除模态框 -->
203
+  <app-dialog-delete [delModal]="delModal" (hideDelModalEvent)="hideDelModal()" [btnLoading]="btnLoading"
204
+    (confirmDelEvent)="confirmDel()" [content]="tipsMsg1"></app-dialog-delete>
205
+</div>
206
+<!-- 操作成功/失败提示框 -->
207
+<app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
208
+  [info]="promptInfo">
209
+</app-prompt-modal>
210
+<!-- 查看详情 -->
211
+<router-outlet></router-outlet>
212
+<!-- 立即执行 -->
213
+<app-dialog-delete [delModal]="execModal" (hideDelModalEvent)="closeExecModal()" [btnLoading]="btnLoading"
214
+  (confirmDelEvent)="confirmExec()" content="您确认立即执行计划一次吗?确认后会立即生成计划内配置的巡检任务"></app-dialog-delete>
215
+<!-- 遮罩 -->
216
+<app-mask *ngIf="maskFlag"></app-mask>

+ 198 - 0
src/app/views/inspection-plan/inspection-plan.component.less

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

+ 519 - 0
src/app/views/inspection-plan/inspection-plan.component.ts

@@ -0,0 +1,519 @@
1
+import { Component, OnInit, ViewChild } from "@angular/core";
2
+import { ActivatedRoute, Router } from "@angular/router";
3
+import {
4
+  FormBuilder,
5
+  Validators,
6
+  FormGroup,
7
+  FormControl,
8
+} from "@angular/forms";
9
+
10
+import { MainService } from "../../services/main.service";
11
+import { OverlayScrollbarsComponent } from "overlayscrollbars-ngx";
12
+import { ToolService } from "../../services/tool.service";
13
+import { Subject } from "rxjs";
14
+import { debounceTime } from "rxjs/operators";
15
+import { NzMessageService } from "ng-zorro-antd";
16
+import { format, startOfMinute } from "date-fns";
17
+@Component({
18
+  selector: "app-inspection-plan",
19
+  templateUrl: "./inspection-plan.component.html",
20
+  styleUrls: ["./inspection-plan.component.less"],
21
+})
22
+export class InspectionPlanComponent implements OnInit {
23
+  @ViewChild("osComponentRef1", {
24
+    read: OverlayScrollbarsComponent,
25
+    static: false,
26
+  })
27
+  osComponentRef1: OverlayScrollbarsComponent;
28
+  constructor(
29
+    private message: NzMessageService,
30
+    private fb: FormBuilder,
31
+    private mainService: MainService,
32
+    private route: ActivatedRoute,
33
+    private router: Router,
34
+    private tool: ToolService
35
+  ) {}
36
+
37
+  userInfo: any = JSON.parse(localStorage.getItem("user")) || {}; //登录用户信息
38
+
39
+  searchCriteria = {
40
+    //搜索条件
41
+    name: "",
42
+    planTypeId: null,
43
+  };
44
+  formIds = []; //巡检单
45
+  planTypes = []; //重复策略
46
+  types = []; //巡检类型
47
+  signTypes = []; //签到方式
48
+  department = []; // 院区下的科室列表
49
+  departmentSearch = []; // 院区下的科室列表(搜索框)
50
+  listOfData: any[] = []; //表格数据
51
+  pageIndex: number = 1; //表格当前页码
52
+  pageSize: number = 10; //表格每页展示条数
53
+  listLength: number = 10; //表格总数据量
54
+  tableHeight: number; //表格动态高
55
+  modal: boolean = false; //新增/编辑模态框
56
+  add: boolean; //true:新增;false:编辑
57
+  validateForm: FormGroup; //新增/编辑表单
58
+  coopId: number; //当前操作列id
59
+
60
+  hosId: any; //当前院区id
61
+  btnLoading: boolean = false; //提交按钮loading状态
62
+
63
+  promptContent: string; //操作提示框提示信息
64
+  ifSuccess: boolean; //操作成功/失败
65
+  promptInfo: string; //操作结果提示信息
66
+  promptModalShow: boolean; //操作提示框是否展示
67
+  demoValue: number = 0;
68
+  changeFormIdSubject = new Subject();
69
+  ngOnInit() {
70
+    this.changeFormIdSubject
71
+      .pipe(debounceTime(500))
72
+      .subscribe((v: any) => {
73
+        this.getFormId(v);
74
+      });
75
+    this.coopBtns = this.tool.initCoopBtns(this.route);
76
+    this.hosId = this.tool.getCurrentHospital().id;
77
+    this.getList(1);
78
+    this.initForm();
79
+    this.getPlanTypes();
80
+    this.getTypes();
81
+    this.getSignTypes();
82
+    this.getFormId();
83
+  }
84
+  // 重置
85
+  reset() {
86
+    this.searchCriteria = {
87
+      //搜索条件
88
+      name: "",
89
+      planTypeId: null,
90
+    };
91
+    this.getList(1);
92
+  }
93
+
94
+  // 选择轮巡类型
95
+  selectedTasktype = null; //当前选中的轮巡类型
96
+  // 任务类型防抖搜索
97
+  isLoading = false;
98
+  changeFormId(keyWord = "") {
99
+    this.isLoading = true;
100
+    this.changeFormIdSubject.next(keyWord);
101
+  }
102
+
103
+  // 初始化增删改按钮
104
+  coopBtns: any = {};
105
+
106
+  // 表格数据
107
+  loading1 = false;
108
+  getList(type) {
109
+    if (type == 1) {
110
+      this.pageIndex = 1;
111
+    }
112
+    let data = {
113
+      idx: this.pageIndex - 1,
114
+      sum: this.pageSize,
115
+      inspection: {
116
+        hosId: this.hosId,
117
+        planType: this.searchCriteria.planTypeId ? { id: this.searchCriteria.planTypeId } : undefined,
118
+        name: this.searchCriteria.name || undefined,
119
+      },
120
+    };
121
+    this.loading1 = true;
122
+    this.mainService
123
+      .getFetchDataList("simple/data", "inspection", data)
124
+      .subscribe((data) => {
125
+        this.loading1 = false;
126
+        if (data.status == 200) {
127
+          this.listOfData = data.list;
128
+          this.listLength = data.totalNum;
129
+          this.listOfData.forEach((item) => {
130
+            if (item.planType.value == "week") {
131
+              let weeks = [
132
+                "周一",
133
+                "周二",
134
+                "周三",
135
+                "周四",
136
+                "周五",
137
+                "周六",
138
+                "周日",
139
+              ];
140
+              item.weekName = weeks[item.planDay - 1];
141
+            }
142
+          });
143
+        }
144
+      });
145
+  }
146
+  //获取巡检单
147
+  getFormId(keyWord = "") {
148
+    let postData = {
149
+      idx: 0,
150
+      sum: 20,
151
+      inspectionForm: {
152
+        hosId: this.hosId,
153
+        name: keyWord,
154
+      },
155
+    };
156
+    this.mainService
157
+      .getFetchDataList("simple/data", "inspectionForm", postData)
158
+      .subscribe((result) => {
159
+        if (result.status == 200) {
160
+          this.isLoading = false;
161
+          this.formIds = result.list;
162
+        }
163
+      });
164
+  }
165
+  //获取重复策略
166
+  getPlanTypes() {
167
+    this.mainService
168
+    .getDictionary('list', 'inspection_plan_type')
169
+    .subscribe((data) => {
170
+      this.planTypes = data || [];
171
+    });
172
+  }
173
+  //获取巡检类型
174
+  getTypes() {
175
+    this.mainService
176
+    .getDictionary('list', 'inspection_type')
177
+    .subscribe((data) => {
178
+      this.types = data || [];
179
+    });
180
+  }
181
+  //获取签到方式
182
+  getSignTypes() {
183
+    this.mainService
184
+    .getDictionary('list', 'inspection_sign_type')
185
+    .subscribe((data) => {
186
+      this.signTypes = data || [];
187
+    });
188
+  }
189
+  // 新增/编辑弹框
190
+  addModal() {
191
+    this.add = true; //新增
192
+    this.modal = true;
193
+    this.initForm();
194
+  }
195
+  //关闭新增/编辑弹框
196
+  hideAddModal() {
197
+    this.modal = false;
198
+    this.initForm();
199
+  }
200
+  // 初始化新增form表单
201
+  initForm() {
202
+    this.validateForm = this.fb.group({
203
+      name: [null, [Validators.required]],
204
+      content: [null, [Validators.required]],
205
+      formId: [null, [Validators.required]],
206
+      planType: [null, [Validators.required]],
207
+      type: [null, [Validators.required]],
208
+      signType: [null, [Validators.required]],
209
+      execDay: [null, [Validators.required]],
210
+      execTime: [null, [Validators.required]],
211
+    });
212
+  }
213
+  // 修改轮巡策略
214
+  months = [...Array(32).keys()].slice(1);
215
+  planTypeChange(e) {
216
+    this.validateForm.controls.execTime.setValue(null);
217
+    switch (e) {
218
+      case "none":
219
+        this.validateForm.addControl("doNone", new FormControl(null, Validators.required));
220
+        this.validateForm.removeControl("doWeek");
221
+        this.validateForm.removeControl("doMonth");
222
+        this.validateForm.removeControl("doYear");
223
+        break;
224
+      case "day":
225
+        this.validateForm.removeControl("doWeek");
226
+        this.validateForm.removeControl("doMonth");
227
+        this.validateForm.removeControl("doYear");
228
+        this.validateForm.removeControl("doNone");
229
+        break;
230
+      case "week":
231
+        this.validateForm.addControl(
232
+          "doWeek",
233
+          new FormControl(null, Validators.required)
234
+        );
235
+        this.validateForm.removeControl("doMonth");
236
+        this.validateForm.removeControl("doYear");
237
+        this.validateForm.removeControl("doNone");
238
+        break;
239
+      case "month":
240
+        this.validateForm.addControl(
241
+          "doMonth",
242
+          new FormControl(null, Validators.required)
243
+        );
244
+        this.validateForm.removeControl("doWeek");
245
+        this.validateForm.removeControl("doYear");
246
+        this.validateForm.removeControl("doNone");
247
+        break;
248
+      case "year":
249
+        this.validateForm.addControl(
250
+          "doYear",
251
+          new FormControl(null, Validators.required)
252
+        );
253
+        this.validateForm.removeControl("doWeek");
254
+        this.validateForm.removeControl("doMonth");
255
+        this.validateForm.removeControl("doNone");
256
+        break;
257
+    }
258
+  }
259
+
260
+  // 新增/编辑表单提交
261
+  submitForm(): void {
262
+    this.btnLoading = true;
263
+    for (const i in this.validateForm.controls) {
264
+      this.validateForm.controls[i].markAsDirty();
265
+      this.validateForm.controls[i].updateValueAndValidity();
266
+    }
267
+    if (this.validateForm.invalid) {
268
+      this.btnLoading = false;
269
+      return;
270
+    }
271
+    let postData: any = {};
272
+
273
+    if (this.add) {
274
+      //增加
275
+      postData = {
276
+        name: this.validateForm.value.name,
277
+        content: this.validateForm.value.content,
278
+        hosId: this.hosId,
279
+        formId: this.validateForm.value.formId,
280
+        planType: this.planTypes.find(v => v.value == this.validateForm.value.planType),
281
+        type: this.types.find(v => v.value == this.validateForm.value.type),
282
+        signType: this.signTypes.find(v => v.value == this.validateForm.value.signType),
283
+        execDay: this.validateForm.value.execDay,
284
+        execTime: format(startOfMinute(this.validateForm.value.execTime), 'yyyy-MM-dd HH:mm:ss'),
285
+      };
286
+      if (this.validateForm.value.planType == "day") {
287
+        delete postData.planDay;
288
+      } else if (this.validateForm.value.planType == "week") {
289
+        postData.planDay = this.validateForm.value.doWeek;
290
+      } else if (this.validateForm.value.planType == "month") {
291
+        postData.planDay = this.validateForm.value.doMonth;
292
+      } else if (this.validateForm.value.planType == "year") {
293
+        delete postData.planDay;
294
+        postData.execTime =  format(this.validateForm.value.doYear, "yyyy-MM-dd") + " " + format(startOfMinute(this.validateForm.value.execTime), "HH:mm:ss");
295
+      } else if (this.validateForm.value.planType == "none") {
296
+        delete postData.planDay;
297
+        postData.execTime = format(this.validateForm.value.doNone, "yyyy-MM-dd") + " " + format(startOfMinute(this.validateForm.value.execTime), "HH:mm:ss");
298
+      }
299
+    } else {
300
+      //编辑
301
+      postData = {
302
+        id: this.coopId,
303
+        name: this.validateForm.value.name,
304
+        content: this.validateForm.value.content,
305
+        hosId: this.hosId,
306
+        formId: this.validateForm.value.formId,
307
+        planType: this.planTypes.find(v => v.value == this.validateForm.value.planType),
308
+        type: this.types.find(v => v.value == this.validateForm.value.type),
309
+        signType: this.signTypes.find(v => v.value == this.validateForm.value.signType),
310
+        execDay: this.validateForm.value.execDay,
311
+        execTime: format(startOfMinute(this.validateForm.value.execTime), 'yyyy-MM-dd HH:mm:ss'),
312
+      };
313
+      if (this.validateForm.value.planType == "day") {
314
+        delete postData.planDay;
315
+      } else if (this.validateForm.value.planType == "week") {
316
+        postData.planDay = this.validateForm.value.doWeek;
317
+      } else if (this.validateForm.value.planType == "month") {
318
+        postData.planDay = this.validateForm.value.doMonth;
319
+      } else if (this.validateForm.value.planType == "year") {
320
+        delete postData.planDay;
321
+        postData.execTime = format(this.validateForm.value.doYear, "yyyy-MM-dd") + " " + format(startOfMinute(this.validateForm.value.execTime), "HH:mm:ss");
322
+      } else if (this.validateForm.value.planType == "none") {
323
+        delete postData.planDay;
324
+        postData.execTime = format(this.validateForm.value.doNone, "yyyy-MM-dd") + " " + format(startOfMinute(this.validateForm.value.execTime), "HH:mm:ss");
325
+      }
326
+    }
327
+    console.log(postData);
328
+    this.mainService
329
+      .simplePost("addData", 'inspection', postData)
330
+      .subscribe((data) => {
331
+        this.btnLoading = false;
332
+        this.hideAddModal();
333
+        this.initForm();
334
+        if (data.status == 200) {
335
+          this.listLength++;
336
+          this.showPromptModal(this.add ? "新增" : "修改", true, "");
337
+        } else {
338
+          this.showPromptModal(this.add ? "新增" : "修改", false, data.msg);
339
+        }
340
+      });
341
+  }
342
+
343
+  // 编辑
344
+  executionTimeTemporaryStorage; //暂存执行时间
345
+  maskFlag: any = false;
346
+  edit(data) {
347
+    this.initForm();
348
+    this.add = false;
349
+    this.modal = true;
350
+    this.coopId = data.id;
351
+    this.validateForm.controls.name.setValue(data.name);
352
+    this.validateForm.controls.content.setValue(data.content);
353
+    this.validateForm.controls.planType.setValue(data.planType ? data.planType.value : null);
354
+    this.validateForm.controls.type.setValue(data.type ? data.type.value : null);
355
+    this.validateForm.controls.signType.setValue(data.signType ? data.signType.value : null);
356
+    this.validateForm.controls.execDay.setValue(data.execDay);
357
+
358
+    if(data.formId){
359
+      let obj = this.formIds.find(v => v.id == data.formId);
360
+      if(!obj){
361
+        this.formIds.unshift(obj);
362
+      }
363
+      this.validateForm.controls.formId.setValue(data.formId);
364
+
365
+    }
366
+
367
+    //执行时间 start
368
+    this.planTypeChange(data.planType.value);
369
+    if (data.planType.value == "year") {
370
+      this.validateForm.controls.doYear.setValue(
371
+        format(data.execTime, "yyyy-MM-dd HH:mm:ss")
372
+      );
373
+      this.validateForm.controls.execTime.setValue(
374
+        format(data.execTime, "yyyy-MM-dd HH:mm:ss")
375
+      );
376
+    } else if (data.planType.value == "month") {
377
+      this.validateForm.controls.doMonth.setValue(data.planDay);
378
+      this.validateForm.controls.execTime.setValue(
379
+        format(data.execTime, "yyyy-MM-dd HH:mm:ss")
380
+      );
381
+    } else if (data.planType.value == "week") {
382
+      this.validateForm.controls.doWeek.setValue(data.planDay);
383
+      this.validateForm.controls.execTime.setValue(
384
+        format(data.execTime, "yyyy-MM-dd HH:mm:ss")
385
+      );
386
+    } else if (data.planType.value == "day") {
387
+      this.validateForm.controls.execTime.setValue(
388
+        format(data.execTime, "yyyy-MM-dd HH:mm:ss")
389
+      );
390
+    } else if (data.planType.value == "none") {
391
+      this.validateForm.controls.doNone.setValue(
392
+        format(data.execTime, "yyyy-MM-dd HH:mm:ss")
393
+      );
394
+      this.validateForm.controls.execTime.setValue(
395
+        format(data.execTime, "yyyy-MM-dd HH:mm:ss")
396
+      );
397
+    }
398
+    //执行时间 end
399
+  }
400
+  // 立即执行
401
+  coopItem: any = {};
402
+  execModal: boolean = false;
403
+  // 打开立即执行模态框
404
+  openExecModal(item) {
405
+    this.coopItem = item;
406
+    this.execModal = true;
407
+  }
408
+  // 确认立即执行
409
+  confirmExec() {
410
+    this.btnLoading = true;
411
+    this.mainService
412
+      .executeNowOrderPlan(this.coopItem.id)
413
+      .subscribe((result: any) => {
414
+        this.closeExecModal();
415
+        this.btnLoading = false;
416
+        if (result.status == 200) {
417
+          this.showPromptModal("立即执行", true, "");
418
+        } else {
419
+          this.showPromptModal("立即执行", false, result.msg);
420
+        }
421
+      });
422
+  }
423
+  // 关闭立即执行模态框
424
+  closeExecModal() {
425
+    this.execModal = false;
426
+  }
427
+  // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
428
+  showPromptModal(con, success, promptInfo?) {
429
+    this.promptModalShow = false;
430
+    this.promptContent = con;
431
+    this.ifSuccess = success;
432
+    this.promptInfo = promptInfo;
433
+    setTimeout(() => {
434
+      this.promptModalShow = true;
435
+    }, 100);
436
+    this.getList(0);
437
+  }
438
+
439
+  // 删除轮巡计划
440
+  delModal: boolean = false; //删除模态框
441
+  tipsMsg1: string; //提示框信息
442
+  tipsMsg2: string; //操作后信息
443
+  confirmDelType: string; //确认的类型(启用/停用,删除)
444
+  confirmDelIsSwitch: boolean; //启用/停用
445
+  showDelModal(
446
+    id: number,
447
+    tipsMsg1: string,
448
+    tipsMsg2: string,
449
+    type: string,
450
+    isSwitch?: boolean
451
+  ) {
452
+    this.confirmDelIsSwitch = isSwitch;
453
+    this.confirmDelType = type;
454
+    this.delModal = true;
455
+    this.coopId = id;
456
+    this.tipsMsg1 = tipsMsg1;
457
+    this.tipsMsg2 = tipsMsg2;
458
+  }
459
+  // 隐藏删除框
460
+  hideDelModal() {
461
+    this.delModal = false;
462
+  }
463
+  // 确认删除
464
+  confirmDel() {
465
+    this.btnLoading = true;
466
+    if (this.confirmDelType === "del") {
467
+      //删除
468
+      this.mainService.simplePost("rmvData", "inspection", [this.coopId]).subscribe((data) => {
469
+        this.btnLoading = false;
470
+        this.delModal = false;
471
+        if (data.status == 200) {
472
+          if (
473
+            this.listOfData.length == 1 &&
474
+            this.pageIndex == Math.ceil(this.listLength / this.pageSize)
475
+          ) {
476
+            this.listLength--;
477
+            if (this.listLength === 0) {
478
+              this.pageIndex = 1;
479
+            } else {
480
+              this.pageIndex = Math.ceil(this.listLength / this.pageSize);
481
+            }
482
+          }
483
+          this.showPromptModal(this.tipsMsg2, true, "");
484
+        } else {
485
+          this.showPromptModal(this.tipsMsg2, false, data.msg);
486
+        }
487
+      });
488
+    } else if (this.confirmDelType === "switch") {
489
+      //启用/停用
490
+      this.mainService
491
+        .switchRoundRobin(
492
+          this.confirmDelIsSwitch ? "stop" : "active",
493
+          this.coopId
494
+        )
495
+        .subscribe((data) => {
496
+          this.btnLoading = false;
497
+          this.delModal = false;
498
+          if (data.status == 200) {
499
+            this.showPromptModal(this.tipsMsg2, true, "");
500
+          } else {
501
+            this.showPromptModal(this.tipsMsg2, false, data.msg);
502
+          }
503
+        });
504
+    }
505
+  }
506
+
507
+  // 查看
508
+  // detail(id) {
509
+  //   this.router.navigateByUrl("/main/roundRobin/roundRobinDetail/" + id);
510
+  // }
511
+  // -----------------------------------------------------------------------
512
+  //配置
513
+  planConfig(data) {
514
+    this.router.navigateByUrl("inspectionPlanConfig/" + data.id);
515
+  }
516
+
517
+  formatterExecDay = (value: number) => value ? `${value} 天` : '';
518
+  parserExecDay = (value: string) => value.replace(' 天', '');
519
+}

+ 19 - 0
src/app/views/inspection-plan/inspection-plan.module.ts

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

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

@@ -518,6 +518,11 @@ const routes: Routes = [
518 518
         path: "inspectionAddress",
519 519
         loadChildren: () => import("../inspection-address/inspection-address.module").then((m) => m.InspectionAddressModule),
520 520
       },
521
+      // 巡检计划
522
+      {
523
+        path: "inspectionPlan",
524
+        loadChildren: () => import("../inspection-plan/inspection-plan.module").then((m) => m.InspectionPlanModule),
525
+      },
521 526
     ],
522 527
   },
523 528
 ];

+ 26 - 3
src/assets/iconfont/demo_index.html

@@ -55,6 +55,12 @@
55 55
           <ul class="icon_lists dib-box">
56 56
           
57 57
             <li class="dib">
58
+              <span class="icon icon_transport">&#xe885;</span>
59
+                <div class="name">24gf-tags</div>
60
+                <div class="code-name">&amp;#xe885;</div>
61
+              </li>
62
+          
63
+            <li class="dib">
58 64
               <span class="icon icon_transport">&#xe644;</span>
59 65
                 <div class="name">修改</div>
60 66
                 <div class="code-name">&amp;#xe644;</div>
@@ -744,9 +750,9 @@
744 750
 <pre><code class="language-css"
745 751
 >@font-face {
746 752
   font-family: 'icon_transport';
747
-  src: url('iconfont.woff2?t=1718952478641') format('woff2'),
748
-       url('iconfont.woff?t=1718952478641') format('woff'),
749
-       url('iconfont.ttf?t=1718952478641') format('truetype');
753
+  src: url('iconfont.woff2?t=1719826829751') format('woff2'),
754
+       url('iconfont.woff?t=1719826829751') format('woff'),
755
+       url('iconfont.ttf?t=1719826829751') format('truetype');
750 756
 }
751 757
 </code></pre>
752 758
           <h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
@@ -773,6 +779,15 @@
773 779
         <ul class="icon_lists dib-box">
774 780
           
775 781
           <li class="dib">
782
+            <span class="icon icon_transport transport-24gf-tags"></span>
783
+            <div class="name">
784
+              24gf-tags
785
+            </div>
786
+            <div class="code-name">.transport-24gf-tags
787
+            </div>
788
+          </li>
789
+          
790
+          <li class="dib">
776 791
             <span class="icon icon_transport transport-weibiaoti2010104"></span>
777 792
             <div class="name">
778 793
               修改
@@ -1809,6 +1824,14 @@
1809 1824
           
1810 1825
             <li class="dib">
1811 1826
                 <svg class="icon svg-icon" aria-hidden="true">
1827
+                  <use xlink:href="#transport-24gf-tags"></use>
1828
+                </svg>
1829
+                <div class="name">24gf-tags</div>
1830
+                <div class="code-name">#transport-24gf-tags</div>
1831
+            </li>
1832
+          
1833
+            <li class="dib">
1834
+                <svg class="icon svg-icon" aria-hidden="true">
1812 1835
                   <use xlink:href="#transport-weibiaoti2010104"></use>
1813 1836
                 </svg>
1814 1837
                 <div class="name">修改</div>

+ 7 - 3
src/assets/iconfont/iconfont.css

@@ -1,8 +1,8 @@
1 1
 @font-face {
2 2
   font-family: "icon_transport"; /* Project id 4543613 */
3
-  src: url('iconfont.woff2?t=1718952478641') format('woff2'),
4
-       url('iconfont.woff?t=1718952478641') format('woff'),
5
-       url('iconfont.ttf?t=1718952478641') format('truetype');
3
+  src: url('iconfont.woff2?t=1719826829751') format('woff2'),
4
+       url('iconfont.woff?t=1719826829751') format('woff'),
5
+       url('iconfont.ttf?t=1719826829751') format('truetype');
6 6
 }
7 7
 
8 8
 .icon_transport {
@@ -13,6 +13,10 @@
13 13
   -moz-osx-font-smoothing: grayscale;
14 14
 }
15 15
 
16
+.transport-24gf-tags:before {
17
+  content: "\e885";
18
+}
19
+
16 20
 .transport-weibiaoti2010104:before {
17 21
   content: "\e644";
18 22
 }

Разница между файлами не показана из-за своего большого размера
+ 1 - 1
src/assets/iconfont/iconfont.js


+ 7 - 0
src/assets/iconfont/iconfont.json

@@ -6,6 +6,13 @@
6 6
   "description": "",
7 7
   "glyphs": [
8 8
     {
9
+      "icon_id": "7542757",
10
+      "name": "24gf-tags",
11
+      "font_class": "24gf-tags",
12
+      "unicode": "e885",
13
+      "unicode_decimal": 59525
14
+    },
15
+    {
9 16
       "icon_id": "1069107",
10 17
       "name": "修改",
11 18
       "font_class": "weibiaoti2010104",

BIN
src/assets/iconfont/iconfont.ttf


BIN
src/assets/iconfont/iconfont.woff


BIN
src/assets/iconfont/iconfont.woff2