Sfoglia il codice sorgente

Merge branch 'develop'

seimin 11 mesi fa
parent
commit
bb1fe0cf73
23 ha cambiato i file con 2799 aggiunte e 0 eliminazioni
  1. 20 0
      src/app/views/main/main-routing.module.ts
  2. 5 0
      src/app/views/main/main.component.html
  3. 13 0
      src/app/views/quilt-washing-department-statistics/quilt-washing-department-statistics-routing.module.ts
  4. 111 0
      src/app/views/quilt-washing-department-statistics/quilt-washing-department-statistics.component.html
  5. 95 0
      src/app/views/quilt-washing-department-statistics/quilt-washing-department-statistics.component.less
  6. 603 0
      src/app/views/quilt-washing-department-statistics/quilt-washing-department-statistics.component.ts
  7. 16 0
      src/app/views/quilt-washing-department-statistics/quilt-washing-department-statistics.module.ts
  8. 13 0
      src/app/views/quilt-washing-hospital-statistics/quilt-washing-hospital-statistics-routing.module.ts
  9. 85 0
      src/app/views/quilt-washing-hospital-statistics/quilt-washing-hospital-statistics.component.html
  10. 95 0
      src/app/views/quilt-washing-hospital-statistics/quilt-washing-hospital-statistics.component.less
  11. 459 0
      src/app/views/quilt-washing-hospital-statistics/quilt-washing-hospital-statistics.component.ts
  12. 16 0
      src/app/views/quilt-washing-hospital-statistics/quilt-washing-hospital-statistics.module.ts
  13. 13 0
      src/app/views/quilt-washing-personnel-statistics/quilt-washing-personnel-statistics-routing.module.ts
  14. 109 0
      src/app/views/quilt-washing-personnel-statistics/quilt-washing-personnel-statistics.component.html
  15. 95 0
      src/app/views/quilt-washing-personnel-statistics/quilt-washing-personnel-statistics.component.less
  16. 527 0
      src/app/views/quilt-washing-personnel-statistics/quilt-washing-personnel-statistics.component.ts
  17. 16 0
      src/app/views/quilt-washing-personnel-statistics/quilt-washing-personnel-statistics.module.ts
  18. 13 0
      src/app/views/quilt-washing-trend-analysis/quilt-washing-trend-analysis-routing.module.ts
  19. 6 0
      src/app/views/quilt-washing-trend-analysis/quilt-washing-trend-analysis.component.html
  20. 12 0
      src/app/views/quilt-washing-trend-analysis/quilt-washing-trend-analysis.component.less
  21. 459 0
      src/app/views/quilt-washing-trend-analysis/quilt-washing-trend-analysis.component.ts
  22. 16 0
      src/app/views/quilt-washing-trend-analysis/quilt-washing-trend-analysis.module.ts
  23. 2 0
      src/common.less

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

@@ -463,6 +463,26 @@ const routes: Routes = [
463 463
         path: "performanceAllocation",
464 464
         loadChildren: () => import("../performance-allocation/performance-allocation.module").then((m) => m.PerformanceAllocationModule),
465 465
       },
466
+      // 绩效基础配置-人员统计
467
+      {
468
+        path: "quiltWashingPersonnelStatistics",
469
+        loadChildren: () => import("../quilt-washing-personnel-statistics/quilt-washing-personnel-statistics.module").then((m) => m.QuiltWashingPersonnelStatisticsModule),
470
+      },
471
+      // 绩效基础配置-科室统计
472
+      {
473
+        path: "quiltWashingDepartmentStatistics",
474
+        loadChildren: () => import("../quilt-washing-department-statistics/quilt-washing-department-statistics.module").then((m) => m.QuiltWashingDepartmentStatisticsModule),
475
+      },
476
+      // 绩效基础配置-全员统计
477
+      {
478
+        path: "quiltWashingHospitalStatistics",
479
+        loadChildren: () => import("../quilt-washing-hospital-statistics/quilt-washing-hospital-statistics.module").then((m) => m.QuiltWashingHospitalStatisticsModule),
480
+      },
481
+      // 绩效基础配置-趋势分析
482
+      {
483
+        path: "quiltWashingTrendAnalysis",
484
+        loadChildren: () => import("../quilt-washing-trend-analysis/quilt-washing-trend-analysis.module").then((m) => m.QuiltWashingTrendAnalysisModule),
485
+      },
466 486
     ],
467 487
   },
468 488
 ];

File diff suppressed because it is too large
+ 5 - 0
src/app/views/main/main.component.html


+ 13 - 0
src/app/views/quilt-washing-department-statistics/quilt-washing-department-statistics-routing.module.ts

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

+ 111 - 0
src/app/views/quilt-washing-department-statistics/quilt-washing-department-statistics.component.html

@@ -0,0 +1,111 @@
1
+<div class="list-template">
2
+  <div class="list-template__content">
3
+    <div class="list-template__top" nz-row>
4
+      <div nz-col nzXl='18' class="list-template__searchBox">
5
+        <div class="list-template__searchItem">
6
+          <nz-radio-group [(ngModel)]="dateType" (ngModelChange)="changeDateType($event)">
7
+            <label *ngFor="let data of dateTypes" nz-radio-button [nzValue]="data.value">{{data.label}}</label>
8
+          </nz-radio-group>
9
+        </div>
10
+        <div class="list-template__searchItem">
11
+          <span class="label">发起时间</span>:
12
+          <nz-range-picker *ngIf="dateType=='day'" [(ngModel)]="dateRange" [nzAllowClear]='false'
13
+            [nzDisabledDate]="disabledDate" (ngModelChange)="changeDate($event)">
14
+          </nz-range-picker>
15
+          <nz-month-picker *ngIf="dateType=='month'" [(ngModel)]="monthRangeStart" [nzDisabledDate]="disabledMonthStart"
16
+            (ngModelChange)="changeMonthStart($event)" nzPlaceHolder="请选择开始月份">
17
+          </nz-month-picker>
18
+          <span *ngIf="dateType=='month'"> ~ </span>
19
+          <nz-month-picker *ngIf="dateType=='month'" [(ngModel)]="monthRangeEnd" [nzDisabledDate]="disabledMonthEnd"
20
+            (ngModelChange)="changeMonthEnd($event)" nzPlaceHolder="请选择截止月份">
21
+          </nz-month-picker>
22
+          <nz-year-picker *ngIf="dateType=='year'" [(ngModel)]="yearRangeStart" [nzDisabledDate]="disabledYearStart"
23
+            (ngModelChange)="changeYearStart($event)" nzPlaceHolder="请选择开始年份">
24
+          </nz-year-picker>
25
+          <span *ngIf="dateType=='year'"> ~ </span>
26
+          <nz-year-picker *ngIf="dateType=='year'" [(ngModel)]="yearRangeEnd" (ngModelChange)="changeYearEnd($event)"
27
+            [nzDisabledDate]="disabledYearEnd" nzPlaceHolder="请选择截止年份">
28
+          </nz-year-picker>
29
+        </div>
30
+        <div class="list-template__searchItem ml8">
31
+          <nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" [nzShowSearch]="false" nzPlaceHolder="请选择时间"
32
+            [(ngModel)]="defRange" (ngModelChange)="changeDateRange($event)">
33
+            <nz-option nzLabel="{{data.label}}" nzValue="{{data.id}}" *ngFor="let data of defRanges"></nz-option>
34
+          </nz-select>
35
+        </div>
36
+        <div class="list-template__searchItem">
37
+          <span class="label">科室名称</span>:
38
+          <nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch
39
+            (nzOnSearch)="changeInp($event, 'getDeptList')" nzAllowClear nzPlaceHolder="请选择科室名称" [(ngModel)]="searchDto.dept">
40
+            <ng-container *ngFor="let option of deptList">
41
+              <nz-option *ngIf="!isLoading" [nzLabel]="option.dept" [nzValue]="option.id"></nz-option>
42
+            </ng-container>
43
+            <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
44
+              <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
45
+            </nz-option>
46
+          </nz-select>
47
+        </div>
48
+        <div class="list-template__searchItem">
49
+          <span class="label">楼栋名称</span>:
50
+          <nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch
51
+            (nzOnSearch)="changeInp($event, 'getBuildingList')" nzAllowClear nzPlaceHolder="请选择楼栋名称" [(ngModel)]="searchDto.building">
52
+            <ng-container *ngFor="let option of buildingList">
53
+              <nz-option *ngIf="!isLoading" [nzLabel]="option.buildingName" [nzValue]="option.id"></nz-option>
54
+            </ng-container>
55
+            <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
56
+              <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
57
+            </nz-option>
58
+          </nz-select>
59
+        </div>
60
+      </div>
61
+      <div nz-col nzXl='6' class="list-template__btns">
62
+        <button nz-button class="btn default" (click)='search(1)'>搜索</button>
63
+        <button nz-button class="btn default ml8" (click)='export()' [nzLoading]="loading2">导出</button>
64
+        <button nz-button class="btn default ml8" (click)='reset()'>重置</button>
65
+        <button nz-button class="btn default ml8" (click)='exportDetail()' [nzLoading]="loading3" [disabled]="!checkedDepIds.length">批量导出详细科室报表</button>
66
+      </div>
67
+    </div>
68
+    <div class="list-template__bottom">
69
+      <nz-table class="list-template__nzTable" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false"
70
+        [nzLoading]="loading1">
71
+        <thead (nzSortChange)="sort($event)" nzSingleSort>
72
+          <tr class="thead">
73
+            <th nzWidth="5%" nzShowCheckbox [(nzChecked)]="isAllDisplayDataChecked"
74
+              (nzCheckedChange)="checkAll($event)"></th>
75
+            <th nzWidth="5%">序号</th>
76
+            <th nzWidth="5%">科室名称</th>
77
+            <th nzShowSort nzWidth="17%" nzSortKey="clothesTypeNum" [(nzSort)]="sortCurrent.clothesTypeNum">回收种类数</th>
78
+            <th nzShowSort nzWidth="17%" nzSortKey="getOrder" [(nzSort)]="sortCurrent.getOrder">回收单数</th>
79
+            <th nzShowSort nzWidth="17%" nzSortKey="sendOrder" [(nzSort)]="sortCurrent.sendOrder">送回单数</th>
80
+            <th nzShowSort nzWidth="17%" nzSortKey="sendClothesNum" [(nzSort)]="sortCurrent.sendClothesNum">洗涤被服数量</th>
81
+            <th nzShowSort nzWidth="17%" nzSortKey="price" [(nzSort)]="sortCurrent.price">费用(元)</th>
82
+          </tr>
83
+        </thead>
84
+        <tbody>
85
+          <tr *ngFor="let data of listOfData;let index=index;" (click)="selectedListData(data)">
86
+            <td nzShowCheckbox [(nzChecked)]="mapOfCheckedId[data.id]" (nzCheckedChange)="refreshStatus()"></td>
87
+            <td>{{index+(pageIndex-1) * pageSize + 1}}</td>
88
+            <td>{{ data.dept || '' }}</td>
89
+            <td>{{ data.clothesTypeNum }}</td>
90
+            <td>{{ data.getOrder }}</td>
91
+            <td>{{ data.sendOrder }}</td>
92
+            <td>{{ data.sendClothesNum }}</td>
93
+            <td>{{ data.price }}</td>
94
+          </tr>
95
+        </tbody>
96
+      </nz-table>
97
+      <div class="list-template__pagination">
98
+        <nz-pagination [(nzPageIndex)]="pageIndex" [nzPageSizeOptions]="[10,100]" [(nzTotal)]="listLength" nzShowSizeChanger [(nzPageSize)]="pageSize"
99
+          (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)"
100
+          (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)">
101
+        </nz-pagination>
102
+      </div>
103
+    </div>
104
+  </div>
105
+</div>
106
+<!-- 操作成功/失败提示框 -->
107
+<app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
108
+  [info]="promptInfo"></app-prompt-modal>
109
+
110
+<!-- 查看详情 -->
111
+<router-outlet></router-outlet>

+ 95 - 0
src/app/views/quilt-washing-department-statistics/quilt-washing-department-statistics.component.less

@@ -0,0 +1,95 @@
1
+@import "../../../../src/theme.less";
2
+
3
+:host ::ng-deep .on {
4
+  color: #fff !important;
5
+}
6
+
7
+.save {
8
+  position: fixed;
9
+  left: 0;
10
+  top: 0;
11
+  width: 100%;
12
+  height: 100%;
13
+  background: rgba(0, 0, 0, 0.4);
14
+  z-index: 99;
15
+
16
+  .modalBody {
17
+    width: 1000px;
18
+    background: #fff;
19
+    border-radius: 5px;
20
+    padding: 10px 20px;
21
+    color: #333;
22
+
23
+    .title {
24
+      width: 100%;
25
+      text-align: center;
26
+      font-size: 18px;
27
+      position: relative;
28
+
29
+      i {
30
+        position: absolute;
31
+        right: 0;
32
+        top: 0;
33
+        font-size: 20px;
34
+        color: #666;
35
+        cursor: pointer;
36
+        padding: 0 5px;
37
+      }
38
+    }
39
+
40
+    .content {
41
+      width: 100%;
42
+      border: 1px solid #e5e9ed;
43
+      border-radius: 5px;
44
+      overflow: hidden;
45
+      margin-top: 12px;
46
+
47
+      .conItem {
48
+        color: #333;
49
+
50
+        .jiTit {
51
+          height: 50px;
52
+          line-height: 50px;
53
+          border-bottom: 1px solid #e5e9ed;
54
+          padding: 0 32px;
55
+        }
56
+
57
+        .defeat {
58
+          font-size: 14px;
59
+          color: #333;
60
+          padding: 15px 32px;
61
+          min-height: 125px;
62
+        }
63
+
64
+        &.noCon {
65
+          background: #f9fafb;
66
+          padding: 16px 32px 24px 32px;
67
+          border-top: 1px solid #e5e9ed;
68
+
69
+          .title {
70
+            text-align: left;
71
+            font-size: 14px;
72
+            margin-bottom: 8px;
73
+          }
74
+
75
+          textarea {
76
+            min-height: 210px;
77
+          }
78
+        }
79
+      }
80
+    }
81
+
82
+    button {
83
+      margin-top: 10px;
84
+      margin-left: 10px;
85
+    }
86
+  }
87
+
88
+  .txtL {
89
+    text-align: left !important;
90
+  }
91
+
92
+  .txtR {
93
+    text-align: right !important;
94
+  }
95
+}

