소스 검색

统合统计页面添加

maotao 1 개월 전
부모
커밋
b0abd4cbaf

+ 9 - 0
src/app/views/new-statistics/maintenance-statistics/maintenance-statistics-routing.module.ts

@@ -8,6 +8,15 @@ const routes: Routes = [
8 8
     path: '',
9 9
     component: MaintenanceStatisticsComponent,
10 10
     children: [
11
+			{
12
+			  // 综合统计
13
+			  path: 'synthesizeStatistics',
14
+			  loadChildren: () => import('./synthesize-statistics/synthesize-statistics.module').then(m => m.SynthesizeStatisticsModule),
15
+			  data: {
16
+			    reuse: true,
17
+			    title: '综合统计'
18
+			  }
19
+			},
11 20
       {
12 21
         // 故障工单统计
13 22
         path: 'incidentStatistics',

+ 14 - 0
src/app/views/new-statistics/maintenance-statistics/synthesize-statistics/synthesize-statistics-routing.module.ts

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

+ 49 - 0
src/app/views/new-statistics/maintenance-statistics/synthesize-statistics/synthesize-statistics.component.html

@@ -0,0 +1,49 @@
1
+<div class="searchDataWrap">
2
+  <div class="searchData">
3
+    <div class="searchDataItem">
4
+      <span class="label">建单时间</span>:
5
+      <nz-range-picker [(ngModel)]="dateRange" [nzAllowClear]="false" (ngModelChange)="changeDate($event)" (nzOnCalendarChange)="onCalendarChangeDate($event)">
6
+      </nz-range-picker>
7
+    </div>
8
+  </div>
9
+  <div class="operation">
10
+    <button nz-button class="btn default" (click)="search(1)">搜索</button>
11
+    <button nz-button class="btn default ml8" (click)="excelExport()">导出</button>
12
+    <button nz-button class="btn default ml8" (click)="reset()">重置</button>
13
+  </div>
14
+</div>
15
+<nz-table [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false" [nzLoading]="loading1">
16
+  <thead (nzSortChange)="sort($event)" nzSingleSort>
17
+    <tr>
18
+      <th nzWidth="10%" nzShowSort nzSortKey="startDate" [(nzSort)]="sortCurrent.startDate">时间</th>
19
+      <th nzWidth="9%" nzShowSort nzSortKey="sum" [(nzSort)]="sortCurrent.sum">工单总数</th>
20
+      <th nzWidth="9%" nzShowSort nzSortKey="avgResponseTime" [(nzSort)]="sortCurrent.avgResponseTime">平均响应时间</th>
21
+      <th nzWidth="9%" nzShowSort nzSortKey="avgResolvedTime" [(nzSort)]="sortCurrent.avgResolvedTime">平均解决时间</th>
22
+      <th nzWidth="9%" nzShowSort nzSortKey="resolvedOverNum" [(nzSort)]="sortCurrent.resolvedOverNum">超时单数</th>
23
+      <th nzWidth="9%" nzShowSort nzSortKey="overTimeNum" [(nzSort)]="sortCurrent.overTimeNum">挂起单数</th>
24
+      <th nzWidth="9%" nzShowSort nzSortKey="consumablePrice" [(nzSort)]="sortCurrent.consumablePrice">耗材费用(元)</th>
25
+      <th nzWidth="9%" nzShowSort nzSortKey="workHourPrice" [(nzSort)]="sortCurrent.workHourPrice">工时费用(元)</th>
26
+      <th nzWidth="9%" nzShowSort nzSortKey="totalPrice" [(nzSort)]="sortCurrent.totalPrice">总费用(元)</th>
27
+      <th nzWidth="9%" nzShowSort nzSortKey="negativeNum" [(nzSort)]="sortCurrent.negativeNum">差评单数</th>
28
+      <th nzWidth="9%" nzShowSort nzSortKey="favorableRate" [(nzSort)]="sortCurrent.favorableRate">好评率</th>
29
+    </tr>
30
+  </thead>
31
+  <tbody>
32
+    <tr *ngFor="let data of listOfData; let index = index">
33
+      <td>{{ data.startDate }}</td>
34
+      <td>{{ data.sum }}</td>
35
+      <td>{{ data.avgResponseTime }}</td>
36
+      <td>{{ data.avgResolvedTime }}</td>
37
+      <td>{{ data.resolvedOverNum }}</td>
38
+      <td>{{ data.overTimeNum }}</td>
39
+      <td>{{ data.consumablePrice }}</td>
40
+      <td>{{ data.workHourPrice }}</td>
41
+      <td>{{ data.totalPrice }}</td>
42
+      <td>{{ data.negativeNum }}</td>
43
+      <td>{{ data.favorableRate }}</td>
44
+    </tr>
45
+  </tbody>
46
+</nz-table>
47
+<div>
48
+  <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" nzShowSizeChanger [(nzPageSize)]="pageSize" (nzPageIndexChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)" (nzPageSizeChange)="getList(pageIndex, sortCurrentKey, sortCurrentValue)"></nz-pagination>
49
+</div>

+ 21 - 0
src/app/views/new-statistics/maintenance-statistics/synthesize-statistics/synthesize-statistics.component.less

@@ -0,0 +1,21 @@
1
+@import "../../../../../../src/theme.less";
2
+:host{
3
+  position: absolute;
4
+  top: 0;
5
+  right: 0;
6
+  bottom: 0;
7
+  left: 0;
8
+  .searchDataWrap{
9
+    display: flex;
10
+    align-items: center;
11
+    justify-content: space-between;
12
+    .searchData{
13
+      padding: 16px;
14
+      .searchDataItem{
15
+        .label{
16
+          font-size: 16px;
17
+        }
18
+      }
19
+    }
20
+  }
21
+}

+ 131 - 0
src/app/views/new-statistics/maintenance-statistics/synthesize-statistics/synthesize-statistics.component.ts

@@ -0,0 +1,131 @@
1
+import { format, addMonths, startOfMonth, endOfMonth } from 'date-fns';
2
+import { Component, OnInit } from "@angular/core";
3
+import { MainService } from 'src/app/services/main.service';
4
+@Component({
5
+  selector: "app-synthesize-statistics",
6
+  templateUrl: "./synthesize-statistics.component.html",
7
+  styleUrls: ["./synthesize-statistics.component.less"],
8
+})
9
+export class SynthesizeStatisticsComponent implements OnInit {
10
+  constructor(
11
+    private mainService: MainService,
12
+  ) {}
13
+
14
+  listOfData: any[] = []; //表格数据
15
+  pageIndex: number = 1; //表格当前页码
16
+  pageSize: number = 10; //表格每页展示条数
17
+  listLength: number = 10; //表格总数据量
18
+
19
+  ngOnInit() {
20
+    this.initSessionData();
21
+    this.search();
22
+  }
23
+
24
+  // 初始化缓存数据
25
+  queryType:any;
26
+  hosId:any;
27
+  dutyId:any;
28
+  parentDutyId:any;
29
+  initSessionData(){
30
+    let maintenanceStatistics = JSON.parse(sessionStorage.getItem('maintenanceStatistics'));
31
+    let queryType:any = maintenanceStatistics.queryType;
32
+    let hosId:any = maintenanceStatistics.hospitalId;
33
+    let dutyId:any = maintenanceStatistics.dutyId;
34
+
35
+    queryType = queryType ? +queryType : undefined;
36
+    hosId = hosId ? +hosId : undefined;
37
+    dutyId = dutyId ? +dutyId : undefined;
38
+
39
+    this.queryType = queryType;
40
+    if(queryType == 1){
41
+      this.hosId = undefined;
42
+      this.dutyId = undefined;
43
+      this.parentDutyId = undefined;
44
+    }else if(queryType == 2){
45
+      this.hosId = hosId;
46
+      this.dutyId = undefined;
47
+      this.parentDutyId = undefined;
48
+    }else if(queryType == 3){
49
+      this.hosId = undefined;
50
+      this.dutyId = dutyId;
51
+      this.parentDutyId = undefined;
52
+    }else if(queryType == 4){
53
+      this.hosId = undefined;
54
+      this.dutyId = undefined;
55
+      this.parentDutyId = dutyId;
56
+    }
57
+  }
58
+
59
+  // 表格数据
60
+  loading1 = false;
61
+  getList(num?: number, field?: string, sort?: string) {
62
+    if (num !== undefined) {
63
+      this.pageIndex = num;
64
+    }
65
+    let postData:any = {
66
+      idx: this.pageIndex - 1,
67
+      sum: this.pageSize,
68
+      startDate: this.dateRange[0],
69
+      endDate: this.dateRange[1],
70
+      hosId: this.hosId,
71
+      dutyId: this.dutyId,
72
+      parentDutyId: this.parentDutyId,
73
+    };
74
+    if (field && sort) {
75
+      postData.sort = `${field} ${sort === "ascend" ? `asc` : `desc`}`
76
+    }
77
+    this.loading1 = true;
78
+    this.mainService
79
+      .postCustom("itsm/report", "incidentWorkOrder", postData)
80
+      .subscribe((result) => {
81
+        this.loading1 = false;
82
+        this.listOfData = result.dataList || [];
83
+        this.listLength = result.totalCount;
84
+      });
85
+  }
86
+
87
+  // 列表排序
88
+  sortCurrent = {};
89
+  sortCurrentKey: string = "";
90
+  sortCurrentValue: string | null = "";
91
+  sort(e) {
92
+    const { key, value } = e;
93
+    this.sortCurrentKey = key;
94
+    this.sortCurrentValue = value;
95
+    this.getList(this.pageIndex, this.sortCurrentKey, this.sortCurrentValue);
96
+  }
97
+
98
+  // 搜索
99
+  search(num?: number) {
100
+    if (num !== undefined) {
101
+      this.getList(num, this.sortCurrentKey, this.sortCurrentValue);
102
+    } else {
103
+      this.getList(this.pageIndex, this.sortCurrentKey, this.sortCurrentValue);
104
+    }
105
+  }
106
+
107
+  // 日期选择 日
108
+  dateRange: any = [format(startOfMonth(addMonths(new Date(), -2)), 'yyyy-MM-dd HH:mm:ss'), format(endOfMonth(addMonths(new Date(), -1)), 'yyyy-MM-dd HH:mm:ss')]; //发起时间区间 天
109
+  changeDate(result?): void {
110
+    console.log(this.dateRange);
111
+    console.log(result);
112
+    result[0] = format(result[0], 'yyyy-MM-dd HH:mm:ss');
113
+    result[1] = format(result[1], 'yyyy-MM-dd HH:mm:ss');
114
+    this.dateRange = result;
115
+    this.search();
116
+  }
117
+
118
+  onCalendarChangeDate(dateArr){
119
+    console.log(dateArr)
120
+    if(dateArr.length == 2){
121
+      let dateStart = new Date(dateArr[0]);
122
+      let dateEnd = new Date(dateArr[1]);
123
+      dateStart.setHours(0,0,0);
124
+      dateEnd.setHours(23,59,59);
125
+      this.dateRange = [dateStart,dateEnd];
126
+    }
127
+  }
128
+
129
+  excelExport(){}
130
+  reset(){}
131
+}

+ 21 - 0
src/app/views/new-statistics/maintenance-statistics/synthesize-statistics/synthesize-statistics.module.ts

@@ -0,0 +1,21 @@
1
+import { SynthesizeStatisticsComponent } from './synthesize-statistics.component';
2
+import { NgModule } from '@angular/core';
3
+import { CommonModule } from '@angular/common';
4
+
5
+import { SynthesizeStatisticsRoutingModule } from './synthesize-statistics-routing.module';
6
+import { ShareModule } from 'src/app/share/share.module';
7
+import { VirtualScrollerModule } from 'ngx-virtual-scroller';
8
+
9
+
10
+@NgModule({
11
+  declarations: [
12
+    SynthesizeStatisticsComponent,
13
+  ],
14
+  imports: [
15
+    CommonModule,
16
+    SynthesizeStatisticsRoutingModule,
17
+    ShareModule,
18
+    VirtualScrollerModule,
19
+  ]
20
+})
21
+export class SynthesizeStatisticsModule { }