From a4b8019d414735754babdefa9c339414981a91fe Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@prec-tech.com>
Date: 星期一, 10 七月 2023 15:48:24 +0800
Subject: [PATCH] 耗材备品配套一览 分单 选择明细 取消选择明细
---
force-app/main/default/lwc/lexCustomDelete/lexCustomDelete.js | 67 +++++++++++++++++++++------------
1 files changed, 42 insertions(+), 25 deletions(-)
diff --git a/force-app/main/default/lwc/lexCustomDelete/lexCustomDelete.js b/force-app/main/default/lwc/lexCustomDelete/lexCustomDelete.js
index 0c3c21f..7d968c9 100644
--- a/force-app/main/default/lwc/lexCustomDelete/lexCustomDelete.js
+++ b/force-app/main/default/lwc/lexCustomDelete/lexCustomDelete.js
@@ -15,6 +15,7 @@
import {
ShowToastEvent
} from 'lightning/platformShowToastEvent';
+import LightningConfirm from 'lightning/confirm';
export default class LexCustomDelete extends LightningElement {
@api recordId;
@@ -45,13 +46,10 @@
this.userID = result.userID;
this.CustomDelete();
- this.dispatchEvent(new CloseActionScreenEvent());
}
}).catch(error => {
console.log(error);
- }).finally(() => {
-
- });
+ })
}
// 鍒犻櫎
@@ -61,30 +59,35 @@
}).then(repList => {
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")
- } else if (rp.Status__c == "4.淇悊鍝佽繑閫侀樁娈�" &&
- (rp.SAP_Transfer_time__c != undefined || rp.Repair_Ordered_Date__c != undefined)
- ) {
- this.ShowToastEvent("宸茬粡鍙戦�佽繃SAP锛屼笉鑳藉垹闄�", "error")
+ if (rp.Status__c != "鑽夋涓�" && rp.Status__c != "1.鍙楃悊瀹屾瘯(SAP寰呭彂閫�)" && rp.Status__c != "4.淇悊鍝佽繑閫侀樁娈�") {
+ 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.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("涓嶆槸鎵�鏈変汉銆佸垱寤轰汉鎴朏SE涓昏礋璐d汉锛屼笉鑳藉垹闄�", "error")
+ this.ShowToastEvent("涓嶆槸鎵�鏈変汉銆佸垱寤轰汉鎴朏SE涓昏礋璐d汉锛屼笉鑳藉垹闄�", "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;
}
})
}
@@ -97,4 +100,18 @@
});
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());
+ }
+ }
}
\ No newline at end of file
--
Gitblit v1.9.1