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-15 13:40:51 * @LastEditTime: 2023-05-24 16:34:15 */ public with sharing class OpportunityLightingButtonController { @AuraEnabled @@ -680,6 +680,42 @@ throw new AuraHandledException(e.getMessage()); } } @AuraEnabled public static String changeTrade(String oppId){ List<Quote> quoList = [select id from Quote where OpportunityId = :oppId]; List<OpportunityLineItem> oppLI = [select id from OpportunityLineItem where Opportunity.id = :oppId]; Opportunity opp = new Opportunity(); opp.id = oppId; opp.Estimation_Decision__c = false; opp.Estimation_Id__c = null; opp.Quote_Update_Sum__c = null; opp.Estimation_No__c = null; opp.Estimation_Proposal_Date__c = null; opp.Estimation_Name__c = null; // LHJ SWAG-C9QAAJ 去掉 Start // opp.Authorized_Finish_Sales__c = null; // opp.Authorized_DB_No__c = null; // opp.Authorized_Date__c = null; // opp.Autholization_Activated_Date__c = null; // opp.Bidding_Content__c = null; // opp.Bid_Date__c = null; // opp.Bidding_No__c = null; // opp.Bidding_Project_Name__c = null; // LHJ End Savepoint sp = Database.setSavepoint(); try { delete quoList; delete oppLI; update opp; return '1'; } catch (Exception ex) { Database.rollback(sp); return ex.getMessage() + ' | Line:' + ex.getLineNumber(); } } public class InitData{ @AuraEnabled public Boolean directLossFLG; force-app/main/default/classes/OpportunityWebService.cls
@@ -1,6 +1,5 @@ global class OpportunityWebService { @AuraEnabled WebService static String changeTrade(String oppId){ List<Quote> quoList = [select id from Quote where OpportunityId = :oppId]; @@ -43,7 +42,7 @@ public OpportunityWebService() { this.parameter = 'value'; } @AuraEnabled WebService static String oppCheck(String oppid, String saveFlg) { Map<Id, String> proMap= new Map<Id, String>(); @@ -68,7 +67,7 @@ } return strRet; } @AuraEnabled // LHJ 阿西赛多检查 Start WebService static String checkDangerItem(String agency1) { //没有危化品证照的提示信息 @@ -392,7 +391,6 @@ } } @AuraEnabled WebService static String updReg(String oppid) { List<OpportunityLineItem> updList = new List<OpportunityLineItem>(); @@ -420,6 +418,7 @@ //SWAG-CG88AG【委托】提出价格申请是在协议有效期内,允许WIN fy end //贸易合规 20230307 you start //营业拦截提醒 WebService static Boolean accSendEmail(String AccDealerBlacklist,String accname,String angency1,String angency2,String ownerids,String ddid,String oppid) { //发送邮件 List<Messaging.SingleEmailMessage> sendMails = new List<Messaging.SingleEmailMessage>(); @@ -437,7 +436,6 @@ for (User u : UsrList){ MailsList.add(u.email); } MailsList.add('youchang@prec-tech.com'); system.debug('111===:'+MailsList); if (MailsList!=null&&MailsList.size()>0){ String title = ''; @@ -459,7 +457,7 @@ }else if(AccDealerBlacklist=='1'){ body += '黑名单的客户为:' + accname+ '<br/>'; }else if(AccDealerBlacklist=='2'){ body += '黑名单的经销商1为:' + angency2+ '<br/>'; body += '黑名单的经销商1为:' + angency1+ '<br/>'; }else if(AccDealerBlacklist=='3'){ body += '黑名单的经销商2为:' + angency2+ '<br/>'; } @@ -501,6 +499,86 @@ } return rs; } //服务拦截提醒 //【新建询价】检查点仅通知合同组 sendalert=Main_Con //【报价Decide】检查点邮件通知人员:合同组、FSE领导、服务助理(标签) sendalert=decide_con WebService static Boolean accSendEmailFW(String AccDealerBlacklist,String accname,String angency,String mcid,String sendalert,String[] FSEStr) { //发送邮件 List<Messaging.SingleEmailMessage> sendMails = new List<Messaging.SingleEmailMessage>(); List<String> MailsList = new List<String>(); List<String> userIdList = new List<String>(); //合同组 List<GroupMember> groupmemberList = [SELECT GroupId,Id,UserOrGroupId FROM GroupMember where Group.DeveloperName = 'TradeComplianceGroup']; Set<String> GroupMap = new Set<String>(); List<GroupMember> gmInsertList = new List<GroupMember>(); if(groupmemberList != null && groupmemberList.size()>0){ for (GroupMember gm : groupmemberList) { GroupMap.add(gm.UserOrGroupId); } } //询价所有人,产品担当,发邮件 List<User> UsrList = [SELECT email FROM user WHERE id in :GroupMap or id in :FSEStr]; //获取各个用户的email for (User u : UsrList){ MailsList.add(u.email); } ////decide 进来服务助理 6个人 //if(sendalert=='decide_con'){ // String toEmailAddress = System.Label.TradeComplianceStatusSendEmailFW; // String[] toAddresses = toEmailAddress.split(','); // for(String toa:toAddresses){ // MailsList.add(toa); // } //} //MailsList.add('youchang@prec-tech.com'); system.debug('111===:'+MailsList); if (MailsList!=null&&MailsList.size()>0){ String title = ''; String body = ''; title = '医院/经销商涉及黑名单'; String accname1 = accname==null ? '' :accname; String angency1 = angency==null ? '' :angency; if(AccDealerBlacklist=='1' || AccDealerBlacklist=='intercept'){ body += '黑名单的客户为:' + accname1 + '<br/>'; body += '黑名单的经销商为:' + angency1 + '<br/>'; } body += '<a href="' + System.Label.Environment_Url + mcid + '">' + System.Label.Environment_Url+ mcid +'</a><br/>'; body += '谢谢!'; Messaging.SingleEmailMessage messageNEW = new Messaging.SingleEmailMessage(); messageNEW.setSubject(title); messageNEW.setHtmlBody(body); messageNEW.setCharset('UTF-8'); messageNEW.setToAddresses(MailsList); sendMails.add(messageNEW); } boolean rs = true; if (sendMails.size() > 0) { Messaging.Email[] allMails = new Messaging.Email[]{}; for(Integer j = 0; j < sendMails.size(); j++) { allMails.add(sendMails.get(j)); } system.debug('222===:'+allMails); Messaging.SendEmailResult[] results = Messaging.sendEmail(allMails); System.debug('results 结果 :'+results); for (Integer i = 0; i < results.size(); i++) { if (results[i].success == false) { system.debug('=====send mail error:' + results[i].errors[0].message); rs = false; } } } return rs; } //贸易合规 20230307 you end } force-app/main/default/classes/lexPCLLostReportLwcController.cls
@@ -1,46 +1,144 @@ public with sharing class lexPCLLostReportLwcController { @AuraEnabled public static Product2 pro2 { get; set; } @AuraEnabled public static string oppId { get; set; } @AuraEnabled public static string lostReportId { get; set; } // 当前页面状态 Create,View and Edit, MarketEdit @AuraEnabled public static string pageStatus { get; set; } // 失单,部分失单 @AuraEnabled public static string lostType {get; set;} public static Set<ID> deleteBrandIDSet = new Set<ID>(); @AuraEnabled public static string submitFlag {get; set;} @AuraEnabled public static LostReport LostReport {get; set;} @AuraEnabled public static integer brandNo {get; set;} @AuraEnabled public static integer RemoveBrandNo {get; set;} @AuraEnabled public static integer setBrandNo {get; set;} @AuraEnabled public static integer brandCount {get; set;} // add tcm 20211122 start @AuraEnabled public static integer topNum {get; set;} @AuraEnabled public static integer secondNum {get; set;} // add tcm 20211122 end // 初始化 @AuraEnabled public static void initForApex(string oppId1,string lostReportId1,string pageStatus1,string lostType1,string submitFlag1){ oppId = oppId1; lostReportId = lostReportId; pageStatus = pageStatus1; lostType = lostType1; submitFlag = submitFlag1; public static LostReport getLostReport(){ try { return LostReport; } catch (Exception e) { throw new AuraHandledException(e.getMessage()); } } @AuraEnabled( cacheable = true ) public static List< Account > getAccounts() { return [ SELECT Id, Name, Industry FROM Account LIMIT 10 ]; } @AuraEnabled( cacheable = true ) public static void saveAccounts(List<Account> accList){ Insert accList; /*if(accList.size()>0 && accList != null){ insert accList; }*/ } @AuraEnabled public static Map<string,object> init(){ public static String getPickList(String objectName, String fieldName) { List<Map<String, String>> lstPickvals = new List<Map<String, String>>(); List<Schema.DescribeSobjectResult> results = Schema.describeSObjects(new List<String>{objectName}); for(Schema.DescribeSobjectResult res : results) { for (Schema.PicklistEntry entry : res.fields.getMap().get(fieldName).getDescribe().getPicklistValues()) { if (entry.isActive()) { lstPickvals.add(new Map<String, String>{'label' => entry.getValue(), 'value' => entry.getValue()}); } } } Map<string,List<Map<String, String>>> pickList = new Map<string,List<Map<String, String>>>(); List<Map<String, String>> zhuji = new List<Map<String, String>>(); List<Map<String, String>> jingzi = new List<Map<String, String>>(); List<Map<String, String>> xiaojingzhong = new List<Map<String, String>>(); List<Map<String, String>> nengliang = new List<Map<String, String>>(); List<Map<String, String>> qita = new List<Map<String, String>>(); Map<String, String> empty = new Map<String, String>{'label' => '--无--', 'value' => ''}; zhuji.add(empty); jingzi.add(empty); xiaojingzhong.add(empty); nengliang.add(empty); qita.add(empty); for (Integer i = 0; i < lstPickvals.size(); i++) { if ((i >= 0 && i <= 6) || i == 36) { zhuji.add(lstPickvals[i]); } if ((i >= 7 && i <= 23) || i == 36) { jingzi.add(lstPickvals[i]); } if ((i >= 24 && i <= 29) || i == 35) { xiaojingzhong.add(lstPickvals[i]); } if ((i >= 30 && i <= 34) || i == 36) { nengliang.add(lstPickvals[i]); } if (i == 36) { qita.add(lstPickvals[i]); } } pickList.put('主机', zhuji); pickList.put('镜子', jingzi); pickList.put('小镜种', xiaojingzhong); pickList.put('能量', nengliang); pickList.put('其他', qita); return JSON.serialize(pickList); } @AuraEnabled public static String getPickListByFilter(String objectName,String fieldName,String controlFieldName,String controlFieldValue){ try { Schema.DescribeFieldResult fieldDescribe = Schema.getGlobalDescribe().get(objectName).getDescribe().fields.getMap().get(fieldName).getDescribe(); // 如果该字段为选项列表类型,则获取选项列表 List<Schema.PicklistEntry> picklistValues = fieldDescribe.getPicklistValues(); // 根据控制字段的值筛选出对应的选项 List<Map<String, Object>> lstPickvals = new List<Map<String, Object>>(); for (Schema.PicklistEntry entry : picklistValues) { if (entry.isActive() && entry.getValue().startsWith(controlFieldValue)) { lstPickvals.add(new Map<String, Object>{'label' => entry.getValue(), 'value' => entry.getValue()}); } } String jsonStr = JSON.serialize(lstPickvals); return jsonStr; } catch (Exception e) { throw new AuraHandledException(e.getMessage()); } } @AuraEnabled public static Map<string,object> init (string oppId1,string lostReportId1,string pageStatus1,string lostType1,string submitFlag1){ try { oppId = oppId1; lostReportId = lostReportId1; pageStatus = pageStatus1; lostType = lostType1; submitFlag = submitFlag1; return init1(); } catch (Exception e) { throw new AuraHandledException(e.getMessage()); } } // 初始化 public static Map<string,object> init1(){ Map<string,object> maps = new Map<string,object>(); if(string.isblank(pageStatus)) { // 这里需要报错没有传参数 @@ -95,6 +193,7 @@ Lost_Reason_Sub__c,Lost_By_Company__c, LostTotalAmount__c,LostType__c, Report_Status__c,Sales_assistant__c, InclusionUltrasound__c, //20230506 lt DB202304618804 包含超声 Opportunity__c, Opportunity__r.Sales_assistant_ID__c, Opportunity__r.Sales_manager_departmentID__c, Manager_sales__c,recordtypeid,recordtype.DeveloperName @@ -183,8 +282,13 @@ return maps; } return null; // List<Map<String,String>> col = new List<Map<String,String>>(); // Map<String,String> ele = new Map<String,String>(); // LostReport.LostBrands[0].columns.add(); maps.put('LostReport', LostReport); return maps; } //写到js // 编辑 只有系统管理员或者草案中可以编辑 @AuraEnabled public static String edit2(){ @@ -192,7 +296,7 @@ '草案'.equals(LostReport.LostReport.Report_Status__c) ) { pageStatus = 'Edit'; init(); init1(); } else{ return '只有在草案中才能进行编辑!'; @@ -248,20 +352,20 @@ } } // 保存 @AuraEnabled public static String save(){ if(!DataCheck()) { return null; } if(!dataEntry()) { return null; } brandCount = LostReport.LostBrands.size(); pageStatus = 'View'; return '保存成功!'; } // @AuraEnabled // public static String save(LostReport report){ // try { // if(!dataEntry(report)) { // return null; // } // // brandCount = LostReport.LostBrands.size(); // pageStatus = 'View'; // return '保存成功!'; // } catch (Exception e) { // return e.getMessage(); // } // } //读取并构建竞争对手品牌 // public void BrandmapSet(){ // CompetitionMap = new map<string, id>(); @@ -274,7 +378,8 @@ // } // 数据检查 @AuraEnabled public static boolean DataCheck(){ public static boolean DataCheck(LostReport report){ LostReport = report; boolean dataCheck = true; if(string.isBlank(LostReport.LostReport.LostType__c)) { @@ -349,6 +454,7 @@ } // 当失单品牌名为其他时,报错字段为失单对手型号(手动) thh 2022-01-17 end } return dataCheck; } @@ -375,10 +481,9 @@ String jsonStr = JSON.serialize(lstPickvals); return jsonStr; } @AuraEnabled public static list<LostBrand> brandcopy(){ public static list<LostBrand> brandcopy(LostReport report){ list<LostBrand> tempbrands = new list<LostBrand>(); for(LostBrand tempbrand: LostReport.LostBrands) { for(LostBrand tempbrand: report.LostBrands) { LostBrand LostBrand = new LostBrand(tempbrand.lineNo,tempbrand.LostProducts ); LostBrand.lostBrand = tempbrand.lostBrand.clone(); @@ -389,46 +494,47 @@ } // 数据录入 @AuraEnabled public static boolean dataEntry(){ public static Map<String,String> dataEntry(String report1){ LostReport report = (LostReport)JSON.deserialize(report1, LostReport.class); Map<String,String> messageMap = new Map <String,String>(); system.debug('save---start:'); Savepoint sp = Database.setSavepoint(); Lost_cancel_report__c templostReport = LostReport.lostReport.clone(); templostReport.id = LostReport.lostReport.id; list<LostBrand> tempBrands = brandcopy(); try{ // 待完成,这里需要把第一个品牌的信息赋值到这个失单报告上去,还有需要把各个品牌金额汇总加起来; //system.debug('LostReport.LostBrands:'+LostReport.LostBrands); // 设置记录类型 LostReport.lostReport.recordTypeID = LostReport.lostReport.LostType__c== '失单'?Schema.SObjectType.Lost_cancel_report__c.getRecordTypeInfosByDeveloperName().get('PCL_Lost_report').getRecordTypeId() : Schema.SObjectType.Lost_cancel_report__c.getRecordTypeInfosByDeveloperName().get('PCL_PartLost_report').getRecordTypeId(); LostReport.lostReport.LostTotalAmount__c = 0; LostReport.lostReport.of_lost_system_processor__c = 0; LostReport.lostReport.Lost_reason_main__c = null; LostReport.lostReport.Lost_Reason_Sub__c = null; LostReport.lostReport.Lost_By_Company__c = null; for(LostBrand tempLostBrand : LostReport.LostBrands) { report.lostReport.recordTypeID = report.lostReport.LostType__c== '失单'?Schema.SObjectType.Lost_cancel_report__c.getRecordTypeInfosByDeveloperName().get('PCL_Lost_report').getRecordTypeId() : Schema.SObjectType.Lost_cancel_report__c.getRecordTypeInfosByDeveloperName().get('PCL_PartLost_report').getRecordTypeId(); report.lostReport.LostTotalAmount__c = 0; report.lostReport.of_lost_system_processor__c = 0; report.lostReport.Lost_reason_main__c = null; report.lostReport.Lost_Reason_Sub__c = null; report.lostReport.Lost_By_Company__c = null; for(LostBrand tempLostBrand : report.LostBrands) { if(string.isNotBlank(tempLostBrand.lostBrand.Lost_By_Company__c)) { LostReport.lostReport.LostTotalAmount__c += tempLostBrand.lostBrand.LostPrice__c; LostReport.lostReport.Lost_reason_main__c = LostReport.lostReport.Lost_reason_main__c == null report.lostReport.LostTotalAmount__c += tempLostBrand.lostBrand.LostPrice__c; report.lostReport.Lost_reason_main__c = report.lostReport.Lost_reason_main__c == null ? tempLostBrand.lostBrand.Lost_reason_main__c : LostReport.lostReport.Lost_reason_main__c; LostReport.lostReport.Lost_Reason_Sub__c = LostReport.lostReport.Lost_Reason_Sub__c == null : report.lostReport.Lost_reason_main__c; report.lostReport.Lost_Reason_Sub__c = report.lostReport.Lost_Reason_Sub__c == null ? tempLostBrand.lostBrand.Lost_Reason_Sub__c : LostReport.lostReport.Lost_Reason_Sub__c; LostReport.lostReport.Lost_By_Company__c = LostReport.lostReport.Lost_By_Company__c == null : report.lostReport.Lost_Reason_Sub__c; report.lostReport.Lost_By_Company__c = report.lostReport.Lost_By_Company__c == null ? tempLostBrand.lostBrand.Lost_By_Company__c : LostReport.lostReport.Lost_By_Company__c; : report.lostReport.Lost_By_Company__c; for( PCLLostProducts tempLostProduct : tempLostBrand.LostProducts) { if(tempLostProduct.LostProductss.Quantity__c !=null && tempLostProduct.LostProductss.Quantity__c >0) { LostReport.lostReport.of_lost_system_processor__c += tempLostProduct.LostProductss.Quantity__c; report.lostReport.of_lost_system_processor__c += tempLostProduct.LostProductss.Quantity__c; } } } } upsert LostReport.lostReport; upsert report.lostReport; String reportId = report.lostReport.Id; messageMap.put('reportId', reportId); // 需要插入更新的失单品牌 map<integer,PCLLostBrand__c> upsertLostBrandMap = new map<integer,PCLLostBrand__c>(); // 需要删掉的失单品牌 @@ -437,12 +543,12 @@ map<string,PCLLostProduct__c> upsertLostProductMap = new map<string,PCLLostProduct__c>(); // 需要删掉的失单品牌 list<PCLLostProduct__c> deleteLostProductList = new list<PCLLostProduct__c>(); for(LostBrand tempLostBrand : LostReport.LostBrands ) { for(LostBrand tempLostBrand : report.LostBrands ) { // 如果有失单品牌,那么就要插入更新; system.debug('tempLostBrand.lostBrand.Lost_By_Company__c:'+tempLostBrand.lostBrand.Lost_By_Company__c); if(string.isNotBlank(tempLostBrand.lostBrand.Lost_By_Company__c)) { upsertLostBrandMap.put(tempLostBrand.lineNo,tempLostBrand.lostBrand); tempLostBrand.lostBrand.Lost_cancel_report__c = LostReport.lostReport.id; tempLostBrand.lostBrand.Lost_cancel_report__c = report.lostReport.id; tempLostBrand.lostBrand.Name = tempLostBrand.lostBrand.Lost_By_Company__c; integer tempNo = 0; for( PCLLostProducts tempLostProduct : tempLostBrand.LostProducts) { @@ -492,11 +598,11 @@ } for(integer brandNumber =0; brandNumber< LostReport.LostBrands.size(); brandNumber++) { for(integer brandNumber =0; brandNumber< report.LostBrands.size(); brandNumber++) { LostBrand tempLostBrand = LostReport.LostBrands.get(brandNumber); LostBrand tempLostBrand = report.LostBrands.get(brandNumber); if(tempLostBrand.lostBrand.Id == null) { LostReport.LostBrands.remove(brandNumber); report.LostBrands.remove(brandNumber); brandNumber--; continue; } @@ -509,38 +615,38 @@ } } } lostReportId = LostReport.lostReport.id; // lostReportId = report.lostReport.id; system.debug('save---end:'); }catch (Exception ex) { Database.rollback(sp); LostReport.lostReport = templostReport; LostReport.LostBrands = tempBrands; // 这里需要写一些报错信息 ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error,ex.getMessage())); return false; messageMap.put('error', ex.getMessage()); return messageMap; } return true; return messageMap; } // 提交 @AuraEnabled public static Map<string,Object> submit(){ public static Map<string,Object> submit(String report1,String reportId){ LostReport report = (LostReport)JSON.deserialize(report1, LostReport.class); Map<string,string> messages = new Map<string,string>(); if(!'草案'.equals(LostReport.LostReport.Report_Status__c) ) { if(!'草案'.equals(report.lostReport.Report_Status__c) ) { messages.put('error', '只有在草案中才能提交申请!'); return messages; } Map<string,Object> objs = new Map<string,Object>(); Savepoint sp = Database.setSavepoint(); try{ LostReport.lostReport.Report_Status__c = '提交'; update LostReport.lostReport; report.lostReport.Id = reportId; report.lostReport.Report_Status__c = '提交'; update report.lostReport; Approval.ProcessSubmitRequest psr = new Approval.ProcessSubmitRequest(); psr.setObjectId(lostReportId); psr.setObjectId(reportId); Approval.ProcessResult submitResult = Approval.process(psr); objs.put('uri', '/apex/PCLLostReportPage'); objs.put('Id', lostReportId); objs.put('Id', reportId); objs.put('pageStatus', 'View'); objs.put('submitFlag', '1'); return objs; @@ -550,13 +656,19 @@ return messages; } } // 添加品牌 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++ @AuraEnabled public static String addBrand(){ LostReport.LostBrands.add(new LostBrand(LostReport.LostBrands.size())); brandCount = LostReport.LostBrands.size(); return null; public static LostBrand getNewLostBrand(Integer lineNo){ LostBrand lostBrand = null; try { //report.LostBrands.add(new LostBrand(report.LostBrands.size())); lostBrand = new LostBrand(lineNo); } catch (Exception e) { System.debug(e.getMessage()); } return lostBrand; } // 删除品牌 这个有参数brandNo,才知道是删除那个品牌 @AuraEnabled public static String Remove(){ @@ -593,6 +705,15 @@ tempLostBrand.ProductSize = tempLostBrand.LostProducts.size(); return null; } @AuraEnabled public static PCLLostProducts getLostProduct(){ try { PCLLostProduct__c plp = new PCLLostProduct__c(); return new PCLLostProducts(0,plp); } catch (Exception e) { throw new AuraHandledException(e.getMessage()); } } // update tcm 20211125 添加型号时自动带出品牌 end // 页面的数据结构 public class LostReport { @@ -616,13 +737,13 @@ public class LostBrand { @AuraEnabled public PCLLostBrand__c lostBrand { get; set; } public PCLLostBrand__c lostBrand; @AuraEnabled public Integer lineNo { get; set; } public Integer lineNo; @AuraEnabled public list<PCLLostProducts> LostProducts { get; set; } public list<PCLLostProducts> LostProducts; @AuraEnabled public Integer ProductSize {get; set;} public Integer ProductSize; public LostBrand( integer lineNo ){ lostBrand = new PCLLostBrand__c(); this.lineNo = lineNo; @@ -646,12 +767,13 @@ // add tcm 20211119 start public class PCLLostProducts { @AuraEnabled public Integer lineNo2 { get; set; } public Integer lineNo2; @AuraEnabled public PCLLostProduct__c LostProductss { get; set; } public PCLLostProduct__c LostProductss; @AuraEnabled public Boolean bool { get; set; } public Boolean bool; @AuraEnabled public List<Map<String, String>> productOptions = new List<Map<String, String>>(); public PCLLostProducts() { this.lineNo2 = 0; this.LostProductss=new PCLLostProduct__c(); @@ -694,4 +816,19 @@ } } // add tcm 20211118 end @AuraEnabled public static List<Product2> searchProduct(){ try { List<Product2> products = [ select Id,name from Product2 where Brand_Name__c = 'STORZ' limit 10 ]; return products; } catch (Exception e) { throw new AuraHandledException(e.getMessage()); } } } force-app/main/default/lwc/lexBeforeOPDPDFBtnSIS/lexBeforeOPDPDFBtnSIS.html
@@ -4,11 +4,12 @@ * @Author: chen jing wu * @Date: 2023-04-13 15:55:45 * @LastEditors: chen jing wu * @LastEditTime: 2023-04-13 15:56:58 * @LastEditTime: 2023-05-24 16:39:05 --> <template> <div class="lexBeforeOPDPDFBtnSISHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> <lightning-button label="Show Toast" onclick={showSuccess}></lightning-button> <lightning-button onclick={handleConfirmClick} label="Open Confirm Modal"></lightning-button> </div> </template> force-app/main/default/lwc/lexBeforeOPDPDFBtnSIS/lexBeforeOPDPDFBtnSIS.js
@@ -4,7 +4,7 @@ * @Author: chen jing wu * @Date: 2023-04-13 15:55:45 * @LastEditors: chen jing wu * @LastEditTime: 2023-04-13 16:04:14 * @LastEditTime: 2023-05-24 16:37:05 */ import { api, wire,LightningElement } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; @@ -13,7 +13,7 @@ import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import selectCommonSequence from '@salesforce/apex/ControllerUtil.selectCommonSequence'; import addReportOPWithEvaluationPDF from '@salesforce/apex/Add_Report.addReportOPWithEvaluationPDF'; import LightningConfirm from 'lightning/confirm'; export default class LexBeforeOPDPDFBtnSIS extends LightningElement { @api recordId; accountId; @@ -34,6 +34,55 @@ } } } async handleConfirmClick(msg) { const result = await LightningConfirm.open({ message: msg, variant: 'headerless', label: 'this is the aria-label value', }); console.log(result); if(result){ try { selectCommonSequence({ valueField: 'EvaluationPDF_NextValue__c', formatField: 'EvaluationPDF_Format__c' }).then(result=>{ var pdfno = result; addReportOPWithEvaluationPDF({ "repOwnerId": this.userId, "reportId": "", "dailyReportId": "", "eventId": "", "recordType": "SIS", "aId": this.accountId, "visitor1": "", "visitor2": "", "visitor3": "", "visitor4": "", "visitor5": "", "opp1": this.recordId, "opp2": "", "opp3": "", "opp4": "", "opp5": "", "reportDate": "", "evaluationPDFNumber": pdfno }).then(()=>{ // 20220913 ljh WLIG-CHMATN update end this.IsLoading = false; window.open('/apex/BeforeOPDPDF?oid=' + this.recordId + '&pdfNo=' + pdfno, 'BeforeOPDPDF'); this.dispatchEvent(new CloseActionScreenEvent()); }) }); } catch(e) { this.showToast(e,"error"); this.dispatchEvent(new CloseActionScreenEvent()); } }else{ window.open('/apex/BeforeOPDPDF?oid=' + this.recordId, 'BeforeOPDPDF'); this.dispatchEvent(new CloseActionScreenEvent()); } } connectedCallback(){ init({ recordId: this.recordId @@ -44,47 +93,7 @@ }) } beforeOPDPDFBtn(){ if (window.confirm('是否新建SIS报告书?')) { try { selectCommonSequence({ valueField: 'EvaluationPDF_NextValue__c', formatField: 'EvaluationPDF_Format__c' }).then(result=>{ var pdfno = result; addReportOPWithEvaluationPDF({ "repOwnerId": this.userId, "reportId": "", "dailyReportId": "", "eventId": "", "recordType": "SIS", "aId": this.accountId, "visitor1": "", "visitor2": "", "visitor3": "", "visitor4": "", "visitor5": "", "opp1": this.recordId, "opp2": "", "opp3": "", "opp4": "", "opp5": "", "reportDate": "", "evaluationPDFNumber": pdfno }).then(()=>{ // 20220913 ljh WLIG-CHMATN update end this.IsLoading = false; window.open('/apex/BeforeOPDPDF?oid=' + this.recordId + '&pdfNo=' + pdfno, 'BeforeOPDPDF'); this.dispatchEvent(new CloseActionScreenEvent()); }) }); } catch(e) { this.showToast(e,"error"); this.dispatchEvent(new CloseActionScreenEvent()); } } else { window.open('/apex/BeforeOPDPDF?oid=' + this.recordId, 'BeforeOPDPDF'); this.dispatchEvent(new CloseActionScreenEvent()); } this.handleConfirmClick('是否新建SIS报告书?'); } showToast(msg,type) { const event = new ShowToastEvent({ force-app/main/default/lwc/lexChangeContractType/lexChangeContractType.html
@@ -2,5 +2,6 @@ <div class="lexChangeContractTypeHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button> <lightning-button onclick={handleConfirmClick} label="Open Confirm Modal"></lightning-button> </div> </template> force-app/main/default/lwc/lexChangeContractType/lexChangeContractType.js
@@ -4,7 +4,15 @@ * @Author: chen jing wu * @Date: 2023-05-15 13:17:26 * @LastEditors: chen jing wu * @LastEditTime: 2023-05-15 15:01:19 * @LastEditTime: 2023-05-24 16:44:21 */ /* * @Description: * @version: * @Author: chen jing wu * @Date: 2023-05-15 13:17:26 * @LastEditors: chen jing wu * @LastEditTime: 2023-05-24 16:34:40 */ import { api, wire,LightningElement } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; @@ -12,8 +20,8 @@ import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import { updateRecord } from 'lightning/uiRecordApi'; import init from '@salesforce/apex/OpportunityLightingButtonController.initForChangeContractTypeButton'; import changeTrade from '@salesforce/apex/OpportunityWebService.changeTrade'; import changeTrade from '@salesforce/apex/OpportunityLightingButtonController.changeTrade'; import LightningConfirm from 'lightning/confirm'; export default class LexChangeContractType extends LightningElement { @api recordId; stageName; @@ -34,6 +42,37 @@ console.log(str); this.recordId = str; } } } async handleConfirmClick(msg) { const result = await LightningConfirm.open({ message: msg, variant: 'headerless', label: 'this is the aria-label value', }); console.log(result); if(result){ try { changeTrade({ oppId: oppId }).then(result=>{ str = result; if(str != '1'){ this.showToast(str,"error"); } this.IsLoading = false; this.dispatchEvent(new CloseActionScreenEvent()); window.location.href = 'https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Opportunity/' + this.recordId + '/view'; }).catch(error=>{ console.log("error"); console.log(error); }); } catch(e) { console.log(e); } }else{ this.dispatchEvent(new CloseActionScreenEvent()); return; } } connectedCallback(){ @@ -78,25 +117,7 @@ this.dispatchEvent(new CloseActionScreenEvent()); return; } if(confirm('变更合同类型会删除全部报价,是否继续?')){ changeTrade({ oppId: oppId }).then(result=>{ str = result; if(str != '1'){ this.showToast(str,"error"); } this.IsLoading = false; this.dispatchEvent(new CloseActionScreenEvent()); window.location.href = 'https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Opportunity/' + this.recordId + '/view'; }).catch(error=>{ console.log("error"); console.log(error); }); }else{ this.dispatchEvent(new CloseActionScreenEvent()); return; } this.handleConfirmClick('变更合同类型会删除全部报价,是否继续?'); } showToast(msg,type) { force-app/main/default/lwc/lexDynamicTable/lexDynamicTable.html
@@ -4,7 +4,7 @@ * @Author: chen jing wu * @Date: 2023-04-27 11:23:11 * @LastEditors: chen jing wu * @LastEditTime: 2023-05-08 11:29:27 * @LastEditTime: 2023-05-19 10:12:18 --> <template> <lightning-card> @@ -23,9 +23,9 @@ <tr class="inputRows" key={row.uuid}> <template for:each={columns} for:item="column"> <td key={column.apiName}> <c-lex-input-pick-list-cell class="fields" field-type={column.fieldType} record={row} field={column.apiName} object-name={column.objectName} value={column.value} read-only={column.readOnly} required={column.required}></c-lex-input-pick-list-cell> <c-lex-input-table-cell class="fields" field-type={column.fieldType} record={row} field={column.apiName} required={column.required}></c-lex-input-table-cell> <c-lex-input-lookup-cell class="fields" field-type={column.fieldType} field-name={column.apiName} record={row} api-name={column.objectName} disable={column.disable} required={column.required}></c-lex-input-lookup-cell> <c-lex-input-pick-list-cell class="fields" field-type={column.fieldType} record={row} field={column.apiName} object-name={column.objectName} value={column.value} read-only={column.readOnly} required={column.required} query={column.query}></c-lex-input-pick-list-cell> <c-lex-input-table-cell class="fields" field-type={column.fieldType} record={row} field={column.apiName} required={column.required} query={column.query} value={column.value}></c-lex-input-table-cell> <c-lex-input-lookup-cell class="fields" field-type={column.fieldType} field-name={column.apiName} record={row} api-name={column.objectName} disable={column.disable} required={column.required} query={column.query} value={column.value}></c-lex-input-lookup-cell> </td> </template> <td> force-app/main/default/lwc/lexDynamicTable/lexDynamicTable.js
@@ -4,7 +4,7 @@ * @Author: chen jing wu * @Date: 2023-04-27 11:23:11 * @LastEditors: chen jing wu * @LastEditTime: 2023-05-15 15:37:57 * @LastEditTime: 2023-05-18 13:41:30 */ import { LightningElement, track, api,wire } from 'lwc'; export default class LexDynamicTable extends LightningElement { force-app/main/default/lwc/lexInputLookupCell/lexInputLookupCell.html
@@ -4,7 +4,7 @@ * @Author: chen jing wu * @Date: 2023-04-27 11:38:36 * @LastEditors: chen jing wu * @LastEditTime: 2023-05-08 10:13:58 * @LastEditTime: 2023-05-18 16:37:50 --> <template> <template if:true={isLookup}> @@ -12,12 +12,6 @@ object-api-name={apiName} record-id='' > <!-- <template if:true={isDisable}> <lightning-input-field field-name={fieldName} onclick={handleinputChange} variant="label-hidden" disabled="true"> </lightning-input-field> </template> <template if:false={isDisable}> <lightning-input-field field-name={fieldName} onclick={handleinputChange} variant="label-hidden"> </lightning-input-field> </template> --> <template if:true={isRequired}> <lightning-input-field field-name={fieldName} onclick={handleinputChange} variant="label-hidden" disabled={isDisable} required> </lightning-input-field> </template> force-app/main/default/lwc/lexLoseBid/lexLoseBid.html
@@ -2,5 +2,6 @@ <div class="lexLoseBidHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button> <lightning-button onclick={handleConfirmClick} label="Open Confirm Modal"></lightning-button> </div> </template> force-app/main/default/lwc/lexLoseBid/lexLoseBid.js
@@ -4,7 +4,7 @@ * @Author: chen jing wu * @Date: 2023-05-08 14:36:33 * @LastEditors: chen jing wu * @LastEditTime: 2023-05-11 14:48:31 * @LastEditTime: 2023-05-24 16:24:28 */ import { api, wire,LightningElement } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; @@ -14,6 +14,7 @@ import init from '@salesforce/apex/OpportunityLightingButtonController.initForLoseBidButton'; import updateForLoseBidButton from '@salesforce/apex/OpportunityLightingButtonController.updateForLoseBidButton'; import queryForLexLoseBidButton from '@salesforce/apex/OpportunityLightingButtonController.queryForLoseBidButton'; import LightningConfirm from 'lightning/confirm'; export default class LexLoseBid extends LightningElement { @api recordId; ifOpenBid; @@ -31,6 +32,34 @@ console.log(str); this.recordId = str; } } } async handleConfirmClick(msg) { const result = await LightningConfirm.open({ message: msg, variant: 'headerless', label: 'this is the aria-label value', }); console.log(result); if(result){ try { updateForLoseBidButton({ recordId: this.recordId }).then(result=>{ if (result) { this.showToast(result,"error"); }else{ this.IsLoading = false; this.updateRecordView(this.recordId); this.showToast("操作成功!","success"); this.dispatchEvent(new CloseActionScreenEvent()); } }) } catch(e) { console.log(e); } }else{ this.dispatchEvent(new CloseActionScreenEvent()); } } connectedCallback(){ @@ -66,19 +95,7 @@ if(flag){ this.showToast("条件不符合,不可操作","error"); }else{ if (window.confirm('是否确认竞争对手中标?')) { updateForLoseBidButton({ recordId: this.recordId }).then(result=>{ if (result) { this.showToast(result,"error"); }else{ this.IsLoading = false; this.updateRecordView(this.recordId); this.showToast("操作成功!","success"); } }) } this.handleConfirmClick('是否确认竞争对手中标?'); } }); } force-app/main/default/lwc/lexOCSMNoToReportForReport/lexOCSMNoToReportForReport.html
@@ -2,5 +2,6 @@ <div class="reportHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button> <lightning-button onclick={handleConfirmClick} label="Open Confirm Modal"></lightning-button> </div> </template> force-app/main/default/lwc/lexOCSMNoToReportForReport/lexOCSMNoToReportForReport.js
@@ -4,7 +4,7 @@ * @Author: chen jing wu * @Date: 2023-03-28 15:59:44 * @LastEditors: chen jing wu * @LastEditTime: 2023-05-15 09:15:58 * @LastEditTime: 2023-05-24 16:12:08 */ import { api, wire,LightningElement } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; @@ -13,7 +13,7 @@ import updateForOCSMNoToReportButton from '@salesforce/apex/ReportController.updateForOCSMNoToReportButton'; import { updateRecord } from 'lightning/uiRecordApi'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import insertAwareDate from '@salesforce/apex/ReportController.updateForOCSMNoToReportButton'; import LightningConfirm from 'lightning/confirm'; export default class LexOCSMNoToReportForReport extends LightningElement { @api recordId; IsLoading = true; @@ -34,6 +34,48 @@ console.log(str); this.recordId = str; } } } async handleConfirmClick(msg) { const result = await LightningConfirm.open({ message: msg, variant: 'headerless', label: 'this is the aria-label value', }); console.log(result); if(result){ try { if(this.theOCSMAdministrativeReportNumber != undefined || this.theOCSMAdministrativeReportDate != undefined ){ this.showToast("已经报告的QIS,不可以点击OCSM不要报告。","error"); this.dispatchEvent(new CloseActionScreenEvent()); return; } this.awareDate = Date.now(); if(this.awareDate != undefined ){ updateForOCSMNoToReportButton({ recordId: this.recordId }).then(result=>{ if(result){ this.showToast(result,"error"); }else{ this.showToast("OCSM不要报告成功","success"); this.updateRecordView(this.recordId); this.IsLoading = false; } this.dispatchEvent(new CloseActionScreenEvent()); }); }else{ this.showToast("没有AwareDate或已经OCSM行政报告,请确认。","error"); this.dispatchEvent(new CloseActionScreenEvent()); return; } } catch(e) { console.log(e); } }else{ this.dispatchEvent(new CloseActionScreenEvent()); return; } } @@ -70,33 +112,6 @@ } noToReport(){ if (!confirm("不要报告后无法撤回,是否继续?")) { this.dispatchEvent(new CloseActionScreenEvent()); return; } if(this.theOCSMAdministrativeReportNumber != undefined || this.theOCSMAdministrativeReportDate != undefined ){ this.showToast("已经报告的QIS,不可以点击OCSM不要报告。","error"); this.dispatchEvent(new CloseActionScreenEvent()); return; } this.awareDate = Date.now(); if(this.awareDate != undefined ){ updateForOCSMNoToReportButton({ recordId: this.recordId }).then(result=>{ if(result){ this.showToast(result,"error"); }else{ this.showToast("OCSM不要报告成功","success"); this.updateRecordView(this.recordId); this.IsLoading = false; } this.dispatchEvent(new CloseActionScreenEvent()); }); }else{ this.showToast("没有AwareDate或已经OCSM行政报告,请确认。","error"); this.dispatchEvent(new CloseActionScreenEvent()); return; } this.handleConfirmClick("不要报告后无法撤回,是否继续?"); } } force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.html
@@ -2,5 +2,6 @@ <div class="toReportHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button> <lightning-button onclick={handleConfirmClick} label="Open Confirm Modal"></lightning-button> </div> </template> force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.js
@@ -2,9 +2,17 @@ * @Description: * @version: * @Author: chen jing wu * @Date: 2023-05-08 14:36:33 * @LastEditors: chen jing wu * @LastEditTime: 2023-05-24 16:21:07 */ /* * @Description: * @version: * @Author: chen jing wu * @Date: 2023-04-07 09:02:03 * @LastEditors: chen jing wu * @LastEditTime: 2023-05-15 09:17:27 * @LastEditTime: 2023-05-24 16:16:57 */ import { api, wire,LightningElement } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; @@ -13,6 +21,7 @@ import updateForOCSMToReportButton from '@salesforce/apex/ReportController.updateForOCSMToReportButton'; import { updateRecord } from 'lightning/uiRecordApi'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import LightningConfirm from 'lightning/confirm'; export default class LexOCSMToReport extends LightningElement { @api recordId; IsLoading = true; @@ -33,6 +42,41 @@ console.log(str); this.recordId = str; } } } async handleConfirmClick(msg) { const result = await LightningConfirm.open({ message: msg, variant: 'headerless', label: 'this is the aria-label value', }); console.log(result); if(result){ try { if(this.theOCSMAdministrativeReportStatus == undefined && this.awareDate != undefined ){ updateForOCSMToReportButton({ recordId: this.recordId }).then(result =>{ if(result){ this.showToast(result,"error"); }else{ this.showToast("成功","success"); this.updateRecordView(this.recordId); this.IsLoading = false; } this.dispatchEvent(new CloseActionScreenEvent()); }); }else{ this.showToast("没有AwareDate或已经OCSM行政报告,请确认。","error"); this.dispatchEvent(new CloseActionScreenEvent()); return; } } catch(e) { console.log(e); } }else{ this.dispatchEvent(new CloseActionScreenEvent()); return; } } @@ -70,28 +114,6 @@ } toReport () { if (!confirm("报告后无法撤回,是否继续?")) { this.dispatchEvent(new CloseActionScreenEvent()); return; } if(this.theOCSMAdministrativeReportStatus == undefined && this.awareDate != undefined ){ updateForOCSMToReportButton({ recordId: this.recordId }).then(result =>{ if(result){ this.showToast(result,"error"); }else{ this.showToast("成功","success"); this.updateRecordView(this.recordId); this.IsLoading = false; } this.dispatchEvent(new CloseActionScreenEvent()); }); }else{ this.showToast("没有AwareDate或已经OCSM行政报告,请确认。","error"); this.dispatchEvent(new CloseActionScreenEvent()); return; } this.handleConfirmClick("报告后无法撤回,是否继续?"); } } force-app/main/default/lwc/lexOLYwinBid/lexOLYwinBid.html
@@ -2,5 +2,6 @@ <div class="lexOLYwinBidHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button> <lightning-button onclick={handleConfirmClick} label="Open Confirm Modal"></lightning-button> </div> </template> force-app/main/default/lwc/lexOLYwinBid/lexOLYwinBid.js
@@ -4,7 +4,7 @@ * @Author: chen jing wu * @Date: 2023-04-13 13:15:52 * @LastEditors: chen jing wu * @LastEditTime: 2023-04-13 13:37:19 * @LastEditTime: 2023-05-24 16:28:23 */ import { api, wire,LightningElement } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; @@ -14,6 +14,7 @@ import init from '@salesforce/apex/OpportunityLightingButtonController.initForOLYwinBidButton'; import updateForOLYwinBidButton from '@salesforce/apex/OpportunityLightingButtonController.updateForOLYwinBidButton'; import queryForOLYwinBidButton from '@salesforce/apex/OpportunityLightingButtonController.queryForOLYwinBidButton'; import LightningConfirm from 'lightning/confirm'; export default class LexOLYwinBid extends LightningElement { @api recordId; ifOpenBid; @@ -31,6 +32,34 @@ console.log(str); this.recordId = str; } } } async handleConfirmClick(msg) { const result = await LightningConfirm.open({ message: msg, variant: 'headerless', label: 'this is the aria-label value', }); console.log(result); if(result){ try { updateForOLYwinBidButton({ recordId: this.recordId }).then(result=>{ if (result) { this.showToast(result,"error"); }else{ this.IsLoading = false; this.updateRecordView(this.recordId); this.showToast("操作成功!","success"); } this.dispatchEvent(new CloseActionScreenEvent()); }); } catch(e) { console.log(e); } }else{ this.dispatchEvent(new CloseActionScreenEvent()); } } connectedCallback(){ @@ -66,19 +95,7 @@ if(flag){ this.showToast("条件不符合,不可操作","error"); }else{ if (window.confirm('是否确认OLY中标?')) { updateForOLYwinBidButton({ recordId: this.recordId }).then(result=>{ if (result) { this.showToast(result,"error"); }else{ this.IsLoading = false; this.updateRecordView(this.recordId); this.showToast("操作成功!","success"); } }) } this.handleConfirmClick('是否确认OLY中标?'); } }); } force-app/main/default/lwc/lexOPDReportConsumFlowLwc/lexOPDReportConsumFlowLwc.js
@@ -4,7 +4,7 @@ * @Author: chen jing wu * @Date: 2023-05-16 13:37:44 * @LastEditors: chen jing wu * @LastEditTime: 2023-05-16 15:18:25 * @LastEditTime: 2023-05-18 10:29:30 */ import { LightningElement,api, track, wire } from 'lwc'; import {CurrentPageReference} from 'lightning/navigation'; force-app/main/default/lwc/lexOPDReportFlowLwc/lexOPDReportFlowLwc.js
@@ -1,3 +1,11 @@ /* * @Description: * @version: * @Author: chen jing wu * @Date: 2023-05-16 16:45:16 * @LastEditors: chen jing wu * @LastEditTime: 2023-05-18 09:45:28 */ import { LightningElement,api, track, wire } from 'lwc'; import {CurrentPageReference} from 'lightning/navigation'; import { CloseActionScreenEvent } from 'lightning/actions'; @@ -92,12 +100,6 @@ } closeAction() { //返回当前的备品申请 this[NavigationMixin.Navigate]({ type: 'standard__recordPage', attributes: { recordId: this.recordId, actionName: 'view' } }); window.open("/"+this.recordId,'_self'); } } force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.html
@@ -4,102 +4,260 @@ * @Author: chen jing wu * @Date: 2023-04-20 17:16:48 * @LastEditors: chen jing wu * @LastEditTime: 2023-05-16 11:41:50 * @LastEditTime: 2023-05-24 15:52:37 --> <template> <lightning-card id="my-element" 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="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.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="text-container" 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-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> <lightning-layout-item flexibility="auto" padding="around-small"> <lightning-combobox name={i} label="失单原因(主):" value="" 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="" 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="" 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="" 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 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="" 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}> <c-lex-dynamic-table name={i} column-list={brand.columns} onchange={setProductClass}> </c-lex-dynamic-table> </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-card data-id="test"> <template if:true={isEdit}> <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> </div> <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="失单品牌"> <lightning-button name={i} 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"> <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> <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' 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> </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> <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> <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> 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-16 11:43:27 * @LastEditTime: 2023-05-24 15:48:07 */ const columns2=[ { label: '--无--', value: '' }, @@ -18,6 +18,30 @@ { label: '某种产品缺失', value: '某种产品缺失' }, { label: '采购平衡', value: '采购平衡' } ]; const productClassOptions = [ { label: '--无--', value: '' }, { label: '主机', value: '主机' }, { label: '镜子', value: '镜子' }, { label: '小镜种', value: '小镜种' }, { label: '能量', value: '能量' }, { label: '其他', value: '其他' } ]; const productCategoryOptions = [ { label: '--无--', value: '' } ]; const columns3 = [ {label : "失单品牌",fieldName : "LostBrandName__c"}, {label : "失单对手型号",fieldName : "LostProduct__c"}, {label : "失单数量",fieldName : "Quantity__c",type : "number"}, {label : "失单对手型号(手动)",fieldName : "LostProductMannual__c"}, {label : "失单产品类别",fieldName : "ProductClass__c"}, {label : "失单产品区分",fieldName : "ProductCategory__c"} ]; const RecordTypeOptions = [ { label: '--无--', value: '' }, { label: '失单', value: '失单' }, { label: '部分失单', value: '部分失单' } ]; import { api, wire,track,LightningElement } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; @@ -29,44 +53,41 @@ import lexMultiSelectCombobox from 'c/lexmultiSelectCombobox'; import searchBrands from '@salesforce/apex/lexPCLLostReportLwcController.searchBrands'; import getNewLostBrand from '@salesforce/apex/lexPCLLostReportLwcController.getNewLostBrand'; import getPickList from '@salesforce/apex/lexPCLLostReportLwcController.getPickList'; import { NavigationMixin } from 'lightning/navigation'; import {CloseActionScreenEvent} from 'lightning/actions'; import submit from '@salesforce/apex/lexPCLLostReportLwcController.submit'; import {CloseActionScreenEvent} from 'lightning/actions'; export default class LexPCLLostReportPage extends NavigationMixin(LightningElement) { @track records; @api recordJson; @track columns2=columns2; @api reasonValue; @api oppId; lostReportId = ''; pageStatus = 'Create'; lostType = '失单'; submitFlag = ''; flag; @track columns2=columns2; @track pageStatus = 'Create'; @track LostReport = { LostBrands: [ ], lostReport: {} }; } @track brandOptions = []; columns=[ { "label" : "失单品牌", "apiName" : "LostBrandName__c" ,"fieldType":"picklist","objectName":"PCLLostProduct__c", "readOnly":true,"value":"--无--","required":false}, { "label" : "失单对手型号", "apiName" : "LostProduct__c" ,"fieldType":"lookup","objectName":"PCLLostProduct__c","disable":"false","searchfield":"'无'","required":false}, { "label" : "失单数量", "apiName" : "Quantity__c","fieldType":"number","objectName":"PCLLostProduct__c" ,"required":true}, { "label" : "失单对手型号(手动)", "apiName" : "LostProductMannual__c","fieldType":"text","objectName":"PCLLostProduct__c" ,"required":false}, { "label" : "失单产品类别", "apiName" : "ProductClass__c","fieldType":"picklist","objectName":"PCLLostProduct__c" ,"required":true}, { "label" : "失单产品区分", "apiName" : "ProductCategory__c","fieldType":"picklist","objectName":"PCLLostProduct__c","required":true} ]; lostType = '失单'; submitFlag = ''; flag; tableflag = 0; reportId = ''; newProduct; productOptionsList; productClassOptions = productClassOptions; productCategoryOptions = productCategoryOptions; columns3 = columns3; //失单类型 RecordTypeOptions = RecordTypeOptions; connectedCallback(){ init({ oppId1: this.oppId, lostReportId1: this.lostReportId, lostReportId1: this.reportId, pageStatus1: this.pageStatus, lostType1: this.lostType, submitFlag1: this.submitFlag }).then(result=>{ console.log(result); if(result.message != null){ if(result.message == '提交成功!'){ this.showToast(result.message,"success"); @@ -75,9 +96,11 @@ this.showToast(result.message,"error"); } }else{ this.LostReport = result.LostReport; var report = result.LostReport; this.LostReport = report; this.LostReport.lostReport.LostTotalAmount__c = 0.0; this.LostReport.LostBrands[0].columns = JSON.parse(JSON.stringify(this.columns)); this.LostReport.lostReport.InclusionUltrasound__c = '0'; this.newProduct = JSON.parse(JSON.stringify(this.LostReport.LostBrands[0].LostProducts[0])); } }).catch(error=>{ console.log("error"); @@ -93,20 +116,15 @@ console.log("error"); console.log(error); }); getPickList({ objectName: 'PCLLostProduct__c', fieldName: 'ProductCategory__c' }).then(result=>{ this.productOptionsList = JSON.parse(result); }); } get isInit(){ if(this.LostReport.LostBrands[0].columns == undefined){ return false; }else{ return true; } } //失单类型 RecordTypeOptions = [{ label: '--无--', value: '' }, { label: '失单', value: '失单' }, { label: '部分失单', value: '部分失单' }]; @wire(CurrentPageReference) getStateParameters(currentPageReference) { console.log(111); @@ -122,41 +140,32 @@ } } } getBrandLabel(index){ return "失单品牌" + (this.LostReport.LostBrands[index].lineno + 1); } getParamValue(paramName) { // Use the URLSearchParams API to get the value of a query parameter const params = new URLSearchParams(window.location.search); return params.get(paramName); } addBrandJs() { getNewLostBrand({ lineNo: this.LostReport.LostBrands.length }).then(result=>{ this.LostReport.LostBrands.push(result); this.LostReport.LostBrands[this.LostReport.LostBrands.length - 1].columns = JSON.parse(JSON.stringify(this.columns)); showToast(msg,type) { const event = new ShowToastEvent({ title: '', message: msg, variant: type }); this.dispatchEvent(event); } submitJS() { submit().then(result=>{ if(result.get('error')){ this.showToast(result.get('error'),"error"); }else{ this[NavigationMixin.Navigate]({ type: 'standard__recordPage', attributes: { uri: result.get('uri'), Id: result.get('Id'), pageStatus: result.get('pageStatus'), submitFlag: result.get('submitFlag') } }); } 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 productList = []; products.forEach(product=>{ productList.push(product.LostProductss); }); } get pageStatusIsCreateOrEdit() { return this.pageStatus === 'Create' || this.pageStatus === 'Edit'; this.tableflag++; return productList; } get isBrandCount2(){ @@ -166,6 +175,69 @@ } return flag; } get isView(){ if(this.pageStatus == 'View'){ return true; } return false; } get isEdit(){ if(this.pageStatus == 'Create' || this.pageStatus == 'Edit'){ return true; } return false; } addBrandJs() { getNewLostBrand({ lineNo: this.LostReport.LostBrands.length }).then(result=>{ this.LostReport.LostBrands.push(result); }); } submitJs() { console.log('1'); submit({ report1: JSON.stringify(this.LostReport), reportId: this.reportId }).then(result=>{ console.log(result); if(result.error){ this.showToast(result.error,"error"); }else{ this.submitFlag = result.submitFlag; init({ oppId1: this.oppId, lostReportId1: this.reportId, pageStatus1: result.pageStatus, lostType1: this.lostType, submitFlag1: this.submitFlag }).then(result=>{ var report = result.LostReport; if(result.message != null){ if(result.message == '提交成功!'){ this.LostReport = report; this.pageStatus = 'View'; this.showToast(result.message,"success"); }else{ this.showToast(result.message,"error"); } }else{ this.LostReport = report; } }).catch(error=>{ console.log("error"); console.log(error); }); } }).catch(error=>{ console.log("error"); console.log(error); }); } deleteBrandJs(event){ var str = event.target.name; @@ -177,18 +249,13 @@ var elements = this.template.querySelectorAll('[data-id="TotalAmount"]'); var tempLostAmount = 0.0; elements.forEach(element => { console.log(element.value); if(element.value != 0){ tempLostAmount = tempLostAmount + parseFloat(element.value); } }); this.LostReport.lostReport.LostTotalAmount__c = tempLostAmount; } setBrandName(brandNumber) { setbrand().then(()=>{ this.clearBrandMannualName(); }); } setBrandMannualName(event) { var index = event.target.name; const payload = event.detail.payload; @@ -200,7 +267,9 @@ } } setDefaultBrand(value,index){ this.LostReport.LostBrands[index].columns[0].value = value; this.LostReport.LostBrands[index].LostProducts.forEach(product => { product.LostProductss.LostBrandName__c = value; }); } @@ -209,12 +278,21 @@ if (value == '其他') { var elements = this.template.querySelectorAll('[data-id="Lost_By_Company_Mannual"]'); elements[index].disabled = false; this.LostReport.LostBrands[index].columns[1].disable = true; elements[index].required = true; var elements1 = this.template.querySelectorAll('.LostProduct[data-id="' + index + '"]'); elements1.forEach(element=>{ element.value = ''; element.disabled = true; }); } else { var elements = this.template.querySelectorAll('[data-id="Lost_By_Company_Mannual"]'); this.brandFlag = false; elements[index].value = ''; elements[index].disabled = true; this.LostReport.LostBrands[index].columns[1].disable = false; elements[index].required = false; elements1.forEach(element=>{ element.disabled = false; }); } } cancel() { @@ -226,134 +304,33 @@ actionName: 'view' } }); } showToast(msg,type) { const event = new ShowToastEvent({ title: '', message: msg, variant: type }); this.dispatchEvent(event); this.dispatchEvent(new CloseActionScreenEvent()); } saveBrandJs(event) { var index = event.target.name; var tables = this.template.querySelectorAll("c-lex-dynamic-table"); if(tables.length > 1){ if(index == "save"){ for(let i=0;i < table.length;i++){ var products = this.LostReport.LostBrands[i].LostProducts; var table = tables[i]; if(table!=undefined){ var records = table.retrieveRecords(); for(let j=0;j<records.length - 1;j++){ products.push(JSON.parse(JSON.stringify(products[0]))); } for(let j=0;j<records.length;j++){ products[j].LostProductss.LostBrandName__c = records[j].LostBrandName__c; products[j].LostProductss.Quantity__c = records[j].Quantity__c; products[j].LostProductss.LostProductMannual__c = records[j].LostProductMannual__c; products[j].LostProductss.ProductClass__c = records[j].ProductClass__c; products[j].LostProductss.ProductCategory__c = records[j].ProductCategory__c; products[j].LostProductss.LostProduct__c = records[j].LostProduct__c; } } } }else{ var products = this.LostReport.LostBrands[index].LostProducts; var table = tables[index]; if(table!=undefined){ var records = table.retrieveRecords(); for(let i=0;i<records.length - 1;i++){ products.push(JSON.parse(JSON.stringify(products[0]))); } for(let i=0;i<records.length;i++){ products[i].LostProductss.LostBrandName__c = records[i].LostBrandName__c; products[i].LostProductss.Quantity__c = records[i].Quantity__c; products[i].LostProductss.LostProductMannual__c = records[i].LostProductMannual__c; products[i].LostProductss.ProductClass__c = records[i].ProductClass__c; products[i].LostProductss.ProductCategory__c = records[i].ProductCategory__c; products[i].LostProductss.LostProduct__c = records[i].LostProduct__c; } } } }else{ var products = this.LostReport.LostBrands[0].LostProducts; var table = tables[0]; if(table!=undefined){ var records = table.retrieveRecords(); console.log(JSON.stringify(records)); if(records.length > 1){ for(let i=0;i<records.length - 1;i++){ products.push(JSON.parse(JSON.stringify(products[0]))); } } for(let i=0;i<records.length;i++){ products[i].LostProductss.LostBrandName__c = records[i].LostBrandName__c; products[i].LostProductss.Quantity__c = records[i].Quantity__c; products[i].LostProductss.LostProductMannual__c = records[i].LostProductMannual__c; products[i].LostProductss.ProductClass__c = records[i].ProductClass__c; products[i].LostProductss.ProductCategory__c = records[i].ProductCategory__c; products[i].LostProductss.LostProduct__c = records[i].LostProduct__c; } } } this.dataCheck(); if(!this.flag){ return; } dataEntry({ report1 : JSON.stringify(this.LostReport) }).then(result=>{ if(result){ this.showToast(result,"error") } }).catch(error=>{ console.log("error"); console.log(error); }); report1 : JSON.stringify(this.LostReport) }).then(result=>{ if(result.error){ this.showToast(result.error,"error"); }else{ this.reportId = result.reportId; console.log(this.LostReport); this.pageStatus = 'View'; } }).catch(error=>{ console.log("error"); console.log(error); }); } handleLostTypeChange(event){ var value = event.target.value; this.LostReport.lostReport.LostType__c = value; editJs(){ this.pageStatus = 'Edit'; } handleLostReasonMainChange(event){ var index = event.target.name; var value = event.target.value; this.LostReport.LostBrands[index].lostBrand.Lost_reason_main__c = value; } handleLostReasonSubChange(event){ var index = event.target.name; var value = event.target.value; this.LostReport.LostBrands[index].lostBrand.Lost_Reason_Sub__c = value; } handleLostByCompanyMannualChange(event){ var index = event.target.name; var value = event.target.value; this.LostReport.LostBrands[index].lostBrand.Lost_By_Company_Mannual__c = value; } handleLostPriceOutChange(event){ var index = event.target.name; var value = event.target.value; this.LostReport.LostBrands[index].lostBrand.LostPrice__c = value; this.setLostTotalAmount(); } handleAgencyOutChange(event){ var index = event.target.name; var value = event.target.value; this.LostReport.LostBrands[index].lostBrand.Agency__c = value; } handleAgencyMannualOutChange(event){ var index = event.target.name; var value = event.target.value; this.LostReport.LostBrands[index].lostBrand.AgencyMannual__c = value; } dataCheck(){ this.flag = true; if(this.LostReport.lostReport.LostType__c == undefined || this.isBlank(this.LostReport.lostReport.LostType__c)) @@ -439,4 +416,129 @@ 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; var deleteButtons = this.template.querySelectorAll('.deleteButton[data-id="' + index1 + '"]'); if(deleteButtons.length == 1){ return; } this.LostReport.LostBrands[index1].LostProducts.splice(index2,1); } handleLostTypeChange(event){ var value = event.target.value; this.LostReport.lostReport.LostType__c = value; } handleLostReasonMainChange(event){ var index = event.target.name; var value = event.target.value; this.LostReport.LostBrands[index].lostBrand.Lost_reason_main__c = value; } handleLostReasonSubChange(event){ var index = event.target.name; var value = event.target.value; this.LostReport.LostBrands[index].lostBrand.Lost_Reason_Sub__c = value; } handleLostByCompanyMannualChange(event){ var index = event.target.name; 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 + '"]'); if(value == '' || value == null){ elements.forEach(element=>{ element.value = ''; element.disabled = true; }); }else{ elements.forEach(element=>{ element.disabled = false; }); } } handleLostPriceOutChange(event){ var index = event.target.name; var value = event.target.value; this.LostReport.LostBrands[index].lostBrand.LostPrice__c = value; this.setLostTotalAmount(); } handleAgencyOutChange(event){ var index = event.target.name; var value = event.target.value; this.LostReport.LostBrands[index].lostBrand.Agency__c = value; } handleAgencyMannualOutChange(event){ var index = event.target.name; var value = event.target.value; this.LostReport.LostBrands[index].lostBrand.AgencyMannual__c = value; } handleLostBrandNameChange(event){ var index1 = event.target.title; var index2 = event.target.name; this.LostReport.LostBrands[index1].LostProducts[index2].LostProductss.LostBrandName__c = event.target.value; } handleLostProductChange(event){ var index1 = event.target.title; var index2 = event.target.name; this.LostReport.LostBrands[index1].LostProducts[index2].LostProductss.LostProduct__c = event.target.value; } handleQuantityChange(event){ var index1 = event.target.title; var index2 = event.target.name; this.LostReport.LostBrands[index1].LostProducts[index2].LostProductss.Quantity__c = event.target.value; } handleLostProductMannualChange(event){ var index1 = event.target.title; var index2 = event.target.name; this.LostReport.LostBrands[index1].LostProducts[index2].LostProductss.LostProductMannual__c = event.target.value; } handleProductClassChange(event){ var index1 = event.target.title; var index2 = event.target.name; this.LostReport.LostBrands[index1].LostProducts[index2].LostProductss.ProductClass__c = event.target.value; var val = event.target.value; if(val == ''){ var temps1 =this.template.querySelectorAll('.ProductCategory[data-id="'+ index1 +'"]'); temps1[index2].readOnly = true; temps1[index2].value = ''; }else{ var temps1 =this.template.querySelectorAll('.ProductCategory[data-id="'+ index1 +'"]'); temps1[index2].readOnly = false; this.LostReport.LostBrands[index1].LostProducts[index2].productOptions = this.productOptionsList[val]; } } handleProductCategoryChange(event){ var index1 = event.target.title; var index2 = event.target.name; var val = event.target.value; var categorys = this.template.querySelectorAll('.ProductCategory'); var flag = false; categorys.forEach(category=>{ if(category.value == '超声主机'){ flag = true; } }); if(flag){ this.LostReport.lostReport.InclusionUltrasound__c = '1'; }else{ this.LostReport.lostReport.InclusionUltrasound__c = '0'; } this.LostReport.LostBrands[index1].LostProducts[index2].LostProductss.ProductCategory__c = val; } } force-app/main/default/lwc/lexStockApply/lexStockApply.html
@@ -2,5 +2,6 @@ <div class="lexStockApplyHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button> <lightning-button onclick={handleConfirmClick} label="Open Confirm Modal"></lightning-button> </div> </template> force-app/main/default/lwc/lexStockApply/lexStockApply.js
@@ -4,7 +4,7 @@ * @Author: chen jing wu * @Date: 2023-04-14 13:04:53 * @LastEditors: chen jing wu * @LastEditTime: 2023-04-23 14:49:52 * @LastEditTime: 2023-05-24 16:45:55 */ import { api, wire,LightningElement } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; @@ -16,6 +16,7 @@ import { loadScript } from "lightning/platformResourceLoader"; import connection from '@salesforce/resourceUrl/connection20'; import submitProcess from '@salesforce/apex/OpportunityLightingButtonController.submitProcess'; import LightningConfirm from 'lightning/confirm'; export default class LexStockApply extends LightningElement { @api recordId; stockApplyStatus; @@ -34,6 +35,69 @@ console.log(str); this.recordId = str; } } } async handleConfirmClick(msg) { const result = await LightningConfirm.open({ message: msg, variant: 'headerless', label: 'this is the aria-label value', }); console.log(result); if(result){ try { updateForStockApplyButton({ recordId: this.recordId, flag: true }).then(result=>{ if(result){ this.showToast(result,"error"); this.dispatchEvent(new CloseActionScreenEvent); return; } // var request = new window.sforce.ProcessSubmitRequest(); // request.objectId = this.recordId; // console.log("s"); // console.log(request); // console.log("e"); // var processResults = window.sforce.Connection.prototype.process([request]); // console.log(processResults); submitProcess({ opportunityId: this.recordId }).then(result=>{ if(result){ this.showToast(result,"error"); updateForStockApplyButton({ recordId: this.recordId, flag: false }).then(result=>{ if(result){ this.showToast(result,"error"); this.dispatchEvent(new CloseActionScreenEvent); return; } this.IsLoading = false; this.updateRecordView(this.recordId); this.dispatchEvent(new CloseActionScreenEvent); }) }else{ this.showToast("成功","success"); this.updateRecordView(this.recordId); this.dispatchEvent(new CloseActionScreenEvent); } }) }).catch(error=>{ console.log(error); }) } catch(e) { console.log(e); } }else{ this.dispatchEvent(new CloseActionScreenEvent); return; } } connectedCallback(){ @@ -59,58 +123,7 @@ this.dispatchEvent(new CloseActionScreenEvent); return; } if (!confirm("一旦提交此记录以待批准,根据您的设置您可能不再能够编辑此记录或将他从批准过程中调回。是否继续?")) { this.dispatchEvent(new CloseActionScreenEvent); return; } updateForStockApplyButton({ recordId: this.recordId, flag: true }).then(result=>{ if(result){ this.showToast(result,"error"); this.dispatchEvent(new CloseActionScreenEvent); return; } // var request = new window.sforce.ProcessSubmitRequest(); // request.objectId = this.recordId; // console.log("s"); // console.log(request); // console.log("e"); // var processResults = window.sforce.Connection.prototype.process([request]); // console.log(processResults); submitProcess({ opportunityId: this.recordId }).then(result=>{ if(result){ this.showToast(result,"error"); updateForStockApplyButton({ recordId: this.recordId, flag: false }).then(result=>{ if(result){ this.showToast(result,"error"); this.dispatchEvent(new CloseActionScreenEvent); return; } this.IsLoading = false; this.updateRecordView(this.recordId); this.dispatchEvent(new CloseActionScreenEvent); }) }else{ this.showToast("成功","success"); this.updateRecordView(this.recordId); this.dispatchEvent(new CloseActionScreenEvent); } }) }).catch(error=>{ console.log(error); }) this.handleConfirmClick("一旦提交此记录以待批准,根据您的设置您可能不再能够编辑此记录或将他从批准过程中调回。是否继续?"); } showToast(msg,type) { const event = new ShowToastEvent({ force-app/main/default/pages/AdvanceOpportunity.page
@@ -1,4 +1,4 @@ <apex:page standardController="Opportunity" extensions="AdvanceOpportunityController" showChat="false" showHeader="false" sidebar="false" action="{!init}" id="allPage"> <apex:page standardController="Opportunity" extensions="AdvanceOpportunityController" showChat="false" showHeader="false" sidebar="false" action="{!init}" id="allPage" lightningStylesheets="true"> <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/> <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/> <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/> force-app/main/default/pages/MaintenanceProductData.page
@@ -1283,7 +1283,7 @@ </apex:pageblocksection> <!-- !(RecordTypeName='GuranteeMain'&&mpd.Status__c='服务填写') --> <apex:pageBlock title="未选择的产品" id="mpdDetailsSection" rendered="{!IF(editAble&&!(RecordTypeName='GuranteeMain'&&mpd.Status__c='服务填写'),true,false)}"> <div style="position:relative;height: 0px;"> <div style="position:absolute;height: 0px;"> <input type="hidden" id="allPage:allForm:allBlock:mpdDetailsSection:mpdDetailsRecordsViewCount" value="{!mpdDetailsRecordsViewCount}" /> <apex:commandButton onclick="saveJs();" value="确认追加" style="position:relative;top: -45px;left: 120px; width:100px;" rerender="mpdDetailsSection,edmpdDetails" rendered="{!IF(editAble,true,false)}" /> </div> force-app/main/default/pages/Opportunity12Rating.page
@@ -1,4 +1,4 @@ <apex:page standardController="Opportunity" showHeader="false" sidebar="false"> <apex:page standardController="Opportunity" showHeader="false" sidebar="false" lightningStylesheets="true"> <head> <style> th {