+ 603 - 0
src/app/views/quilt-washing-department-statistics/quilt-washing-department-statistics.component.ts

@@ -0,0 +1,603 @@
1
+import { Component, OnInit } from "@angular/core";
2
+import { ActivatedRoute, Router } from "@angular/router";
3
+import { differenceInCalendarDays, endOfMonth, endOfYear, format, startOfMonth, startOfYear } from "date-fns";
4
+
5
+import { MainService } from "../../services/main.service";
6
+import { DateService } from "../../services/date.service";
7
+import { MyServiceService } from "../../services/my-service.service";
8
+import { ToolService } from "../../services/tool.service";
9
+import { Subject } from 'rxjs';
10
+import { debounceTime } from 'rxjs/operators';
11
+
12
+@Component({
13
+  selector: "app-quilt-washing-department-statistics",
14
+  templateUrl: "./quilt-washing-department-statistics.component.html",
15
+  styleUrls: ["./quilt-washing-department-statistics.component.less"],
16
+})
17
+export class QuiltWashingDepartmentStatisticsComponent implements OnInit {
18
+  constructor(
19
+    private route: ActivatedRoute,
20
+    private router: Router,
21
+    private mainService: MainService,
22
+    private dateService: DateService,
23
+    private myService: MyServiceService,
24
+    private tool: ToolService
25
+  ) {}
26
+
27
+  searchTimerSubject = new Subject();
28
+
29
+  searchDto: any = {
30
+    dept: null,
31
+    building: null,
32
+  }
33
+
34
+  ngOnInit() {
35
+    this.searchTimerSubject.pipe(debounceTime(500)).subscribe((v) => {
36
+      let fun = v[0];
37
+      fun.call(this, v[1]);
38
+    });
39
+    this.coopBtns = this.tool.initCoopBtns(this.route);
40
+    this.getAllHos();
41
+    this.changeDateRange(this.defRange);
42
+    // this.search();
43
+  }
44
+
45
+  dateType: string = "day"; //选中时间维度
46
+  dateTypes: any = [
47
+    {
48
+      label: "按天统计",
49
+      value: "day",
50
+    },
51
+    {
52
+      label: "按月统计",
53
+      value: "month",
54
+    },
55
+    {
56
+      label: "按年统计",
57
+      value: "year",
58
+    },
59
+  ]; //时间维度
60
+  defRange = "1"; //默认上周
61
+  defRanges = [
62
+    {
63
+      label: "上周",
64
+      id: 1,
65
+    },
66
+    {
67
+      label: "上月",
68
+      id: 2,
69
+    },
70
+    {
71
+      label: "上年",
72
+      id: 3,
73
+    },
74
+  ]; //时间默认区间
75
+
76
+  listOfData: any[] = []; //表格数据
77
+  pageIndex: number = 1; //表格当前页码
78
+  pageSize: number = 10; //表格每页展示条数
79
+  listLength: number = 10; //表格总数据量
80
+
81
+  alldepart: any = []; //当前院区所属科室
82
+  dateRange: any = []; //发起时间区间 天
83
+  monthRangeStart: any; //发起时间 月 起
84
+  monthRangeEnd: any; //发起时间 月 止
85
+  yearRangeStart: any; //发起时间 年 起
86
+  yearRangeEnd: any; //发起时间 年 止
87
+
88
+  promptContent: string; //操作提示框提示信息
89
+  ifSuccess: boolean; //操作成功/失败
90
+  promptInfo: string; //操作结果提示信息
91
+  promptModalShow: boolean; //操作提示框是否展示
92
+
93
+  // 初始化增删改按钮
94
+  coopBtns: any = {};
95
+  searchData: any = {}; // 综合统计页面带过来的参数
96
+  getSearchData() {
97
+    let that = this;
98
+    let sub = that.myService.getMsg().subscribe((msg) => {
99
+      // 从综合报表跳转过来
100
+      that.searchData = msg;
101
+      console.log(that.searchData);
102
+      console.log(66);
103
+      sub.unsubscribe(); //取消订阅,否则订阅函数会累加执行
104
+      that.hospital = that.searchData["hosId"];
105
+      that.changeDate(that.searchData["range"]);
106
+      that.defRange = that.searchData["defRange"];
107
+      that.search();
108
+    });
109
+    that.changeDateRange(that.defRange);
110
+    that.search();
111
+  }
112
+  // 搜索
113
+  search(num?: number) {
114
+    if (this.hospital) {
115
+      this.searchData["hosId"] = this.hospital;
116
+    }
117
+    if (this.startDate) {
118
+      this.searchData["dateRange"] = {
119
+        start: this.startDate + " " + "00:00:00",
120
+        end: this.endDate + " " + "23:59:59",
121
+      };
122
+    }
123
+    if (num !== undefined) {
124
+      this.getList(num, this.sortCurrentKey, this.sortCurrentValue);
125
+    } else {
126
+      this.getList(this.pageIndex, this.sortCurrentKey, this.sortCurrentValue);
127
+    }
128
+  }
129
+  // 导出
130
+  loading2 = false;
131
+  export() {
132
+    this.mapOfCheckedId = {};
133
+    this.checkedDepIds = [];
134
+    this.isAllDisplayDataChecked = false;
135
+    let that = this;
136
+    let postData: any = {
137
+      startTime: this.startDate + " " + "00:00:00",
138
+      endTime: this.endDate + " " + "23:59:59",
139
+      hosId: that.hospital,
140
+      type: this.dateType,
141
+      deptId: this.searchDto.dept || undefined,
142
+      buildingId: this.searchDto.building || undefined,
143
+    };
144
+    if (this.sortCurrentKey && this.sortCurrentValue) {
145
+      postData.sort =
146
+        this.sortCurrentValue === "ascend"
147
+          ? this.sortCurrentKey
148
+          : `${this.sortCurrentKey} desc`;
149
+    }
150
+    this.loading2 = true;
151
+    that.mainService.exportReport("clothesDept", postData).subscribe(
152
+      (data) => {
153
+        this.loading2 = false;
154
+        this.showPromptModal("导出", true, "");
155
+        var file = new Blob([data], {
156
+          type: "application/vnd.ms-excel",
157
+        });
158
+        //trick to download store a file having its URL
159
+        var fileURL = URL.createObjectURL(file);
160
+        var a = document.createElement("a");
161
+        a.href = fileURL;
162
+        a.target = "_blank";
163
+        a.download = "科室统计.xls";
164
+        document.body.appendChild(a);
165
+        a.click();
166
+      },
167
+      (err) => {
168
+        this.loading2 = false;
169
+        this.showPromptModal("导出", false, "");
170
+      }
171
+    );
172
+  }
173
+  // 批量导出详细科室报表
174
+  loading3 = false;
175
+  exportDetail() {
176
+    let ids = this.checkedDepIds.join(",");
177
+    this.mapOfCheckedId = {};
178
+    this.checkedDepIds = [];
179
+    this.isAllDisplayDataChecked = false;
180
+    let that = this;
181
+    let postData: any = {
182
+      startTime: this.startDate + " " + "00:00:00",
183
+      endTime: this.endDate + " " + "23:59:59",
184
+      hosId: that.hospital,
185
+      type: this.dateType,
186
+      deptId: ids || undefined,
187
+      buildingId: this.searchDto.building || undefined,
188
+    };
189
+    if (this.sortCurrentKey && this.sortCurrentValue) {
190
+      postData.sort =
191
+        this.sortCurrentValue === "ascend"
192
+          ? this.sortCurrentKey
193
+          : `${this.sortCurrentKey} desc`;
194
+    }
195
+    this.loading3 = true;
196
+    that.mainService.exportReport("clothesDeptDetails", postData).subscribe(
197
+      (data) => {
198
+        this.loading3 = false;
199
+        this.showPromptModal("导出", true, "");
200
+        var file = new Blob([data], {
201
+          type: "application/vnd.ms-excel",
202
+        });
203
+        //trick to download store a file having its URL
204
+        var fileURL = URL.createObjectURL(file);
205
+        var a = document.createElement("a");
206
+        a.href = fileURL;
207
+        a.target = "_blank";
208
+        a.download = "详细科室报表.xls";
209
+        document.body.appendChild(a);
210
+        a.click();
211
+      },
212
+      (err) => {
213
+        this.loading3 = false;
214
+        this.showPromptModal("导出", false, "");
215
+      }
216
+    );
217
+  }
218
+  // 重置
219
+  reset() {
220
+    this.changeDateType("day");
221
+    this.changeDateRange("1");
222
+    this.sortCurrentKey = "";
223
+    this.sortCurrentValue = "";
224
+    this.sortCurrent = {
225
+      clothesTypeNum: null,
226
+      getOrder: null,
227
+      sendOrder: null,
228
+      sendClothesNum: null,
229
+      price: null,
230
+    };
231
+    this.searchDto = {
232
+      dept: null,
233
+      building: null,
234
+    }
235
+    this.search();
236
+  }
237
+  // 选中表格单列
238
+  mapOfCheckedId: { [key: string]: boolean } = {};
239
+  checkedDepIds = []; //已选中单列id
240
+  refreshStatus(): void {
241
+    this.isAllDisplayDataChecked = this.listOfData.every(
242
+      (item) => this.mapOfCheckedId[item.id]
243
+    );
244
+    let arr = [];
245
+    for (var k in this.mapOfCheckedId) {
246
+      if (this.mapOfCheckedId[k]) {
247
+        arr.push(Number(k));
248
+      }
249
+    }
250
+    this.checkedDepIds = arr;
251
+  }
252
+  // 整行操作
253
+  selectedListData(data) {
254
+    this.mapOfCheckedId[data.id] = !this.mapOfCheckedId[data.id];
255
+    this.refreshStatus();
256
+  }
257
+  // 全选
258
+  isAllDisplayDataChecked = false; //当前页是否全选
259
+  checkAll(value: boolean): void {
260
+    this.listOfData.forEach((item) => {
261
+      this.mapOfCheckedId[item.id] = value;
262
+    });
263
+    this.refreshStatus();
264
+  }
265
+  // 表格数据
266
+  loading1 = false;
267
+  getList(num?: number, field?: string, sort?: string) {
268
+    this.mapOfCheckedId = {};
269
+    this.checkedDepIds = [];
270
+    this.isAllDisplayDataChecked = false;
271
+    this.pageIndex = num;
272
+    let postData: any = {
273
+      idx: this.pageIndex - 1,
274
+      sum: this.pageSize,
275
+      startTime: this.searchData.dateRange.start,
276
+      endTime: this.searchData.dateRange.end,
277
+      hosId: this.searchData.hosId,
278
+      type: this.dateType,
279
+      deptId: this.searchDto.dept || undefined,
280
+      buildingId: this.searchDto.building || undefined,
281
+    };
282
+    if (field && sort) {
283
+      postData.sort = sort === "ascend" ? field : `${field} desc`;
284
+    }
285
+    this.loading1 = true;
286
+    this.mainService
287
+      .postCustom("report/clothes", "dept", postData)
288
+      .subscribe((result) => {
289
+        this.loading1 = false;
290
+        this.listOfData = result.list || [];
291
+        this.listLength = result.totalNum;
292
+      });
293
+  }
294
+  // 获取院区
295
+  hospital: string; //选中院区
296
+  getAllHos() {
297
+    this.hospital = this.tool.getCurrentHospital().id + "";
298
+    this.getDeptList();
299
+    this.getBuildingList();
300
+  }
301
+
302
+  // 边输边搜节流阀
303
+  changeInp(e, fn) {
304
+    this.searchTimer(this[fn], e);
305
+  }
306
+  // 获取科室
307
+  deptList: any = [];
308
+  getDeptList(keyword = '') {
309
+    let postData = {
310
+      department: {
311
+        searchType: 1,// 简单查询
312
+        cascadeHosId: this.hospital,
313
+        dept: keyword,
314
+      },
315
+      idx: 0,
316
+      sum: 10,
317
+    };
318
+    this.isLoading = true;
319
+    this.mainService
320
+      .getFetchDataList("data", "department", postData)
321
+      .subscribe((result) => {
322
+        this.isLoading = false;
323
+        this.deptList = result.list;
324
+      });
325
+  }
326
+
327
+  // 获取楼栋
328
+  buildingList: any = [];
329
+  getBuildingList(keyword = '') {
330
+    let postData = {
331
+      building: {
332
+        cascadeHosId: this.hospital,
333
+        buildingName: keyword
334
+      },
335
+      idx: 0,
336
+      sum: 10,
337
+    };
338
+    this.isLoading = true;
339
+    this.mainService
340
+      .getFetchDataList("data", "building", postData)
341
+      .subscribe((result) => {
342
+        this.isLoading = false;
343
+        this.buildingList = result.list;
344
+      });
345
+  }
346
+
347
+  // 修改时间展示维度
348
+  changeDateType(res) {
349
+    console.log(res, this.dateType);
350
+    this.dateType = res;
351
+    this.searchData["type"] = res;
352
+    console.log(this.searchData);
353
+    switch (res) {
354
+      case "day":
355
+        this.defRanges = [
356
+          {
357
+            label: "上周",
358
+            id: 1,
359
+          },
360
+          {
361
+            label: "上月",
362
+            id: 2,
363
+          },
364
+          {
365
+            label: "上年",
366
+            id: 3,
367
+          },
368
+        ]; //时间默认区间
369
+        this.defRange = "1"; //默认上周
370
+        this.changeDateRange("1");
371
+        break;
372
+      case "month":
373
+        this.defRanges = [
374
+          {
375
+            label: "上月",
376
+            id: 2,
377
+          },
378
+          {
379
+            label: "上年",
380
+            id: 3,
381
+          },
382
+        ]; //时间默认区间
383
+        this.defRange = "2"; //上月
384
+        this.changeDateRange("2");
385
+        break;
386
+      case "year":
387
+        this.defRanges = [
388
+          {
389
+            label: "上年",
390
+            id: 3,
391
+          },
392
+        ]; //时间默认区间
393
+        this.defRange = "3"; //默认上周
394
+        this.changeDateRange("3");
395
+        break;
396
+    }
397
+  }
398
+
399
+  // 禁选日期
400
+  disabledDate = (current: Date): boolean => {
401
+    // Can not select days before today and today
402
+    return differenceInCalendarDays(current, this.today) > 0;
403
+  };
404
+
405
+  // 禁选月份开始
406
+  disabledMonthStart = (current: Date): boolean => {
407
+    // Can not select days before today and today
408
+    let cur = differenceInCalendarDays(current, endOfMonth(this.today)) > 0;
409
+    let staEnd = differenceInCalendarDays(current, this.monthRangeEnd) > 0;
410
+    return cur || staEnd;
411
+  };
412
+  // 禁选月份结束
413
+  disabledMonthEnd = (current: Date): boolean => {
414
+    // Can not select days before today and today
415
+    let cur = differenceInCalendarDays(current, endOfMonth(this.today)) > 0;
416
+    let staEnd = differenceInCalendarDays(this.monthRangeStart, current) > 0;
417
+    return cur || staEnd;
418
+  };
419
+
420
+  // 禁选年份开始
421
+  disabledYearStart = (current: Date): boolean => {
422
+    // Can not select days before today and today
423
+    let cur = differenceInCalendarDays(current, endOfYear(this.today)) > 0;
424
+    let staEnd = differenceInCalendarDays(current, this.yearRangeEnd) > 0;
425
+    return cur || staEnd;
426
+  };
427
+
428
+  // 禁选年份结束
429
+  disabledYearEnd = (current: Date): boolean => {
430
+    // Can not select days before today and today
431
+    let cur = differenceInCalendarDays(current, endOfYear(this.today)) > 0;
432
+    let staEnd = differenceInCalendarDays(this.yearRangeStart, current) > 0;
433
+    return cur || staEnd;
434
+  };
435
+
436
+  // 日期选择 日
437
+  startDate: string; //发起时间开始
438
+  endDate: string; //发起时间结束
439
+  changeDate(result?): void {
440
+    console.log(this.dateRange);
441
+    console.log(result);
442
+    this.dateRange = result;
443
+    if (!this.quick) {
444
+      // 不是快捷选择
445
+      this.defRange = null;
446
+    }
447
+    if (!result || !result.length) {
448
+      this.startDate = this.endDate = "";
449
+      return;
450
+    }
451
+    this.startDate =
452
+      result[0].getFullYear() +
453
+      "-" +
454
+      (result[0].getMonth() + 1) +
455
+      "-" +
456
+      result[0].getDate();
457
+    this.endDate =
458
+      result[1].getFullYear() +
459
+      "-" +
460
+      (result[1].getMonth() + 1) +
461
+      "-" +
462
+      result[1].getDate();
463
+  }
464
+
465
+  // 月份选择
466
+  changeMonthStart(result?) {
467
+    console.log(result);
468
+    this.monthRangeStart = result;
469
+    if (!this.quick) {
470
+      // 不是快捷选择
471
+      this.defRange = null;
472
+    }
473
+    if (!result) {
474
+      this.startDate = this.endDate = "";
475
+      return;
476
+    }
477
+    this.startDate = format(startOfMonth(result), 'yyyy-MM-dd');
478
+    // this.endDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
479
+  }
480
+  changeMonthEnd(result?) {
481
+    console.log(result);
482
+    this.monthRangeEnd = result;
483
+    if (!this.quick) {
484
+      // 不是快捷选择
485
+      this.defRange = null;
486
+    }
487
+    if (!result) {
488
+      this.startDate = this.endDate = "";
489
+      return;
490
+    }
491
+    // this.startDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
492
+    this.endDate = format(endOfMonth(result), 'yyyy-MM-dd');
493
+  }
494
+  // 年份选择
495
+  changeYearStart(result?) {
496
+    console.log(result);
497
+    this.yearRangeStart = result;
498
+    if (!this.quick) {
499
+      // 不是快捷选择
500
+      this.defRange = null;
501
+    }
502
+    if (!result) {
503
+      this.startDate = this.endDate = "";
504
+      return;
505
+    }
506
+    this.startDate = format(startOfYear(result), 'yyyy-MM-dd');
507
+    // this.endDate = result.getFullYear() + '-01-01';
508
+  }
509
+  changeYearEnd(result?) {
510
+    console.log(result);
511
+    this.yearRangeEnd = result;
512
+    if (!this.quick) {
513
+      // 不是快捷选择
514
+      this.defRange = null;
515
+    }
516
+    if (!result) {
517
+      this.startDate = this.endDate = "";
518
+      return;
519
+    }
520
+    this.endDate = format(endOfYear(result), 'yyyy-MM-dd');
521
+  }
522
+
523
+  // 日期选择 快速修改时间区间
524
+  today = new Date();
525
+  quick: boolean = false;
526
+  changeDateRange(res) {
527
+    console.log(res);
528
+    this.quick = true;
529
+    switch (res) {
530
+      case "1":
531
+        // 上周
532
+        let lastweekstartdate = this.dateService.date().lastWeekStartDate;
533
+        let lastweekenddate = this.dateService.date().lastWeekEndDate;
534
+        console.log(lastweekstartdate, lastweekenddate);
535
+        this.changeDate([lastweekstartdate, lastweekenddate]);
536
+        break;
537
+      case "2":
538
+        // 上月
539
+        let lastmonthstartdate = this.dateService.date().lastMonthStartDate;
540
+        let lastmonthenddate = this.dateService.date().lastMonthEndDate;
541
+        console.log(lastmonthstartdate, lastmonthenddate);
542
+        this.changeDate([lastmonthstartdate, lastmonthenddate]);
543
+        this.changeMonthStart(lastmonthstartdate);
544
+        this.changeMonthEnd(lastmonthenddate);
545
+        break;
546
+      case "3":
547
+        // 上年
548
+        let lastyearstartdate = this.dateService.date().lastYearStartDate;
549
+        let lastyearenddate = this.dateService.date().lastYearEndDate;
550
+        console.log(lastyearstartdate, lastyearenddate);
551
+        this.changeDate([lastyearstartdate, lastyearenddate]);
552
+        this.changeMonthStart(lastyearstartdate);
553
+        this.changeMonthEnd(lastyearenddate);
554
+        this.changeYearStart(lastyearstartdate);
555
+        this.changeYearEnd(lastyearenddate);
556
+        break;
557
+    }
558
+    this.quick = false;
559
+    this.search();
560
+  }
561
+
562
+  // 更多
563
+  toMore(type) {
564
+    let sendData = this.searchData;
565
+    console.log(sendData);
566
+    this.myService.sendMsg(sendData);
567
+    this.router.navigateByUrl("/main/" + type);
568
+  }
569
+
570
+  // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
571
+  showPromptModal(con, success, promptInfo?) {
572
+    this.promptModalShow = false;
573
+    this.promptContent = con;
574
+    this.ifSuccess = success;
575
+    this.promptInfo = promptInfo;
576
+    setTimeout(() => {
577
+      this.promptModalShow = true;
578
+    }, 100);
579
+  }
580
+
581
+  // 边输入边搜索节流阀
582
+  isLoading: boolean = false;
583
+  searchTimer(fun, e) {
584
+    this.isLoading = true;
585
+    this.searchTimerSubject.next([fun, e]);
586
+  }
587
+  // 列表排序
588
+  sortCurrent = {
589
+    clothesTypeNum: null,
590
+    getOrder: null,
591
+    sendOrder: null,
592
+    sendClothesNum: null,
593
+    price: null,
594
+  };
595
+  sortCurrentKey: string = "";
596
+  sortCurrentValue: string | null = "";
597
+  sort(e) {
598
+    const { key, value } = e;
599
+    this.sortCurrentKey = key;
600
+    this.sortCurrentValue = value;
601
+    this.getList(this.pageIndex, this.sortCurrentKey, this.sortCurrentValue);
602
+  }
603
+}

