From 890eafcf31f5f8d519bb9e6f9c15303be5328e2d Mon Sep 17 00:00:00 2001
From: KKbes <1620284052@qq.com>
Date: 星期一, 07 八月 2023 10:48:54 +0800
Subject: [PATCH] review

---
 force-app/main/default/classes/LexOpdCommitApprovalController.cls-meta.xml               |    5 
 force-app/main/default/lwc/lexOPDCommitNeedApproval/lexOPDCommitNeedApproval.html        |    0 
 force-app/main/default/classes/LexCommitNeedApprovalController.cls                       |    4 
 force-app/main/default/lwc/lexProductRepairQuoteProduct/lexProductRepairQuoteProduct.js  |   14 -
 force-app/main/default/lwc/lexExistingInquiry/lexExistingInquiry.js                      |   15 -
 force-app/main/default/lwc/lexNewOPDButtonAccount/lexNewOPDButtonAccount.js              |    3 
 force-app/main/default/lwc/lexCommitNeedApproval/lexCommitNeedApproval.js                |   24 ++-
 force-app/main/default/lwc/lexOPDCommitNeedApproval/lexOPDCommitNeedApproval.js          |  106 +++++++++++++++
 /dev/null                                                                                |   31 ----
 force-app/main/default/lwc/lexNewIntention/lexNewIntention.js                            |   49 +++---
 force-app/main/default/lwc/lexOPDCommitNeedApproval/lexOPDCommitNeedApproval.js-meta.xml |    2 
 force-app/main/default/lwc/lexMeetingDelayApplyCampaign/lexMeetingDelayApplyCampaign.js  |   12 -
 force-app/main/default/classes/LexAgenceCopyPIController.cls-meta.xml                    |    5 
 force-app/main/default/classes/LexAgenceCopyPIController.cls                             |   58 ++++++++
 force-app/main/default/classes/LexInquiryController.cls                                  |    4 
 force-app/main/default/classes/LexOpdCommitApprovalController.cls                        |   36 +++++
 force-app/main/default/lwc/lexNewOPDButtonOpportunity/lexNewOPDButtonOpportunity.js      |    3 
 force-app/main/default/classes/LexNewIntentionController.cls                             |    9 
 18 files changed, 276 insertions(+), 104 deletions(-)

