From 4688e276eee13cd2e521aa55afb5725cb0fda270 Mon Sep 17 00:00:00 2001
From: binxie <137736985@qq.com>
Date: 星期一, 22 一月 2024 21:21:18 +0800
Subject: [PATCH] backuprentalapply0122
---
force-app/main/default/lwc/lexOPDPlanCommitNeedApproval/lexOPDPlanCommitNeedApproval.js | 225 +++++--------------------------------------------------
1 files changed, 23 insertions(+), 202 deletions(-)
diff --git a/force-app/main/default/lwc/lexOPDPlanCommitNeedApproval/lexOPDPlanCommitNeedApproval.js b/force-app/main/default/lwc/lexOPDPlanCommitNeedApproval/lexOPDPlanCommitNeedApproval.js
index 991b20e..6e8bbe3 100644
--- a/force-app/main/default/lwc/lexOPDPlanCommitNeedApproval/lexOPDPlanCommitNeedApproval.js
+++ b/force-app/main/default/lwc/lexOPDPlanCommitNeedApproval/lexOPDPlanCommitNeedApproval.js
@@ -8,14 +8,8 @@
import {loadStyle} from 'lightning/platformResourceLoader';
import init from '@salesforce/apex/LexOPDSupplementaryController.init2';
import NewAndUpdateOPDStatus from '@salesforce/apex/LexOPDSupplementaryController.NewAndUpdateOPDStatus';
-// import UpdateSign from '@salesforce/apex/LexOPDSupplementaryController.UpdateSign';
-import STATUS_PROCESS_STATE from '@salesforce/label/c.StatusProcessState';
-import { updateRecord } from 'lightning/uiRecordApi';
-import UserInfo_Owner from '@salesforce/apex/LexOPDSupplementaryController.UserInfo_Owner';
-import newApply from '@salesforce/apex/lexNewSparePartsLoanApplicationCtl.newApplyInit';
-import newApplyInitApp from '@salesforce/apex/lexNewSparePartsLoanApplicationCtl.newApplyInitApp';
-import sendFailEmail from '@salesforce/apex/LexOPDSupplementaryController.sendTemperatureEmail';
-import newRentalApply from '@salesforce/apex/LexOPDSupplementaryController.newRentalApply';
+
+
const event1 = new ShowToastEvent({
message:
@@ -42,20 +36,11 @@
@api recordId;
OPDPlan;
IsLoading=true;
- opdCampaignTypeId;
- opdInternalinchargeprovince;
- @track proSameNum;
- @track proModelNum;
- @track proStopNum;
- @track proNewNum;
- @track proAccSameNum;
- @track renAppName;
- @track RepeatRentalSign = false;
- @track StatusProcessState=STATUS_PROCESS_STATE;
- @track rentalReson1;
- @wire(CurrentPageReference)
- getStateParameters(currentPageReference) {
- if (currentPageReference) {
+
+
+ @wire(CurrentPageReference)
+ getStateParameters(currentPageReference) {
+ if (currentPageReference) {
const urlValue = currentPageReference.state.recordId;
if (urlValue) {
let str = `${urlValue}`;
@@ -72,17 +57,7 @@
recordId: this.recordId
}).then(result => {
if (result != null) {
- this.rentalReson1 = result.rentalReson;
- this.OPDPlan = result.opdPlanRecord;
- this.proSameNum = result.proSameNum;
- this.proModelNum = result.proModelNum;
- this.proStopNum = result.proStopNum;
- this.proNewNum = result.proNewNum;
- this.proAccSameNum = result.proAccSameNum;
- this.renAppName = result.renAppName;
- this.opdStatusProcessState = result.opdStatusProcessState;
- this.opdCampaignTypeId = result.opdCampaignTypeId;
- this.opdInternalinchargeprovince = result.opdInternalinchargeprovince;
+ this.OPDPlan = result;
this.commitNeedApproval().then(result=>{
this.IsLoading=false;
this.dispatchEvent(new CloseActionScreenEvent());
@@ -90,6 +65,7 @@
}
}).catch(error => {
const eventInItError = new ShowToastEvent({
+
message:
error.message,
variant : 'error',
@@ -103,31 +79,16 @@
async commitNeedApproval(){
var changeFlg=0;
//0.褰撳墠鐘舵��(鍙湁鑽夋涓墠鍙互杩涜瀹℃壒)
- var NowStatus = this.OPDPlan.Status__c;
+ var NowStatus = this.OPDPlan.opdPlanRecord.Status__c;
//鑾峰彇鍑哄�熺洰鐨�
- var RentalReson__c = this.OPDPlan.RentalReson__c;
+ var RentalReson__c = this.OPDPlan.opdPlanRecord.RentalReson__c;
//鑾峰彇闄勪欢璇佹槑
var AttachmentCertificate__c = this.OPDPlan.AttachmentCertificate__c;
//鑾峰彇鏄惁闇�瑕佸~鍐欐姤鍛婁功
- var NeedReport = this.OPDPlan.NeedReport__c;
- var IFApproved = this.OPDPlan.IF_Approved__c;
- var ApprovedNo = this.OPDPlan.Approved_No__c;
- var ApprovedStatus = this.OPDPlan.Approved_Status__c;
- var RentalApply2 = this.OPDPlan.Rental_Apply2__c;
- var HaveValue = this.OPDPlan.Rental_Apply2__c;
- var OPDType = this.OPDPlan.OPDType__c;
- var CampaignId = this.OPDPlan.Campaign__c;
- var Days = this.OPDPlan.Rental_Apply_Flag__c;
- var CampaignTypeId = this.OPDPlan.CampaignRecodeTypeId__c;
- var cp = this.OPDPlan.Internal_in_charge_province__c;
- var up = "{!Text($User.Province__c)}";
- var ups = up.slice(0, 2);
- var CampaignStatus = this.OPDPlan.CampaignStatus__c;
- var OriginalOpdPlanApplication = this.OPDPlan.OriginalOpdPlanApplication__c;
- var opdAccountLaboratory = this.OPDPlan.Account_Laboratory__c;
- var rentalReson = this.OPDPlan.RentalReson__c;
- var StayOrNot = this.OPDPlan.StayOrNot__c;
-
+ var NeedReport = this.OPDPlan.opdPlanRecord.NeedReport__c;
+ console.log('NowStatus>>>>>' + NowStatus);
+ console.log('this.OPDPlan>>>>' + JSON.stringify(this.OPDPlan));
+ debugger;
if(NowStatus != "鑽夋涓�"){
this.dispatchEvent(event1);
return;
@@ -142,41 +103,6 @@
this.dispatchEvent(event3);
return;
}
-
- //2023-11-28 Add by du Start 闃叉鍑哄�熺洰鐨勪慨鏀�,鎻愪氦鏃跺瓨鍦ㄤ笉绗﹀悎鏉′欢鐨勬暟鎹�
- if (this.proStopNum == 1 || this.proModelNum == 1) {
- this.showToast('OPD璁″垝涓嬪瓨鍦ㄤ笉绗﹀悎鍑哄�熺洰鐨勭殑澶囧搧鏁版嵁銆�','error');
- return;
- }
-
- //2023-12-15 Add by du Start 鏂颁骇鍝佽瘎浠蜂笅鐨勪骇鍝佽嚦灏戣鏈変竴涓柊浜у搧鏍囪鐨勪骇鍝佸瓨鍦�
- if (this.proNewNum === 0 && this.rentalReson1 === '鏂颁骇鍝佽瘎浠�') {
- this.showToast('鏂颁骇鍝佽瘯鐢ㄦ椂锛岃嚦灏戣鏈変竴涓柊浜у搧銆�','error');
- return;
- }
-
-
- //鍚屼竴绉戝涓�,杩涜鍏宠仈鎬ч獙璇�
- if (this.proSameNum === 0) {
- this.showToast('鍑哄�熷鍝佹槑缁嗚嚦灏戞湁涓�涓拰鍏宠仈鐨勮浠锋姤浠蜂骇鍝佺浉绗�, 璇峰悓姝ユ姤浠蜂骇鍝併��','error');
- return;
- }
-
- //鍚屼竴绉戝涓�,杩涜閲嶅鎬ч獙璇�
- console.log('this.proAccSameNum----------' + this.rentalReson1);
- if (this.proAccSameNum !== 0 && this.rentalReson1 == 'OPD'){
- const result3 = await LightningConfirm.open({
- message: '鍚屽尰闄㈠悓绉戝鍊熺敤閲嶅鍨嬪彿浜у搧(' + this.renAppName + '),瀹℃壒鍒板壇鎬昏, 璇风‘瀹氭槸鍚︾户缁敵璇峰�熺敤锛�',
- variant: 'headerless',
- label: 'this is the aria-label value',
- });
- if(!result3){
- return;
- }else{
- this.RepeatRentalSign = true;
- }
- }
- // 2023-11-28 Add by du End
//2.鎻愮ず
const result1 = await LightningConfirm.open({
message: '涓�鏃︽彁浜ゆ璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵',
@@ -186,9 +112,7 @@
if(!result1){
return;
}
-
-
-
+ console.log('123123');
//2022-07-20 zyh
var RentalReson = this.OPDPlan.RentalReson__c;
var Related_Opportunity1_ID = this.OPDPlan.Related_Opportunity1_ID__c;
@@ -203,137 +127,34 @@
return;
}
}
-
- //20231008 sx 鍊熺敤鏈轰細鍙鍖�-鎻愪氦瀹℃壒閫昏緫鏀归�� start
- if(StayOrNot == '宸茬鑱�'){
- this.showToast('鎵�鏈変汉宸茬粡绂昏亴锛岃鑱旂郴绯荤粺绠$悊鍛樹慨鏀规墍鏈変汉銆�','warning');
- sendFailEmail({opdName:this.OPDPlan.Name ,ErrorMessage: '鎵�鏈変汉宸茬粡绂昏亴锛岃鑱旂郴绯荤粺绠$悊鍛樹慨鏀规墍鏈変汉銆�' , recordId: this.recordId});
- return;
- }
- if(IFApproved && (ApprovedNo == '' || ApprovedNo == undefined)){
- this.showToast('闇�瑕佸喅瑁佹椂锛屽喅瑁佺紪鐮佷笉鑳戒负绌�','warning');
- sendFailEmail({opdName:this.OPDPlan.Name ,ErrorMessage: '闇�瑕佸喅瑁佹椂锛屽喅瑁佺紪鐮佷笉鑳戒负绌�' , recordId: this.recordId});
- return;
- }
-
- if (IFApproved && (ApprovedNo != '' || ApprovedNo == undefined) && this.opdStatusProcessState.indexOf(ApprovedStatus)!=-1 && ApprovedStatus != '鑽夌'){
- this.showToast('宸茬敵璇峰喅瑁佷絾鍐宠鐘舵�佷笉绗﹀悎鏉′欢','error');
- sendFailEmail({opdName:this.OPDPlan.Name ,ErrorMessage: '宸茬敵璇峰喅瑁佷絾鍐宠鐘舵�佷笉绗﹀悎鏉′欢' , recordId: this.recordId});
- return;
- }
- if((HaveValue!= null || HaveValue!= undefined) && OPDType != '瀛︿細'){
- this.showToast('涓�涓狾PD璁″垝鍙彲鍏宠仈鍒涘缓涓�涓鍝佺敵璇峰崟','error');
- sendFailEmail({opdName:this.OPDPlan.Name ,ErrorMessage: '涓�涓狾PD璁″垝鍙彲鍏宠仈鍒涘缓涓�涓鍝佺敵璇峰崟' , recordId: this.recordId});
- return;
- }
-
+ console.log('12312312hhhh');
//2022-07-20 zyh
- await NewAndUpdateOPDStatus({Id : this.OPDPlan.Id, RepeatRentalSign : this.RepeatRentalSign}).then(result=>{
+ await NewAndUpdateOPDStatus({Id : this.OPDPlan.Id}).then(result=>{
if(result!='success'){
const eventError = new ShowToastEvent({
- message:result,
- variant:'error',
- mode:'sticky'
+ message:
+ result,
+ variant :'error',
+ mode : 'sticky'
});
changeFlg+=1;
this.dispatchEvent(eventError);
- }else{
- console.log('NewAndUpdateOPDStatus======'+result);
}
});
if(changeFlg!=0){
return;
}
-
-
- await UserInfo_Owner({}).then(res=>{
- if (OPDType == '瀛︿細' && CampaignId != '') {
- let campaignRecodeType = CampaignTypeId.slice(0,15);
- let getCampaignRecodeType = opdCampaignTypeId.slice(0,15);
- let ups = res.userProvince.slice(0, 2);
- if (campaignRecodeType != getCampaignRecodeType && res.userJobCategory == '閿�鍞湇鍔�' ) {
- this.showToast('FSE涓嶈兘鐢宠璇ュ浼氱被鍨嬪鍝�','warning');
- return;
- }else if ((res.userJobCategory == '閿�鍞湇鍔�' || res.userJobCategory == '鏀彺') && campaignRecodeType != getCampaignRecodeType && opdInternalinchargeprovince.indexOf(ups) == -1) {
- this.showToast("涓嶧SE鎵�鍦ㄧ渷涓�鑷达紝鎵嶅彲浣跨敤澶囧搧",'warning');
- return;
- }else if(CampaignStatus == '宸茬粨鏉�'){
- this.showToast("宸茬粨鏉燂紝涓嶈兘鐢宠",'warning');
- return;
- }else if(CampaignStatus == '宸叉彁浜ゆ姤鍛�'){
- this.showToast("宸叉彁浜ゆ姤鍛婏紝涓嶈兘鐢宠",'warning');
- return;
- }else if(CampaignStatus == '鍙栨秷鐢宠涓�'){
- this.showToast("鍙栨秷鐢宠涓紝涓嶈兘鐢宠",'warning');
- return;
- }else if(CampaignStatus == '鍙栨秷'){
- this.showToast("宸茬粡鍙栨秷锛屼笉鑳界敵璇�",'warning');
- return;
- }
- }
- })
-
-
- newRentalApply({
- recordId: this.recordId
- }).then(res=>{
- console.log('newRentalApply======'+res);
- }).catch(err=>{
- console.log(err)
- })
-
-
- this.dispatchEvent(new CloseActionScreenEvent());
-
- //20231008 sx 鍊熺敤鏈轰細鍙鍖�-鎻愪氦瀹℃壒閫昏緫鏀归�� end
//4. 杩涚▼鐢熸垚鍣�
//5. 閲嶆柊鍒锋柊椤甸潰
setTimeout(function(){
window.location.href = window.location;
}, 1500 )
- }
- //20240103 sx 澶囧搧鏅鸿兘鍖� add start
- showToast(msg,type) {
- if(type == 'success'){
- const event = new ShowToastEvent({
- message: msg,
- variant: type
- });
- this.dispatchEvent(event);
- this.dispatchEvent(new CloseActionScreenEvent());
- }else{
- const event = new ShowToastEvent({
- message: msg,
- variant: type,
- mode: 'sticky'
- });
- this.dispatchEvent(event);
- this.dispatchEvent(new CloseActionScreenEvent());
- }
- }
- updateRecordView(recordId) {
- updateRecord({fields: { Id: recordId }});
+
}
- navigateEvents(defaultValues){
- console.log("--------navigateEvents------",defaultValues);
- this[NavigationMixin.Navigate]({
- type: 'standard__objectPage',
- attributes: {
- objectApiName: 'Rental_Apply__c',
- actionName: 'new'
- },
- state:{
- // nooverride : 1,
- defaultFieldValues: defaultValues
- }
- });
- this.dispatchEvent(new CloseActionScreenEvent());
- }
- //20240103 sx 澶囧搧鏅鸿兘鍖� add end
}
\ No newline at end of file
--
Gitblit v1.9.1