dialog-delete.component.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import { Component, EventEmitter, Input, OnInit, Output } from "@angular/core";
  2. @Component({
  3. selector: "app-dialog-delete",
  4. templateUrl: "./dialog-delete.component.html",
  5. styleUrls: ["./dialog-delete.component.less"],
  6. })
  7. export class DialogDeleteComponent implements OnInit {
  8. @Output() hideDelModalEvent = new EventEmitter<any>();
  9. @Output() confirmDelEvent = new EventEmitter<any>();
  10. @Output() cancelDelEvent = new EventEmitter<any>();
  11. @Input() btnLoading: boolean = false;
  12. @Input() cancenlLoading: boolean = false;
  13. @Input() delModal: boolean = false;
  14. @Input() content: string = "您确定要删除吗?";
  15. @Input() tips: string = "";
  16. @Input() confirmTxt: string = "确定";
  17. @Input() cancelTxt: string = "取消";
  18. @Input() isChecked: boolean = false;
  19. constructor() {}
  20. isRemandClean:boolean = true;
  21. ngOnInit() {}
  22. // 隐藏
  23. hideDelModal(e: string) {
  24. this.hideDelModalEvent.emit(e);
  25. }
  26. // 确认删除
  27. confirmDel() {
  28. this.confirmDelEvent.emit(this.isChecked ? this.isRemandClean : false);
  29. }
  30. cancel(type: string) {
  31. if (type == "cancel") {
  32. //取消
  33. this.hideDelModal("cancel");
  34. } else if (type == "no") {
  35. //否
  36. this.cancelDelEvent.emit();
  37. }
  38. }
  39. }