+ 16 - 0
src/app/views/quilt-washing-department-statistics/quilt-washing-department-statistics.module.ts

@@ -0,0 +1,16 @@
1
+import { NgModule } from "@angular/core";
2
+import { CommonModule } from "@angular/common";
3
+
4
+import { QuiltWashingDepartmentStatisticsRoutingModule } from "./quilt-washing-department-statistics-routing.module";
5
+import { ShareModule } from "src/app/share/share.module";
6
+import { QuiltWashingDepartmentStatisticsComponent } from "./quilt-washing-department-statistics.component";
7
+
8
+@NgModule({
9
+  declarations: [QuiltWashingDepartmentStatisticsComponent],
10
+  imports: [
11
+    CommonModule,
12
+    QuiltWashingDepartmentStatisticsRoutingModule,
13
+    ShareModule,
14
+  ],
15
+})
16
+export class QuiltWashingDepartmentStatisticsModule {}

+ 13 - 0
src/app/views/quilt-washing-hospital-statistics/quilt-washing-hospital-statistics-routing.module.ts

@@ -0,0 +1,13 @@
1
+import { NgModule } from "@angular/core";
2
+import { Routes, RouterModule } from "@angular/router";
3
+import { QuiltWashingHospitalStatisticsComponent } from "./quilt-washing-hospital-statistics.component";
4
+
5
+const routes: Routes = [
6
+  { path: "", component: QuiltWashingHospitalStatisticsComponent },
7
+];
8
+
9
+@NgModule({
10
+  imports: [RouterModule.forChild(routes)],
11
+  exports: [RouterModule],
12
+})
13
+export class QuiltWashingHospitalStatisticsRoutingModule {}

+ 85 - 0
src/app/views/quilt-washing-hospital-statistics/quilt-washing-hospital-statistics.component.html

@@ -0,0 +1,85 @@
1
+<div class="list-template">
2
+  <div class="list-template__content">
3
+    <div class="list-template__top" nz-row>
4
+      <div nz-col nzXl='18' class="list-template__searchBox">
5
+        <div class="list-template__searchItem">
6
+          <nz-radio-group [(ngModel)]="dateType" (ngModelChange)="changeDateType($event)">
7
+            <label *ngFor="let data of dateTypes" nz-radio-button [nzValue]="data.value">{{data.label}}</label>
8
+          </nz-radio-group>
9
+        </div>
10
+        <div class="list-template__searchItem">
11
+          <span class="label">发起时间</span>:
12
+          <nz-range-picker *ngIf="dateType=='day'" [(ngModel)]="dateRange" [nzAllowClear]='false'
13
+            [nzDisabledDate]="disabledDate" (ngModelChange)="changeDate($event)">
14
+          </nz-range-picker>
15
+          <nz-month-picker *ngIf="dateType=='month'" [(ngModel)]="monthRangeStart" [nzDisabledDate]="disabledMonthStart"
16
+            (ngModelChange)="changeMonthStart($event)" nzPlaceHolder="请选择开始月份">
17
+          </nz-month-picker>
18
+          <span *ngIf="dateType=='month'"> ~ </span>
19
+          <nz-month-picker *ngIf="dateType=='month'" [(ngModel)]="monthRangeEnd" [nzDisabledDate]="disabledMonthEnd"
20
+            (ngModelChange)="changeMonthEnd($event)" nzPlaceHolder="请选择截止月份">
21
+          </nz-month-picker>
22
+          <nz-year-picker *ngIf="dateType=='year'" [(ngModel)]="yearRangeStart" [nzDisabledDate]="disabledYearStart"
23
+            (ngModelChange)="changeYearStart($event)" nzPlaceHolder="请选择开始年份">
24
+          </nz-year-picker>
25
+          <span *ngIf="dateType=='year'"> ~ </span>
26
+          <nz-year-picker *ngIf="dateType=='year'" [(ngModel)]="yearRangeEnd" (ngModelChange)="changeYearEnd($event)"
27
+            [nzDisabledDate]="disabledYearEnd" nzPlaceHolder="请选择截止年份">
28
+          </nz-year-picker>
29
+        </div>
30
+        <div class="list-template__searchItem ml8">
31
+          <nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" [nzShowSearch]="false" nzPlaceHolder="请选择时间"
32
+            [(ngModel)]="defRange" (ngModelChange)="changeDateRange($event)">
33
+            <nz-option nzLabel="{{data.label}}" nzValue="{{data.id}}" *ngFor="let data of defRanges"></nz-option>
34
+          </nz-select>
35
+        </div>
36
+      </div>
37
+      <div nz-col nzXl='6' class="list-template__btns">
38
+        <button nz-button class="btn default" (click)='search(1)'>搜索</button>
39
+        <button nz-button class="btn default ml8" (click)='export()' [nzLoading]="loading2">导出</button>
40
+        <button nz-button class="btn default ml8" (click)='reset()'>重置</button>
41
+      </div>
42
+    </div>
43
+    <div class="list-template__bottom">
44
+      <nz-table class="list-template__nzTable" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false"
45
+        [nzLoading]="loading1">
46
+        <thead (nzSortChange)="sort($event)" nzSingleSort>
47
+          <tr class="thead">
48
+            <th nzWidth="5%">序号</th>
49
+            <th nzWidth="11%">日期</th>
50
+            <th nzShowSort nzWidth="14%" nzSortKey="deptNum" [(nzSort)]="sortCurrent.deptNum">科室数</th>
51
+            <th nzShowSort nzWidth="14%" nzSortKey="clothesTypeNum" [(nzSort)]="sortCurrent.clothesTypeNum">被服种类数</th>
52
+            <th nzShowSort nzWidth="14%" nzSortKey="getOrder" [(nzSort)]="sortCurrent.getOrder">回收工单数</th>
53
+            <th nzShowSort nzWidth="14%" nzSortKey="sendOrder" [(nzSort)]="sortCurrent.sendOrder">送回工单数</th>
54
+            <th nzShowSort nzWidth="14%" nzSortKey="sendClothesNum" [(nzSort)]="sortCurrent.sendClothesNum">洗涤数量</th>
55
+            <th nzShowSort nzWidth="14%" nzSortKey="price" [(nzSort)]="sortCurrent.price">费用(元)</th>
56
+          </tr>
57
+        </thead>
58
+        <tbody>
59
+          <tr *ngFor="let data of listOfData;let index=index;">
60
+            <td>{{index+(pageIndex-1) * pageSize + 1}}</td>
61
+            <td>{{ data.date }}</td>
62
+            <td>{{ data.deptNum }}</td>
63
+            <td>{{ data.clothesTypeNum }}</td>
64
+            <td>{{ data.getOrder }}</td>
65
+            <td>{{ data.sendOrder }}</td>
66
+            <td>{{ data.sendClothesNum }}</td>
67
+            <td>{{ data.price }}</td>
68
+          </tr>
69
+        </tbody>
70
+      </nz-table>
71
+      <div class="list-template__pagination">
72
+        <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" nzShowSizeChanger [(nzPageSize)]="pageSize"
73
+          (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)"
74
+          (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)">
75
+        </nz-pagination>
76
+      </div>
77
+    </div>
78
+  </div>
79
+</div>
80
+<!-- 操作成功/失败提示框 -->
81
+<app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
82
+  [info]="promptInfo"></app-prompt-modal>
83
+
84
+<!-- 查看详情 -->
85
+<router-outlet></router-outlet>

