From d77b6353ca9b59a6398df3eae9912f9fd766946d Mon Sep 17 00:00:00 2001
From: zhangzhengmei <zhangzhengmei@prec-tech.com>
Date: 星期六, 05 八月 2023 17:04:22 +0800
Subject: [PATCH] fix: lightning 页面确认

---
 force-app/main/default/lwc/lexRentalFixtureSetAssign/lexRentalFixtureSetAssign.js |   70 +++++++++++++++++++++++++++++++++++
 1 files changed, 70 insertions(+), 0 deletions(-)

diff --git a/force-app/main/default/lwc/lexRentalFixtureSetAssign/lexRentalFixtureSetAssign.js b/force-app/main/default/lwc/lexRentalFixtureSetAssign/lexRentalFixtureSetAssign.js
new file mode 100644
index 0000000..3c2f3ba
--- /dev/null
+++ b/force-app/main/default/lwc/lexRentalFixtureSetAssign/lexRentalFixtureSetAssign.js
@@ -0,0 +1,70 @@
+import { LightningElement, track, wire, api } from 'lwc';
+import {CurrentPageReference} from 'lightning/navigation';
+import init from '@salesforce/apex/lexRentalFixtureSetAssignController.init';
+import assignBtn from '@salesforce/apex/RentalApplyWebService.AssignBtn';
+
+export default class lexRentalFixtureSetAssign extends LightningElement {
+	@api recordId
+	msg;
+	@wire(CurrentPageReference)
+	getStateParameters(currentPageReference){
+		console.log("杩涘叆椤甸潰");
+		if(currentPageReference){
+			const urvalue=currentPageReference.state.recordId;
+			if(urvalue){
+				let str=`${urvalue}`;
+				this.recordId=str;
+			}
+		}
+	}
+
+	connectedCallback(){
+		init({
+			recordId:this.recordId
+		}).then(result =>{
+			console.log(this.recordId);
+			console.log(result);
+			let res = result.ra;
+			console.log("res==="+JSON.stringify(res));
+			if(res.Campaign__c != '' || res.Campaign__c != undefined){
+				if(res.CampaignStatus == '鍙栨秷'){
+					this.msg = '瀛︿細鍙栨秷锛屼笉鍙垎閰�';
+					return;
+				}
+			}
+
+			if(res.Repair__c != '' || res.Repair__c != undefined){
+				if(res.Repair_Final_Inspection_Date_F__c != null && res.Repair_Final_Inspection_Date_F__c !='' || (res.RC_return_to_office__c!=null && res.RC_return_to_office__c != '')){
+					this.msg = '淇悊鏈夋渶缁堟娴嬫棩鎴栦慨鐞嗗搧杩旈�佹棩锛屼笉鍙垎閰�';
+					return;
+				}
+			}
+
+			assignBtn({
+				Rid: this.recordId
+			}).then(resultMsg=>{
+				if(res.Status__c == '鍙栨秷' && res.Rental_Apply_Equipment_Set_Cnt__c != 0){
+					window.open("/apex/RentalFixtureSetAssign?pt_recid=" + this.recordId); 
+					this.closeAction();
+				}else if((res.demo_purpose2__c == '瀛︿細灞曚細' || res.demo_purpose2__c == '璇鹃鐮旂┒' || res.demo_purpose2__c == '鍩硅涓績')&& res.Status__c == '鑽夋涓�'){
+					this.msg = "涓嶈兘鍒嗛厤锛岃纭鐢宠鐨勭姸鎬�";
+					return
+				}else if((res.demo_purpose2__c =='璇曠敤锛堟棤璇环锛�' || res.demo_purpose2__c == '璇曠敤锛堟湁璇环锛�' || res.demo_purpose2__c =='鍔ㄧ墿瀹為獙' || res.demo_purpose2__c == '涓�鑸淮淇唬鐢�' || res.demo_purpose2__c== '淇濅慨鍚堝悓鐢ㄦ埛缁翠慨浠g敤' || res.demo_purpose2__c == '宸茶喘寰呰揣') && res.Status__c != '宸叉壒鍑�' && res.Status__c != '宸插嚭搴撴寚绀�'){
+					this.msg = "涓嶈兘鍒嗛厤锛岃纭鐢宠鐨勭姸鎬�";
+					return;
+				}else if(resultMsg == 'Fin'){
+					window.open("/apex/RentalFixtureSetAssign?pt_recid=" + this.recordId); 
+					this.closeAction();
+				}else{
+					this.msg = resultMsg;
+					return;
+				}
+			})
+		})
+	}
+
+	closeAction() {
+        //杩斿洖褰撳墠鐨勫鍝佺敵璇�
+		window.open("/"+this.recordId,'_self');
+    }
+}
\ No newline at end of file

--
Gitblit v1.9.1