From a8628cfe2640797ba9265e9be46c42430d9e7eba Mon Sep 17 00:00:00 2001
From: twysparks <twysparks@163.com>
Date: 星期一, 26 六月 2023 10:01:44 +0800
Subject: [PATCH] 服务按钮样式调整
---
force-app/main/default/lwc/lexCustomDelete/lexCustomDelete.js | 58 ++++++++++++++++++++++++++++++++++++++++------------------
1 files changed, 40 insertions(+), 18 deletions(-)
diff --git a/force-app/main/default/lwc/lexCustomDelete/lexCustomDelete.js b/force-app/main/default/lwc/lexCustomDelete/lexCustomDelete.js
index 5123b26..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(() => {
-
- });
+ })
}
// 鍒犻櫎
@@ -62,24 +60,34 @@
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("涓嶆槸鎵�鏈変汉銆佸垱寤轰汉鎴朏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;
}
})
}
@@ -92,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