From 50ce6a5e5ae7ac6ce3e6281acca9a0db568306e6 Mon Sep 17 00:00:00 2001
From: unknown <sunxia@prec-tech.com>
Date: 星期三, 23 八月 2023 14:54:59 +0800
Subject: [PATCH] Merge branch 'LEX_dev' of http://47.92.229.245:8089/r/lightningupdate into LEX_dev
---
force-app/main/default/lwc/lexCustomDelete/lexCustomDelete.js | 80 +++++++++++++++++++++++++++-------------
1 files changed, 54 insertions(+), 26 deletions(-)
diff --git a/force-app/main/default/lwc/lexCustomDelete/lexCustomDelete.js b/force-app/main/default/lwc/lexCustomDelete/lexCustomDelete.js
index 4ae611c..7d968c9 100644
--- a/force-app/main/default/lwc/lexCustomDelete/lexCustomDelete.js
+++ b/force-app/main/default/lwc/lexCustomDelete/lexCustomDelete.js
@@ -12,7 +12,10 @@
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';
+import LightningConfirm from 'lightning/confirm';
export default class LexCustomDelete extends LightningElement {
@api recordId;
@@ -43,13 +46,10 @@
this.userID = result.userID;
this.CustomDelete();
- this.dispatchEvent(new CloseActionScreenEvent());
}
}).catch(error => {
console.log(error);
- }).finally(() => {
-
- });
+ })
}
// 鍒犻櫎
@@ -59,31 +59,59 @@
}).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.淇悊鍝佽繑閫侀樁娈�"
- ) {
- alert("涓嶆槸鑽夋涓紝涓嶈兘鍒犻櫎");
- } else if (rp.Status__c == "4.淇悊鍝佽繑閫侀樁娈�" &&
- (rp.SAP_Transfer_time__c != "" || rp.Repair_Ordered_Date__c != "")
- ) {
- alert("宸茬粡鍙戦�佽繃SAP锛屼笉鑳藉垹闄�");
+ 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)) {
- alert("涓嶆槸鎵�鏈変汉銆佸垱寤轰汉鎴朏SE涓昏礋璐d汉锛屼笉鑳藉垹闄�");
+ 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;
+ }
+ })
+ }
+
+ ShowToastEvent(msg, type) {
+ const event = new ShowToastEvent({
+ title: '',
+ message: msg,
+ variant: type
+ });
+ 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