19626
2023-03-29 a2409429cc017633ae38d3f2d144753331b77f03
陈京武修改按钮(更新至2023.3.29)
20个文件已添加
6761 ■■■■■ 已修改文件
force-app/main/default/classes/ControllerUtil.cls 5828 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/ControllerUtil.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/ReportController.cls 525 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/ReportController.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.css 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.js 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.css 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.js 97 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.css 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.js 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.css 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.js 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/ControllerUtil.cls
New file
Diff too large
force-app/main/default/classes/ControllerUtil.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>31.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/classes/ReportController.cls
New file
@@ -0,0 +1,525 @@
public with sharing class ReportController {
    @AuraEnabled
    public static InitData initForVOCFinishButton (String recordId) {
        InitData res = new initData();
        try {
            Report__c report = [select Status__c from Report__c where Id = :recordId];
            res.status = report.Status__c;
            res.profileId = UserInfo.getProfileId();
            System.debug(LoggingLevel.INFO, '*** res: ' + res);
        } catch (Exception e) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }
    @AuraEnabled
    public static InitData initForVOCCheckButton (String recordId) {
        InitData res = new initData();
        try {
            Report__c report = [select Status__c,IsVOC__c,Responsible_Person__r.Id from Report__c where Id = :recordId];
            res.status = report.Status__c;
            res.isVOC = report.IsVOC__c;
            res.personId = report.Responsible_Person__r.Id;
            res.profileId = UserInfo.getProfileId();
            System.debug(LoggingLevel.INFO, '*** res: ' + res);
        } catch (Exception e) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }
    @AuraEnabled
    public static Initdata initForVOCSubmitButton(String recordId){
        InitData res = new InitData();
        try {
            Report__c report = [select Status__c,Owner.Id,CreatedBy.Id from Report__c where Id = :recordId];
            res.status = report.Status__c;
            res.ownerId = report.Owner.Id;
            res.createdById = report.CreatedBy.Id;
            System.debug(LoggingLevel.INFO, '*** res: ' + res);
        } catch (Exception e) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }
    @AuraEnabled
    public static Initdata initForVOCAnswerButton(String recordId){
        InitData res = new InitData();
        try {
            Report__c report = [select Status__c from Report__c where Id = :recordId];
            res.status = report.Status__c;
            System.debug(LoggingLevel.INFO, '*** res: ' + res);
        } catch (Exception e) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }
    @AuraEnabled
    public static InitData initForVOCConfirmButton (String recordId) {
        InitData res = new initData();
        try {
            Report__c report = [select Status__c,VOC_Satisfy__c,VOC_Satisfy1__c from Report__c where Id = :recordId];
            res.status = report.Status__c;
            res.Satisfy = report.VOC_Satisfy__c;
            res.Satisfy1 = report.VOC_Satisfy1__c;
            System.debug(LoggingLevel.INFO, '*** res: ' + res);
        } catch (Exception e) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }
    @AuraEnabled
    public static InitData initForCancelButton(String recordId){
        InitData res = new InitData();
        try {
            Report__c report = [select Status__c from Report__c where Id = :recordId];
            res.status = report.Status__c;
        } catch (Exception e) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }
    @AuraEnabled
    public static InitData initForOCSMNoToReportButton(String recordId){
        InitData res = new InitData();
        try {
            Report__c report = [select OCSMAdministrativeReportNumber__c,OCSMAdministrativeReportDate__c,Aware_date__c from Report__c where Id = :recordId];
            res.OCSMAdministrativeReportDate = report.OCSMAdministrativeReportDate__c;
            res.OCSMAdministrativeReportNumber = report.OCSMAdministrativeReportNumber__c;
            res.awareDate = report.Aware_date__c;
        } catch (Exception e) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }
    @AuraEnabled
    public static InitData initForSIStoOPDButton(String recordId){
        InitData res = new InitData();
        try {
            Report__c report = [select Status__c,Owner.Id from Report__c where Id = :recordId];
            res.status = report.Status__c;
            res.ownerId = report.Owner.Id;
            res.userId = UserInfo.getUserId();
        } catch (Exception e) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }
    @AuraEnabled
    public static InitData initForOCSMToReportButton(String recordId){
        InitData res = new InitData();
        try {
            Report__c report = [select OCSMAdministrativeReportStatus__c,AwareDate__C from Report__c where Id = :recordId];
            res.OCSMAdministrativeReportStatus = report.OCSMAdministrativeReportStatus__c;
            res.awareDate = report.AwareDate__C;
        } catch (Exception e) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }
    @AuraEnabled
    public static InitData initForCompleteButton(String recordId){
        InitData res = new InitData();
        try {
            Report__c report = [select Status__c from Report__c where Id = :recordId];
            res.status = report.Status__c;
            res.profileId = UserInfo.getProfileId();
        } catch (Exception e) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }
    @AuraEnabled
    public static InitData initForASRCEditorButton(String recordId){
        InitData res = new InitData();
        String recordTypeId = 'ASRCDecision';
        try {
            PAE_DecisionRecord__c[] report = [SELECT LastModifiedDate, Id, Name, LastModifiedById,RecordType.DeveloperName FROM PAE_DecisionRecord__c where PAE_Report__c =  :recordId  And RecordType.DeveloperName = :recordTypeId Order by LastModifiedDate desc];
            if (report != null && !report.isEmpty()) {
                res.LastModifiedDate = report[0].LastModifiedDate;
                res.Id = report[0].Id;
                res.Name = report[0].Name;
                res.LastModifiedById = report[0].LastModifiedById;
                res.DeveloperName = report[0].RecordType.DeveloperName;
            }
        } catch (Exception e) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }
    @AuraEnabled
    public static InitData initForASACEditorButton(String recordId){
        InitData res = new InitData();
        String recordTypeId = 'ASACDecision';
        try {
            PAE_DecisionRecord__c[] report = [SELECT LastModifiedDate, Id, Name, LastModifiedById,RecordType.DeveloperName FROM PAE_DecisionRecord__c where PAE_Report__c =  :recordId  And RecordType.DeveloperName = :recordTypeId Order by LastModifiedDate desc];
            if (report != null && !report.isEmpty()) {
                res.LastModifiedDate = report[0].LastModifiedDate;
                res.Id = report[0].Id;
                res.Name = report[0].Name;
                res.LastModifiedById = report[0].LastModifiedById;
                res.DeveloperName = report[0].RecordType.DeveloperName;
            }
        } catch (Exception e) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }
    @AuraEnabled
    public static InitData initForOPDtoSISButton(String recordId){
        InitData res = new InitData();
        try {
            Report__c report = [select Status__c,Owner.Id from Report__C where Id = :recordId];
            res.status = report.Status__c;
            res.ownerId = report.Owner.Id;
            res.userId = UserInfo.getUserId();
        } catch (Exception e) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }
    @AuraEnabled
    public static InitData initForSubmitCompetitorReportButton(String recordId){
        InitData res = null;
        try {
           res =  new InitData();
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
        }
        return res;
    }
    @AuraEnabled
    public static void updateForSubmitButton(String reocrdId){
        try {
            Report__c rac = new Report__c();
            rac.Id = reocrdId;
            rac.Status__c = '提交';
            rac.Submit_time__c = Datetime.now();
            rac.Submit_report_day__c = Date.today();
            update rac;
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
        }
    }
    @AuraEnabled
    public static void updateForOPDtoSISButton(String recordId){
        try {
            Report__c rac = new Report__c();
            rac.Id = recordId;
            rac.RecordTypeId = '01210000000RLTi';
            update rac;
        } catch (Exception e) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
    }
    @AuraEnabled
    public static void updateForCancelSubmitReportButton(String recordId){
        try {
            Report__c rac = new Report__c();
            rac.Id = recordId;
            rac.Status__c = '草案中';
            rac.Submit_report_day__c = null;
            rac.Submit_time__c = null;
            update rac;
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
        }
    }
    @AuraEnabled
    public static void updateForCompleteButton(String recordId){
        Report__c rac = new Report__c();
        try {
            rac.Id = recordId;
            rac.Status__c = '完毕';
            rac.RecordTypeId = '01210000000Qeky';
            update rac;
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
        }
    }
    @AuraEnabled
    public static void updateForOCSMToReportButton(String recordId){
        try {
            Report__c rac = new Report__c();
            rac.Id = recordId;
            rac.OCSMAdministrativeReportStatus__c = '待报告';
            update rac;
        } catch (Exception e) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
    }
    @AuraEnabled
    public static void updateForSIStoOPDButton(String recordId){
        Report__c rac = new Report__c();
        try {
            rac.Id = recordId;
            rac.RecordTypeId = '01210000000Qekj';
            update rac;
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
        }
    }
    @AuraEnabled
    public static void updateForDispatchOCSMQARAButton(String recordId){
        try {
            Report__c rac = new Report__c();
            rac.Id = recordId;
            rac.Dispatch_OCSM_QARA__c = true;
            update rac;
        } catch (Exception e) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
    }
    @AuraEnabled
    public static void updateForOCSMNoToReportButton(String recordId){
        try {
            Report__c rac = new Report__c();
            rac.Id = recordId;
            rac.OCSMAdministrativeReportStatus__c  = '无需报告';
            update rac;
        } catch (Exception e) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
    }
    @AuraEnabled
    public static void updateForCancelButton(String recordId){
        try {
            Report__c rac = new Report__c();
            rac.Id = recordId;
            rac.Status__c = '取消';
            update rac;
        } catch (Exception e) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
    }
    @AuraEnabled
    public static void updateForVOCConfirmButton(String recordId,String Satisfy,String Satisfy1){
        try {
            Report__c rac = new Report__c();
            rac.Id = recordId;
            if (Satisfy == '是') {
                rac.Status__c = '结果确认完毕';
                } else if (Satisfy == '否') {
                // 対応結果(一回目)に値なければ、一回目の「否」と見なす
                if (Satisfy1 != '否') {
                Report__c[] records = [SELECT Id, VOC_Satisfy__c, VOC_Unsatisfy_Reason__c, VOC_follow_up_result__c, VOC_solution_category__c FROM Report__c WHERE Id = :recordId];
                rac.VOC_Satisfy__c = null;
                rac.VOC_Unsatisfy_Reason__c = null;
                rac.VOC_follow_up_result__c = null;
                rac.VOC_solution_category__c = null;
                rac.VOC_Satisfy1__c= records[0].VOC_Satisfy__c;
                rac.VOC_Unsatisfy_Reason1__c = records[0].VOC_Unsatisfy_Reason__c;
                rac.VOC_follow_up_result1__c = records[0].VOC_follow_up_result__c;
                rac.VOC_solution_category1__c = records[0].VOC_solution_category__c;
                rac.Status__c = '草案中';
                }
                // 対応結果(一回目)に値あれば、二回目の「否」と見なす
                else {
                rac.Status__c = '结果确认完毕';
                }
                }
            update rac;
        } catch (Exception e) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
    }
    @AuraEnabled
    public static String updateForVOCAnswerButton(String recordId){
        try {
            Report__c rac = [select Status__c from Report__c where Id = :recordId];
            rac.Status__c = '回答完毕';
            update rac;
            return null;
        } catch (Exception e) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
            String exc = '' + e.getMessage();
            return exc;
        }
    }
    @AuraEnabled
    public static void updateForSubmitCompetitorReportButton(String recordId){
        try {
            Report__c rac = new Report__c();
            rac.Id = recordId;
            rac.Status__c = '申請中';
            rac.Submit_time__c = Datetime.now();
            rac.Submit_report_day__c = Date.today();
            rac.Date__c = Date.today();
            update rac;
        } catch (Exception e) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
    }
    @AuraEnabled
    public static void updateForVOCSubmitButton(String recordId ,String createdById){
        try {
            Report__c rac = [select Status__c,JingliApprovalManager__r.Id,BuchangApprovalManager__r.Id,SalesManager__r.Id,BuchangApprovalManagerSales__r.Id,ZongjianApprovalManager__c,Submit_time__c,Submit_report_day__c,Owner.Id from Report__c where Id = :recordId];
            // share
            rac.Id = recordId;
            User[] records = [SELECT  Job_Category__c FROM User WHERE Id = :createdById];
            List<String> userAccess = new List<String>();
            if (records[0].Job_Category__c == '销售服务') {
            userAccess.add(rac.JingliApprovalManager__c + '_Read');
            userAccess.add(rac.BuchangApprovalManager__c + '_Read');
            rac.VOC_CreatedBy_jingli__c = rac.JingliApprovalManager__c;
            rac.VOC_CreatedBy_buzhang__c = rac.BuchangApprovalManager__c;
            } else {
            userAccess.add(rac.SalesManager__c + '_Read');
            userAccess.add(rac.BuchangApprovalManagerSales__c + '_Read');
            rac.VOC_CreatedBy_jingli__c = rac.SalesManager__c;
            rac.VOC_CreatedBy_buzhang__c = rac.BuchangApprovalManagerSales__c;
            }
            userAccess.add(rac.ZongjianApprovalManager__c + '_Read');
            String rtn = ControllerUtil.setSObjectShare('Report__Share','VOCShare__c',recordId,userAccess,rac.Owner.Id);
            if (rtn != 'OK') {
            return;
            }
            rac.Status__c = '填写完毕';
            rac.Submit_time__c = Date.today();
            rac.Submit_report_day__c = Date.today();
            update rac;
        } catch (Exception e) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
    }
    @AuraEnabled
    public static String updateForVOCCheckButton (String recordId,String isVOC,String personId) {
        try {
            Report__c rac = [select Owner.Id,VOC_jingli__r.Id,VOC_buzhang__r.Id,VOC_zongjian__r.Id,VOC_Finish__c,VOC_share_date__c,Responsible_Person__r.Id from Report__c where Id = :recordId];
            if (isVOC == 'VOC') {
                // VOC対応者の経理部長総監を設定
                User[] records = [SELECT Id, Job_Category__c, JingliApprovalManager__c, SalesManager__c, BuchangApprovalManager__c, BuchangApprovalManagerSales__c, ZongjianApprovalManager__c FROM User WHERE Id = :personId];
                if (records[0].job_Category__c == '销售服务') {
                    rac.VOC_jingli__c = records[0].JingliApprovalManager__c == null ? '' : records[0].JingliApprovalManager__c;
                    rac.VOC_buzhang__c = records[0].BuchangApprovalManager__c == null ? '' : records[0].BuchangApprovalManager__c;
                } else {
                    rac.VOC_jingli__c = records[0].SalesManager__c == null ? '' : records[0].SalesManager__c;
                    rac.VOC_buzhang__c = records[0].BuchangApprovalManagerSales__c == null ? '' : records[0].BuchangApprovalManagerSales__c;
                }
                rac.VOC_zongjian__c = records[0].ZongjianApprovalManager__c == null ? '' : records[0].ZongjianApprovalManager__c;
                rac.Status__c = '判定完毕';
                rac.VOC_Finish__c = false;
                Date serverTimestamp = Date.today();
                rac.VOC_share_date__c = serverTimestamp;
                // share
                List<String> userAccess = new List<String>();
                userAccess.add(rac.Responsible_Person__c + '_Edit');
                userAccess.add(rac.VOC_jingli__c + '_Read');
                userAccess.add(rac.VOC_buzhang__c + '_Read');
                userAccess.add(rac.VOC_zongjian__c + '_Read');
                String rtn = ControllerUtil.setSObjectShare('Report__Share','VOCShare__c',recordId,userAccess,rac.Owner.Id);
                if (rtn != 'OK') {
                    return null;
                }
                update rac;
                } else {
                    rac.Status__c = '完毕';
                    rac.VOC_Finish__c = true;
                    update rac;
                }
                return null;
        } catch (Exception e) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
            String exc = e.getMessage();
            return exc;
        }
    }
    @AuraEnabled
    public static void updateForVOCFinishButton (String recordId) {
        try {
            Report__c report = [select Id,Status__C from Report__c where Id = :recordId];
            report.Status__c = '完毕';
            update report;
        } catch (Exception e) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
    }
    public class InitData{
        @AuraEnabled
        public String status;
        @AuraEnabled
        public String isVOC;
        @AuraEnabled
        public String personId;
        @AuraEnabled
        public String createdById;
        @AuraEnabled
        public String ownerId;
        @AuraEnabled
        public String Satisfy;
        @AuraEnabled
        public String Satisfy1;
        @AuraEnabled
        public String profileId;
        @AuraEnabled
        public String OCSMAdministrativeReportNumber;
        @AuraEnabled
        public Date OCSMAdministrativeReportDate;
        @AuraEnabled
        public Date awareDate;
        @AuraEnabled
        public String OCSMAdministrativeReportStatus;
        @AuraEnabled
        public Datetime LastModifiedDate;
        @AuraEnabled
        public String Id;
        @AuraEnabled
        public String Name;
        @AuraEnabled
        public String LastModifiedById;
        @AuraEnabled
        public String DeveloperName;
        @AuraEnabled
        public String userId;
    }
}
force-app/main/default/classes/ReportController.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/lexSubmitCompetitorReport/lexSubmitCompetitorReport.css
New file
@@ -0,0 +1,10 @@
.submitHolder{
    position: relative;
    display: inline-block;
    width: 80px;
    height: 80px;
    text-align: center;
}
.container .uiContainerManager{
    display: none !important;
}
force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.html
New file
@@ -0,0 +1,5 @@
<template>
    <div class="submitHolder" if:true={IsLoading}>
        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
    </div>
