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-06-25 13:10:39 * @LastEditTime: 2023-06-29 16:53:17 */ public with sharing class OpportunityLightingButtonController { @AuraEnabled @@ -495,6 +495,21 @@ return res; } @AuraEnabled public static InitData initForNewOpportunityFileButton(String recordId){ InitData res = new InitData(); try { Opportunity opp = [ select Stock_apply_status__c from Opportunity where Id =: recordId ]; res.stockApplyStatus = opp.Stock_apply_status__c; } catch (Exception e) { throw new AuraHandledException(e.getMessage()); } return res; } @AuraEnabled public static string updateForAgencyAuthorizeButton(String recordId){ try { Opportunity opp = new Opportunity(); force-app/main/default/classes/ReportController.cls
@@ -261,6 +261,25 @@ } 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; } //给提交相应的js提供初始化数据 @AuraEnabled @@ -682,5 +701,9 @@ public String demoPurpose2; @AuraEnabled public String opdPlan; @AuraEnabled public Date datec; @AuraEnabled public String practitioner1; } } force-app/main/default/classes/lexCaseController.cls
New file @@ -0,0 +1,28 @@ public with sharing class lexCaseController { @AuraEnabled public static InitData initForCreateVOCFromCIC(String recordId){ InitData res = new InitData(); try { Case ca = [ select Department__c, Account__c from Case where Id =: recordId ]; res.department = ca.Department__c; res.accountId = ca.Account__c; res.recordTypeId = Schema.SObjectType.Case.getRecordTypeInfosByName().get(lexLightingButtonConstant.RECORD_TYPE_NAME_BY_VOC).getRecordTypeId(); } catch (Exception e) { throw new AuraHandledException(e.getMessage()); } return res; } class InitData{ @AuraEnabled public String department; @AuraEnabled public String accountId; @AuraEnabled public String recordTypeId; } } force-app/main/default/classes/lexCaseController.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/classes/lexLastbuyProductController.cls
New file @@ -0,0 +1,21 @@ public with sharing class lexLastbuyProductController { @AuraEnabled public static InitData initForCBLBPNew(String recordId){ InitData res = new InitData(); try { Product2 pro = [ select Name from Product2 where Id =: recordId ]; res.name = pro.Name; } catch (Exception e) { throw new AuraHandledException(e.getMessage()); } return res; } class InitData{ @AuraEnabled public String name; } } force-app/main/default/classes/lexLastbuyProductController.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/classes/lexLightingButtonConstant.cls
@@ -93,6 +93,8 @@ public static final String RECORD_TYPE_NAME_BY_SPECIL_APPLY_CREATE = '询价特殊对应'; //52 询价注残特殊对应的记录类型‘注残特殊对应’ public static final String RECORD_TYPE_NAME_BY_SPECIL_APPLY_CREATE_ACH = '注残特殊对应'; //Case对应的记录类型‘VOC’ public static final String RECORD_TYPE_NAME_BY_VOC = 'VOC'; //报表名‘报价产品’ public static final String REPORT_NAME_FOR_CNY = '报价产品'; //报表名‘产品的询价’ force-app/main/default/classes/lexPCLLostReportLwcController.cls
@@ -434,6 +434,22 @@ objs.put('Id', reportId); objs.put('pageStatus', 'View'); objs.put('submitFlag', '1'); ProcessInstance pro = [ SELECT ProcessDefinition.Name, ( SELECT StepStatus, Comments, CreatedDate, Actor.Name, OriginalActor.Name, ProcessNode.Name FROM StepsAndWorkitems order by IsPending DESC, CreatedDate DESC ) FROM ProcessInstance where TargetObjectId =:reportId order by CreatedDate DESC ]; List<ProcessInstanceHistory> items = new List<ProcessInstanceHistory>(); items.addall(pro.StepsAndWorkitems); objs.put('approvalHistorys',items); return objs; }catch(exception ex) { Database.rollback(sp); @@ -454,6 +470,17 @@ return lostBrand; } @AuraEnabled public static PCLLostProducts getNewLostProduct(Integer lineNo2){ PCLLostProducts pro = null; try { pro = new PCLLostProducts(lineNo2); } catch (Exception e) { System.debug(e.getMessage()); } return pro; } // update tcm 20211125 添加型号时自动带出品牌 end // 页面的数据结构 public class LostReport { @@ -461,17 +488,22 @@ public Lost_cancel_report__c lostReport { get; set; } @AuraEnabled public list<LostBrand> LostBrands { get; set; } @AuraEnabled public list<ProcessInstanceHistory> approvalHistorys { get; set; } public LostReport(){ lostReport = new Lost_cancel_report__c(); LostBrands = new list<LostBrand> {new LostBrand(0)}; approvalHistorys = new list<ProcessInstanceHistory>(); } public LostReport(Lost_cancel_report__c lostReport){ this.lostReport = lostReport; LostBrands = new list<LostBrand> {new LostBrand(0)}; approvalHistorys = new list<ProcessInstanceHistory>(); } public LostReport(Lost_cancel_report__c lostReport, list<LostBrand> LostBrands){ this.lostReport = lostReport; this.LostBrands = LostBrands; approvalHistorys = new list<ProcessInstanceHistory>(); } } force-app/main/default/classes/lexRentalApplyController.cls
New file @@ -0,0 +1,32 @@ public with sharing class lexRentalApplyController { @AuraEnabled public static InitData initForCreateOPDFromRentalApply(String recordId){ InitData res = new InitData(); try { Rental_Apply__c re = [ select Hospital__c, Strategic_dept__c, Account__c from Rental_Apply__c where Id =: recordId ]; res.hospitalId = re.Hospital__c; res.strategicDeptId = re.Strategic_dept__c; res.accountId = re.Account__c; res.recordTypeId = Schema.SObjectType.Report__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 hospitalId; @AuraEnabled public String strategicDeptId; @AuraEnabled public String accountId; @AuraEnabled public String recordTypeId; } } force-app/main/default/classes/lexRentalApplyController.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/lexCBLBPNew/__tests__/lexCBLBPNew.test.js
New file @@ -0,0 +1,25 @@ import { createElement } from 'lwc'; import LexCBLBPNew from 'c/lexCBLBPNew'; describe('c-lex-cblbp-new', () => { 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-cblbp-new', { is: LexCBLBPNew }); // Act document.body.appendChild(element); // Assert // const div = element.shadowRoot.querySelector('div'); expect(1).toBe(1); }); }); force-app/main/default/lwc/lexCBLBPNew/lexCBLBPNew.css
New file @@ -0,0 +1,22 @@ .holder{ position: relative; display: inline-block; width: 80px; height: 80px; text-align: center; } .container .uiContainerManager{ display : none !important; } .toast{ border: 1px solid #c9c9c9; border-radius: 10px; width: 50%; margin: 0 auto; font-size: 18px; font-weight: bold; padding: 10px 20px; background: #feb75d; display: flex; } force-app/main/default/lwc/lexCBLBPNew/lexCBLBPNew.html
New file @@ -0,0 +1,13 @@ <template> <div class="holder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> <div if:false={IsLoading} class="toast"> <span style="padding: 10px;">{msg}</span> <button class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" onclick={closeAction} title="Close" style="background-color: #e5e4e2;margin-top: 15px;"> <lightning-icon class="greyIcon" icon-name="utility:close" alternative-text="Connected" variant="inverse" size="small" title="Close" style="color: black;"></lightning-icon> <span class="slds-assistive-text">Close</span> </button> </div> </template> force-app/main/default/lwc/lexCBLBPNew/lexCBLBPNew.js
New file @@ -0,0 +1,29 @@ import init from '@salesforce/apex/lexLastbuyProductController.initForCBLBPNew'; import { api, wire,LightningElement } from 'lwc'; export default class LexCBLBPNew extends LightningElement { @api recordId; name; IsLoading = true; connectedCallback(){ init({ recordId: this.recordId }).then(result=>{ this.name = result.name; this.CBLBPNew(); }); } CBLBPNew(){ var url = '/apex/StandardFieldDefaults?'; var product = this.recordId; if (product != undefined && product != '') { url = url + 'SObjId=' + this.recordId + '&SObjName=' + this.name + '&linkId=00N10000009HD8q' + '&Pagefrom=Product'; } url = url + '&Pageto=LastbuyProduct'; window.open(url); this.closeAction(); } closeAction(){ window.open("/"+this.recordId,'_self'); } } force-app/main/default/lwc/lexCBLBPNew/lexCBLBPNew.js-meta.xml
New file @@ -0,0 +1,22 @@ <?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__AppPage</target> <target>lightning__RecordPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> <!-- 屏幕流配置 --> <target>lightning__FlowScreen</target> </targets> <!-- 定义变量 --> <targetConfigs> <targetConfig targets="lightning__FlowScreen"> <!-- name js中使用的变量,从屏幕流中获取参数 label 在屏幕流的该LWC的设置中显示 --> <property name="recordId" type="String" label="recordId"/> </targetConfig> </targetConfigs> </LightningComponentBundle> force-app/main/default/lwc/lexCreateOPDFromRentalApply/__tests__/lexCreateOPDFromRentalApply.test.js
New file @@ -0,0 +1,25 @@ import { createElement } from 'lwc'; import LexCreateOPDFromRentalApply from 'c/lexCreateOPDFromRentalApply'; describe('c-lex-create-opd-from-rental-apply', () => { 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-create-opd-from-rental-apply', { is: LexCreateOPDFromRentalApply }); // Act document.body.appendChild(element); // Assert // const div = element.shadowRoot.querySelector('div'); expect(1).toBe(1); }); }); force-app/main/default/lwc/lexCreateOPDFromRentalApply/lexCreateOPDFromRentalApply.html
New file @@ -0,0 +1,14 @@ <!-- * @Description: * @version: * @Author: chen jing wu * @Date: 2023-06-29 14:59:56 * @LastEditors: chen jing wu * @LastEditTime: 2023-06-29 15:01:48 --> <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/lexCreateOPDFromRentalApply/lexCreateOPDFromRentalApply.js
New file @@ -0,0 +1,71 @@ /* * @Description: * @version: * @Author: chen jing wu * @Date: 2023-06-29 14:59:56 * @LastEditors: chen jing wu * @LastEditTime: 2023-06-29 15:39:17 */ 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/lexRentalApplyController.initForCreateOPDFromRentalApply'; export default class LexCreateOPDFromRentalApply extends NavigationMixin(LightningElement) { @api recordId; hospitalId; strategicDeptId; accountId; recordTypeId; @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=>{ this.hospitalId = result.hospitalId; this.strategicDeptId = result.strategicDeptId; this.accountId = result.accountId; this.recordTypeId = result.recordTypeId; this.createOPDFromRentalApply(); }); } createOPDFromRentalApply(){ const defaultValues = encodeDefaultFieldValues({ Loaner_request_no1__c: this.recordId, Hospital_Reference__c: this.hospitalId, Department_Class_Ref__c: this.strategicDeptId, Hospital_Department__c: this.accountId }); this[NavigationMixin.Navigate]({ type: 'standard__objectPage', attributes: { objectApiName: 'Report__c', actionName: 'new' }, state: { nooverride: '1', defaultFieldValues: defaultValues, recordTypeId: this.recordTypeId } }); this.dispatchEvent(new CloseActionScreenEvent()); } } force-app/main/default/lwc/lexCreateOPDFromRentalApply/lexCreateOPDFromRentalApply.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/lexCreateVOCFromCIC/__tests__/lexCreateVOCFromCIC.test.js
New file @@ -0,0 +1,25 @@ import { createElement } from 'lwc'; import LexCreateVOCFromCIC from 'c/lexCreateVOCFromCIC'; describe('c-lex-create-voc-from-cic', () => { 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-create-voc-from-cic', { is: LexCreateVOCFromCIC }); // Act document.body.appendChild(element); // Assert // const div = element.shadowRoot.querySelector('div'); expect(1).toBe(1); }); }); force-app/main/default/lwc/lexCreateVOCFromCIC/lexCreateVOCFromCIC.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/lexCreateVOCFromCIC/lexCreateVOCFromCIC.js
New file @@ -0,0 +1,62 @@ 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/lexCaseController.initForCreateVOCFromCIC'; export default class LexCreateVOCFromCIC extends NavigationMixin(LightningElement) { @api recordId; caseNumber; recordTypeId; department; accountId; @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=>{ this.caseNumber = result.caseNumber; this.recordTypeId = result.recordTypeId; this.department = result.department; this.accountId = result.accountId; this.createVOCFromCIC(); }); } createVOCFromCIC(){ const defaultValues = encodeDefaultFieldValues({ CIC_Number__c: this.recordId, Manual_Name__c: this.department, Hospital_Reference__c: this.accountId }); this[NavigationMixin.Navigate]({ type: 'standard__objectPage', attributes: { objectApiName: 'Case', actionName: 'new' }, state: { nooverride: '1', defaultFieldValues: defaultValues, recordTypeId: this.recordTypeId } }); this.dispatchEvent(new CloseActionScreenEvent()); } } force-app/main/default/lwc/lexCreateVOCFromCIC/lexCreateVOCFromCIC.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/lexLookupLwc/lexLookupLwc.html
@@ -4,7 +4,7 @@ * @Author: chen jing wu * @Date: 2023-05-25 13:59:44 * @LastEditors: chen jing wu * @LastEditTime: 2023-05-30 10:21:50 * @LastEditTime: 2023-06-27 16:49:27 --> <template> <div> @@ -19,10 +19,10 @@ </template> <template if:true={recordselected}> <span class="slds-pill slds-pill_link fullWidth slds-input slds-combobox__input"> <a href="javascript:void(0);" class="slds-pill__action slds-p-left_x-small" title={selectedValue}> <a href="javascript:void(0);" class="slds-pill__action slds-p-left_x-small" title={selectedValue} style="height: 32px;"> <lightning-icon icon-name={iconname} size="x-small"></lightning-icon> <span class="slds-pill__label slds-p-left_x-small">{selectedValue}</span> <span class="slds-pill__label slds-p-left_x-small" style="display: inline-flex;width: 50px">{selectedValue}</span> </a> <button onclick={clearSelection} class="slds-button slds-button_icon slds-button_icon slds-pill__remove" force-app/main/default/lwc/lexNewOnLineSurvey/__tests__/lexNewOnLineSurvey.test.js
New file @@ -0,0 +1,25 @@ import { createElement } from 'lwc'; import LexNewOnLineSurvey from 'c/lexNewOnLineSurvey'; describe('c-lex-new-on-line-survey', () => { 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-on-line-survey', { is: LexNewOnLineSurvey }); // Act document.body.appendChild(element); // Assert // const div = element.shadowRoot.querySelector('div'); expect(1).toBe(1); }); }); force-app/main/default/lwc/lexNewOnLineSurvey/lexNewOnLineSurvey.html
New file @@ -0,0 +1,23 @@ <!-- * @Description: * @version: * @Author: chen jing wu * @Date: 2023-06-29 13:45:26 * @LastEditors: chen jing wu * @LastEditTime: 2023-06-29 14:24:14 --> <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/lexNewOnLineSurvey/lexNewOnLineSurvey.js
New file @@ -0,0 +1,92 @@ /* * @Description: * @version: * @Author: chen jing wu * @Date: 2023-06-29 13:45:26 * @LastEditors: chen jing wu * @LastEditTime: 2023-06-29 16:43:33 */ /* * @Description: * @version: * @Author: chen jing wu * @Date: 2023-06-29 13:45:26 * @LastEditors: chen jing wu * @LastEditTime: 2023-06-29 14:29:53 */ 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/ReportController.initForNewOnLineSurveyButton'; import { getObjectInfo } from 'lightning/uiObjectInfoApi'; export default class LexNewOnLineSurvey extends NavigationMixin(LightningElement) { @api recordId; date; practitioner1; ownerId; selectedRecordTypeId; IsLoading = true; @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=>{ this.date = result.datec; this.practitioner1 = result.practitioner1; this.ownerId = result.ownerId; this.IsLoading = false; }); } handleRecordTypeChange(event) { this.selectedRecordTypeId = event.target.value; const defaultValues = encodeDefaultFieldValues({ OPD_number__c: this.recordId, Report_day__c: this.date, Medical_staff__c: this.practitioner1, 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/lexNewOnLineSurvey/lexNewOnLineSurvey.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/lexNewOpportunityFile/__tests__/lexNewOpportunityFile.test.js
New file @@ -0,0 +1,25 @@ import { createElement } from 'lwc'; import LexNewOpportunityFile from 'c/lexNewOpportunityFile'; describe('c-lex-new-opportunity-file', () => { 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-file', { is: LexNewOpportunityFile }); // Act document.body.appendChild(element); // Assert // const div = element.shadowRoot.querySelector('div'); expect(1).toBe(1); }); }); force-app/main/default/lwc/lexNewOpportunityFile/lexNewOpportunityFile.html
New file @@ -0,0 +1,6 @@ <template> <div class="reportHolder" 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/lexNewOpportunityFile/lexNewOpportunityFile.js
New file @@ -0,0 +1,73 @@ /* * @Description: * @version: * @Author: chen jing wu * @Date: 2023-06-29 16:43:08 * @LastEditors: chen jing wu * @LastEditTime: 2023-06-29 17:07:54 */ 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/OpportunityLightingButtonController.initForNewOpportunityFileButton'; export default class LexNewOpportunityFile extends NavigationMixin(LightningElement) { @api recordId; stockApplyStatus; @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.stockApplyStatus = result.stockApplyStatus; this.newOpportunityFile(); }); } newOpportunityFile(){ var status = this.stockApplyStatus; if (status == '批准') { this.showToast('备货审批已经批准,不能添加新询价文件。','error'); } else { const defaultValues = encodeDefaultFieldValues({ Opportunity__c: this.recordId }); this[NavigationMixin.Navigate]({ type: 'standard__objectPage', attributes: { objectApiName: 'Opportunity_File__c', actionName: 'new' }, state: { nooverride: '1', defaultFieldValues: defaultValues } }); } this.dispatchEvent(new CloseActionScreenEvent()); } } force-app/main/default/lwc/lexNewOpportunityFile/lexNewOpportunityFile.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/lexOTHCreate/__tests__/lexOTHCreate.test.js
New file @@ -0,0 +1,25 @@ import { createElement } from 'lwc'; import LexOTHCreate from 'c/lexOTHCreate'; describe('c-lex-oth-create', () => { 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-oth-create', { is: LexOTHCreate }); // Act document.body.appendChild(element); // Assert // const div = element.shadowRoot.querySelector('div'); expect(1).toBe(1); }); }); force-app/main/default/lwc/lexOTHCreate/lexOTHCreate.html
New file @@ -0,0 +1,3 @@ <template> </template> force-app/main/default/lwc/lexOTHCreate/lexOTHCreate.js
New file @@ -0,0 +1,3 @@ import { LightningElement } from 'lwc'; export default class LexOTHCreate extends LightningElement {} force-app/main/default/lwc/lexOTHCreate/lexOTHCreate.js-meta.xml
New file @@ -0,0 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>57.0</apiVersion> <isExposed>false</isExposed> </LightningComponentBundle> force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.css
@@ -41,7 +41,7 @@ border: 0; } .container { .container { display: flex; justify-content: space-between; /* 设置子元素间的间距 */ } @@ -53,4 +53,10 @@ .text-container p:first-line { background-color: rgb(243, 243, 243); } } .slds-accordion__summary-heading{ background-color: rgb(243, 243, 243); } force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.html
@@ -4,226 +4,230 @@ * @Author: chen jing wu * @Date: 2023-04-20 17:16:48 * @LastEditors: chen jing wu * @LastEditTime: 2023-06-25 17:28:26 * @LastEditTime: 2023-06-28 17:53:19 --> <template> <template if:true={isCreateOrEdit}> <lightning-card id="my-element1" class="card" variant="Narrow" data-id="my-card"> <div style="padding: 0 20px"> <lightning-layout> <lightning-layout-item> <div class="mainTitle" style="padding: 10px 3px;font-weight: bold;">失单报告编辑页面</div> </lightning-layout-item> <div style="margin-left: 550px;"> <lightning-layout-item size="12"> <lightning-button label="追加品牌" onclick={addBrandJs}></lightning-button> <lightning-button name="save" label="保存" onclick={saveBrandJs}></lightning-button> <lightning-button label="返回询价" onclick={cancel}></lightning-button> </lightning-layout-item> </div> </lightning-layout> <div style="margin-top: 5px"> <lightning-layout> <lightning-layout-item size="3" padding="around-small"> <div class="slds-form_horizontal my-combobox"> <label class="slds-form-element__label">失单类型:</label> <lightning-combobox name="progress" value={LostReport.lostReport.LostType__c} options={RecordTypeOptions} onchange={handleLostTypeChange} class="searchField" required> </lightning-combobox> </div> </lightning-layout-item> <lightning-layout-item size="4" padding="around-small"> <div style="padding: 10px 3px;font: 16px;">失单总金额(元):{LostReport.lostReport.LostTotalAmount__c}</div> </lightning-layout-item> <lightning-layout-item size="3" padding="around-small"> <div style="padding: 10px 3px;font: 16px;">包含超声:{LostReport.lostReport.InclusionUltrasound__c}</div> </lightning-layout-item> <lightning-layout-item size="3" padding="around-small"> <div style="padding: 10px 3px;font: 16px;">状态:{LostReport.lostReport.Report_Status__c}</div> </lightning-layout-item> </lightning-layout> <lightning-accordion allow-multiple-sections-open class="myAccordion"> <template for:each={LostReport.LostBrands} for:item="brand" for:index="i"> <li key={brand}> <lightning-accordion-section class="" data-id={i} name="失单品牌" label="失单品牌"> <lightning-button name="save" label="保存" onclick={saveBrandJs}></lightning-button> <lightning-button name={i} label="删除" onclick={deleteBrandJs} disabled={isBrandCount2}></lightning-button> <lightning-layout> <lightning-layout-item size="4" padding="around-small"> <template if:true={isEdit}> <c-multi-select-combobox name={i} onselect={setBrandMannualName} data-id="Lost_By_Company" class="mycombobox" options={brandOptions} selected-value={reasonValue} label="失单品牌: " placeholder={brand.lostBrand.Lost_By_Company__c} required></c-multi-select-combobox> </template> <template if:false={isEdit}> <c-multi-select-combobox name={i} onselect={setBrandMannualName} data-id="Lost_By_Company" class="mycombobox" options={brandOptions} selected-value={reasonValue} label="失单品牌: " required></c-multi-select-combobox> </template> </lightning-layout-item> <lightning-layout-item flexibility="auto" padding="around-small"> <lightning-combobox name={i} label="失单原因(主):" value={brand.lostBrand.Lost_reason_main__c} options={columns2} onchange={handleLostReasonMainChange} class="searchField" required></lightning-combobox> </lightning-layout-item> <lightning-layout-item flexibility="auto" padding="around-small"> <lightning-combobox name={i} label="失单原因(次):" value={brand.lostBrand.Lost_Reason_Sub__c} options={columns2} onchange={handleLostReasonSubChange} class="searchField"></lightning-combobox> </lightning-layout-item> </lightning-layout> <lightning-layout> <lightning-layout-item size="4" padding="horizontal-small"> <lightning-input name={i} data-id="Lost_By_Company_Mannual" value={brand.lostBrand.Lost_By_Company_Mannual__c} type="text" label="失单品牌(手动): " class="searchField" onchange={handleLostByCompanyMannualChange}></lightning-input> </lightning-layout-item> <lightning-layout-item size="4" padding="horizontal-small"> <lightning-input data-id="TotalAmount" name={i} value={brand.lostBrand.LostPrice__c} type="number" label="失单金额(元): " class="searchField" onchange={handleLostPriceOutChange} required></lightning-input> </lightning-layout-item> <lightning-layout-item size="4" padding="horizontal-small"> <lightning-record-edit-form object-api-name='PCLLostBrand__c' record-id='' > <lightning-input-field value={brand.lostBrand.Agency__c} name={i} field-name='Agency__c' onchange={handleAgencyOutChange} required> </lightning-input-field> </lightning-record-edit-form> </lightning-layout-item> </lightning-layout> <lightning-layout> <lightning-layout-item size="4" padding="horizontal-small"> <lightning-input name={i} value={brand.lostBrand.AgencyMannual__c} type="text" label="中标经销商(手动):" class="searchField" onchange={handleAgencyMannualOutChange}></lightning-input> </lightning-layout-item> </lightning-layout> <lightning-layout> <lightning-layout-item flexibility="auto" padding="around-small"> <template if:true={isInit}> <div class="slds-card__body slds-card__body_inner"> <table class="slds-table slds-table_bordered slds-table_cell-buffer slds-var-m-bottom_large"> <thead> <tr class="slds-text-title_caps"> <th><div class="slds-truncate">失单品牌</div></th> <th><div class="slds-truncate">失单对手型号</div></th> <th><div class="slds-truncate"><span style="color:red;font-size: 18px;">*</span>失单数量</div></th> <th><div class="slds-truncate">失单对手型号(手动)</div></th> <th><div class="slds-truncate"><span style="color:red;font-size: 18px;">*</span>失单产品类别</div></th> <th><div class="slds-truncate"><span style="color:red;font-size: 18px;">*</span>失单产品区分</div></th> <th></th> </tr> </thead> <tbody> <template for:each={brand.LostProducts} for:item="product" for:index="j"> <tr class="inputRows" key={product}> <td> <lightning-combobox placeholder={product.LostProductss.LostBrandName__c} data-id={i} class="BrandName" name={j} title={i} options={brandOptions} value={product.LostProductss.LostBrandName__c} onchange={handleLostBrandNameChange} read-only="true"></lightning-combobox> </td> <td> <!-- <lightning-record-edit-form object-api-name='PCLLostProduct__c' > <lightning-input-field class="LostProduct" data-id={i} title={i} value={product.LostProductss.LostProduct__c} name={j} field-name='LostProduct__c' onchange={handleLostProductChange} variant="label-hidden"> </lightning-input-field> </lightning-record-edit-form> --> <template if:true={isEdit}> <c-lex-lookup-lwc class="Product" data-id={i} title={i} name={j} iconname="standard:product_item" query-brand={product.LostProductss.LostBrandName__c} objectname="Product2" onselected={handleSelected} init-value={product.productName}></c-lex-lookup-lwc> </template> <template if:false={isEdit}> <c-lex-lookup-lwc class="Product" data-id={i} title={i} name={j} iconname="standard:product_item" query-brand={product.LostProductss.LostBrandName__c} objectname="Product2" onselected={handleSelected}></c-lex-lookup-lwc> </template> </td> <td> <lightning-input class="Quantity" title={i} name={j} value={product.LostProductss.Quantity__c} onchange={handleQuantityChange}></lightning-input> </td> <td> <lightning-input class="LostProductMannual" title={i} name={j} value={product.LostProductss.LostProductMannual__c} onchange={handleLostProductMannualChange}></lightning-input> </td> <td> <lightning-combobox class="ProductClass" data-id={i} placeholder="--无--" title={i} name={j} options={productClassOptions} value={product.LostProductss.ProductClass__c} onchange={handleProductClassChange}></lightning-combobox> </td> <td> <lightning-combobox class="ProductCategory" data-id={i} placeholder="--无--" title={i} name={j} options={product.productOptions} value={product.LostProductss.ProductCategory__c} onchange={handleProductCategoryChange} read-only="true"></lightning-combobox> </td> <td> <lightning-button-icon name={i} icon-name="utility:add" value={j} variant="bare" onclick={addRow}></lightning-button-icon> </td> <td> <lightning-button-icon class="deleteButton" data-id={i} name={i} icon-name="utility:delete" value={j} variant="bare" onclick={removeRow}></lightning-button-icon> </td> </tr> </template> </tbody> </table> </div> </template> </lightning-layout-item> </lightning-layout> </lightning-accordion-section> </li> </template> </lightning-accordion> <lightning-layout style="margin-top: 20px;"> <div class="slds-align_absolute-center"> <lightning-layout-item size="12"> <template if:true={isInit}> <template if:true={isCreateOrEdit}> <lightning-card id="my-element1" class="card" variant="Narrow" data-id="my-card"> <div style="padding: 0 20px"> <div class="slds-box slds-p-around_medium slds-text-align_center"> <lightning-layout> <lightning-layout-item> <div class="mainTitle" style="padding: 10px 3px;font-weight: bold;font-size: large">失单报告编辑页面</div> </lightning-layout-item> <lightning-layout-item alignment-bump="left"> <lightning-button label="追加品牌" onclick={addBrandJs}></lightning-button> <lightning-button name="save" label="保存" onclick={saveBrandJs}></lightning-button> <lightning-button label="返回询价" onclick={cancel}></lightning-button> </lightning-layout-item> </div> </lightning-layout> </div> </div> </lightning-card> </template> <template if:true={isView}> <lightning-card id="my-element2" class="card" variant="Narrow" data-id="my-card"> <div style="padding: 0 20px"> <lightning-layout> <lightning-layout-item> <div class="mainTitle" style="padding: 10px 3px;font-weight: bold;">失单报告查看页面</div> </lightning-layout-item> <div style="margin-left: 550px;"> <lightning-layout-item size="12"> <lightning-button label="提交" onclick={submitJs}></lightning-button> <lightning-button name="编辑" label="编辑" onclick={editJs}></lightning-button> <lightning-button label="返回询价" onclick={cancel}></lightning-button> </lightning-layout-item> </div> </lightning-layout> <div style="margin-top: 5px"> </div> <div class="slds-box slds-p-around_medium"> <lightning-layout> <lightning-layout-item size="1"> <label>失单类型:</label> </lightning-layout-item> <lightning-layout-item size="1"> <lightning-record-view-form object-api-name="Lost_cancel_report__c" record-id={LostReport.lostReport.Id} density="comfy"> <lightning-output-field field-name="LostType__c" variant="label-hidden"></lightning-output-field> </lightning-record-view-form> </lightning-layout-item> <lightning-layout-item size="1"></lightning-layout-item> <lightning-layout-item size="2"> <label>失单总金额(元):</label> </lightning-layout-item> <lightning-layout-item size="1"> <lightning-record-view-form object-api-name="Lost_cancel_report__c" record-id={LostReport.lostReport.Id} density="comfy"> <lightning-output-field field-name="LostTotalAmount__c" variant="label-hidden"></lightning-output-field> </lightning-record-view-form> </lightning-layout-item> <lightning-layout-item size="1"></lightning-layout-item> <lightning-layout-item size="1"> <label>包含超声:</label> </lightning-layout-item> <lightning-layout-item size="1"> <lightning-record-view-form object-api-name="Lost_cancel_report__c" record-id={LostReport.lostReport.Id} density="comfy"> <lightning-output-field field-name="InclusionUltrasound__c" variant="label-hidden"></lightning-output-field> </lightning-record-view-form> </lightning-layout-item> <lightning-layout-item size="1"></lightning-layout-item> <lightning-layout-item size="1"> <label>状态:</label> </lightning-layout-item> <lightning-layout-item size="1"> <lightning-record-view-form object-api-name="Lost_cancel_report__c" record-id={LostReport.lostReport.Id} density="comfy"> <lightning-output-field field-name="Report_Status__c" variant="label-hidden"></lightning-output-field> </lightning-record-view-form> </lightning-layout-item> <template if:true={LostReport.lostReport}> <lightning-layout-item size="3" padding="around-small"> <div style="padding: 10px 3px;font: 16px;float: left"> <span style="color:red;font-size: 10px;">*</span> 失单类型:</div> <div style="float: left;"> <lightning-combobox name="progress" value={LostReport.lostReport.LostType__c} options={RecordTypeOptions} onchange={handleLostTypeChange} class="searchField" style="bottom: 16px;"> </lightning-combobox> </div> </lightning-layout-item> <lightning-layout-item size="4" padding="around-small"> <div style="padding: 10px 3px;font: 16px;">失单总金额(元):{LostReport.lostReport.LostTotalAmount__c}</div> </lightning-layout-item> <lightning-layout-item size="3" padding="around-small"> <div style="padding: 10px 3px;font: 16px;">包含超声:{LostReport.lostReport.InclusionUltrasound__c}</div> </lightning-layout-item> <lightning-layout-item size="3" padding="around-small"> <div style="padding: 10px 3px;font: 16px;">状态:{LostReport.lostReport.Report_Status__c}</div> </lightning-layout-item> </template> </lightning-layout> <lightning-accordion allow-multiple-sections-open class="myAccordion"> <lightning-accordion allow-multiple-sections-open class="myAccordion"> <template for:each={LostReport.LostBrands} for:item="brand" for:index="i"> <li key={brand.lineNo}> <lightning-accordion-section class="" data-id={i} name="失单品牌" label="失单品牌"> <lightning-button name="save" label="保存" onclick={saveBrandJs}></lightning-button> <lightning-button name={i} label="删除" onclick={deleteBrandJs} disabled={isBrandCount2}></lightning-button> <lightning-layout> <lightning-layout-item size="4" padding="around-small"> <template if:true={isEdit}> <c-multi-select-combobox name={i} onselect={setBrandMannualName} data-id="Lost_By_Company" class="mycombobox" options={brandOptions} selected-value={reasonValue} label="失单品牌: " placeholder={brand.lostBrand.Lost_By_Company__c} required></c-multi-select-combobox> </template> <template if:false={isEdit}> <c-multi-select-combobox name={i} onselect={setBrandMannualName} data-id="Lost_By_Company" class="mycombobox" options={brandOptions} selected-value={reasonValue} label="失单品牌: " required></c-multi-select-combobox> </template> </lightning-layout-item> <lightning-layout-item flexibility="auto" padding="around-small"> <lightning-combobox name={i} label="失单原因(主):" value={brand.lostBrand.Lost_reason_main__c} options={columns2} onchange={handleLostReasonMainChange} class="searchField" required></lightning-combobox> </lightning-layout-item> <lightning-layout-item flexibility="auto" padding="around-small"> <lightning-combobox name={i} label="失单原因(次):" value={brand.lostBrand.Lost_Reason_Sub__c} options={columns2} onchange={handleLostReasonSubChange} class="searchField"></lightning-combobox> </lightning-layout-item> </lightning-layout> <lightning-layout> <lightning-layout-item size="4" padding="horizontal-small"> <lightning-input name={i} data-id="Lost_By_Company_Mannual" value={brand.lostBrand.Lost_By_Company_Mannual__c} type="text" label="失单品牌(手动): " class="searchField" onchange={handleLostByCompanyMannualChange}></lightning-input> </lightning-layout-item> <lightning-layout-item size="4" padding="horizontal-small"> <lightning-input data-id="TotalAmount" name={i} value={brand.lostBrand.LostPrice__c} type="number" label="失单金额(元): " class="searchField" onchange={handleLostPriceOutChange} required></lightning-input> </lightning-layout-item> <lightning-layout-item size="4" padding="horizontal-small"> <lightning-record-edit-form object-api-name='PCLLostBrand__c' record-id='' > <lightning-input-field value={brand.lostBrand.Agency__c} name={i} field-name='Agency__c' onchange={handleAgencyOutChange} required> </lightning-input-field> </lightning-record-edit-form> </lightning-layout-item> </lightning-layout> <lightning-layout> <lightning-layout-item size="4" padding="horizontal-small"> <lightning-input name={i} value={brand.lostBrand.AgencyMannual__c} type="text" label="中标经销商(手动):" class="searchField" onchange={handleAgencyMannualOutChange}></lightning-input> </lightning-layout-item> </lightning-layout> <lightning-layout> <lightning-layout-item flexibility="auto" padding="around-small"> <template if:true={isInit}> <div class="slds-card__body slds-card__body_inner"> <table class="slds-table slds-table_bordered slds-table_cell-buffer slds-var-m-bottom_large"> <thead> <tr class="slds-text-title_caps"> <th><div class="slds-truncate">失单品牌</div></th> <th><div class="slds-truncate">失单对手型号</div></th> <th><div class="slds-truncate"><span style="color:red;font-size: 10px;">*</span>失单数量</div></th> <th><div class="slds-truncate">失单对手型号(手动)</div></th> <th><div class="slds-truncate"><span style="color:red;font-size: 10px;">*</span>失单产品类别</div></th> <th><div class="slds-truncate"><span style="color:red;font-size: 10px;">*</span>失单产品区分</div></th> <th></th> </tr> </thead> <tbody> <template for:each={brand.LostProducts} for:item="product" for:index="j"> <tr class="inputRows" key={product.lineNo2}> <td> <lightning-combobox placeholder={product.LostProductss.LostBrandName__c} data-id={i} class="BrandName" name={j} title={i} options={brandOptions} value={product.LostProductss.LostBrandName__c} onchange={handleLostBrandNameChange} read-only="true" style="margin-bottom: 20px; width: 70px"></lightning-combobox> </td> <td> <template if:true={isEdit}> <c-lex-lookup-lwc class="Product" data-id={i} title={i} name={j} iconname="standard:product_item" query-brand={product.LostProductss.LostBrandName__c} objectname="Product2" onselected={handleSelected} init-value={product.productName}></c-lex-lookup-lwc> </template> <template if:false={isEdit}> <c-lex-lookup-lwc class="Product" data-id={i} title={i} name={j} iconname="standard:product_item" query-brand={product.LostProductss.LostBrandName__c} objectname="Product2" onselected={handleSelected} style="margin-bottom: 20px;"></c-lex-lookup-lwc> </template> </td> <td> <lightning-input class="Quantity" title={i} name={j} value={product.LostProductss.Quantity__c} onchange={handleQuantityChange} style="margin-bottom: 20px;"></lightning-input> </td> <td> <lightning-input class="LostProductMannual" title={i} name={j} value={product.LostProductss.LostProductMannual__c} onchange={handleLostProductMannualChange} style="margin-bottom: 20px;"></lightning-input> </td> <td> <lightning-combobox class="ProductClass" data-id={i} placeholder="--无--" title={i} name={j} options={productClassOptions} value={product.LostProductss.ProductClass__c} onchange={handleProductClassChange} style="margin-bottom: 20px; width: 87px"></lightning-combobox> </td> <td> <lightning-combobox class="ProductCategory" data-id={i} placeholder="--无--" title={i} name={j} options={product.productOptions} value={product.LostProductss.ProductCategory__c} onchange={handleProductCategoryChange} read-only="true" style="margin-bottom: 20px; width: 87px"></lightning-combobox> </td> <td> <lightning-button-icon name={i} icon-name="utility:add" value={j} variant="bare" onclick={addRow}></lightning-button-icon> </td> <td> <lightning-button-icon class="deleteButton" data-id={i} name={i} icon-name="utility:delete" value={j} variant="bare" onclick={removeRow}></lightning-button-icon> </td> </tr> </template> </tbody> </table> </div> </template> </lightning-layout-item> </lightning-layout> </lightning-accordion-section> </li> </template> </lightning-accordion> </div> <div style="margin-top: 5px"> <div class="slds-box slds-p-around_medium slds-text-align_center"> <lightning-layout style="margin-top: 20px;"> <div class="slds-align_absolute-center"> <lightning-layout-item size="12"> <lightning-button label="追加品牌" onclick={addBrandJs}></lightning-button> <lightning-button name="save" label="保存" onclick={saveBrandJs}></lightning-button> <lightning-button label="返回询价" onclick={cancel}></lightning-button> </lightning-layout-item> </div> </lightning-layout> </div> </div> </div> </lightning-card> </template> <template if:true={isView}> <lightning-card id="my-element2" class="card" variant="Narrow" data-id="my-card"> <div style="padding: 0 20px"> <div class="slds-box slds-p-around_medium slds-text-align_center"> <lightning-layout> <lightning-layout-item> <div class="mainTitle" style="padding: 10px 3px;font-weight: bold;font-size: large">失单报告查看页面</div> </lightning-layout-item> <lightning-layout-item alignment-bump="left"> <lightning-button label="提交" onclick={submitJs}></lightning-button> <lightning-button name="编辑" label="编辑" onclick={editJs}></lightning-button> <lightning-button label="返回询价" onclick={cancel}></lightning-button> </lightning-layout-item> </lightning-layout> <lightning-layout> <lightning-layout-item size="1"> <label>失单类型:</label> </lightning-layout-item> <lightning-layout-item size="1"> <lightning-record-view-form object-api-name="Lost_cancel_report__c" record-id={LostReport.lostReport.Id} density="comfy"> <lightning-output-field field-name="LostType__c" variant="label-hidden"></lightning-output-field> </lightning-record-view-form> </lightning-layout-item> <lightning-layout-item size="1"></lightning-layout-item> <lightning-layout-item size="2"> <label>失单总金额(元):</label> </lightning-layout-item> <lightning-layout-item size="1"> <lightning-record-view-form object-api-name="Lost_cancel_report__c" record-id={LostReport.lostReport.Id} density="comfy"> <lightning-output-field field-name="LostTotalAmount__c" variant="label-hidden"></lightning-output-field> </lightning-record-view-form> </lightning-layout-item> <lightning-layout-item size="1"></lightning-layout-item> <lightning-layout-item size="1"> <label>包含超声:</label> </lightning-layout-item> <lightning-layout-item size="1"> <lightning-record-view-form object-api-name="Lost_cancel_report__c" record-id={LostReport.lostReport.Id} density="comfy"> <lightning-output-field field-name="InclusionUltrasound__c" variant="label-hidden"></lightning-output-field> </lightning-record-view-form> </lightning-layout-item> <lightning-layout-item size="1"></lightning-layout-item> <lightning-layout-item size="1"> <label>状态:</label> </lightning-layout-item> <lightning-layout-item size="1"> <lightning-record-view-form object-api-name="Lost_cancel_report__c" record-id={LostReport.lostReport.Id} density="comfy"> <lightning-output-field field-name="Report_Status__c" variant="label-hidden"></lightning-output-field> </lightning-record-view-form> </lightning-layout-item> </lightning-layout> </div> <div style="margin-top: 5px"> <div class="slds-box slds-p-around_medium"> <lightning-accordion allow-multiple-sections-open class="myAccordion"> <template for:each={LostReport.LostBrands} for:item="brand" for:index="i"> <li key={brand}> <li key={brand.lostBrand.Id}> <lightning-accordion-section class="text-container" data-id={i} name="失单品牌" label="失单品牌"> <lightning-layout> <lightning-layout-item size="2" style="border-style:solid;border-width: 1px;"> @@ -289,8 +293,46 @@ </lightning-layout> <lightning-layout> <lightning-layout-item flexibility="auto" padding="around-small"> <template if:true={isInit}> <!-- <template if:true={isInit}> <lightning-datatable hide-checkbox-column="true" key-field="is" columns={columns3} data={getData}></lightning-datatable> </template> --> <template if:true={isInit}> <table class="slds-table slds-table_bordered slds-table_cell-buffer slds-var-m-bottom_large"> <thead> <tr class="slds-text-title_caps"> <th><div class="slds-truncate">失单品牌</div></th> <th><div class="slds-truncate">失单对手型号</div></th> <th><div class="slds-truncate">失单数量</div></th> <th><div class="slds-truncate">失单对手型号(手动)</div></th> <th><div class="slds-truncate">失单产品类别</div></th> <th><div class="slds-truncate">失单产品区分</div></th> </tr> </thead> <tbody> <template for:each={brand.LostProducts} for:item="product" for:index="j"> <tr class="inputRows" key={product.lineNo2}> <td> <div>{product.LostProductss.LostBrandName__c}</div> </td> <td> <div>{product.productName}</div> </td> <td> <div>{product.LostProductss.Quantity__c}</div> </td> <td> <div>{product.LostProductss.LostProductMannual__c}</div> </td> <td> <div>{product.LostProductss.ProductClass__c}</div> </td> <td> <div>{product.LostProductss.ProductCategory__c}</div> </td> </tr> </template> </tbody> </table> </template> </lightning-layout-item> </lightning-layout> @@ -298,17 +340,73 @@ </li> </template> </lightning-accordion> <lightning-layout style="margin-top: 20px;"> <div class="slds-align_absolute-center"> <lightning-layout-item size="12"> <lightning-button label="提交" onclick={submitJs}></lightning-button> <lightning-button name="编辑" label="编辑" onclick={editJs}></lightning-button> <lightning-button label="返回询价" onclick={cancel}></lightning-button> </div> <div class="slds-box slds-p-around_medium slds-text-align_center"> <lightning-layout style="margin-top: 20px;"> <div class="slds-align_absolute-center"> <lightning-layout-item size="12"> <lightning-button label="提交" onclick={submitJs}></lightning-button> <lightning-button name="编辑" label="编辑" onclick={editJs}></lightning-button> <lightning-button label="返回询价" onclick={cancel}></lightning-button> </lightning-layout-item> </div> </lightning-layout> </div> </div> <template if:true={submitFlag}> <div class="slds-box slds-p-around_medium slds-text-align_center"> <lightning-layout> <lightning-layout-item> <div class="mainTitle" style="padding: 10px 3px;font-weight: bold;font-size: large">批准历史</div> </lightning-layout-item> </div> </lightning-layout> </div> </div> </lightning-card> <lightning-layout-item alignment-bump="left"> <lightning-button label="撤回批准请求"></lightning-button> </lightning-layout-item> </lightning-layout> <lightning-layout> <table class="slds-table slds-table_bordered slds-table_cell-buffer slds-var-m-bottom_large"> <thead> <tr class="slds-text-title_caps"> <th><div class="slds-truncate">操作</div></th> <th><div class="slds-truncate">日期</div></th> <th><div class="slds-truncate">状态</div></th> <th><div class="slds-truncate">被分配人</div></th> <th><div class="slds-truncate">实际批准人</div></th> <th><div class="slds-truncate">评论</div></th> </tr> </thead> <tbody> <template for:each={LostReport.approvalHistorys} for:item="approvalHistory" for:index="j"> <tr class="inputRows" key={approvalHistory.Id}> <td> <a onclick={test}>重新分配</a> <label>|</label> <a onclick={test}>批准/拒绝</a> </td> <td> <div>{approvalHistory.CreatedDate}</div> </td> <td> <div>{approvalHistory.StepStatus}</div> </td> <td> <div>{approvalHistory.Actor.Name}</div> </td> <td> <div>{approvalHistory.OriginalActor.Name}</div> </td> <td> <div>{approvalHistory.Comments}</div> </td> </tr> </template> </tbody> </table> </lightning-layout> </div> </template> </div> </lightning-card> </template> </template> </template> 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-06-06 13:27:33 * @LastEditTime: 2023-06-28 17:29:47 */ const columns2=[ { label: '--无--', value: '' }, @@ -51,6 +51,7 @@ import multiSelectCombobox from 'c/multiSelectCombobox' import searchBrands from '@salesforce/apex/lexPCLLostReportLwcController.searchBrands'; import getNewLostBrand from '@salesforce/apex/lexPCLLostReportLwcController.getNewLostBrand'; import getNewLostProduct from '@salesforce/apex/lexPCLLostReportLwcController.getNewLostProduct'; import getPickList from '@salesforce/apex/lexPCLLostReportLwcController.getPickList'; import { NavigationMixin } from 'lightning/navigation'; import submit from '@salesforce/apex/lexPCLLostReportLwcController.submit'; @@ -71,6 +72,7 @@ lostReport: {} } @track brandOptions = []; @track isInit = false; lostType = '失单'; submitFlag = ''; flag; @@ -107,6 +109,8 @@ this.LostReport.lostReport.LostTotalAmount__c = 0.0; this.LostReport.lostReport.InclusionUltrasound__c = '0'; this.newProduct = JSON.parse(JSON.stringify(this.LostReport.LostBrands[0].LostProducts[0])); console.log(this.LostReport); this.isInit = true; } }).catch(error=>{ console.log("error"); @@ -127,6 +131,9 @@ fieldName: 'ProductCategory__c' }).then(result=>{ this.productOptionsList = JSON.parse(result); }).catch(error=>{ console.log('error'); console.log(error); }); } @@ -159,19 +166,20 @@ updateRecord({fields: { Id: recordId }}); } get isInit(){ if(this.LostReport.LostBrands[0].LostProducts[0].productOptions == undefined){ return false; }else{ return true; } } // get isInit(){ // if(this.LostReport.LostBrands[0].LostProducts[0].productOptions == undefined){ // return false; // }else{ // return true; // } // } get getData(){ var products = this.LostReport.LostBrands[this.tableflag].LostProducts; var newLostReport = JSON.parse(JSON.stringify(this.LostReport)); var products = newLostReport.LostBrands[this.tableflag].LostProducts; var productList = []; products.forEach(product=>{ var newProduct = JSON.parse(JSON.stringify(product)); var newProduct = product; newProduct.LostProductss.productName = newProduct.productName; productList.push(newProduct.LostProductss); }); @@ -221,6 +229,15 @@ this.LostReport.LostBrands.push(result); }); } addRow(event){ var index = event.target.name; getNewLostProduct({ lineNo2: this.LostReport.LostBrands[index].LostProducts.length }).then(result=>{ result.LostProductss.LostBrandName__c = this.LostReport.LostBrands[index].lostBrand.Lost_By_Company__c; this.LostReport.LostBrands[index].LostProducts.push(result); }); } submitJs() { console.log('1'); submit({ @@ -230,7 +247,15 @@ if(result.error){ this.showToast(result.error,"error"); }else{ this.submitFlag = result.submitFlag; console.log(result); console.log(this.LostReport); for(var i=0;i < result.approvalHistorys.length;i++){ console.log('123'); this.LostReport.approvalHistorys.push(JSON.parse(JSON.stringify(result.approvalHistorys[i]))); console.log('321'); } this.submitFlag = JSON.parse(JSON.stringify(result.submitFlag)); console.log(this.LostReport); this.updateRecordView(this.reportId); } }).catch(error=>{ @@ -374,6 +399,7 @@ // console.log(this.LostReport); this.status.pageStatus = 'View'; this.tableflag = 0; this.showToast('保存成功','success'); console.log(this.LostReport); } }).catch(error=>{ @@ -470,14 +496,6 @@ isBlank(str) { return /^\s*$/.test(str); } addRow(event){ var index = event.target.name; var product = JSON.parse(JSON.stringify(this.newProduct)); if(this.LostReport.LostBrands[index].LostProducts[0].LostProductss.LostBrandName__c != undefined){ product.LostProductss.LostBrandName__c = JSON.parse(JSON.stringify(this.LostReport.LostBrands[index].LostProducts[0].LostProductss.LostBrandName__c)); } this.LostReport.LostBrands[index].LostProducts.push(product); } removeRow(event){ var index1 = event.target.name; var index2 = event.target.value; force-app/main/default/lwc/multiSelectCombobox/multiSelectCombobox.html
@@ -4,7 +4,7 @@ * @Author: chen jing wu * @Date: 2023-04-25 17:41:26 * @LastEditors: chen jing wu * @LastEditTime: 2023-05-30 15:07:43 * @LastEditTime: 2023-06-28 09:32:17 --> <!-- Code by CafeForce || www.cafeforce.com || support@cafeforce.com || Mandatory Header --> @@ -12,7 +12,9 @@ <!-- Header Label --> <template if:true={label}> <label class="slds-form-element__label">{label}</label> <label class="slds-form-element__label"> <span style="color:red;font-size: 10px;">*</span> {label}</label> </template> <div class="slds-combobox_container"> <div class="slds-combobox slds-dropdown-trigger slds-dropdown-trigger_click slds-is-open" aria-expanded="true" aria-haspopup="listbox" role="combobox">