From 2768cebeb80753586dcc25b352913c3b5b5b6cd1 Mon Sep 17 00:00:00 2001
From: 19626 <1962676589@qq.com>
Date: 星期五, 21 四月 2023 17:58:11 +0800
Subject: [PATCH] 修改按钮4.21

---
 force-app/main/default/lwc/lexCopyWithAsset/lexCopyWithAsset.html                            |   14 +
 force-app/main/default/lwc/lexCancelReport/lexCancelReport.js                                |    2 
 force-app/main/default/lwc/lexEnquiryNoBidding/lexEnquiryNoBidding.js                        |   34 +++
 force-app/main/default/lwc/lexCreateEvent/lexCreateEvent.js                                  |    8 
 force-app/main/default/lwc/lexNewOpportunityAgency/__tests__/lexNewOpportunityAgency.test.js |   25 ++
 force-app/main/default/lwc/lexNewOpportunityAgency/lexNewOpportunityAgency.js-meta.xml       |   11 +
 force-app/main/default/classes/OpportunityLightingButtonController.cls                       |  124 +++++++++++
 force-app/main/default/lwc/lexEnquiryNoBidding/lexEnquiryNoBidding.js-meta.xml               |   11 +
 force-app/main/default/lwc/lexNewOpportunityAgency/lexNewOpportunityAgency.html              |    6 
 force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.js                      |   35 +++
 force-app/main/default/lwc/lexCopyWithAsset/lexCopyWithAsset.js-meta.xml                     |   11 +
 force-app/main/default/lwc/lexLoseReport/lexLoseReport.js                                    |    8 
 force-app/main/default/lwc/lexEnquiryNoBidding/lexEnquiryNoBidding.html                      |    6 
 force-app/main/default/lwc/lexNewOpportunityAgency/lexNewOpportunityAgency.js                |  208 ++++++++++++++++++
 force-app/main/default/lwc/lexCopyWithAsset/lexCopyWithAsset.js                              |   69 ++++++
 force-app/main/default/lwc/lexBeforeOPDPDFBtn/lexBeforeOPDPDFBtn.js                          |    2 
 force-app/main/default/lwc/lexEnquiryNoBidding/__tests__/lexEnquiryNoBidding.test.js         |   25 ++
 force-app/main/default/lwc/lexNewOpportunityAgency/lexNewOpportunityAgency.css               |   10 
 force-app/main/default/lwc/lexCopyWithAsset/__tests__/lexCopyWithAsset.test.js               |   25 ++
 19 files changed, 629 insertions(+), 5 deletions(-)

diff --git a/force-app/main/default/classes/OpportunityLightingButtonController.cls b/force-app/main/default/classes/OpportunityLightingButtonController.cls
index 5c0b778..f3274d0 100644
--- a/force-app/main/default/classes/OpportunityLightingButtonController.cls
+++ b/force-app/main/default/classes/OpportunityLightingButtonController.cls
@@ -4,7 +4,7 @@
  * @Author: chen jing wu
  * @Date: 2023-04-12 11:16:07
  * @LastEditors: chen jing wu
- * @LastEditTime: 2023-04-14 17:24:54
+ * @LastEditTime: 2023-04-21 17:39:35
  */
 public with sharing class OpportunityLightingButtonController {
     @AuraEnabled
@@ -305,6 +305,63 @@
         return res;
     }
     @AuraEnabled