diff --git a/force-app/main/default/classes/LexAgenceCopyPIController.cls b/force-app/main/default/classes/LexAgenceCopyPIController.cls
new file mode 100644
index 0000000..e064021
--- /dev/null
+++ b/force-app/main/default/classes/LexAgenceCopyPIController.cls
@@ -0,0 +1,58 @@
+public with sharing class LexAgenceCopyPIController {
+    //.瀹㈡埛浜哄憳鐨勫鍒舵寜閽�
+    @AuraEnabled
+    public static Agency_Contact__c init(String recordId){
+        Agency_Contact__c res = new Agency_Contact__c();
+        try{
+            res = [SELECT Id,Name,Department_Class__c,Contact__c,Agency_ID__c,
+            Type__c,    Doctor_Division1__c,    Agency_Hospital__c,AWS_Data_Id__c
+                FROM Agency_Contact__c 
+                    WHERE Id=:recordId];
+            return res;
+        }
+        catch (Exception e) {
+            return null;
+        }
+    }
+
+    //瀹㈡埛浜哄憳鐨勫鍒舵寜閽�
+    @AuraEnabled
+    public static String init2(String recordId){
+        String s='';
+        try {
+            String objectName = 'Contact'; // 瑕佽幏鍙栧瓧娈电殑瀵硅薄鍚�
+            Map<String, Schema.SObjectType> globalDescribe = Schema.getGlobalDescribe();
+            Schema.SObjectType objType = globalDescribe.get(objectName);
+            if (objType != null) {
+                Schema.DescribeSObjectResult objDescribe = objType.getDescribe();
+                Map<String, Schema.SObjectField> fieldMap = objDescribe.fields.getMap();
+                s+='SELECT ';
+                // 鐜板湪锛宖ieldMap涓寘鍚簡瀵硅薄鐨勬墍鏈夊瓧娈典俊鎭�
+                for (String fieldName : fieldMap.keySet()) {
+                    if(!fieldName.equals('id'))
+                        s+=fieldName+',';
+                }
+
+                s=s.removeEnd(',');
+                s+=' FROM Contact where id=\''+recordId+'\'';
+                system.debug('SQL:'+s);
+                List<Contact> opportunitys = Database.query(s);
+                s='';
+                if(opportunitys.size()>0){
+                    system.debug('in!');
+                    for (String fieldName : fieldMap.keySet()) {
+                        String formaF=fieldMap.get(fieldName).getDescribe().getName();
+                        if(opportunitys.get(0).get(fieldName)!=null&&!opportunitys.get(0).get(fieldName).equals('null'))
+                            s+=formaF+'='+opportunitys.get(0).get(fieldName)+',';
+                    }
+                    s=s.removeEnd(',');
+                    return s;
+                }
+            }
+            return s;
+        } catch (Exception e) {
+            System.debug('LexAgenceCopyPIController init2 error:'+e.getMessage());
+        }
+        return s;
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexAgenceCopyPIController.cls-meta.xml b/force-app/main/default/classes/LexAgenceCopyPIController.cls-meta.xml
new file mode 100644
index 0000000..70f89f4
--- /dev/null
+++ b/force-app/main/default/classes/LexAgenceCopyPIController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>51.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexCommitNeedApprovalController.cls b/force-app/main/default/classes/LexCommitNeedApprovalController.cls
index 5cbdbd8..46b0a1e 100644
--- a/force-app/main/default/classes/LexCommitNeedApprovalController.cls
+++ b/force-app/main/default/classes/LexCommitNeedApprovalController.cls
@@ -15,15 +15,17 @@
     }
 
     @AuraEnabled
-    public static void  newUpdateMeetingDelayApply(String Id){
+    public static String  newUpdateMeetingDelayApply(String Id){
         meeting_delay_apply__c res = new meeting_delay_apply__c();
         try{
             res.Id=Id;
             res.Status__c ='鎻愪氦';
             update res;
+            return 'succuse';
         }
         catch (Exception e) {
             System.debug(LoggingLevel.INFO, '*** e: ' + e);
+            return e.getMessage();
         }
 
     } 
diff --git a/force-app/main/default/classes/LexInquiryController.cls b/force-app/main/default/classes/LexInquiryController.cls
index 4d1621f..3c985fe 100644
--- a/force-app/main/default/classes/LexInquiryController.cls
+++ b/force-app/main/default/classes/LexInquiryController.cls
@@ -50,8 +50,8 @@
     public static String makeAndUpdateLead(String leadId,String Id,String QuoteIraiId){
         Lead res = new Lead();
         try{
-            res.Id =  leadId;
-            res.Opp_Name_Search__c =  Id;
+            res.Id =  Id;
+            res.Opp_Name_Search__c =  leadId;
                 if(QuoteIraiId != ''){
                     res.LatestQuotationEntrustment__c=QuoteIraiId;
                 }
diff --git a/force-app/main/default/classes/LexNewIntentionController.cls b/force-app/main/default/classes/LexNewIntentionController.cls
index f508d2b..a038d6c 100644
--- a/force-app/main/default/classes/LexNewIntentionController.cls
+++ b/force-app/main/default/classes/LexNewIntentionController.cls
@@ -11,12 +11,13 @@
             Sales_Method__c,Request__c,Request_Detail__c 
                 FROM Agency_Opportunity__c
                     WHERE  Id = : recordId];
+            return res;
 
         }
         catch(Exception e){
             System.debug(LoggingLevel.INFO, '*** e: ' + e);
+            return null;
         }
-        return res;
 
     }
 
@@ -29,8 +30,9 @@
         }
         catch (Exception e) {
             System.debug(LoggingLevel.INFO, '*** e: ' + e);
+            return null;
         }
-        return null;
+
     }
 
         @AuraEnabled
@@ -41,7 +43,8 @@
         }
         catch (Exception e) {
             System.debug(LoggingLevel.INFO, '*** e: ' + e);
+            return null;
         }
