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-05-24 16:34:15 * @LastEditTime: 2023-05-31 17:32:51 */ public with sharing class OpportunityLightingButtonController { @AuraEnabled @@ -223,6 +223,7 @@ res.salesManagerDepartmentID = opportunity.Sales_manager_departmentID__c; res.salesOwnerBuchang = opportunity.Sales_owner_buchang__c; res.salesOwnerBuchangID = opportunity.Sales_owner_buchangID__c; res.recordTypeId = Schema.SObjectType.Lost_cancel_report__c.getRecordTypeInfosByName().get(lexLightingButtonConstant.RECORD_TYPE_NAME_BY_OPPO_CANCEL_REPORT).getRecordTypeId(); } catch (Exception e) { throw new AuraHandledException(e.getMessage()); } @@ -568,7 +569,7 @@ select id, Tender_information__r.subInfoType__c from Tender_Opportunity_Link__c where (Tender_information__r.subInfoType__c =:lexLightingButtonConstant.SUB_INFO_TYPE_SCRAPPED_LABEL OR Tender_information__r.subInfoType__c =:lexLightingButtonConstant.SUB_INFO_TYPE_FLOW_LABEL) and Opportunity__c =: recordId where (Tender_information__r.subInfoType__c =:lexLightingButtonConstant.SUB_INFO_TYPE_SCRAPPED_LABEL OR Tender_information__r.subInfoType__c =:lexLightingButtonConstant.SUB_INFO_TYPE_FLOW_LABEL OR Tender_information__r.TerminateApprovalStatus__c= :lexLightingButtonConstant.SUB_INFO_TYPE_APPROVE) and Opportunity__c =: recordId ]; } catch (Exception e) { System.debug('e:****' + e); @@ -833,5 +834,7 @@ public String s1ProfileId; @AuraEnabled public String accountName; @AuraEnabled public String recordTypeId; } } force-app/main/default/classes/lexLightingButtonConstant.cls
@@ -59,6 +59,8 @@ public static final String SUB_INFO_TYPE_SCRAPPED_LABEL = '3-1:废标公告'; //招标项目的阶段补充说明‘3-2:流标公告’ public static final String SUB_INFO_TYPE_FLOW_LABEL = '3-2:流标公告'; //招标项目的阶段补充说明‘批准’ public static final String SUB_INFO_TYPE_APPROVE = '批准'; //周报月报的记录类型名‘周报’ public static final String RECORD_TYPE_NAME_BY_MONTHLY_REPORT = '周报'; //报告书的记录类型‘提交’ @@ -75,6 +77,8 @@ public static final String RECORD_TYPE_NAME_BY_FINAL= '9.Final 完毕'; //QIS的记录类型‘5.现场结案’ public static final String RECORD_TYPE_NAME_BY_COMP= '5.现场结案'; //失单取消报告的记录类型‘询价取消报告’ public static final String RECORD_TYPE_NAME_BY_OPPO_CANCEL_REPORT = '询价取消报告'; //记录类型的developerName‘ASRCDecision’ public static final String DEVELOPER_NAME_ASRC_DECISION = 'ASRCDecision'; //记录类型的developerName‘ASACDecision’ force-app/main/default/classes/lexLookupController.cls
New file @@ -0,0 +1,8 @@ public with sharing class lexLookupController { @AuraEnabled public static List<Object> getRecordsByName(String objectName, String searchFor,String queryBrand) { String queryString = 'SELECT Id, Name FROM '; queryString += String.escapeSingleQuotes(objectName) + ' WHERE Name Like \'%' + String.escapeSingleQuotes(searchFor) + '%\' and Category5__c = \'竞争对手\' and Brand_Name__c != \'奥林巴斯\' and RecordTypeId = \'01210000000aMAEAA2\' and Brand_Name__c = \'' + queryBrand + '\' limit 10'; return Database.query(queryString); } } force-app/main/default/classes/lexLookupController.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>56.0</apiVersion> <status>Active</status> </ApexClass> force-app/main/default/classes/lexPCLLostReportLwcController.cls
@@ -617,6 +617,7 @@ } // lostReportId = report.lostReport.id; system.debug('save---end:'); messageMap.put('LostReport',JSON.serialize(report)); }catch (Exception ex) { Database.rollback(sp); // 这里需要写一些报错信息 @@ -773,6 +774,8 @@ @AuraEnabled public Boolean bool; @AuraEnabled public String productName; @AuraEnabled public List<Map<String, String>> productOptions = new List<Map<String, String>>(); public PCLLostProducts() { this.lineNo2 = 0; @@ -815,20 +818,17 @@ } } } // add tcm 20211118 end @AuraEnabled public static List<Product2> searchProduct(){ public static string searchProduct(String lostProduct){ Product2 prd = null; try { List<Product2> products = [ select Id,name from Product2 where Brand_Name__c = 'STORZ' limit 10 ]; return products; prd = [select Id,ProductClass__c, ProductCategory__c from Product2 where Id =:lostProduct]; } catch (Exception e) { throw new AuraHandledException(e.getMessage()); } return JSON.serialize(prd); } // add tcm 20211118 end } force-app/main/default/lwc/lexASACEditor/lexASACEditor.js
@@ -4,13 +4,14 @@ * @Author: chen jing wu * @Date: 2023-05-08 14:36:32 * @LastEditors: chen jing wu * @LastEditTime: 2023-05-15 09:20:08 * @LastEditTime: 2023-05-26 15:57:45 */ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/ReportController.initForASACEditorButton'; export default class LexASACEditor extends LightningElement { import { NavigationMixin } from 'lightning/navigation'; export default class LexASACEditor extends NavigationMixin(LightningElement) { @api recordId; lastModifiedDate id @@ -50,7 +51,6 @@ this.developerName = result.developerName; this.editor(); this.dispatchEvent(new CloseActionScreenEvent()); //window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Report__c/" + this.recordId + "/view"); }else{ console.log("else"); this.IsLoading = false; @@ -69,12 +69,10 @@ editor(){ if (this.id != undefined){ this.url = "/apex/RepPAEDecisionRecord?Id="+this.id+"&ReportId="+this.recordId+"&RecordTypeIds="+"ASACDecision"; console.log(this.url); } else { this.url = "/apex/RepPAEDecisionRecord?Id="+this.id+"&ReportId="+this.recordId+"&RecordTypeIds="+"ASACDecision"; } else { this.url = "/apex/RepPAEDecisionRecord?ReportId="+this.recordId+"&RecordTypeIds="+"ASACDecision"; console.log(this.url); } } window.open(this.url,"_self"); } } force-app/main/default/lwc/lexASRCEditor/lexASRCEditor.js
@@ -4,14 +4,14 @@ * @Author: chen jing wu * @Date: 2023-05-08 14:36:32 * @LastEditors: chen jing wu * @LastEditTime: 2023-05-15 09:22:15 * @LastEditTime: 2023-05-26 15:57:13 */ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/ReportController.initForASRCEditorButton'; export default class LexASRCEditor extends LightningElement { import { NavigationMixin } from 'lightning/navigation'; export default class LexASRCEditor extends NavigationMixin(LightningElement) { @api recordId; lastModifiedDate id @@ -35,7 +35,6 @@ } } } connectedCallback () { console.log(this.recordId); init({ @@ -51,7 +50,6 @@ this.developerName = result.developerName; this.editor(); this.dispatchEvent(new CloseActionScreenEvent()); //window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Report__c/" + this.recordId + "/view"); }else{ console.log("else"); this.IsLoading = false; @@ -63,19 +61,16 @@ console.log(error); }).finally(() => { }); //this.updateRecordView(this.recordId); }); } editor(){ if (this.id != undefined){ this.url = "/apex/RepPAEDecisionRecord?Id="+this.id+"&ReportId="+this.recordId+"&RecordTypeIds="+"ASRCDecision"; console.log(this.url); } else { } else { this.url = "/apex/RepPAEDecisionRecord?ReportId="+this.recordId+"&RecordTypeIds="+"ASRCDecision"; console.log(this.url); } } window.open(this.url,"_self"); } } force-app/main/default/lwc/lexASRCEditor/lexASRCEditor.js-meta.xml
@@ -1,4 +1,3 @@ <?xml version="1.0" encoding="UTF-8"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>54.0</apiVersion> force-app/main/default/lwc/lexCancelReport/lexCancelReport.js
@@ -5,8 +5,10 @@ import queryForCancelReportButton from '@salesforce/apex/OpportunityLightingButtonController.queryForCancelReportButton'; import { updateRecord } from 'lightning/uiRecordApi'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import { NavigationMixin } from 'lightning/navigation'; import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils'; import ConSent from '@salesforce/apex/BidAnnouncementController.ConSent'; export default class LexCancelReport extends LightningElement { export default class LexCancelReport extends NavigationMixin(LightningElement) { @api recordId; stageName; sapSendOK; @@ -21,6 +23,7 @@ salesManagerDepartmentID; salesOwnerBuchang; salesOwnerBuchangID; recordTypeId; IsLoading = true; @wire(CurrentPageReference) getStateParameters(currentPageReference) { @@ -55,8 +58,12 @@ this.salesManagerDepartmentID = result.salesManagerDepartmentID == undefined ? '' : result.salesManagerDepartmentID; this.salesOwnerBuchang = result.salesOwnerBuchang == undefined ? '' : result.salesOwnerBuchang; this.salesOwnerBuchangID = result.salesOwnerBuchangID == undefined ? '' : result.salesOwnerBuchangID; this.recordTypeId = result.recordTypeId; this.cancelReport(); }) }).catch(error=>{ console.log("error"); console.log(error); }); } showToast(msg,type) { const event = new ShowToastEvent({ @@ -100,17 +107,24 @@ } //XLIU-CG98L5 【委托】【评估】新需求-招标项目/询价对应流标、废标改善 end else { location.href = '/a1U/e?retURL=%2F'+ this.recordId + '&RecordType=01210000000R4hH' + '&CF00N10000004lbGT=' + this.name + '&CF00N10000004lbGT_lkid=' + this.recordId + '&CF00N10000006QShg=' + this.salesAssistantName + '&CF00N10000006QShg_lkid=' + this.salesAssistantID + '&CF00N10000006QShq='+ this.managerName + '&CF00N10000006QShq_lkid=' + this.salesManagerDepartmentID + '&CF00N10000006QShb=' + this.salesOwnerBuchang + '&CF00N10000006QShb_lkid=' + this.salesOwnerBuchangID + ''; const defaultValues = encodeDefaultFieldValues({ Opportunity__c: this.recordId, // 关联主记录 ID Sales_assistant__c: this.salesAssistantID, Manager_sales__c: this.salesManagerDepartmentID, Buchang_sales__c: this.salesOwnerBuchangID }); this[NavigationMixin.Navigate]({ type: 'standard__objectPage', attributes: { objectApiName: 'Lost_cancel_report__c', actionName: 'new' }, state: { nooverride: '1', defaultFieldValues: defaultValues, recordTypeId: this.recordTypeId, } }); } this.dispatchEvent(new CloseActionScreenEvent()); }); force-app/main/default/lwc/lexLookupLwc/__tests__/lexLookupLwc.test.js
New file @@ -0,0 +1,25 @@ import { createElement } from 'lwc'; import LexLookupLwc from 'c/lexLookupLwc'; describe('c-lex-lookup-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-lookup-lwc', { is: LexLookupLwc }); // Act document.body.appendChild(element); // Assert // const div = element.shadowRoot.querySelector('div'); expect(1).toBe(1); }); }); force-app/main/default/lwc/lexLookupLwc/lexLookupLwc.html
New file @@ -0,0 +1,60 @@ <!-- * @Description: * @version: * @Author: chen jing wu * @Date: 2023-05-25 13:59:44 * @LastEditors: chen jing wu * @LastEditTime: 2023-05-30 10:21:50 --> <template> <div> <div class="slds-form-element"> <div class="slds-form-element__control"> <div class="slds-combobox_container"> <div class="slds-combobox" aria-expanded="false" aria-haspopup="listbox" role="combobox"> <div class="slds-combobox__form-element slds-input-has-icon slds-input-has-icon_right" role="none"> <template if:false={recordselected}> <input class="slds-input slds-combobox__input" id="combobox-id-1" aria-autocomplete="list" aria-controls="listbox-id-1" role="textbox" type="text" placeholder="Search..." onkeyup={onKeyChange} value={selectedValue}/ disabled={disabled}> </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}> <lightning-icon icon-name={iconname} size="x-small"></lightning-icon> <span class="slds-pill__label slds-p-left_x-small">{selectedValue}</span> </a> <button onclick={clearSelection} class="slds-button slds-button_icon slds-button_icon slds-pill__remove" title="Remove"> <lightning-icon icon-name="utility:close" size="small" alternative-text="Press delete or backspace to remove"></lightning-icon> <span class="slds-assistive-text" >Remove</span> </button> </span> </template> </div> <template if:true={recordsList}> <div class="slds-combobox_container"> <div id="listbox-id-1" class="slds-dropdown slds-dropdown_fluid" role="listbox"> <ul class="slds-listbox slds-listbox_vertical" role="presentation"> <template for:each={recordsList} for:item="item"> <li key={item.Id} role="presentation" class="slds-listbox__item"> <div class="slds-media slds-listbox__option slds-listbox__option_plain slds-media_small" role="option" data-itemid = {item.Id} data-itemname={item.Name} onclick={setSelectedValue}> <span role="menuitem" tabindex="-1" data-itemid = {item.Id} data-itemname={item.Name}> <lightning-icon icon-name={iconname} size="x-small" data-itemid = {item.Id} data-itemname={item.Name}></lightning-icon> {item.Name} </span> </div> </li> </template> </ul> </div> </div> </template> </div> </div> </div> </div> </div> </template> force-app/main/default/lwc/lexLookupLwc/lexLookupLwc.js
New file @@ -0,0 +1,87 @@ /* * @Description: * @version: * @Author: chen jing wu * @Date: 2023-05-25 13:59:44 * @LastEditors: chen jing wu * @LastEditTime: 2023-05-30 14:54:30 */ import { LightningElement, track, api } from 'lwc'; import getRecordsByName from '@salesforce/apex/lexLookupController.getRecordsByName' export default class LexLookupLwc extends LightningElement { @api objectname; @api queryBrand; @track recordsList; @track selectedValue = ""; error; recordselected = false; @api iconname; @api initValue; disabled = false; //Method to query data after typing search term onKeyChange(event) { this.selectedValue = event.target.value; if(this.queryBrand == undefined){ this.queryBrand = ''; } getRecordsByName({objectName : this.objectname, searchFor : this.selectedValue, queryBrand : this.queryBrand}) .then(result => { this.recordsList = result; }) .catch(error => { //exception handling this.error = error; }) } renderedCallback(){ if(this.initValue != '' && this.initValue != undefined && this.initValue != null){ this.recordselected = true; this.selectedValue = this.initValue; } } @api letDisabledTrue(){ this.recordselected = false; this.disabled = true; this.selectedValue = ""; this.recordsList = undefined; } @api letDisabledFalse(){ this.recordselected = false; this.disabled = false; this.selectedValue = ""; this.recordsList = undefined; } //Method to clear search list and show selected value. @api clearSelection() { this.recordselected = false; this.selectedValue = ""; this.recordsList = undefined; } //Method to pass selected record to parent component. setSelectedValue(event) { this.selectedValue = event.target.dataset.itemname; this.recordselected = true; this.recordsList = undefined; event.preventDefault(); const selectedEvent = new CustomEvent('selected', { detail: { Name : this.selectedValue, Id : event.target.dataset.itemid, ObjectName : this.objectname } }); this.dispatchEvent(selectedEvent); } } force-app/main/default/lwc/lexLookupLwc/lexLookupLwc.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>56.0</apiVersion> <isExposed>false</isExposed> </LightningComponentBundle> force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.html
@@ -4,139 +4,308 @@ * @Author: chen jing wu * @Date: 2023-04-20 17:16:48 * @LastEditors: chen jing wu * @LastEditTime: 2023-05-24 15:52:37 * @LastEditTime: 2023-05-31 11:44:24 --> <template> <lightning-card data-id="test"> <template if:true={isEdit}> <lightning-card id="my-element1" class="card" variant="Narrow" data-id="my-card"> <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> <template if:true={isEdit}> <lightning-button name="save" label="保存1" onclick={saveBrandToEditJs}></lightning-button> </template> <template if:false={isEdit}> <lightning-button name="save" label="保存" onclick={saveBrandJs}></lightning-button> </template> <lightning-button label="返回询价" onclick={cancel}></lightning-button> </lightning-layout-item> </div> </lightning-layout> <div style="margin-top: 5px"> <lightning-layout> <lightning-layout-item size="2" 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="3" 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.index}> <lightning-accordion-section class="" data-id={i} name="失单品牌" label="失单品牌"> <template if:true={isEdit}> <lightning-button name="save" label="保存1" onclick={saveBrandToEditJs}></lightning-button> </template> <template if:false={isEdit}> <lightning-button name="save" label="保存" onclick={saveBrandJs}></lightning-button> </template> <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} 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"> <lightning-button label="追加品牌" onclick={addBrandJs}></lightning-button> <template if:true={isEdit}> <lightning-button name="save" label="保存1" onclick={saveBrandToEditJs}></lightning-button> </template> <template if:false={isEdit}> <lightning-button name="save" label="保存" onclick={saveBrandJs}></lightning-button> </template> <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> <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={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"> <lightning-layout> <lightning-layout-item size="2" 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 size="1"> <label>失单类型:</label> </lightning-layout-item> <lightning-layout-item size="3" padding="around-small"> <div style="padding: 10px 3px;font: 16px;">失单总金额(元):{LostReport.lostReport.LostTotalAmount__c}</div> <lightning-layout-item size="1"> <lightning-record-view-form object-api-name="Lost_cancel_report__c" record-id={reportId} 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="3" padding="around-small"> <div style="padding: 10px 3px;font: 16px;">包含超声:{LostReport.lostReport.InclusionUltrasound__c}</div> <lightning-layout-item size="1"></lightning-layout-item> <lightning-layout-item size="2"> <label>失单总金额(元):</label> </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 size="1"> <lightning-record-view-form object-api-name="Lost_cancel_report__c" record-id={reportId} 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={reportId} 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={reportId} 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> <lightning-accordion allow-multiple-sections-open class="myAccordion"> <template for:each={LostReport.LostBrands} for:item="brand" for:index="i"> <li key={brand.index}> <lightning-accordion-section class="" data-id={i} name="失单品牌" label="失单品牌"> <lightning-button name={i} label="保存" onclick={saveBrandJs}></lightning-button> <lightning-button name={i} label="删除" onclick={deleteBrandJs} disabled={isBrandCount2}></lightning-button> <lightning-accordion-section class="text-container" data-id={i} name="失单品牌" label="失单品牌"> <lightning-layout> <lightning-layout-item size="4" padding="around-small"> <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> <lightning-layout-item size="2" style="border-style:solid;border-width: 1px;"> <label>失单品牌:</label> </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 size="2" style="border-style:solid;border-width: 1px;"> <lightning-record-view-form object-api-name="PCLLostBrand__c" record-id={brand.lostBrand.Id} density="comfy"> <lightning-output-field field-name="Lost_By_Company__c" variant="label-hidden"></lightning-output-field> </lightning-record-view-form> </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 size="2" style="border-style:solid;border-width: 1px;"> <label>失单原因(主):</label> </lightning-layout-item> <lightning-layout-item size="2" style="border-style:solid;border-width: 1px;"> <lightning-record-view-form object-api-name="PCLLostBrand__c" record-id={brand.lostBrand.Id} density="comfy"> <lightning-output-field field-name="Lost_reason_main__c" variant="label-hidden"></lightning-output-field> </lightning-record-view-form> </lightning-layout-item> <lightning-layout-item size="2" style="border-style:solid;border-width: 1px;"> <label>失单原因(次):</label> </lightning-layout-item> <lightning-layout-item size="2" style="border-style:solid;border-width: 1px;"> <lightning-record-view-form object-api-name="PCLLostBrand__c" record-id={brand.lostBrand.Id} density="comfy"> <lightning-output-field field-name="Lost_Reason_Sub__c" variant="label-hidden"></lightning-output-field> </lightning-record-view-form> </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 size="2" style="border-style:solid;border-width: 1px;"> <label>失单品牌(手动):</label> </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 size="2" style="border-style:solid;border-width: 1px;"> <lightning-record-view-form object-api-name="PCLLostBrand__c" record-id={brand.lostBrand.Id} density="comfy"> <lightning-output-field field-name="Lost_By_Company_Mannual__c" variant="label-hidden"></lightning-output-field> </lightning-record-view-form> </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 size="2" style="border-style:solid;border-width: 1px;"> <label>失单金额(元):</label> </lightning-layout-item> <lightning-layout-item size="2" style="border-style:solid;border-width: 1px;"> <lightning-record-view-form object-api-name="PCLLostBrand__c" record-id={brand.lostBrand.Id} density="comfy"> <lightning-output-field field-name="LostPrice__c" variant="label-hidden"></lightning-output-field> </lightning-record-view-form> </lightning-layout-item> <lightning-layout-item size="2" style="border-style:solid;border-width: 1px;"> <label>中标经销商:</label> </lightning-layout-item> <lightning-layout-item size="2" style="border-style:solid;border-width: 1px;"> <lightning-record-view-form object-api-name="PCLLostBrand__c" record-id={brand.lostBrand.Id} density="comfy"> <lightning-output-field field-name="Agency__c" variant="label-hidden"></lightning-output-field> </lightning-record-view-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 size="2" style="border-style:solid;border-width: 1px;"> <label>中标经销商(手动):</label> </lightning-layout-item> <lightning-layout-item size="2" style="border-style:solid;border-width: 1px;"> <lightning-record-view-form object-api-name="PCLLostBrand__c" record-id={brand.lostBrand.Id} density="comfy"> <lightning-output-field field-name="AgencyMannual__c" variant="label-hidden"></lightning-output-field> </lightning-record-view-form> </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} 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' record-id='' > <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> </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" 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> <lightning-datatable hide-checkbox-column="true" key-field="is" columns={columns3} data={getData}></lightning-datatable> </template> </lightning-layout-item> </lightning-layout> @@ -147,117 +316,17 @@ <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={submitJs}></lightning-button> <lightning-button name="编辑" label="编辑" onclick={editJs}></lightning-button> <lightning-button label="返回询价" onclick={cancel}></lightning-button> </lightning-layout-item> </div> </lightning-layout> <template if:true={isSubmit}> <div>...test...</div> </template> </div> </div> </lightning-card> </template> <template if:true={isView}> <lightning-card> <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"> <lightning-layout> <lightning-layout-item size="2" padding="around-small"> <div class="slds-form_horizontal my-combobox"> <label>失单类型:</label> <lightning-formatted-text value={LostReport.lostReport.LostType__c}></lightning-formatted-text> </div> </lightning-layout-item> <lightning-layout-item size="3" padding="around-small"> <label>失单总金额(元):</label> <lightning-formatted-number value={LostReport.lostReport.LostTotalAmount__c}></lightning-formatted-number> </lightning-layout-item> <lightning-layout-item size="3" padding="around-small"> <label>包含超声:</label> <lightning-formatted-text value={LostReport.lostReport.InclusionUltrasound__c}></lightning-formatted-text> </lightning-layout-item> <lightning-layout-item size="3" padding="around-small"> <label>状态:</label> <lightning-formatted-text value={LostReport.lostReport.Report_Status__c}></lightning-formatted-text> </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.index}> <lightning-accordion-section class="text-container" data-id={i} name="失单品牌" label="失单品牌"> <lightning-layout> <lightning-layout-item size="4" padding="around-small"> <label>失单品牌:</label> <lightning-formatted-text name={i} value={brand.lostBrand.Lost_By_Company__c}></lightning-formatted-text> </lightning-layout-item> <lightning-layout-item flexibility="auto" padding="around-small"> <label>失单原因(主):</label> <lightning-formatted-text name={i} value={brand.lostBrand.Lost_reason_main__c}></lightning-formatted-text> </lightning-layout-item> <lightning-layout-item flexibility="auto" padding="around-small"> <label>失单原因(次):</label> <lightning-formatted-text name={i} value={brand.lostBrand.Lost_Reason_Sub__c}></lightning-formatted-text> </lightning-layout-item> </lightning-layout> <lightning-layout> <lightning-layout-item size="4" padding="horizontal-small"> <label>失单品牌(手动):</label> <lightning-formatted-text name={i} value={brand.lostBrand.Lost_By_Company_Mannual__c}></lightning-formatted-text> </lightning-layout-item> <lightning-layout-item size="4" padding="horizontal-small"> <label>失单金额(元):</label> <lightning-formatted-text name={i} value={brand.lostBrand.LostPrice__c}></lightning-formatted-text> </lightning-layout-item> <lightning-layout-item size="4" padding="horizontal-small"> <label>中标经销商:</label> <lightning-formatted-text name={i} value={brand.lostBrand.Agency__c}></lightning-formatted-text> </lightning-layout-item> </lightning-layout> <lightning-layout> <lightning-layout-item size="4" padding="horizontal-small"> <label>中标经销商(手动):</label> <lightning-formatted-text name={i} value={brand.lostBrand.AgencyMannual__c}></lightning-formatted-text> </lightning-layout-item> </lightning-layout> <lightning-layout> <lightning-layout-item flexibility="auto" padding="around-small"> <template if:true={isInit}> <lightning-datatable hide-checkbox-column="true" key-field="is" columns={columns3} data={getData}></lightning-datatable> </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"> <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> </lightning-card> </lightning-card> </template> </lightning-card> </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-05-24 15:48:07 * @LastEditTime: 2023-05-31 11:42:30 */ const columns2=[ { label: '--无--', value: '' }, @@ -57,11 +57,14 @@ import { NavigationMixin } from 'lightning/navigation'; import submit from '@salesforce/apex/lexPCLLostReportLwcController.submit'; import {CloseActionScreenEvent} from 'lightning/actions'; import lexLookupLwc from 'c/lexLookupLwc'; import searchProduct from '@salesforce/apex/lexPCLLostReportLwcController.searchProduct'; import { updateRecord } from 'lightning/uiRecordApi'; export default class LexPCLLostReportPage extends NavigationMixin(LightningElement) { @api oppId; @track columns2=columns2; @track pageStatus = 'Create'; @api pageStatus = 'Create'; @track LostReport = { LostBrands: [ ], @@ -80,6 +83,7 @@ columns3 = columns3; //失单类型 RecordTypeOptions = RecordTypeOptions; isSubmit = false; connectedCallback(){ init({ oppId1: this.oppId, @@ -149,6 +153,9 @@ }); this.dispatchEvent(event); } updateRecordView(recordId) { updateRecord({fields: { Id: recordId }}); } get isInit(){ if(this.LostReport.LostBrands[0].LostProducts[0].productOptions == undefined){ @@ -183,8 +190,15 @@ return false; } get isEdit(){ get isCreateOrEdit(){ if(this.pageStatus == 'Create' || this.pageStatus == 'Edit'){ return true; } return false; } get isEdit(){ if(this.pageStatus == 'Edit'){ return true; } return false; @@ -203,7 +217,6 @@ report1: JSON.stringify(this.LostReport), reportId: this.reportId }).then(result=>{ console.log(result); if(result.error){ this.showToast(result.error,"error"); }else{ @@ -219,8 +232,12 @@ if(result.message != null){ if(result.message == '提交成功!'){ this.LostReport = report; this.isSubmit = true; this.pageStatus = 'View'; console.log(this.LostReport); this.showToast(result.message,"success"); this.updateRecordView(this.reportId); }else{ this.showToast(result.message,"error"); } @@ -262,14 +279,39 @@ const payloadType = event.detail.payloadType; this.LostReport.LostBrands[index].lostBrand.Lost_By_Company__c = payload.value; if(payloadType === 'multi-select'){ this.clearProducts(payload.value,index); this.setDefaultBrand(payload.value,index); this.clearBrandMannualName(payload.value,index); } } setDefaultBrand(value,index){ this.LostReport.LostBrands[index].LostProducts.forEach(product => { product.LostProductss.LostBrandName__c = value; console.log('22222'); // this.LostReport.LostBrands[index].LostProducts.forEach(product => { // product.LostProductss.LostBrandName__c = value; // }); var newProducts = []; this.LostReport.LostBrands[index].LostProducts.forEach(product=>{ this.newProduct.LostProductss.LostBrandName__c = value; newProducts.push(JSON.parse(JSON.stringify(this.newProduct))); }); this.LostReport.LostBrands[index].LostProducts = newProducts; } clearProducts(value,index){ console.log('111111'); var newProducts = []; this.LostReport.LostBrands[index].LostProducts.forEach(product=>{ this.newProduct.LostProductss.LostBrandName__c = value; newProducts.push(JSON.parse(JSON.stringify(this.newProduct))); }); var elements1 = this.template.querySelectorAll('.ProductClass[data-id="' + index + '"]'); elements1.forEach(element=>{ element.readOnly = false; }); var elements2 = this.template.querySelectorAll('.Product[data-id="' + index + '"]'); elements2.forEach(element=>{ element.clearSelection(); }); this.LostReport.LostBrands[index].LostProducts = newProducts; } @@ -279,10 +321,9 @@ var elements = this.template.querySelectorAll('[data-id="Lost_By_Company_Mannual"]'); elements[index].disabled = false; elements[index].required = true; var elements1 = this.template.querySelectorAll('.LostProduct[data-id="' + index + '"]'); var elements1 = this.template.querySelectorAll('.Product[data-id="' + index + '"]'); elements1.forEach(element=>{ element.value = ''; element.disabled = true; element.letDisabledTrue(); }); } else { var elements = this.template.querySelectorAll('[data-id="Lost_By_Company_Mannual"]'); @@ -290,8 +331,9 @@ elements[index].value = ''; elements[index].disabled = true; elements[index].required = false; var elements1 = this.template.querySelectorAll('.Product[data-id="' + index + '"]'); elements1.forEach(element=>{ element.disabled = false; element.letDisabledFalse(); }); } } @@ -311,26 +353,63 @@ if(!this.flag){ return; } dataEntry({ console.log(this.pageStatus); if(this.pageStatus == 'Edit'){ this.pageStatus = 'View'; }else{ dataEntry({ report1 : JSON.stringify(this.LostReport) }).then(result=>{ console.log(result); if(result.error){ this.showToast(result.error,"error"); }else{ this.LostReport = JSON.parse(result.LostReport); this.reportId = result.reportId; console.log(this.LostReport); this.pageStatus = 'View'; Promise.resolve().then(() => { this.pageStatus = 'View'; this.template.querySelectorAll('lightning-card').forEach(elem => { elem.classList.toggle('View'); }); }); } }).catch(error=>{ console.log("error"); console.log(error); }); } } editJs(){ this.pageStatus = 'Edit'; saveBrandToEditJs(event) { Promise.resolve().then(() => { this.pageStatus = 'View'; this.template.querySelectorAll('lightning-card').forEach(elem => { elem.classList.toggle('View'); }); }); } editJs(){ Promise.resolve().then(() => { this.pageStatus = 'Edit'; this.template.querySelectorAll('lightning-card').forEach(elem => { elem.classList.toggle('Edit'); }); }); // var elements = this.template.querySelectorAll('.Product'); // console.log(elements.length); // elements.forEach(element=>{ // var name = null; // this.productNameList.forEach(product=>{ // if(product.index1 == element.title && product.index2 == element.name){ // name = product.name; // } // }); // element.editLookup(name); // }); } dataCheck(){ this.flag = true; if(this.LostReport.lostReport.LostType__c == undefined || this.isBlank(this.LostReport.lostReport.LostType__c)) @@ -433,6 +512,66 @@ } this.LostReport.LostBrands[index1].LostProducts.splice(index2,1); } search(topNum,secondNum){ console.log("sb"); var elements1 = this.template.querySelectorAll('.ProductClass[data-id="' + topNum + '"]'); var elements2 = this.template.querySelectorAll('.ProductCategory[data-id="' + topNum + '"]'); if (this.LostReport.LostBrands[topNum].LostProducts[secondNum].LostProductss.LostProduct__c==null) { elements1[secondNum].readOnly = false; elements2[secondNum].readOnly = false; this.LostReport.LostBrands[topNum].LostProducts[secondNum].LostProductss.ProductClass__c=null; this.LostReport.LostBrands[topNum].LostProducts[secondNum].LostProductss.ProductCategory__c=null; this.LostReport.LostBrands[topNum].LostProducts[secondNum].bool=false; elements1[secondNum].readOnly = true; elements2[secondNum].readOnly = true; }else { console.log("a"); searchProduct({ lostProduct : this.LostReport.LostBrands[topNum].LostProducts[secondNum].LostProductss.LostProduct__c }).then(result=>{ console.log(result); var prd = JSON.parse(result); this.LostReport.LostBrands[topNum].LostProducts[secondNum].productOptions = this.productOptionsList[prd.ProductClass__c]; if (prd.ProductCategory__c!=null) { console.log("c"); elements1[secondNum].readOnly = false; elements2[secondNum].readOnly = false; this.LostReport.LostBrands[topNum].LostProducts[secondNum].LostProductss.ProductClass__c=prd.ProductClass__c; this.LostReport.LostBrands[topNum].LostProducts[secondNum].LostProductss.ProductCategory__c=prd.ProductCategory__c; elements1[secondNum].readOnly = true; elements2[secondNum].readOnly = true; console.log("e"); // this.LostReport.LostBrands[topNum].LostProducts[secondNum].bool=true; }else { console.log("d"); elements1[secondNum].readOnly = false; elements2[secondNum].readOnly = false; this.LostReport.LostBrands[topNum].LostProducts[secondNum].LostProductss.ProductClass__c=null; this.LostReport.LostBrands[topNum].LostProducts[secondNum].LostProductss.ProductCategory__c=null; elements1[secondNum].readOnly = true; elements2[secondNum].readOnly = true; // this.LostReport.LostBrands[topNum].LostProducts[secondNum].bool=false; } }).catch(error=>{ console.log("error"); console.log(error); }); } } handleSelected(event) { console.log('......'); var index1 = event.target.title; var index2 = event.target.name; // var objectname = event.detail.ObjectName; this.LostReport.LostBrands[index1].LostProducts[index2].LostProductss.LostProduct__c = event.detail.Id; this.LostReport.LostBrands[index1].LostProducts[index2].productName = event.detail.Name; this.search(index1,index2); console.log(this.LostReport); // this.account = {Name : event.detail.Name, Id: event.detail.Id} } handleLostTypeChange(event){ var value = event.target.value; @@ -456,15 +595,14 @@ var value = event.target.value; this.LostReport.LostBrands[index].lostBrand.Lost_By_Company_Mannual__c = value; this.setDefaultBrand(value,index); var elements = this.template.querySelectorAll('.LostProduct[data-id="' + index + '"]'); var elements = this.template.querySelectorAll('.Product[data-id="' + index + '"]'); if(value == '' || value == null){ elements.forEach(element=>{ element.value = ''; element.disabled = true; element.letDisabledTrue(); }); }else{ elements.forEach(element=>{ element.disabled = false; element.letDisabledFalse(); }); } } @@ -506,6 +644,7 @@ this.LostReport.LostBrands[index1].LostProducts[index2].LostProductss.LostProductMannual__c = event.target.value; } handleProductClassChange(event){ console.log("qwer"); var index1 = event.target.title; var index2 = event.target.name; this.LostReport.LostBrands[index1].LostProducts[index2].LostProductss.ProductClass__c = event.target.value; force-app/main/default/lwc/lexSubmit/lexSubmit.js
@@ -4,7 +4,7 @@ * @Author: chen jing wu * @Date: 2023-04-11 16:46:48 * @LastEditors: chen jing wu * @LastEditTime: 2023-04-11 16:48:05 * @LastEditTime: 2023-05-31 17:48:01 */ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; 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-04 13:56:11 * @LastEditTime: 2023-05-30 15:07:43 --> <!-- Code by CafeForce || www.cafeforce.com || support@cafeforce.com || Mandatory Header --> @@ -18,7 +18,7 @@ <div class="slds-combobox slds-dropdown-trigger slds-dropdown-trigger_click slds-is-open" aria-expanded="true" aria-haspopup="listbox" role="combobox"> <!-- Search Input --> <div class="slds-combobox__form-element slds-input-has-icon slds-input-has-icon_right" role="none"> <lightning-input data-id="myinput" disabled={disabled} class="inputBox" placeholder="--无--" onblur={blurEvent} onclick={showOptions} onkeyup={filterOptions} value={searchString} auto-complete="off" variant="label-hidden" id="combobox-id-1" required={isRequired}></lightning-input> <lightning-input data-id="myinput" disabled={disabled} class="inputBox" placeholder={placeholder} onblur={blurEvent} onclick={showOptions} onkeyup={filterOptions} value={searchString} auto-complete="off" variant="label-hidden" id="combobox-id-1" required={isRequired}></lightning-input> <lightning-icon class="slds-input__icon" icon-name="utility:down" size="x-small" alternative-text="search"></lightning-icon> </div> <!-- Dropdown List --> force-app/main/default/lwc/multiSelectCombobox/multiSelectCombobox.js
@@ -18,6 +18,7 @@ @track searchString; @track message; @track showDropdown = false; @api placeholder = '--无--'; connectedCallback() { this.showDropdown = false; var optionData = this.options ? (JSON.parse(JSON.stringify(this.options))) : null; force-app/main/default/pages/MergeAgencyActivity.page
@@ -1,4 +1,4 @@ <apex:page showHeader="true" sidebar="true" id="allPage" title="MergeAgencyActivity" controller="MergeAgencyActivityController"> <apex:page showHeader="true" sidebar="true" id="allPage" title="MergeAgencyActivity" controller="MergeAgencyActivityController" lightningStylesheets="true"> <head> <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/> <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/> force-app/main/default/pages/Xin_SearchVisitorPlace.page
@@ -1,4 +1,4 @@ <apex:page controller="Xin_SearchVisitorPlace" action="{!search}" contentType="plain/text"> <apex:page controller="Xin_SearchVisitorPlace" action="{!search}" contentType="plain/text" lightningStylesheets="true"> <apex:outputPanel layout="none" rendered="{!IsOverLimit}"> <span class="result_name" style="color:red;">检索结果超过了50件</span><span class="result_id" style="display:none"></span><br/> </apex:outputPanel>