+ 95 - 0
src/app/views/quilt-washing-hospital-statistics/quilt-washing-hospital-statistics.component.less

@@ -0,0 +1,95 @@
1
+@import "../../../../src/theme.less";
2
+
3
+:host ::ng-deep .on {
4
+  color: #fff !important;
5
+}
6
+
7
+.save {
8
+  position: fixed;
9
+  left: 0;
10
+  top: 0;
11
+  width: 100%;
12
+  height: 100%;
13
+  background: rgba(0, 0, 0, 0.4);
14
+  z-index: 99;
15
+
16
+  .modalBody {
17
+    width: 1000px;
18
+    background: #fff;
19
+    border-radius: 5px;
20
+    padding: 10px 20px;
21
+    color: #333;
22
+
23
+    .title {
24
+      width: 100%;
25
+      text-align: center;
26
+      font-size: 18px;
27
+      position: relative;
28
+
29
+      i {
30
+        position: absolute;
31
+        right: 0;
32
+        top: 0;
33
+        font-size: 20px;
34
+        color: #666;
35
+        cursor: pointer;
36
+        padding: 0 5px;
37
+      }
38
+    }
39
+
40
+    .content {
41
+      width: 100%;
42
+      border: 1px solid #e5e9ed;
43
+      border-radius: 5px;
44
+      overflow: hidden;
45
+      margin-top: 12px;
46
+
47
+      .conItem {
48
+        color: #333;
49
+
50
+        .jiTit {
51
+          height: 50px;
52
+          line-height: 50px;
53
+          border-bottom: 1px solid #e5e9ed;
54
+          padding: 0 32px;
55
+        }
56
+
57
+        .defeat {
58
+          font-size: 14px;
59
+          color: #333;
60
+          padding: 15px 32px;
61
+          min-height: 125px;
62
+        }
63
+
64
+        &.noCon {
65
+          background: #f9fafb;
66
+          padding: 16px 32px 24px 32px;
67
+          border-top: 1px solid #e5e9ed;
68
+
69
+          .title {
70
+            text-align: left;
71
+            font-size: 14px;
72
+            margin-bottom: 8px;
73
+          }
74
+
75
+          textarea {
76
+            min-height: 210px;
77
+          }
78
+        }
79
+      }
80
+    }
81
+
82
+    button {
83
+      margin-top: 10px;
84
+      margin-left: 10px;
85
+    }
86
+  }
87
+
88
+  .txtL {
89
+    text-align: left !important;
90
+  }
91
+
92
+  .txtR {
93
+    text-align: right !important;
94
+  }
95
+}

+ 459 - 0
src/app/views/quilt-washing-hospital-statistics/quilt-washing-hospital-statistics.component.ts

@@ -0,0 +1,459 @@
1
+import { Component, OnInit } from "@angular/core";
2
+import { ActivatedRoute, Router } from "@angular/router";
3
+import { differenceInCalendarDays, endOfMonth, endOfYear, format, startOfMonth, startOfYear } from "date-fns";
4
+
5
+import { MainService } from "../../services/main.service";
6
+import { DateService } from "../../services/date.service";
7
+import { MyServiceService } from "../../services/my-service.service";
8
+import { ToolService } from "../../services/tool.service";
9
+
10
+@Component({
11
+  selector: "app-quilt-washing-hospital-statistics",
12
+  templateUrl: "./quilt-washing-hospital-statistics.component.html",
13
+  styleUrls: ["./quilt-washing-hospital-statistics.component.less"],
14
+})
15
+export class QuiltWashingHospitalStatisticsComponent implements OnInit {
16
+  constructor(
17
+    private route: ActivatedRoute,
18
+    private router: Router,
19
+    private mainService: MainService,
20
+    private dateService: DateService,
21
+    private myService: MyServiceService,
22
+    private tool: ToolService
23
+  ) {}
24
+
25
+  ngOnInit() {
26
+    this.coopBtns = this.tool.initCoopBtns(this.route);
27
+    this.getAllHos();
28
+    this.changeDateRange(this.defRange);
29
+    // this.search();
30
+  }
31
+
32
+  dateType: string = "day"; //选中时间维度
33
+  dateTypes: any = [
34
+    {
35
+      label: "按天统计",
36
+      value: "day",
37
+    },
38
+    {
39
+      label: "按月统计",
40
+      value: "month",
41
+    },
42
+    {
43
+      label: "按年统计",
44
+      value: "year",
45
+    },
46
+  ]; //时间维度
47
+  defRange = "1"; //默认上周
48
+  defRanges = [
49
+    {
50
+      label: "上周",
51
+      id: 1,
52
+    },
53
+    {
54
+      label: "上月",
55
+      id: 2,
56
+    },
57
+    {
58
+      label: "上年",
59
+      id: 3,
60
+    },
61
+  ]; //时间默认区间
62
+
63
+  listOfData: any[] = []; //表格数据
64
+  pageIndex: number = 1; //表格当前页码
65
+  pageSize: number = 10; //表格每页展示条数
66
+  listLength: number = 10; //表格总数据量
67
+
68
+  alldepart: any = []; //当前院区所属科室
69
+  dateRange: any = []; //发起时间区间 天
70
+  monthRangeStart: any; //发起时间 月 起
71
+  monthRangeEnd: any; //发起时间 月 止
72
+  yearRangeStart: any; //发起时间 年 起
73
+  yearRangeEnd: any; //发起时间 年 止
74
+
75
+  promptContent: string; //操作提示框提示信息
76
+  ifSuccess: boolean; //操作成功/失败
77
+  promptInfo: string; //操作结果提示信息
78
+  promptModalShow: boolean; //操作提示框是否展示
79
+
80
+  // 初始化增删改按钮
81
+  coopBtns: any = {};
82
+  searchData: any = {}; // 综合统计页面带过来的参数
83
+  getSearchData() {
84
+    let that = this;
85
+    let sub = that.myService.getMsg().subscribe((msg) => {
86
+      // 从综合报表跳转过来
87
+      that.searchData = msg;
88
+      console.log(that.searchData);
89
+      console.log(66);
90
+      sub.unsubscribe(); //取消订阅,否则订阅函数会累加执行
91
+      that.hospital = that.searchData["hosId"];
92
+      that.changeDate(that.searchData["range"]);
93
+      that.defRange = that.searchData["defRange"];
94
+      that.search();
95
+    });
96
+    that.changeDateRange(that.defRange);
97
+    that.search();
98
+  }
99
+  // 搜索
100
+  search(num?: number) {
101
+    if (this.hospital) {
102
+      this.searchData["hosId"] = this.hospital;
103
+    }
104
+    if (this.startDate) {
105
+      this.searchData["dateRange"] = {
106
+        start: this.startDate + " " + "00:00:00",
107
+        end: this.endDate + " " + "23:59:59",
108
+      };
109
+    }
110
+    if (num !== undefined) {
111
+      this.getList(num, this.sortCurrentKey, this.sortCurrentValue);
112
+    } else {
113
+      this.getList(this.pageIndex, this.sortCurrentKey, this.sortCurrentValue);
114
+    }
115
+  }
116
+  // 导出
117
+  loading2 = false;
118
+  export() {
119
+    let that = this;
120
+    let postData: any = {
121
+      startTime: this.startDate + " " + "00:00:00",
122
+      endTime: this.endDate + " " + "23:59:59",
123
+      hosId: that.hospital,
124
+      type: this.dateType,
125
+    };
126
+    if (this.sortCurrentKey && this.sortCurrentValue) {
127
+      postData.sort =
128
+        this.sortCurrentValue === "ascend"
129
+          ? this.sortCurrentKey
130
+          : `${this.sortCurrentKey} desc`;
131
+    }
132
+    this.loading2 = true;
133
+    that.mainService.exportReport("clothesHos", postData).subscribe(
134
+      (data) => {
135
+        this.loading2 = false;
136
+        this.showPromptModal("导出", true, "");
137
+        var file = new Blob([data], {
138
+          type: "application/vnd.ms-excel",
139
+        });
140
+        //trick to download store a file having its URL
141
+        var fileURL = URL.createObjectURL(file);
142
+        var a = document.createElement("a");
143
+        a.href = fileURL;
144
+        a.target = "_blank";
145
+        a.download = "全员统计.xls";
146
+        document.body.appendChild(a);
147
+        a.click();
148
+      },
149
+      (err) => {
150
+        this.loading2 = false;
151
+        this.showPromptModal("导出", false, "");
152
+      }
153
+    );
154
+  }
155
+  // 重置
156
+  reset() {
157
+    this.changeDateType("day");
158
+    this.changeDateRange("1");
159
+    this.sortCurrentKey = "";
160
+    this.sortCurrentValue = "";
161
+    this.sortCurrent = {
162
+      deptNum: null,
163
+      clothesTypeNum: null,
164
+      getOrder: null,
165
+      sendOrder: null,
166
+      sendClothesNum: null,
167
+      price: null,
168
+    };
169
+    this.search();
170
+  }
171
+  // 表格数据
172
+  loading1 = false;
173
+  getList(num?: number, field?: string, sort?: string) {
174
+    this.pageIndex = num;
175
+    let postData: any = {
176
+      idx: this.pageIndex - 1,
177
+      sum: this.pageSize,
178
+      startTime: this.searchData.dateRange.start,
179
+      endTime: this.searchData.dateRange.end,
180
+      hosId: this.searchData.hosId,
181
+      type: this.dateType,
182
+    };
183
+    if (field && sort) {
184
+      postData.sort = sort === "ascend" ? field : `${field} desc`;
185
+    }
186
+    this.loading1 = true;
187
+    this.mainService
188
+      .postCustom("report/clothes", "hospital", postData)
189
+      .subscribe((result) => {
190
+        this.loading1 = false;
191
+        this.listOfData = result.list || [];
192
+        this.listLength = result.totalNum;
193
+      });
194
+  }
195
+  // 获取院区
196
+  hospital: string; //选中院区
197
+  getAllHos() {
198
+    this.hospital = this.tool.getCurrentHospital().id + "";
199
+  }
200
+
201
+  // 修改时间展示维度
202
+  changeDateType(res) {
203
+    console.log(res, this.dateType);
204
+    this.dateType = res;
205
+    this.searchData["type"] = res;
206
+    console.log(this.searchData);
207
+    switch (res) {
208
+      case "day":
209
+        this.defRanges = [
210
+          {
211
+            label: "上周",
212
+            id: 1,
213
+          },
214
+          {
215
+            label: "上月",
216
+            id: 2,
217
+          },
218
+          {
219
+            label: "上年",
220
+            id: 3,
221
+          },
222
+        ]; //时间默认区间
223
+        this.defRange = "1"; //默认上周
224
+        this.changeDateRange("1");
225
+        break;
226
+      case "month":
227
+        this.defRanges = [
228
+          {
229
+            label: "上月",
230
+            id: 2,
231
+          },
232
+          {
233
+            label: "上年",
234
+            id: 3,
235
+          },
236
+        ]; //时间默认区间
237
+        this.defRange = "2"; //上月
238
+        this.changeDateRange("2");
239
+        break;
240
+      case "year":
241
+        this.defRanges = [
242
+          {
243
+            label: "上年",
244
+            id: 3,
245
+          },
246
+        ]; //时间默认区间
247
+        this.defRange = "3"; //默认上周
248
+        this.changeDateRange("3");
249
+        break;
250
+    }
251
+  }
252
+
253
+  // 禁选日期
254
+  disabledDate = (current: Date): boolean => {
255
+    // Can not select days before today and today
256
+    return differenceInCalendarDays(current, this.today) > 0;
257
+  };
258
+
259
+  // 禁选月份开始
260
+  disabledMonthStart = (current: Date): boolean => {
261
+    // Can not select days before today and today
262
+    let cur = differenceInCalendarDays(current, endOfMonth(this.today)) > 0;
263
+    let staEnd = differenceInCalendarDays(current, this.monthRangeEnd) > 0;
264
+    return cur || staEnd;
265
+  };
266
+  // 禁选月份结束
267
+  disabledMonthEnd = (current: Date): boolean => {
268
+    // Can not select days before today and today
269
+    let cur = differenceInCalendarDays(current, endOfMonth(this.today)) > 0;
270
+    let staEnd = differenceInCalendarDays(this.monthRangeStart, current) > 0;
271
+    return cur || staEnd;
272
+  };
273
+
274
+  // 禁选年份开始
275
+  disabledYearStart = (current: Date): boolean => {
276
+    // Can not select days before today and today
277
+    let cur = differenceInCalendarDays(current, endOfYear(this.today)) > 0;
278
+    let staEnd = differenceInCalendarDays(current, this.yearRangeEnd) > 0;
279
+    return cur || staEnd;
280
+  };
281
+
282
+  // 禁选年份结束
283
+  disabledYearEnd = (current: Date): boolean => {
284
+    // Can not select days before today and today
285
+    let cur = differenceInCalendarDays(current, endOfYear(this.today)) > 0;
286
+    let staEnd = differenceInCalendarDays(this.yearRangeStart, current) > 0;
287
+    return cur || staEnd;
288
+  };
289
+
290
+  // 日期选择 日
291
+  startDate: string; //发起时间开始
292
+  endDate: string; //发起时间结束
293
+  changeDate(result?): void {
294
+    console.log(this.dateRange);
295
+    console.log(result);
296
+    this.dateRange = result;
297
+    if (!this.quick) {
298
+      // 不是快捷选择
299
+      this.defRange = null;
300
+    }
301
+    if (!result || !result.length) {
302
+      this.startDate = this.endDate = "";
303
+      return;
304
+    }
305
+    this.startDate =
306
+      result[0].getFullYear() +
307
+      "-" +
308
+      (result[0].getMonth() + 1) +
309
+      "-" +
310
+      result[0].getDate();
311
+    this.endDate =
312
+      result[1].getFullYear() +
313
+      "-" +
314
+      (result[1].getMonth() + 1) +
315
+      "-" +
316
+      result[1].getDate();
317
+  }
318
+
319
+  // 月份选择
320
+  changeMonthStart(result?) {
321
+    console.log(result);
322
+    this.monthRangeStart = result;
323
+    if (!this.quick) {
324
+      // 不是快捷选择
325
+      this.defRange = null;
326
+    }
327
+    if (!result) {
328
+      this.startDate = this.endDate = "";
329
+      return;
330
+    }
331
+    this.startDate = format(startOfMonth(result), 'yyyy-MM-dd');
332
+    // this.endDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
333
+  }
334
+  changeMonthEnd(result?) {
335
+    console.log(result);
336
+    this.monthRangeEnd = result;
337
+    if (!this.quick) {
338
+      // 不是快捷选择
339
+      this.defRange = null;
340
+    }
341
+    if (!result) {
342
+      this.startDate = this.endDate = "";
343
+      return;
344
+    }
345
+    // this.startDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
346
+    this.endDate = format(endOfMonth(result), 'yyyy-MM-dd');
347
+  }
348
+  // 年份选择
349
+  changeYearStart(result?) {
350
+    console.log(result);
351
+    this.yearRangeStart = result;
352
+    if (!this.quick) {
353
+      // 不是快捷选择
354
+      this.defRange = null;
355
+    }
356
+    if (!result) {
357
+      this.startDate = this.endDate = "";
358
+      return;
359
+    }
360
+    this.startDate = format(startOfYear(result), 'yyyy-MM-dd');
361
+    // this.endDate = result.getFullYear() + '-01-01';
362
+  }
363
+  changeYearEnd(result?) {
364
+    console.log(result);
365
+    this.yearRangeEnd = result;
366
+    if (!this.quick) {
367
+      // 不是快捷选择
368
+      this.defRange = null;
369
+    }
370
+    if (!result) {
371
+      this.startDate = this.endDate = "";
372
+      return;
373
+    }
374
+    this.endDate = format(endOfYear(result), 'yyyy-MM-dd');
375
+  }
376
+
377
+  // 日期选择 快速修改时间区间
378
+  today = new Date();
379
+  quick: boolean = false;
380
+  changeDateRange(res) {
381
+    console.log(res);
382
+    this.quick = true;
383
+    switch (res) {
384
+      case "1":
385
+        // 上周
386
+        let lastweekstartdate = this.dateService.date().lastWeekStartDate;
387
+        let lastweekenddate = this.dateService.date().lastWeekEndDate;
388
+        console.log(lastweekstartdate, lastweekenddate);
389
+        this.changeDate([lastweekstartdate, lastweekenddate]);
390
+        break;
391
+      case "2":
392
+        // 上月
393
+        let lastmonthstartdate = this.dateService.date().lastMonthStartDate;
394
+        let lastmonthenddate = this.dateService.date().lastMonthEndDate;
395
+        console.log(lastmonthstartdate, lastmonthenddate);
396
+        this.changeDate([lastmonthstartdate, lastmonthenddate]);
397
+        this.changeMonthStart(lastmonthstartdate);
398
+        this.changeMonthEnd(lastmonthenddate);
399
+        break;
400
+      case "3":
401
+        // 上年
402
+        let lastyearstartdate = this.dateService.date().lastYearStartDate;
403
+        let lastyearenddate = this.dateService.date().lastYearEndDate;
404
+        console.log(lastyearstartdate, lastyearenddate);
405
+        this.changeDate([lastyearstartdate, lastyearenddate]);
406
+        this.changeMonthStart(lastyearstartdate);
407
+        this.changeMonthEnd(lastyearenddate);
408
+        this.changeYearStart(lastyearstartdate);
409
+        this.changeYearEnd(lastyearenddate);
410
+        break;
411
+    }
412
+    this.quick = false;
413
+    this.search();
414
+  }
415
+
416
+  // 更多
417
+  toMore(type) {
418
+    let sendData = this.searchData;
419
+    console.log(sendData);
420
+    this.myService.sendMsg(sendData);
421
+    this.router.navigateByUrl("/main/" + type);
422
+  }
423
+
424
+  // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
425
+  showPromptModal(con, success, promptInfo?) {
426
+    this.promptModalShow = false;
427
+    this.promptContent = con;
428
+    this.ifSuccess = success;
429
+    this.promptInfo = promptInfo;
430
+    setTimeout(() => {
431
+      this.promptModalShow = true;
432
+    }, 100);
433
+  }
434
+
435
+  // 边输入边搜索节流阀
436
+  isLoading: boolean = false;
437
+  searchTimer(fun, e, those) {
438
+    let that = this;
439
+    that.isLoading = true;
440
+    fun(e, those);
441
+  }
442
+  // 列表排序
443
+  sortCurrent = {
444
+    deptNum: null,
445
+    clothesTypeNum: null,
446
+    getOrder: null,
447
+    sendOrder: null,
448
+    sendClothesNum: null,
449
+    price: null,
450
+  };
451
+  sortCurrentKey: string = "";
452
+  sortCurrentValue: string | null = "";
453
+  sort(e) {
454
+    const { key, value } = e;
455
+    this.sortCurrentKey = key;
456
+    this.sortCurrentValue = value;
457
+    this.getList(this.pageIndex, this.sortCurrentKey, this.sortCurrentValue);
458
+  }
459
+}

