force-app/main/default/classes/lexCreateContactController.cls
New file @@ -0,0 +1,22 @@ public with sharing class lexCreateContactController { public lexCreateContactController() { } @AuraEnabled public static InitData init(String recordId){ InitData res = new InitData(); try { List<RecordType> rL=[SELECT id from recordType where name='医師' and SObjectType='Contact']; res.recordTypeId=rL.get(0).Id; List<Account> aL=[SELECT Department_Class__c from account where id=:recordId ]; res.StrategicDeptClassC=aL.get(0).Department_Class__c; } catch (Exception e) { throw new AuraHandledException(e.getMessage()); } return res; } class InitData{ @AuraEnabled public String recordTypeId; @AuraEnabled public String StrategicDeptClassC; } } force-app/main/default/classes/lexCreateContactController.cls-meta.xml
New file @@ -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> force-app/main/default/classes/lexCreateInternalStaffController.cls
New file @@ -0,0 +1,22 @@ public with sharing class lexCreateInternalStaffController { public lexCreateInternalStaffController() { } @AuraEnabled public static InitData init(String recordId){ InitData res = new InitData(); try { List<RecordType> rL=[SELECT id from recordType where name='社内员工' and SObjectType='Contact']; res.recordTypeId=rL.get(0).Id; List<Account> aL=[SELECT Department_Class__c from account where id=:recordId ]; res.StrategicDeptClassC=aL.get(0).Department_Class__c; } catch (Exception e) { throw new AuraHandledException(e.getMessage()); } return res; } class InitData{ @AuraEnabled public String recordTypeId; @AuraEnabled public String StrategicDeptClassC; } } force-app/main/default/classes/lexCreateInternalStaffController.cls-meta.xml
New file @@ -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> force-app/main/default/classes/lexCreateJxsController.cls
New file @@ -0,0 +1,23 @@ public with sharing class lexCreateJxsController { public lexCreateJxsController() { } @AuraEnabled public static InitData init(String recordId){ InitData res = new InitData(); try { List<RecordType> rL=[SELECT id from recordType where name='販売店' and SObjectType='Contact']; res.recordTypeId=rL.get(0).Id; res.recordTypeId=res.recordTypeId.substring(0,15); List<Account> aL=[SELECT Department_Class__c from account where id=:recordId ]; res.StrategicDeptClassC=aL.get(0).Department_Class__c; } catch (Exception e) { throw new AuraHandledException(e.getMessage()); } return res; } class InitData{ @AuraEnabled public String recordTypeId; @AuraEnabled public String StrategicDeptClassC; } } force-app/main/default/classes/lexCreateJxsController.cls-meta.xml
New file @@ -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> force-app/main/default/classes/lexNewOnLineSurvey2Controller.cls
New file @@ -0,0 +1,40 @@ public with sharing class lexNewOnLineSurvey2Controller { public lexNewOnLineSurvey2Controller() { } @AuraEnabled public static InitData init(String recordId){ InitData res = new InitData(); try { List<Contact> r= [SELECT CreatedById from Contact where id=:recordId]; res.CreatedById=r.get(0).CreatedById; } catch (Exception e) { throw new AuraHandledException(e.getMessage()); } return res; } // @AuraEnabled // public static InitData initForNewOnLineSurveyButton(String recordId){ // InitData res = new InitData(); // try { // Report__c re = [ // select // Date__c, // Practitioner1__c, // OwnerId // from Report__c where Id =: recordId // ]; // res.ownerId = re.OwnerId; // res.datec = re.Date__c; // res.practitioner1 = re.Practitioner1__c; // } catch (Exception e) { // throw new AuraHandledException(e.getMessage()); // } // return res; // } class InitData{ @AuraEnabled public String Name; @AuraEnabled public String CreatedByNameC; @AuraEnabled public String CreatedById; } } force-app/main/default/classes/lexNewOnLineSurvey2Controller.cls-meta.xml
New file @@ -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> force-app/main/default/classes/lexNewOpportunityController.cls
New file @@ -0,0 +1,32 @@ public with sharing class lexNewOpportunityController { public lexNewOpportunityController() { } @AuraEnabled public static InitData init(String recordId){ InitData res = new InitData(); try { // String i=Schema.SObjectType.Opportunity.getRecordTypeInfosByName().get(lexLightingButtonConstant.RECORD_TYPE_NAME_BY_FOLLOW_THE_STAGE).getRecordTypeId(); List<recordType> r=[SELECT Id from recordType where name='引合']; res.recordTypeId=r.get(0).Id; List<Account> accl=[SELECT Hospital__c,Department_Class__c,Department_Class_Wd__c from Account where id=:recordId]; res.hospitalC=accl.get(0).Hospital__c; res.departmentClassC=accl.get(0).Department_Class__c; res.departmentClassWdC=accl.get(0).Department_Class_Wd__c; String userId=UserInfo.getUserId(); List<User> ul=[SELECT Province_Text__c from user where id=:userId]; res.provinceTextC=ul.get(0).Province_Text__c; } catch (Exception e) { throw new AuraHandledException(e.getMessage()); } return res; } class InitData{ @AuraEnabled public String recordTypeId; @AuraEnabled public String recordTypeId2; @AuraEnabled public String hospitalC; @AuraEnabled public String departmentClassC; @AuraEnabled public String departmentClassWdC; @AuraEnabled public String provinceTextC; } } force-app/main/default/classes/lexNewOpportunityController.cls-meta.xml
New file @@ -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> force-app/main/default/classes/lexSICreateBTNController.cls
New file @@ -0,0 +1,18 @@ public with sharing class lexSICreateBTNController { public lexSICreateBTNController() { } @AuraEnabled public static InitData init(String recordId){ InitData res = new InitData(); try { // res.recordTypeId = Schema.SObjectType.SI_Attachment__c.getRecordTypeInfosByName().get(lexLightingButtonConstant.RECORD_TYPE_NAME_BY_FOLLOW_THE_STAGE).getRecordTypeId(); } catch (Exception e) { throw new AuraHandledException(e.getMessage()); } return res; } class InitData{ @AuraEnabled public String recordTypeId; } } force-app/main/default/classes/lexSICreateBTNController.cls-meta.xml
New file @@ -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> force-app/main/default/lwc/lexCreateContact/lexCreateContact.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/lexCreateContact/lexCreateContact.js
New file @@ -0,0 +1,68 @@ 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 { NavigationMixin } from 'lightning/navigation'; import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils'; import init from '@salesforce/apex/lexCreateContactController.init'; export default class lexCreateContact extends NavigationMixin(LightningElement) { @api recordId; @api rentalApplyIds; @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=>{ console.log(result); this.recordTypeId=result.recordTypeId; this.Strategic_dept_Class__c=result.StrategicDeptClassC; this.createOPDFromRentalApply(); }); } createOPDFromRentalApply(){ const defaultValues = encodeDefaultFieldValues({ retURL:'%2F'+this.recordId, con4_lkid:this.recordId, Strategic_dept_Class__c: this.Strategic_dept_Class__c, RecordType:this.recordTypeId, ent:'Contact', }); console.log("ddd"); console.log(defaultValues) this[NavigationMixin.Navigate]({ type: 'standard__objectPage', attributes: { objectApiName: 'Contact', actionName: 'new' }, state: { nooverride: '1', defaultFieldValues: defaultValues, recordTypeId: this.recordTypeId } }); // let url='/lightning/o/Contact/new?Strategic_dept_Class__c='+this.Strategic_dept_Class__c+'&retURL=%2F'+this.recordId+ // '&con4_lkid='+this.recordId+ // '&RecordType='+this.recordTypeId+ // '&ent=Contact'; // this[NavigationMixin.Navigate]({ // type: 'standard__webPage', // attributes: { // url:url // } // }); // window.open(url,'dji'); // console.log("dddd:"+url); } } force-app/main/default/lwc/lexCreateContact/lexCreateContact.js-meta.xml
New file @@ -0,0 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexCreateContact"> <apiVersion>51.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__AppPage</target> <target>lightning__RecordPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> <target>lightning__FlowScreen</target> </targets> <targetConfigs> <targetConfig targets="lightning__FlowScreen"> <property name="recordId" type="String" label="recordId"/> <property name="rentalApplyIds" type="String[]" label="rentalApplyIds"/> </targetConfig> </targetConfigs> </LightningComponentBundle> force-app/main/default/lwc/lexCreateInternalStaff/lexCreateInternalStaff.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/lexCreateInternalStaff/lexCreateInternalStaff.js
New file @@ -0,0 +1,68 @@ 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 { NavigationMixin } from 'lightning/navigation'; import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils'; import init from '@salesforce/apex/lexCreateInternalStaffController.init'; export default class lexCreateInternalStaff extends NavigationMixin(LightningElement) { @api recordId; @api rentalApplyIds; @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=>{ console.log(result); this.recordTypeId=result.recordTypeId; this.Strategic_dept_Class__c=result.StrategicDeptClassC; this.createOPDFromRentalApply(); }); } createOPDFromRentalApply(){ const defaultValues = encodeDefaultFieldValues({ retURL:'%2F'+this.recordId, con4_lkid:this.recordId, Strategic_dept_Class__c: this.Strategic_dept_Class__c, RecordType:this.recordTypeId, ent:'Contact', }); console.log("ddd"); console.log(defaultValues) this[NavigationMixin.Navigate]({ type: 'standard__objectPage', attributes: { objectApiName: 'Contact', actionName: 'new' }, state: { nooverride: '1', defaultFieldValues: defaultValues, recordTypeId: this.recordTypeId } }); // let url='/lightning/o/Contact/new?Strategic_dept_Class__c='+this.Strategic_dept_Class__c+'&retURL=%2F'+this.recordId+ // '&con4_lkid='+this.recordId+ // '&RecordType='+this.recordTypeId+ // '&ent=Contact'; // this[NavigationMixin.Navigate]({ // type: 'standard__webPage', // attributes: { // url:url // } // }); // window.open(url,'dji'); // console.log("dddd:"+url); } } force-app/main/default/lwc/lexCreateInternalStaff/lexCreateInternalStaff.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" fqn="lexCreateInternalStaff"> <apiVersion>51.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__AppPage</target> <target>lightning__RecordPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexCreateJxs/lexCreateJxs.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/lexCreateJxs/lexCreateJxs.js
New file @@ -0,0 +1,70 @@ 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 { NavigationMixin } from 'lightning/navigation'; import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils'; import init from '@salesforce/apex/lexCreateJxsController.init'; export default class lexCreateJxs extends NavigationMixin(LightningElement) { @api recordId; @api rentalApplyIds; @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=>{ console.log(result); this.recordTypeId=result.recordTypeId; this.Strategic_dept_Class__c=result.StrategicDeptClassC; this.createOPDFromRentalApply(); }); } createOPDFromRentalApply(){ const defaultValues = encodeDefaultFieldValues({ retURL:'%2F'+this.recordId, con4_lkid:this.recordId, Strategic_dept_Class__c: this.Strategic_dept_Class__c, RecordType:this.recordTypeId, ent:'Contact', accid:this.recordId }); console.log("ddd"); console.log(defaultValues) this[NavigationMixin.Navigate]({ type: 'standard__objectPage', attributes: { objectApiName: 'Contact', actionName: 'new' }, state: { nooverride: '1', defaultFieldValues: defaultValues, recordTypeId: this.recordTypeId // recordTypeId:'01210000000QfWi' } }); // let url='/lightning/o/Contact/new?Strategic_dept_Class__c='+this.Strategic_dept_Class__c+'&retURL=%2F'+this.recordId+ // '&con4_lkid='+this.recordId+ // '&RecordType='+this.recordTypeId+ // '&ent=Contact'; // this[NavigationMixin.Navigate]({ // type: 'standard__webPage', // attributes: { // url:url // } // }); // window.open(url,'dji'); // console.log("dddd:"+url); } } force-app/main/default/lwc/lexCreateJxs/lexCreateJxs.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" fqn="lexCreateJxs"> <apiVersion>51.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__AppPage</target> <target>lightning__RecordPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexNewOnLineSurvey2/lexNewOnLineSurvey2.html
New file @@ -0,0 +1,16 @@ <template> <div class="reportHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> <div if:false={IsLoading}> <lightning-card title="选择记录类型"> <lightning-combobox label="选择记录类型" options={recordTypeOptions} value={selectedRecordTypeId} onchange={handleRecordTypeChange} ></lightning-combobox> </lightning-card> </div> </template> force-app/main/default/lwc/lexNewOnLineSurvey2/lexNewOnLineSurvey2.js
New file @@ -0,0 +1,167 @@ // 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 { NavigationMixin } from 'lightning/navigation'; // import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils'; // import init from '@salesforce/apex/lexNewOnLineSurvey2Controller.init'; // export default class lexNewOnLineSurvey2 extends NavigationMixin(LightningElement) { // @api recordId; // id; // reportId; // CreatedById; // CreatedBy_Name__c; // Name // @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=>{ // this.Name = result.Id; // this.CreatedBy_Name__c=result.CreatedByNameC; // this.CreatedById=result.CreatedById // this.createOPDFromRentalApply(); // }); // } // createOPDFromRentalApply(){ // var today = new Date(); // var year = today.getFullYear(); // var month = today.getMonth() + 1; // var day = today.getDate(); // var hours = today.getHours(); // var minutes = today.getMinutes(); // var seconds = today.getSeconds(); // let time=year + '%2F' + month + '%2F' + day; // let url='/setup/ui/recordtypeselect.jsp?ent=01I10000000u0VA&retURL=%2F'+this.recordId+ // '&save_new_url=%2Fa1E%2Fe%3FretURL%3D%252F'+this.recordId+ // '%26Report_day__c%3D'+time+ // '%26Medical_staff__c%3D'+this.name+ // '%26Medical_staff__c_lkid%3D'+this.recordId+ // '%26Reporter__c%3D'+this.CreatedBy_Name__c+ // '%26Reporter__c_lkid%3D'+this.CreatedById; // // let url='/setup/ui/recordtypeselect.jsp?ent=On_Line_Survey'; // this[NavigationMixin.Navigate]({ // type: 'standard__webPage', // attributes: { // url:url // } // }); // // let url = '/setup/ui/recordtypeselect.jsp'; // // let params = new URLSearchParams(); // // params.append('ent', '%2F'+this.recordId); // // params.append('save_new_url', '%2Fa1E%2Fe%3FretURL%3D%252F'+this.recordId+ // // '%26Report_day__c%3D'+time+ // // '%26Medical_staff__c%3D'+this.name+ // // '%26Medical_staff__c_lkid%3D'+this.recordId+ // // '%26Reporter__c%3D'+this.CreatedBy_Name__c+ // // '%26Reporter__c_lkid%3D'+this.CreatedById); // // console.log(url + '?' + params.toString()); // // url=url + '?' + params.toString() // // this[NavigationMixin.Navigate]({ // // type: 'tandard__webPage', // // attributes: { // // url: url // // } // // }); // // window.open(); // this.dispatchEvent(new CloseActionScreenEvent()); // } // } import { api, wire,LightningElement, track } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import { updateRecord } from 'lightning/uiRecordApi'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import { NavigationMixin } from 'lightning/navigation'; import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils'; import init from '@salesforce/apex/lexNewOnLineSurvey2Controller.init'; import { getObjectInfo } from 'lightning/uiObjectInfoApi'; export default class LexNewOnLineSurvey2 extends NavigationMixin(LightningElement) { @api recordId; date; practitioner1; ownerId; selectedRecordTypeId; IsLoading = true; @track recordTypeOptions; @wire(getObjectInfo, { objectApiName: 'On_Line_Survey__c' }) objectInfo({ error, data }) { if (data) { this.recordTypeOptions = Object.values(data.recordTypeInfos).map((rt) => ({ label: rt.name, value: rt.recordTypeId })); } else if (error) { // 处理操作失败的错误 } } @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("res:"+result); this.ownerId = result.CreatedById; this.IsLoading = false; }); } handleRecordTypeChange(event) { this.selectedRecordTypeId = event.target.value; var today = new Date(); var year = today.getFullYear(); var month = today.getMonth() + 1; var day = today.getDate(); var hours = today.getHours(); var minutes = today.getMinutes(); var seconds = today.getSeconds(); let time=year + '-' + month + '-' + day; const defaultValues = encodeDefaultFieldValues({ // OPD_number__c: this.recordId, Report_day__c: time, Medical_staff__c: this.recordId, Reporter__c: this.ownerId }); this[NavigationMixin.Navigate]({ type: 'standard__objectPage', attributes: { objectApiName: 'On_Line_Survey__c', actionName: 'new' }, state: { nooverride: '1', defaultFieldValues: defaultValues, recordTypeId: this.selectedRecordTypeId } }); this.dispatchEvent(new CloseActionScreenEvent()); } } force-app/main/default/lwc/lexNewOnLineSurvey2/lexNewOnLineSurvey2.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" fqn="lexNewOnLineSurvey2"> <apiVersion>51.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__AppPage</target> <target>lightning__RecordPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexNewOpportunity/lexNewOpportunity.html
New file @@ -0,0 +1,6 @@ <template> <div class="baseHolder" 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/lexNewOpportunity/lexNewOpportunity.js
New file @@ -0,0 +1,72 @@ 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 { NavigationMixin } from 'lightning/navigation'; import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils'; import init from '@salesforce/apex/lexNewOpportunityController.init'; export default class lexNewOpportunity extends NavigationMixin(LightningElement) { @api recordId; @api rentalApplyIds; hospitalId; strategicDeptId; accountId; recordTypeId; recordTypeId2; HospitalId__c; Department_ClassId__c; Department_Class_Wd__c; Province_Text__c; @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=>{ console.log(result); this.recordTypeId2 = result.recordTypeId2; this.recordTypeId = result.recordTypeId; this.HospitalId__c = result.hospitalC; this.Department_ClassId__c = result.departmentClassC; this.Department_Class_Wd__c = result.departmentClassWdC; this.Province_Text__c = result.provinceTextC; this.createOPDFromRentalApply(); }); } createOPDFromRentalApply(){ const defaultValues = encodeDefaultFieldValues({ retURL:'%2F'+this.recordId, accid: this.recordId, RecordType: this.recordTypeId, Hospital__c:this.HospitalId__c, Department_Class__c:this.Department_ClassId__c, ent:'Opportunity', Opportunity_Category__c:this.Department_Class_Wd__c, SAP_Province__c:this.Province_Text__c, opp11:'%e5%bc%95%e5%90%88' }); console.log("de:"+defaultValues); this[NavigationMixin.Navigate]({ type: 'standard__objectPage', attributes: { objectApiName: 'Opportunity', actionName: 'new' }, state: { // nooverride: '1', defaultFieldValues: defaultValues // recordTypeId: '012100000006KW7AAM' } }); } } force-app/main/default/lwc/lexNewOpportunity/lexNewOpportunity.js-meta.xml
New file @@ -0,0 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexNewOpportunity"> <apiVersion>51.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__AppPage</target> <target>lightning__RecordPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> <target>lightning__FlowScreen</target> </targets> <targetConfigs> <targetConfig targets="lightning__FlowScreen"> <property name="recordId" type="String" label="recordId"/> <property name="rentalApplyIds" type="String[]" label="rentalApplyIds"/> </targetConfig> </targetConfigs> </LightningComponentBundle> force-app/main/default/lwc/lexNewOpportunityAgencyLWC/lexNewOpportunityAgencyLWC.html
New file @@ -0,0 +1,6 @@ <template> <div class="baseHolder" 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/lexNewOpportunityAgencyLWC/lexNewOpportunityAgencyLWC.js
New file @@ -0,0 +1,73 @@ 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 { NavigationMixin } from 'lightning/navigation'; import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils'; import init from '@salesforce/apex/lexNewOpportunityController.init'; export default class lexNewOpportunityAgencyLWC extends NavigationMixin(LightningElement) { @api recordId; @api rentalApplyIds; hospitalId; strategicDeptId; accountId; recordTypeId; recordTypeId2; HospitalId__c; Department_ClassId__c; Department_Class_Wd__c; Province_Text__c; @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=>{ console.log(result); this.recordTypeId2 = result.recordTypeId2; this.recordTypeId = result.recordTypeId; this.HospitalId__c = result.hospitalC; this.Department_ClassId__c = result.departmentClassC; this.Department_Class_Wd__c = result.departmentClassWdC; this.Province_Text__c = result.provinceTextC; this.createOPDFromRentalApply(); }); } createOPDFromRentalApply(){ const defaultValues = encodeDefaultFieldValues({ retURL:'%2F'+this.recordId, accid: this.recordId, RecordType: this.recordTypeId, Opportunity_Category__c:'ET', Hospital__c:this.recordId, Sales_Root__c:'OCM%e7%9b%b4%e6%8e%a5%e8%b2%a9%e5%a3%b2', Opportunity_Category__c:this.Department_Class_Wd__c, ent:'Opportunity', SAP_Province__c:this.Province_Text__c, opp11:'%e5%bc%95%e5%90%88' }); console.log("de:"+defaultValues); this[NavigationMixin.Navigate]({ type: 'standard__objectPage', attributes: { objectApiName: 'Opportunity', actionName: 'new' }, state: { // nooverride: '1', defaultFieldValues: defaultValues, recordTypeId: this.recordTypeId } }); } } force-app/main/default/lwc/lexNewOpportunityAgencyLWC/lexNewOpportunityAgencyLWC.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" fqn="lexNewOpportunityAgencyLWC"> <apiVersion>51.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__AppPage</target> <target>lightning__RecordPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexSICreateBTNLWC/lexSICreateBTNLWC.html
New file @@ -0,0 +1,6 @@ <template> <div class="baseHolder" 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/lexSICreateBTNLWC/lexSICreateBTNLWC.js
New file @@ -0,0 +1,58 @@ 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 { NavigationMixin } from 'lightning/navigation'; import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils'; import init from '@salesforce/apex/lexSICreateBTNController.init'; export default class lexSICreateBTNLWC extends NavigationMixin(LightningElement) { @api recordId; hospitalId; strategicDeptId; accountId; recordTypeId; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback(){ console.log("dd1"); console.log(this.recordId); init({ recordId: this.recordId }).then(result=>{ console.log(result); // this.recordTypeId = result.recordTypeId; this.createOPDFromRentalApply(); }); } createOPDFromRentalApply(){ console.log("ddd"); const defaultValues = encodeDefaultFieldValues({ Name__c: '*', Name: '*', Opportunity_ID__c: this.recordId }); console.log("ddd"); this[NavigationMixin.Navigate]({ type: 'standard__objectPage', attributes: { objectApiName: 'SI_Attachment__c', actionName: 'new' }, state: { defaultFieldValues: defaultValues } }); console.log("ddd"); this.dispatchEvent(new CloseActionScreenEvent()); } } force-app/main/default/lwc/lexSICreateBTNLWC/lexSICreateBTNLWC.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" fqn="lexSICreateBTNLWC"> <apiVersion>51.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__AppPage</target> <target>lightning__RecordPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle>