office-detail.component.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { Component, OnInit } from "@angular/core";
  2. import { Router, ActivatedRoute } from "@angular/router";
  3. import { NzMessageService } from "ng-zorro-antd";
  4. import { MainService } from "../../services/main.service";
  5. @Component({
  6. selector: "app-office-detail",
  7. templateUrl: "./office-detail.component.html",
  8. styleUrls: ["./office-detail.component.less"],
  9. })
  10. export class OfficeDetailComponent implements OnInit {
  11. constructor(
  12. private message: NzMessageService,
  13. private router: Router,
  14. private mainService: MainService,
  15. private routerInfo: ActivatedRoute
  16. ) {}
  17. id: number;
  18. officeInfo: any = {};
  19. ngOnInit() {
  20. this.getDetail();
  21. }
  22. hideModal() {
  23. this.router.navigateByUrl("/main/officeManagement");
  24. }
  25. // 获取详情
  26. maskFlag: any = false;
  27. getDetail() {
  28. this.id = this.routerInfo.snapshot.params["id"];
  29. this.maskFlag = this.message.loading("正在加载中..", {
  30. nzDuration: 0,
  31. }).messageId;
  32. this.mainService
  33. .getFetchData("data", "department", this.id)
  34. .subscribe((data) => {
  35. this.message.remove(this.maskFlag);
  36. this.maskFlag = false;
  37. this.officeInfo = data.data;
  38. });
  39. }
  40. }