+    public static InitData initForCopyWithAssetButton(String recordId){
+        InitData res = new InitData();
+        try {
+            Opportunity oppo = [
+                select
+                Name,
+                SAP_Send_OK__c,
+                IsAuthorized__c
+                from Opportunity where Id =: recordId
+            ];
+            res.name = oppo.Name;
+            res.sapSendOK = oppo.SAP_Send_OK__c;
+            res.isAuthorized = oppo.IsAuthorized__c;
+        } catch (Exception e) {
+            throw new AuraHandledException(e.getMessage());
+        }
+        return res;
+    }
+    @AuraEnabled
+    public static InitData initForNewOpportunityAgencyButton(String recordId){
+        InitData res = new InitData();
+        try {
+            Opportunity opp = [
+                select
+                Agency1__r.Id,
+                Agency_Opportunity__c,
+                Trade__c,
+                Hospital__r.Id,
+                Name,
+                Close_Forecasted_Date__c,
+                Bid_Planned_Date__c,
+                Dealer_Final_Price__c,
+                Wholesale_Price__c,
+                Agency1__r.Name,
+                Opportunity_stage__c,
+                Opportunity_Category__c
+                from Opportunity where Id =: recordId
+            ];
+            res.agency1Id = opp.Agency1__r.Id;
+            res.agencyOpportunity = opp.Agency_Opportunity__c;
+            res.trade = opp.Trade__c;
+            res.hospitalId = opp.Hospital__r.Id;
+            res.name = opp.Name;
+            res.closeForecastedDate = opp.Close_Forecasted_Date__c;
+            res.bidPlannedDate = opp.Bid_Planned_Date__c;
+            res.dealerFinalPrice = opp.Dealer_Final_Price__c;
+            res.wholesalePrice = opp.Wholesale_Price__c;
+            res.agency1 = opp.Agency1__c;
+            res.opportunityStage = opp.Opportunity_stage__c;
+            res.opportunityCategory = opp.Opportunity_Category__c;
+            res.agency1Name = opp.Agency1__r.Name;
+        } catch (Exception e) {
+            throw new AuraHandledException(e.getMessage());
+        }
+        return res;
+    }
+    @AuraEnabled
     public static string updateForAgencyAuthorizeButton(String recordId){
         try {
             Opportunity opp = new Opportunity();
@@ -443,6 +500,53 @@
         }
         return quotes;
     }
+
+    @AuraEnabled
+    public static List<Agency_Hospital_Link__c> queryForNewOpportunityAgencyButtonToRecords(String agency1Id,String hospitalId){
+        List<Agency_Hospital_Link__c> links = null;
+        try {
+            links = [
+                SELECT 
+                Id, 
+                Name 
+                FROM Agency_Hospital_Link__c WHERE Agency__c =: agency1Id AND Hospital__c =: hospitalId
+            ];
+        } catch (Exception e) {
+            System.debug('e:****' + e);
+        }
+        return links;
+    }
+
+    @AuraEnabled
+    public static List<RecordType> queryForNewOpportunityAgencyButtonToRecTypeList(String sobjectType,String developerName,Boolean isActive){
+        List<RecordType> types = null;
+        try {
+            types = [
+                SELECT 
+                Id, 
+                Name FROM RecordType WHERE SobjectType =: sobjectType And developerName=: developerName And IsActive =: isActive 
+            ];
+        } catch (Exception e) {
+            System.debug('e:****' + e);
+        }
+        return types;
+    }
+
+    @AuraEnabled
+    public static List<FieldDefinition> queryForNewOpportunityAgencyButtonToRecords2(String qualifiedApiName){
+        List<FieldDefinition> fields = null;
+        try {
+            fields = [
+                select 
+                QualifiedApiName, 
+                EntityDefinition.KeyPrefix, 
+                DurableId From FieldDefinition WHERE EntityDefinition.QualifiedApiName =: qualifiedApiName
+            ];
+        } catch (Exception e) {
+            System.debug('e:****' + e);
+        }
+        return fields;
+    }
     public class InitData{
         @AuraEnabled
         public Boolean directLossFLG;
@@ -520,5 +624,23 @@
         public String lastOpportunityFileId;
         @AuraEnabled
         public String currencyIsoCode;
+        @AuraEnabled
+        public Boolean isAuthorized;
+        @AuraEnabled
+        public String agencyOpportunity;
+        @AuraEnabled
+        public String hospitalId;
+        @AuraEnabled
+        public Date closeForecastedDate;
+        @AuraEnabled
+        public Decimal dealerFinalPrice;
+        @AuraEnabled
+        public Decimal wholesalePrice;
+        @AuraEnabled
+        public String opportunityStage;
+        @AuraEnabled
+        public String opportunityCategory;
+        @AuraEnabled
+        public String agency1Name;
     }
 }
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexBeforeOPDPDFBtn/lexBeforeOPDPDFBtn.js b/force-app/main/default/lwc/lexBeforeOPDPDFBtn/lexBeforeOPDPDFBtn.js
index babbb46..7305df4 100644
--- a/force-app/main/default/lwc/lexBeforeOPDPDFBtn/lexBeforeOPDPDFBtn.js
+++ b/force-app/main/default/lwc/lexBeforeOPDPDFBtn/lexBeforeOPDPDFBtn.js
@@ -4,7 +4,7 @@
  * @Author: chen jing wu
  * @Date: 2023-04-13 15:08:43
  * @LastEditors: chen jing wu
