import { Component, OnInit, ViewChild } from "@angular/core"; import { ActivatedRoute } from "@angular/router"; import { OverlayScrollbarsComponent } from "overlayscrollbars-ngx"; import { ToolService } from "../../services/tool.service"; import { WorkOrderLogService } from './work-order-log.service'; @Component({ selector: "app-work-order-log", templateUrl: "./work-order-log.component.html", styleUrls: ["./work-order-log.component.less"], }) export class WorkOrderLogComponent implements OnInit { @ViewChild("osComponentRef1", { read: OverlayScrollbarsComponent, static: false, }) osComponentRef1: OverlayScrollbarsComponent; constructor( private route: ActivatedRoute, private tool: ToolService, private workOrderLogService: WorkOrderLogService, ) {} listOfData: any[] = []; //表格数据 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); } // 表格数据 loading1 = false; getList(isResetPageIndex = false) { isResetPageIndex && (this.pageIndex = 1); let data = { pageIndex: this.pageIndex, pageSize: this.pageSize, hosId: this.hosId, }; this.loading1 = true; this.workOrderLogService .query(data) .subscribe((result) => { this.loading1 = false; result.list = result.list || []; result.list.forEach(v => { // todo }) this.listOfData = result.list; this.listLength = result.totalNum; }); } }