work-order-log.component.ts 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import { Component, OnInit, ViewChild } from "@angular/core";
  2. import { ActivatedRoute } from "@angular/router";
  3. import { OverlayScrollbarsComponent } from "overlayscrollbars-ngx";
  4. import { ToolService } from "../../services/tool.service";
  5. import { WorkOrderLogService } from './work-order-log.service';
  6. @Component({
  7. selector: "app-work-order-log",
  8. templateUrl: "./work-order-log.component.html",
  9. styleUrls: ["./work-order-log.component.less"],
  10. })
  11. export class WorkOrderLogComponent implements OnInit {
  12. @ViewChild("osComponentRef1", {
  13. read: OverlayScrollbarsComponent,
  14. static: false,
  15. })
  16. osComponentRef1: OverlayScrollbarsComponent;
  17. constructor(
  18. private route: ActivatedRoute,
  19. private tool: ToolService,
  20. private workOrderLogService: WorkOrderLogService,
  21. ) {}
  22. listOfData: any[] = []; //表格数据
  23. hosId: any; //院区(搜索)
  24. pageIndex: number = 1; //页码
  25. listLength: number = 10; //总条数
  26. pageSize: number = 10; //每页条数
  27. // 初始化增删改按钮
  28. coopBtns: any = {};
  29. ngOnInit() {
  30. this.coopBtns = this.tool.initCoopBtns(this.route);
  31. this.hosId = this.tool.getCurrentHospital().id;
  32. this.getList(true);
  33. }
  34. // 搜索
  35. search() {
  36. this.getList(true);
  37. }
  38. // 表格数据
  39. loading1 = false;
  40. getList(isResetPageIndex = false) {
  41. isResetPageIndex && (this.pageIndex = 1);
  42. let data = {
  43. pageIndex: this.pageIndex,
  44. pageSize: this.pageSize,
  45. hosId: this.hosId,
  46. };
  47. this.loading1 = true;
  48. this.workOrderLogService
  49. .query(data)
  50. .subscribe((result) => {
  51. this.loading1 = false;
  52. result.list = result.list || [];
  53. result.list.forEach(v => {
  54. // todo
  55. })
  56. this.listOfData = result.list;
  57. this.listLength = result.totalNum;
  58. });
  59. }
  60. }