- * @LastEditTime: 2023-04-14 15:37:35
+ * @LastEditTime: 2023-04-21 11:40:00
  */
 import { api, wire,LightningElement } from 'lwc';
 import { CurrentPageReference } from "lightning/navigation";
diff --git a/force-app/main/default/lwc/lexCancelReport/lexCancelReport.js b/force-app/main/default/lwc/lexCancelReport/lexCancelReport.js
index 0032022..c964370 100644
--- a/force-app/main/default/lwc/lexCancelReport/lexCancelReport.js
+++ b/force-app/main/default/lwc/lexCancelReport/lexCancelReport.js
@@ -89,7 +89,7 @@
                 this.showToast("璇环宸茬粡鏈� 鍙栨秷锛忓け鍗曟姤鍛� 浜嗭紒","error");
             }
             else if (this.jobCategory == '鏀彺') {
-                this.showToast("璇环鎵�鏈変汉鏄姪鐞嗙殑锛屽厛璇蜂慨鏀瑰埌閿�鍞媴褰擄紒","");
+                this.showToast("璇环鎵�鏈変汉鏄姪鐞嗙殑锛屽厛璇蜂慨鏀瑰埌閿�鍞媴褰擄紒","error");
             }
             //XLIU-CG98L5 銆愬鎵樸�戙�愯瘎浼般�戞柊闇�姹�-鎷涙爣椤圭洰/璇环瀵瑰簲娴佹爣銆佸簾鏍囨敼鍠� start
             //else if({!NOT(ISBLANK(Opportunity.Bidding_Project_Name_Bid__c))}&& '{!Opportunity.subInfoType__c}' != '3-1锛氬簾鏍囧叕鍛�' &&'{!Opportunity.subInfoType__c}' != '3-2锛氭祦鏍囧叕鍛�'){
