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; } } 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"; 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:流标公告'){ force-app/main/default/lwc/lexCopyWithAsset/__tests__/lexCopyWithAsset.test.js
New file @@ -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); }); }); force-app/main/default/lwc/lexCopyWithAsset/lexCopyWithAsset.html
New file @@ -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> force-app/main/default/lwc/lexCopyWithAsset/lexCopyWithAsset.js
New file @@ -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()); } } force-app/main/default/lwc/lexCopyWithAsset/lexCopyWithAsset.js-meta.xml
New file @@ -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> 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 force-app/main/default/lwc/lexEnquiryNoBidding/__tests__/lexEnquiryNoBidding.test.js
New file @@ -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); }); }); force-app/main/default/lwc/lexEnquiryNoBidding/lexEnquiryNoBidding.html
New file @@ -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> force-app/main/default/lwc/lexEnquiryNoBidding/lexEnquiryNoBidding.js
New file @@ -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()); } } force-app/main/default/lwc/lexEnquiryNoBidding/lexEnquiryNoBidding.js-meta.xml
New file @@ -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> 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 force-app/main/default/lwc/lexNewOpportunityAgency/__tests__/lexNewOpportunityAgency.test.js
New file @@ -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); }); }); force-app/main/default/lwc/lexNewOpportunityAgency/lexNewOpportunityAgency.css
New file @@ -0,0 +1,10 @@ .lexNewOpportunityAgencyHolder{ position: relative; display: inline-block; width: 80px; height: 80px; text-align: center; } .container .uiContainerManager{ display: none !important; } force-app/main/default/lwc/lexNewOpportunityAgency/lexNewOpportunityAgency.html
New file @@ -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> force-app/main/default/lwc/lexNewOpportunityAgency/lexNewOpportunityAgency.js
New file @@ -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 }}); } } force-app/main/default/lwc/lexNewOpportunityAgency/lexNewOpportunityAgency.js-meta.xml
New file @@ -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> 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();