-        return null;
+        
     }
 }
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexOpdCommitApprovalController.cls b/force-app/main/default/classes/LexOpdCommitApprovalController.cls
new file mode 100644
index 0000000..0daa0cb
--- /dev/null
+++ b/force-app/main/default/classes/LexOpdCommitApprovalController.cls
@@ -0,0 +1,36 @@
+public with sharing class LexOpdCommitApprovalController {
+    @AuraEnabled
+    public static CancelPostponePlan__c init(String recordId){
+        CancelPostponePlan__c res = new CancelPostponePlan__c();
+        try{
+            res = [Select Id,Status__c,CancelOPDPlan__c
+                FROM CancelPostponePlan__c
+                    WHERE  Id = : recordId];
+        }
+        catch(Exception e){
+            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+        }
+        return res;
+    }
+
+    @AuraEnabled
+    public static String  newUpdateCancelPostponePlan(String Id,String Status){
+        CancelPostponePlan__c res = new CancelPostponePlan__c();
+        try{
+            res.Id=Id;
+            if(Status == '鍙栨秷'){
+                res.Status__c ='鎻愪氦';
+            }
+            else if (Status == '寤舵湡鎶ュ憡'){
+                res.Status__c ='寤舵湡鎻愪氦';
+            }
+            update res;
+            return 'success';
+        }
+        catch (Exception e) {
+            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+            return e.getMessage();
+        }
+
+    } 
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexOpdCommitApprovalController.cls-meta.xml b/force-app/main/default/classes/LexOpdCommitApprovalController.cls-meta.xml
new file mode 100644
index 0000000..70f89f4
--- /dev/null
+++ b/force-app/main/default/classes/LexOpdCommitApprovalController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>51.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexAgenceCopyPI/lexAgenceCopyPI.js b/force-app/main/default/lwc/lexAgenceCopyPI/lexAgenceCopyPI.js
deleted file mode 100644
index cdacba3..0000000
--- a/force-app/main/default/lwc/lexAgenceCopyPI/lexAgenceCopyPI.js
+++ /dev/null
@@ -1,31 +0,0 @@
-import { LightningElement, track, wire,api } from 'lwc';
-import { CurrentPageReference } from "lightning/navigation";
-import { CloseActionScreenEvent } from 'lightning/actions';
-export default class lexAgenceCopyPI extends LightningElement {
-
-	@api recordId;
-	IsLoading=true;
-
-	@wire(CurrentPageReference)
-    getStateParameters(currentPageReference) {
-        if (currentPageReference) {
-          const urlValue = currentPageReference.state.recordId;
-          if (urlValue) {
-            let str = `${urlValue}`;
-            this.recordId = str;
-          }
-        }
-    }
-
-    connectedCallback(){
-        this.CopyPI().then(result => {
-            this.IsLoading=false;
-            this.dispatchEvent(new CloseActionScreenEvent());
-        });
-    }
-
-
-    async CopyPI(){
-    	window.location.href = "/"+this.recordId+"/e?newclone=1";
-    }
-}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCommitNeedApproval/lexCommitNeedApproval.js b/force-app/main/default/lwc/lexCommitNeedApproval/lexCommitNeedApproval.js
index 0c04c86..450dd27 100644
--- a/force-app/main/default/lwc/lexCommitNeedApproval/lexCommitNeedApproval.js
+++ b/force-app/main/default/lwc/lexCommitNeedApproval/lexCommitNeedApproval.js
@@ -59,6 +59,7 @@
 
 
     async commitNeedApproval(){
+    	var changeFlg=0;
     	var NowStatus = this.MeetingDelayApply.status__c;
 		if(NowStatus == "鑽夋涓�" || NowStatus == "椹冲洖"){
 			var campaignId = this.MeetingDelayApply.campaign__c; //瀛︿細id
@@ -83,7 +84,6 @@
             message: '涓�鏃︽彁浜ゆ璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵',
             variant: 'headerless',
             label: 'this is the aria-label value',
-            // setting theme would have no effect
         });
         if(!result){
         	return;
@@ -92,16 +92,20 @@
 		if(NowStatus == "鑽夋涓�" || NowStatus == "椹冲洖"){
 			await newUpdateMeetingDelayApply({Id : this.recordId })
 			.then(result=>{
-			}).catch(error=>{
-				const event2 = new ShowToastEvent({
-	          	 	message:
-	          	  error.message,
-	          	  variant : 'error'
-        	});
-        	this.dispatchEvent(event2);
-		});
+				if(result!='success'){
+					const event2 = new ShowToastEvent({
+	          	 		message:
+	          	  		result,
+	          	  		variant : 'error'
+        			});
+        			changeFlg+=1;
+        			this.dispatchEvent(event2);	
+				}
+			});
 		}
