12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- import { Component, EventEmitter, Input, OnInit, Output, OnChanges, SimpleChanges } from "@angular/core";
- import { NzMessageService } from 'ng-zorro-antd';
- @Component({
- selector: "app-dialog-delete",
- templateUrl: "./dialog-delete.component.html",
- styleUrls: ["./dialog-delete.component.less"],
- })
- export class DialogDeleteComponent implements OnInit, OnChanges {
- @Output() hideDelModalEvent = new EventEmitter<any>();
- @Output() confirmDelEvent = new EventEmitter<any>();
- @Output() cancelDelEvent = new EventEmitter<any>();
- @Input() btnLoading: boolean = false;
- @Input() cancenlLoading: boolean = false;
- @Input() delModal: boolean = false;
- @Input() content: string = "您确定要删除吗?";
- @Input() tips: string = "";
- @Input() confirmTxt: string = "确定";
- @Input() cancelTxt: string = "取消";
- @Input() isChecked: boolean = false;
- @Input() isSelected: boolean = false;
- @Input() isSelectedArr: any[] = [];
- @Input() deptDisplay: number = 0;
- @Input() isShowConfirm: boolean = true;
- @Input() isShowConfirmInfo: string = '';
- constructor(private message: NzMessageService) {}
- isRemandClean:boolean = true;
- isLoading:boolean = false;
- recoveryRoom:any = null;
- ngOnInit() {}
- ngOnChanges(changes: SimpleChanges){
- if(changes.delModal && changes.delModal.currentValue){
- this.isRemandClean = true;
- this.isLoading = false;
- this.recoveryRoom = null;
- }
- if(changes.isSelected && changes.isSelectedArr){
- if(changes.isSelectedArr.currentValue.length === 1){
- this.recoveryRoom = changes.isSelectedArr.currentValue[0].id;
- }
- }
- }
- // 隐藏
- hideDelModal(e: string) {
- this.hideDelModalEvent.emit(e);
- }
- // 确认删除
- confirmDel() {
- // 如何送回苏醒室开启,并且未选择苏醒室
- if(this.isSelected && !this.recoveryRoom){
- this.message.info('请选择苏醒科室!');
- return;
- }
- let data:any = {};
- if(this.isChecked){
- data.isRemandClean = this.isRemandClean;
- }
- if(this.isSelected){
- data.recoveryRoom = this.recoveryRoom;
- }
- this.confirmDelEvent.emit(data);
- }
- // 取消|否
- cancel(type: string) {
- if (type == "cancel") {
- //取消
- this.hideDelModal("cancel");
- } else if (type == "no") {
- //否
- this.cancelDelEvent.emit();
- }
- }
- }
|