</template>
force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.js
New file
@@ -0,0 +1,52 @@
import { LightningElement,wire,track,api} from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
import { NavigationMixin } from 'lightning/navigation';
import  otherButtonInSubmitCompetitorReport  from '@salesforce/apex/ReportController.updateForSubmitCompetitorReportButton';
import { updateRecord } from 'lightning/uiRecordApi';
import init  from '@salesforce/apex/ReportController.initForSubmitCompetitorReportButton';
export default class LexSubmitCompetitorReport extends LightningElement {
    @api recordId;
    IsLoading = true;
    @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;
          }
        }
    }
    updateRecordView(recordId) {
      updateRecord({fields: { Id: recordId }});
  }
    connectedCallback(){
          init({
            recordId: this.recordId
          }).then(result=>{
            this.submit();
            this.dispatchEvent(new CloseActionScreenEvent());
            this.IsLoading = false;
          });
    }
    submit(){
      otherButtonInSubmitCompetitorReport({
        recordId: this.recordId
    }).then(result=>{
      this.updateRecordView(this.recordId);
    });
    }
}
force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.js-meta.xml
New file
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
   <apiVersion>54.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__RecordPage</target>
        <target>lightning__AppPage</target>
        <target>lightning__HomePage</target>
        <target>lightning__RecordAction</target>
    </targets>