+ 16 - 0
src/app/views/quilt-washing-hospital-statistics/quilt-washing-hospital-statistics.module.ts

@@ -0,0 +1,16 @@
1
+import { NgModule } from "@angular/core";
2
+import { CommonModule } from "@angular/common";
3
+
4
+import { QuiltWashingHospitalStatisticsRoutingModule } from "./quilt-washing-hospital-statistics-routing.module";
5
+import { ShareModule } from "src/app/share/share.module";
6
+import { QuiltWashingHospitalStatisticsComponent } from "./quilt-washing-hospital-statistics.component";
7
+
8
+@NgModule({
9
+  declarations: [QuiltWashingHospitalStatisticsComponent],
10
+  imports: [
11
+    CommonModule,
12
+    QuiltWashingHospitalStatisticsRoutingModule,
13
+    ShareModule,
14
+  ],
15
+})
16
+export class QuiltWashingHospitalStatisticsModule {}

+ 13 - 0
src/app/views/quilt-washing-personnel-statistics/quilt-washing-personnel-statistics-routing.module.ts

@@ -0,0 +1,13 @@
1
+import { NgModule } from "@angular/core";
2
+import { Routes, RouterModule } from "@angular/router";
3
+import { QuiltWashingPersonnelStatisticsComponent } from "./quilt-washing-personnel-statistics.component";
4
+
5
+const routes: Routes = [
6
+  { path: "", component: QuiltWashingPersonnelStatisticsComponent },
7
+];
8
+
9
+@NgModule({
10
+  imports: [RouterModule.forChild(routes)],
11
+  exports: [RouterModule],
12
+})
13
+export class QuiltWashingPersonnelStatisticsRoutingModule {}

+ 109 - 0
src/app/views/quilt-washing-personnel-statistics/quilt-washing-personnel-statistics.component.html

@@ -0,0 +1,109 @@
1
+<div class="list-template">
2
+  <div class="list-template__content">
3
+    <div class="list-template__top" nz-row>
4
+      <div nz-col nzXl='18' class="list-template__searchBox">
5
+        <div class="list-template__searchItem">
6
+          <nz-radio-group [(ngModel)]="dateType" (ngModelChange)="changeDateType($event)">
7
+            <label *ngFor="let data of dateTypes" nz-radio-button [nzValue]="data.value">{{data.label}}</label>
8
+          </nz-radio-group>
9
+        </div>
10
+        <div class="list-template__searchItem">
11
+          <span class="label">发起时间</span>:
12
+          <nz-range-picker *ngIf="dateType=='day'" [(ngModel)]="dateRange" [nzAllowClear]='false'
13
+            [nzDisabledDate]="disabledDate" (ngModelChange)="changeDate($event)">
14
+          </nz-range-picker>
15
+          <nz-month-picker *ngIf="dateType=='month'" [(ngModel)]="monthRangeStart" [nzDisabledDate]="disabledMonthStart"
16
+            (ngModelChange)="changeMonthStart($event)" nzPlaceHolder="请选择开始月份">
17
+          </nz-month-picker>
18
+          <span *ngIf="dateType=='month'"> ~ </span>
19
+          <nz-month-picker *ngIf="dateType=='month'" [(ngModel)]="monthRangeEnd" [nzDisabledDate]="disabledMonthEnd"
20
+            (ngModelChange)="changeMonthEnd($event)" nzPlaceHolder="请选择截止月份">
21
+          </nz-month-picker>
22
+          <nz-year-picker *ngIf="dateType=='year'" [(ngModel)]="yearRangeStart" [nzDisabledDate]="disabledYearStart"
23
+            (ngModelChange)="changeYearStart($event)" nzPlaceHolder="请选择开始年份">
24
+          </nz-year-picker>
25
+          <span *ngIf="dateType=='year'"> ~ </span>
26
+          <nz-year-picker *ngIf="dateType=='year'" [(ngModel)]="yearRangeEnd" (ngModelChange)="changeYearEnd($event)"
27
+            [nzDisabledDate]="disabledYearEnd" nzPlaceHolder="请选择截止年份">
28
+          </nz-year-picker>
29
+        </div>
30
+        <div class="list-template__searchItem ml8">
31
+          <nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" [nzShowSearch]="false" nzPlaceHolder="请选择时间"
32
+            [(ngModel)]="defRange" (ngModelChange)="changeDateRange($event)">
33
+            <nz-option nzLabel="{{data.label}}" nzValue="{{data.id}}" *ngFor="let data of defRanges"></nz-option>
34
+          </nz-select>
35
+        </div>
36
+        <div class="list-template__searchItem">
37
+          <span class="label">人员名称</span>:
38
+          <nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" nzServerSearch nzShowSearch
39
+            (nzOnSearch)="changeInp($event)" nzAllowClear nzPlaceHolder="请选择人员名称" [(ngModel)]="searchDto.user">
40
+            <ng-container *ngFor="let option of userList">
41
+              <nz-option *ngIf="!isLoading" [nzLabel]="option.name" [nzValue]="option.id"></nz-option>
42
+            </ng-container>
43
+            <nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
44
+              <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
45
+            </nz-option>
46
+          </nz-select>
47
+        </div>
48
+        <div class="list-template__searchItem">
49
+          <span class="label">人员分组</span>:
50
+          <nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" [nzShowSearch]="false" nzPlaceHolder="请选择人员分组" [(ngModel)]="searchDto.group">
51
+            <nz-option [nzLabel]="data.groupName" [nzValue]="data.id" *ngFor="let data of groupList"></nz-option>
52
+          </nz-select>
53
+        </div>
54
+      </div>
55
+      <div nz-col nzXl='6' class="list-template__btns">
56
+        <button nz-button class="btn default" (click)='search(1)'>搜索</button>
57
+        <button nz-button class="btn default ml8" (click)='export()' [nzLoading]="loading2">导出</button>
58
+        <button nz-button class="btn default ml8" (click)='reset()'>重置</button>
59
+      </div>
60
+    </div>
61
+    <div class="list-template__bottom">
62
+      <nz-table class="list-template__nzTable" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false"
63
+        [nzLoading]="loading1">
64
+        <thead (nzSortChange)="sort($event)" nzSingleSort>
65
+          <tr class="thead">
66
+            <th nzWidth="5%">序号</th>
67
+            <th nzWidth="5%">人员姓名</th>
68
+            <th nzShowSort nzWidth="10%" nzSortKey="totalTrip" [(nzSort)]="sortCurrent.totalTrip">总趟数</th>
69
+            <th nzShowSort nzWidth="10%" nzSortKey="totalOrder" [(nzSort)]="sortCurrent.totalOrder">总单数</th>
70
+            <th nzShowSort nzWidth="10%" nzSortKey="getTrip" [(nzSort)]="sortCurrent.getTrip">回收趟数</th>
71
+            <th nzShowSort nzWidth="10%" nzSortKey="getOrder" [(nzSort)]="sortCurrent.getOrder">回收工单数</th>
72
+            <th nzShowSort nzWidth="10%" nzSortKey="getClothesNum" [(nzSort)]="sortCurrent.getClothesNum">回收被服数量</th>
73
+            <th nzShowSort nzWidth="10%" nzSortKey="sendTrip" [(nzSort)]="sortCurrent.sendTrip">送回趟数</th>
74
+            <th nzShowSort nzWidth="10%" nzSortKey="sendOrder" [(nzSort)]="sortCurrent.sendOrder">送回工单数</th>
75
+            <th nzShowSort nzWidth="10%" nzSortKey="sendClothesNum" [(nzSort)]="sortCurrent.sendClothesNum">送回被服数量</th>
76
+            <th nzShowSort nzWidth="10%" nzSortKey="price" [(nzSort)]="sortCurrent.price">费用(元)</th>
77
+          </tr>
78
+        </thead>
79
+        <tbody>
80
+          <tr *ngFor="let data of listOfData;let index=index;">
81
+            <td>{{index+(pageIndex-1) * pageSize + 1}}</td>
82
+            <td>{{ data.userName }}</td>
83
+            <td>{{ data.totalTrip }}</td>
84
+            <td>{{ data.totalOrder }}</td>
85
+            <td>{{ data.getTrip }}</td>
86
+            <td>{{ data.getOrder }}</td>
87
+            <td>{{ data.getClothesNum }}</td>
88
+            <td>{{ data.sendTrip }}</td>
89
+            <td>{{ data.sendOrder }}</td>
90
+            <td>{{ data.sendClothesNum }}</td>
91
+            <td>{{ data.price }}</td>
92
+          </tr>
93
+        </tbody>
94
+      </nz-table>
95
+      <div class="list-template__pagination">
96
+        <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" nzShowSizeChanger [(nzPageSize)]="pageSize"
97
+          (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)"
98
+          (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)">
99
+        </nz-pagination>
100
+      </div>
101
+    </div>
102
+  </div>
103
+</div>
104
+<!-- 操作成功/失败提示框 -->
105
+<app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
106
+  [info]="promptInfo"></app-prompt-modal>
107
+
108
+<!-- 查看详情 -->
109
+<router-outlet></router-outlet>

