19626
2023-08-08 874d06c838d77ed9e4e19ca888161c1590d02e2b
force-app/main/default/lwc/lexCustomDelete/lexCustomDelete.js
@@ -12,7 +12,9 @@
import init from '@salesforce/apex/otherButtonRepairController.init';
import selectCustomDeleteById from '@salesforce/apex/otherButtonRepairController.selectCustomDeleteById';
import deleteRepair from '@salesforce/apex/otherButtonRepairController.deleteRepair';
import {
    ShowToastEvent
} from 'lightning/platformShowToastEvent';
export default class LexCustomDelete extends LightningElement {
    @api recordId;
@@ -63,13 +65,13 @@
                    rp.Status__c != "1.受理完毕(SAP待发送)" &&
                    rp.Status__c != "4.修理品返送阶段"
                ) {
                    alert("不是草案中,不能删除");
                    this.ShowToastEvent("不是草案中,不能删除", "error")
                } else if (rp.Status__c == "4.修理品返送阶段" &&
                    (rp.SAP_Transfer_time__c != "" || rp.Repair_Ordered_Date__c != "")
                    (rp.SAP_Transfer_time__c != undefined || rp.Repair_Ordered_Date__c != undefined)
                ) {
                    alert("已经发送过SAP,不能删除");
                    this.ShowToastEvent("已经发送过SAP,不能删除", "error")
                } else if (this.userID.substring(0, 15) != rp.CreatedById.substring(0, 15) && this.userID.substring(0, 15) != rp.Acc_OwnerId__c.substring(0, 15) && this.userID.substring(0, 15) != rp.FSE_ownerid__c.substring(0, 15)) {
                    alert("不是所有人、创建人或FSE主负责人,不能删除");
                    this.ShowToastEvent("不是所有人、创建人或FSE主负责人,不能删除", "error")
                } else {
                    if (confirm("是否确定?")) {
                        deleteRepair({
@@ -86,4 +88,13 @@
            }
        })
    }
    ShowToastEvent(msg, type) {
        const event = new ShowToastEvent({
            title: '',
            message: msg,
            variant: type
        });
        this.dispatchEvent(event);
    }
}