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 ++++----------------------------------------
 force-app/main/default/pages/RentalApplyQR.page                                         |   26 ++---
 .vim-force.com/session.properties                                                       |    0 
 force-app/main/default/pages/RentalApplyBR.page                                         |    4 
 manifest/packagerentalapply.xml                                                         |   12 ++
 5 files changed, 47 insertions(+), 220 deletions(-)

diff --git a/.vim-force.com/session.properties b/.vim-force.com/session.properties
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/.vim-force.com/session.properties
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
diff --git a/force-app/main/default/pages/RentalApplyBR.page b/force-app/main/default/pages/RentalApplyBR.page
index 28bbee8..65d2ad3 100644
--- a/force-app/main/default/pages/RentalApplyBR.page
+++ b/force-app/main/default/pages/RentalApplyBR.page
@@ -99,10 +99,10 @@
                 var version = new sforce.SObject("ContentVersion");
                 version = sforce.connection.query("select Id,ContentDocumentId from ContentVersion where ContentDocumentId = \'" + records[0].id + "\'");
                 version = version.getArray("records"); 
-                if(version[0].Id != "{!Rental_Apply__c.QRId__c}"){
+                if(version[0].Id != "{!Rental_Apply__c.BRId__c}"){
                     var es = new sforce.SObject("Rental_Apply__c");
                     es.Id = "{!Rental_Apply__c.Id}";
-                    es.QRId__c = version[0].id;
+                    es.BRId__c = version[0].Id;
                     result = sforce.connection.update([es]);
                 }
             } else {
diff --git a/force-app/main/default/pages/RentalApplyQR.page b/force-app/main/default/pages/RentalApplyQR.page
index f368137..64ff787 100644
--- a/force-app/main/default/pages/RentalApplyQR.page
+++ b/force-app/main/default/pages/RentalApplyQR.page
@@ -23,7 +23,7 @@
                 record = sforce.connection.query("select Id from ContentDocument where Id in (" + idList + ") and Title = \'QRCode-{!Rental_Apply__c.Name}\'");
             }           
              // 鏃€伀銇傘倢銇扮劇瑕�
-             console.log("record.size--------888------------",record.size);
+             console.log("record.size--------888------------",record.size+'~'+record.getArray("records"));
             if (record.size == 0) {
                 console.log("record.size--------777------------",record.size);
                 var version = new sforce.SObject("ContentVersion");
@@ -53,27 +53,21 @@
                 result = sforce.connection.update([es]);
                 // window.location = '/' + '{!Rental_Apply__c.Id}';
             //鐢宠涔︽洿鏂板け璐ョ殑璇濆啀娆℃洿鏂�
-            } else if ("{!Rental_Apply__c.QRId__c}" == '' || "{!Rental_Apply__c.QRId__c}" == null) {
-                console.log("record.size--------666------------",record.size);
-                // var records = record.getArray("records");
-                // var es = new sforce.SObject("Rental_Apply__c");
-                // es.Id = "{!Rental_Apply__c.Id}";
-                // es.QRId__c = records[0].Id;
-                // result = sforce.connection.update([es]);
-                // TODO Name澶夈倧銈嬪彲鑳芥�с亗銈娿�乽psert銇仐銇俱仚
+            } else {
+                // 20240113 ljh update start 
                 var records = record.getArray("records");
+                console.log('zheliupdate:'+records[0].Id);
                 var version = new sforce.SObject("ContentVersion");
-                version = sforce.connection.query("select Id,ContentDocumentId from ContentVersion where ContentDocumentId = \'" + records[0].id + "\'");
+                version = sforce.connection.query("select Id,ContentDocumentId from ContentVersion where ContentDocumentId = \'" + records[0].Id + "\'");
                 version = version.getArray("records"); 
-                if(version[0].id != "{!Rental_Apply__c.QRId__c}"){
+                // 瀛樺湪qr鏃讹紝缁戝埌娓呭崟涓�
+                if(version[0].Id != "{!Rental_Apply__c.QRId__c}"){
                     var es = new sforce.SObject("Rental_Apply__c");
-                    es.Id = "{!Rental_Apply__c.Id}";
-                    es.QRId__c = version[0].id;
+                    es.Id =  "{!Rental_Apply__c.Id}";
+                    es.QRId__c = version[0].Id;
                     result = sforce.connection.update([es]);
                 }
-            } else {
-                
-                // alert(record[0].Id);
+                // 20240113 ljh update end
             }
             // //20231027 ymh娣诲姞娉ㄩ噴  lighting淇敼闄勪欢涓婁紶 end
         }
diff --git a/manifest/packagerentalapply.xml b/manifest/packagerentalapply.xml
new file mode 100644
index 0000000..9c9eb8f
--- /dev/null
+++ b/manifest/packagerentalapply.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<Package xmlns="http://soap.sforce.com/2006/04/metadata">
+    <types>
+        <members>LexOPDSupplementaryController</members>
+        <name>ApexClass</name>
+    </types>
+    <types>
+        <members>lexOPDPlanCommitNeedApproval</members>
+        <name>LightningComponentBundle</name>
+    </types>
+    <version>59.0</version>
+</Package>
\ No newline at end of file

--
Gitblit v1.9.1