</LightningComponentBundle>
force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.css
New file
@@ -0,0 +1,10 @@
.checkHolder{
    position: relative;
    display: inline-block;
    width: 80px;
    height: 80px;
    text-align: center;
}
.container .uiContainerManager{
    display: none !important;
}
force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.html
New file
@@ -0,0 +1,5 @@
<template>
    <div class="checkHolder" if:true={IsLoading}>
        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
    </div>
</template>
force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.js
New file
@@ -0,0 +1,97 @@
import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
import { api, wire,LightningElement } from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
import init  from '@salesforce/apex/ReportController.initForVOCCheckButton';
import VOCCheck  from '@salesforce/apex/ReportController.updateForVOCCheckButton';
import { updateRecord } from 'lightning/uiRecordApi';
export default class LexVOCCheck extends LightningElement {
    @api recordId;
    status;
    isVOC;
    personId;
    profileId;
    Isloading = true;
    @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.Isloading = false;
                this.status = result.status;
                this.isVOC = result.isVOC;
                this.personId = result.personId;
                this.profileId = result.profileId;
                console.log(this.status);
                this.check();
                this.dispatchEvent(new CloseActionScreenEvent());
                //window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Report__c/" + this.recordId + "/view");
            }
        }).catch(error => {
            console.log("error");
            console.log(error);
        }).finally(() => {
        });
        this.updateRecordView(this.recordId);
    }
    updateRecordView(recordId) {
        updateRecord({fields: { Id: recordId }});
    }
    check (){
        // 陆胜,胡迪安,系统管理员可点(需要调整)
        if (UserInfo_Owner.Id != "00510000000gWAE" && UserInfo_Owner.Id != "00510000004reg2" && this.profileId != "00e10000000Y3o5AAC") {
                alert("你没有判定VOC的权限");
                return;
            }
            if (this.status != "跟进中") {
                alert("不是跟进中不能点击");
                return;
            }
            if (this.isVOC == undefined) {
                alert("必须选择是否VOC");
                return;
            }
            VOCCheck(
                {
                    recordId:this.recordId,
                    isVOC:this.isVOC,
                    personId:this.personId
                }
            ).then(result =>{
                if(result == null){
                    this.updateRecordView(this.recordId);
                }else {
                    alert(result);
                }
            });
            //location.reload();
    }
}
force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.js-meta.xml
New file
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>54.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__RecordPage</target>
        <target>lightning__AppPage</target>
        <target>lightning__HomePage</target>
        <target>lightning__RecordAction</target>
    </targets>
