123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- import { Component, OnInit, ViewChild } from "@angular/core";
- import { ActivatedRoute, Router } from "@angular/router";
- import { OverlayScrollbarsComponent } from "overlayscrollbars-ngx";
- import { ToolService } from "../../services/tool.service";
- import { format, startOfDay, endOfDay, previousMonday, previousSunday } from 'date-fns';
- import { DeptInspectionRateStatisticsService } from './dept-inspection-rate-statistics.service';
- @Component({
- selector: "app-dept-inspection-rate-statistics",
- templateUrl: "./dept-inspection-rate-statistics.component.html",
- styleUrls: ["./dept-inspection-rate-statistics.component.less"],
- })
- export class DeptInspectionRateStatisticsComponent implements OnInit {
- @ViewChild("osComponentRef1", {
- read: OverlayScrollbarsComponent,
- static: false,
- })
- osComponentRef1: OverlayScrollbarsComponent;
- constructor(
- private router: Router,
- private route: ActivatedRoute,
- private tool: ToolService,
- private deptInspectionRateStatisticsService: DeptInspectionRateStatisticsService,
- ) {}
- listOfData: any[] = []; //表格数据
- searchDto: any = {
- dateRange: [previousMonday(new Date()), previousSunday(new Date())],
- }
- hosId: any; //院区(搜索)
- pageIndex: number = 1; //页码
- listLength: number = 10; //总条数
- pageSize: number = 10; //每页条数
- // 初始化增删改按钮
- coopBtns: any = {};
- ngOnInit() {
- this.coopBtns = this.tool.initCoopBtns(this.route);
- this.hosId = this.tool.getCurrentHospital().id;
- this.getList(true);
- }
- // 搜索
- search() {
- this.getList(true);
- }
- // 重置
- reset() {
- this.searchDto = {
- dateRange: [previousMonday(new Date()), previousSunday(new Date())],
- }
- this.search();
- }
- // 表格数据
- loading1 = false;
- getList(isResetPageIndex = false) {
- isResetPageIndex && (this.pageIndex = 1);
- let postData:any = {
- idx: this.pageIndex - 1,
- sum: this.pageSize,
- hosId: this.hosId,
- startTime: this.searchDto.dateRange[0] ? format(startOfDay(this.searchDto.dateRange[0]), 'yyyy-MM-dd HH:mm:ss') : undefined,
- endTime: this.searchDto.dateRange[1] ? format(endOfDay(this.searchDto.dateRange[1]), 'yyyy-MM-dd HH:mm:ss') : undefined,
- };
- this.loading1 = true;
- this.deptInspectionRateStatisticsService
- .query(postData)
- .subscribe((result) => {
- this.loading1 = false;
- result.list = result.list || [];
- this.listOfData = result.list;
- this.listLength = result.totalNum;
- });
- }
- // 查看业务数据
- businessDataModalShow = false; //业务数据弹窗开关
- businessDataModalType = ''; //业务数据类型
- dataInfo = null; //查看业务数据携带
- viewDetail(data, type) {
- this.dataInfo = data;
- this.businessDataModalType = type;
- this.businessDataModalShow = true;
- }
- // 关闭业务数据弹窗
- closeModelBlood(e) {
- this.businessDataModalShow = JSON.parse(e).show;
- }
- personDetail(dataInfo){
- let startDate = dataInfo.searchDto.dateRange[0] ? format(startOfDay(dataInfo.searchDto.dateRange[0]), 'yyyy-MM-dd HH:mm:ss') : 'null';
- let endDate = dataInfo.searchDto.dateRange[1] ? format(endOfDay(dataInfo.searchDto.dateRange[1]), 'yyyy-MM-dd HH:mm:ss') : 'null';
- let deptId = dataInfo.data.deptId || 'null';
- this.router.navigateByUrl(
- `/main/deptInspectionRateStatistics/workerStatisticsDetail/null/${startDate}/${endDate}/null/deptInspectionRateStatistics/${deptId}`
- );
- }
- }
|