denny chen
2023-04-24 eb179da9323a4ef85b6146660d0384f11e8f6696
页面描述(删除修理)-对象(修理)
16个文件已添加
1个文件已修改
923 ■■■■■ 已修改文件
force-app/main/default/aura/lexCustomDeleteAura/lexCustomDeleteAura.auradoc 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/lexCustomDeleteAura/lexCustomDeleteAura.cmp 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/lexCustomDeleteAura/lexCustomDeleteAura.cmp-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/lexCustomDeleteAura/lexCustomDeleteAura.css 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/lexCustomDeleteAura/lexCustomDeleteAura.design 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/lexCustomDeleteAura/lexCustomDeleteAura.svg 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/lexCustomDeleteAura/lexCustomDeleteAuraController.js 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/lexCustomDeleteAura/lexCustomDeleteAuraHelper.js 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/lexCustomDeleteAura/lexCustomDeleteAuraRenderer.js 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/ControllerUtil.cls 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/TaskFeedbackController.cls 659 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/TaskFeedbackController.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/lexCustomDeleteController.cls 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/lexCustomDeleteController.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCustomDeleteLWC/lexCustomDeleteLWC.html 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCustomDeleteLWC/lexCustomDeleteLWC.js 144 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCustomDeleteLWC/lexCustomDeleteLWC.js-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/lexCustomDeleteAura/lexCustomDeleteAura.auradoc
New file
@@ -0,0 +1,6 @@
<aura:documentation>
    <aura:description>Documentation</aura:description>
    <aura:example name="ExampleName" ref="exampleComponentName" label="Label">
        Example Description
    </aura:example>
</aura:documentation>
force-app/main/default/aura/lexCustomDeleteAura/lexCustomDeleteAura.cmp
New file
@@ -0,0 +1,9 @@
<!-- <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>
force-app/main/default/aura/lexCustomDeleteAura/lexCustomDeleteAura.cmp-meta.xml
New file
@@ -0,0 +1,5 @@
<?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>
force-app/main/default/aura/lexCustomDeleteAura/lexCustomDeleteAura.css
New file
@@ -0,0 +1,2 @@
.THIS {
}
force-app/main/default/aura/lexCustomDeleteAura/lexCustomDeleteAura.design
New file
@@ -0,0 +1,3 @@
<design:component >
</design:component>
force-app/main/default/aura/lexCustomDeleteAura/lexCustomDeleteAura.svg
New file
@@ -0,0 +1,7 @@
<?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>
force-app/main/default/aura/lexCustomDeleteAura/lexCustomDeleteAuraController.js
New file
@@ -0,0 +1,10 @@
({
    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();
    }
})
force-app/main/default/aura/lexCustomDeleteAura/lexCustomDeleteAuraHelper.js
New file
@@ -0,0 +1,5 @@
({
    helperMethod : function() {
    }
})
force-app/main/default/aura/lexCustomDeleteAura/lexCustomDeleteAuraRenderer.js
New file
@@ -0,0 +1,5 @@
({
// Your renderer method overrides go here
})
force-app/main/default/classes/ControllerUtil.cls
@@ -4951,6 +4951,7 @@
        insert log;
    }
    
    @AuraEnabled
    WebService static String deleteRepair(String rid) {
        try {
            Repair__c r = new Repair__c(Id = rid);
@@ -5551,7 +5552,7 @@
        
        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>();
force-app/main/default/classes/TaskFeedbackController.cls
New file
@@ -0,0 +1,659 @@
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
    }
}
force-app/main/default/classes/TaskFeedbackController.cls-meta.xml
New file
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>41.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/classes/lexCustomDeleteController.cls
New file
@@ -0,0 +1,48 @@
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;
    }
}
force-app/main/default/classes/lexCustomDeleteController.cls-meta.xml
New file
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>56.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/lwc/lexCustomDeleteLWC/lexCustomDeleteLWC.html
New file
@@ -0,0 +1,2 @@
<template>
</template>
force-app/main/default/lwc/lexCustomDeleteLWC/lexCustomDeleteLWC.js
New file
@@ -0,0 +1,144 @@
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
}
}
}
force-app/main/default/lwc/lexCustomDeleteLWC/lexCustomDeleteLWC.js-meta.xml
New file
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="customDelete">
    <apiVersion>56.0</apiVersion>
    <isExposed>true</isExposed>
</LightningComponentBundle>