+ 95 - 0
src/app/views/quilt-washing-personnel-statistics/quilt-washing-personnel-statistics.component.less

@@ -0,0 +1,95 @@
1
+@import "../../../../src/theme.less";
2
+
3
+:host ::ng-deep .on {
4
+  color: #fff !important;
5
+}
6
+
7
+.save {
8
+  position: fixed;
9
+  left: 0;
10
+  top: 0;
11
+  width: 100%;
12
+  height: 100%;
13
+  background: rgba(0, 0, 0, 0.4);
14
+  z-index: 99;
15
+
16
+  .modalBody {
17
+    width: 1000px;
18
+    background: #fff;
19
+    border-radius: 5px;
20
+    padding: 10px 20px;
21
+    color: #333;
22
+
23
+    .title {
24
+      width: 100%;
25
+      text-align: center;
26
+      font-size: 18px;
27
+      position: relative;
28
+
29
+      i {
30
+        position: absolute;
31
+        right: 0;
32
+        top: 0;
33
+        font-size: 20px;
34
+        color: #666;
35
+        cursor: pointer;
36
+        padding: 0 5px;
37
+      }
38
+    }
39
+
40
+    .content {
41
+      width: 100%;
42
+      border: 1px solid #e5e9ed;
43
+      border-radius: 5px;
44
+      overflow: hidden;
45
+      margin-top: 12px;
46
+
47
+      .conItem {
48
+        color: #333;
49
+
50
+        .jiTit {
51
+          height: 50px;
52
+          line-height: 50px;
53
+          border-bottom: 1px solid #e5e9ed;
54
+          padding: 0 32px;
55
+        }
56
+
57
+        .defeat {
58
+          font-size: 14px;
59
+          color: #333;
60
+          padding: 15px 32px;
61
+          min-height: 125px;
62
+        }
63
+
64
+        &.noCon {
65
+          background: #f9fafb;
66
+          padding: 16px 32px 24px 32px;
67
+          border-top: 1px solid #e5e9ed;
68
+
69
+          .title {
70
+            text-align: left;
71
+            font-size: 14px;
72
+            margin-bottom: 8px;
73
+          }
74
+
75
+          textarea {
76
+            min-height: 210px;
77
+          }
78
+        }
79
+      }
80
+    }
81
+
82
+    button {
83
+      margin-top: 10px;
84
+      margin-left: 10px;
85
+    }
86
+  }
87
+
88
+  .txtL {
89
+    text-align: left !important;
90
+  }
91
+
92
+  .txtR {
93
+    text-align: right !important;
94
+  }
95
+}

+ 527 - 0
src/app/views/quilt-washing-personnel-statistics/quilt-washing-personnel-statistics.component.ts

@@ -0,0 +1,527 @@
1
+import { Component, OnInit } from "@angular/core";
2
+import { ActivatedRoute, Router } from "@angular/router";
3
+import { differenceInCalendarDays, endOfMonth, endOfYear, format, startOfMonth, startOfYear } from "date-fns";
4
+
5
+import { MainService } from "../../services/main.service";
6
+import { DateService } from "../../services/date.service";
7
+import { MyServiceService } from "../../services/my-service.service";
8
+import { ToolService } from "../../services/tool.service";
9
+import { Subject } from 'rxjs';
10
+import { debounceTime } from 'rxjs/operators';
11
+
12
+@Component({
13
+  selector: "app-quilt-washing-personnel-statistics",
14
+  templateUrl: "./quilt-washing-personnel-statistics.component.html",
15
+  styleUrls: ["./quilt-washing-personnel-statistics.component.less"],
16
+})
17
+export class QuiltWashingPersonnelStatisticsComponent implements OnInit {
18
+  constructor(
19
+    private route: ActivatedRoute,
20
+    private router: Router,
21
+    private mainService: MainService,
22
+    private dateService: DateService,
23
+    private myService: MyServiceService,
24
+    private tool: ToolService
25
+  ) {}
26
+
27
+  searchTimerSubject = new Subject();
28
+
29
+  ngOnInit() {
30
+    this.searchTimerSubject.pipe(debounceTime(500)).subscribe((v) => {
31
+      let fun = v[0];
32
+      fun.call(this, v[1]);
33
+    });
34
+    this.coopBtns = this.tool.initCoopBtns(this.route);
35
+    this.getAllHos();
36
+    this.changeDateRange(this.defRange);
37
+    // this.search();
38
+  }
39
+
40
+  dateType: string = "day"; //选中时间维度
41
+  dateTypes: any = [
42
+    {
43
+      label: "按天统计",
44
+      value: "day",
45
+    },
46
+    {
47
+      label: "按月统计",
48
+      value: "month",
49
+    },
50
+    {
51
+      label: "按年统计",
52
+      value: "year",
53
+    },
54
+  ]; //时间维度
55
+  defRange = "1"; //默认上周
56
+  defRanges = [
57
+    {
58
+      label: "上周",
59
+      id: 1,
60
+    },
61
+    {
62
+      label: "上月",
63
+      id: 2,
64
+    },
65
+    {
66
+      label: "上年",
67
+      id: 3,
68
+    },
69
+  ]; //时间默认区间
70
+
71
+  listOfData: any[] = []; //表格数据
72
+  pageIndex: number = 1; //表格当前页码
73
+  pageSize: number = 10; //表格每页展示条数
74
+  listLength: number = 10; //表格总数据量
75
+
76
+  alldepart: any = []; //当前院区所属科室
77
+  dateRange: any = []; //发起时间区间 天
78
+  monthRangeStart: any; //发起时间 月 起
79
+  monthRangeEnd: any; //发起时间 月 止
80
+  yearRangeStart: any; //发起时间 年 起
81
+  yearRangeEnd: any; //发起时间 年 止
82
+
83
+  promptContent: string; //操作提示框提示信息
84
+  ifSuccess: boolean; //操作成功/失败
85
+  promptInfo: string; //操作结果提示信息
86
+  promptModalShow: boolean; //操作提示框是否展示
87
+
88
+  searchDto: any = {
89
+    group: null,
90
+    user: null,
91
+  }
92
+
93
+  // 初始化增删改按钮
94
+  coopBtns: any = {};
95
+  searchData: any = {}; // 综合统计页面带过来的参数
96
+  getSearchData() {
97
+    let that = this;
98
+    let sub = that.myService.getMsg().subscribe((msg) => {
99
+      // 从综合报表跳转过来
100
+      that.searchData = msg;
101
+      console.log(that.searchData);
102
+      console.log(66);
103
+      sub.unsubscribe(); //取消订阅,否则订阅函数会累加执行
104
+      that.hospital = that.searchData["hosId"];
105
+      that.changeDate(that.searchData["range"]);
106
+      that.defRange = that.searchData["defRange"];
107
+      that.search();
108
+    });
109
+    that.changeDateRange(that.defRange);
110
+    that.search();
111
+  }
112
+  // 获取分组
113
+  groupList: any = []; //分组
114
+  getGroupList(id) {
115
+    let groupData = {
116
+      group2: {
117
+        hospitals: id,
118
+        type:1
119
+      },
120
+      idx: 0,
121
+      sum: 9999,
122
+    };
123
+    this.mainService
124
+      .getFetchDataList("data", "group2", groupData)
125
+      .subscribe((result) => {
126
+        this.groupList = result.list;
127
+      });
128
+  }
129
+  // 边输边搜节流阀
130
+  changeInp(e) {
131
+    this.searchTimer(this.getUserList, e);
132
+  }
133
+  // 获取人员
134
+  userList: any = []; //人员
135
+  getUserList(keyword = '') {
136
+    let postData = {
137
+      user: {
138
+        hospital: { id: this.hospital },
139
+        name: keyword
140
+      },
141
+      idx: 0,
142
+      sum: 10,
143
+    };
144
+    this.isLoading = true;
145
+    this.mainService
146
+      .getFetchDataList("data", "user", postData)
147
+      .subscribe((result) => {
148
+        this.isLoading = false;
149
+        this.userList = result.list;
150
+      });
151
+  }
152
+  // 搜索
153
+  search(num?: number) {
154
+    if (this.hospital) {
155
+      this.searchData["hosId"] = this.hospital;
156
+    }
157
+    if (this.startDate) {
158
+      this.searchData["dateRange"] = {
159
+        start: this.startDate + " " + "00:00:00",
160
+        end: this.endDate + " " + "23:59:59",
161
+      };
162
+    }
163
+    if (num !== undefined) {
164
+      this.getList(num, this.sortCurrentKey, this.sortCurrentValue);
165
+    } else {
166
+      this.getList(this.pageIndex, this.sortCurrentKey, this.sortCurrentValue);
167
+    }
168
+  }
169
+  // 导出
170
+  loading2 = false;
171
+  export() {
172
+    let that = this;
173
+    let postData: any = {
174
+      startTime: this.startDate + " " + "00:00:00",
175
+      endTime: this.endDate + " " + "23:59:59",
176
+      hosId: that.hospital,
177
+      type: this.dateType,
178
+      userId: this.searchDto.user || undefined,
179
+      groupId: this.searchDto.group || undefined,
180
+    };
181
+    if (this.sortCurrentKey && this.sortCurrentValue) {
182
+      postData.sort =
183
+        this.sortCurrentValue === "ascend"
184
+          ? this.sortCurrentKey
185
+          : `${this.sortCurrentKey} desc`;
186
+    }
187
+    this.loading2 = true;
188
+    that.mainService.exportReport("clothesPersonal", postData).subscribe(
189
+      (data) => {
190
+        this.loading2 = false;
191
+        this.showPromptModal("导出", true, "");
192
+        var file = new Blob([data], {
193
+          type: "application/vnd.ms-excel",
194
+        });
195
+        //trick to download store a file having its URL
196
+        var fileURL = URL.createObjectURL(file);
197
+        var a = document.createElement("a");
198
+        a.href = fileURL;
199
+        a.target = "_blank";
200
+        a.download = "人员统计.xls";
201
+        document.body.appendChild(a);
202
+        a.click();
203
+      },
204
+      (err) => {
205
+        this.loading2 = false;
206
+        this.showPromptModal("导出", false, "");
207
+      }
208
+    );
209
+  }
210
+  // 重置
211
+  reset() {
212
+    this.changeDateType("day");
213
+    this.changeDateRange("1");
214
+    this.sortCurrentKey = "";
215
+    this.sortCurrentValue = "";
216
+    this.sortCurrent = {
217
+      totalTrip: null,
218
+      totalOrder: null,
219
+      getTrip: null,
220
+      getOrder: null,
221
+      getClothesNum: null,
222
+      sendTrip: null,
223
+      sendOrder: null,
224
+      sendClothesNum: null,
225
+      price: null,
226
+    };
227
+    this.searchDto = {
228
+      group: null,
229
+      user: null,
230
+    }
231
+    this.search();
232
+  }
233
+  // 表格数据
234
+  loading1 = false;
235
+  getList(num?: number, field?: string, sort?: string) {
236
+    this.pageIndex = num;
237
+    let postData: any = {
238
+      idx: this.pageIndex - 1,
239
+      sum: this.pageSize,
240
+      startTime: this.searchData.dateRange.start,
241
+      endTime: this.searchData.dateRange.end,
242
+      hosId: this.searchData.hosId,
243
+      type: this.dateType,
244
+      userId: this.searchDto.user || undefined,
245
+      groupId: this.searchDto.group || undefined,
246
+    };
247
+    if (field && sort) {
248
+      postData.sort = sort === "ascend" ? field : `${field} desc`;
249
+    }
250
+    this.loading1 = true;
251
+    this.mainService
252
+      .postCustom("report/clothes", "personal", postData)
253
+      .subscribe((result) => {
254
+        this.loading1 = false;
255
+        this.listOfData = result.list || [];
256
+        this.listLength = result.totalNum;
257
+      });
258
+  }
259
+  // 获取院区
260
+  hospital: string; //选中院区
261
+  getAllHos() {
262
+    this.hospital = this.tool.getCurrentHospital().id + "";
263
+    this.getGroupList(this.hospital);
264
+    this.getUserList();
265
+  }
266
+
267
+  // 修改时间展示维度
268
+  changeDateType(res) {
269
+    console.log(res, this.dateType);
270
+    this.dateType = res;
271
+    this.searchData["type"] = res;
272
+    console.log(this.searchData);
273
+    switch (res) {
274
+      case "day":
275
+        this.defRanges = [
276
+          {
277
+            label: "上周",
278
+            id: 1,
279
+          },
280
+          {
281
+            label: "上月",
282
+            id: 2,
283
+          },
284
+          {
285
+            label: "上年",
286
+            id: 3,
287
+          },
288
+        ]; //时间默认区间
289
+        this.defRange = "1"; //默认上周
290
+        this.changeDateRange("1");
291
+        break;
292
+      case "month":
293
+        this.defRanges = [
294
+          {
295
+            label: "上月",
296
+            id: 2,
297
+          },
298
+          {
299
+            label: "上年",
300
+            id: 3,
301
+          },
302
+        ]; //时间默认区间
303
+        this.defRange = "2"; //上月
304
+        this.changeDateRange("2");
305
+        break;
306
+      case "year":
307
+        this.defRanges = [
308
+          {
309
+            label: "上年",
310
+            id: 3,
311
+          },
312
+        ]; //时间默认区间
313
+        this.defRange = "3"; //默认上周
314
+        this.changeDateRange("3");
315
+        break;
316
+    }
317
+  }
318
+
319
+  // 禁选日期
320
+  disabledDate = (current: Date): boolean => {
321
+    // Can not select days before today and today
322
+    return differenceInCalendarDays(current, this.today) > 0;
323
+  };
324
+
325
+  // 禁选月份开始
326
+  disabledMonthStart = (current: Date): boolean => {
327
+    // Can not select days before today and today
328
+    let cur = differenceInCalendarDays(current, endOfMonth(this.today)) > 0;
329
+    let staEnd = differenceInCalendarDays(current, this.monthRangeEnd) > 0;
330
+    return cur || staEnd;
331
+  };
332
+  // 禁选月份结束
333
+  disabledMonthEnd = (current: Date): boolean => {
334
+    // Can not select days before today and today
335
+    let cur = differenceInCalendarDays(current, endOfMonth(this.today)) > 0;
336
+    let staEnd = differenceInCalendarDays(this.monthRangeStart, current) > 0;
337
+    return cur || staEnd;
338
+  };
339
+
340
+  // 禁选年份开始
341
+  disabledYearStart = (current: Date): boolean => {
342
+    // Can not select days before today and today
343
+    let cur = differenceInCalendarDays(current, endOfYear(this.today)) > 0;
344
+    let staEnd = differenceInCalendarDays(current, this.yearRangeEnd) > 0;
345
+    return cur || staEnd;
346
+  };
347
+
348
+  // 禁选年份结束
349
+  disabledYearEnd = (current: Date): boolean => {
350
+    // Can not select days before today and today
351
+    let cur = differenceInCalendarDays(current, endOfYear(this.today)) > 0;
352
+    let staEnd = differenceInCalendarDays(this.yearRangeStart, current) > 0;
353
+    return cur || staEnd;
354
+  };
355
+
356
+  // 日期选择 日
357
+  startDate: string; //发起时间开始
358
+  endDate: string; //发起时间结束
359
+  changeDate(result?): void {
360
+    console.log(this.dateRange);
361
+    console.log(result);
362
+    this.dateRange = result;
363
+    if (!this.quick) {
364
+      // 不是快捷选择
365
+      this.defRange = null;
366
+    }
367
+    if (!result || !result.length) {
368
+      this.startDate = this.endDate = "";
369
+      return;
370
+    }
371
+    this.startDate =
372
+      result[0].getFullYear() +
373
+      "-" +
374
+      (result[0].getMonth() + 1) +
375
+      "-" +
376
+      result[0].getDate();
377
+    this.endDate =
378
+      result[1].getFullYear() +
379
+      "-" +
380
+      (result[1].getMonth() + 1) +
381
+      "-" +
382
+      result[1].getDate();
383
+  }
384
+
385
+  // 月份选择
386
+  changeMonthStart(result?) {
387
+    console.log(result);
388
+    this.monthRangeStart = result;
389
+    if (!this.quick) {
390
+      // 不是快捷选择
391
+      this.defRange = null;
392
+    }
393
+    if (!result) {
394
+      this.startDate = this.endDate = "";
395
+      return;
396
+    }
397
+    this.startDate = format(startOfMonth(result), 'yyyy-MM-dd');
398
+    // this.endDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
399
+  }
400
+  changeMonthEnd(result?) {
401
+    console.log(result);
402
+    this.monthRangeEnd = result;
403
+    if (!this.quick) {
404
+      // 不是快捷选择
405
+      this.defRange = null;
406
+    }
407
+    if (!result) {
408
+      this.startDate = this.endDate = "";
409
+      return;
410
+    }
411
+    // this.startDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
412
+    this.endDate = format(endOfMonth(result), 'yyyy-MM-dd');
413
+  }
414
+  // 年份选择
415
+  changeYearStart(result?) {
416
+    console.log(result);
417
+    this.yearRangeStart = result;
418
+    if (!this.quick) {
419
+      // 不是快捷选择
420
+      this.defRange = null;
421
+    }
422
+    if (!result) {
423
+      this.startDate = this.endDate = "";
424
+      return;
425
+    }
426
+    this.startDate = format(startOfYear(result), 'yyyy-MM-dd');
427
+    // this.endDate = result.getFullYear() + '-01-01';
428
+  }
429
+  changeYearEnd(result?) {
430
+    console.log(result);
431
+    this.yearRangeEnd = result;
432
+    if (!this.quick) {
433
+      // 不是快捷选择
434
+      this.defRange = null;
435
+    }
436
+    if (!result) {
437
+      this.startDate = this.endDate = "";
438
+      return;
439
+    }
440
+    this.endDate = format(endOfYear(result), 'yyyy-MM-dd');
441
+  }
442
+
443
+  // 日期选择 快速修改时间区间
444
+  today = new Date();
445
+  quick: boolean = false;
446
+  changeDateRange(res) {
447
+    console.log(res);
448
+    this.quick = true;
449
+    switch (res) {
450
+      case "1":
451
+        // 上周
452
+        let lastweekstartdate = this.dateService.date().lastWeekStartDate;
453
+        let lastweekenddate = this.dateService.date().lastWeekEndDate;
454
+        console.log(lastweekstartdate, lastweekenddate);
455
+        this.changeDate([lastweekstartdate, lastweekenddate]);
456
+        break;
457
+      case "2":
458
+        // 上月
459
+        let lastmonthstartdate = this.dateService.date().lastMonthStartDate;
460
+        let lastmonthenddate = this.dateService.date().lastMonthEndDate;
461
+        console.log(lastmonthstartdate, lastmonthenddate);
462
+        this.changeDate([lastmonthstartdate, lastmonthenddate]);
463
+        this.changeMonthStart(lastmonthstartdate);
464
+        this.changeMonthEnd(lastmonthenddate);
465
+        break;
466
+      case "3":
467
+        // 上年
468
+        let lastyearstartdate = this.dateService.date().lastYearStartDate;
469
+        let lastyearenddate = this.dateService.date().lastYearEndDate;
470
+        console.log(lastyearstartdate, lastyearenddate);
471
+        this.changeDate([lastyearstartdate, lastyearenddate]);
472
+        this.changeMonthStart(lastyearstartdate);
473
+        this.changeMonthEnd(lastyearenddate);
474
+        this.changeYearStart(lastyearstartdate);
475
+        this.changeYearEnd(lastyearenddate);
476
+        break;
477
+    }
478
+    this.quick = false;
479
+    this.search();
480
+  }
481
+
482
+  // 更多
483
+  toMore(type) {
484
+    let sendData = this.searchData;
485
+    console.log(sendData);
486
+    this.myService.sendMsg(sendData);
487
+    this.router.navigateByUrl("/main/" + type);
488
+  }
489
+
490
+  // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
491
+  showPromptModal(con, success, promptInfo?) {
492
+    this.promptModalShow = false;
493
+    this.promptContent = con;
494
+    this.ifSuccess = success;
495
+    this.promptInfo = promptInfo;
496
+    setTimeout(() => {
497
+      this.promptModalShow = true;
498
+    }, 100);
499
+  }
500
+
501
+  // 边输入边搜索节流阀
502
+  isLoading: boolean = false;
503
+  searchTimer(fun, e) {
504
+    this.isLoading = true;
505
+    this.searchTimerSubject.next([fun, e]);
506
+  }
507
+  // 列表排序
508
+  sortCurrent = {
509
+    totalTrip: null,
510
+    totalOrder: null,
511
+    getTrip: null,
512
+    getOrder: null,
513
+    getClothesNum: null,
514
+    sendTrip: null,
515
+    sendOrder: null,
516
+    sendClothesNum: null,
517
+    price: null,
518
+  };
519
+  sortCurrentKey: string = "";
520
+  sortCurrentValue: string | null = "";
521
+  sort(e) {
522
+    const { key, value } = e;
523
+    this.sortCurrentKey = key;
524
+    this.sortCurrentValue = value;
525
+    this.getList(this.pageIndex, this.sortCurrentKey, this.sortCurrentValue);
526
+  }
527
+}