</LightningComponentBundle>
force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.css
New file
@@ -0,0 +1,10 @@
.vocFinishHolder{
    position: relative;
    display: inline-block;
    width: 80px;
    height: 80px;
    text-align: center;
}
.container .uiContainerManager{
    display: none !important;
}
force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.html
New file
@@ -0,0 +1,5 @@
<template>
    <div class="vocFinishHolder" if:true={IsLoading}>
        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
    </div>
</template>
force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.js
New file
@@ -0,0 +1,74 @@
import { api, wire,LightningElement } from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
import init  from '@salesforce/apex/ReportController.initForVOCFinishButton';
import update  from '@salesforce/apex/ReportController.updateForVOCFinishButton';
import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
import { updateRecord } from 'lightning/uiRecordApi';
export default class LexVOCFinish extends LightningElement {
    @api recordId;
    status;
    IsLoading = true;
    profileId;
    @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.IsLoading = false;
                this.status = result.status;
                this.profileId = result.profileId;
                this.VOCFinish();
                this.dispatchEvent(new CloseActionScreenEvent());
            }
        }).catch(error => {
            console.log("error");
            console.log(error);
        }).finally(() => {
        });
        //window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Report__c/" + this.recordId + "/view");
        //this.updateRecordView(this.recordId);
    }
    updateRecordView(recordId) {
        updateRecord({fields: { Id: recordId }});
    }
    VOCFinish () {
        if (UserInfo_Owner.Id != "00510000000gWAE" && UserInfo_Owner.Id != "00510000004reg2" && this.profileId != "00e10000000Y3o5AAC") {
            alert("你没有完毕VOC的权限");
            return;
            }
            if (this.status != "结果确认完毕") {
            alert("不是结果确认完毕不能点击");
            return;
            }
            update({
                recordId: this.recordId
            }).then(result =>{
                this.updateRecordView(this.recordId);
            });
    }
}
force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.js-meta.xml
New file
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>54.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__RecordPage</target>
        <target>lightning__AppPage</target>
        <target>lightning__HomePage</target>
        <target>lightning__RecordAction</target>
    </targets>