-		
+		if(changeFlg!=0){
+			return;
+		}		
 
 		//4. 杩涚▼鐢熸垚鍣�
 
diff --git a/force-app/main/default/lwc/lexExistingInquiry/lexExistingInquiry.js b/force-app/main/default/lwc/lexExistingInquiry/lexExistingInquiry.js
index bd43c23..71b4cd8 100644
--- a/force-app/main/default/lwc/lexExistingInquiry/lexExistingInquiry.js
+++ b/force-app/main/default/lwc/lexExistingInquiry/lexExistingInquiry.js
@@ -1,5 +1,4 @@
 //author : kk   
-//self  review  鏇存柊澶辫触杩斿洖鐨勯敊璇俊鎭病鏈変箣鍓峜lass鐨勫ソ銆傜粰鍑虹殑閮芥槸鎰忎箟涓嶆槑鐨勬姤閿�
 
 import { LightningElement, track, wire , api  } from 'lwc';
 
@@ -74,11 +73,9 @@
 
 
      connectedCallback(){
-        console.log(this.recordId);
         init({
             recordId: this.recordId
         }).then(result => {
-            console.log(result);
             if (result != null) {
                 this.Task = result;
                 this.ExistingInquiry().then(result=>{
@@ -86,9 +83,6 @@
                     this.dispatchEvent(new CloseActionScreenEvent());
                 });
             }
-        }).catch(error => {
-            console.log("error");
-            console.log(error);
         });
 
     }
@@ -112,13 +106,10 @@
                     await getQuoteIrai({QuoteIraiId : this.Task.QuoteIraiId__c
                     }).then(res=>{
                         this.NewTask=res;
-                    }).catch(err=>{
-                        console.log("err:",err.message);
                     });