+ 16 - 0
src/app/views/quilt-washing-personnel-statistics/quilt-washing-personnel-statistics.module.ts

@@ -0,0 +1,16 @@
1
+import { NgModule } from "@angular/core";
2
+import { CommonModule } from "@angular/common";
3
+
4
+import { QuiltWashingPersonnelStatisticsRoutingModule } from "./quilt-washing-personnel-statistics-routing.module";
5
+import { ShareModule } from "src/app/share/share.module";
6
+import { QuiltWashingPersonnelStatisticsComponent } from "./quilt-washing-personnel-statistics.component";
7
+
8
+@NgModule({
9
+  declarations: [QuiltWashingPersonnelStatisticsComponent],
10
+  imports: [
11
+    CommonModule,
12
+    QuiltWashingPersonnelStatisticsRoutingModule,
13
+    ShareModule,
14
+  ],
15
+})
16
+export class QuiltWashingPersonnelStatisticsModule {}

+ 13 - 0
src/app/views/quilt-washing-trend-analysis/quilt-washing-trend-analysis-routing.module.ts

@@ -0,0 +1,13 @@
1
+import { NgModule } from "@angular/core";
2
+import { Routes, RouterModule } from "@angular/router";
3
+import { QuiltWashingTrendAnalysisComponent } from "./quilt-washing-trend-analysis.component";
4
+
5
+const routes: Routes = [
6
+  { path: "", component: QuiltWashingTrendAnalysisComponent },
7
+];
8
+
9
+@NgModule({
10
+  imports: [RouterModule.forChild(routes)],
11
+  exports: [RouterModule],
12
+})
13
+export class QuiltWashingTrendAnalysisRoutingModule {}

+ 6 - 0
src/app/views/quilt-washing-trend-analysis/quilt-washing-trend-analysis.component.html

@@ -0,0 +1,6 @@
1
+<div class="quiltWashingTrendAnalysis">
2
+  <div class="main">
3
+    <div class="head"></div>
4
+    <div class="body"></div>
5
+  </div>
6
+</div>

+ 12 - 0
src/app/views/quilt-washing-trend-analysis/quilt-washing-trend-analysis.component.less

@@ -0,0 +1,12 @@
1
+@import "../../../../src/theme.less";
2
+
3
+:host {
4
+  .quiltWashingTrendAnalysis{
5
+    min-height: 100%;
6
+    background-color: #F1F2F2;
7
+    .main{
8
+      margin-left: 10px;
9
+      background: #000;
10
+    }
11
+  }
12
+}

+ 459 - 0
src/app/views/quilt-washing-trend-analysis/quilt-washing-trend-analysis.component.ts

