From dfff58b7cd897b824a129edba6b5cdae20bb1e5c Mon Sep 17 00:00:00 2001
From: unknown <sunxia@prec-tech.com>
Date: 星期三, 23 八月 2023 17:40:58 +0800
Subject: [PATCH] 发起再注册分析并同步SAP
---
force-app/main/default/lwc/lexUploadToSap/lexUploadToSap.js | 86 +++++++++++++++---------------------------
1 files changed, 31 insertions(+), 55 deletions(-)
diff --git a/force-app/main/default/lwc/lexUploadToSap/lexUploadToSap.js b/force-app/main/default/lwc/lexUploadToSap/lexUploadToSap.js
index 82f0cd4..e06e449 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;
@@ -29,6 +33,7 @@
urfFlag;
rtn1;
rtn;
+
@wire(CurrentPageReference)
getStateParameters(currentPageReference) {
if (currentPageReference) {
@@ -41,7 +46,6 @@
}
connectedCallback() {
- console.log(this.recordId);
init({
recordId: this.recordId
}).then(result => {
@@ -62,106 +66,78 @@
}
}).catch(error => {
console.log(error);
- }).finally(() => {
-
- });
+ })
}
+ // 涓婁紶SAP
uploadToSap() {
if (this.MCApprovalStatusC != 'Pass') {
- alert("鍚堝悓澶嶆牳鎵瑰噯鍚庢墠鍙互涓婁紶SAP銆�");
+ this.ShowToastEvent("鍚堝悓澶嶆牳鎵瑰噯鍚庢墠鍙互涓婁紶SAP銆�", "error")
} else if (this.MaintenanceContractNoC == undefined) {
- alert('缁翠慨鍚堝悓绠$悊缂栫爜涓虹┖锛屼笉鑳戒笂浼燬AP銆�');
+ this.ShowToastEvent('缁翠慨鍚堝悓绠$悊缂栫爜涓虹┖锛屼笉鑳戒笂浼燬AP銆�', "error")
} else if (this.uploadToSapTimeC != undefined) {
- alert('宸茬粡涓婁紶SAP锛屼笉鑳介噸澶嶄笂浼犮��');
+ this.ShowToastEvent('宸茬粡涓婁紶SAP锛屼笉鑳介噸澶嶄笂浼犮��', "error")
} 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")
return;
} else {
- //鍒ゆ柇鏄惁瀹屾垚璁ゆ
if (!this.IsRecognitionModelTrueC) {
- console.log("b");
- alert('褰撳墠缁翠慨鍚堝悓娌℃湁瀹屾垚璁ゆ锛屼笉鑳戒笂浼燬AP銆�');
+ this.ShowToastEvent('褰撳墠缁翠慨鍚堝悓娌℃湁瀹屾垚璁ゆ锛屼笉鑳戒笂浼燬AP銆�', "error")
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")
}
});
-
- //棣栨鏈嶅姟鍚堝悓璧嬪��
- // 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")
}
});
-
- //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鎴愬姛");
- window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Maintenance_Contract__c/" + this.recordId + "/view");
- //window.location.href = "/" + this.Id;
+ this.ShowToastEvent("涓婁紶SAP鎴愬姛", "success")
+ location.href = "/" + this.Id;
} else {
- alert(this.rtn);
+ this.ShowToastEvent(this.rtn, "error")
}
} else {
- alert(this.rtn1);
+ this.ShowToastEvent(this.rtn1, "error")
}
}
}
+ // 寮圭獥
+ 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