diff --git a/force-app/main/default/lwc/lexCopyWithAsset/__tests__/lexCopyWithAsset.test.js b/force-app/main/default/lwc/lexCopyWithAsset/__tests__/lexCopyWithAsset.test.js
new file mode 100644
index 0000000..d3656ac
--- /dev/null
+++ b/force-app/main/default/lwc/lexCopyWithAsset/__tests__/lexCopyWithAsset.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexCopyWithAsset from 'c/lexCopyWithAsset';
+
+describe('c-lex-copy-with-asset', () => {
+    afterEach(() => {
+        // The jsdom instance is shared across test cases in a single file so reset the DOM
+        while (document.body.firstChild) {
+            document.body.removeChild(document.body.firstChild);
+        }
+    });
+
+    it('TODO: test case generated by CLI command, please fill in test logic', () => {
+        // Arrange
+        const element = createElement('c-lex-copy-with-asset', {
+            is: LexCopyWithAsset
+        });
+
+        // Act
+        document.body.appendChild(element);
+
+        // Assert
+        // const div = element.shadowRoot.querySelector('div');
+        expect(1).toBe(1);
+    });
+});
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCopyWithAsset/lexCopyWithAsset.html b/force-app/main/default/lwc/lexCopyWithAsset/lexCopyWithAsset.html
new file mode 100644
index 0000000..22c6a45
--- /dev/null
+++ b/force-app/main/default/lwc/lexCopyWithAsset/lexCopyWithAsset.html
@@ -0,0 +1,14 @@
+<!--
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-04-21 14:32:09
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-21 14:32:48
+-->
+<template>
+    <div class="lexCopyWithAssetHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+        <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCopyWithAsset/lexCopyWithAsset.js b/force-app/main/default/lwc/lexCopyWithAsset/lexCopyWithAsset.js
new file mode 100644
index 0000000..9f9694c
--- /dev/null
+++ b/force-app/main/default/lwc/lexCopyWithAsset/lexCopyWithAsset.js
@@ -0,0 +1,69 @@
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-04-21 14:32:09
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-21 14:44:55
+ */
+import { api, wire,LightningElement } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import init from '@salesforce/apex/OpportunityLightingButtonController.initForCopyWithAssetButton';
+export default class LexCopyWithAsset extends LightningElement {
+    @api recordId;
+    sapSendOK;
+    name;
+    isAuthorized;
+    @wire(CurrentPageReference)
+    getStateParameters(currentPageReference) {
+            console.log(111);
+            console.log(currentPageReference);
+
+        if (currentPageReference) {
+          const urlValue = currentPageReference.state.recordId;
+          if (urlValue) {
+            let str = `${urlValue}`;
+            console.log("str");
+            console.log(str);
+            this.recordId = str;
+          }
+        }
+    }
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            title: '',
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+    }
+    connectedCallback(){
+        init({
+            recordId: this.recordId
+        }).then(result=>{
+            this.sapSendOK = result.sapSendOK;
+            this.name = result.name;
+            this.isAuthorized = result.isAuthorized;
+            this.copyWithAsset();       
+        })
+    }
+    copyWithAsset(){
+        if(this.sapSendOK){
+            this.showToast("璇环宸茬粡WIN锛屼笉鑳借繘琛屾媶鍗�","error");
+            } else {
+                window.open(
+                    "/" 
+                    + this.recordId 
+                    + "/e?clone=1&retURL=%2F006p0000004bsox&_CONFIRMATIONTOKEN=VmpFPSxNakF4Tnkwd05DMHdPVlF3TmpvME16bzFPUzR5TWpsYSxuc010bXY2U1MxYWgzTHcwNzdUX0VpLE5HUmlaR013&common.udd.actions.ActionsUtilORIG_URI=%2F006p0000004bsox%2Fe&cloneli=1&CF00N10000006qHai=" 
+                    + this.name  
+                    +"&CF00N10000006qHai_lkid=" 
+                    + this.recordId 
+                    + "&00N10000009Glvn=" 
+                    + this.isAuthorized 
+                    + "&00N10000008pnmd=1&00N10000002Cb9P=&00N10000002DItz=&00N10000003O9oO=&00N10000003O9o4=&00N10000002CYHy=&00Np00000030gzb=&00Np0000002ajGe=&00Np00000034Qlb");
+            }
+            this.dispatchEvent(new CloseActionScreenEvent());
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCopyWithAsset/lexCopyWithAsset.js-meta.xml b/force-app/main/default/lwc/lexCopyWithAsset/lexCopyWithAsset.js-meta.xml
new file mode 100644
index 0000000..8b2c3d6
--- /dev/null
+++ b/force-app/main/default/lwc/lexCopyWithAsset/lexCopyWithAsset.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+   <apiVersion>54.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/lexCreateEvent/lexCreateEvent.js b/force-app/main/default/lwc/lexCreateEvent/lexCreateEvent.js
index 453f9df..615e3ee 100644
--- a/force-app/main/default/lwc/lexCreateEvent/lexCreateEvent.js
+++ b/force-app/main/default/lwc/lexCreateEvent/lexCreateEvent.js
@@ -2,6 +2,14 @@
  * @Description: 
  * @version: 
  * @Author: chen jing wu
+ * @Date: 2023-04-20 14:08:55
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-21 14:12:53
+ */
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
  * @Date: 2023-04-13 13:50:23
  * @LastEditors: chen jing wu
  * @LastEditTime: 2023-04-13 14:39:54
diff --git a/force-app/main/default/lwc/lexEnquiryNoBidding/__tests__/lexEnquiryNoBidding.test.js b/force-app/main/default/lwc/lexEnquiryNoBidding/__tests__/lexEnquiryNoBidding.test.js
new file mode 100644
index 0000000..acc5c1a
--- /dev/null
+++ b/force-app/main/default/lwc/lexEnquiryNoBidding/__tests__/lexEnquiryNoBidding.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexEnquiryNoBidding from 'c/lexEnquiryNoBidding';
+
+describe('c-lex-enquiry-no-bidding', () => {
+    afterEach(() => {
+        // The jsdom instance is shared across test cases in a single file so reset the DOM
+        while (document.body.firstChild) {
+            document.body.removeChild(document.body.firstChild);
+        }
+    });
+
+    it('TODO: test case generated by CLI command, please fill in test logic', () => {
+        // Arrange
+        const element = createElement('c-lex-enquiry-no-bidding', {
+            is: LexEnquiryNoBidding
+        });
+
+        // Act
+        document.body.appendChild(element);
+
+        // Assert
+        // const div = element.shadowRoot.querySelector('div');
+        expect(1).toBe(1);
+    });
+});
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexEnquiryNoBidding/lexEnquiryNoBidding.html b/force-app/main/default/lwc/lexEnquiryNoBidding/lexEnquiryNoBidding.html
new file mode 100644
index 0000000..617f069
--- /dev/null
+++ b/force-app/main/default/lwc/lexEnquiryNoBidding/lexEnquiryNoBidding.html
@@ -0,0 +1,6 @@
+<template>
+    <div class="lexCreateEventReportHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+        <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexEnquiryNoBidding/lexEnquiryNoBidding.js b/force-app/main/default/lwc/lexEnquiryNoBidding/lexEnquiryNoBidding.js
new file mode 100644
index 0000000..abb57f1
--- /dev/null
+++ b/force-app/main/default/lwc/lexEnquiryNoBidding/lexEnquiryNoBidding.js
@@ -0,0 +1,34 @@
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-04-21 14:11:57
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-21 14:15:55
+ */
+import { api, wire,LightningElement } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+
+export default class LexEnquiryNoBidding extends LightningElement {
+    @api recordId;
+    @wire(CurrentPageReference)
+    getStateParameters(currentPageReference) {
+            console.log(111);
+            console.log(currentPageReference);
+
+        if (currentPageReference) {
+          const urlValue = currentPageReference.state.recordId;
+          if (urlValue) {
+            let str = `${urlValue}`;
+            console.log("str");
+            console.log(str);
+            this.recordId = str;
+          }
+        }
+    }
+    connectedCallback(){
+        window.open ('/apex/EnquiryNoBiddingPage?oid=' + this.recordId, 'height=350, width=600, top=200, left=350,location=no');
+        this.dispatchEvent(new CloseActionScreenEvent());
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexEnquiryNoBidding/lexEnquiryNoBidding.js-meta.xml b/force-app/main/default/lwc/lexEnquiryNoBidding/lexEnquiryNoBidding.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexEnquiryNoBidding/lexEnquiryNoBidding.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>54.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/lexLoseReport/lexLoseReport.js b/force-app/main/default/lwc/lexLoseReport/lexLoseReport.js
index 7b167ea..96e99f5 100644
--- a/force-app/main/default/lwc/lexLoseReport/lexLoseReport.js
+++ b/force-app/main/default/lwc/lexLoseReport/lexLoseReport.js
@@ -2,6 +2,14 @@
  * @Description: 
  * @version: 
  * @Author: chen jing wu
+ * @Date: 2023-04-20 14:08:55
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-21 15:15:44
+ */
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
  * @Date: 2023-04-14 10:16:19
  * @LastEditors: chen jing wu
  * @LastEditTime: 2023-04-14 10:41:46
diff --git a/force-app/main/default/lwc/lexNewOpportunityAgency/__tests__/lexNewOpportunityAgency.test.js b/force-app/main/default/lwc/lexNewOpportunityAgency/__tests__/lexNewOpportunityAgency.test.js
new file mode 100644
index 0000000..e6c4b93
--- /dev/null
+++ b/force-app/main/default/lwc/lexNewOpportunityAgency/__tests__/lexNewOpportunityAgency.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexNewOpportunityAgency from 'c/lexNewOpportunityAgency';
+
+describe('c-lex-new-opportunity-agency', () => {
+    afterEach(() => {
+        // The jsdom instance is shared across test cases in a single file so reset the DOM
+        while (document.body.firstChild) {
+            document.body.removeChild(document.body.firstChild);
+        }
+    });
+
+    it('TODO: test case generated by CLI command, please fill in test logic', () => {
+        // Arrange
+        const element = createElement('c-lex-new-opportunity-agency', {
+            is: LexNewOpportunityAgency
+        });
+
+        // Act
+        document.body.appendChild(element);
+
+        // Assert
+        // const div = element.shadowRoot.querySelector('div');
+        expect(1).toBe(1);
+    });
+});
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexNewOpportunityAgency/lexNewOpportunityAgency.css b/force-app/main/default/lwc/lexNewOpportunityAgency/lexNewOpportunityAgency.css
new file mode 100644
index 0000000..8ce8187
--- /dev/null
+++ b/force-app/main/default/lwc/lexNewOpportunityAgency/lexNewOpportunityAgency.css
@@ -0,0 +1,10 @@
+.lexNewOpportunityAgencyHolder{
+    position: relative;
+    display: inline-block;
+    width: 80px;
+    height: 80px;
+    text-align: center;
+}
+.container .uiContainerManager{
+	display: none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexNewOpportunityAgency/lexNewOpportunityAgency.html b/force-app/main/default/lwc/lexNewOpportunityAgency/lexNewOpportunityAgency.html
new file mode 100644
index 0000000..b62fe53
--- /dev/null
+++ b/force-app/main/default/lwc/lexNewOpportunityAgency/lexNewOpportunityAgency.html
@@ -0,0 +1,6 @@
+<template>
+    <div class="lexNewOpportunityAgencyHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+        <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexNewOpportunityAgency/lexNewOpportunityAgency.js b/force-app/main/default/lwc/lexNewOpportunityAgency/lexNewOpportunityAgency.js
new file mode 100644
index 0000000..9b6cfc7
--- /dev/null
+++ b/force-app/main/default/lwc/lexNewOpportunityAgency/lexNewOpportunityAgency.js
@@ -0,0 +1,208 @@
+import { api, wire,LightningElement } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import init  from '@salesforce/apex/OpportunityLightingButtonController.initForNewOpportunityAgencyButton';
+import queryForRecords from '@salesforce/apex/OpportunityLightingButtonController.queryForNewOpportunityAgencyButtonToRecords';
+import queryForRecTypeList from '@salesforce/apex/OpportunityLightingButtonController.queryForNewOpportunityAgencyButtonToRecTypeList';
+import queryForRecords2 from '@salesforce/apex/OpportunityLightingButtonController.queryForNewOpportunityAgencyButtonToRecords2';
+export default class LexNewOpportunityAgency extends LightningElement {
+    @api recordId;
+    agency1Id;
+    agencyOpportunity;
+    trade;
+    hospitalId;
+    name;
+    closeForecastedDate;
+    bidPlannedDate;
+    dealerFinalPrice;
+    wholesalePrice;
+    agency1;
+    agency1Name;
+    opportunityStage;
+    opportunityCategory;
+    IsLoading = true;
+    @wire(CurrentPageReference)
+    getStateParameters(currentPageReference) {
+            console.log(111);
+            console.log(currentPageReference);
+
+        if (currentPageReference) {
+          const urlValue = currentPageReference.state.recordId;
+          if (urlValue) {
+            let str = `${urlValue}`;
+            console.log("str");
+            console.log(str);
+            this.recordId = str;
+          }
+        }
+    }
+    connectedCallback(){
+        init({
+            recordId: this.recordId
+        }).then(result=>{
+            console.log(result);
+            this.agency1Id = result.agency1Id;
+            this.agencyOpportunity = result.agencyOpportunity;
+            this.trade = result.trade;
+            this.hospitalId = result.hospitalId;
+            this.name = result.name;
+            this.closeForecastedDate = result.closeForecastedDate;
+            this.bidPlannedDate = result.bidPlannedDate;
+            this.dealerFinalPrice = result.dealerFinalPrice;
+            this.wholesalePrice = result.wholesalePrice;
+            this.agency1 = result.agency1;
+            this.opportunityStage = result.opportunityStage;
+            this.opportunityCategory = result.opportunityCategory;
+            this.agency1Name = result.agency1Name;
+            console.log("1");
+            this.newOpportunityAgency();
+        }).catch(error=>{
+            console.log("error");
+            console.log(error);
+        })
+    }
+    newOpportunityAgency(){
+        
+            console.log("2");
+            var newflag = true;
+            if (this.agency1Id == undefined) {
+                newflag = false;
+                alert("缁忛攢鍟嗕笉瀛樺湪锛屼笉鑳借浆鎴愩�愮粡閿�鍟嗙洰鏍囪浠枫�戙��");
+            }
+            else if (this.agencyOpportunity != undefined) {
+                newflag = false;
+                alert("宸茬粡杞垚杩囥�愮粡閿�鍟嗙洰鏍囪浠枫�戙��");
+            }
+            else if (this.trade != '鍐呰部') {
+                newflag = false;
+                alert("涓嶆槸鍐呰锤锛屼笉鑳借浆鎴愩�愮粡閿�鍟嗙洰鏍囪浠枫�戙��");
+            }
+            else {
+                var records = null;
+                console.log("3");
+                queryForRecords({
+                    agency1Id: this.agency1Id,
+                    hospitalId: this.hospitalId
+                }).then(result=>{
+                    records = result;
+                    if (records == null || records.length == 0) {
+                        newflag = false;
+                        alert("娌℃湁鏈夋晥鐨勩�愮粡閿�鍟嗗尰闄€�戙��");
+                    }
+                    if (newflag) {
+                        console.log("5");
+                        queryForRecTypeList({
+                            sobjectType: 'Agency_Opportunity__c',
+                            developerName: 'Opportunity',
+                            isActive: true
+                        }).then(result=>{
+                            console.log("6");
+                            var recTypeList = result;
+                            if (recTypeList.length == 0) {
+                                    alert("娌℃湁鎵惧埌锛岀粡閿�鍟嗚浠风殑瀹氫箟銆�");
+                                } else {
+                                    console.log("7");
+                                    queryForRecords2({
+                                        qualifiedApiName: 'Agency_Opportunity__c'
+                                    }).then(result=>{
+                                        console.log("8");
+                                        var records2 = result;
+                                        var recTypeId = recTypeList[0].Id;
+                                        var prefix, fId_Close_Forecasted_Date__c, fId_Agency_Hospital__c
+                                        , fId_OCM_Change_To_Opportunity_Flg__c, fId_Amount__c
+                                        , fId_OCMSale_Price__c, fId_Agency__c
+                                        , fId_StageName__c, fId_Change_To_Opportunity__c
+                                        , fId_Department_Cateogy__c, fId_Bid_Planned_Date__c;
+                                        console.log("9");
+                                        console.log(records2);
+                                        for (var i=0; i< records2.length; i++) {
+                                            var record = records2[i];
+                                            prefix = record.EntityDefinition.KeyPrefix.toString();
+                                            if (record.QualifiedApiName == 'Close_Forecasted_Date__c') {
+                                                fId_Close_Forecasted_Date__c = record.DurableId.toString().split('.')[1];
+                                            }
+                                            if (record.QualifiedApiName == 'OCM_Change_To_Opportunity_Flg__c') {
+                                                fId_OCM_Change_To_Opportunity_Flg__c = record.DurableId.toString().split('.')[1];
+                                            }
+                                            if (record.QualifiedApiName == 'Agency_Hospital__c') {
+                                                fId_Agency_Hospital__c = record.DurableId.toString().split('.')[1];
+                                            }
+                                            if (record.QualifiedApiName == 'Amount__c') {
+                                                fId_Amount__c = record.DurableId.toString().split('.')[1];
+                                            }
+                                            if (record.QualifiedApiName == 'OCMSale_Price__c') {
+                                                fId_OCMSale_Price__c = record.DurableId.toString().split('.')[1];
+                                            }
+                                            if (record.QualifiedApiName == 'Agency__c') {
+                                                fId_Agency__c = record.DurableId.toString().split('.')[1];
+                                            }
+                                            if (record.QualifiedApiName == 'StageName__c') {
+                                                fId_StageName__c = record.DurableId.toString().split('.')[1];
+                                            }
+                                            if (record.QualifiedApiName == 'Change_To_Opportunity__c') {
+                                                fId_Change_To_Opportunity__c = record.DurableId.toString().split('.')[1];
+                                            }
+                                            if (record.QualifiedApiName == 'Department_Cateogy__c') {
+                                                fId_Department_Cateogy__c = record.DurableId.toString().split('.')[1];
+                                            }
+                                            if (record.QualifiedApiName == 'Bid_Planned_Date__c') {
+                                                fId_Bid_Planned_Date__c = record.DurableId.toString().split('.')[1];
+                                            }
+                                        }
+                                        console.log("10");
+                                        console.log(records[0]);
+                                        var ahl = records[0];
+                                        try {
+                                            var url = "/a2Y/e?retURL=%2F" 
+                                            + this.recordId 
+                                            + "&Name='(OLYMPUS)'"  
+                                            + encodeURIComponent(this.name)
+                                            + "&RecordType=" + recTypeId  + "&" + fId_Close_Forecasted_Date__c + "=" 
+                                            + encodeURIComponent(this.closeForecastedDate)
+                                            + "&" + fId_Bid_Planned_Date__c + "=" 
+                                            + encodeURIComponent(this.bidPlannedDate)
+                                            + "&" + fId_OCM_Change_To_Opportunity_Flg__c + "=1" + "&CF" + fId_Agency_Hospital__c + "_lkid=" + ahl.Id + "&CF" + fId_Agency_Hospital__c + "=" + encodeURIComponent(ahl.Name) + "&" + fId_Amount__c + "=" 
+                                            + encodeURIComponent(this.dealerFinalPrice)
+                                            + "&" + fId_OCMSale_Price__c + "=" 
+                                            + encodeURIComponent(this.wholesalePrice)
+                                            + "&CF" + fId_Agency__c + "_lkid=" 
+                                            + encodeURIComponent(this.agency1Id) 
+                                            + "&CF" + fId_Agency__c + "=" 
+                                            + encodeURIComponent(this.agency1Name)
+                                            + "&" + fId_StageName__c + "=" 
+                                            + encodeURIComponent(this.opportunityStage) 
+                                            + "&CF" + fId_Change_To_Opportunity__c + "_lkid=" 
+                                            + encodeURIComponent(this.recordId )
+                                            + "&CF" + fId_Change_To_Opportunity__c + "=" 
+                                            + encodeURIComponent(this.name )
+                                            + "&" + fId_Department_Cateogy__c + "=" 
+                                            + encodeURIComponent(this.opportunityCategory);
+                                            console.log(url);
+                                            window.open(url);
+                                        } catch (error) {
+                                            console.log(error)
+                                        }
+                                    })
+                                }
+                        })  
+                    }
+                });
+                console.log("4");
+            }
+        this.IsLoading = false;
+        this.dispatchEvent(new CloseActionScreenEvent());
+    }
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            title: '',
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+    }
+    updateRecordView(recordId) {
+        updateRecord({fields: { Id: recordId }});
+    }
+}
diff --git a/force-app/main/default/lwc/lexNewOpportunityAgency/lexNewOpportunityAgency.js-meta.xml b/force-app/main/default/lwc/lexNewOpportunityAgency/lexNewOpportunityAgency.js-meta.xml
new file mode 100644
index 0000000..8b2c3d6
--- /dev/null
+++ b/force-app/main/default/lwc/lexNewOpportunityAgency/lexNewOpportunityAgency.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+   <apiVersion>54.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/lexPCLLostReportPage/lexPCLLostReportPage.js b/force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.js
index aa97526..4b691f4 100644
--- a/force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.js
+++ b/force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.js
@@ -4,7 +4,7 @@
  * @Author: chen jing wu
  * @Date: 2023-04-20 15:04:03
  * @LastEditors: chen jing wu
- * @LastEditTime: 2023-04-20 17:15:06
+ * @LastEditTime: 2023-04-20 18:01:37
  */
 /*
  * @Description: 
@@ -16,10 +16,41 @@
  */
 import { LightningElement } from 'lwc';
 import save from '@salesforce/apex/lexPCLLostReportLwcController.save';
-import unblockui from '@sa';
+import jquery from '@salesforce/resourceUrl/jquery183minjs';
+import blockUIcss from '@salesforce/resourceUrl/blockUIcss';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { loadStyle, loadScript } from 'lightning/platformResourceLoader';
+import setBrand from '@salesforce/apex/lexPCLLostReportLwcController.setBrand';
 export default class LexPCLLostReportPage extends LightningElement {
     connectedCallback(){
+        Promise.all([
+           loadScript(this,jquery),
+           loadStyle(this,blockUIcss)
+        ]).then(() =>{
+            save().then(result=>{
+                if(result){
+                    this.showToast(result,"success");
+                    window.unblockUI();
+                    this.clearBrandMannualName();
+                }
+            setBrand({
 
+            }).then({
+                
+            });
+            })
+        }).catch(error=>{
+            console.log(error);
+        });
+    }
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            title: '',
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+        this.dispatchEvent(new CloseActionScreenEvent());
     }
     saveJs() {
         blockme();

--
Gitblit v1.9.1