@@ -0,0 +1,459 @@
1
+import { Component, OnInit } from "@angular/core";
2
+import { ActivatedRoute, Router } from "@angular/router";
3
+import { differenceInCalendarDays, endOfMonth, endOfYear, format, startOfMonth, startOfYear } from "date-fns";
4
+
5
+import { MainService } from "../../services/main.service";
6
+import { DateService } from "../../services/date.service";
7
+import { MyServiceService } from "../../services/my-service.service";
8
+import { ToolService } from "../../services/tool.service";
9
+
10
+@Component({
11
+  selector: "app-quilt-washing-trend-analysis",
12
+  templateUrl: "./quilt-washing-trend-analysis.component.html",
13
+  styleUrls: ["./quilt-washing-trend-analysis.component.less"],
14
+})
15
+export class QuiltWashingTrendAnalysisComponent implements OnInit {
16
+  constructor(
17
+    private route: ActivatedRoute,
18
+    private router: Router,
19
+    private mainService: MainService,
20
+    private dateService: DateService,
21
+    private myService: MyServiceService,
22
+    private tool: ToolService
23
+  ) {}
24
+
25
+  ngOnInit() {
26
+    this.coopBtns = this.tool.initCoopBtns(this.route);
27
+    this.getAllHos();
28
+    this.changeDateRange(this.defRange);
29
+    // this.search();
30
+  }
31
+
32
+  dateType: string = "day"; //选中时间维度
33
+  dateTypes: any = [
34
+    {
35
+      label: "按天统计",
36
+      value: "day",
37
+    },
38
+    {
39
+      label: "按月统计",
40
+      value: "month",
41
+    },
42
+    {
43
+      label: "按年统计",
44
+      value: "year",
45
+    },
46
+  ]; //时间维度
47
+  defRange = "1"; //默认上周
48
+  defRanges = [
49
+    {
50
+      label: "上周",
51
+      id: 1,
52
+    },
53
+    {
54
+      label: "上月",
55
+      id: 2,
56
+    },
57
+    {
58
+      label: "上年",
59
+      id: 3,
60
+    },
61
+  ]; //时间默认区间
62
+
63
+  listOfData: any[] = []; //表格数据
64
+  pageIndex: number = 1; //表格当前页码
65
+  pageSize: number = 10; //表格每页展示条数
66
+  listLength: number = 10; //表格总数据量
67
+
68
+  alldepart: any = []; //当前院区所属科室
69
+  dateRange: any = []; //发起时间区间 天
70
+  monthRangeStart: any; //发起时间 月 起
71
+  monthRangeEnd: any; //发起时间 月 止
72
+  yearRangeStart: any; //发起时间 年 起
73
+  yearRangeEnd: any; //发起时间 年 止
74
+
75
+  promptContent: string; //操作提示框提示信息
76
+  ifSuccess: boolean; //操作成功/失败
77
+  promptInfo: string; //操作结果提示信息
78
+  promptModalShow: boolean; //操作提示框是否展示
79
+
80
+  // 初始化增删改按钮
81
+  coopBtns: any = {};
82
+  searchData: any = {}; // 综合统计页面带过来的参数
83
+  getSearchData() {
84
+    let that = this;
85
+    let sub = that.myService.getMsg().subscribe((msg) => {
86
+      // 从综合报表跳转过来
87
+      that.searchData = msg;
88
+      console.log(that.searchData);
89
+      console.log(66);
90
+      sub.unsubscribe(); //取消订阅,否则订阅函数会累加执行
91
+      that.hospital = that.searchData["hosId"];
92
+      that.changeDate(that.searchData["range"]);
93
+      that.defRange = that.searchData["defRange"];
94
+      that.search();
95
+    });
96
+    that.changeDateRange(that.defRange);
97
+    that.search();
98
+  }
99
+  // 搜索
100
+  search(num?: number) {
101
+    if (this.hospital) {
102
+      this.searchData["hosId"] = this.hospital;
103
+    }
104
+    if (this.startDate) {
105
+      this.searchData["dateRange"] = {
106
+        start: this.startDate + " " + "00:00:00",
107
+        end: this.endDate + " " + "23:59:59",
108
+      };
109
+    }
110
+    if (num !== undefined) {
111
+      this.getList(num, this.sortCurrentKey, this.sortCurrentValue);
112
+    } else {
113
+      this.getList(this.pageIndex, this.sortCurrentKey, this.sortCurrentValue);
114
+    }
115
+  }
116
+  // 导出
117
+  loading2 = false;
118
+  export() {
119
+    let that = this;
120
+    let postData: any = {
121
+      startTime: this.startDate + " " + "00:00:00",
122
+      endTime: this.endDate + " " + "23:59:59",
123
+      hosId: that.hospital,
124
+      type: this.dateType,
125
+    };
126
+    if (this.sortCurrentKey && this.sortCurrentValue) {
127
+      postData.sort =
128
+        this.sortCurrentValue === "ascend"
129
+          ? this.sortCurrentKey
130
+          : `${this.sortCurrentKey} desc`;
131
+    }
132
+    this.loading2 = true;
133
+    that.mainService.exportReport("clothesHos", postData).subscribe(
134
+      (data) => {
135
+        this.loading2 = false;
136
+        this.showPromptModal("导出", true, "");
137
+        var file = new Blob([data], {
138
+          type: "application/vnd.ms-excel",
139
+        });
140
+        //trick to download store a file having its URL
141
+        var fileURL = URL.createObjectURL(file);
142
+        var a = document.createElement("a");
143
+        a.href = fileURL;
144
+        a.target = "_blank";
145
+        a.download = "全员统计.xls";
146
+        document.body.appendChild(a);
147
+        a.click();
148
+      },
149
+      (err) => {
150
+        this.loading2 = false;
151
+        this.showPromptModal("导出", false, "");
152
+      }
153
+    );
154
+  }
155
+  // 重置
156
+  reset() {
157
+    this.changeDateType("day");
158
+    this.changeDateRange("1");
159
+    this.sortCurrentKey = "";
160
+    this.sortCurrentValue = "";
161
+    this.sortCurrent = {
162
+      deptNum: null,
163
+      clothesTypeNum: null,
164
+      getOrder: null,
165
+      sendOrder: null,
166
+      sendClothesNum: null,
167
+      price: null,
168
+    };
169
+    this.search();
170
+  }
171
+  // 表格数据
172
+  loading1 = false;
173
+  getList(num?: number, field?: string, sort?: string) {
174
+    this.pageIndex = num;
175
+    let postData: any = {
176
+      idx: this.pageIndex - 1,
177
+      sum: this.pageSize,
178
+      startTime: this.searchData.dateRange.start,
179
+      endTime: this.searchData.dateRange.end,
180
+      hosId: this.searchData.hosId,
181
+      type: this.dateType,
182
+    };
183
+    if (field && sort) {
184
+      postData.sort = sort === "ascend" ? field : `${field} desc`;
185
+    }
186
+    this.loading1 = true;
187
+    this.mainService
188
+      .postCustom("report/clothes", "hospital", postData)
189
+      .subscribe((result) => {
190
+        this.loading1 = false;
191
+        this.listOfData = result.list || [];
192
+        this.listLength = result.totalNum;
193
+      });
194
+  }
195
+  // 获取院区
196
+  hospital: string; //选中院区
197
+  getAllHos() {
198
+    this.hospital = this.tool.getCurrentHospital().id + "";
199
+  }
200
+
201
+  // 修改时间展示维度
202
+  changeDateType(res) {
203
+    console.log(res, this.dateType);
204
+    this.dateType = res;
205
+    this.searchData["type"] = res;
206
+    console.log(this.searchData);
207
+    switch (res) {
208
+      case "day":
209
+        this.defRanges = [
210
+          {
211
+            label: "上周",
212
+            id: 1,
213
+          },
214
+          {
215
+            label: "上月",
216
+            id: 2,
217
+          },
218
+          {
219
+            label: "上年",
220
+            id: 3,
221
+          },
222
+        ]; //时间默认区间
223
+        this.defRange = "1"; //默认上周
224
+        this.changeDateRange("1");
225
+        break;
226
+      case "month":
227
+        this.defRanges = [
228
+          {
229
+            label: "上月",
230
+            id: 2,
231
+          },
232
+          {
233
+            label: "上年",
234
+            id: 3,
235
+          },
236
+        ]; //时间默认区间
237
+        this.defRange = "2"; //上月
238
+        this.changeDateRange("2");
239
+        break;
240
+      case "year":
241
+        this.defRanges = [
242
+          {
243
+            label: "上年",
244
+            id: 3,
245
+          },
246
+        ]; //时间默认区间
247
+        this.defRange = "3"; //默认上周
248
+        this.changeDateRange("3");
249
+        break;
250
+    }
251
+  }
252
+
253
+  // 禁选日期
254
+  disabledDate = (current: Date): boolean => {
255
+    // Can not select days before today and today
256
+    return differenceInCalendarDays(current, this.today) > 0;
257
+  };
258
+
259
+  // 禁选月份开始
260
+  disabledMonthStart = (current: Date): boolean => {
261
+    // Can not select days before today and today
262
+    let cur = differenceInCalendarDays(current, endOfMonth(this.today)) > 0;
263
+    let staEnd = differenceInCalendarDays(current, this.monthRangeEnd) > 0;
264
+    return cur || staEnd;
265
+  };
266
+  // 禁选月份结束
267
+  disabledMonthEnd = (current: Date): boolean => {
268
+    // Can not select days before today and today
269
+    let cur = differenceInCalendarDays(current, endOfMonth(this.today)) > 0;
270
+    let staEnd = differenceInCalendarDays(this.monthRangeStart, current) > 0;
271
+    return cur || staEnd;
272
+  };
273
+
274
+  // 禁选年份开始
275
+  disabledYearStart = (current: Date): boolean => {
276
+    // Can not select days before today and today
277
+    let cur = differenceInCalendarDays(current, endOfYear(this.today)) > 0;
278
+    let staEnd = differenceInCalendarDays(current, this.yearRangeEnd) > 0;
279
+    return cur || staEnd;
280
+  };
281
+
282
+  // 禁选年份结束
283
+  disabledYearEnd = (current: Date): boolean => {
284
+    // Can not select days before today and today
285
+    let cur = differenceInCalendarDays(current, endOfYear(this.today)) > 0;
286
+    let staEnd = differenceInCalendarDays(this.yearRangeStart, current) > 0;
287
+    return cur || staEnd;
288
+  };
289
+
290
+  // 日期选择 日
291
+  startDate: string; //发起时间开始
292
+  endDate: string; //发起时间结束
293
+  changeDate(result?): void {
294
+    console.log(this.dateRange);
295
+    console.log(result);
296
+    this.dateRange = result;
297
+    if (!this.quick) {
298
+      // 不是快捷选择
299
+      this.defRange = null;
300
+    }
301
+    if (!result || !result.length) {
302
+      this.startDate = this.endDate = "";
303
+      return;
304
+    }
305
+    this.startDate =
306
+      result[0].getFullYear() +
307
+      "-" +
308
+      (result[0].getMonth() + 1) +
309
+      "-" +
310
+      result[0].getDate();
311
+    this.endDate =
312
+      result[1].getFullYear() +
313
+      "-" +
314
+      (result[1].getMonth() + 1) +
315
+      "-" +
316
+      result[1].getDate();
317
+  }
318
+
319
+  // 月份选择
320
+  changeMonthStart(result?) {
321
+    console.log(result);
322
+    this.monthRangeStart = result;
323
+    if (!this.quick) {
324
+      // 不是快捷选择
325
+      this.defRange = null;
326
+    }
327
+    if (!result) {
328
+      this.startDate = this.endDate = "";
329
+      return;
330
+    }
331
+    this.startDate = format(startOfMonth(result), 'yyyy-MM-dd');
332
+    // this.endDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
333
+  }
334
+  changeMonthEnd(result?) {
335
+    console.log(result);
336
+    this.monthRangeEnd = result;
337
+    if (!this.quick) {
338
+      // 不是快捷选择
339
+      this.defRange = null;
340
+    }
341
+    if (!result) {
342
+      this.startDate = this.endDate = "";
343
+      return;
344
+    }
345
+    // this.startDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
346
+    this.endDate = format(endOfMonth(result), 'yyyy-MM-dd');
347
+  }
348
+  // 年份选择
349
+  changeYearStart(result?) {
350
+    console.log(result);
351
+    this.yearRangeStart = result;
352
+    if (!this.quick) {
353
+      // 不是快捷选择
354
+      this.defRange = null;
355
+    }
356
+    if (!result) {
357
+      this.startDate = this.endDate = "";
358
+      return;
359
+    }
360
+    this.startDate = format(startOfYear(result), 'yyyy-MM-dd');
361
+    // this.endDate = result.getFullYear() + '-01-01';
362
+  }
363
+  changeYearEnd(result?) {
364
+    console.log(result);
365
+    this.yearRangeEnd = result;
366
+    if (!this.quick) {
367
+      // 不是快捷选择
368
+      this.defRange = null;
369
+    }
370
+    if (!result) {
371
+      this.startDate = this.endDate = "";
372
+      return;
373
+    }
374
+    this.endDate = format(endOfYear(result), 'yyyy-MM-dd');
375
+  }
376
+
377
+  // 日期选择 快速修改时间区间
378
+  today = new Date();
379
+  quick: boolean = false;
380
+  changeDateRange(res) {
381
+    console.log(res);
382
+    this.quick = true;
383
+    switch (res) {
384
+      case "1":
385
+        // 上周
386
+        let lastweekstartdate = this.dateService.date().lastWeekStartDate;
387
+        let lastweekenddate = this.dateService.date().lastWeekEndDate;
388
+        console.log(lastweekstartdate, lastweekenddate);
389
+        this.changeDate([lastweekstartdate, lastweekenddate]);
390
+        break;
391
+      case "2":
392
+        // 上月
393
+        let lastmonthstartdate = this.dateService.date().lastMonthStartDate;
394
+        let lastmonthenddate = this.dateService.date().lastMonthEndDate;
395
+        console.log(lastmonthstartdate, lastmonthenddate);
396
+        this.changeDate([lastmonthstartdate, lastmonthenddate]);
397
+        this.changeMonthStart(lastmonthstartdate);
398
+        this.changeMonthEnd(lastmonthenddate);
399
+        break;
400
+      case "3":
401
+        // 上年
402
+        let lastyearstartdate = this.dateService.date().lastYearStartDate;
403
+        let lastyearenddate = this.dateService.date().lastYearEndDate;
404
+        console.log(lastyearstartdate, lastyearenddate);
405
+        this.changeDate([lastyearstartdate, lastyearenddate]);
406
+        this.changeMonthStart(lastyearstartdate);
407
+        this.changeMonthEnd(lastyearenddate);
408
+        this.changeYearStart(lastyearstartdate);
409
+        this.changeYearEnd(lastyearenddate);
410
+        break;
411
+    }
412
+    this.quick = false;
413
+    this.search();
414
+  }
415
+
416
+  // 更多
417
+  toMore(type) {
418
+    let sendData = this.searchData;
419
+    console.log(sendData);
420
+    this.myService.sendMsg(sendData);
421
+    this.router.navigateByUrl("/main/" + type);
422
+  }
423
+
424
+  // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
425
+  showPromptModal(con, success, promptInfo?) {
426
+    this.promptModalShow = false;
427
+    this.promptContent = con;
428
+    this.ifSuccess = success;
429
+    this.promptInfo = promptInfo;
430
+    setTimeout(() => {
431
+      this.promptModalShow = true;
432
+    }, 100);
433
+  }
434
+
435
+  // 边输入边搜索节流阀
436
+  isLoading: boolean = false;
437
+  searchTimer(fun, e, those) {
438
+    let that = this;
439
+    that.isLoading = true;
440
+    fun(e, those);
441
+  }
442
+  // 列表排序
443
+  sortCurrent = {
444
+    deptNum: null,
445
+    clothesTypeNum: null,
446
+    getOrder: null,
447
+    sendOrder: null,
448
+    sendClothesNum: null,
449
+    price: null,
450
+  };
451
+  sortCurrentKey: string = "";
452
+  sortCurrentValue: string | null = "";
453
+  sort(e) {
454
+    const { key, value } = e;
455
+    this.sortCurrentKey = key;
456
+    this.sortCurrentValue = value;
457
+    this.getList(this.pageIndex, this.sortCurrentKey, this.sortCurrentValue);
458
+  }
459
+}

+ 16 - 0
src/app/views/quilt-washing-trend-analysis/quilt-washing-trend-analysis.module.ts

@@ -0,0 +1,16 @@
1
+import { NgModule } from "@angular/core";
2
+import { CommonModule } from "@angular/common";
3
+
4
+import { QuiltWashingTrendAnalysisRoutingModule } from "./quilt-washing-trend-analysis-routing.module";
5
+import { ShareModule } from "src/app/share/share.module";
6
+import { QuiltWashingTrendAnalysisComponent } from "./quilt-washing-trend-analysis.component";
7
+
8
+@NgModule({
9
+  declarations: [QuiltWashingTrendAnalysisComponent],
10
+  imports: [
11
+    CommonModule,
12
+    QuiltWashingTrendAnalysisRoutingModule,
13
+    ShareModule,
14
+  ],
15
+})
16
+export class QuiltWashingTrendAnalysisModule {}

+ 2 - 0
src/common.less

@@ -253,6 +253,8 @@
253 253
         display: flex;
254 254
         justify-content: flex-end;
255 255
         align-items: center;
256
+        flex-wrap: wrap;
257
+        row-gap: 8px;
256 258
       }
257 259
     }
258 260
     .list-template__checkBoxes {