| | |
| | | import { |
| | | ShowToastEvent |
| | | } from 'lightning/platformShowToastEvent'; |
| | | import LightningConfirm from 'lightning/confirm'; |
| | | |
| | | export default class LexCustomDelete extends LightningElement { |
| | | @api recordId; |
| | |
| | | this.userID = result.userID; |
| | | |
| | | this.CustomDelete(); |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | } |
| | | }).catch(error => { |
| | | console.log(error); |
| | | }).finally(() => { |
| | | |
| | | }); |
| | | }) |
| | | } |
| | | |
| | | // 删除 |
| | |
| | | if (repList != null && repList.length > 0) { |
| | | var rp = repList[0]; |
| | | if (rp.Status__c != "草案中" && rp.Status__c != "1.受理完毕(SAP待发送)" && rp.Status__c != "4.修理品返送阶段") { |
| | | this.ShowToastEvent("不是草案中,不能删除", "error") |
| | | this.ShowToastEvent("不是草案中,不能删除", "error"); |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | return; |
| | | } else if (rp.Status__c == "4.修理品返送阶段" && (rp.SAP_Transfer_time__c != undefined || rp.Repair_Ordered_Date__c != undefined)) { |
| | | this.ShowToastEvent("已经发送过SAP,不能删除", "error") |
| | | this.ShowToastEvent("已经发送过SAP,不能删除", "error"); |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | return; |
| | | } 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)) { |
| | | this.ShowToastEvent("不是所有人、创建人或FSE主负责人,不能删除", "error") |
| | | this.ShowToastEvent("不是所有人、创建人或FSE主负责人,不能删除", "error"); |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | return; |
| | | } else { |
| | | if (confirm("是否确定?")) { |
| | | deleteRepair({ |
| | | rid: rp.Id |
| | | }).then(rtn => { |
| | | if (rtn == "OK") { |
| | | window.location.href = "/a0J/o"; |
| | | } else { |
| | | alert(rtn); |
| | | } |
| | | }) |
| | | } |
| | | this.handleConfirmClick("是否确定?"); |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | ll() { |
| | | deleteRepair({ |
| | | rid: this.Id |
| | | }).then(rtn => { |
| | | if (rtn == "OK") { |
| | | window.location.href = "/a0J/o"; |
| | | } else { |
| | | this.ShowToastEvent(rtn, "error"); |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | return; |
| | | } |
| | | }) |
| | | } |
| | |
| | | }); |
| | | this.dispatchEvent(event); |
| | | } |
| | | |
| | | async handleConfirmClick(msg) { |
| | | const result = await LightningConfirm.open({ |
| | | message: msg, |
| | | variant: 'headerless', |
| | | label: 'this is the aria-label value' |
| | | }); |
| | | |
| | | if (result) { |
| | | this.ll(); |
| | | } else { |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | } |
| | | } |
| | | } |