-
                     if(this.NewTask.Lead__c){
                          // Lead浣滄垚骞舵洿
-                        await makeAndUpdateLead({ Lead_c : this.Opportunity.Lead__c, Id : this.NewTask.Id, 
+                        await makeAndUpdateLead({ Lead_c : this.Opportunity.Id, Id : this.NewTask.Lead__c, 
                                QuoteIraiId__c : this.Task.QuoteIraiId__c
                         }).then(res=>{
                             if(res !='success'){
@@ -135,7 +126,7 @@
                             return;
                         }
                         // 鍒ゆ柇鎶ヤ环濮旀墭
-                            if( this.Task.QuoteIraiId__c != '') {
+                            if( this.Task.QuoteIraiId__c != '' && this.Task.QuoteIraiId__c!=undefined) {
                                 // 鎶ヤ环濮旀墭浣滄垚
                                 await makeAndUpdateQuoteIrai({ QuoteIraiStatus : "宸叉湁璇环", Id : this.Task.QuoteIraiId__c 
                                 }).then(res=>{
@@ -196,4 +187,4 @@
     
 
 
-}
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexMeetingDelayApplyCampaign/lexMeetingDelayApplyCampaign.js b/force-app/main/default/lwc/lexMeetingDelayApplyCampaign/lexMeetingDelayApplyCampaign.js
index 4f4f61c..77b23ad 100644
--- a/force-app/main/default/lwc/lexMeetingDelayApplyCampaign/lexMeetingDelayApplyCampaign.js
+++ b/force-app/main/default/lwc/lexMeetingDelayApplyCampaign/lexMeetingDelayApplyCampaign.js
@@ -15,27 +15,27 @@
 const event1 = new ShowToastEvent({
 	            	message:
 	                "瀛樺湪瀹℃壒涓殑浼氳寤舵湡鐢宠锛屾棤娉曞啀娆℃彁浜ゅ欢鏈熺敵璇枫��!",
-	                variant : "warning" 
+	                variant : "error" 
 });
 const event2 = new ShowToastEvent({
 	            	message:
 	                "鑰楁潗鍊熷嚭鐢宠鐨勭姸鎬佹湭澶勪簬`鑽夋涓璥鎴朻鍙栨秷`锛岃浼氳鍙兘鍙栨秷,鏃犳硶寤舵湡銆�",
-	                 variant : "warning"
+	                 variant : "error"
 });
 const event3 = new ShowToastEvent({
 	            	message:
 	                "澶囧搧鍊熷嚭鐢宠鐨勭姸鎬佹湭澶勪簬`鑽夋涓璥鎴朻鍙栨秷`锛岃浼氳鍙兘鍙栨秷,鏃犳硶寤舵湡銆�",
-	                 variant : "warning"
+	                 variant : "error"
 });
 const event4 = new ShowToastEvent({
 	            	message:
 	                "璇ユ椿鍔ㄤ俊鎭凡鍙戦�佸埌鏅烘収鍖荤枟锛岃纭鍚庡啀鎿嶄綔",
-	                 variant : "warning"
+	                 variant : "error"
 });
 const event5 = new ShowToastEvent({
 	            	message:
 	                "璇ヤ細璁笉鍦ㄥ叕寮�涓垨鐢宠涓紝鍙兘鍙栨秷锛屾棤娉曞欢鏈熴��",
-	                 variant : "warning"
+	                 variant : "error"
 });
 export default class lexMeetingDelayApplyCampaign extends NavigationMixin(LightningElement) {
 	@api recordId;
@@ -50,14 +50,12 @@
           if (urlValue) {
             let str = `${urlValue}`;
             this.recordId = str;
-            console.log(this.recordId);
           }
         }
     }
 
 	connectedCallback(){
 		init({recordId:this.recordId}).then(res=>{
-			console.log(res);
 			this.Campaign=res;
 			this.meetingDelayApply().then(res=>{
 				this.IsLoading=false;
diff --git a/force-app/main/default/lwc/lexNewIntention/lexNewIntention.js b/force-app/main/default/lwc/lexNewIntention/lexNewIntention.js
index 85f04dc..a62af77 100644
--- a/force-app/main/default/lwc/lexNewIntention/lexNewIntention.js
+++ b/force-app/main/default/lwc/lexNewIntention/lexNewIntention.js
@@ -4,10 +4,18 @@
 import { ShowToastEvent } from 'lightning/platformShowToastEvent';
 
 import init  from '@salesforce/apex/LexNewIntentionController.init';
+import getRecordIdByName  from '@salesforce/apex/LexSubmitCampaignController.getRecordIdByName';
 import getAccountByLongName  from '@salesforce/apex/LexNewIntentionController.getAccountByLongName';
 import getAccountByShortName  from '@salesforce/apex/LexNewIntentionController.getAccountByShortName';
-
-
+import Agency_Opportunity from '@salesforce/label/c.Agency_Opportunity';
+import Opportunity_stage from '@salesforce/label/c.Opportunity_stage';
+import Opp_Name from '@salesforce/label/c.Opp_Name';
+import Purchase_Reason from '@salesforce/label/c.Purchase_Reason';
+import Fund_Basis from '@salesforce/label/c.Fund_Basis';
+import Purchase_Type from '@salesforce/label/c.Purchase_Type';
+import Sales_Method from '@salesforce/label/c.Sales_Method';
+import Request from '@salesforce/label/c.Request';
+import Request_Detail from '@salesforce/label/c.Request_Detail';
 
 
   const event1 = new ShowToastEvent({
@@ -30,7 +38,6 @@
           const urlValue = currentPageReference.state.recordId;
           if (urlValue) {
             let str = `${urlValue}`;
-            console.log(str);
             this.recordId = str;
           }
         }
@@ -43,17 +50,14 @@
         init({
             recordId: this.recordId
         }).then(result => {
-            console.log(result);
             if (result != null) {
                 this.AgencyOpportunity = result;
                 this.newIntention().then(result=>{
                 	IsLoading=false;
                 	this.dispatchEvent(new CloseActionScreenEvent());
                 });
+                this.judageWhertherNull();
             }
-        }).catch(error => {
-            console.log("error");
-            console.log(error);
         });
 
     }
@@ -71,35 +75,32 @@
 	var accountID = '';
 		if(accountrecords.length > 0){
 			accountID = accountrecords[0].Id;
-			console.log('闀縩ame杩斿洖闀垮害澶т簬0')
 		}
 		if (accountID == '') {
 			accountName = this.AgencyOpportunity.Department_Class_Opp_Name__c;
 			accountrecords =  await getAccountByShortName({Name : accountName});
 				if(accountrecords.length > 0){
 					accountID = accountrecords[0].Id;
-					console.log('shortName return size 銆� 0')
 				}
 		}
-	var url = '/apex/NewAndEditLead?' + '00N10000009HKSP=' + this.AgencyOpportunity.Id
-	+ '&LeadSource=缁忛攢鍟�' + '&00N10000006qOFb=' + this.AgencyOpportunity.StageName__c 
-	+ '&00N10000006qOF0=' + this.AgencyOpportunity.Close_Forecasted_Date__c 
-	+ '&00N10000002EjE1=' + this.AgencyOpportunity.Name 
-	+ '&00N10000008rqHf=' + this.AgencyOpportunity.Purchase_Reason__c 
-	+ '&00N10000008rqHd=' + this.AgencyOpportunity.Fund_Basis__c 
-	+ '&00N10000008rqHg=' + this.AgencyOpportunity.Purchase_Type__c 
-	+'&00N10000008rqHj=' + this.AgencyOpportunity.Sales_Method__c
-	+ '&00N10000008rqHi=' + this.AgencyOpportunity.Request__c
-	+ '&00N10000008rqHh=' + this.AgencyOpportunity.Request_Detail__c
+	//鍚庣浠g爜鍙栧弬鏁版暟鎹�,涓�涓�瀵瑰簲
+	var recordTypeId= await getRecordIdByName({Name : '鎷滆鑾峰彇鐨勬剰鍚�'})
+	var url = '/apex/NewAndEditLead?' + Agency_Opportunity+'=' + this.AgencyOpportunity.Id
+	+ '&LeadSource=缁忛攢鍟�' + '&'+Opportunity_stage+'=' + this.AgencyOpportunity.StageName__c 
+	+ '&00N10000006qOF0=' + 	this.AgencyOpportunity.Close_Forecasted_Date__c 
+	+ '&'+Opp_Name+'=' + 		this.AgencyOpportunity.Name 
+	+ '&'+Purchase_Reason+'=' + this.AgencyOpportunity.Purchase_Reason__c 
+	+ '&'+Fund_Basis+'=' + 		this.AgencyOpportunity.Fund_Basis__c 
+	+ '&'+Purchase_Type+'=' + 	this.AgencyOpportunity.Purchase_Type__c 
+	+'&'+Sales_Method+'=' + 	this.AgencyOpportunity.Sales_Method__c
+	+ '&'+Request+'=' + 		this.AgencyOpportunity.Request__c
+	+ '&'+Request_Detail+'=' +  this.AgencyOpportunity.Request_Detail__c
 	+ '&CF00N10000002CvC5=' + accountName
 	+ '&CF00N10000002CvC5_lkid=' + accountID
-	+ '&RecordTypeId=01210000000QiRf' + '&retURL=%2F' + this.AgencyOpportunity.Id;
-
+	+ '&RecordTypeId='+recordTypeId + '&retURL=%2F' + this.AgencyOpportunity.Id;
 	window.open(url);
+
 	
-
-
     }
-
 
 }
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexNewOPDButtonAccount/lexNewOPDButtonAccount.js b/force-app/main/default/lwc/lexNewOPDButtonAccount/lexNewOPDButtonAccount.js
index de32fcf..17bf0c0 100644
--- a/force-app/main/default/lwc/lexNewOPDButtonAccount/lexNewOPDButtonAccount.js
+++ b/force-app/main/default/lwc/lexNewOPDButtonAccount/lexNewOPDButtonAccount.js
@@ -7,7 +7,7 @@
 const event1 = new ShowToastEvent({
 	            	message:
 	                "绉戝鐘舵�佷负鏃犳晥锛屼笉鍏佽鏂板缓OPD璁″垝",
-	                variant : "warning" 
+	                variant : "error" 
 });
 import init  from '@salesforce/apex/LexOPDSupplementaryController.initNewOPDButton';
 export default class lexNewOPDButtonAccount extends NavigationMixin(LightningElement) {
@@ -31,7 +31,6 @@
 	connectedCallback(){
 		init({recordId:this.recordId}).then(res=>{
 			if (res!=null) {
-				console.log(res);
 				this.Account=res;
 				this.newOPDButtonAccount().then(res=>{
 					this.IsLoading=false;
diff --git a/force-app/main/default/lwc/lexNewOPDButtonOpportunity/lexNewOPDButtonOpportunity.js b/force-app/main/default/lwc/lexNewOPDButtonOpportunity/lexNewOPDButtonOpportunity.js
index fac96cc..4203a64 100644
--- a/force-app/main/default/lwc/lexNewOPDButtonOpportunity/lexNewOPDButtonOpportunity.js
+++ b/force-app/main/default/lwc/lexNewOPDButtonOpportunity/lexNewOPDButtonOpportunity.js
@@ -7,7 +7,7 @@
 const event1 = new ShowToastEvent({
 	            	message:
 	                "璇环鐘舵�佷负锛氬け鍗曘�佸彇娑堛�佹敞娈嬨�佸彂璐с�佸畬姣曪紝涓嶅厑璁稿垱寤篛PD璁″垝",
-	                variant : "warning" 
+	                variant : "error" 
 });
 import init  from '@salesforce/apex/LexOPDSupplementaryController.initNewOPDButton2';
 export default class lexNewOPDButtonOpportunity extends NavigationMixin(LightningElement) {
@@ -30,7 +30,6 @@
 	connectedCallback(){
 		init({recordId:this.recordId}).then(res=>{
 			if (res!=null) {
-				console.log(res);
 				this.Opportunity=res;
 				this.newOPDButtonOpportunity().then(res=>{
 					this.IsLoading=false;
diff --git a/force-app/main/default/lwc/lexAgenceCopyPI/lexAgenceCopyPI.html b/force-app/main/default/lwc/lexOPDCommitNeedApproval/lexOPDCommitNeedApproval.html
similarity index 100%
rename from force-app/main/default/lwc/lexAgenceCopyPI/lexAgenceCopyPI.html
rename to force-app/main/default/lwc/lexOPDCommitNeedApproval/lexOPDCommitNeedApproval.html
diff --git a/force-app/main/default/lwc/lexOPDCommitNeedApproval/lexOPDCommitNeedApproval.js b/force-app/main/default/lwc/lexOPDCommitNeedApproval/lexOPDCommitNeedApproval.js
new file mode 100644
index 0000000..a593fba
--- /dev/null
+++ b/force-app/main/default/lwc/lexOPDCommitNeedApproval/lexOPDCommitNeedApproval.js
@@ -0,0 +1,106 @@
+//author锛歬kbes   澧炲姞LexOpdCommitApprovalController  
+import { LightningElement, track, wire,api } from 'lwc';
+import LightningConfirm from 'lightning/confirm';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import init  from '@salesforce/apex/LexOpdCommitApprovalController.init';
+import newUpdateCancelPostponePlan  from '@salesforce/apex/LexOpdCommitApprovalController.newUpdateCancelPostponePlan';
+import changeTrade  from '@salesforce/apex/OpdPlanWebService.changeTrade';
+
+
+
+const event1 = new ShowToastEvent({
+	            	title: '鐘舵�侀敊璇�',
+	            	message:
+	                "鍙湁鍙栨秷鎴栬�呭欢鏈熸姤鍛婄姸鎬佹墠鍙互杩涜瀹℃壒!",
+});
+export default class lexOPDCommitNeedApproval extends LightningElement {
+
+	@api recordId;
+	IsLoading=true;
+	CancelPostponePlan;
+
+	@wire(CurrentPageReference)
+    getStateParameters(currentPageReference) {
+        if (currentPageReference) {
+          const urlValue = currentPageReference.state.recordId;
+          if (urlValue) {
+            let str = `${urlValue}`;
+            this.recordId = str;
+          }
+        }
+    }
+
+    connectedCallback(){
+        init({
+            recordId: this.recordId
+        }).then(result => {
+            if (result != null) {	
+                this.CancelPostponePlan = result;
+                this.OPDCommitApproval().then(result=>{
+                	this.IsLoading=false;
+					this.dispatchEvent(new CloseActionScreenEvent());	
+                });
+            }
+        }).catch(error => {
+			const event3 = new ShowToastEvent({
+	           	title: '椤甸潰鍒濆鍖栭敊璇�',
+	           	message:
+	            error.message,
+        	});
+        	this.dispatchEvent(event3);
+        });
+
+    }
+
+
+    async  OPDCommitApproval(){
+    	var changeFlg=0;
+    	var NowStatus = this.CancelPostponePlan.Status__c;
+		if(NowStatus == "鍙栨秷" || NowStatus == "寤舵湡鎶ュ憡"){
+			var opdplanid = this.CancelPostponePlan.CancelOPDPlan__c; //瀛︿細id
+			var rtn = await changeTrade({opdplanId:opdplanid});
+			if (rtn != 'OK') {
+				const event = new ShowToastEvent({
+	            	title: '澶辫触',
+	            	message:
+	                rtn,
+        		});
+        		this.dispatchEvent(event);
+				return;
+			}
+		}
+		if(NowStatus != "鍙栨秷" && NowStatus != "寤舵湡鎶ュ憡"){
+    		this.dispatchEvent(event1);
+    		return;
+    	}
+		const result = await LightningConfirm.open({
+            message: '涓�鏃︽彁浜ゆ璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵',
+            variant: 'headerless',
+            label: 'this is the aria-label value',
+        });
+        if(!result){
+        	return;
+        }
+		await newUpdateCancelPostponePlan({Id : this.recordId ,Status : this.CancelPostponePlan.Status__c})
+		.then(result=>{
+			if(result!='success'){
+				const event2 = new ShowToastEvent({
+		          	message:
+		            result,
+		            variant : 'error'
+	        	});
+	        	changeFlg+=1;
+	        	this.dispatchEvent(event2);
+			}
+		});
+		if(changeFlg!=0){
+			return;
+		}
+		setTimeout(function(){
+				window.location.href = window.location;
+			}, 1500 )
+    }
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexAgenceCopyPI/lexAgenceCopyPI.js-meta.xml b/force-app/main/default/lwc/lexOPDCommitNeedApproval/lexOPDCommitNeedApproval.js-meta.xml
similarity index 90%
rename from force-app/main/default/lwc/lexAgenceCopyPI/lexAgenceCopyPI.js-meta.xml
rename to force-app/main/default/lwc/lexOPDCommitNeedApproval/lexOPDCommitNeedApproval.js-meta.xml
index 0d273fe..15307ea 100644
--- a/force-app/main/default/lwc/lexAgenceCopyPI/lexAgenceCopyPI.js-meta.xml
+++ b/force-app/main/default/lwc/lexOPDCommitNeedApproval/lexOPDCommitNeedApproval.js-meta.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexAgenceCopyPI">
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexOPDCommitNeedApproval">
     <apiVersion>51.0</apiVersion>
     <isExposed>true</isExposed>
     <targets>
diff --git a/force-app/main/default/lwc/lexProductRepairQuoteProduct/lexProductRepairQuoteProduct.js b/force-app/main/default/lwc/lexProductRepairQuoteProduct/lexProductRepairQuoteProduct.js
index e00356f..3f6644a 100644
--- a/force-app/main/default/lwc/lexProductRepairQuoteProduct/lexProductRepairQuoteProduct.js
+++ b/force-app/main/default/lwc/lexProductRepairQuoteProduct/lexProductRepairQuoteProduct.js
@@ -13,10 +13,8 @@
     getStateParameters(currentPageReference) {
         if (currentPageReference) {
           const urlValue = currentPageReference.state.recordId;
-          console.log(currentPageReference);
           if (urlValue) {
             let str = `${urlValue}`;
-            console.log(str);
             this.recordId = str;
 
           }
@@ -25,20 +23,18 @@
 
 
     connectedCallback(){
-        this.productRepairQuoteProduct().then(res=>{
-			this.IsLoading=false;
-			this.dispatchEvent(new CloseActionScreenEvent());
+      this.productRepairQuoteProduct().then(res=>{
+			  this.IsLoading=false;
+			  this.dispatchEvent(new CloseActionScreenEvent());
 		});
 
     }
 
 
 
-    async productRepairQuoteProduct(){
-    	
+    async productRepairQuoteProduct(){  	
     	window.open ('/apex/ProductRepairQuote?productid=' + this.recordId +
-    		'&flag=productsearch', '', 'height=500, width=1200, top=300, left=350,location=no');
-    
+    		'&flag=productsearch', '', 'height=500, width=1200, top=300, left=350,location=no');   
     }
 
 

--
Gitblit v1.9.1