Merge branch 'LEX_dev' of http://47.92.229.245:8089/r/lightningupdate into LEX_dev
| New file |
| | |
| | | <aura:documentation> |
| | | <aura:description>Documentation</aura:description> |
| | | <aura:example name="ExampleName" ref="exampleComponentName" label="Label"> |
| | | Example Description |
| | | </aura:example> |
| | | </aura:documentation> |
| New file |
| | |
| | | <!-- <aura:component implements="force:lightningQuickAction,lightning:isUrlAddressable,flexipage:availableForRecordHome,force:hasRecordId" controller=""> --> |
| | | <aura:component implements="force:lightningQuickActionWithoutHeader,force:hasRecordId,lightning:isUrlAddressable" > |
| | | <aura:attribute name="recordId" type="String" /> |
| | | <aura:handler name="init" value="{!this}" action="{!c.doInit}"/> |
| | | <div class="exampleHolder"> |
| | | <!-- onpartevent="{!c.closeModal}" --> |
| | | <c:lexCustomDeleteLWC recordId="{!v.recordId}" /> |
| | | </div> |
| | | </aura:component> |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <AuraDefinitionBundle xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <description>A Lightning Component Bundle</description> |
| | | </AuraDefinitionBundle> |
| New file |
| | |
| | | <design:component > |
| | | |
| | | </design:component> |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" standalone="no" ?> |
| | | <svg width="120px" height="120px" viewBox="0 0 120 120" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> |
| | | <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> |
| | | <path d="M120,108 C120,114.6 114.6,120 108,120 L12,120 C5.4,120 0,114.6 0,108 L0,12 C0,5.4 5.4,0 12,0 L108,0 C114.6,0 120,5.4 120,12 L120,108 L120,108 Z" id="Shape" fill="#2A739E" /> |
| | | <path d="M77.7383308,20 L61.1640113,20 L44.7300055,63.2000173 L56.0543288,63.2000173 L40,99.623291 L72.7458388,54.5871812 L60.907727,54.5871812 L77.7383308,20 Z" id="Path-1" fill="#FFFFFF" /> |
| | | </g> |
| | | </svg> |
| New file |
| | |
| | | ({ |
| | | doInit: function(component, event, helper) { |
| | | var val=component.get('v.recordId'); |
| | | $A.get("e.force:closeQuickAction").fire(); |
| | | console.log('val',val); |
| | | }, |
| | | closeModal : function(component,event,helper) { |
| | | $A.get("e.force:closeQuickAction").fire(); |
| | | } |
| | | }) |
| New file |
| | |
| | | ({ |
| | | helperMethod : function() { |
| | | |
| | | } |
| | | }) |
| New file |
| | |
| | | ({ |
| | | |
| | | // Your renderer method overrides go here |
| | | |
| | | }) |
| New file |
| | |
| | | <!-- |
| | | 2023/04/14 新建(修理) |
| | | --> |
| | | <aura:component implements="flexipage:availableForRecordHome,force:lightningQuickActionWithoutHeader,force:hasRecordId,lightning:actionOverride,lightning:isUrlAddressable" access="global" controller="lexNewRepairAuraController"> |
| | | <aura:attribute name="urlStr" type="String"/> |
| | | <aura:attribute name="recordId" type="String"/> |
| | | <aura:handler name="init" value="{!this}" action="{!c.doInit}" /> |
| | | <lightning:notificationsLibrary aura:id="notifLib"/> |
| | | <!-- <aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" > |
| | | <aura:attribute name="fields" type="String[]" default="['Name','AnnualRevenue','Industry']" /> |
| | | <aura:attribute name="recordId" type="String"/> |
| | | <lightning:notificationsLibrary aura:id="notifLib"/> |
| | | |
| | | <lightning:recordForm |
| | | objectApiName="Account" |
| | | fields="{!v.fields}" |
| | | onsuccess="{!c.handleSuccess}" /> |
| | | </aura:component> --> |
| | | |
| | | <!-- <aura:attribute name = "recordId" type = "Id" default = ""/> |
| | | <aura:attribute name="title" type="string"/> |
| | | <aura:handler name="init" value="{!this}" action="{!c.doInit}" /> |
| | | <aura:attribute name="layout" type="LayoutDescriberHelper.LayoutWrapper"/> |
| | | <aura:attribute name="record_data" type="Map"/> |
| | | <aura:attribute name="section_names" type="List"/> |
| | | <aura:attribute name="showSpinner" type="Boolean" default = "False"/> |
| | | <aura:attribute name="staticResource" type="Map"/> |
| | | <aura:attribute name="pi_fields_map" type="Map"/> |
| | | <aura:attribute name="isClone" type="Boolean" default = "False"/> |
| | | <ltng:require scripts="{! $Resource.AWSService+'/AWSService.js' }" /> |
| | | <ltng:require scripts="{! $Resource.jquery183minjs }" /> |
| | | <aura:registerEvent name="NewAgencyContactEvent" type="c:NewAgencyContactEvent"/> --> |
| | | |
| | | <div class="{! v.container_class}"> |
| | | <!-- header --> |
| | | <header class="slds-modal__header"> |
| | | <!-- <h2 id="modal-heading-01" class="slds-modal__title slds-hyphenate"> --> |
| | | <div class="ptBody"> |
| | | <div class="content" style="font-size: 18px;font-weight: bold;"> |
| | | <img src="/img/s.gif" alt="修理" class="pageTitleIcon" title="修理" /> |
| | | <span class="pageType">修理编辑 |
| | | <span class="titleSeparatingColon">:</span> |
| | | </span> |
| | | <span class="pageDescription">新建修理</span> |
| | | <div class="blank"> </div> |
| | | </div> |
| | | <!-- <div class="links"> |
| | | <a href="javascript:openPopupFocusEscapePounds(%27https://help.salesforce.com/apex/htdoor?loc=help&target=repairs_edit.htm&section=repairs&language=zh_CN&release=234.18.8&instance=CS117&showSplash=true%27, %27Help%27, 700, 600, %27width=700,height=600,resizable=yes,toolbar=yes,status=no,scrollbars=yes,menubar=yes,directories=no,location=no,dependant=no%27, false, false);" |
| | | title="此页面的帮助 (新窗口)"> |
| | | <span class="helpLink">此页面的帮助</span> |
| | | <img src="/img/s.gif" alt="" class="helpIcon" /> |
| | | </a> |
| | | </div> --> |
| | | </div> |
| | | <div class="ptBreadcrumb"></div> |
| | | <!-- </h2> --> |
| | | </header> |
| | | |
| | | <div class="slds-modal__content slds-p-around_medium"> |
| | | <!-- <aura:iteration items="1,2,3,4,5" var="item"> |
| | | {!item} |
| | | </aura:iteration> --> |
| | | <!-- <lightning:recordEditForm recordId="{!v.recordId}" |
| | | objectApiName="Repair__c"> |
| | | <lightning:messages /> |
| | | <div class="slds-col slds-size_1-of-2"> |
| | | Your lightning:inputField components here |
| | | <lightning:inputField fieldName="Source_QIS__c" /> |
| | | </div> |
| | | <lightning:button class="slds-m-top_small" type="submit" label="Create new" /> |
| | | </lightning:recordEditForm> --> |
| | | <c:lexNewRepairLWC recordId="{!v.recordId}" urlStr="{!v.urlStr}" /> |
| | | </div> |
| | | </div> |
| | | <!-- <div class="exampleHolder"> |
| | | <c:newRepairLWC recordId="{!v.recordId}"/> |
| | | </div> --> |
| | | </aura:component> |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <AuraDefinitionBundle xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>54.0</apiVersion> |
| | | <description>A Lightning Component Bundle</description> |
| | | </AuraDefinitionBundle> |
| New file |
| | |
| | | ({ |
| | | doInit1 : function(component, event, helper) { |
| | | let rid = component.get('v.recordId'); |
| | | console.log(rid); |
| | | let pid = window.location.href.replace("https://","").split("/"); |
| | | pid = pid[pid.length-1].replace("new?",""); |
| | | let jsonobj = {}; |
| | | console.log(pid); |
| | | pid.split("&").forEach(function(v){ |
| | | |
| | | console.log(v); |
| | | let param = v.split("="); |
| | | jsonobj[param[0]] = param[1]; |
| | | }); |
| | | let urlStr = JSON.stringify(jsonobj); |
| | | console.log(urlStr); |
| | | // if (rid) {} |
| | | /*let pid = null; |
| | | if(!rid){ |
| | | pid = window.location.href.replace("https://","").split("/")[4]; |
| | | } |
| | | let isClone = component.get('v.isClone'); |
| | | if(!rid || isClone){ |
| | | component.set('v.title',$A.get("$Label.c.New")+'.客户人员'); |
| | | }else{ |
| | | component.set('v.title',$A.get("$Label.c.Edit")+'.客户人员'); |
| | | } |
| | | |
| | | let record_type_id = null; |
| | | let pageref = component.get("v.pageReference") |
| | | if(!record_type_id && pageref){ |
| | | record_type_id = pageref.state.recordTypeId |
| | | } |
| | | component.set("v.showSpinner", true);*/ |
| | | helper.CallBackAction(component,'init',{ |
| | | recordId : rid, |
| | | urlStr : urlStr |
| | | },function(data){ |
| | | console.log("data"); |
| | | console.log(data); |
| | | }); |
| | | }, |
| | | doInit : function(component, event, helper) { |
| | | let rid = component.get('v.recordId'); |
| | | // console.log(rid); |
| | | let pid = window.location.href.replace("https://","").split("/"); |
| | | pid = pid[pid.length-1].replace("new?",""); |
| | | let jsonobj = {}; |
| | | // console.log(pid); |
| | | pid.split("&").forEach(function(v){ |
| | | |
| | | // console.log(v); |
| | | let param = v.split("="); |
| | | jsonobj[param[0]] = param[1]; |
| | | }); |
| | | let urlStr = JSON.stringify(jsonobj); |
| | | // console.log(urlStr); |
| | | component.set('v.urlStr',urlStr); |
| | | // create a one-time use instance of the serverEcho action |
| | | // in the server-side controller |
| | | /*var action = component.get("c.init"); |
| | | action.setParams({ |
| | | recordId : rid, |
| | | urlStr : urlStr |
| | | }); |
| | | |
| | | // Create a callback that is executed after |
| | | // the server-side action returns |
| | | action.setCallback(this, function(response) { |
| | | console.log("response"); |
| | | console.log(response); |
| | | // var state = response.getState(); |
| | | if (state === "SUCCESS") { |
| | | // Alert the user with the value returned |
| | | // from the server |
| | | alert("From server: " + response.getReturnValue()); |
| | | |
| | | // You would typically fire a event here to trigger |
| | | // client-side notification that the server-side |
| | | // action is complete |
| | | } |
| | | else if (state === "INCOMPLETE") { |
| | | // do something |
| | | } |
| | | else if (state === "ERROR") { |
| | | var errors = response.getError(); |
| | | if (errors) { |
| | | if (errors[0] && errors[0].message) { |
| | | console.log("Error message: " + |
| | | errors[0].message); |
| | | } |
| | | } else { |
| | | console.log("Unknown error"); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | // optionally set storable, abortable, background flag here |
| | | |
| | | // A client-side action could cause multiple events, |
| | | // which could trigger other events and |
| | | // other server-side action calls. |
| | | // $A.enqueueAction adds the server-side action to the queue. |
| | | $A.enqueueAction(action);*/ |
| | | } |
| | | }) |
| New file |
| | |
| | | ({ |
| | | CallBackAction : function(component,action_name,para,callback) { |
| | | var action = component.get("c." + action_name.trimStart().replace("c.","")); |
| | | if(para){ |
| | | action.setParams(para); |
| | | } |
| | | if(callback){ |
| | | action.setCallback(this,function(data){ |
| | | callback(data); |
| | | }); |
| | | } |
| | | |
| | | $A.enqueueAction(action); |
| | | }, |
| | | ShowToast : function(paras){ |
| | | var toastEvent = $A.get("e.force:showToast"); |
| | | toastEvent.setParams(paras); |
| | | toastEvent.fire(); |
| | | } |
| | | }) |
| | |
| | | insert log; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | WebService static String deleteRepair(String rid) { |
| | | try { |
| | | Repair__c r = new Repair__c(Id = rid); |
| | |
| | | |
| | | insert log; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | WebService static String setSObjectShare(String sobjectName, String rowCause, String parentId, List<String> userAccess, String ownerId) { |
| | | try { |
| | | List<SObject> sObjList = new List<SObject>(); |
| New file |
| | |
| | | public without sharing class TaskFeedbackController { |
| | | |
| | | // 初始方法,获取当前所有任务,包括当前用户和当前用户下属的任务 |
| | | @AuraEnabled |
| | | public static Task getFeedbackTask(string myTaskName, string myTaskType, string myTaskStatus, string myAccountID, Date myStartDate, Date myEndDate, String myTaskDifferent, //2021-09-28 mzy 任务管理改善 start |
| | | string subTaskName, string subTaskType, string subSFDCPosition, string subTaskStatus, string subAccountID, Date subStartDate, Date subEndDate,String subTaskDifferent) { |
| | | ID myUserID = UserInfo.getUserId(); |
| | | // 检索出来当前用户的任务 |
| | | |
| | | |
| | | |
| | | list<TaskWrapper> myTasks = TasksBuild( new list<ID> {myUserID}, |
| | | myTaskName, myTaskType, '' , |
| | | myTaskStatus, myAccountID, |
| | | myStartDate, |
| | | myEndDate ,myTaskDifferent); //2021-09-28 mzy 任务管理改善 start |
| | | |
| | | |
| | | // 下属的ID set |
| | | list<id> subUserIDlist = new list<id>(); |
| | | // 检索当前用户是经理、部长、总监等等的下属 |
| | | for (user tempUser : |
| | | [select id |
| | | from user |
| | | where managerid = : myUserID |
| | | or JingliApprovalManager__c = : myUserID |
| | | or SalesManager__c = : myUserID |
| | | or JingliEquipmentManager__c = : myUserID |
| | | or BuchangApprovalManagerSales__c = : myUserID |
| | | or BuchangApprovalManager__c = : myUserID |
| | | or Buzhang_Equipment_Manager__c = : myUserID |
| | | or ZongjianApprovalManager__c = : myUserID |
| | | or TongkuoZongjian__c = : myUserID |
| | | ]) { |
| | | subUserIDlist.add(tempUser.id); |
| | | } |
| | | // 检索出来下属用户的任务 |
| | | list<TaskWrapper> subTasks = TasksBuild( subUserIDlist, |
| | | subTaskName, subTaskType, '', '', subAccountID, subStartDate, subEndDate ,subTaskDifferent); //2021-09-28 mzy 任务管理改善 start |
| | | |
| | | Task allTask = new Task(myTasks, subTasks ); |
| | | return allTask; |
| | | } |
| | | // 确认或者延期 |
| | | @AuraEnabled |
| | | public static string confirmOrDelay(boolean isDelay, string delayReason, string delayReasonOther, string taskID,Boolean IsGeneratePlan,Date ActivityDate) { |
| | | //2021-07-30 mzy SWAG-C5DAX8 update start |
| | | UserResult u = UserInfo_Owner(); |
| | | //2021-07-30 mzy SWAG-C5DAX8 update end |
| | | try { |
| | | Task__c tempTask = new Task__c(); |
| | | tempTask.id = taskID; |
| | | tempTask.isDelay__c = isDelay; |
| | | tempTask.delayReason__c = delayReason; |
| | | tempTask.delayReasonOther__c = delayReasonOther; |
| | | //2021-07-30 mzy SWAG-C5DAX8 update start |
| | | if(u.Job_Category!=null&&u.Job_Category.equals('销售服务')){ |
| | | tempTask.delayReasonSelectFSE__c = delayReason; |
| | | }else { |
| | | tempTask.delayReasonSelect__c = delayReason; |
| | | } |
| | | //2021-07-30 mzy SWAG-C5DAX8 update end |
| | | //2021-10-20 mzy 任务管理改善 start |
| | | if(IsGeneratePlan == false){ |
| | | //不生成计划 |
| | | tempTask.taskStatus__c = '02 接受'; |
| | | tempTask.GeneratePlan__c = IsGeneratePlan; |
| | | tempTask.ConfirmDate__c = Date.today(); |
| | | tempTask.Activity_Date__c = ActivityDate; |
| | | } |
| | | //2021-10-20 mzy 任务管理改善 end |
| | | |
| | | update tempTask; |
| | | //成功返回更新成功 |
| | | return 'Success'; |
| | | } catch (exception e) { |
| | | //否则返回错误信息 |
| | | return e.getMessage(); |
| | | } |
| | | } |
| | | |
| | | //合并任务 |
| | | @AuraEnabled |
| | | public static string mergeTask(List<String> taskIdList) { |
| | | |
| | | try { |
| | | //BatchIF_Log__c iflog = new BatchIF_Log__c(); |
| | | //iflog.Type__c = 'TestTaskManage'; |
| | | //iflog.Log__c = taskIdList.get(0)+'===='+taskIdList.get(1); |
| | | //iflog.Log__c = '进入了mergeTask方法'; |
| | | //insert iflog; |
| | | List<Task__c> taskList = [select id,mergeTaskMain__c,CreateDate__c,Name,Assignment_Date__c,taskType__c,RelatedInformation_Text__c from task__c where id in :taskIdList]; |
| | | Task__c mainTask = [select id,mergeTaskMain__c,CreateDate__c,Name,Assignment_Date__c,taskType__c,RelatedInformation_Text__c from task__c where id in :taskIdList order by CreateDate__c desc limit 1]; |
| | | List<Task__c> subTaskList = [select id,mergeTaskMain__c,CreateDate__c,Name,Assignment_Date__c,taskType__c,RelatedInformation_Text__c from task__c where mergeTaskMain__c in :taskIdList ]; |
| | | List<Task__c> updateList = new List<Task__c>(); |
| | | List<Task__c> deleteList = new List<Task__c>(); |
| | | |
| | | for(Task__c tsk : taskList){ |
| | | if(tsk.id != mainTask.id ){ |
| | | if(tsk.Assignment_Date__c != null && tsk.Assignment_Date__c != mainTask.Assignment_Date__c && tsk.taskType__c == mainTask.taskType__c &&tsk.Name == mainTask.Name && tsk.RelatedInformation_Text__c == mainTask.RelatedInformation_Text__c ){ |
| | | deleteList.add(tsk); |
| | | |
| | | }else if(tsk.Assignment_Date__c != null && tsk.Assignment_Date__c == mainTask.Assignment_Date__c && tsk.Name != mainTask.Name){ |
| | | tsk.mergeTaskMain__c = mainTask.Id; |
| | | updateList.add(tsk); |
| | | }else{ |
| | | return tsk.Name + ' 与 ' + mainTask.Name + ' 不符合合并条件!请选择分配时间不同,任务名称、类型、相关信息相同的任务进行合并,或者选择分配时间相同,其余信息不同的任务进行合并!'; |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | if(subTaskList != null && subTaskList.size() > 0){ |
| | | for(Task__c subTask : subTaskList){ |
| | | subTask.mergeTaskMain__c = mainTask.Id; |
| | | } |
| | | update subTaskList; |
| | | } |
| | | if(updateList != null && updateList.size() > 0){ |
| | | update updateList; |
| | | } |
| | | if(deleteList != null && deleteList.size() > 0){ |
| | | delete deleteList; |
| | | } |
| | | return 'Success'; |
| | | } catch (exception e) { |
| | | //否则返回错误信息 |
| | | return e.getMessage(); |
| | | } |
| | | } |
| | | |
| | | //2021-10-28 yjk 根据任务id获取询价id |
| | | @AuraEnabled |
| | | public static string checkEnquiryController(String taskId) { |
| | | try { |
| | | List<task__c> tskList = [select id, OpportunityId__c from task__c where id = :taskId]; |
| | | if(tskList.size() != 1){ |
| | | return 'error'; |
| | | } |
| | | if(tskList.get(0).OpportunityId__c == null ){ |
| | | return 'no'; |
| | | } |
| | | |
| | | return tskList.get(0).OpportunityId__c; |
| | | } catch (exception e) { |
| | | //否则返回错误信息 |
| | | return 'error'; |
| | | } |
| | | } |
| | | |
| | | //重新分配任务 |
| | | @AuraEnabled |
| | | public static UserResult resetAssignee(string assigneeID, string taskID) { |
| | | UserResult result = new UserResult(); |
| | | Savepoint sp = Database.setSavepoint(); |
| | | try { |
| | | Task__c tempTask = new Task__c(); |
| | | tempTask.id = taskID; |
| | | tempTask.assignee__c = assigneeID; |
| | | tempTask.ownerid = assigneeID; |
| | | tempTask.Assignment_Date__c = Date.today(); |
| | | update tempTask; |
| | | User tempUser = |
| | | [select id, alias from user where id = : assigneeID ]; |
| | | result.assigneeID = assigneeID; |
| | | result.assigneeName = tempUser.alias; |
| | | |
| | | } catch (exception e) { |
| | | Database.rollback(sp); |
| | | result.result = e.getMessage(); |
| | | } |
| | | return result; |
| | | } |
| | | //20210105 CHAN-BWX3YU you start |
| | | //重新分配任务 |
| | | @AuraEnabled |
| | | public static UserResult resetAssignee_Owner(string assigneeID, string taskID) { |
| | | UserResult result = new UserResult(); |
| | | Savepoint sp = Database.setSavepoint(); |
| | | try { |
| | | // Task__Share tasksha = new Task__Share(UserOrGroupId=assigneeID, AccessLevel='Edit', ParentId = taskID,RowCause = 'Manual'); |
| | | //insert tasksha; |
| | | system.debug('==taskID==='+taskID+'==assigneeID=='+assigneeID); |
| | | |
| | | Task__c tempTask = new Task__c(); |
| | | tempTask.id = taskID; |
| | | tempTask.assignee__c = assigneeID; |
| | | tempTask.ownerid = assigneeID; |
| | | tempTask.Assignment_Date__c = Date.today(); |
| | | update tempTask; |
| | | User tempUser = |
| | | [select id, alias from user where id = : assigneeID ]; |
| | | result.assigneeID = assigneeID; |
| | | result.assigneeName = tempUser.alias; |
| | | |
| | | } catch (exception e) { |
| | | Database.rollback(sp); |
| | | result.result = e.getMessage(); |
| | | } |
| | | return result; |
| | | } |
| | | //获取当前登录人的 省份 和 职种 |
| | | @AuraEnabled |
| | | public static UserResult UserInfo_Owner() { |
| | | UserResult result = new UserResult(); |
| | | ID myUserID = UserInfo.getUserId(); |
| | | |
| | | try { |
| | | User tempUser = |
| | | [select id,Province__c,Job_Category__c from user where id = : myUserID ]; |
| | | result.Job_Category = tempUser.Job_Category__c; |
| | | result.ProvinceName = tempUser.Province__c; |
| | | } catch (exception e) { |
| | | |
| | | result.result = e.getMessage(); |
| | | } |
| | | return result; |
| | | } |
| | | //20210105 CHAN-BWX3YU you end |
| | | // 获取当前用户的任务 |
| | | @AuraEnabled |
| | | public static Task getMyTask(string myTaskName, string myTaskType, |
| | | string myTaskStatus, string myAccountID, |
| | | Date myStartDate, Date myEndDate, |
| | | //2021-09-28 mzy 任务管理改善 start |
| | | String myTaskDifferent |
| | | //2021-09-28 mzy 任务管理改善 end |
| | | ) { |
| | | ID myUserID = UserInfo.getUserId(); |
| | | |
| | | //2021-09-28 mzy 任务管理改善 update start |
| | | list<TaskWrapper> myTasks = TasksBuild( new list<ID> {myUserID}, |
| | | myTaskName, myTaskType, '' , myTaskStatus, myAccountID, myStartDate, myEndDate, myTaskDifferent ); |
| | | //2021-09-28 mzy 任务管理改善 update end |
| | | Task allTask = new Task(myTasks, null ); |
| | | return allTask; |
| | | } |
| | | //获取当前用户下属的任务 |
| | | @AuraEnabled |
| | | public static Task getSubTask(string subTaskName, string subTaskType, |
| | | string subSFDCPosition , string subTaskStatus, |
| | | string subAccountID, |
| | | Date subStartDate, Date subEndDate , |
| | | //2021-09-28 mzy 任务管理改善 start |
| | | String subTaskDifferent |
| | | //2021-09-28 mzy 任务管理改善 end |
| | | ) { |
| | | ID myUserID = UserInfo.getUserId(); |
| | | list<id> subUserIDlist = new list<id>(); |
| | | for (user tempUser : |
| | | [select id |
| | | from user |
| | | where managerid = : myUserID |
| | | or JingliApprovalManager__c = : myUserID |
| | | or SalesManager__c = : myUserID |
| | | or JingliEquipmentManager__c = : myUserID |
| | | or BuchangApprovalManagerSales__c = : myUserID |
| | | or BuchangApprovalManager__c = : myUserID |
| | | or Buzhang_Equipment_Manager__c = : myUserID |
| | | or ZongjianApprovalManager__c = : myUserID |
| | | or TongkuoZongjian__c = : myUserID |
| | | ]) { |
| | | subUserIDlist.add(tempUser.id); |
| | | } |
| | | //system.debug('subUserIDlist:'+subUserIDlist); |
| | | //2021-09-28 mzy 任务管理改善 update start |
| | | list<TaskWrapper> subTasks = TasksBuild( subUserIDlist, |
| | | subTaskName, subTaskType, subSFDCPosition, subTaskStatus, subAccountID, subStartDate, subEndDate , subTaskDifferent ); |
| | | //2021-09-28 mzy 任务管理改善 update end |
| | | Task allTask = new Task(null, subTasks ); |
| | | return allTask; |
| | | } |
| | | // 取消任务 |
| | | @AuraEnabled |
| | | public static string cancel(string taskID, string cancelReason, string cancelReasonOther) { |
| | | //2021-07-30 mzy SWAG-C5DAX8 update start |
| | | UserResult u = UserInfo_Owner(); |
| | | //2021-07-30 mzy SWAG-C5DAX8 update end |
| | | |
| | | try { |
| | | Task__c tempTask = new Task__c(); |
| | | tempTask.id = taskID; |
| | | tempTask.cancelReason__c = cancelReason; |
| | | tempTask.cancelReasonOther__c = cancelReasonOther; |
| | | tempTask.taskStatus__c = '04 取消'; |
| | | tempTask.cancelDate__c = date.today(); |
| | | //2021-07-30 mzy SWAG-C5DAX8 update start |
| | | if(u.Job_Category!=null&&u.Job_Category.equals('销售服务')){ |
| | | tempTask.cancelReasonSelectFSE__c = cancelReason; |
| | | }else { |
| | | tempTask.cancelReasonSelect__c = cancelReason; |
| | | } |
| | | //2021-07-30 mzy SWAG-C5DAX8 update end |
| | | |
| | | update tempTask; |
| | | return 'Success'; |
| | | } catch (exception e) { |
| | | return e.getMessage(); |
| | | } |
| | | } |
| | | |
| | | // 取消任务 |
| | | @AuraEnabled |
| | | public static string feedback(string feedbackContent, string taskId) { |
| | | try { |
| | | Task__c tempTask = [select id , taskType__c,taskStatus__c,FeedbackDescription__c,NeedActivity__c,GeneratePlan__c from task__c where id = :taskId]; |
| | | tempTask.id = taskId; |
| | | tempTask.FeedbackDescription__c = feedbackContent; |
| | | if('其他'.equals(tempTask.taskType__c) ){ |
| | | tempTask.taskStatus__c = '03 完成'; |
| | | } |
| | | update tempTask; |
| | | return 'Success'; |
| | | } catch (exception e) { |
| | | return e.getMessage(); |
| | | } |
| | | } |
| | | |
| | | // 构建任务集合 |
| | | public static list<TaskWrapper> TasksBuild( list<ID> userIDList, string TaskName, |
| | | string taskType, string SFDCPosition , |
| | | string TaskStatus, string AccountID, |
| | | Date startDate, Date endDate,String TaskDifferent) {// 2021-09-28 mzy 任务管理改善 start |
| | | list<TaskWrapper> myTasks = new list<TaskWrapper>(); |
| | | |
| | | // 拼出来任务检索条件 |
| | | String query = 'select id, name, account__c, account__r.name,' + |
| | | 'CreateDate__c,assignee__c , assignee__r.alias, ' + |
| | | //2021-03-29 WLIG-BZK59N mzy start |
| | | 'RelatedInformation_ID__c,RelatedInformation_Text__c,'+ |
| | | //2021-03-29 WLIG-BZK59N mzy end |
| | | //2021-09-28 mzy 任务管理改善 start |
| | | 'TaskDifferent__c,'+ |
| | | //2021-09-28 mzy 任务管理改善 end |
| | | 'FeedbackDescription__c ,'+ |
| | | 'taskStatus__c,taskType__c,Assignment_Date__c from task__c where assignee__c in :userIDList and mergeTaskMain__c = null '+ |
| | | ' and NeedFeedback__c = true and (taskStatus__c = \'02 接受\' or taskStatus__c = \'03 完成\')' ; |
| | | //任务名称 |
| | | if (string.isNotBlank(TaskName)) { |
| | | query += ' and Name like \'%' + String.escapeSingleQuotes(TaskName.trim()) + '%\''; |
| | | } |
| | | //任务类型 |
| | | if (string.isNotBlank(taskType)) { |
| | | query += ' and taskType__c = \'' + String.escapeSingleQuotes(taskType) + '\''; |
| | | } |
| | | // SFDC职种 |
| | | if (string.isNotBlank(SFDCPosition)) { |
| | | query += ' and assignee__r.SFDCPosition_C__c = \'' + String.escapeSingleQuotes(SFDCPosition) + '\''; |
| | | } |
| | | // 所属客户 |
| | | if (string.isNotBlank(AccountID)) { |
| | | query += ' and account__c = \'' + String.escapeSingleQuotes(AccountID) + '\''; |
| | | } |
| | | //任务状态 |
| | | if (string.isNotBlank(TaskStatus)) { |
| | | query += ' and taskStatus__c = \'' + String.escapeSingleQuotes(TaskStatus) + '\''; |
| | | } |
| | | //创建日期的起始日期 |
| | | if (startDate != null) { |
| | | query += ' and CreateDate__c >= ' + startDate.format().replace('/', '-') ; |
| | | } |
| | | //创建日期的结束日期 |
| | | if (endDate != null) { |
| | | query += ' and CreateDate__c <= ' + endDate.format().replace('/', '-') ; |
| | | } |
| | | //2021-09-28 mzy 任务管理改善 start |
| | | //任务区分 |
| | | if(string.isNotBlank(TaskDifferent)){ |
| | | query += ' and TaskDifferent__c =\''+ String.escapeSingleQuotes(TaskDifferent) +'\''; |
| | | } |
| | | //2021-09-28 mzy 任务管理改善 end |
| | | |
| | | //2021-04-19 mzy WLIG-C25DW4 任务一览表显示逻辑 任务管理表请按客户、任务类型和相关信息排序。 start |
| | | query += ' order by account__c ,taskType__c,RelatedInformation_ID__c'; |
| | | //2021-04-19 mzy WLIG-C25DW4 任务一览表显示逻辑 任务管理表请按客户、任务类型和相关信息排序。 end |
| | | |
| | | // 检索成功后构建任务wrapper |
| | | for ( Task__c tempTask : Database.query(query) ) { |
| | | |
| | | if(tempTask.FeedbackDescription__c != null && !''.equals(tempTask.FeedbackDescription__c)){ |
| | | continue; |
| | | } |
| | | TaskWrapper tempTaskWrapper = new TaskWrapper(); |
| | | tempTaskWrapper.Id = tempTask.id; |
| | | tempTaskWrapper.taskId = '/' + tempTask.id; |
| | | //2021-11-25 yjk 任务管理改善 start |
| | | //任务名称只显示 名称不显示客户名 |
| | | if(String.isNotBlank(tempTask.Name)){ |
| | | String tempTaskName = tempTask.Name; |
| | | if(tempTaskName.contains(':')){ |
| | | tempTaskWrapper.taskName = tempTaskName.split(':')[0]; |
| | | //}else if(tempTaskName.contains('(')){ |
| | | // tempTaskWrapper.taskName = tempTaskName.split('(')[0]; |
| | | }else { |
| | | tempTaskWrapper.taskName = tempTaskName; |
| | | } |
| | | } |
| | | //tempTaskWrapper.taskName = tempTask.Name; |
| | | //2021-11-25 yjk 任务管理改善 end |
| | | |
| | | tempTaskWrapper.taskAccountID = '/' + tempTask.account__c; |
| | | tempTaskWrapper.taskAccountName = tempTask.account__r.name; |
| | | tempTaskWrapper.taskType = tempTask.taskType__c; |
| | | tempTaskWrapper.taskStatus = tempTask.taskStatus__c; |
| | | tempTaskWrapper.taskCreateddate = tempTask.CreateDate__c; |
| | | tempTaskWrapper.taskAssigneeName = tempTask.assignee__r.alias; |
| | | tempTaskWrapper.taskAssigneeUrl = '/' + tempTask.assignee__c; |
| | | tempTaskWrapper.taskAssigneeID = tempTask.assignee__c; |
| | | //2021-09-28 mzy 任务管理改善 start |
| | | tempTaskWrapper.taskDifferent = tempTask.TaskDifferent__c; |
| | | //2021-09-28 mzy 任务管理改善 end |
| | | //2021-03-29 WLIG-BZK59N mzy start |
| | | if(tempTask.RelatedInformation_Text__c != null && tempTask.RelatedInformation_ID__c != null){ |
| | | //多年保 和 询价 |
| | | tempTaskWrapper.taskRelatedInformation = tempTask.RelatedInformation_Text__c; |
| | | tempTaskWrapper.taskRelatedInformationID = '/'+tempTask.RelatedInformation_ID__c; |
| | | }else if(tempTask.RelatedInformation_Text__c != null&&String.isBlank(String.valueOf(tempTask.RelatedInformation_ID__c))==true){ |
| | | //OPD任务 |
| | | tempTaskWrapper.taskRelatedInformation = tempTask.RelatedInformation_Text__c; |
| | | tempTaskWrapper.taskRelatedInformationID = '/apex/taskManage?id='+String.ValueOf(UserInfo.getUserId()).substring(0,15)+'#'; |
| | | } |
| | | //tempTaskWrapper.taskRelatedInformation = tempTask.RelatedInformation_Text__c; |
| | | //tempTaskWrapper.taskRelatedInformationID = tempTask.RelatedInformation_ID__c==null?'/':'/'+tempTask.RelatedInformation_ID__c; |
| | | //2021-03-29 WLIG-BZK59N mzy end |
| | | tempTaskWrapper.cancelButtonisDisabled = false; |
| | | tempTaskWrapper.confirmButtonisDisabled = false; |
| | | tempTaskWrapper.delayButtonisDisabled = false; |
| | | tempTaskWrapper.assignButtonisDisabled = false; |
| | | //20210111 CHAN-BWX3YU you start |
| | | tempTaskWrapper.assignButtonisDisabled_Owner = false; |
| | | |
| | | Date d2 = date.today().addDays(-2); |
| | | Date createdate1= date.newinstance(tempTask.CreateDate__c.year(), tempTask.CreateDate__c.month(), tempTask.CreateDate__c.day()); |
| | | system.debug('分配时间'+tempTask.Assignment_Date__c+'==d2=='+d2); |
| | | //20210111 CHAN-BWX3YU you end |
| | | |
| | | if (tempTask.taskStatus__c != null && !tempTask.taskStatus__c.equals('01 分配')) { |
| | | tempTaskWrapper.cancelButtonisDisabled = true; |
| | | tempTaskWrapper.confirmButtonisDisabled = true; |
| | | tempTaskWrapper.delayButtonisDisabled = true; |
| | | tempTaskWrapper.assignButtonisDisabled = true; |
| | | //20210105 CHAN-BWX3YU you start |
| | | tempTaskWrapper.assignButtonisDisabled_Owner = true; |
| | | //20210105 CHAN-BWX3YU you end |
| | | } |
| | | //20210618 SWAG-C434H9 zh start |
| | | // if((tempTask.Assignment_Date__c!= null && tempTask.Assignment_Date__c >=d2) || (tempTask.Assignment_Date__c== null && createdate1>=d2 )){ |
| | | if(tempTask.Assignment_Date__c!= null && tempTask.Assignment_Date__c >=d2){ |
| | | //20210618 SWAG-C434H9 zh end |
| | | //20210113 CHAN-BWX3YU you start |
| | | tempTaskWrapper.assignButtonisDisabled_Owner = true; |
| | | tempTaskWrapper.assignButtonisDisabled = true; |
| | | //20210113 CHAN-BWX3YU you end |
| | | } |
| | | //2021-10-08 mzy 任务管理改善 start |
| | | //上级分配的任务只允许 接受 ,不允许 延期/取消 |
| | | if(tempTask.TaskDifferent__c != null && tempTask.TaskDifferent__c.equals('上级分配任务')){ |
| | | tempTaskWrapper.cancelButtonisDisabled = true; |
| | | tempTaskWrapper.delayButtonisDisabled = true; |
| | | tempTaskWrapper.assignButtonisDisabled_Owner = true; |
| | | } |
| | | //2021-10-08 mzy 任务管理改善 end |
| | | myTasks.add(tempTaskWrapper); |
| | | } |
| | | return myTasks; |
| | | } |
| | | // 获取各种选项列表的选项值 |
| | | @AuraEnabled |
| | | public static map<string, list<pickerWrapper>> getpickerField() { |
| | | map<string, list<pickerWrapper>> pickerFields = new map<string, list<pickerWrapper>>(); |
| | | |
| | | // 任务类型选项值获取 |
| | | list<pickerWrapper> taskTypeOptions = new list<pickerWrapper>(); |
| | | Map<String, Schema.RecordTypeInfo> taskTypeNameMap = |
| | | Schema.SObjectType.Task__c.getRecordTypeInfosByName(); |
| | | set<string> taskTypeNameSet = taskTypeNameMap.keySet(); |
| | | for (string tempStr : taskTypeNameSet) { |
| | | if (!tempStr.equals('主类型')) { |
| | | pickerWrapper temppickerWrapper = |
| | | new pickerWrapper(tempStr, tempStr); |
| | | taskTypeOptions.add(temppickerWrapper); |
| | | } |
| | | } |
| | | pickerWrapper pickerWrapper = |
| | | new pickerWrapper('所有', ''); |
| | | taskTypeOptions.add(pickerWrapper); |
| | | pickerFields.put('taskTypeOptions', taskTypeOptions); |
| | | // 任务状态选项值获取 |
| | | list<pickerWrapper> taskStatusOptions = new list<pickerWrapper>(); |
| | | Schema.DescribeFieldResult taskStatusfieldResult = Task__c.taskStatus__c.getDescribe(); |
| | | List<Schema.PicklistEntry> taskStatusple = taskStatusfieldResult.getPicklistValues(); |
| | | for ( Schema.PicklistEntry pickListVal : taskStatusple) { |
| | | pickerWrapper temppickerWrapper = |
| | | new pickerWrapper(pickListVal.getLabel(), pickListVal.getValue()); |
| | | taskStatusOptions.add(temppickerWrapper); |
| | | } |
| | | pickerFields.put('taskStatusOptions', taskStatusOptions); |
| | | // 2021-09-28 mzy 任务管理改善 start |
| | | // 任务区分选项值获取 |
| | | list<pickerWrapper> taskDifferentOptions = new list<pickerWrapper>(); |
| | | Schema.DescribeFieldResult taskDifferentfieldResult = Task__c.taskDifferent__c.getDescribe(); |
| | | List<Schema.PicklistEntry> taskDifferentple = taskDifferentfieldResult.getPicklistValues(); |
| | | for ( Schema.PicklistEntry pickListVal : taskDifferentple) { |
| | | pickerWrapper temppickerWrapper = |
| | | new pickerWrapper(pickListVal.getLabel(), pickListVal.getValue()); |
| | | taskDifferentOptions.add(temppickerWrapper); |
| | | } |
| | | pickerWrapper taskDifferentWrapper = |
| | | new pickerWrapper('所有', ''); |
| | | taskDifferentOptions.add(taskDifferentWrapper); |
| | | pickerFields.put('taskDifferentOptions', taskDifferentOptions); |
| | | // 2021-09-28 mzy 任务管理改善 end |
| | | // SFDC 职种选项值获取 |
| | | list<pickerWrapper> SFDCPositionOptions = new list<pickerWrapper>(); |
| | | Schema.DescribeFieldResult SFDCPositionfieldResult = user.SFDCPosition_C__c.getDescribe(); |
| | | List<Schema.PicklistEntry> SFDCPositionple = SFDCPositionfieldResult.getPicklistValues(); |
| | | for ( Schema.PicklistEntry pickListVal : SFDCPositionple) { |
| | | pickerWrapper temppickerWrapper = |
| | | new pickerWrapper(pickListVal.getLabel(), pickListVal.getValue()); |
| | | SFDCPositionOptions.add(temppickerWrapper); |
| | | } |
| | | pickerFields.put('SFDCPositionOptions', SFDCPositionOptions); |
| | | // 当前用户职种获取 |
| | | User curentUser = |
| | | [select id , Job_Category__c |
| | | from User |
| | | where id = : UserInfo.getUserId()]; |
| | | // 取消理由选项值获取 |
| | | list<pickerWrapper> cancelReasonOptions = new list<pickerWrapper>(); |
| | | Schema.DescribeFieldResult cancelReasonfieldResult; |
| | | if (curentUser.Job_Category__c != null && curentUser.Job_Category__c.equals('销售服务')) { |
| | | cancelReasonfieldResult = Task__c.cancelReasonSelectFSE__c.getDescribe(); |
| | | |
| | | } else { |
| | | cancelReasonfieldResult = Task__c.cancelReasonSelect__c.getDescribe(); |
| | | } |
| | | List<Schema.PicklistEntry> cancelReasonple = cancelReasonfieldResult.getPicklistValues(); |
| | | for ( Schema.PicklistEntry pickListVal : cancelReasonple) { |
| | | pickerWrapper temppickerWrapper = |
| | | new pickerWrapper(pickListVal.getLabel(), pickListVal.getValue()); |
| | | cancelReasonOptions.add(temppickerWrapper); |
| | | } |
| | | pickerFields.put('cancelReasonOptions', cancelReasonOptions); |
| | | |
| | | // 延期理由选项值获取 |
| | | list<pickerWrapper> delayReasonOptions = new list<pickerWrapper>(); |
| | | Schema.DescribeFieldResult delayReasonfieldResult; |
| | | if (curentUser.Job_Category__c != null && curentUser.Job_Category__c.equals('销售服务')) { |
| | | delayReasonfieldResult = Task__c.delayReasonSelectFSE__c.getDescribe(); |
| | | |
| | | } else { |
| | | delayReasonfieldResult = Task__c.delayReasonSelect__c.getDescribe(); |
| | | } |
| | | List<Schema.PicklistEntry> delayReasonple = delayReasonfieldResult.getPicklistValues(); |
| | | for ( Schema.PicklistEntry pickListVal : delayReasonple) { |
| | | pickerWrapper temppickerWrapper = |
| | | new pickerWrapper(pickListVal.getLabel(), pickListVal.getValue()); |
| | | delayReasonOptions.add(temppickerWrapper); |
| | | } |
| | | pickerFields.put('delayReasonOptions', delayReasonOptions); |
| | | |
| | | return pickerFields; |
| | | } |
| | | |
| | | //2021-11-17 mzy 任务管理改善 satrt |
| | | //查询已反馈的任务 |
| | | @AuraEnabled |
| | | public static List<Task__c> getOverFeedbackTask(){ |
| | | List<Task__c> OverFeedbackTaskList = new List<Task__c> (); |
| | | OverFeedbackTaskList = [SELECT Id FROM Task__c WHERE IsAssignmenter__c = true And TaskDifferent__c = '上级分配任务' And OverFeedback__c = true]; |
| | | |
| | | return OverFeedbackTaskList; |
| | | } |
| | | //2021-11-17 mzy 任务管理改善 end |
| | | |
| | | public class Task { |
| | | @AuraEnabled |
| | | public list<TaskWrapper> myTasks; |
| | | @AuraEnabled |
| | | public list<TaskWrapper> subTasks; |
| | | |
| | | public Task(list<TaskWrapper> myTasks, list<TaskWrapper> subTasks) { |
| | | this.myTasks = myTasks; |
| | | this.subTasks = subTasks; |
| | | } |
| | | } |
| | | public class TaskWrapper { |
| | | @AuraEnabled |
| | | public String id; |
| | | @AuraEnabled |
| | | public String taskId; |
| | | @AuraEnabled |
| | | public String taskName; |
| | | @AuraEnabled |
| | | public String taskAccountID; |
| | | @AuraEnabled |
| | | public String taskAccountName; |
| | | @AuraEnabled |
| | | public String taskAssigneeID; |
| | | @AuraEnabled |
| | | public String taskAssigneeUrl; |
| | | @AuraEnabled |
| | | public String taskAssigneeName; |
| | | @AuraEnabled |
| | | public String taskType; |
| | | @AuraEnabled |
| | | public String taskStatus; |
| | | @AuraEnabled |
| | | public Date taskCreateddate; |
| | | @AuraEnabled |
| | | public Boolean cancelButtonisDisabled; |
| | | @AuraEnabled |
| | | public Boolean confirmButtonisDisabled; |
| | | @AuraEnabled |
| | | public Boolean delayButtonisDisabled; |
| | | @AuraEnabled |
| | | public Boolean assignButtonisDisabled; |
| | | //20210104 CHAN-BWX3YU you |
| | | @AuraEnabled |
| | | public Boolean assignButtonisDisabled_Owner; |
| | | //2021-03-29 WLIG-BZK59N mzy |
| | | @AuraEnabled |
| | | public String taskRelatedInformation; |
| | | @AuraEnabled |
| | | public String taskRelatedInformationID; |
| | | //2021-09-28 任务管理改善 mzy |
| | | @AuraEnabled |
| | | public String taskDifferent; |
| | | } |
| | | public class pickerWrapper { |
| | | @AuraEnabled |
| | | public string label; |
| | | @AuraEnabled |
| | | public string value; |
| | | public pickerWrapper(string label, string value) { |
| | | this.label = label; |
| | | this.value = value; |
| | | } |
| | | |
| | | } |
| | | public class UserResult { |
| | | @AuraEnabled |
| | | public string assigneeName; |
| | | @AuraEnabled |
| | | public string assigneeID; |
| | | @AuraEnabled |
| | | public string result; |
| | | public UserResult( ) { |
| | | result = 'Success'; |
| | | } |
| | | //20210105 CHAN-BWX3YU you start |
| | | @AuraEnabled |
| | | public string Job_Category; |
| | | @AuraEnabled |
| | | public string ProvinceName; |
| | | //20210105 CHAN-BWX3YU you end |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>41.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | /** |
| | | * 2023-04-07 |
| | | * 批量选择修理LWC处理 |
| | | */ |
| | | public with sharing class lexBatchSelectRepairLWCController { |
| | | |
| | | public static List<Repair__c> RepairList; |
| | | public static List<RepairData> RAInfoList; |
| | | public static List<String> repairIdList; |
| | | // public static String pdfURL; |
| | | |
| | | //查询Repair数据 |
| | | @AuraEnabled |
| | | public static ReturnData search(String json) { |
| | | |
| | | //2023/04/07 LWC |
| | | ReturnData returnData = new ReturnData(); |
| | | RetrievalData RevalInfo = (RetrievalData)System.JSON.deserialize(json,RetrievalData.class); |
| | | System.debug(LoggingLevel.INFO, '*** RevalInfo: ' + RevalInfo); |
| | | |
| | | //pageController 逻辑 |
| | | RepairList = new List<Repair__c>(); |
| | | RAInfoList = new List<RepairData>(); |
| | | if(String.isBlank(RevalInfo.Status1) && String.isBlank(RevalInfo.Status2) && String.isBlank(RevalInfo.RepairName) && String.isBlank(RevalInfo.SAPRepairNo) |
| | | && String.isBlank(RevalInfo.SerialNumber) && String.isBlank(RevalInfo.repair.Incharge_Staff__c) && String.isBlank(RevalInfo.onSiteRepair) |
| | | && String.isBlank(String.valueOf(RevalInfo.repair.Aware_date__c)) && String.isBlank(String.valueOf(RevalInfo.repair.Aware_date2__c)) && String.isBlank(RevalInfo.workLocationSelect) |
| | | && String.isBlank(RevalInfo.State_Hospital)){ |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '请至少添加一个检索条件!')); |
| | | return null; |
| | | } |
| | | // 2023/04/10 add 型号,修理委托者 名称 |
| | | String sql = 'select Id, Name, SAP_Service_Repair_No__c, Status1__c, Status2__c, Delivered_Product__c, SerialNumber__c, Delivered_Product__r.Name,Incharge_Staff__r.Name,'; |
| | | sql += 'HP_Name__c, State_Hospital__c, Incharge_Staff__c, FSE_ApplyForRepair_Day__c, work_location_select__c, On_site_repair__c,'; |
| | | sql += 'Number_of_EffectiveContract__c, NewProductGuaranteeObject__c from Repair__c where Id != null '; |
| | | if(String.isNotBlank(RevalInfo.Status2)){ |
| | | sql += ' and Status2__c = \'' + RevalInfo.Status2 + '\''; |
| | | } |
| | | if(String.isNotBlank(RevalInfo.Status1)){ |
| | | sql += ' and Status1__c = \'' + RevalInfo.Status1 + '\''; |
| | | } |
| | | if(String.isNotBlank(RevalInfo.HospitalName)){ |
| | | |
| | | sql += ' and HP_Name__c like \'%' + RevalInfo.HospitalName.trim() + '%\''; |
| | | } |
| | | if(String.isNotBlank(RevalInfo.RepairName)){ |
| | | System.debug(LoggingLevel.INFO, '***RevalInfo.RepairName.contains(): ' + RevalInfo.RepairName.contains(' ')); |
| | | String splitStr = null; |
| | | if(RevalInfo.RepairName.contains(' ')){ |
| | | splitStr = ' '; |
| | | }else if(RevalInfo.RepairName.contains(',')){ |
| | | splitStr = ','; |
| | | } |
| | | if(splitStr != null && RevalInfo.RepairName.contains(splitStr)){ |
| | | sql += ' and ('; |
| | | list <String> nameList = RevalInfo.RepairName.split(splitStr); |
| | | for(String name: nameList){ |
| | | sql += 'Name like \'%' + name + '%\' or '; |
| | | } |
| | | sql = sql.removeEnd('or '); |
| | | sql += ')'; |
| | | }else{ |
| | | sql += ' and Name like \'%' + RevalInfo.RepairName.trim() + '%\''; |
| | | } |
| | | System.debug(LoggingLevel.INFO, '*** sql: ' + sql); |
| | | } |
| | | if(String.isNotBlank(RevalInfo.SAPRepairNo)){ |
| | | System.debug(LoggingLevel.INFO, '***RevalInfo.SAPRepairNo.contains(): ' + RevalInfo.SAPRepairNo.contains(' ')); |
| | | String splitStr = null; |
| | | if(RevalInfo.SAPRepairNo.contains(' ')){ |
| | | splitStr = ' '; |
| | | }else if(RevalInfo.SAPRepairNo.contains(',')){ |
| | | splitStr = ','; |
| | | } |
| | | if(splitStr != null && RevalInfo.SAPRepairNo.contains(splitStr)){ |
| | | sql += ' and ('; |
| | | |
| | | list <String> noList = RevalInfo.SAPRepairNo.split(splitStr); |
| | | for(String no: noList){ |
| | | sql += 'SAP_Service_Repair_No__c like \'%' + no + '%\' or '; |
| | | } |
| | | sql = sql.removeEnd('or '); |
| | | sql += ')'; |
| | | }else{ |
| | | sql += ' and SAP_Service_Repair_No__c like \'%' + RevalInfo.SAPRepairNo.trim() + '%\''; |
| | | } |
| | | System.debug(LoggingLevel.INFO, '*** sql: ' + sql); |
| | | } |
| | | if(String.isNotBlank(RevalInfo.SerialNumber)){ |
| | | List<String> SerialNumberList = new List<String>(); |
| | | if(RevalInfo.SerialNumber.indexOf(',') != -1){ |
| | | SerialNumberList = RevalInfo.SerialNumber.split(','); |
| | | } |
| | | System.debug('SerialNumberList1:' + SerialNumberList); |
| | | // 支持模糊查询多个,文本框输入用英文半角逗号分隔 |
| | | if(SerialNumberList.size() > 0){ |
| | | sql += ' and (SerialNumber__c like \'%'; |
| | | Integer i = 0; |
| | | for(String SerialNumber : SerialNumberList){ |
| | | if(i == 0){ |
| | | sql += SerialNumber.trim() + '%\''; |
| | | }else{ |
| | | sql += 'or SerialNumber__c like \'%' + SerialNumber.trim() + '%\''; |
| | | } |
| | | i++; |
| | | } |
| | | sql += ')'; |
| | | } else{ |
| | | sql += ' and SerialNumber__c like \'%' + RevalInfo.SerialNumber.trim() + '%\''; |
| | | } |
| | | } |
| | | if(String.isNotBlank(RevalInfo.repair.Incharge_Staff__c)){ |
| | | sql += ' and Incharge_Staff__c = \'' + RevalInfo.repair.Incharge_Staff__c + '\''; |
| | | } |
| | | if(String.isNotBlank(String.valueof(RevalInfo.repair.Aware_date__c))&&String.isNotBlank(String.valueof(RevalInfo.repair.Aware_date2__c))){ |
| | | String day = String.valueof(RevalInfo.repair.Aware_date__c); |
| | | String day2 = String.valueof(RevalInfo.repair.Aware_date2__c); |
| | | day = day.substring(0,10); |
| | | day2 = day2.substring(0,10); |
| | | sql += ' and FSE_ApplyForRepair_Day__c >= ' + day + 'and FSE_ApplyForRepair_Day__c <=' +day2; |
| | | } |
| | | if(String.isNotBlank(RevalInfo.onSiteRepair)){ |
| | | sql += ' and On_site_repair__c = \'' + RevalInfo.onSiteRepair + '\''; |
| | | } |
| | | if(String.isNotBlank(RevalInfo.workLocationSelect)){ |
| | | List<String> workLocationSelectList = new List<String>(); |
| | | if(RevalInfo.workLocationSelect.indexOf(',') != -1){ |
| | | workLocationSelectList = RevalInfo.workLocationSelect.split(','); |
| | | } |
| | | System.debug('workLocationSelectList1:' + workLocationSelectList); |
| | | if(workLocationSelectList.size() > 0){ |
| | | sql += ' and (work_location_select__c like \'%'; |
| | | Integer i = 0; |
| | | for(String workLocationSelect : workLocationSelectList){ |
| | | if(i == 0){ |
| | | sql += workLocationSelect.trim() + '%\''; |
| | | }else{ |
| | | sql += 'or work_location_select__c like \'%' + workLocationSelect.trim() + '%\''; |
| | | } |
| | | i++; |
| | | } |
| | | sql += ')'; |
| | | } else{ |
| | | sql += ' and work_location_select__c like \'%' + RevalInfo.workLocationSelect.trim() + '%\''; |
| | | } |
| | | } |
| | | if(String.isNotBlank(RevalInfo.State_Hospital)){ |
| | | sql += ' and State_Hospital__c like \'%' + RevalInfo.State_Hospital.trim() + '%\''; |
| | | } |
| | | sql += 'and Status1__c not in(\'0.删除\',\'0.取消\') limit 200'; |
| | | System.debug('sql1LWC:' + sql); |
| | | if(String.isNotBlank(sql)){ |
| | | RepairList = Database.query(sql); |
| | | } |
| | | if(RepairList.size() == 200){ |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '检索数据太多,请缩小检索范围!')); |
| | | //2023/04/07 returnData |
| | | returnData.status = '检索数据太多,请缩小检索范围!'; |
| | | } |
| | | if(RepairList.size() <= 0){ |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '没检索到任何修理')); |
| | | //2023/04/07 returnData |
| | | returnData.status = '没检索到任何修理'; |
| | | return returnData; |
| | | } |
| | | for(Repair__c ra : RepairList){ |
| | | RepairData raData = new RepairData(ra); |
| | | RAInfoList.add(raData); |
| | | } |
| | | // return RAInfoList; |
| | | |
| | | returnData.repairData = RAInfoList; |
| | | System.debug(LoggingLevel.INFO, '*** returnData: ' + returnData); |
| | | return returnData; |
| | | } |
| | | |
| | | //打印PDF |
| | | @AuraEnabled |
| | | public static String showPDF(String json) { |
| | | System.debug(LoggingLevel.INFO, '*** joinshoPDF: '); |
| | | List<Repair__c> RepairList = (List<Repair__c>)System.JSON.deserialize(json,List<Repair__c>.class); |
| | | |
| | | if(RepairList == null || RepairList.isEmpty()){ |
| | | return '请先检索修理'; |
| | | } |
| | | repairIdList = new List<String>(); |
| | | for(Repair__c rd : RepairList) { |
| | | System.debug(LoggingLevel.INFO, '*** rd: ' + rd); |
| | | repairIdList.add(rd.Id); |
| | | } |
| | | // RepairList = new List<Repair__c>(); |
| | | String url = '='; |
| | | /*System.debug('RAInfoList:' + RAInfoList); |
| | | if(RAInfoList == null || RAInfoList.isEmpty()){ |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '请先检索修理')); |
| | | return '请先检索修理'; |
| | | }*/ |
| | | /*for(RepairData rd : RAInfoList) { |
| | | System.debug(LoggingLevel.INFO, '*** rd: ' + rd); |
| | | //选中的repair |
| | | if(rd.IFCheck){ |
| | | repairIdList.add(rd.repair.Id); |
| | | RepairList.add(rd.repair); |
| | | } |
| | | }*/ |
| | | System.debug(LoggingLevel.INFO, '***repairIdList : ' + repairIdList); |
| | | System.debug(LoggingLevel.INFO, '***RepairList : ' + RepairList); |
| | | if(repairIdList.size() > 0){ |
| | | if(repairIdList.size() <= 50){ |
| | | if(RepairList.size() > 0){ |
| | | System.debug(LoggingLevel.INFO, '*** if size>0 generateAttachment: '); |
| | | generateAttachment(RepairList); |
| | | } |
| | | for(String Id : repairIdList){ |
| | | url += Id + '='; |
| | | } |
| | | url = url.substring(0, url.lastIndexOf('=')); |
| | | // PageReference pageRef = new PageReference('/apex/MaintenanceCommissionPDF?id' + url); |
| | | // pageRef.setRedirect(true); |
| | | // return pageRef; |
| | | String pdfURL = ''; |
| | | if(isSandbox()){ |
| | | pdfURL = 'https://ocsm--stagefull--c.visualforce.com/apex/MaintenanceCommissionPDF?id' + url; |
| | | } else{ |
| | | pdfURL = 'https://ocsm.my.salesforce.com/apex/MaintenanceCommissionPDF?id' + url; |
| | | } |
| | | return pdfURL; |
| | | } else{ |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '多单打印最大数量为50,请选择少于50个修理!')); |
| | | return '多单打印最大数量为50,请选择少于50个修理!'; |
| | | } |
| | | } else{ |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '请至少选择一个修理')); |
| | | return '请至少选择一个修理'; |
| | | } |
| | | } |
| | | |
| | | // 生成pdf添加到对应的修理中 |
| | | public static PageReference generateAttachment(List<Repair__c> repList){ |
| | | System.debug(LoggingLevel.INFO, '*** generateAttachment: '); |
| | | BatchSelectRepairPDFDelete pdf = new BatchSelectRepairPDFDelete(); |
| | | pdf.deletePDF(repList); |
| | | pdf.createPDF(repList); |
| | | return null; |
| | | } |
| | | |
| | | // 判断是否是测试环境 |
| | | public static Boolean isSandbox() { |
| | | return [SELECT IsSandbox FROM Organization LIMIT 1].IsSandbox; |
| | | } |
| | | |
| | | public class RetrievalData { |
| | | @AuraEnabled |
| | | public String Status1; |
| | | @AuraEnabled |
| | | public String Status2; |
| | | @AuraEnabled |
| | | public String RepairName; |
| | | @AuraEnabled |
| | | public String SAPRepairNo; |
| | | @AuraEnabled |
| | | public String SerialNumber; |
| | | @AuraEnabled |
| | | public String onSiteRepair; |
| | | @AuraEnabled |
| | | public String workLocationSelect; |
| | | @AuraEnabled |
| | | public String State_Hospital; |
| | | @AuraEnabled |
| | | public String HospitalName; |
| | | @AuraEnabled |
| | | public Repair__c repair; |
| | | |
| | | public RetrievalData(){ |
| | | repair = new Repair__c(); |
| | | } |
| | | } |
| | | |
| | | public class RepairData { |
| | | @AuraEnabled |
| | | public Boolean IFCheck; |
| | | @AuraEnabled |
| | | public Repair__c repair; |
| | | public RepairData(Repair__c RepairInfo){ |
| | | IFCheck = null; |
| | | repair = RepairInfo; |
| | | } |
| | | } |
| | | //2023/04/07 返回查询结果和状态 |
| | | public class ReturnData { |
| | | @AuraEnabled |
| | | public String status; |
| | | @AuraEnabled |
| | | public List<RepairData> repairData; |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>52.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | public with sharing class lexCustomDeleteController { |
| | | @AuraEnabled |
| | | public static InitData initForCustomDelete(String recordId){ |
| | | InitData res=new initData(); |
| | | try { |
| | | Repair__c repair=[Select Id,Status__c,FSE_ApplyForRepair_time__c,SAP_Transfer_time__c,CreatedById,Repair_Ordered_Date__c,Acc_OwnerId__c,FSE_ownerid__c FROM Repair__c WHERE Id=:recordId limit 1]; |
| | | res.Id=repair.Id; |
| | | res.Status=repair.Status__c; |
| | | res.FSEApplyForRepairtime=repair.FSE_ApplyForRepair_time__c; |
| | | res.SAP=repair.SAP_Transfer_time__c; |
| | | res.cre=repair.CreatedById; |
| | | res.Rep=repair.Repair_Ordered_Date__c; |
| | | res.acc=repair.Acc_OwnerId__c; |
| | | res.FSEownerId=repair.FSE_ownerid__c; |
| | | // User user=[Select Id FROM User WHERE Repair__r.CreatedById=:res.cre limit 1]; |
| | | // res.UserId=repair.User__r.Id; |
| | | System.debug(LoggingLevel.INFO,'***res:'+res); |
| | | } catch (Exception e) { |
| | | System.debug(LoggingLevel.INFO,'***e:'+e); |
| | | } |
| | | return res; |
| | | } |
| | | |
| | | |
| | | public class InitData{ |
| | | @AuraEnabled |
| | | public String Id; |
| | | @AuraEnabled |
| | | public String Status; |
| | | @AuraEnabled |
| | | public Datetime SAP; |
| | | @AuraEnabled |
| | | public Datetime FSEApplyForRepairtime; |
| | | @AuraEnabled |
| | | public String cre; |
| | | @AuraEnabled |
| | | public Date Rep; |
| | | @AuraEnabled |
| | | public String acc; |
| | | @AuraEnabled |
| | | public String FSEownerId; |
| | | @AuraEnabled |
| | | public String UserId; |
| | | @AuraEnabled |
| | | public String ApiSessionId; |
| | | |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | /** |
| | | * 2023-04-14 |
| | | * Lightning new Repair |
| | | */ |
| | | public with sharing class lexNewRepairAuraController { |
| | | public static String sobjectTypeValue = 'Repair__c'; |
| | | //查询Repair数据 修理对象的new和update |
| | | @AuraEnabled |
| | | public static ReturnData init(String recordId,String urlStr) { |
| | | ReturnData res = new ReturnData(); |
| | | String sobjectId = [SELECT CustomObjectId,CustomObjectName FROM CustomObjectUserLicenseMetrics where CustomObjectName ='Repair' limit 1].CustomObjectId; |
| | | String Input_Required_Field_Msg = Label.Input_Required_Field_Msg; |
| | | String PIPL_Name_Label = Label.PIPL_Name_Label; |
| | | String PIPL_Input_Account_Error_Msg = label.PIPL_Input_Account_Error_Msg; |
| | | Map<string,string> mso = (Map<string,string>)JSON.deserialize(urlStr, Map<string,string>.class); |
| | | system.debug('mso='+mso); |
| | | if (recordId != null) { |
| | | res.recordTypeId = [SELECT Id,RecordTypeId FROM Repair__c WHERE Id = :recordId].RecordTypeId; |
| | | res.status = true; |
| | | } |
| | | String RepairSubOrderAWSDataId; |
| | | // AssignValueFromUrl(mso,controller.getRecord()); |
| | | //通过id查 问题 |
| | | //PIPL zhj 2022-11-11 start |
| | | //从报修子单过来00N10000009H1rR |
| | | if (mso.containsKey('CF00N10000009H1rR_lkid')) { |
| | | String repairSubOrderId = mso.get('CF00N10000009H1rR_lkid'); |
| | | System.debug('repairSubOrderId = ' + repairSubOrderId); |
| | | //查询AWSDataId |
| | | List<RepairSubOrder__c> rso = [select AWS_Data_Id__c from RepairSubOrder__c where Id=:repairSubOrderId]; |
| | | if(rso.size() > 0){ |
| | | //todo 从报修子单过来,需要解密报修人 lwc是否需要进行解密处理? |
| | | RepairSubOrderAWSDataId = rso[0].AWS_Data_Id__c; |
| | | res.AWS_Data_Id = rso[0].AWS_Data_Id__c; |
| | | res.status = true; |
| | | } |
| | | } |
| | | //PIPL zhj 2022-11-11 end |
| | | List<Repair__c> rc = new List<Repair__c>(); |
| | | system.debug('retURL=' + mso.containsKey('retURL')); |
| | | if (mso.containsKey('retURL')) { |
| | | String RepairId = mso.get('retURL').substring(1); |
| | | System.debug('RepairId = ' + RepairId); |
| | | rc = [select Hospital__c,Department_Class__c,Account__c,Dealer__c,Incharge_Staff_Contact__c,Incharge_Staff__c, RepairSubOrder__c,On_Call_ID__c,QIS_ID__c, InsReport__c,Rental_Apply_Equipment_Set_Detail__c from Repair__c where id =:RepairId ]; |
| | | System.debug('rc = ' + rc); |
| | | if(rc.size() > 0){ |
| | | //已有数据赋值 |
| | | //医院 |
| | | res.Hospital = rc[0].Hospital__c; |
| | | //战略科室分类 |
| | | res.Department_Class = rc[0].Department_Class__c; |
| | | //科室 |
| | | res.Account = rc[0].Account__c; |
| | | //经销商名 |
| | | res.Dealer = rc[0].Dealer__c; |
| | | //修理委托者(员工) |
| | | res.Incharge_Staff_Contact = rc[0].Incharge_Staff_Contact__c; |
| | | //修理委托者(FSE) |
| | | res.Incharge_Staff = rc[0].Incharge_Staff__c; |
| | | //报修子单RepairSubOrder__c |
| | | res.RepairSubOrder = rc[0].RepairSubOrder__c; |
| | | //查询AWSDataId |
| | | List<RepairSubOrder__c> rso = [select AWS_Data_Id__c from RepairSubOrder__c where Id=:rc[0].RepairSubOrder__c]; |
| | | if(rso.size() > 0){ |
| | | RepairSubOrderAWSDataId = rso[0].AWS_Data_Id__c; |
| | | res.AWS_Data_Id = rso[0].AWS_Data_Id__c; |
| | | } |
| | | //On-Call号码On_Call_ID__c |
| | | res.On_Call_ID = rc[0].On_Call_ID__c; |
| | | //QIS号码QIS_ID__c |
| | | res.QIS_ID = rc[0].QIS_ID__c; |
| | | //点检报告书InsReport__c |
| | | res.InsReport = rc[0].InsReport__c; |
| | | //借出备品配套一览明细Rental_Apply_Equipment_Set_Detail__c |
| | | res.Rental_Apply_Equipment_Set_Detail = rc[0].Rental_Apply_Equipment_Set_Detail__c; |
| | | |
| | | res.status = true; |
| | | } |
| | | |
| | | } |
| | | //2023/04/23 lwc的保存并新建 保存后刷新页面 |
| | | // PIHelper.PIIntegration piIntegration = PIHelper.getPIIntegrationInfo('Repair__c'); |
| | | // PIHelper.PIIntegration piIntegrationAddress = PIHelper.getPIIntegrationInfo('Address__c'); |
| | | // PIHelper.PIIntegration piIntegrationContact = PIHelper.getPIIntegrationInfo('Contact'); |
| | | // PIHelper.PIIntegration piIntegrationRepairSubOrder = PIHelper.getPIIntegrationInfo('RepairSubOrder__c'); |
| | | // String staticResource = JSON.serialize(piIntegration); |
| | | // //zhj MEBG新方案改造 2022-11-29 start |
| | | // String staticResourceV2 = JSON.serialize(PIHelper.getPIIntegrationInfo('Repair__cV2')); |
| | | // //zhj MEBG新方案改造 2022-11-29 end |
| | | // String staticResourceAddress = JSON.serialize(piIntegrationAddress); |
| | | // String staticResourceContact = JSON.serialize(piIntegrationContact); |
| | | // String staticResourceRepairSubOrder = JSON.serialize(piIntegrationRepairSubOrder); |
| | | // List<String> encryptedAPIList = piIntegration.PIFields; |
| | | // String sobjectPrefix = piIntegration.sobjectPrefix; |
| | | |
| | | //save and new url page处保存并新建跳转地址:new?recordTypeId=01210000000QmS9&additionalParams=retURL%3D%252Fa0J%252Fo%26&count=1 |
| | | // String newUrl = '/setup/ui/recordtypeselect.jsp?ent=' + sobjectId + '&retURL=/' + sobjectPrefix + '/o&save_new_url=/' + sobjectPrefix + '/e?retURL=%2F' + sobjectPrefix + '%2Fo'; |
| | | // res.newUrl = newUrl; |
| | | |
| | | return res; |
| | | } |
| | | |
| | | public static String getAllFieldNames(String objName){ |
| | | Map <String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe(); |
| | | List<Schema.sObjectField> fields = schemaMap.get(objName).getDescribe().fields.getMap().values(); |
| | | |
| | | String fieldString = ''; |
| | | for( Schema.sObjectField field : fields ){ |
| | | fieldString += field + ','; |
| | | } |
| | | fieldString = fieldString.removeEnd(','); |
| | | |
| | | return fieldString; |
| | | } |
| | | |
| | | // @AuraEnabled |
| | | public static List <LayoutDescriberHelper.LayoutSection > init1(String recordId,String urlStr) { |
| | | String sobjectId = [SELECT CustomObjectId,CustomObjectName FROM CustomObjectUserLicenseMetrics where CustomObjectName ='Repair' limit 1].CustomObjectId; |
| | | Boolean isNewMode = true; |
| | | String Input_Required_Field_Msg = Label.Input_Required_Field_Msg; |
| | | String PIPL_Name_Label = Label.PIPL_Name_Label; |
| | | String PIPL_Input_Account_Error_Msg = label.PIPL_Input_Account_Error_Msg; |
| | | String rtTypeId; |
| | | // String sobjecttypeForFrontEnd = sobjectTypeValue; |
| | | //获取所有字段 |
| | | // List<String> fieldList = new List<String>(Schema.getGlobalDescribe().get('Repair__c').getDescribe().fields.getMap().keyset()); |
| | | // Add fields to controller. This is to avoid the SOQL error in visualforce page |
| | | // if(!Test.isRunningTest()){ |
| | | // controller.addFields(fieldList); |
| | | // } |
| | | // SObject obj = controller.getRecord(); |
| | | if(recordId == ''){ |
| | | //更新 页面判断 |
| | | // isNewMode = false; |
| | | Repair__c repairData = [select Id,RecordTypeId,AWS_Data_Id__c,Address_AWS_Data_Id__c,Contact_AWS_Data_Id__c,Address_Contacts_Encrypt__c,Address_Contacts_Name_Encrypt__c,Address_Telephone_Encrypt__c,Address_ZipCode_Encrypt__c,Detailed_Address_Encrypt__c from Repair__c where id =: recordId]; |
| | | rtTypeId = repairData.RecordTypeId; |
| | | String AWSDataId = repairData.AWS_Data_Id__c; |
| | | String DecryptAWSDataId = String.valueOf(repairData.Address_AWS_Data_Id__c); |
| | | String ContactAWSDataId = String.valueOf(repairData.Contact_AWS_Data_Id__c); |
| | | }else{ |
| | | //get url 参数 |
| | | // Map<string,string> mso = ApexPages.currentPage().getParameters(); |
| | | Map<string,string> mso = (Map<string,string>)JSON.deserialize(urlStr, Map<string,string>.class); |
| | | system.debug('mso='+mso); |
| | | // AssignValueFromUrl(mso,controller.getRecord()); |
| | | //通过id查 问题 |
| | | //PIPL zhj 2022-11-11 start |
| | | //从报修子单过来00N10000009H1rR |
| | | if (mso.containsKey('CF00N10000009H1rR_lkid')) { |
| | | String repairSubOrderId = mso.get('CF00N10000009H1rR_lkid'); |
| | | System.debug('repairSubOrderId = ' + repairSubOrderId); |
| | | //查询AWSDataId |
| | | List<RepairSubOrder__c> rso = [select AWS_Data_Id__c from RepairSubOrder__c where Id=:repairSubOrderId]; |
| | | if(rso.size() > 0){ |
| | | String RepairSubOrderAWSDataId = rso[0].AWS_Data_Id__c; |
| | | } |
| | | } |
| | | //PIPL zhj 2022-11-11 end |
| | | List<Repair__c> rc = new List<Repair__c>(); |
| | | system.debug('retURL=' + mso.containsKey('retURL')); |
| | | if (mso.containsKey('retURL')) { |
| | | String RepairId = mso.get('retURL').substring(1); |
| | | System.debug('RepairId = ' + RepairId); |
| | | rc = [select Hospital__c,Department_Class__c,Account__c,Dealer__c,Incharge_Staff_Contact__c,Incharge_Staff__c, RepairSubOrder__c,On_Call_ID__c,QIS_ID__c, InsReport__c,Rental_Apply_Equipment_Set_Detail__c from Repair__c where id =:RepairId ]; |
| | | System.debug('rc = ' + rc); |
| | | if(rc.size() > 0){ |
| | | //已有数据赋值 defaultValue |
| | | /*//医院 |
| | | controller.getRecord().put('Hospital__c',rc[0].Hospital__c); |
| | | //战略科室分类 |
| | | controller.getRecord().put('Department_Class__c',rc[0].Department_Class__c); |
| | | //科室 |
| | | controller.getRecord().put('Account__c',rc[0].Account__c); |
| | | //经销商名 |
| | | controller.getRecord().put('Dealer__c',rc[0].Dealer__c); |
| | | //修理委托者(员工) |
| | | controller.getRecord().put('Incharge_Staff_Contact__c',rc[0].Incharge_Staff_Contact__c); |
| | | //修理委托者(FSE) |
| | | controller.getRecord().put('Incharge_Staff__c',rc[0].Incharge_Staff__c); |
| | | //报修子单RepairSubOrder__c |
| | | controller.getRecord().put('RepairSubOrder__c',rc[0].RepairSubOrder__c); |
| | | //查询AWSDataId |
| | | List<RepairSubOrder__c> rso = [select AWS_Data_Id__c from RepairSubOrder__c where Id=:rc[0].RepairSubOrder__c]; |
| | | if(rso.size() > 0){ |
| | | RepairSubOrderAWSDataId = rso[0].AWS_Data_Id__c; |
| | | } |
| | | //On-Call号码On_Call_ID__c |
| | | controller.getRecord().put('On_Call_ID__c',rc[0].On_Call_ID__c); |
| | | //QIS号码QIS_ID__c |
| | | controller.getRecord().put('QIS_ID__c',rc[0].QIS_ID__c); |
| | | //点检报告书InsReport__c |
| | | controller.getRecord().put('InsReport__c',rc[0].InsReport__c); |
| | | //借出备品配套一览明细Rental_Apply_Equipment_Set_Detail__c |
| | | controller.getRecord().put('Rental_Apply_Equipment_Set_Detail__c',rc[0].Rental_Apply_Equipment_Set_Detail__c);*/ |
| | | } |
| | | |
| | | } |
| | | |
| | | // rtTypeId = ApexPages.currentPage().getParameters().get('RecordType'); |
| | | rtTypeId = mso.get('RecordType'); |
| | | if(String.isBlank(rtTypeId)||String.isEmpty(rtTypeId)){ |
| | | List<RecordType> rtList = new List<RecordType>([select Id,DeveloperName from RecordType where SobjectType ='Repair__c' and DeveloperName ='Repair']); |
| | | rtTypeId = rtList[0].Id; |
| | | } |
| | | } |
| | | LayoutDescriberHelper.LayoutWrapper LayoutWrapperValue = LayoutDescriberHelper.describeSectionWithFieldsWrapper(rtTypeId, 'Repair__c','classic'); |
| | | List <LayoutDescriberHelper.LayoutSection > layoutSections = LayoutWrapperValue.layoutSections; |
| | | String layoutSectionsStr = JSON.serialize(layoutSections); //for dynamic add readonly attribute |
| | | List<String> requiredFieldAPIList = LayoutWrapperValue.requiredFieldAPIList; |
| | | Map<String,String> fieldAPIToLabelMap = LayoutWrapperValue.fieldAPIToLabelMap; |
| | | String requiredFieldAPIListStr = JSON.serialize(requiredFieldAPIList); |
| | | String fieldAPIToLabelMapStr = JSON.serialize(fieldAPIToLabelMap); |
| | | PIHelper.PIIntegration piIntegration = PIHelper.getPIIntegrationInfo('Repair__c'); |
| | | PIHelper.PIIntegration piIntegrationAddress = PIHelper.getPIIntegrationInfo('Address__c'); |
| | | PIHelper.PIIntegration piIntegrationContact = PIHelper.getPIIntegrationInfo('Contact'); |
| | | PIHelper.PIIntegration piIntegrationRepairSubOrder = PIHelper.getPIIntegrationInfo('RepairSubOrder__c'); |
| | | String staticResource = JSON.serialize(piIntegration); |
| | | //zhj MEBG新方案改造 2022-11-29 start |
| | | String staticResourceV2 = JSON.serialize(PIHelper.getPIIntegrationInfo('Repair__cV2')); |
| | | //zhj MEBG新方案改造 2022-11-29 end |
| | | String staticResourceAddress = JSON.serialize(piIntegrationAddress); |
| | | String staticResourceContact = JSON.serialize(piIntegrationContact); |
| | | String staticResourceRepairSubOrder = JSON.serialize(piIntegrationRepairSubOrder); |
| | | List<String> encryptedAPIList = piIntegration.PIFields; |
| | | String sobjectPrefix = piIntegration.sobjectPrefix; |
| | | //获取lookup字段 |
| | | List<String> VLookUpFields = new List<String>(); |
| | | for (LayoutDescriberHelper.LayoutSection ls : layoutSections) { |
| | | for (LayoutDescriberHelper.LayoutField lf : ls.layoutFields) { |
| | | if (lf.fieldAPI != '' && lf.fieldType == 'reference') { |
| | | VLookUpFields.add(lf.fieldAPI); |
| | | } |
| | | } |
| | | } |
| | | String VLookUpFieldsJson = Json.serialize(VLookUpFields); |
| | | System.debug(LoggingLevel.INFO, '*** layoutSectionsLWC: ' + layoutSections); |
| | | return layoutSections; |
| | | } |
| | | |
| | | // 从url参数赋值到当前页面 |
| | | public static void AssignValueFromUrl(Map<string,string> mso, sobject sobj){ |
| | | |
| | | String sobject_name = sobj.getSObjectType().getDescribe().getName(); |
| | | Map<string,object> temp = new Map<string,object>(); |
| | | Map<string,FieldDefinition> fdm = new Map<string,FieldDefinition>(); |
| | | List<FieldDefinition> fds = [SELECT Id, DurableId, QualifiedApiName,ValueTypeId , EntityDefinitionId, NamespacePrefix,EntityDefinition.NamespacePrefix, DeveloperName, MasterLabel, Label FROM FieldDefinition where EntityDefinition.QualifiedApiName = :sobject_name]; |
| | | for(FieldDefinition fd : fds){ |
| | | //system.debug(fd.DurableId); |
| | | fdm.put(fd.DurableId.split('\\.')[1],fd); |
| | | } |
| | | |
| | | for(string key : mso.keySet()){ |
| | | if (key.toLowerCase() == 'id') { |
| | | System.debug('skip id assign'); |
| | | continue; |
| | | } |
| | | string new_key = key; |
| | | system.debug('new_key='+new_key); |
| | | if(new_key.contains('_lkid')){ |
| | | new_key = new_key.replace('_lkid', ''); |
| | | new_key = new_key.substring(2); |
| | | }else{ |
| | | if(temp.containsKey(new_key)){ |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | system.debug('now new_key='+new_key); |
| | | if(fdm.containsKey(new_key)){ |
| | | system.debug('fdm.get(new_key)='+fdm.get(new_key)); |
| | | string val_str = mso.get(key); |
| | | system.debug('val_str='+val_str); |
| | | /*无需做decode,sf内部已经做好 |
| | | try{ |
| | | val_str = EncodingUtil.urlDecode(mso.get(key),'UTF-8'); |
| | | }catch(Exception e){ |
| | | continue; |
| | | system.debug('Exception from get Key:'+e.getMessage()); |
| | | system.debug(e.getStackTraceString()); |
| | | } */ |
| | | object val = null; |
| | | string type_id = fdm.get(new_key).ValueTypeId; |
| | | // address, boolean, date, datetime, double, id, location, string, time |
| | | if(string.isBlank(val_str)){ |
| | | val = null; |
| | | }else if(type_id == 'boolean'){ |
| | | if(val_str == '1'){ |
| | | val = true; |
| | | }else{ |
| | | val = boolean.valueOf(val_str); |
| | | } |
| | | }else if(type_id == 'date'){ |
| | | // |
| | | try{ |
| | | val = date.parse(val_str); |
| | | }catch(Exception e){ |
| | | system.debug('val_str='+val_str); |
| | | system.debug(e.getMessage()); |
| | | system.debug(e.getStackTraceString()); |
| | | try{ |
| | | val = date.valueOf(val_str); |
| | | }catch(Exception ee){ |
| | | system.debug('val_str='+val_str); |
| | | system.debug(ee.getMessage()); |
| | | system.debug(ee.getStackTraceString()); |
| | | continue; |
| | | } |
| | | } |
| | | }else if(type_id == 'datetime'){ |
| | | // |
| | | try{ |
| | | val = datetime.parse(val_str); |
| | | }catch(Exception e){ |
| | | system.debug('val_str='+val_str); |
| | | system.debug(e.getMessage()); |
| | | system.debug(e.getStackTraceString()); |
| | | try{ |
| | | val = datetime.valueOf(val_str); |
| | | }catch(Exception ee){ |
| | | system.debug('val_str='+val_str); |
| | | system.debug(ee.getMessage()); |
| | | system.debug(ee.getStackTraceString()); |
| | | continue; |
| | | } |
| | | } |
| | | }else if(type_id == 'double' || type_id == 'number'){ |
| | | try{ |
| | | val = decimal.valueOf(val_str.replace(',', '')); |
| | | }catch(Exception ee){ |
| | | system.debug('val_str='+val_str); |
| | | system.debug(ee.getMessage()); |
| | | system.debug(ee.getStackTraceString()); |
| | | continue; |
| | | } |
| | | |
| | | }else if(type_id == 'id' || type_id == 'string'){ |
| | | val = val_str; |
| | | }else{ |
| | | system.debug('type_id='+type_id+' is not support to convert'); |
| | | continue; |
| | | } |
| | | temp.put(fdm.get(new_key).QualifiedApiName,val); |
| | | }else{ |
| | | system.debug(key+' is not in fdm'); |
| | | } |
| | | } |
| | | |
| | | for(string key : temp.keySet()){ |
| | | system.debug('assign '+key+'='+temp.get(key)); |
| | | try{ |
| | | sobj.put(key, temp.get(key)); |
| | | }catch(Exception e){ |
| | | system.debug(e.getMessage()); |
| | | system.debug(e.getStackTraceString()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public class RetrievalData { |
| | | @AuraEnabled |
| | | public String Status1; |
| | | @AuraEnabled |
| | | public String Status2; |
| | | @AuraEnabled |
| | | public String RepairName; |
| | | @AuraEnabled |
| | | public String SAPRepairNo; |
| | | @AuraEnabled |
| | | public String SerialNumber; |
| | | @AuraEnabled |
| | | public String onSiteRepair; |
| | | @AuraEnabled |
| | | public String workLocationSelect; |
| | | @AuraEnabled |
| | | public String State_Hospital; |
| | | @AuraEnabled |
| | | public String HospitalName; |
| | | @AuraEnabled |
| | | public Repair__c repair; |
| | | |
| | | public RetrievalData(){ |
| | | repair = new Repair__c(); |
| | | } |
| | | } |
| | | |
| | | public class RepairData { |
| | | @AuraEnabled |
| | | public Boolean IFCheck; |
| | | @AuraEnabled |
| | | public Repair__c repair; |
| | | public RepairData(Repair__c RepairInfo){ |
| | | IFCheck = null; |
| | | repair = RepairInfo; |
| | | } |
| | | } |
| | | //2023/04/18 返回查询结果和状态 |
| | | public class ReturnData { |
| | | //判断是否有Repair的默认值 |
| | | @AuraEnabled |
| | | public Boolean status; |
| | | // @AuraEnabled |
| | | // public Repair__c repair; |
| | | //todo 报修人 |
| | | @AuraEnabled |
| | | public String AWS_Data_Id; |
| | | //医院 |
| | | @AuraEnabled |
| | | public String Hospital; |
| | | @AuraEnabled |
| | | public String Department_Class; |
| | | @AuraEnabled |
| | | public String Account; |
| | | @AuraEnabled |
| | | public String Dealer; |
| | | @AuraEnabled |
| | | public String Incharge_Staff_Contact; |
| | | @AuraEnabled |
| | | public String Incharge_Staff; |
| | | @AuraEnabled |
| | | public String RepairSubOrder; |
| | | @AuraEnabled |
| | | public String On_Call_ID; |
| | | @AuraEnabled |
| | | public String QIS_ID; |
| | | @AuraEnabled |
| | | public String InsReport; |
| | | @AuraEnabled |
| | | public String Rental_Apply_Equipment_Set_Detail; |
| | | @AuraEnabled |
| | | public String recordTypeId; |
| | | // @AuraEnabled |
| | | // public String newUrl; |
| | | |
| | | public ReturnData(){ |
| | | this.status = false; |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>54.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | .Narrow{ |
| | | padding: 20px; |
| | | } |
| | | .searchField,.searchField .input-text{ |
| | | /*display: flex;*/ |
| | | } |
| | | .searchField .slds-combobox_container{ |
| | | width: 160px !important; |
| | | } |
| New file |
| | |
| | | <template> |
| | | <!-- <div class="slds-box slds-theme--default"> |
| | | Click on the link Below to Export data as csv/xls. |
| | | <p class="slds-m-top--large"> |
| | | <a onclick={exportContactData}>Export Contact Data</a> |
| | | <lightning-button variant="brand" label="Export Contact data" title="Export Contact Data" onclick={exportContactData}></lightning-button> |
| | | </p> |
| | | </div> --> |
| | | <lightning-card variant="Narrow"> |
| | | <div style="padding: 0 20px"> |
| | | <div> |
| | | <div style="padding: 10px 3px;border-bottom: 1px solid;font: 16px;font-size: blod;">检索列</div> |
| | | <div style="margin-top: 5px"> |
| | | <lightning-layout> |
| | | <!-- cancelPaddingLeft --> |
| | | <lightning-layout-item flexibility="auto" padding="around-small"> |
| | | <lightning-combobox name="progress" label="状态1" value={searchObj.Status1} options={status1Options} |
| | | onchange={handleStatus1Change} class="searchField"></lightning-combobox> |
| | | </lightning-layout-item> |
| | | <lightning-layout-item flexibility="auto" padding="around-small"> |
| | | <lightning-combobox |
| | | name="progress" label="状态2" value={searchObj.Status2} options={status2Options} onchange={handleStatus2Change} |
| | | class="searchField"></lightning-combobox> |
| | | </lightning-layout-item> |
| | | <lightning-layout-item flexibility="auto" padding="around-small"> |
| | | <lightning-combobox |
| | | name="progress" label="服务方式" value={searchObj.onSiteRepair} options={siteRepairItems} onchange={handleSiteChange} |
| | | class="searchField"></lightning-combobox> |
| | | </lightning-layout-item> |
| | | </lightning-layout> |
| | | <lightning-layout> |
| | | <lightning-layout-item size="4" padding="horizontal-small"> |
| | | <lightning-input value={searchObj.RepairName} type="text" label="RS修理单号" class="searchField" onchange={handleRepairNameChange}></lightning-input> |
| | | </lightning-layout-item> |
| | | <lightning-layout-item size="4" padding="horizontal-small"> |
| | | <lightning-input value={searchObj.SAPRepairNo} type="text" label="SAP修理单号" class="searchField" onchange={handleSAPRepairNoChange}></lightning-input> |
| | | </lightning-layout-item> |
| | | <lightning-layout-item size="4" padding="horizontal-small"> |
| | | <lightning-input value={searchObj.workLocationSelect} type="text" label="维修中心" class="searchField" onchange={handleWorkLocationChange}></lightning-input> |
| | | </lightning-layout-item> |
| | | </lightning-layout> |
| | | <lightning-layout> |
| | | <lightning-layout-item size="4" padding="horizontal-small"> |
| | | <lightning-input value={searchObj.SerialNumber} type="text" label="机身编码" class="searchField" onchange={handleSerialNumberChange}></lightning-input> |
| | | </lightning-layout-item> |
| | | <lightning-layout-item size="4" padding="horizontal-small"> |
| | | <lightning-input value={searchObj.State_Hospital} type="text" label="省份" class="searchField" onchange={handleStateHospitalChange}></lightning-input> |
| | | </lightning-layout-item> |
| | | <lightning-layout-item size="4" padding="horizontal-small"> |
| | | <lightning-input value={searchObj.HospitalName} type="text" label="医院名称" class="searchField" onchange={handleHospitalChange}></lightning-input> |
| | | </lightning-layout-item> |
| | | </lightning-layout> |
| | | <lightning-layout> |
| | | <lightning-layout-item size="2" padding="horizontal-small"> |
| | | <lightning-input type="date" label="FSE申请日(开始)" value={repair.Aware_date__c} onchange={handleAwareDateDStart}></lightning-input> |
| | | </lightning-layout-item> |
| | | <!-- cancelPaddingLeft --> |
| | | <lightning-layout-item size="2" padding="horizontal-small"> |
| | | <!-- variant="label-hidden" --> |
| | | <lightning-input type="date" label="FSE申请日(结束)" value={repair.Aware_date2__c} onchange={handleAwareDateDEnd}></lightning-input> |
| | | </lightning-layout-item> |
| | | <lightning-layout-item size="4" padding="horizontal-small"> |
| | | <!-- record-id={recordId} 修理委托者 Incharge_Staff__c--> |
| | | <!-- <lightning-record-edit-form |
| | | object-api-name={objectApiName} |
| | | record-id='' |
| | | > |
| | | <lightning-input-field field-name={nameField} onclick={handleInchargeStaffChange}> </lightning-input-field> |
| | | </lightning-record-edit-form> --> |
| | | <lightning-record-edit-form |
| | | object-api-name='Repair__c' |
| | | record-id='' |
| | | > |
| | | <lightning-input-field field-name='Incharge_Staff__c' onclick={handleInchargeStaffChange}> </lightning-input-field> |
| | | </lightning-record-edit-form> |
| | | </lightning-layout-item> |
| | | </lightning-layout> |
| | | <lightning-layout> |
| | | <lightning-layout-item flexibility="auto" padding="around-small"> |
| | | <lightning-button label="检索" onclick={searchRepair}></lightning-button> |
| | | </lightning-layout-item> |
| | | </lightning-layout> |
| | | </div> |
| | | </div> |
| | | <div> |
| | | <div style="padding: 10px 5px;border-bottom: 1px solid">详细信息</div> |
| | | <div style="padding: 10px 0;"> |
| | | <lightning-button label="打印PDF" onclick={skipPage}></lightning-button> |
| | | |
| | | <lightning-button label="导出Excel" onclick={exportContactData}></lightning-button> |
| | | <!-- <lightning-button label="导出Excel" onclick={downloadCSVFile}></lightning-button> --> |
| | | </div> |
| | | <div> |
| | | <lightning-datatable |
| | | key-field="id" |
| | | data={data} |
| | | columns={columns} |
| | | onrowselection={getSelectedRows} |
| | | onrowaction={handleRowAction}> |
| | | |
| | | </lightning-datatable> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </lightning-card> |
| | | |
| | | </template> |
| New file |
| | |
| | | import { LightningElement,wire,track,api} from 'lwc'; |
| | | import { CurrentPageReference } from "lightning/navigation"; |
| | | import { CloseActionScreenEvent } from 'lightning/actions'; |
| | | import { NavigationMixin } from 'lightning/navigation'; |
| | | import { ShowToastEvent } from 'lightning/platformShowToastEvent'; |
| | | |
| | | import NAME_FIELD from '@salesforce/schema/Repair__c.Incharge_Staff__c'; |
| | | import MY_CUSTOM_OBJECT from '@salesforce/schema/Repair__c'; |
| | | |
| | | import search from '@salesforce/apex/lexBatchSelectRepairLWCController.search'; |
| | | import showPDF from '@salesforce/apex/lexBatchSelectRepairLWCController.showPDF'; |
| | | |
| | | /* |
| | | const actions = [ |
| | | { label: 'Show details', name: 'show_details' }, |
| | | { label: 'Delete', name: 'delete' }, |
| | | ];*/ |
| | | |
| | | const columns = [ |
| | | { label: '状态1', fieldName: 'Status1__c'}, |
| | | { label: '状态2', fieldName: 'Status2__c' }, |
| | | { label: 'RS修理单号', fieldName: 'Name' }, |
| | | { label: 'SAP修理单号', fieldName: 'SAP_Service_Repair_No__c' }, |
| | | // { label: '型号', fieldName: 'deliveredProductName' }, |
| | | { label: '型号', fieldName: 'deliveredProductUrl',type:'url', |
| | | typeAttributes:{ |
| | | label:{ |
| | | fieldName:'deliveredProductName' |
| | | }, |
| | | target:'_balank' |
| | | } |
| | | }, |
| | | { label: '机身编号', fieldName: 'SerialNumber__c' }, |
| | | { label: '医院名称', fieldName: 'HP_Name__c' }, |
| | | { label: '省份', fieldName: 'State_Hospital__c' }, |
| | | // { label: '修理委托者', fieldName: 'Incharge_Staff_Name' }, |
| | | { label: '修理委托者', fieldName: 'inchargeStaffUrl',type:'url', |
| | | typeAttributes:{ |
| | | label:{ |
| | | fieldName:'inchargeStaffName' |
| | | }, |
| | | target:'_balank' |
| | | } |
| | | }, |
| | | { label: 'FSE申请日期', fieldName: 'FSE_ApplyForRepair_Day__c' }, |
| | | { label: '维修中心', fieldName: 'work_location_select__c' }, |
| | | { label: '服务方式', fieldName: 'On_site_repair__c' }, |
| | | { label: '有无维修合同对象', fieldName: 'Number_of_EffectiveContract__c' }, |
| | | { label: '无偿区别标志', fieldName: 'NewProductGuaranteeObject__c' } |
| | | /* { |
| | | type: 'action', |
| | | typeAttributes: { rowActions: actions }, |
| | | },*/ |
| | | ]; |
| | | |
| | | export default class lexBatchSelectRepairLWC extends LightningElement { |
| | | // Expose a field to make it available in the template |
| | | nameField = NAME_FIELD; |
| | | |
| | | // Flexipage provides recordId and objectApiName |
| | | @api recordId; |
| | | @api objectApiName; |
| | | |
| | | data = []; |
| | | columns = columns; |
| | | |
| | | //状态1 |
| | | status1Options = [{ label: '--无--', value: '' }, |
| | | { label: '0.申请完毕', value: '0.申请完毕' }, |
| | | { label: '2.维修报价阶段', value: '2.维修报价阶段' }, |
| | | { label: '3.维修阶段', value: '3.维修阶段' }, |
| | | { label: '4.修理品返送阶段', value: '4.修理品返送阶段' }, |
| | | { label: '5.完毕', value: '5.完毕' }, |
| | | { label: '0.删除', value: '0.删除' }, |
| | | { label: '0.取消', value: '0.取消' }]; |
| | | //状态2 |
| | | status2Options = [{label:'00.申请完毕', value:'00.申请完毕'}, |
| | | {label:'01.分公司受理完毕', value:'01.分公司受理完毕'}, |
| | | {label:'02.RC受理完毕', value:'02.RC受理完毕'}, |
| | | {label:'03.报价检查结束', value:'03.报价检查结束'}, |
| | | {label:'04.报价跟进中', value:'04.报价跟进中'}, |
| | | {label:'05.报价同意完备', value:'05.报价同意完备'}, |
| | | {label:'06.零件齐备', value:'06.零件齐备'}, |
| | | {label:'07.修理開始', value:'07.修理開始'}, |
| | | {label:'08.修理预计完成', value:'08.修理预计完成'}, |
| | | {label:'09.修理完成', value:'09.修理完成'}, |
| | | {label:'10.最终检查完成', value:'10.最终检查完成'}, |
| | | {label:'11.RC修理品已返送', value:'11.RC修理品已返送'}, |
| | | {label:'12.发票已发送', value:'12.发票已发送'}, |
| | | {label:'13.已返送到用户', value:'13.已返送到用户'}, |
| | | {label:'14.收到验收单', value:'14.收到验收单'}, |
| | | {label:'15.验收单签收复核通过', value:'15.验收单签收复核通过'}, |
| | | {label:'16.部分付款', value:'16.部分付款'}, |
| | | {label:'16.完毕', value:'16.完毕'}, |
| | | {label:'17.付款完毕', value:'17.付款完毕'}, |
| | | {label:'00.取消', value:'00.取消'}, |
| | | {label:'00.删除', value:'00.删除'}, |
| | | {label:'00.关闭', value:'00.关闭'}]; |
| | | //服务方式 |
| | | siteRepairItems = [{label:'--无--',value:''}, |
| | | {label:'RC修理',value:'RC修理'}, |
| | | {label:'直送SORC修理',value:'直送SORC修理'}, |
| | | {label:'直送OGZ修理',value:'直送OGZ修理'}, |
| | | {label:'办事处修理',value:'办事处修理'}, |
| | | {label:'现场修理',value:'现场修理'}]; |
| | | |
| | | searchObj = {}; |
| | | repair = {}; |
| | | selectedRepairs; |
| | | |
| | | /* @wire(CurrentPageReference) |
| | | getStateParameters(currentPageReference) { |
| | | console.log(111); |
| | | console.log(currentPageReference); |
| | | |
| | | if (currentPageReference) { |
| | | const urlValue = currentPageReference.state.recordId; |
| | | if (urlValue) { |
| | | let str = `${urlValue}`; |
| | | console.log("str"); |
| | | console.log(str); |
| | | this.recordId = str; |
| | | } |
| | | } |
| | | }*/ |
| | | |
| | | connectedCallback(){ |
| | | // console.log(this.recordId); |
| | | } |
| | | //状态1 |
| | | handleStatus1Change(event){ |
| | | /*console.log(event); |
| | | console.log(event.detail);*/ |
| | | this.searchObj.Status1 = event.detail.value; |
| | | // console.log(JSON.stringify(this.searchObj)); |
| | | } |
| | | //状态2 |
| | | handleStatus2Change(event){ |
| | | this.searchObj.Status2 = event.detail.value; |
| | | // console.log(this.searchObj); |
| | | } |
| | | //服务方式 |
| | | handleSiteChange(event){ |
| | | this.searchObj.onSiteRepair = event.detail.value; |
| | | // console.log(this.searchObj); |
| | | } |
| | | //RS修理单号 RepairName |
| | | handleRepairNameChange(event){ |
| | | this.searchObj.RepairName = event.detail.value; |
| | | // console.log(this.searchObj); |
| | | } |
| | | //SAP修理单号 SAPRepairNo |
| | | handleSAPRepairNoChange(event){ |
| | | this.searchObj.SAPRepairNo = event.detail.value; |
| | | // console.log(this.searchObj); |
| | | } |
| | | //维修中心 workLocationSelect |
| | | handleWorkLocationChange(event){ |
| | | this.searchObj.workLocationSelect = event.detail.value; |
| | | } |
| | | //机身编码 SerialNumber |
| | | handleSerialNumberChange(event){ |
| | | this.searchObj.SerialNumber = event.detail.value; |
| | | } |
| | | // 省份 State_Hospital |
| | | handleStateHospitalChange(event){ |
| | | this.searchObj.State_Hospital = event.detail.value; |
| | | } |
| | | //医院名称 HospitalName |
| | | handleHospitalChange(event){ |
| | | this.searchObj.HospitalName = event.detail.value; |
| | | } |
| | | //FSE申请日 repair.Aware_date__c |
| | | handleAwareDateDStart(event){ |
| | | this.repair.Aware_date__c = event.detail.value; |
| | | console.log(this.repair.Aware_date__c); |
| | | } |
| | | // repair.Aware_date2__c |
| | | handleAwareDateDEnd(event){ |
| | | this.repair.Aware_date2__c = event.detail.value; |
| | | // console.log(this.repair.Aware_date2__c); |
| | | } |
| | | // 修理委托者 repair.Incharge_Staff__c |
| | | handleInchargeStaffChange(event){ |
| | | this.repair.Incharge_Staff__c = event.detail.value; |
| | | // console.log(this.repair.Aware_date2__c); |
| | | } |
| | | |
| | | //检索 |
| | | searchRepair(event) { |
| | | console.log(this.repair.Aware_date__c); |
| | | if (JSON.stringify(this.repair) != "{}") { |
| | | console.log('this.repair'); |
| | | this.searchObj.repair = this.repair; |
| | | // fse 时间条件 |
| | | /*if (!(this.repair.Aware_date__c != null && this.repair.Aware_date2__c != null) || this.repair.Aware_date__c > this.repair.Aware_date2__c) { |
| | | const event = new ShowToastEvent({ |
| | | title: 'error', |
| | | message: 'FSE申请日输入有误', |
| | | variant:'error', |
| | | }); |
| | | this.dispatchEvent(event); |
| | | return; |
| | | }*/ |
| | | } |
| | | let jsonStr = JSON.stringify(this.searchObj); |
| | | if (jsonStr === "{}") { |
| | | const event = new ShowToastEvent({ |
| | | title: 'error', |
| | | message: '请至少添加一个检索条件!', |
| | | variant:'error', |
| | | }); |
| | | this.dispatchEvent(event); |
| | | }else{ |
| | | console.log(jsonStr); |
| | | search({ |
| | | json: jsonStr |
| | | }).then(result => { |
| | | console.log(result.repairData); |
| | | console.log('length:'+result.repairData.length); |
| | | if (result.repairData.length == 0 || result.repairData.length == 200) { |
| | | const event = new ShowToastEvent({ |
| | | title: 'warning', |
| | | message: result.status, |
| | | variant:'warning', |
| | | }); |
| | | this.dispatchEvent(event); |
| | | } |
| | | let returnArr = []; |
| | | result.repairData.forEach(function(v){ |
| | | let objRepair = v.repair; |
| | | //添加修理委托者和型号名称 |
| | | objRepair.deliveredProductName = objRepair.Delivered_Product__r.Name; |
| | | objRepair.deliveredProductUrl = "/"+objRepair.Delivered_Product__c; |
| | | objRepair.inchargeStaffName = objRepair.Incharge_Staff__r.Name; |
| | | objRepair.inchargeStaffUrl = "/"+objRepair.Incharge_Staff__c; |
| | | // console.log(objRepair); |
| | | returnArr.push(objRepair); |
| | | }); |
| | | /*console.log('arr'); |
| | | console.log(arr); |
| | | console.log(arr.length);*/ |
| | | this.data = returnArr; |
| | | // console.log(this.data); |
| | | }).catch(error => { |
| | | console.log("error"); |
| | | console.log(error); |
| | | }).finally(() => { |
| | | |
| | | }); |
| | | } |
| | | |
| | | |
| | | } |
| | | //导出为Excel 画table |
| | | exportContactData(){ |
| | | // Prepare a html table |
| | | let doc = '<table>'; |
| | | // Add styles for the table |
| | | doc += '<style>'; |
| | | doc += 'table, th, td {'; |
| | | doc += ' border: 1px solid black;'; |
| | | doc += ' border-collapse: collapse;'; |
| | | doc += '}'; |
| | | doc += '</style>'; |
| | | // Add all the Table Headers |
| | | doc += '<tr>'; |
| | | this.columns.forEach(element => { |
| | | doc += '<th>'+ element.label +'</th>' |
| | | }); |
| | | doc += '</tr>'; |
| | | // Add the data rows |
| | | let fieldNameArr =[]; |
| | | this.columns.forEach(function(v){ |
| | | if (v['typeAttributes']) { |
| | | fieldNameArr.push(v['typeAttributes'].label.fieldName); |
| | | }else{ |
| | | fieldNameArr.push(v.fieldName); |
| | | } |
| | | }); |
| | | console.log(fieldNameArr); |
| | | fieldNameArr.forEach(v=>{ |
| | | console.log(v); |
| | | // console.log(this.data[0].v); |
| | | }) |
| | | this.data.forEach(record => { |
| | | doc += '<tr>'; |
| | | if (record.Status1__c != null) { |
| | | doc += '<th>'+record.Status1__c+'</th>'; |
| | | }else{ |
| | | doc += '<th></th>' |
| | | } |
| | | if (record.Status2__c != null) { |
| | | doc += '<th>'+record.Status2__c+'</th>'; |
| | | }else{ |
| | | doc += '<th></th>' |
| | | } |
| | | if (record.Name != null) { |
| | | doc += '<th>'+record.Name+'</th>'; |
| | | }else{ |
| | | doc += '<th></th>' |
| | | } |
| | | if (record.SAP_Service_Repair_No__c != null) { |
| | | doc += '<th>'+record.SAP_Service_Repair_No__c+'</th>'; |
| | | }else{ |
| | | doc += '<th></th>' |
| | | } |
| | | if (record.deliveredProductName != null) { |
| | | doc += '<th>'+record.deliveredProductName+'</th>'; |
| | | }else{ |
| | | doc += '<th></th>' |
| | | } |
| | | if (record.SerialNumber__c != null) { |
| | | doc += '<th>'+record.SerialNumber__c+'</th>'; |
| | | }else{ |
| | | doc += '<th></th>' |
| | | } |
| | | if (record.HP_Name__c != null) { |
| | | doc += '<th>'+record.HP_Name__c+'</th>'; |
| | | }else{ |
| | | doc += '<th></th>' |
| | | } |
| | | if (record.State_Hospital__c != null) { |
| | | doc += '<th>'+record.State_Hospital__c+'</th>'; |
| | | }else{ |
| | | doc += '<th></th>' |
| | | } |
| | | if (record.inchargeStaffName != null) { |
| | | doc += '<th>'+record.inchargeStaffName+'</th>'; |
| | | }else{ |
| | | doc += '<th></th>' |
| | | } |
| | | if (record.FSE_ApplyForRepair_Day__c != null) { |
| | | doc += '<th>'+record.FSE_ApplyForRepair_Day__c+'</th>'; |
| | | }else{ |
| | | doc += '<th></th>' |
| | | } |
| | | if (record.work_location_select__c != null) { |
| | | doc += '<th>'+record.work_location_select__c+'</th>'; |
| | | }else{ |
| | | doc += '<th></th>' |
| | | } |
| | | if (record.On_site_repair__c != null) { |
| | | doc += '<th>'+record.On_site_repair__c+'</th>'; |
| | | }else{ |
| | | doc += '<th></th>' |
| | | } |
| | | if (record.Number_of_EffectiveContract__c != null) { |
| | | doc += '<th>'+record.Number_of_EffectiveContract__c+'</th>'; |
| | | }else{ |
| | | doc += '<th></th>' |
| | | } |
| | | if (record.NewProductGuaranteeObject__c != null) { |
| | | doc += '<th>'+record.NewProductGuaranteeObject__c+'</th>'; |
| | | }else{ |
| | | doc += '<th></th>' |
| | | } |
| | | // fieldNameArr.forEach(fieldName =>{ |
| | | // doc += '<th>'+record.fieldName+'</th>'; |
| | | // }); |
| | | doc += '</tr>'; |
| | | }); |
| | | doc += '</table>'; |
| | | var element = 'data:application/vnd.ms-excel,' + encodeURIComponent(doc); |
| | | let downloadElement = document.createElement('a'); |
| | | downloadElement.href = element; |
| | | downloadElement.target = '_self'; |
| | | // use .csv as extension on below line if you want to export data as csv |
| | | downloadElement.download = '修理明细表.xls'; |
| | | document.body.appendChild(downloadElement); |
| | | downloadElement.click(); |
| | | } |
| | | |
| | | // this method validates the data and creates the csv file to download this.data的所有字段 |
| | | downloadCSVFile1() { |
| | | console.log("downloadCSVFile1"); |
| | | let rowEnd = '\n'; |
| | | let csvString = ''; |
| | | // this set elminates the duplicates if have any duplicate keys |
| | | let rowData = new Set(); |
| | | let columnsData = new Set(); |
| | | let columnsLabelData = new Set(); |
| | | |
| | | // getting keys from data |
| | | this.data.forEach(function (record) { |
| | | Object.keys(record).forEach(function (key) { |
| | | rowData.add(key); |
| | | }); |
| | | }); |
| | | console.log(rowData); |
| | | |
| | | // Array.from() method returns an Array object from any object with a length property or an iterable object. |
| | | rowData = Array.from(rowData); |
| | | console.log(rowData); |
| | | |
| | | // splitting using ',' |
| | | csvString += rowData.join(','); |
| | | csvString += rowEnd; |
| | | console.log(csvString); |
| | | this.columns.forEach(function(v){ |
| | | columnsLabelData.add(v.label); |
| | | if (v['typeAttributes']) { |
| | | columnsData.add(v['typeAttributes'].label.fieldName); |
| | | }else{ |
| | | columnsData.add(v.fieldName); |
| | | } |
| | | }); |
| | | console.log("columnsData"); |
| | | console.log(columnsLabelData); |
| | | console.log(columnsData); |
| | | console.log(rowData[1]); |
| | | console.log(Array.from(columnsData)); |
| | | console.log(Array.from(columnsData).hasOwnProperty(rowData[1])); |
| | | console.log(this.data[0].Name); |
| | | console.log(this.data[0][rowData[1]]); |
| | | // main for loop to get the data based on key value |
| | | for(let i=0; i < this.data.length; i++){ |
| | | let colValue = 0; |
| | | |
| | | // validating keys in data |
| | | for(let key in rowData) { |
| | | if(rowData.hasOwnProperty(key)) { |
| | | // Key value |
| | | // Ex: Id, Name |
| | | let rowKey = rowData[key]; |
| | | // add , after every value except the first. |
| | | if(colValue > 0){ |
| | | csvString += ','; |
| | | } |
| | | // If the column is undefined, it as blank in the CSV file. |
| | | let value = this.data[i][rowKey] === undefined ? '' : this.data[i][rowKey]; |
| | | csvString += '"'+ value +'"'; |
| | | colValue++; |
| | | } |
| | | } |
| | | csvString += rowEnd; |
| | | } |
| | | |
| | | // Creating anchor element to download |
| | | let downloadElement = document.createElement('a'); |
| | | |
| | | // This encodeURI encodes special characters, except: , / ? : @ & = + $ # (Use encodeURIComponent() to encode these characters). |
| | | downloadElement.href = 'data:text/csv;charset=utf-8,' + encodeURI(csvString); |
| | | downloadElement.target = '_self'; |
| | | // CSV File Name |
| | | downloadElement.download = 'Account Data.csv'; |
| | | // below statement is required if you are using firefox browser |
| | | document.body.appendChild(downloadElement); |
| | | // click() Javascript function to download CSV file |
| | | downloadElement.click(); |
| | | } |
| | | //导出为Excel |
| | | downloadCSVFile() { |
| | | console.log("downloadCSVFile"); |
| | | let rowEnd = '\n'; |
| | | let csvString = ''; |
| | | // this set elminates the duplicates if have any duplicate keys |
| | | //表格标题 |
| | | let columnsData = new Set(); |
| | | //表格字段 |
| | | let rowData = new Set(); |
| | | |
| | | // getting keys from data |
| | | this.columns.forEach(function(v){ |
| | | columnsData.add(v.label); |
| | | if (v['typeAttributes']) { |
| | | rowData.add(v['typeAttributes'].label.fieldName); |
| | | }else{ |
| | | rowData.add(v.fieldName); |
| | | } |
| | | }); |
| | | console.log(columnsData); |
| | | console.log(rowData); |
| | | // Array.from() method returns an Array object from any object with a length property or an iterable object. |
| | | rowData = Array.from(rowData); |
| | | columnsData = Array.from(columnsData); |
| | | // getting keys from data |
| | | /* console.log("rowData"); |
| | | rowData.forEach(function(v){ |
| | | console.log(v); |
| | | }); |
| | | console.log("columnsData"); |
| | | columnsData.forEach(function(v){ |
| | | console.log(v); |
| | | }); */ |
| | | |
| | | // splitting using ',' |
| | | csvString += columnsData.join(','); |
| | | csvString += rowEnd; |
| | | // console.log(csvString); |
| | | // main for loop to get the data based on key value |
| | | for(let i=0; i < this.data.length; i++){ |
| | | let colValue = 0; |
| | | |
| | | // validating keys in data |
| | | for(let key in rowData) { |
| | | if(rowData.hasOwnProperty(key)) {//del |
| | | // Key value |
| | | // Ex: Id, Name |
| | | let rowKey = rowData[key]; |
| | | // add , after every value except the first. |
| | | if(colValue > 0){ |
| | | csvString += ','; |
| | | } |
| | | // If the column is undefined, it as blank in the CSV file. |
| | | let value = this.data[i][rowKey] === undefined ? '' : this.data[i][rowKey]; |
| | | csvString += '"'+ value +'"'; |
| | | colValue++; |
| | | } |
| | | } |
| | | csvString += rowEnd; |
| | | } |
| | | |
| | | // Creating anchor element to download |
| | | let downloadElement = document.createElement('a'); |
| | | |
| | | // This encodeURI encodes special characters, except: , / ? : @ & = + $ # (Use encodeURIComponent() to encode these characters). |
| | | downloadElement.href = 'data:text/csv;charset=utf-8,' + encodeURI(csvString); |
| | | downloadElement.target = '_self'; |
| | | // CSV File Name |
| | | downloadElement.download = '修理明细表.csv'; |
| | | // below statement is required if you are using firefox browser |
| | | document.body.appendChild(downloadElement); |
| | | // click() Javascript function to download CSV file |
| | | downloadElement.click(); |
| | | } |
| | | //获取选中Repair |
| | | getSelectedRows(event) { |
| | | const selectedRows = event.detail.selectedRows; |
| | | console.log(selectedRows); |
| | | //Repair__c selectedRepairs |
| | | // Display that fieldName of the selected rows |
| | | let selectedRepairsArr = []; |
| | | for (let i = 0; i < selectedRows.length; i++) { |
| | | selectedRepairsArr.push(selectedRows[i]); |
| | | } |
| | | this.selectedRepairs = selectedRepairsArr; |
| | | } |
| | | |
| | | //跳转到pdf页面 |
| | | skipPage() { |
| | | console.log("selectedRows"); |
| | | // console.log(jsonStr); |
| | | if (this.selectedRepairs.length <= 0 ) { |
| | | const event = new ShowToastEvent({ |
| | | title: 'error', |
| | | message: '请至少选择一个修理', |
| | | variant:'error', |
| | | }); |
| | | this.dispatchEvent(event); |
| | | return; |
| | | } |
| | | let jsonStr = JSON.stringify(this.selectedRepairs); |
| | | showPDF({ |
| | | json: jsonStr |
| | | }).then(result => { |
| | | console.log(result); |
| | | if (result.indexOf("https://ocsm") != -1) { |
| | | window.open(result, "维修委托书PDF", ""); |
| | | }else{ |
| | | const event = new ShowToastEvent({ |
| | | title: 'error', |
| | | message: result, |
| | | variant:'error', |
| | | }); |
| | | this.dispatchEvent(event); |
| | | } |
| | | }).catch(error => { |
| | | console.log("error"); |
| | | console.log(error); |
| | | }).finally(() => { |
| | | |
| | | }); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?xml version="1.0"?> |
| | | <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>54.0</apiVersion> |
| | | <isExposed>true</isExposed> |
| | | <targets> |
| | | <target>lightning__RecordPage</target> |
| | | <target>lightning__AppPage</target> |
| | | <target>lightning__HomePage</target> |
| | | <target>lightning__RecordAction</target> |
| | | </targets> |
| | | </LightningComponentBundle> |
| New file |
| | |
| | | <template> |
| | | </template> |
| New file |
| | |
| | | import { LightningElement, api, track, wire } from 'lwc'; |
| | | import init from '@salesforce/apex/lexCustomDeleteController.initForCustomDelete'; |
| | | import {CurrentPageReference} from 'lightning/navigation' |
| | | import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner'; |
| | | import { ShowToastEvent } from 'lightning/platformShowToastEvent'; |
| | | import deleteRepair from '@salesforce/apex/ControllerUtil.deleteRepair'; |
| | | |
| | | export default class lexCustomDeleteLWC extends LightningElement { |
| | | |
| | | |
| | | @api recordId; |
| | | @api message; |
| | | |
| | | @track Status ; |
| | | @track FSE ; |
| | | @track SAP; |
| | | @track cre ; |
| | | @track Rep ; |
| | | @track acc ; |
| | | @track fSE ; |
| | | @track id; |
| | | @track rtn; |
| | | |
| | | |
| | | @wire(CurrentPageReference) |
| | | getStateParameters(currentPageReference){ |
| | | console.log(111); |
| | | console.log(currentPageReference); |
| | | if(currentPageReference){ |
| | | const urlValue=currentPageReference.state.recordId; |
| | | if(urlValue){ |
| | | let str='${urlValue}'; |
| | | console.log("str"); |
| | | console.log(str); |
| | | this.recordId=str; |
| | | } |
| | | } |
| | | } |
| | | connectedCallback(){ |
| | | console.log(this.recordId); |
| | | init({ |
| | | recordId:this.recordId |
| | | }).then(result=>{ |
| | | console.log(result); |
| | | if(result!=null){ |
| | | this.FSE=result.FSEApplyForRepairtime; |
| | | this.Rep=result.Rep; |
| | | this.SAP=result.SAP; |
| | | this.Status=result.Status; |
| | | this.acc=result.acc; |
| | | this.id=result.Id; |
| | | this.cre=result.cre; |
| | | this.fSE=result.FSEownerId; |
| | | console.log("end"); |
| | | this.handleDeleteAction(); |
| | | console.log("end2"); |
| | | |
| | | } |
| | | }) |
| | | } |
| | | |
| | | handleDeleteAction(){ |
| | | if (this.Status != null && this.Status.length > 0) { |
| | | if (this.Status != "草案中"&& this.Status != "1.受理完毕(SAP待发送)"&& this.Status != "4.修理品返送阶段") { |
| | | this.message = "不是草案中,不能删除"; |
| | | const event = new ShowToastEvent({ |
| | | title: 'error', |
| | | variant:'error', |
| | | message: |
| | | this.message, |
| | | }); |
| | | this.dispatchEvent(event); |
| | | } |
| | | else if (this.Status == "0.申请完毕"&& (this.FSE != "")) { |
| | | message = "FSE已经申请,不能删除"; |
| | | console.log('***action4'); |
| | | |
| | | const event = new ShowToastEvent({ |
| | | title: 'warning', |
| | | message: |
| | | this.message, |
| | | }); |
| | | this.dispatchEvent(event); |
| | | } |
| | | else if (this.Status == "4.修理品返送阶段"&& (this.SAP != "" || this.Rep!= "")){ |
| | | message = "已经发送过SAP,不能删除"; |
| | | const event = new ShowToastEvent({ |
| | | title: 'warning', |
| | | message: |
| | | this.message, |
| | | }); |
| | | this.dispatchEvent(event); |
| | | } |
| | | else if (UserInfo_Owner.Id.substring(0,15) != this.cre.substring(0,15) && UserInfo_Owner.Id.substring(0,15) != this.acc.substring(0,15)&& UserInfo_Owner.Id.substring(0,15) != this.fSE.substring(0,15)) { |
| | | message = "不是所有人、创建人或FSE主负责人,不能删除"; |
| | | const event = new ShowToastEvent({ |
| | | title: 'warning', |
| | | message: |
| | | this.message, |
| | | }); |
| | | this.dispatchEvent(event); |
| | | } |
| | | else { |
| | | |
| | | // sforce.connection.sessionId = '{!$Api.Session_ID}'; |
| | | // var rtn=sforce.apex.execute("ControllerUtil","deleteRepair",{rid:this.id}); |
| | | deleteRepair({ |
| | | rid:this.id |
| | | }).then(result=>{ |
| | | console.log(result); |
| | | if(result!=null){ |
| | | this.rtn=result; |
| | | } |
| | | }) |
| | | |
| | | if (this.rtn == "OK") { |
| | | reload(); |
| | | } else { |
| | | alert(this.rtn); |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | function reload(){ |
| | | var str=""; |
| | | if(getParam('retURL')!==null){ |
| | | str +=getParam('retURL'); |
| | | } |
| | | window.open(str,'_self'); |
| | | } |
| | | |
| | | function getParam(paramName) { |
| | | paramValue = "", isFound = !1; |
| | | if (this.location.search.indexOf("?") == 0 && this.location.search.indexOf("=") > 1) { |
| | | arrSource = unescape(this.location.search).substring(1, this.location.search.length).split("&"), i = 0; |
| | | while (i < arrSource.length && !isFound) arrSource[i].indexOf("=") > 0 && arrSource[i].split("=")[0].toLowerCase() == paramName.toLowerCase() && (paramValue = arrSource[i].split("=")[1], isFound = !0), i++ |
| | | } |
| | | return paramValue == "" && (paramValue = null), paramValue |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="customDelete"> |
| | | <apiVersion>56.0</apiVersion> |
| | | <isExposed>true</isExposed> |
| | | </LightningComponentBundle> |
| New file |
| | |
| | | .exampleHolder{ |
| | | position: relative; |
| | | top: 0; |
| | | width: 0; |
| | | left: 0; |
| | | right: 0; |
| | | margin: 0 auto; |
| | | } |
| | | .repairTitle{ |
| | | --slds-c-accordion-heading-font-size: 1.05rem; |
| | | --slds-c-accordion-summary-color-background:#f3f3f3; |
| | | } |
| New file |
| | |
| | | <template> |
| | | <div class="exampleHolder" if:true={isLoading}> |
| | | <lightning-spinner alternative-text="Loading" size="small"></lightning-spinner> |
| | | </div> |
| | | <div class="newRepair"> |
| | | <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-2"> |
| | | <!-- onsectiontoggle={handleSectionToggle} --> |
| | | <lightning-accordion allow-multiple-sections-open="true" |
| | | active-section-name={activeSections}> |
| | | <!-- Repair__c --> |
| | | <lightning-record-edit-form onload={handleRecordEditFormLoad} onsubmit={handleSubmit} onsuccess={handleSucess} onerror={handleError} object-api-name='{objectName}' record-type-id={recordTypeId} record-id={recordIdStr}> |
| | | <lightning-messages></lightning-messages> |
| | | <template if:true={uiPageLayoutView}> |
| | | <lightning-layout multiple-rows="true"> |
| | | <lightning-layout-item size="12"> |
| | | <!-- active-section-name={activeSections} --> |
| | | |
| | | <template for:each={uiPageLayoutView.sections} for:item="section"> |
| | | <lightning-accordion-section name={section.id} key={section.id} label={section.heading} class="repairTitle"> |
| | | <lightning-layout multiple-rows="true" style="margin-top: 10px;"> |
| | | <template for:each={section.layoutRows} for:item="layoutRow"> |
| | | <template for:each={layoutRow.layoutItems} for:item="layoutItem"> |
| | | <template for:each={layoutItem.layoutComponents} for:item="layoutComponent"> |
| | | <lightning-layout-item key={layoutComponent.apiName} size="6" padding="horizontal-small"> |
| | | <template if:true={layoutItem.editableForNew}> |
| | | <lightning-input-field data-fieldname={layoutComponent.apiName} |
| | | field-name={layoutComponent.apiName} name={layoutComponent.apiName} required={layoutItem.required}> |
| | | </lightning-input-field> |
| | | </template> |
| | | <!-- <template if:false={layoutItem.editableForNew}> --> |
| | | <!-- 修理受付番号 --> |
| | | <!-- <template if:true={layoutComponent.apiName}> |
| | | <lightning-output-field field-name={layoutComponent.apiName}> |
| | | </lightning-output-field> |
| | | </template> --> |
| | | <!-- </template> --> |
| | | </lightning-layout-item> |
| | | </template> |
| | | </template> |
| | | </template> |
| | | </lightning-layout> |
| | | </lightning-accordion-section> |
| | | </template> |
| | | </lightning-layout-item> |
| | | </lightning-layout> |
| | | </template> |
| | | <lightning-messages></lightning-messages> |
| | | <div class="" style="text-align: center;"> |
| | | <lightning-button |
| | | label="取消" |
| | | onclick={handleCancel} |
| | | ></lightning-button> |
| | | <lightning-button |
| | | type="submit" |
| | | name="save" |
| | | label="保存" |
| | | style="margin-left: 10px;" |
| | | ></lightning-button> |
| | | <lightning-button if:true={hasRecordId} |
| | | name="saveAndNew" |
| | | type="submit" |
| | | label="保存并新建" |
| | | onclick={handleSubmitAndNew} |
| | | style="margin-left: 10px;" |
| | | ></lightning-button> |
| | | </div> |
| | | </lightning-record-edit-form> |
| | | </lightning-accordion> |
| | | </div> |
| | | <!-- <div class="footer-background-class"> |
| | | <div class="slds-align_absolute-center slds-p-around_xx-small"> |
| | | <lightning-button class="slds-m-around_xx-small" |
| | | title="Cancel" label="Cancel" |
| | | onclick={closeNewObjectModal}> |
| | | </lightning-button> |
| | | <lightning-button variant="brand" title="Save" |
| | | onclick={submitRecordForm} name="Save" label="Save"> |
| | | </lightning-button> |
| | | </div> |
| | | </div> --> |
| | | </div> |
| | | <!-- a0J0l00000Ep9XHEAZ --> |
| | | <!-- <lightning-record-edit-form record-id="" object-api-name='{objectName}'> |
| | | <lightning-input-field field-name="Delivered_Product__c"> </lightning-input-field> |
| | | <lightning-button |
| | | class="slds-m-top_small" |
| | | variant="brand" |
| | | type="submit" |
| | | label="Update" |
| | | > |
| | | </lightning-button> |
| | | </lightning-record-edit-form> --> |
| | | </template> |
| New file |
| | |
| | | import { LightningElement,wire,track,api} from 'lwc'; |
| | | import { CurrentPageReference } from "lightning/navigation"; |
| | | import { CloseActionScreenEvent } from 'lightning/actions'; |
| | | import { NavigationMixin } from 'lightning/navigation'; |
| | | import { ShowToastEvent } from 'lightning/platformShowToastEvent'; |
| | | |
| | | import init from '@salesforce/apex/lexNewRepairAuraController.init'; |
| | | |
| | | export default class lexNewRepairLWC extends NavigationMixin(LightningElement) { |
| | | |
| | | // Flexipage provides recordId |
| | | @api recordId; |
| | | // @api recordId; |
| | | @api urlStr; |
| | | @api objectApiName; |
| | | |
| | | /* @wire(CurrentPageReference) |
| | | getStateParameters(currentPageReference) { |
| | | console.log(111); |
| | | console.log(currentPageReference); |
| | | |
| | | if (currentPageReference) { |
| | | const urlValue = currentPageReference.state.recordId; |
| | | if (urlValue) { |
| | | let str = `${urlValue}`; |
| | | console.log("str"); |
| | | console.log(str); |
| | | this.recordId = str; |
| | | } |
| | | } |
| | | }*/ |
| | | |
| | | objectName = 'Repair__c'; |
| | | uiPageLayoutView; |
| | | isNewMode; |
| | | //属性默认值 |
| | | defaultValue = {}; |
| | | isLoading = true; |
| | | activeSections; |
| | | isSaveAndNew = false; |
| | | //更新操作时 不显示保存新建 |
| | | hasRecordId = false; |
| | | recordIdStr; |
| | | recordTypeId = ''; |
| | | |
| | | connectedCallback(){ |
| | | console.log(this.recordId); |
| | | console.log(JSON.parse(this.urlStr)); |
| | | if (!this.recordId) { |
| | | this.hasRecordId = true; |
| | | // urlStr 传参处理 |
| | | let urlObj = JSON.parse(this.urlStr); |
| | | if (urlObj.hasOwnProperty("CF00N10000009H1rR_lkid") || urlObj.hasOwnProperty("retURL") ) { |
| | | console.log('urlObj.hasOwnProperty:',urlObj); |
| | | // init 向Controller发送请求获取数据 |
| | | init({ |
| | | recordId : this.recordId,urlStr : this.urlStr |
| | | }).then(result => { |
| | | console.log("result"); |
| | | console.log(result); |
| | | this.defaultValue = result; |
| | | //返回结果赋值 |
| | | if (result.status) { |
| | | this.recordTypeId = result.recordTypeId; |
| | | } |
| | | }).catch(error => { |
| | | console.log("error"); |
| | | console.log(error); |
| | | }).finally(() => { |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | //获取Layout字段 |
| | | handleRecordEditFormLoad(event) { |
| | | if (event.detail.layout == undefined) { |
| | | return; |
| | | } |
| | | console.log('Layout => ', JSON.stringify(event.detail.layout)); |
| | | this.uiPageLayoutView = event.detail.layout; |
| | | console.log('Layout1 => ',this.uiPageLayoutView); |
| | | |
| | | //页面内容初始化 del |
| | | //to del ! err: Delivered_Product 02i10000004tNXIAA2 Hospital 0011000001g11rDAAQ |
| | | // this.defaultValue['Delivered_Product'] = '02i10000004tMKgAAM'; |
| | | // // this.defaultValue['Delivered_Product'] = '02i10000004tNXIAA2'; |
| | | // this.defaultValue['Account'] = '0011000001g11rDAAQ'; |
| | | // this.defaultValue['SalesOfficeCode_selection'] = '北京'; |
| | | // this.defaultValue['On_site_repair'] = 'RC修理'; |
| | | // this.defaultValue['Repair_Detail'] = 'testLwcSaveAndNew'; |
| | | // this.defaultValue['Hospital'] = '0011000001g0R8vAAE'; |
| | | // // this.defaultValue['Hospital'] = '0011000001g11rDAAQ'; |
| | | // // 0011000000V9SG5AAN |
| | | // this.defaultValue['work_location_select'] = '北京办事处'; |
| | | |
| | | const inputFields = this.template.querySelectorAll('lightning-input-field'); |
| | | if (inputFields) { |
| | | inputFields.forEach(field => { |
| | | let fieldName = field.name.replace("__c",""); |
| | | if (this.defaultValue.hasOwnProperty(fieldName)) { |
| | | field.value= this.defaultValue[fieldName]; |
| | | } |
| | | }); |
| | | } |
| | | |
| | | let checkedSections = new Set(); |
| | | if (this.uiPageLayoutView.sections.length > 0) { |
| | | for(const tabs of this.uiPageLayoutView.sections){ |
| | | checkedSections.add(tabs.id); |
| | | } |
| | | this.activeSections = Array.from(checkedSections); |
| | | } |
| | | this.isLoading = false; |
| | | this.recordIdStr = this.recordId; |
| | | |
| | | } |
| | | //保存 保存新建提交事件 |
| | | handleSubmit(event){ |
| | | this.isLoading = true; |
| | | console.log("handleSubmit"); |
| | | event.preventDefault(); // stop the form from submitting |
| | | const fields = event.detail.fields; |
| | | /*console.log("fields"); |
| | | console.log(fields);*/ |
| | | this.template.querySelector('lightning-record-edit-form').submit(fields); |
| | | // console.log("success"); |
| | | } |
| | | handleSubmitAndNew(event){ |
| | | this.isSaveAndNew = true; |
| | | } |
| | | //成功后跳转 |
| | | handleSucess(event){ |
| | | // console.log("handleSucess"); |
| | | const updatedRecord = event.detail.id; |
| | | console.log('onsuccess: ', updatedRecord); |
| | | if (this.isSaveAndNew) { |
| | | // console.log("isSaveAndNew"); |
| | | window.location.reload(); |
| | | }else if (event.detail.id) { |
| | | // console.log("NavigationMixin"); |
| | | this[NavigationMixin.Navigate]({ |
| | | type:'standard__recordPage', |
| | | attributes:{ |
| | | recordId:updatedRecord, |
| | | objectApiName:this.objectName, |
| | | actionName:'view' |
| | | } |
| | | }); |
| | | } |
| | | this.isLoading = false; |
| | | } |
| | | //对象验证,属性验证 |
| | | handleError(event) { |
| | | console.log("handleError event"); |
| | | console.log(JSON.stringify(event.detail)); |
| | | } |
| | | handleCancel(event) { |
| | | window.location.href = "https://ocsm--partial.sandbox.lightning.force.com/lightning/o/Repair__c/list?filterName=Recent&0.source=alohaHeader"; |
| | | } |
| | | |
| | | |
| | | showToast(theTitle, theMessage, theVariant) { |
| | | const event = new ShowToastEvent({ |
| | | title: theTitle, |
| | | message: theMessage, |
| | | variant: theVariant |
| | | }); |
| | | this.dispatchEvent(event); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?xml version="1.0"?> |
| | | <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>54.0</apiVersion> |
| | | <isExposed>true</isExposed> |
| | | <targets> |
| | | <target>lightning__RecordPage</target> |
| | | <target>lightning__AppPage</target> |
| | | <target>lightning__HomePage</target> |
| | | <target>lightning__RecordAction</target> |
| | | </targets> |
| | | </LightningComponentBundle> |