From 1b84706ff2f7f4bd19bb357b29a213e6cc6998d7 Mon Sep 17 00:00:00 2001
From: KKbes <1620284052@qq.com>
Date: 星期一, 26 六月 2023 16:58:18 +0800
Subject: [PATCH] 新建意向按钮和修理报价预估按钮

---
 force-app/main/default/lwc/lexNewIntention/lexNewIntention.js                                    |  103 ++++++++++++++++++++++++++++++++++
 force-app/main/default/lwc/lexNewIntention/lexNewIntention.js-meta.xml                           |   11 +++
 force-app/main/default/lwc/lexProductRepairQuoteProduct/lexProductRepairQuoteProduct.html        |    3 +
 force-app/main/default/lwc/lexProductRepairQuoteProduct/lexProductRepairQuoteProduct.js          |   47 +++++++++++++++
 force-app/main/default/lwc/lexProductRepairQuoteProduct/lexProductRepairQuoteProduct.js-meta.xml |   11 +++
 force-app/main/default/lwc/lexNewIntention/lexNewIntention.html                                  |    3 +
 6 files changed, 178 insertions(+), 0 deletions(-)

diff --git a/force-app/main/default/lwc/lexNewIntention/lexNewIntention.html b/force-app/main/default/lwc/lexNewIntention/lexNewIntention.html
new file mode 100644
index 0000000..af9fa97
--- /dev/null
+++ b/force-app/main/default/lwc/lexNewIntention/lexNewIntention.html
@@ -0,0 +1,3 @@
+<template>
+
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexNewIntention/lexNewIntention.js b/force-app/main/default/lwc/lexNewIntention/lexNewIntention.js
new file mode 100644
index 0000000..7f95bc9
--- /dev/null
+++ b/force-app/main/default/lwc/lexNewIntention/lexNewIntention.js
@@ -0,0 +1,103 @@
+import { LightningElement, api , track, wire } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+
+import init  from '@salesforce/apex/LexNewIntentionController.init';
+import getAccountByLongName  from '@salesforce/apex/LexNewIntentionController.getAccountByLongName';
+import getAccountByShortName  from '@salesforce/apex/LexNewIntentionController.getAccountByShortName';
+
+
+
+
+  const event1 = new ShowToastEvent({
+            title: '鎻愮ず',
+            message:
+                '璇蜂粠璇环鐢婚潰鏂板缓鎶ヤ环濮旀墭',
+        });
+export default class lexNewIntention extends LightningElement {
+
+	@api recordId;
+	AgencyOpportunity;
+
+
+
+
+	@wire(CurrentPageReference)
+    getStateParameters(currentPageReference) {
+        if (currentPageReference) {
+          const urlValue = currentPageReference.state.recordId;
+          if (urlValue) {
+            let str = `${urlValue}`;
+            console.log(str);
+            this.recordId = str;
+          }
+        }
+    }
+
+
+
+    connectedCallback(){
+        console.log(this.recordId);
+        init({
+            recordId: this.recordId
+        }).then(result => {
+            console.log(result);
+            if (result != null) {
+                this.AgencyOpportunity = result;
+                this.newIntention();
+            }
+        }).catch(error => {
+            console.log("error");
+            console.log(error);
+        });
+
+    }
+
+
+
+    async newIntention(){
+		if(this.AgencyOpportunity.Is_Transformed__c == true){
+			this.dispatchEvent(new CloseActionScreenEvent());
+			this.dispatchEvent(event1);
+			return;
+		}
+	var accountName = this.AgencyOpportunity.Department_Class_Opp_Name__c + ' ' 
+	+ this.AgencyOpportunity.Department_Name_Text__c;
+	var accountrecords = await getAccountByLongName({Name: accountName});
+	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')
+				}
+		}
+	this.dispatchEvent(new CloseActionScreenEvent());
+	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
+	+ '&CF00N10000002CvC5=' + accountName
+	+ '&CF00N10000002CvC5_lkid=' + accountID
+	+ '&RecordTypeId=01210000000QiRf' + '&retURL=%2F' + this.AgencyOpportunity.Id;
+
+	window.open(url);
+	
+
+
+    }
+
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexNewIntention/lexNewIntention.js-meta.xml b/force-app/main/default/lwc/lexNewIntention/lexNewIntention.js-meta.xml
new file mode 100644
index 0000000..5ae835c
--- /dev/null
+++ b/force-app/main/default/lwc/lexNewIntention/lexNewIntention.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexNewIntention">
+    <apiVersion>51.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__RecordPage</target>
+        <target>lightning__AppPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexProductRepairQuoteProduct/lexProductRepairQuoteProduct.html b/force-app/main/default/lwc/lexProductRepairQuoteProduct/lexProductRepairQuoteProduct.html
new file mode 100644
index 0000000..af9fa97
--- /dev/null
+++ b/force-app/main/default/lwc/lexProductRepairQuoteProduct/lexProductRepairQuoteProduct.html
@@ -0,0 +1,3 @@
+<template>
+
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexProductRepairQuoteProduct/lexProductRepairQuoteProduct.js b/force-app/main/default/lwc/lexProductRepairQuoteProduct/lexProductRepairQuoteProduct.js
new file mode 100644
index 0000000..658051d
--- /dev/null
+++ b/force-app/main/default/lwc/lexProductRepairQuoteProduct/lexProductRepairQuoteProduct.js
@@ -0,0 +1,47 @@
+import { LightningElement, api , track, wire } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import init  from '@salesforce/apex/LexRepairQuoteController.init';
+
+
+export default class lexProductRepairQuoteProduct extends LightningElement {
+
+	@api recordId;
+	IsLoading;
+
+	@wire(CurrentPageReference)
+    getStateParameters(currentPageReference) {
+        if (currentPageReference) {
+          const urlValue = currentPageReference.state.recordId;
+          console.log(currentPageReference);
+          if (urlValue) {
+            let str = `${urlValue}`;
+            console.log(str);
+            this.recordId = str;
+
+          }
+        }
+    }
+
+
+    connectedCallback(){
+        this.productRepairQuoteProduct().then(res=>{
+			this.IsLoading=false;
+			this.dispatchEvent(new CloseActionScreenEvent());
+		});
+
+    }
+
+
+
+    async productRepairQuoteProduct(){
+    	
+    	window.open ('/apex/ProductRepairQuote?productid=' + this.recordId +
+    		'&flag=productsearch', '', 'height=500, width=1200, top=300, left=350,location=no');
+    
+    }
+
+
+
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexProductRepairQuoteProduct/lexProductRepairQuoteProduct.js-meta.xml b/force-app/main/default/lwc/lexProductRepairQuoteProduct/lexProductRepairQuoteProduct.js-meta.xml
new file mode 100644
index 0000000..379d1e8
--- /dev/null
+++ b/force-app/main/default/lwc/lexProductRepairQuoteProduct/lexProductRepairQuoteProduct.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexProductRepairQuoteProduct">
+    <apiVersion>51.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__RecordPage</target>
+        <target>lightning__AppPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file

--
Gitblit v1.9.1