From 07390e2fcb4adf27c928335bf27ae7939c5a80ad Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期二, 23 五月 2023 11:28:12 +0800
Subject: [PATCH] bakcup20230523
---
force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js | 81 +++++++++++++++++++++++++---------------
1 files changed, 50 insertions(+), 31 deletions(-)
diff --git a/force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js b/force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js
index 3916190..0f8760e 100644
--- a/force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js
+++ b/force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js
@@ -1,9 +1,11 @@
import { LightningElement, track, wire, api } from 'lwc';
import { CurrentPageReference,NavigationMixin } from 'lightning/navigation';
import { CloseActionScreenEvent } from 'lightning/actions';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { updateRecord } from 'lightning/uiRecordApi';
-import init from '@salesforce/apex/loanerArrangedEmailController.init';
-import getRentalApplyEquipmentSet from '@salesforce/apex/loanerArrangedEmailController.getRentalApplyEquipmentSet';
+import init from '@salesforce/apex/LoanerArrangedEmailController.init';
+import getRentalApplyEquipmentSet from '@salesforce/apex/LoanerArrangedEmailController.getRentalApplyEquipmentSet';
import approvalCheck from '@salesforce/apex/RentalApplyWebService.approvalCheck';
import setShipment_request from '@salesforce/apex/RentalApplyWebService.approvalCheck';
export default class lexLoanerArrangedEmail extends LightningElement {
@@ -25,49 +27,50 @@
init({
recordId: this.recordId
}).then(result => {
- console.log(this.recordId);
+ let statusArr = result.statusList;
console.log('result==='+JSON.stringify(result));
if(result != null) {
- if( result.WeiAssignedCnt > 0 ) {
- alert("鐢宠鍗曞唴瀛樺湪鏈垎閰嶇殑閰嶅锛岃鍒嗛厤澶囧搧鎴栧垎鍓茬敵璇峰崟");
- }else if(result.CampaignStatus == "鍙栨秷") {
- alert("瀛︿細鍙栨秷锛屼笉鍙嚭搴撴寚绀�");
- }else if (result.RaStatus == "宸插嚭搴撴寚绀�" && result.AssignedNotShipment == 0){
- alert("鎵�鏈夌殑鍊熷嚭澶囧搧Set涓�瑙堥兘杩涜杩囧嚭搴撴寚绀轰簡");
- }else if (result.AssignedNotShipment == 0) {
- alert("娌℃湁鍙互鍑哄簱鎸囩ず鐨勬槑缁�");
- }else if (result.DemoPurpose1 == "闀挎湡鍊熷嚭" && result.ContractPdfUpdated == 0){
- alert("闀挎湡鍊熷嚭鏃讹紝蹇呴』鍏堜笂浼犲绾︿功");
- }else if (result.RepairId != '' && (result.RepairFinalInspectionDateF != null && result.RepairFinalInspectionDateF != '') || (result.RCReturnToOffice != null && result.RCReturnToOffice != '')){
- alert("淇悊鏈夋渶缁堟娴嬫棩鎴栦慨鐞嗗搧杩旈�佹棩锛屼笉鍙嚭搴撴寚绀�");
- }else if (result.IFApproved == "true" && (result.MeetingApprovedNo == null || result.MeetingApprovedNo == "")){
- alert("娌℃湁鍐宠鍙风殑锛屾殏涓嶈兘鍑哄��,璇锋洿鏂拌鍐充俊鎭��");
- }else if (result.IFApproved == "true" && result.MeetingApprovedNo != "" && result.StatusList.indexOf(records[0].Approved_Status__c) != -1){
- alert("宸茬敵璇峰喅瑁佷絾鍐宠鐘舵�佷笉绗﹀悎鏉′欢銆�");
- }else {
+ if( result.weiAssignedCnt > 0 ) {
+ this.showToast("鐢宠鍗曞唴瀛樺湪鏈垎閰嶇殑閰嶅锛岃鍒嗛厤澶囧搧鎴栧垎鍓茬敵璇峰崟",'error');
+ }else if(result.campaignStatus == "鍙栨秷") {
+ this.showToast("瀛︿細鍙栨秷锛屼笉鍙嚭搴撴寚绀�",'error');
+ }else if (result.raStatus == "宸插嚭搴撴寚绀�" && result.assignedNotShipment == 0){
+ this.showToast("鎵�鏈夌殑鍊熷嚭澶囧搧Set涓�瑙堥兘杩涜杩囧嚭搴撴寚绀轰簡",'error');
+ }else if (result.assignedNotShipment == 0) {
+ this.showToast("娌℃湁鍙互鍑哄簱鎸囩ず鐨勬槑缁�",'error');
+ }else if (result.demoPurpose1 == "闀挎湡鍊熷嚭" && result.contractPdfUpdated == false){
+ this.showToast("闀挎湡鍊熷嚭鏃讹紝蹇呴』鍏堜笂浼犲绾︿功",'error');
+ }else if (result.repairId != '' && (result.repairFinalInspectionDateF != null && result.repairFinalInspectionDateF != '') || (result.rCReturnToOffice != null && result.rCReturnToOffice != '')){
+ this.showToast("淇悊鏈夋渶缁堟娴嬫棩鎴栦慨鐞嗗搧杩旈�佹棩锛屼笉鍙嚭搴撴寚绀�",'error');
+ }else if (result.iFApproved == true && (result.meetingApprovedNo == null || result.meetingApprovedNo == "")){
+ this.showToast("娌℃湁鍐宠鍙风殑锛屾殏涓嶈兘鍑哄��,璇锋洿鏂拌鍐充俊鎭��",'error');
+ }else if (result.iFApproved == true && result.meetingApprovedNo != "" && statusArr.indexOf(result.approvedStatus) != -1){
+ this.showToast("宸茬敵璇峰喅瑁佷絾鍐宠鐘舵�佷笉绗﹀悎鏉′欢銆�",'error');
+ }else{
approvalCheck({
rentalApplyId: this.recordId
- }).then(res=>{
- if (res != '1') {
- alert(rs1);
- } else {
+ }).then(res1 =>{
+ if (res1 != '1') {
+ this.showToast(res1,'error');
+ }else{
//bp2 var rs2 = sforce.apex.execute("RentalApplyWebService", "reserve", {rentalApplyId: raid});
//bp2 if (rs2 != '1') {
//bp2 alert(rs2);
//bp2 } else {
//var rs1 = sforce.apex.execute("RentalApplyWebService", "setShipment_request", {raid : "{!Rental_Apply__c.Id}"});
-
+ console.log('setShipment_request==');
setShipment_request({
raid: this.recordId
}).then(res=>{
- if (res == "鐘舵�佹洿鏂板埌宸插嚭搴撴寚绀�") {
- alert("鐘舵�佹洿鏂板埌宸插嚭搴撴寚绀�");
+ console.log('res==',res);
+ if (res == "鐘舵�佹洿鏂板埌宸插嚭搴撴寚绀�") {
+ this.showToast("鐘舵�佹洿鏂板埌宸插嚭搴撴寚绀�",'success');
print();
- setTimeout(function() {
- location.href = "/{!Rental_Apply__c.Id}";
- },100);
+ // setTimeout(function() {
+ // location.href = "/{!Rental_Apply__c.Id}";
+ // },100);
}else {
- alert(res);
+ this.showToast(res,'error');
}
}).catch(e=>{
console.log('approvalCheck==='+e);
@@ -99,4 +102,20 @@
var Seconds = fixTime(date.getSeconds());
return date.getFullYear() + "-" + Month + "-" + Day + "T" + Time;
}
+
+ showToast(msg,type) {
+ const event = new ShowToastEvent({
+ message: msg,
+ variant: type
+ });
+ if(type == 'success'){
+ this.updateRecordView();
+ }
+ this.dispatchEvent(event);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+
+ updateRecordView(recordId) {
+ updateRecord({fields: { Id: recordId }});
+ }
}
\ No newline at end of file
--
Gitblit v1.9.1