</LightningComponentBundle>
force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.css
New file
@@ -0,0 +1,10 @@
.vocSubmitHolder{
    position: relative;
    display: inline-block;
    width: 80px;
    height: 80px;
    text-align: center;
}
.container .uiContainerManager{
    display: none !important;
}
force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.html
New file
@@ -0,0 +1,5 @@
<template>
    <div class="vocSubmitHolder" if:true={IsLoading}>
        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
    </div>
</template>
force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.js
New file
@@ -0,0 +1,71 @@
import { LightningElement,wire,track,api} from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
import init  from '@salesforce/apex/ReportController.initForVOCSubmitButton';
import VOCSubmit  from '@salesforce/apex/ReportController.updateForVOCSubmitButton';
import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
import { updateRecord } from 'lightning/uiRecordApi';
export default class LexVOCSubmit extends LightningElement {
    @api recordId;
    createdById;
    status;
    IsLoading = true;
    @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.status = result.status;
                this.createdById = result.createdById;
                this.Submit();
                this.dispatchEvent(new CloseActionScreenEvent());
                this.IsLoading = false;
                //window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Report__c/" + this.recordId + "/view");
            }
        }).catch(error => {
            console.log("error");
            console.log(error);
        }).finally(() => {
        });
        //this.updateRecordView(this.recordId);
    }
    updateRecordView(recordId) {
        updateRecord({fields: { Id: recordId }});
    }
    Submit () {
        if (this.status != "草案中") {
            alert("不是草案中不能点击");
            return;
            }
            VOCSubmit({
                recordId: this.recordId,
                createdById: this.createdById
            }).then(result =>{
                this.updateRecordView(this.recordId);
            });
    }
}
force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.js-meta.xml
New file
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>54.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__RecordPage</target>
        <target>lightning__AppPage</target>
        <target>lightning__HomePage</target>
        <target>lightning__RecordAction</target>
    </targets>
</LightningComponentBundle>