force-app/main/default/classes/lexSolutionProgrammaController.cls
New file @@ -0,0 +1,52 @@ public with sharing class lexSolutionProgrammaController { @AuraEnabled public static InitData initForNewSolutionProgramma(String recordId){ InitData res = new InitData(); try { SolutionProjectRequirements__c so = [ select Status__c, GirWindowDirectorApproved__c, HospitalOwner__c from SolutionProjectRequirements__c where Id =: recordId ]; res.girWindowDirectorApproved = so.GirWindowDirectorApproved__c; res.hospitalOwnerId = so.HospitalOwner__c; res.status = so.Status__c; res.profileId = UserInfo.getProfileId(); res.m2profileId = [select Id from Profile where Name =: lexLightingButtonConstant.M2_PROFILE_NAME].Id; } catch (Exception e) { throw new AuraHandledException(e.getMessage()); } return res; } @AuraEnabled public static InitData initForNewSolutionClosingAttachment(String recordId){ InitData res = new InitData(); try { Solution_Programme__c so = [ select Scheme_Type__c from Solution_Programme__c where Id =: recordId ]; res.schemeType = so.Scheme_Type__c; } catch (Exception e) { throw new AuraHandledException(e.getMessage()); } return res; } class InitData{ @AuraEnabled public String status; @AuraEnabled public Boolean girWindowDirectorApproved; @AuraEnabled public String hospitalOwnerId; @AuraEnabled public String profileId; @AuraEnabled public String m2profileId; @AuraEnabled public String schemeType; } } force-app/main/default/classes/lexSolutionProgrammaController.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>57.0</apiVersion> <status>Active</status> </ApexClass> force-app/main/default/lwc/lexNewSolutionClosingAttachment/__tests__/lexNewSolutionClosingAttachment.test.js
New file @@ -0,0 +1,25 @@ import { createElement } from 'lwc'; import LexNewSolutionClosingAttachment from 'c/lexNewSolutionClosingAttachment'; describe('c-lex-new-solution-closing-attachment', () => { 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-solution-closing-attachment', { is: LexNewSolutionClosingAttachment }); // Act document.body.appendChild(element); // Assert // const div = element.shadowRoot.querySelector('div'); expect(1).toBe(1); }); }); force-app/main/default/lwc/lexNewSolutionClosingAttachment/lexNewSolutionClosingAttachment.html
New file @@ -0,0 +1,5 @@ <template> <div class="baseholder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexNewSolutionClosingAttachment/lexNewSolutionClosingAttachment.js
New file @@ -0,0 +1,67 @@ import { api, wire,LightningElement } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/lexSolutionProgrammaController.initForNewSolutionClosingAttachment'; import { updateRecord } from 'lightning/uiRecordApi'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import LightningConfirm from 'lightning/confirm'; import { NavigationMixin } from 'lightning/navigation'; import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils'; export default class LexNewSolutionClosingAttachment extends LightningElement { @api recordId; schemeType; @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.schemeType = result.schemeType; this.newSolutionClosingAttachment(); }); } newSolutionClosingAttachment(){ if(this.schemeType != '结案'){ this.showToast('只有结案的方案才能创建结案附件','error'); this.dispatchEvent(new CloseActionScreenEvent()); }else{ const defaultValues = encodeDefaultFieldValues({ Solution_Programme__c: this.recordId }); this[NavigationMixin.Navigate]({ type: 'standard__objectPage', attributes: { objectApiName: 'solutionClosingAttachment__c', actionName: 'new' }, state: { nooverride: '1', defaultFieldValues: defaultValues } }); this.dispatchEvent(new CloseActionScreenEvent()); } } } force-app/main/default/lwc/lexNewSolutionClosingAttachment/lexNewSolutionClosingAttachment.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/lexNewSolutionProgramma/__tests__/lexNewSolutionProgramma.test.js
New file @@ -0,0 +1,25 @@ import { createElement } from 'lwc'; import LexNewSolutionProgramma from 'c/lexNewSolutionProgramma'; describe('c-lex-new-solution-programma', () => { 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-solution-programma', { is: LexNewSolutionProgramma }); // Act document.body.appendChild(element); // Assert // const div = element.shadowRoot.querySelector('div'); expect(1).toBe(1); }); }); force-app/main/default/lwc/lexNewSolutionProgramma/lexNewSolutionProgramma.html
New file @@ -0,0 +1,5 @@ <template> <div class="baseholder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexNewSolutionProgramma/lexNewSolutionProgramma.js
New file @@ -0,0 +1,93 @@ /* * @Description: * @version: * @Author: chen jing wu * @Date: 2023-06-26 11:10:52 * @LastEditors: chen jing wu * @LastEditTime: 2023-06-26 14:18:17 */ import { api, wire,LightningElement } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/lexSolutionProgrammaController.initForNewSolutionProgramma'; import { updateRecord } from 'lightning/uiRecordApi'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import LightningConfirm from 'lightning/confirm'; import { NavigationMixin } from 'lightning/navigation'; import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils'; export default class LexNewSolutionProgramma extends LightningElement { @api recordId; status; girWindowDirectorApproved; hospitalOwnerId; profileId; m2profileId; @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.status = result.status; this.girWindowDirectorApproved = result.girWindowDirectorApproved; this.hospitalOwnerId = result.hospitalOwnerId; this.profileId = result.profileId; this.m2profileId = result.m2profileId; this.newSolutionProgramma(); }); } newSolutionProgramma(){ if(this.profileId != this.m2profileId){ this.showToast('只有GIR窗口才能新建方案','error'); this.dispatchEvent(new CloseActionScreenEvent()); }else if(this.status == '07结案'){ this.showToast('结案后不能新建方案','error'); this.dispatchEvent(new CloseActionScreenEvent()); }else if(this.status == '01草案中' || this.status == '02需求已提交'){ }else if(!this.girWindowDirectorApproved){ this.showToast('项目需求还未通过审批不能新建方案','error'); this.dispatchEvent(new CloseActionScreenEvent()); }else{ const defaultValues = encodeDefaultFieldValues({ SolutionProjectRequirements__c: this.recordId == undefined ? '' : this.recordId, Business_Promotion__c: this.hospitalOwnerId == undefined ? '' : this.hospitalOwnerId }); this[NavigationMixin.Navigate]({ type: 'standard__objectPage', attributes: { objectApiName: 'Solution_Programme__c', actionName: 'new' }, state: { nooverride: '1', defaultFieldValues: defaultValues } }); this.dispatchEvent(new CloseActionScreenEvent()); } } } force-app/main/default/lwc/lexNewSolutionProgramma/lexNewSolutionProgramma.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/lexNewSolutonPro/lexNewSolutonPro.js
@@ -4,9 +4,16 @@ * @Author: chen jing wu * @Date: 2023-06-25 13:21:05 * @LastEditors: chen jing wu * @LastEditTime: 2023-06-25 17:18:27 * @LastEditTime: 2023-06-26 09:15:15 */ import { api, wire,LightningElement } from 'lwc'; /* * @Description: * @version: * @Author: chen jing wu * @Date: 2023-06-25 13:21:05 * @LastEditors: chen jing wu * @LastEditTime: 2023-06-26 09:07:52 */import { api, wire,LightningElement } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/lexAccountController.initForNewSolutonProButton'; @@ -14,11 +21,12 @@ import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import LightningConfirm from 'lightning/confirm'; import SolutionHBLabel from '@salesforce/label/c.Solution_HB'; import SolutionHBLabel from '@salesforce/label/c.Solution_DB'; import SolutionHBLabel from '@salesforce/label/c.Solution_XB'; import SolutionHBLabel from '@salesforce/label/c.Solution_XN'; import SolutionHBLabel from '@salesforce/label/c.Solution_HD'; import SolutionHBLabel from '@salesforce/label/c.Solution_HN'; import SolutionDBLabel from '@salesforce/label/c.Solution_DB'; import SolutionXBLabel from '@salesforce/label/c.Solution_XB'; import SolutionXNLabel from '@salesforce/label/c.Solution_XN'; import SolutionHDLabel from '@salesforce/label/c.Solution_HD'; import SolutionHNLabel from '@salesforce/label/c.Solution_HN'; export default class LexNewSolutonPro extends LightningElement { @api accountId; hospitalSalesdepartmentHP; @@ -53,17 +61,17 @@ newSolutonPro(){ if(this.hospitalSalesdepartmentHP == '1.华北'){ this.salesAssistant = $A.get("$Label."); this.salesAssistant = SolutionHBLabel; }else if(this.hospitalSalesdepartmentHP == '2.东北'){ this.salesAssistant = $A.get("$Label.c."); this.salesAssistant = SolutionDBLabel; }else if(this.hospitalSalesdepartmentHP == '3.西北'){ this.salesAssistant = $A.get("$Label.c."); this.salesAssistant = SolutionXBLabel; }else if(this.hospitalSalesdepartmentHP == '4.西南'){ this.salesAssistant = $A.get("$Label.c."); this.salesAssistant = SolutionXNLabel; }else if(this.hospitalSalesdepartmentHP == '5.华东'){ this.salesAssistant = $A.get("$Label.c."); this.salesAssistant = SolutionHDLabel; }else if(this.hospitalSalesdepartmentHP == '6.华南'){ this.salesAssistant = $A.get("$Label.c."); this.salesAssistant = SolutionHNLabel; }else{ this.salesAssistant = ''; } force-app/main/default/lwc/lexNewSolutonProLwc/__tests__/lexNewSolutonProLwc.test.js
New file @@ -0,0 +1,25 @@ import { createElement } from 'lwc'; import LexNewSolutonProLwc from 'c/lexNewSolutonProLwc'; describe('c-lex-new-soluton-pro-lwc', () => { 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-soluton-pro-lwc', { is: LexNewSolutonProLwc }); // Act document.body.appendChild(element); // Assert // const div = element.shadowRoot.querySelector('div'); expect(1).toBe(1); }); }); force-app/main/default/lwc/lexNewSolutonProLwc/lexNewSolutonProLwc.html
New file @@ -0,0 +1,13 @@ <!-- * @Description: * @version: * @Author: chen jing wu * @Date: 2023-06-26 09:14:47 * @LastEditors: chen jing wu * @LastEditTime: 2023-06-26 09:15:04 --> <template> <div class="baseholder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexNewSolutonProLwc/lexNewSolutonProLwc.js
New file @@ -0,0 +1,84 @@ import { api, wire,LightningElement } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/lexAccountController.initForNewSolutonProButton'; import { updateRecord } from 'lightning/uiRecordApi'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import LightningConfirm from 'lightning/confirm'; import { NavigationMixin } from 'lightning/navigation'; import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils'; import SolutionHBLabel from '@salesforce/label/c.Solution_HB'; import SolutionDBLabel from '@salesforce/label/c.Solution_DB'; import SolutionXBLabel from '@salesforce/label/c.Solution_XB'; import SolutionXNLabel from '@salesforce/label/c.Solution_XN'; import SolutionHDLabel from '@salesforce/label/c.Solution_HD'; import SolutionHNLabel from '@salesforce/label/c.Solution_HN'; export default class LexNewSolutonProLwc extends NavigationMixin(LightningElement) { @api accountId; hospitalSalesdepartmentHP; hospitalId; hospitalOCMCategory; salesAssistant; @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.accountId = str; } } } connectedCallback(){ init({ recordId: this.accountId }).then(result=>{ this.hospitalId = result.hospitalId; this.hospitalOCMCategory = result.hospitalOCMCategory; this.hospitalSalesdepartmentHP = result.hospitalSalesdepartmentHP; this.newSolutonPro(); }); } newSolutonPro(){ if(this.hospitalSalesdepartmentHP == '1.华北'){ this.salesAssistant = SolutionHBLabel; }else if(this.hospitalSalesdepartmentHP == '2.东北'){ this.salesAssistant = SolutionDBLabel; }else if(this.hospitalSalesdepartmentHP == '3.西北'){ this.salesAssistant = SolutionXBLabel; }else if(this.hospitalSalesdepartmentHP == '4.西南'){ this.salesAssistant = SolutionXNLabel; }else if(this.hospitalSalesdepartmentHP == '5.华东'){ this.salesAssistant = SolutionHDLabel; }else if(this.hospitalSalesdepartmentHP == '6.华南'){ this.salesAssistant = SolutionHNLabel; }else{ this.salesAssistant = ''; } const defaultValues = encodeDefaultFieldValues({ Hospital__c: this.hospitalId == undefined ? '' : this.hospitalId, Department_Class__c: this.accountId == undefined ? '' : this.accountId, Sales_Assistant__c: this.salesAssistant == undefined ? '' : this.salesAssistant }); this[NavigationMixin.Navigate]({ type: 'standard__objectPage', attributes: { objectApiName: 'SolutionProjectRequirements__c', actionName: 'new' }, state: { nooverride: '1', defaultFieldValues: defaultValues } }); this.dispatchEvent(new CloseActionScreenEvent()); } } force-app/main/default/lwc/lexNewSolutonProLwc/lexNewSolutonProLwc.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>