From bbc7c47e3eadfe0ae3ac57419b1c9b8b2ed3e3d4 Mon Sep 17 00:00:00 2001
From: 19626 <1962676589@qq.com>
Date: 星期四, 06 四月 2023 17:30:41 +0800
Subject: [PATCH] 修改按钮 4.6
---
force-app/main/default/lwc/lexUploadToSap/lexUploadToSap.js | 88 +++++++++++++++++++-------------------------
1 files changed, 38 insertions(+), 50 deletions(-)
diff --git a/force-app/main/default/lwc/lexUploadToSap/lexUploadToSap.js b/force-app/main/default/lwc/lexUploadToSap/lexUploadToSap.js
index 82f0cd4..5bd9188 100644
--- a/force-app/main/default/lwc/lexUploadToSap/lexUploadToSap.js
+++ b/force-app/main/default/lwc/lexUploadToSap/lexUploadToSap.js
@@ -14,6 +14,10 @@
import updateFirstContract from '@salesforce/apex/updateFirstServiceContractWebService.updateFirstContract';
import Check_plan from '@salesforce/apex/MaintenanceContractWebService.Check_plan';
import up2sap from '@salesforce/apex/MaintenanceContractWebService.up2sap';
+import {
+ ShowToastEvent
+} from 'lightning/platformShowToastEvent';
+
export default class LexUploadToSap extends LightningElement {
@api recordId;
str;
@@ -67,101 +71,85 @@
});
}
+ // 涓婁紶SAP
uploadToSap() {
if (this.MCApprovalStatusC != 'Pass') {
- alert("鍚堝悓澶嶆牳鎵瑰噯鍚庢墠鍙互涓婁紶SAP銆�");
+ this.ShowToastEvent("鍚堝悓澶嶆牳鎵瑰噯鍚庢墠鍙互涓婁紶SAP銆�", "error")
+ // alert("鍚堝悓澶嶆牳鎵瑰噯鍚庢墠鍙互涓婁紶SAP銆�");
} else if (this.MaintenanceContractNoC == undefined) {
- alert('缁翠慨鍚堝悓绠$悊缂栫爜涓虹┖锛屼笉鑳戒笂浼燬AP銆�');
+ this.ShowToastEvent('缁翠慨鍚堝悓绠$悊缂栫爜涓虹┖锛屼笉鑳戒笂浼燬AP銆�', "error")
+ // alert('缁翠慨鍚堝悓绠$悊缂栫爜涓虹┖锛屼笉鑳戒笂浼燬AP銆�');
} else if (this.uploadToSapTimeC != undefined) {
- alert('宸茬粡涓婁紶SAP锛屼笉鑳介噸澶嶄笂浼犮��');
+ this.ShowToastEvent('宸茬粡涓婁紶SAP锛屼笉鑳介噸澶嶄笂浼犮��', "error")
+ // alert('宸茬粡涓婁紶SAP锛屼笉鑳介噸澶嶄笂浼犮��');
} else {
- //update wangweipeng 2021/11/20 start
- //鍒ゆ柇鏄惁闇�瑕佸厛涓婁紶璁ゆ鍚堝悓鍚楋紝濡傛灉闇�瑕侀偅涔堝垽鏂粬鏄惁宸茬粡涓婁紶锛屽鏋滀笂浼狅紝閭d箞鍒ゆ柇浠栨槸鍚﹀畬鎴愯娆撅紝濡傛灉閮芥弧瓒筹紝閭d箞鎵嶈兘姝e父璧版帴鍙d笂浼燬AP
- //鍒ゆ柇鏄娆惧悎鍚屽悧
if (this.oldIsRecognitionModelC) {
- //鍒ゆ柇鏄惁宸茬粡涓婁紶璁ゆ鍚堝悓
if (this.uploadToRMTimeC == undefined) {
- console.log("a");
- alert('褰撳墠缁翠慨鍚堝悓鐨勭粡閿�鍟嗘槸鍏堟瀵硅薄锛岄渶瑕佸厛銆愪笂浼犺娆惧悎鍚屻�戯紝鐒跺悗瀹屾垚璁ゆ浠ュ悗鎵嶈兘涓婁紶SAP銆�');
+ this.ShowToastEvent('褰撳墠缁翠慨鍚堝悓鐨勭粡閿�鍟嗘槸鍏堟瀵硅薄锛岄渶瑕佸厛銆愪笂浼犺娆惧悎鍚屻�戯紝鐒跺悗瀹屾垚璁ゆ浠ュ悗鎵嶈兘涓婁紶SAP銆�', "error")
+ // alert('褰撳墠缁翠慨鍚堝悓鐨勭粡閿�鍟嗘槸鍏堟瀵硅薄锛岄渶瑕佸厛銆愪笂浼犺娆惧悎鍚屻�戯紝鐒跺悗瀹屾垚璁ゆ浠ュ悗鎵嶈兘涓婁紶SAP銆�');
return;
} else {
- //鍒ゆ柇鏄惁瀹屾垚璁ゆ
if (!this.IsRecognitionModelTrueC) {
- console.log("b");
- alert('褰撳墠缁翠慨鍚堝悓娌℃湁瀹屾垚璁ゆ锛屼笉鑳戒笂浼燬AP銆�');
+ this.ShowToastEvent('褰撳墠缁翠慨鍚堝悓娌℃湁瀹屾垚璁ゆ锛屼笉鑳戒笂浼燬AP銆�', "error")
+ // alert('褰撳墠缁翠慨鍚堝悓娌℃湁瀹屾垚璁ゆ锛屼笉鑳戒笂浼燬AP銆�');
return;
}
}
}
- //update wangweipeng 2021/11/20 end
- // sforce.connection.sessionId = this.api.sessionId;
- // var mcid = this.Id;
- // var result = sforce.apex.execute("MaintenanceContractSetColunmWebService", "updateColunm", {
- // mcid: mcid
- // });
updateColunm({
mcid: this.Id
- }).then(result=>{
- console.log("updateColunm" + result);
+ }).then(result => {
if (result != '1') {
- console.log("c");
- alert('涓婁紶SAP澶辫触,鍥犱负 鏉ュ勾鍚堝悓鐩稿叧淇℃伅淇敼澶辫触');
- //location.href = "/" + this.Id;
+ this.ShowToastEvent('涓婁紶SAP澶辫触,鍥犱负 鏉ュ勾鍚堝悓鐩稿叧淇℃伅淇敼澶辫触', "error")
+ // alert('涓婁紶SAP澶辫触,鍥犱负 鏉ュ勾鍚堝悓鐩稿叧淇℃伅淇敼澶辫触');
}
});
-
- //棣栨鏈嶅姟鍚堝悓璧嬪��
- // var updateResult = sforce.apex.execute("updateFirstServiceContractWebService", "updateFirstContract", {
- // mcid: mcid
- // });
updateFirstContract({
mcid: this.Id
- }).then(result=>{
- console.log("updateFirstContract:" + result);
+ }).then(result => {
if (result != '1') {
- alert(result);
+ this.ShowToastEvent(result, "error")
+ // alert(result);
}
});
-
- //URF闄愭鍚堝悓2鏈� LY 20220811 start
this.urfFlag = this.URFContractFC;
this.rtn1 = '1';
this.rtn = '1';
if (this.urfFlag == 'false') {
- // rtn1 = sforce.apex.execute("MaintenanceContractWebService", "Check_plan", {
- // mcidList: mcid
- // });
Check_plan({
mcidList: this.Id
- }).then(result=>{
- console.log("Check_plan:" + result);
+ }).then(result => {
this.rtn1 = result;
});
}
- console.log("rtn1" + this.rtn1);
- //URF闄愭鍚堝悓2鏈� LY 20220811 end
if (this.rtn1 == '1') {
- // var rtn = sforce.apex.execute("MaintenanceContractWebService", "up2sap", {
- // mcid: mcid
- // });
up2sap({
mcid: this.Id
- }).then(result=>{
- console.log("up2sap:" + result);
+ }).then(result => {
this.rtn = result;
});
- console.log("rtn" + this.rtn);
if (this.rtn == '1') {
- alert("涓婁紶SAP鎴愬姛");
+ this.ShowToastEvent("涓婁紶SAP鎴愬姛", "success")
+ // alert("涓婁紶SAP鎴愬姛");
window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Maintenance_Contract__c/" + this.recordId + "/view");
- //window.location.href = "/" + this.Id;
} else {
- alert(this.rtn);
+ this.ShowToastEvent(this.rtn, "error")
+ // alert(this.rtn);
}
} else {
- alert(this.rtn1);
+ this.ShowToastEvent(this.rtn1, "error")
+ // alert(this.rtn1);
}
}
}
+ // 寮圭獥
+ ShowToastEvent(msg, type) {
+ const event = new ShowToastEvent({
+ title: '',
+ message: msg,
+ variant: type
+ });
+ this.dispatchEvent(event);
+ }
}
\ No newline at end of file
--
Gitblit v1.9.1