19626
2023-10-23 1727a4f4d02e429475608e60f142a63bc24127bc
近期修改
30个文件已添加
64个文件已修改
17161 ■■■■■ 已修改文件
force-app/main/default/classes/Add_Report.cls 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/Add_ReportTest.cls 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/Add_ReportTest.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/AssetMaintainController.cls 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/AttachmentReQisHandlerTest.cls 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/BatchSelectRepairPageControllerTest.cls 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/BidAnnounceIframeController.cls 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/BidAnnounceIframeControllerTest.cls 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/CheckAllOlympusAssetController.cls 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/CheckAllOlympusAssetControllerTest.cls 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/ConsumTrialPDFControllerTest.cls 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/ISO_DemandOperAndDemonsJumpController.cls 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/ImprovedForecastTimeController.cls 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/InventoryReportControllerTest.cls 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/InventoryResultRecordControllerTest.cls 349 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/MaintenanceProductDataControllerTest.cls 75 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM401ControllerTest.cls 48 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NotetoPdfHandler.cls 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NotetoPdfHandlerTest.cls 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NotetoPdfHandlerTest.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/OFSRepairConsignPDFOuterControllerTest.cls 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/OFSUploadImageRest.cls 93 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/OFSUploadImageRestTest.cls 212 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/OFSUploadImageRestTest.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/OFSUploadRepairImageRest.cls 87 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/OpportunityLightingButtonController.cls 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/OpportunityLightingButtonControllerTest.cls 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/PCLLostProduct2AssetHandlerTest.cls 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/ReportController.cls 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/SetPersonalTargetBatch.cls 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/StartTradingController2.cls 321 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/StartTradingController2.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/TenderOpportunityLinkHandler.cls 339 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/UpdateInquiryFormConfirmationBatch.cls 79 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/UpdateReceivingNoteImgRest.cls 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/XinDailyReportController.cls 6254 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/XinDailyReportControllerTest.cls 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/eSignAgencyConfirmPageControllerTest.cls 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/eSignAgencyPageControllerTest.cls 87 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/eSignFormAttachmentControllerTest.cls 71 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/eSignHospitalConfirmControllerTest.cls 94 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/eSignHospitalPageControllerTest.cls 86 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/lexLightingButtonConstantTest.cls 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/lexLightingButtonConstantTest.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/lexLostCancelReportController.cls 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/lexLostCancelReportController.cls-meta.xml 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/lexLostCancelReportControllerTest.cls 100 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/lexLostCancelReportControllerTest.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/lexOpportunitySpecialApplyController.cls 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/lexPCLLostReportLwcController.cls 53 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/lexPCLLostReportLwcControllerTest.cls 145 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/lexSolutionProgrammeController.cls 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/lexSolutionProjectRequirementsController.cls 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/activeContent/activeContent.css 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/activeContent/activeContent.html 657 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/activeContent/activeContent.js 2780 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/activeContent/activeContent.js-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/improvedForecastTime/improvedForecastTime.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCancelReport/lexCancelReport.js 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCreateEvent/lexCreateEvent.js 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexEditCancelReport/lexEditCancelReport.js 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexEnquiryNoBidding/lexEnquiryNoBidding.html 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexEnquiryNoBidding/lexEnquiryNoBidding.js 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexFollowUpHistory/lexFollowUpHistory.html 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexFollowUpHistory/lexFollowUpHistory.js 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexFollowUpHistory/lexFollowUpHistory.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexImprovedForecastTimeNew/lexImprovedForecastTimeNew.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexLoseReport/lexLoseReport.js 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexNewOpportunityFile/lexNewOpportunityFile.js 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.html 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.js 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexQuotationProductNotUse/lexQuotationProductNotUse.html 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexQuotationProductNotUse/lexQuotationProductNotUse.js 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexQuotationProductNotUse/lexQuotationProductNotUse.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSISubmit/lexSISubmit.js 33 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSelectAssetEstimateVM/lexSelectAssetEstimateVM.css 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSelectAssetEstimateVM/lexSelectAssetEstimateVM.html 748 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSelectAssetEstimateVM/lexSelectAssetEstimateVM.js 2808 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSelectAssetEstimateVM/lexSelectAssetEstimateVM.js-meta.xml 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexStartTrading/lexStartTrading.js 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexStockCancel/lexStockCancel.html 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexStockCancel/lexStockCancel.js 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexsurface/lexsurface.css 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexsurface/lexsurface.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexsurface/lexsurface.js 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexsurface/lexsurface.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/multiSelectCombobox/multiSelectCombobox.html 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/oppLoseButton/oppLoseButton.html 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/oppLoseButton/oppLoseButton.js 189 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/tEnquiryNoBidding/tEnquiryNoBidding.html 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/tEnquiryNoBidding/tEnquiryNoBidding.js 95 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/CheckAllOlympusAsset.page 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/triggers/ContentDocumentLink.trigger 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/triggers/ContentDocumentTrigger.trigger 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/Add_Report.cls
@@ -5,7 +5,9 @@
    List<Account> aList = selectAccount(aId);
    if(reportId != null && reportId != ''){
      List<Report__c> rList = [select id, Daily_Report__c, RecordTypeId, Event_Id__c, Hospital_Department__c, Department_Class_Ref__c, Hospital_Reference__c, Date__c, Practitioner1__c, Practitioner2__c, Practitioner3__c, Practitioner4__c, Practitioner5__c, Comment__c from Report__c where id =:reportId];
        //kk p课题需要 实施人5从查找变为文本字段
    //   List<Report__c> rList = [select id, Daily_Report__c, RecordTypeId, Event_Id__c, Hospital_Department__c, Department_Class_Ref__c, Hospital_Reference__c, Date__c, Practitioner1__c, Practitioner2__c, Practitioner3__c, Practitioner4__c, Practitioner5__c, Comment__c from Report__c where id =:reportId];
    List<Report__c> rList = [select id, Daily_Report__c, RecordTypeId, Event_Id__c, Hospital_Department__c, Department_Class_Ref__c, Hospital_Reference__c, Date__c, Practitioner1__c, Practitioner2__c, Practitioner3__c, Practitioner4__c, Comment__c from Report__c where id =:reportId];
      if (rList.size() > 0) {
        return rList.get(0).id;
      }
@@ -41,9 +43,9 @@
    if(visitor4 != null && visitor4 != ''){
      r.Practitioner4__c = visitor4;
    }
    if(visitor5 != null && visitor5 != ''){
      r.Practitioner5__c = visitor5;
    }
    // if(visitor5 != null && visitor5 != ''){
    //   r.Practitioner5__c = visitor5;
    // }
    r.Comment__c = description;
    upsert r;
@@ -66,9 +68,10 @@
    if(reportId != null && reportId != ''){
      //康康p课题需要修改字段类型 后续跟进(Opportunity5__c变为文本类型字段)
    //   List<Report__c> rList = [select id, Daily_Report__c, RecordTypeId, Event_Id__c, Hospital_Department__c, Department_Class_Ref__c, Hospital_Reference__c, Date__c, Practitioner1__c, Practitioner2__c, Practitioner3__c, Practitioner4__c, Practitioner5__c, Opportunity1__c, Opportunity2__c, Opportunity3__c, Opportunity4__c, Opportunity5__c from Report__c where id =:reportId];
    //   if(rList.size() > 0){
    //     return rList.get(0).id;
    //   }
      List<Report__c> rList = [select id, Daily_Report__c, RecordTypeId, Event_Id__c, Hospital_Department__c, Department_Class_Ref__c, Hospital_Reference__c, Date__c, Practitioner1__c, Practitioner2__c, Practitioner3__c, Practitioner4__c, Opportunity1__c, Opportunity2__c, Opportunity3__c, Opportunity4__c, Opportunity5__c from Report__c where id =:reportId];
      if(rList.size() > 0){
        return rList.get(0).id;
      }
    }
    Report__c r = new Report__c();
@@ -102,9 +105,9 @@
    if(visitor4 != null && visitor4 != ''){
      r.Practitioner4__c = visitor4;
    }
    if(visitor5 != null && visitor5 != ''){
      r.Practitioner5__c = visitor5;
    }
    // if(visitor5 != null && visitor5 != ''){
    //   r.Practitioner5__c = visitor5;
    // }
    List<String> oppIdList = new List<String>();
    if(opp1 != null && opp1 != ''){
@@ -137,9 +140,9 @@
      if(opp4 != null && opp4 != ''){
        r.Opportunity4__c = opp4;
      }
    //   if(opp5 != null && opp5 != ''){
    //     r.Opportunity5__c = opp5;
    //   }
      if(opp5 != null && opp5 != ''){
        r.Opportunity5__c = opp5;
      }
      r.Opportunity_Situation__c = '引合発生';
    }
    else{
@@ -168,7 +171,8 @@
    List<Account> aList = selectAccount(aId);
    if(reportId != null && reportId != ''){
      List<Report__c> rList = [select id, Daily_Report__c, RecordTypeId, Event_Id__c, Hospital_Department__c, Department_Class_Ref__c, Hospital_Reference__c, Date__c, Practitioner1__c, Practitioner2__c, Practitioner3__c, Practitioner4__c, Practitioner5__c, From__c, To__c, Location__c from Report__c where id =:reportId];
    //   List<Report__c> rList = [select id, Daily_Report__c, RecordTypeId, Event_Id__c, Hospital_Department__c, Department_Class_Ref__c, Hospital_Reference__c, Date__c, Practitioner1__c, Practitioner2__c, Practitioner3__c, Practitioner4__c, Practitioner5__c, From__c, To__c, Location__c from Report__c where id =:reportId];
    List<Report__c> rList = [select id, Daily_Report__c, RecordTypeId, Event_Id__c, Hospital_Department__c, Department_Class_Ref__c, Hospital_Reference__c, Date__c, Practitioner1__c, Practitioner2__c, Practitioner3__c, Practitioner4__c, From__c, To__c, Location__c from Report__c where id =:reportId];
      if(rList.size() > 0){
        return rList.get(0).id;
      }
@@ -201,9 +205,9 @@
    if(visitor4 != null && visitor4 != ''){
      r.Practitioner4__c = visitor4;
    }
    if(visitor5 != null && visitor5 != ''){
      r.Practitioner5__c = visitor5;
    }
    // if(visitor5 != null && visitor5 != ''){
    //   r.Practitioner5__c = visitor5;
    // }
    if(sTime != null && sTime != ''){
      //sTime = sTime.substring(0,16);
      r.From__c = datetime.parse(sTime);
@@ -341,7 +345,8 @@
    List<Account> aList = selectAccount(aId);
    if(reportId != null && reportId != ''){
      List<Report__c> rList = [select id, Daily_Report__c, RecordTypeId, Event_Id__c, Hospital_Department__c, Department_Class_Ref__c, Hospital_Reference__c, Date__c, Practitioner1__c, Practitioner2__c, Practitioner3__c, Practitioner4__c, Practitioner5__c, Comment__c from Report__c where id =:reportId];
    //   List<Report__c> rList = [select id, Daily_Report__c, RecordTypeId, Event_Id__c, Hospital_Department__c, Department_Class_Ref__c, Hospital_Reference__c, Date__c, Practitioner1__c, Practitioner2__c, Practitioner3__c, Practitioner4__c, Practitioner5__c, Comment__c from Report__c where id =:reportId];
    List<Report__c> rList = [select id, Daily_Report__c, RecordTypeId, Event_Id__c, Hospital_Department__c, Department_Class_Ref__c, Hospital_Reference__c, Date__c, Practitioner1__c, Practitioner2__c, Practitioner3__c, Practitioner4__c, Comment__c from Report__c where id =:reportId];
      if(rList.size() > 0){
        return rList.get(0).id;
      }
@@ -378,7 +383,8 @@
    List<Account> aList = selectAccount(aId);
    if(reportId != null && reportId != ''){
      List<Report__c> rList = [select id, Daily_Report__c, RecordTypeId, Event_Id__c, Hospital_Department__c, Department_Class_Ref__c, Hospital_Reference__c, Date__c, Practitioner1__c, Practitioner2__c, Practitioner3__c, Practitioner4__c, Practitioner5__c, Comment__c from Report__c where id =:reportId];
    //   List<Report__c> rList = [select id, Daily_Report__c, RecordTypeId, Event_Id__c, Hospital_Department__c, Department_Class_Ref__c, Hospital_Reference__c, Date__c, Practitioner1__c, Practitioner2__c, Practitioner3__c, Practitioner4__c, Practitioner5__c, Comment__c from Report__c where id =:reportId];
    List<Report__c> rList = [select id, Daily_Report__c, RecordTypeId, Event_Id__c, Hospital_Department__c, Department_Class_Ref__c, Hospital_Reference__c, Date__c, Practitioner1__c, Practitioner2__c, Practitioner3__c, Practitioner4__c, Comment__c from Report__c where id =:reportId];
      if(rList.size() > 0){
        return rList.get(0).id;
      }
force-app/main/default/classes/Add_ReportTest.cls
New file
@@ -0,0 +1,11 @@
@isTest
private class Add_ReportTest {
    @TestSetup
    private static void init() {
    }
    @isTest
    static void test01() {
    }
}
force-app/main/default/classes/Add_ReportTest.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>58.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/classes/AssetMaintainController.cls
@@ -1197,11 +1197,22 @@
    }
    private void fillShowList(Integer k){
        if(allAssetInfoList.size() == 0 && assetFromSearchList.size() > 0 ){
            allAssetInfoList.addAll(assetFromSearchList);
            assetFromSearchList.clear();
        }
        totalNum = allAssetInfoList.size();
        totalPage = (totalNum / selctRecordNum) + (Math.mod(totalNum, selctRecordNum) > 0 ? 1 : 0);  // 总页
        allAssetInfoShowList = new List<AssetInfo>();
        Integer a = (k-1)*selctRecordNum;
        Integer b = Math.min(k*selctRecordNum, allAssetInfoList.size());
        System.debug('allAssetInfoList.size=>' + allAssetInfoList.size());
        System.debug('a=>' + a);
        System.debug('b=>' + b);
        System.debug('k=>' + k);
        System.debug('totalNum=>' + totalNum);
        System.debug('totalPage=>' + totalPage);
        System.debug('selctRecordNum=>' + selctRecordNum);
        for (Integer i = a ; i < b ; i++) {
            allAssetInfoShowList.add(allAssetInfoList[i]);
        }
force-app/main/default/classes/AttachmentReQisHandlerTest.cls
@@ -57,25 +57,12 @@
        repair.Hospital__c = hospital.Id;
        repair.Delivered_Product__c = asset.Id;
        insert repair;
        // Attachment att = new Attachment(
        //     Name = 'test',
        //     ParentId = repair.Id,
        //     Body = EncodingUtil.base64Decode('test')
        // );
        ContentVersion version = new ContentVersion(
            Title = 'test',
            VersionData = EncodingUtil.base64Decode('test'),
            ContentLocation = 's',
            PathOnClient = 'test.txt'
        Attachment att = new Attachment(
            Name = 'test',
            ParentId = repair.Id,
            Body = EncodingUtil.base64Decode('test')
        );
        insert version;
        version = [select ContentDocumentId from ContentVersion where Id =: version.Id];
        ContentDocumentLink link = new ContentDocumentLink();
        link.ContentDocumentId = version.ContentDocumentId;
        link.LinkedEntityId = repair.Id;
        link.ShareType = 'I';
        link.Visibility = 'AllUsers';
        insert link;
    }
    // 覆盖率补充
@@ -137,20 +124,13 @@
        ofile.Oppor_File_Stage__c = 'G';
        insert ofile;
        ContentVersion version = new ContentVersion(
            Title = 'test',
            VersionData = EncodingUtil.base64Decode('test'),
            ContentLocation = 's',
            PathOnClient = 'test.txt'
        Attachment att1 = new Attachment(
            Name = 'test',
            ParentId = ofile.Id,
            Body = EncodingUtil.base64Decode('test')
        );
        insert version;
        version = [select ContentDocumentId from ContentVersion where Id =: version.Id];
        ContentDocumentLink link = new ContentDocumentLink();
        link.ContentDocumentId = version.ContentDocumentId;
        link.LinkedEntityId = ofile.Id;
        link.ShareType = 'I';
        link.Visibility = 'AllUsers';
        insert link;
        insert att1;
        delete ofile;
force-app/main/default/classes/BatchSelectRepairPageControllerTest.cls
@@ -12,7 +12,7 @@
        if (rectDpt.size() == 0) {
            return;
        }
        Account hp = new Account(RecordTypeId = rectHp[0].Id, Name = 'SoakupTestHp', OwnerId = hpOwner.Id);
        Account hp = new Account(RecordTypeId = rectHp[0].Id, Name = 'SoakupTestHp', OwnerId = hpOwner.Id,Speciality_Type__c = '综合医院');
        insert hp;
        Account dc = [select Id, Name, RecordType_DeveloperName__c, Account2__c from Account where ParentId = :hp.Id and RecordType_DeveloperName__c = 'Department_Class_GI'];
        Account dpt = new Account(RecordTypeId = rectDpt[0].Id);
@@ -49,6 +49,7 @@
        System.Test.setCurrentPage(page);
        System.Test.StartTest();
        BatchSelectRepairPageController br = new BatchSelectRepairPageController();
        StaticParameter.ContentDocumentLink = false;
        br.init();
        Repair__c repair01 = [SELECT Id,Status2__c,Name,Incharge_Staff__c,SAP_Service_Repair_No__c,Aware_date2__c,State_Hospital__c,SerialNumber__c,work_location_select__c,FSE_ApplyForRepair_Day__c,On_site_repair__c,Aware_date__c FROM Repair__c LIMIT 1];
        br.RevalInfo.repair = repair01;
@@ -71,6 +72,7 @@
        List<Repair__c> repList = new List<Repair__c>();
        repList.add(repair01);
        BatchSelectRepairPageController.generateAttachment(repList);       
        System.Test.StopTest();
    }
force-app/main/default/classes/BidAnnounceIframeController.cls
@@ -20,10 +20,10 @@
        if (docList.size() > 0) {
            doc = docList[0];
        }
        ContentVersion version = [select Id from ContentVersion where ContentDocumentId =: doc.Id];
        if (bid.Web_URL__c != null) {
            // 中标通知书URL更新时间 と 最新Attachmentの時間と比較、新しいものを適用
            if (doc != null) {
                ContentVersion version = [select Id from ContentVersion where ContentDocumentId =: doc.Id];
                if (bid.Web_URL_ModifiedDate__c < doc.ContentModifiedDate) {
                    iframe = '/sfc/servlet.shepherd/version/renditionDownload?rendition=THUMB720BY480&versionId='+ version.Id;
                } else {
@@ -37,6 +37,7 @@
        } else {
            // Attachmentを適用
            if (doc != null) {
                ContentVersion version = [select Id from ContentVersion where ContentDocumentId =: doc.Id];
                iframe = '/sfc/servlet.shepherd/version/renditionDownload?rendition=THUMB720BY480&versionId='+ version.Id;
            }
        }
force-app/main/default/classes/BidAnnounceIframeControllerTest.cls
@@ -31,12 +31,20 @@
        BidAnnounceIframeController controller = new BidAnnounceIframeController(new ApexPages.StandardController(ba));
        controller.init();
        
        Attachment att = new Attachment(
            Name = 'test',
            ParentId = ba.Id,
            Body = EncodingUtil.base64Decode('test')
        ContentVersion version = new ContentVersion(
            Title = 'test',
            VersionData = EncodingUtil.base64Decode('test'),
            ContentLocation = 's',
            PathOnClient = 'test.txt'
        );
        insert att;
        insert version;
        version = [select ContentDocumentId from ContentVersion where Id =: version.Id];
        ContentDocumentLink link = new ContentDocumentLink();
        link.ContentDocumentId = version.ContentDocumentId;
        link.LinkedEntityId = ba.Id;
        link.ShareType = 'I';
        link.Visibility = 'AllUsers';
        insert link;
        controller.init();
        
        ba.Web_URL__c = '';
force-app/main/default/classes/CheckAllOlympusAssetController.cls
@@ -424,6 +424,7 @@
        if (beipinCunFangDi=='广州 备品中心' || beipinCunFangDi=='北京 备品中心' || beipinCunFangDi=='上海 备品中心') {
            angecylookrole =true;
        }
        System.debug('angecylookrole===' + angecylookrole);
        setAssetFieldSetInfo();//20210628 1650 you 挪个位置
        if (UserInfo.getProfileId() == System.Label.ProfileId_SystemAdmin || System.Label.ProfileId_EquCenAdmin.contains(UserInfo.getProfileId())) {
            internalAssetLocationLogin = FixtureUtil.bieCunFangDiOpsMap.get('备品管理中心')[0].getValue();  // SelectOption('All', '--全部--')
@@ -758,6 +759,7 @@
        }
        System.debug('oldAssetInfoList===' + oldAssetInfoList);
        checkedAssetInfoNum = oldAssetInfoList.size();
        System.debug('oldAssetInfoListSize===' + oldAssetInfoList.size());
        allAssetInfoList.clear();
        totalFixDataNum = oldAssetInfoList.size(); // 打勾固定数据数量
@@ -968,6 +970,7 @@
        }
        System.debug('currPage===' + currPage);
        System.debug('totalPage===' + totalPage);
        System.debug('selctRecordNum===' + selctRecordNum);
        if (selRecordOption != NONE) {
            // selRecordOption = String.valueOf(Integer.valueOf(selRecordOption) + checkedAssetInfoNum);
            if (currPage == 1) {
@@ -977,8 +980,13 @@
                soqlAsset += ' limit ' + selRecordOption + ' offset ' + String.valueOf((currPage - 1) * selctRecordNum - checkedAssetInfoNum);
                System.debug('Last page;');
            } else {
                if(oldAssetInfoList.size() > 10 && currPage == 2){
                    soqlAsset += ' limit ' + selRecordOption + ' offset ' + String.valueOf((currPage) * selctRecordNum - checkedAssetInfoNum);
                }else{
                soqlAsset += ' limit ' + selRecordOption + ' offset ' + String.valueOf((currPage - 1) * selctRecordNum - checkedAssetInfoNum);
            }
            }
        }
        // 最终检索结果
        allAssetDataList = Database.query(soqlAsset);
force-app/main/default/classes/CheckAllOlympusAssetControllerTest.cls
@@ -1,6 +1,7 @@
@isTest
private class CheckAllOlympusAssetControllerTest {
     private static void createAssetData() {
        TestDataUtility.CreatePIPolicyConfigurations(new string[]{'Agency_Contact__c','Contact'});
        // OLY_OCM-643 追加EscapeNFM001Trigger
        ControllerUtil.EscapeNFM001Trigger = true;
        // 省
@@ -563,17 +564,17 @@
        page.getParameters().put('assertCondition', 'all');
        page.getParameters().put('fromQuickBarFlag', 'true');
        String csvStr = '';
        csvStr += 'Id(不可修改),Internal_asset_location__c,Salesdepartment__c,SalesProvince__c,Fixture_Model_No_F__c(不可修改),CompanyOfEquipment__c,Internal_Asset_number__c,Internal_Asset_number_key__c(不可修改),';
        csvStr += 'SerialNumber,Product_category__c,Equipment_Type__c,Consumable_Guaranteen_end__c,Manage_type__c,Loaner_accsessary__c,EquipmentSet_Managment_Code__c,AssetManageConfirm__c,Fixture_QRCode__c(不可修改),';
        csvStr += 'WH_location__c,Quantity,You_Xiao_Ku_Cun__c(不可修改),Ji_Zhong_Guan_Li_Ku_Cun__c(不可修改),Out_of_wh__c,Rental_Count__c,Frozen_Quantity__c,Abandoned_RealThing__c,Abandoned_Inventory__c,Repairing_Count__c(不可修改),';
        csvStr += 'Fixture_Status__c(不可修改),Main_OneToOne__c';
        csvStr += 'Id,Internal_asset_location__c,Salesdepartment__c,SalesProvince__c,Fixture_Model_No_F__c,CompanyOfEquipment__c,Internal_Asset_number__c,Internal_Asset_number_key__c,';
        csvStr += 'SerialNumber,Product_category__c,Equipment_Type__c,Consumable_Guaranteen_end__c,Manage_type__c,Loaner_accsessary__c,EquipmentSet_Managment_Code__c,AssetManageConfirm__c,Fixture_QRCode__c,';
        csvStr += 'WH_location__c,Quantity,You_Xiao_Ku_Cun__c,Ji_Zhong_Guan_Li_Ku_Cun__c,Out_of_wh__c,Rental_Count__c,Frozen_Quantity__c,Abandoned_RealThing__c,Abandoned_Inventory__c,Repairing_Count__c,';
        csvStr += 'Fixture_Status__c,Main_OneToOne__c,Status';
        csvStr += '\r\n';
        csvStr += 'Id(不可修改),备品存放地,所在地区(本部),所在地区(省),备品配套明细型号(不可修改),备品所属公司,固定资产编号,固定资产编号(Key)(不可修改),シリアル番号,产品分类(GI/SP),备品分类,消耗品有效期至,';
        csvStr += '管理种类,备品用途附属品,备品管理编码,备品中心确认,备品QRCode(不可修改),货架号,数量,有效库存(不可修改),集中管理库存(不可修改),借出_分配_数,已借出数,冻结数,待废弃数(实物),待废弃数(丢失/盘亏),修理中件数(不可修改),备品状态(不可修改),一对一保管主体';
        csvStr += '管理种类,备品用途附属品,备品管理编码,备品中心确认,备品QRCode(不可修改),货架号,数量,有效库存(不可修改),集中管理库存(不可修改),借出_分配_数,已借出数,冻结数,待废弃数(实物),待废弃数(丢失/盘亏),修理中件数(不可修改),备品状态(不可修改),一对一保管主体,状态';
        csvStr += '\r\n';
        csvStr += targetAssetId;
        csvStr += ',上海 备品中心,3.西北营业本部,沈阳,IMH-20,上海,8765_4211,51128765_4211,3,GI,产品试用,,个体管理,';
        csvStr += 'true,51138765_4 _1,true,51128765_4211,N10,1.00,0,0,0,0,,,,0,无库存,true';
        csvStr += 'true,51138765_4 _1,true,51128765_4211,N10,1.00,0,0,0,0,,,,0,无库存,true,使用中';
        csvStr += '\r\n';
        page.getParameters().put('csvData', csvStr);
force-app/main/default/classes/ConsumTrialPDFControllerTest.cls
@@ -2,12 +2,12 @@
private class ConsumTrialPDFControllerTest {
    @testSetup
    static void setupTestData() {
        List<String> strList = new List<String>();
        strList.add('Consum_Apply_Equipment_Set_Detail__c');
        strList.add('Consum_Apply__c');
        strList.add('Document');
        strList.add('Agency_Contact__c');
        strList.add('Contact');
        TestDataUtility.CreatePIPolicyConfigurations(strList);
        
        // 用户
force-app/main/default/classes/ISO_DemandOperAndDemonsJumpController.cls
@@ -10,23 +10,9 @@
        this.isid = (IS_Opportunity_Demand__c)controller.getRecord();
    }
    public void init() {
        // String eid = ApexPages.currentPage().getParameters().get('id');
        IS_Opportunity_Demand__c isod = [select Id, Operating_Room_Count__c,Opportunity_ID__c,Demonstration_Number__c from IS_Opportunity_Demand__c where Id = :isid.Id];
        if(isod.Demonstration_Number__c == null && isod.Operating_Room_Count__c == null){
            lid = 'ISO_DemandOperAndDemons?Id='+isod.Id+'&OppoerID='+isod.Opportunity_ID__c;
        }else{
            lid = 'ISO_DemandOperAndDemonsNew?id='+isod.Id+'&OppoerID='+isod.Opportunity_ID__c;
        }
        Integer i = 0;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        String Id = ApexPages.currentPage().getParameters().get('Id');
        String oppId = ApexPages.currentPage().getParameters().get('oppId');
        //IS_Opportunity_Demand__c isod = [select Id, Operating_Room_Count__c,Opportunity_ID__c,Demonstration_Number__c from IS_Opportunity_Demand__c where Id = :Id];
        lid = 'ISO_DemandOperAndDemonsNew?id='+Id+'&OppoerID='+oppId;
    }
}
force-app/main/default/classes/ImprovedForecastTimeController.cls
@@ -151,9 +151,20 @@
            InquiryPredictsDateChange__c ipd = mergeInfo(oppMap);
            // ipd.Predicted_Date_Status__c = '已提交';
            upsert ipd;
        }catch(Exception ex)
        }catch(Exception e)
        {
            return  ex.getLineNumber()+'  行错误 :   '+ex.getMessage();
            if (e.getMessage().contains('EXCEPTION,')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf('EXCEPTION,') + 10;
                Integer right = exc.lastIndexOf('」: [') + 1;
                String str = exc.substring(left,right);
                // left = str.indexOf(',') +  1;
                // String newStr = str.substring(left);
                return str;
            }else {
                return e.getMessage();
            }
        }
        return  '成功';
    }
force-app/main/default/classes/InventoryReportControllerTest.cls
@@ -1,7 +1,10 @@
@isTest
private class InventoryReportControllerTest {
    // 创建 Asset & 盘点表头 & 盘点明细 数据
    @TestSetup
    static void setupTestData() {
        TestDataUtility.CreatePIPolicyConfigurations(new string[]{'Agency_Contact__c','Contact'});
        SS_Batch_Column_Mapping__c InventoryHeaderName = new SS_Batch_Column_Mapping__c(Name = 'Inventory_Header_Name', SS_TableName__c='Inventory_Header_Name');
        InventoryHeaderName.From_Column_001__c = '北京 备品中心';
        InventoryHeaderName.SS_Column_001__c = 'BJ';
@@ -297,7 +300,6 @@
        user.JingliEquipmentManager__c = UserInfo.getUserId();
        System.runAs(new User(Id = Userinfo.getUserId())) {
            setupTestData();
            insert user;
            User currUser = [
@@ -345,7 +347,6 @@
    // 保存按钮--盘点报告提交人 & 盘点报告确认人 & 盘点人员 & 盘点时间From & 盘点时间To & 盘点差异具体情况说明 & 差异资产部门处理意见
    static testMethod void testSaveData() {
        
            setupTestData();
            PageReference page = new PageReference('/apex/InventoryReport?Id=' + invHeadId);
            System.Test.setCurrentPage(page);
@@ -365,7 +366,7 @@
            System.Test.StartTest();
            controller.init();
            page = controller.saveSubmit();
            controller.init();
            
            Inventory_Header__c invHead = [
@@ -392,7 +393,6 @@
    // 提交盘点报告按钮
    static testMethod void testSubmitData() {
        setupTestData();
        PageReference page = new PageReference('/apex/InventoryReport?Id=' + invHeadId + '&saveType=1');
        System.Test.setCurrentPage(page);
@@ -407,7 +407,7 @@
        controller.ihObj.IvtDifference_Detail__c = '盘点差异具体情况说明';
        controller.ihObj.IvtDifference_Comment__c = '差异资产部门处理意见';
        page = controller.saveSubmit();
        controller.init();
        System.Test.StartTest();
        //System.assertEquals(controller.ihObj.Inventory_Status__c, '填写完毕');
@@ -419,9 +419,13 @@
    // 提交盘点报告按钮--审批流
    static testMethod void testApprovalProcess() {
        setupTestData();
        PageReference page = new PageReference('/apex/InventoryReport?Id=' + invHeadId + '&saveType=1');
        Inventory_Header__c invHeadObj = new Inventory_Header__c();
        invHeadObj.Internal_asset_location__c = '北京 备品中心';
        invHeadObj.Inventory_Start_Date__c = Date.today();
        invHeadObj.Inventory_Status__c = '盘点中';
        invHeadObj.UniqueKey__c = '备品中心Obj:' + String.valueOf(Date.today());
        insert invHeadObj;
        PageReference page = new PageReference('/apex/InventoryReport?Id=' + invHeadObj.Id + '&saveType=1');
        System.Test.setCurrentPage(page);
        InventoryReportController controller = new InventoryReportController();
        controller.init();
@@ -434,7 +438,6 @@
        controller.ihObj.IvtDifference_Detail__c = '盘点差异具体情况说明';
        controller.ihObj.IvtDifference_Comment__c = '差异资产部门处理意见';
        page = controller.saveSubmit();
        System.Test.StartTest();
        // List<ProcessInstance> piList = [
@@ -472,7 +475,6 @@
    // for coverage
    static testMethod void testException() {
        setupTestData();
        Inventory_Header__c invHeadObj = new Inventory_Header__c();
        invHeadObj.Internal_asset_location__c = '北京 备品中心';
@@ -501,6 +503,7 @@
        controller.ihObj.Inventory_Date_From__c = Date.today().addDays(60);
        controller.ihObj.Inventory_Date_To__c = Date.today();
        page3 = controller.saveSubmit();
        controller.init();
        // 盘点报告提交人或确认人不能为空, 请先确认。
        PageReference page4 = new PageReference('/apex/InventoryReport?Id=' + invHeadId);
@@ -510,6 +513,7 @@
        controller.ihObj.Inventory_Date_To__c = Date.today();
        controller.ihObj.InventorySubmit_PIC__c = null;
        page4 = controller.saveSubmit();
        controller.init();
    }
    static testMethod void updaue() {
        InventoryReportController.test();//先调用这个,然后继续补充测试类
force-app/main/default/classes/InventoryResultRecordControllerTest.cls
@@ -4,6 +4,8 @@
    public static User user = new User();
    static void setupTestData() {
        ControllerUtil.EscapeNFM001Trigger = true;
        Oly_TriggerHandler.bypass(Product2Handler.Class.getName());
        Oly_TriggerHandler.bypass(ContactTriggerHandler.Class.getName());
        //// 省
        //Address_Level__c al = new Address_Level__c();
        //al.Name = '東京';
@@ -201,6 +203,8 @@
                timezonesidkey='America/Los_Angeles', 
                username='test@acme.com' + Datetime.now().getTime());
            insert user;
            InventoryResultRecordController con = new InventoryResultRecordController();
            // con.save();
        }
        //Repair__c repair = new Repair__c();
        //repair.Service_Repair_No__c = 'repair';
@@ -210,6 +214,7 @@
        //repair.Department_Class__c = strategicDep[0].id;
        //repair.Delivered_Product__c = assetA2.Id;
        //insert repair;
    }
    /**  点击开始盘点
@@ -226,6 +231,7 @@
        setupTestData();
        InventoryResultRecordController con = new InventoryResultRecordController();
        con.init();
        con.showResult();
        //con.bieCunFangDi = '北京 备品中心';
        //未开始盘点
@@ -278,7 +284,9 @@
         //        FROM User WHERE Dept__c = '医疗东北营业本部' and IsActive = true limit 1].id;
        // update ihList;
        //本月已有结束的盘点
        // con.showResult();
        // // 本月已有结束的盘点
        // con.startInventory();
        // msgs = ApexPages.getMessages();
        // b = false;
@@ -310,9 +318,13 @@
        Database.executeBatch(new InventoryStartAssetSnapshotBatch(cunFangDi,header));
        System.Test.StopTest();
        headerList[0].Inventory_Status__c = '已批准';
        update headerList;
        InventoryResultRecordController con = new InventoryResultRecordController();
        con.init();
        con.searchBtn();
        con.showResult();
    }
    static testMethod void testMethod3() {
@@ -375,6 +387,17 @@
        System.assertEquals(19, con.salesdepartmentOpts.size());
        System.assertEquals(57, con.salesProvinceOpts.size());
        
        List<Inventory_Header__c> headerList = [select UniqueKey__c from Inventory_Header__c];
        con.showResult();
        headerList[0].Inventory_Status__c = '盘点中';
        update headerList;
        con.showResult();
        headerList[0].Inventory_Status__c = null;
        update headerList;
        con.showResult();
        //con.inventoryDetailList[0].Inventory_Count__c = 1;
        //con.save();
        
@@ -412,6 +435,328 @@
        }
    }
    static testMethod void updaue() {
        InventoryResultRecordController.test();//先调用这个,然后继续补充测试类
        //InventoryResultRecordController.test();//先调用这个,然后继续补充测试类
    }
    //lt start
    static testMethod void testMethod06() {
        bp3_Setting__c conf = bp3_Setting__c.getOrgDefaults();
        conf.SH_Start_Inventory_User__c = UserInfo.getUserId();
        conf.InventoryDetailArchiveFolder__c = UserInfo.getUserId();
        insert conf;
        setupTestData();
        InventoryResultRecordController con = new InventoryResultRecordController();
        con.init();
        con.showResult();
        con.bieCunFangDi = '上海 备品中心';
        //未开始盘点
        List<Apexpages.Message> msgs = ApexPages.getMessages();
        boolean b = false;
        for(Apexpages.Message msg:msgs){
            if (msg.getDetail().contains('没有开始中的盘点,请点击开始盘点')) b = true;
        }
        //system.assert(b);
        Profile p = [select Id from Profile where id =:System.Label.ProfileId_SystemAdmin];
        // ユーザー作成
        User hpOwner = new User(Test_staff__c = true, LastName = 'hp',
                                FirstName = 'owner', Alias = 'hp',
                                CommunityNickname = 'hpOwner',
                                Email = 'olympus_hpowner@sunbridge.com',
                                Username = 'olympus_hpowner@sunbridge.com',
                                IsActive = true, EmailEncodingKey = 'ISO-2022-JP',
                                TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP',
                                 LanguageLocaleKey = 'ja', ProfileId = p.id);
        insert hpOwner;
        System.debug('---lt123---'+hpOwner);
        System.runAs(hpOwner) {
            //没有开始权限
            con.startInventory();
            msgs = ApexPages.getMessages();
            b = false;
            for(Apexpages.Message msg:msgs){
                if (msg.getDetail().contains('没有开始盘点的权限')) b = true;
            }
        }
        //第一次开始盘点
        con.startInventory();
        msgs = ApexPages.getMessages();
        b = false;
        for(Apexpages.Message msg:msgs){
            if (msg.getDetail().contains('开始盘点处理,请等待Batch处理结束')) b = true;
        }
        List<Inventory_Header__c> ihList = [select Id,InventoryCheck_PIC__c,InventorySubmit_PIC__c from Inventory_Header__c];
        //再次开始盘点
        con.startInventory();
        msgs = ApexPages.getMessages();
        b = false;
        for(Apexpages.Message msg:msgs){
            if (msg.getDetail().contains('有未结束的盘点')) b = true;
        }
    }
    static testMethod void testMethod07() {
        bp3_Setting__c conf = bp3_Setting__c.getOrgDefaults();
        conf.GZ_Start_Inventory_User__c = UserInfo.getUserId();
        conf.InventoryDetailArchiveFolder__c = UserInfo.getUserId();
        insert conf;
        setupTestData();
        InventoryResultRecordController con = new InventoryResultRecordController();
        con.init();
        con.showResult();
        con.bieCunFangDi = '广州 备品中心';
        //未开始盘点
        List<Apexpages.Message> msgs = ApexPages.getMessages();
        boolean b = false;
        for(Apexpages.Message msg:msgs){
            if (msg.getDetail().contains('没有开始中的盘点,请点击开始盘点')) b = true;
        }
        //system.assert(b);
        Profile p = [select Id from Profile where id =:System.Label.ProfileId_SystemAdmin];
        // ユーザー作成
        User hpOwner = new User(Test_staff__c = true, LastName = 'hp',
                                FirstName = 'owner', Alias = 'hp',
                                CommunityNickname = 'hpOwner',
                                Email = 'olympus_hpowner@sunbridge.com',
                                Username = 'olympus_hpowner@sunbridge.com',
                                IsActive = true, EmailEncodingKey = 'ISO-2022-JP',
                                TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP',
                                 LanguageLocaleKey = 'ja', ProfileId = p.id);
        insert hpOwner;
        System.debug('---lt123---'+hpOwner);
        System.runAs(hpOwner) {
            //没有开始权限
            con.startInventory();
            msgs = ApexPages.getMessages();
            b = false;
            for(Apexpages.Message msg:msgs){
                if (msg.getDetail().contains('没有开始盘点的权限')) b = true;
            }
        }
        //第一次开始盘点
        con.startInventory();
        msgs = ApexPages.getMessages();
        b = false;
        for(Apexpages.Message msg:msgs){
            if (msg.getDetail().contains('开始盘点处理,请等待Batch处理结束')) b = true;
        }
        List<Inventory_Header__c> ihList = [select Id,InventoryCheck_PIC__c,InventorySubmit_PIC__c from Inventory_Header__c];
        //再次开始盘点
        con.startInventory();
        msgs = ApexPages.getMessages();
        b = false;
        for(Apexpages.Message msg:msgs){
            if (msg.getDetail().contains('有未结束的盘点')) b = true;
        }
    }
    static testMethod void testMethod37() {
        Oly_TriggerHandler.bypass(InventoryHeaderHandler.Class.getName());
        bp3_Setting__c conf = bp3_Setting__c.getOrgDefaults();
        conf.SJZ_Start_Inventory_User__c = UserInfo.getUserId();
        conf.GZ_Start_Inventory_User_Agency__c = UserInfo.getUserId();
        conf.CD_Start_Inventory_User__c = UserInfo.getUserId();
        conf.CQ_Start_Inventory_User__c = UserInfo.getUserId();
        conf.NN_Start_Inventory_User__c = UserInfo.getUserId();
        conf.KM_Start_Inventory_User__c = UserInfo.getUserId();
        conf.WH_Start_Inventory_User__c = UserInfo.getUserId();
        conf.GY_Start_Inventory_User__c = UserInfo.getUserId();
        conf.CS_Start_Inventory_User__c = UserInfo.getUserId();
        conf.HF_Start_Inventory_User__c = UserInfo.getUserId();
        conf.NC_Start_Inventory_User__c = UserInfo.getUserId();
        conf.NJ_Start_Inventory_User__c = UserInfo.getUserId();
        conf.HZ_Start_Inventory_User__c = UserInfo.getUserId();
        conf.FZ_Start_Inventory_User__c = UserInfo.getUserId();
        conf.SH_Start_Inventory_User_Agency__c = UserInfo.getUserId();
        conf.TJ_Start_Inventory_User__c = UserInfo.getUserId();
        conf.XN_Start_Inventory_User__c = UserInfo.getUserId();
        conf.YC_Start_Inventory_User__c = UserInfo.getUserId();
        // conf.CC_Start_Inventory_User__c = UserInfo.getUserId();
        // conf.HEB_Start_Inventory_User__c = UserInfo.getUserId();
        // conf.DL_Start_Inventory_User__c = UserInfo.getUserId();
        // conf.WLMQ_Start_Inventory_User__c = UserInfo.getUserId();
        // conf.LZ_Start_Inventory_User__c = UserInfo.getUserId();
        // conf.XA_Start_Inventory_User__c = UserInfo.getUserId();
        // conf.TY_Start_Inventory_User__c = UserInfo.getUserId();
        // conf.ZZ_Start_Inventory_User__c = UserInfo.getUserId();
        // conf.JN_Start_Inventory_User__c = UserInfo.getUserId();
        // conf.HHHT_Start_Inventory_User__c = UserInfo.getUserId();
        // conf.SY_Start_Inventory_User__c = UserInfo.getUserId();
        // conf.QD_Start_Inventory_User__c = UserInfo.getUserId();
        conf.InventoryDetailArchiveFolder__c = UserInfo.getUserId();
        insert conf;
        String biecunFangDi = '石家庄';
        Inventory_Header__c header = new Inventory_Header__c();
        header.Inventory_Start_Date__c = Date.toDay();
        header.UniqueKey__c = 'IH-0000';
        header.Inventory_Status__c = '处理中';
        header.Internal_asset_location__c = biecunFangDi;
        header.InventoryCheck_PIC__c = [SELECT Id
                FROM User WHERE Dept__c = '医疗东北营业本部' and IsActive = true limit 1].id;
        header.InventorySubmit_PIC__c = [SELECT id
                FROM User WHERE Dept__c = '医疗东北营业本部' and IsActive = true limit 1].id;
        insert header;
        List<Inventory_Header__c> headerList = [select UniqueKey__c from Inventory_Header__c];
        setupTestData();
        InventoryResultRecordController con = new InventoryResultRecordController();
        con.init();
        con.showResult();
        con.bieCunFangDi = '石家庄';
        con.showResult();
        headerList[0].Inventory_Status__c = '盘点中';
        update headerList;
        con.showResult();
        headerList[0].Inventory_Status__c = null;
        update headerList;
        con.showResult();
        //未开始盘点
        List<Apexpages.Message> msgs = ApexPages.getMessages();
        boolean b = false;
        User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
        Profile p = [select Id from Profile where Name = '系统管理员'];
        User user1 = new User();
        user1.ProfileId = p.Id;
        user1.FirstName = 'ユーザー';
        user1.LastName = 'テスト';
        user1.Email = 'test_user@example.com';
        user1.emailencodingkey='UTF-8';
        user1.languagelocalekey='zh_CN';
        user1.localesidkey='ja_JP';
        user1.timezonesidkey='Asia/Shanghai';
        user1.Username = 'test_user111@example.com';
        user1.Alias = 'テユ';
        user1.CommunityNickname = 'テストユーザー';
        user1.Dept__c = '医疗华南营业本部';
        user1.JingliEquipmentManager__c = thisUser.Id;
        insert user1;
        // System.runAs (user1) {
        //再次开始盘点
        con.startInventory();
        con.bieCunFangDi = '成都';
        con.startInventory();
        con.bieCunFangDi = '广州';
        con.startInventory();
        con.bieCunFangDi = '重庆';
        con.startInventory();
        con.bieCunFangDi = '南宁';
        con.startInventory();
        con.bieCunFangDi = '昆明';
        con.startInventory();
        con.bieCunFangDi = '武汉';
        con.startInventory();
        con.bieCunFangDi = '贵阳';
        con.startInventory();
        con.bieCunFangDi = '长沙';
        con.startInventory();
        con.bieCunFangDi = '合肥';
        con.startInventory();
        con.bieCunFangDi = '南昌';
        con.startInventory();
        con.bieCunFangDi = '南京';
        con.startInventory();
        con.bieCunFangDi = '杭州';
        con.startInventory();
        con.bieCunFangDi = '福州';
        con.startInventory();
        con.bieCunFangDi = '上海';
        con.startInventory();
        con.bieCunFangDi = '天津';
        con.startInventory();
        con.bieCunFangDi = '西宁';
        con.startInventory();
        // con.bieCunFangDi = '银川';
        // con.startInventory();
        // }
        msgs = ApexPages.getMessages();
        b = false;
        for(Apexpages.Message msg:msgs){
            if (msg.getDetail().contains('有未结束的盘点')) b = true;
        }
    }
    static testMethod void testMethod20() {
        bp3_Setting__c conf = bp3_Setting__c.getOrgDefaults();
        conf.YC_Start_Inventory_User__c = UserInfo.getUserId();
        conf.InventoryDetailArchiveFolder__c = UserInfo.getUserId();
        conf.CC_Start_Inventory_User__c = UserInfo.getUserId();
        conf.HEB_Start_Inventory_User__c = UserInfo.getUserId();
        conf.DL_Start_Inventory_User__c = UserInfo.getUserId();
        conf.WLMQ_Start_Inventory_User__c = UserInfo.getUserId();
        conf.LZ_Start_Inventory_User__c = UserInfo.getUserId();
        conf.XA_Start_Inventory_User__c = UserInfo.getUserId();
        conf.TY_Start_Inventory_User__c = UserInfo.getUserId();
        conf.ZZ_Start_Inventory_User__c = UserInfo.getUserId();
        conf.JN_Start_Inventory_User__c = UserInfo.getUserId();
        conf.HHHT_Start_Inventory_User__c = UserInfo.getUserId();
        conf.SY_Start_Inventory_User__c = UserInfo.getUserId();
        conf.QD_Start_Inventory_User__c = UserInfo.getUserId();
        insert conf;
        setupTestData();
        InventoryResultRecordController con = new InventoryResultRecordController();
        con.init();
        con.showResult();
        con.bieCunFangDi = '银川';
        //未开始盘点
        List<Apexpages.Message> msgs = ApexPages.getMessages();
        boolean b = false;
        //再次开始盘点
        con.startInventory();
        con.bieCunFangDi = '长春';
        con.startInventory();
        con.bieCunFangDi = '哈尔滨';
        con.startInventory();
        con.bieCunFangDi = '大连';
        con.startInventory();
        con.bieCunFangDi = '乌鲁木齐';
        con.startInventory();
        con.bieCunFangDi = '兰州';
        con.startInventory();
        con.bieCunFangDi = '西安';
        con.startInventory();
        con.bieCunFangDi = '太原';
        con.startInventory();
        con.bieCunFangDi = '郑州';
        con.startInventory();
        con.bieCunFangDi = '济南';
        con.startInventory();
        con.bieCunFangDi = '呼和浩特';
        con.startInventory();
        con.bieCunFangDi = '沈阳';
        con.startInventory();
        con.bieCunFangDi = '青岛';
        con.startInventory();
        msgs = ApexPages.getMessages();
        b = false;
        for(Apexpages.Message msg:msgs){
            if (msg.getDetail().contains('有未结束的盘点')) b = true;
        }
    }
    //lt end
}
force-app/main/default/classes/MaintenanceProductDataControllerTest.cls
@@ -371,12 +371,25 @@
            mpdTest1.mpdDetailsRecords[3].mpded.Intra_Trade_Gurantee_RMB__c = 7500.00 ;
            mpdTest1.mpdDetailsRecords[3].mpded.Maintenance_Price_Year__c = 7000.00;
            mpdTest1.UpdateSave();
            Attachment att = new Attachment(
                Name = 'test',
                ParentId = mpdTest1.Id,
                Body = EncodingUtil.base64Decode('test')
            );
            insert att;
            ContentVersion version = new ContentVersion();
            version.Title = '123';
            version.VersionData = EncodingUtil.base64Decode('test');
            version.ContentLocation = 's';
            version.PathOnClient = '123.txt';
            insert version;
            version = [select ContentDocumentId from ContentVersion where Id =: version.Id];
            ContentDocumentLink link = new ContentDocumentLink();
            link.ContentDocumentId = version.ContentDocumentId;
            link.LinkedEntityId = mpdTest1.Id;
            link.ShareType = 'I';
            link.Visibility = 'AllUsers';
            insert link;
            // Attachment att = new Attachment(
            //     Name = 'test',
            //     ParentId = mpdTest1.Id,
            //     Body = EncodingUtil.base64Decode('test')
            // );
            // insert att;
            //system.assertEquals(1,mList.size());  
            if(mList.size()>0){
                mList[0].Status__c = '审批中-服务';
@@ -429,12 +442,25 @@
            //mpdTest1.UpdateSave();
            List<Maintenance_Product_Data__c> mListEdit = [SELECT Id,Status__c,Name,RecordTypeId, RecordType.Name,RecordType.DeveloperName
                            FROM Maintenance_Product_Data__c where id = :mpdTest1.id];
            Attachment att = new Attachment(
                Name = 'test11',
                ParentId = mListEdit[0].Id,
                Body = EncodingUtil.base64Decode('test11')
            );
            insert att;
            ContentVersion version = new ContentVersion();
            version.Title = '123';
            version.VersionData = EncodingUtil.base64Decode('test11');
            version.ContentLocation = 's';
            version.PathOnClient = '123.txt';
            insert version;
            version = [select ContentDocumentId from ContentVersion where Id =: version.Id];
            ContentDocumentLink link = new ContentDocumentLink();
            link.ContentDocumentId = version.ContentDocumentId;
            link.LinkedEntityId = mListEdit[0].Id;
            link.ShareType = 'I';
            link.Visibility = 'AllUsers';
            insert link;
            // Attachment att = new Attachment(
            //     Name = 'test11',
            //     ParentId = mListEdit[0].Id,
            //     Body = EncodingUtil.base64Decode('test11')
            // );
            // insert att;
            mpdTest1.init();
            mpdTest1.UpdateSave();
            mpdTest1.Submitmpd();
@@ -505,12 +531,25 @@
            MaintenanceProductDataController mpdTest1 = new MaintenanceProductDataController(new ApexPages.StandardController(m));
            List<Maintenance_Product_Data__c> mListEdit = [SELECT Id,Status__c,Name,RecordTypeId, RecordType.Name,RecordType.DeveloperName
                            FROM Maintenance_Product_Data__c where id = :mpdTest1.id];
            Attachment att = new Attachment(
                Name = 'test11',
                ParentId = mListEdit[0].Id,
                Body = EncodingUtil.base64Decode('test11')
            );
            insert att;
            ContentVersion version = new ContentVersion();
            version.Title = '123';
            version.VersionData = EncodingUtil.base64Decode('test11');
            version.ContentLocation = 's';
            version.PathOnClient = '123.txt';
            insert version;
            version = [select ContentDocumentId from ContentVersion where Id =: version.Id];
            ContentDocumentLink link = new ContentDocumentLink();
            link.ContentDocumentId = version.ContentDocumentId;
            link.LinkedEntityId = mListEdit[0].Id;
            link.ShareType = 'I';
            link.Visibility = 'AllUsers';
            insert link;
            // Attachment att = new Attachment(
            //     Name = 'test11',
            //     ParentId = mListEdit[0].Id,
            //     Body = EncodingUtil.base64Decode('test11')
            // );
            // insert att;
            mpdTest1.init();
            mpdTest1.UpdateSave();
            mpdTest1.Submitmpd();
force-app/main/default/classes/NFM401ControllerTest.cls
@@ -5,6 +5,7 @@
    @testSetup
    static void makeTestRepair() {
        StaticParameter.EscapeQISTrigger = false;
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院'];
        if (rectCo.size() == 0) {
            throw new ControllerUtil.myException('not found 病院 recodetype');
@@ -123,12 +124,25 @@
        System.runAs(new User(Id = Userinfo.getUserId())){
            insert rpr;
        }
        ContentVersion version = new ContentVersion();
        version.Title = '123';
        version.VersionData = EncodingUtil.base64Decode('test02');
        version.ContentLocation = 's';
        version.PathOnClient = '123.txt';
        insert version;
        version = [select ContentDocumentId from ContentVersion where Id =: version.Id];
        ContentDocumentLink link = new ContentDocumentLink();
        link.ContentDocumentId = version.ContentDocumentId;
        link.LinkedEntityId = rpr.Id;
        link.ShareType = 'I';
        link.Visibility = 'AllUsers';
        insert link;
        Attachment att = new Attachment();
        att.ParentId = rpr.Id;
        att.Name = 'test01';
        att.Body = EncodingUtil.base64Decode('test02');
        insert att;
        // Attachment att = new Attachment();
        // att.ParentId = rpr.Id;
        // att.Name = 'test01';
        // att.Body = EncodingUtil.base64Decode('test02');
        // insert att;
         qis = new QIS_Report__c();
@@ -146,11 +160,25 @@
        qis.next_action__c = '无偿更换';
        insert qis;
        Attachment att1 = new Attachment();
        att1.ParentId = qis.Id;
        att1.Name = 'test02';
        att1.Body = EncodingUtil.base64Decode('test02');
        insert att1;
        // ContentVersion version1 = new ContentVersion();
        // version1.Title = '123';
        // version1.VersionData = EncodingUtil.base64Decode('test02');
        // version1.ContentLocation = 's';
        // version1.PathOnClient = '123.txt';
        // insert version1;
        // version1 = [select ContentDocumentId from ContentVersion where Id =: version1.Id];
        // ContentDocumentLink link1 = new ContentDocumentLink();
        // link1.ContentDocumentId = version1.ContentDocumentId;
        // link1.LinkedEntityId = qis.Id;
        // link1.ShareType = 'I';
        // link1.Visibility = 'AllUsers';
        // insert link;
        // Attachment att1 = new Attachment();
        // att1.ParentId = qis.Id;
        // att1.Name = 'test02';
        // att1.Body = EncodingUtil.base64Decode('test02');
        // insert att1;
    }
force-app/main/default/classes/NotetoPdfHandler.cls
@@ -53,12 +53,14 @@
        List<Messaging.SingleEmailMessage> sendMails = new List<Messaging.SingleEmailMessage>();
        List<String> Rlist = new List<String>();
        List<String> ParentIdList = new List<String>();
        Map<String,String> idMap = new Map<String,String>();
        // QisID
        for (ContentDocumentLink link : newList) {
            if(String.valueOf(link.LinkedEntityId).startsWith('a0J') 
                || String.valueOf(link.LinkedEntityId).startsWith('a0f')){
                Rlist.add(link.ContentDocumentId);
                ParentIdList.add(link.LinkedEntityId);
                idMap.put(link.ContentDocumentId,link.LinkedEntityId);
            }
        }
        // for (Attachment att : newList) {
@@ -95,11 +97,11 @@
        }
        List<User> userList = [select Id, Name, Email, Manager.Email from User where id IN :IdList];
        for (ContentVersion version : verList) {
            ContentDocumentLink link = [select LinkedEntityId from ContentDocumentLink where ContentDocumentId =: version.ContentDocumentId limit 1];
            String titName = updateRprMap.containsKey(link.LinkedEntityId)? updateRprMap.get(link.LinkedEntityId).Name : updateQisMap.get(link.LinkedEntityId).Name;
            String prname = updateRprMap.containsKey(link.LinkedEntityId)? updateRprMap.get(link.LinkedEntityId).Delivered_Product__r.Name : updateQisMap.get(link.LinkedEntityId).nonyushohin__r.Name;
            String Serial = updateRprMap.containsKey(link.LinkedEntityId)? updateRprMap.get(link.LinkedEntityId).SerialNumber__c : updateQisMap.get(link.LinkedEntityId).lot_or_serial__c;
            String accountname = updateRprMap.containsKey(link.LinkedEntityId)? updateRprMap.get(link.LinkedEntityId).HP_Name__c : updateQisMap.get(link.LinkedEntityId).Hospital__r.Name;
            String linkedEntityId = idMap.get(version.ContentDocumentId);
            String titName = updateRprMap.containsKey(linkedEntityId)? updateRprMap.get(linkedEntityId).Name : updateQisMap.get(linkedEntityId).Name;
            String prname = updateRprMap.containsKey(linkedEntityId)? updateRprMap.get(linkedEntityId).Delivered_Product__r.Name : updateQisMap.get(linkedEntityId).nonyushohin__r.Name;
            String Serial = updateRprMap.containsKey(linkedEntityId)? updateRprMap.get(linkedEntityId).SerialNumber__c : updateQisMap.get(linkedEntityId).lot_or_serial__c;
            String accountname = updateRprMap.containsKey(linkedEntityId)? updateRprMap.get(linkedEntityId).HP_Name__c : updateQisMap.get(linkedEntityId).Hospital__r.Name;
            String title = '';
            String body = '';
            if(version.TextPreview != null){
@@ -119,7 +121,7 @@
            body += '操作担当:' + UserInfo.getName();
            body += '<br/>';
            body += '<br/>';
            body += '链接:' + baseUrl + '/' + link.LinkedEntityId +' ';
            body += '链接:' + baseUrl + '/' + linkedEntityId +' ';
            //收件邮箱
            List<String> toMailList = new List<String>();
            String uId = UserInfo.getUserId();
force-app/main/default/classes/NotetoPdfHandlerTest.cls
New file
@@ -0,0 +1,81 @@
@isTest
private class NotetoPdfHandlerTest {
    private static Id pricebookId = ControllerUtil.getStandardPricebook().Id;
    static testMethod void NotetoPdf() {
        // 病院を作る
        Account hospital = new Account();
        hospital.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'].id;
        hospital.Name = 'test hospital';
        insert hospital;
        // 戦略科室を得る
        List<Account> strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hospital.Id AND recordType.DeveloperName = 'Department_Class_GI'];
        // 診療科を作る
        Account dep = new Account();
        dep.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_GI'].id;
        dep.Name = 'test dep';
        dep.ParentId = strategicDep[0].Id;
        dep.Department_Class__c = strategicDep[0].Id;
        dep.Hospital__c = hospital.Id;
        insert dep;
        // 製品を作る
        Product2 productA = new Product2( Name='テスト商品');
        insert productA;
        // 価格表エントリを作成する
        PricebookEntry entry = new PricebookEntry( Pricebook2Id=pricebookId, Product2Id=productA.Id);
        entry.UnitPrice = 0;
        entry.IsActive = true;
        entry.UseStandardPrice = false;
        entry.CurrencyIsoCode = 'CNY';
        entry.Product2Id = productA.Id;
        insert entry;
        // 納入機器を作成する
        Asset asset = new Asset();
        asset.Name = 'テスト機器';
        asset.AccountId = dep.Id;
        asset.Department_Class__c = strategicDep[0].Id;
        asset.Hospital__c = hospital.Id;
        asset.SerialNumber = 'testserial';
        insert asset;
        // 维修合同を作成する
        Maintenance_Contract__c contract = new Maintenance_Contract__c();
        contract.Name = 'tect contract';
        contract.Hospital__c = hospital.Id;
        contract.Department_Class__c = strategicDep[0].Id;
        contract.Department__c = dep.Id;
        insert contract;
        // 修理を作成する
        Repair__c repair = new Repair__c();
        repair.Account__c = dep.Id;
        repair.Department_Class__c = strategicDep[0].Id;
        repair.Hospital__c = hospital.Id;
        repair.Delivered_Product__c = asset.Id;
        insert repair;
        ContentVersion version = new ContentVersion();
        version.Title = fileName;
        version.VersionData = EncodingUtil.base64Decode(base64Data);
        version.ContentLocation = 's';
        version.PathOnClient = fileName + '.' + contentType;
        insert version;
        version = [select ContentDocumentId from ContentVersion where Id =: version.Id];
        ContentDocumentLink link = new ContentDocumentLink();
        link.ContentDocumentId = version.ContentDocumentId;
        link.LinkedEntityId = repair.Id;
        link.ShareType = 'V';
        link.Visibility = 'AllUsers';
        insert link;
        // Note n = new Note();
        // n.ParentId = repair.Id;
        // n.Title = 'testnote';
        // insert n;
        PageReference page = new PageReference('/apex/ReAndQISNotePDF?id='+n.id);
        System.Test.setCurrentPage(page);
        ReAndQISNotePDFController conTest = new ReAndQISNotePDFController();
    }
}
force-app/main/default/classes/NotetoPdfHandlerTest.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/OFSRepairConsignPDFOuterControllerTest.cls
@@ -78,6 +78,7 @@
        insert repair1;
        
        // PDFテスト
        Test.startTest();
        PageReference page = new PageReference('/apex/OFSRepairConsignPDF?id=' + repair1.Id);
        System.Test.setCurrentPage(page);
        OFSRepairConsignPDFController irpdf = new OFSRepairConsignPDFController();
@@ -91,5 +92,6 @@
        irpdf2.signStr = 'aaaaabbbbbccccc';
        irpdf2.saveSign();
        irpdf2.savePDF();
        Test.stopTest();
    }
}
force-app/main/default/classes/OFSUploadImageRest.cls
@@ -10,20 +10,27 @@
        String ccId, acId;
        
        if (String.isNotBlank(repairId)) {
            Repair__c repair = [Select Id, contract_consent_id__c, acceptance_id__c From Repair__c Where Id= :repairId];
            if (repair == null) {
                res.statusCode = 200;
                jsonResponse = '{"status": "Failure", "Message": "no repair found"}';
                res.responseBody = blob.valueOf(jsonResponse);
                return;
            Repair__c repair = null;
            try {
                repair = [Select Id, contract_consent_id__c, acceptance_id__c From Repair__c Where Id= :repairId];
            } catch ( Exception ex ) {
                returnMessage('{"status": "Failure", "Message": "no repair found"}',200);
                // res.statusCode = 200;
                // jsonResponse = '{"status": "Failure", "Message": "no repair found"}';
                // res.responseBody = blob.valueOf(jsonResponse);
                // return;
            }
            if (String.isNotBlank(ccImg)) {
                Repair_Quotation__c repairQ = [Select Id, contract_consent_id__c From Repair_Quotation__c Where Id= :rqId];
                if (repairQ == null) {
                    res.statusCode = 200;
                    jsonResponse = '{"status": "Failure", "Message": "no RepairQuotation found"}';
                    res.responseBody = blob.valueOf(jsonResponse);
                    return;
                Repair_Quotation__c repairQ = null;
                try {
                    repairQ = [Select Id, contract_consent_id__c From Repair_Quotation__c Where Id= :rqId];
                } catch ( Exception ex ) {
                    returnMessage('{"status": "Failure", "Message": "no RepairQuotation found"}',200);
                    // res.statusCode = 200;
                    // jsonResponse = '{"status": "Failure", "Message": "no RepairQuotation found"}';
                    // res.responseBody = blob.valueOf(jsonResponse);
                    // return;
                }
                // Attachment att;
                ContentVersion version;
@@ -60,10 +67,11 @@
                } catch ( Exception ex ) {
                    //TODO:
                    //error message:cannot update exception
                    res.statusCode = 200;
                    jsonResponse = '{"status": "Failure", "Message": "error when try to upsert ContractConsent Attachment. '+ ex +'"}';
                    res.responseBody = blob.valueOf(jsonResponse);
                    return;
                    returnMessage('{"status": "Failure", "Message": "error when try to upsert ContractConsent Attachment. '+ ex +'"}',200);
                    // res.statusCode = 200;
                    // jsonResponse = '{"status": "Failure", "Message": "error when try to upsert ContractConsent Attachment. '+ ex +'"}';
                    // res.responseBody = blob.valueOf(jsonResponse);
                    // return;
                }
                
                try {
@@ -71,10 +79,11 @@
                } catch ( Exception ex ) {
                    //TODO:
                    //error message:cannot update exception
                    res.statusCode = 200;
                    jsonResponse = '{"status": "Failure", "Message": "error when try to update RepairQuotation. '+ ex +'"}';
                    res.responseBody = blob.valueOf(jsonResponse);
                    return;
                    returnMessage('{"status": "Failure", "Message": "error when try to update RepairQuotation. '+ ex +'"}',200);
                    // res.statusCode = 200;
                    // jsonResponse = '{"status": "Failure", "Message": "error when try to update RepairQuotation. '+ ex +'"}';
                    // res.responseBody = blob.valueOf(jsonResponse);
                    // return;
                }
            }
            if (String.isNotBlank(acImg)) {
@@ -112,10 +121,11 @@
                } catch ( Exception ex ) {
                    //TODO:
                    //error message:cannot update exception
                    res.statusCode = 200;
                    jsonResponse = '{"status": "Failure", "Message": "error when try to upsert Acceptance Attachment. '+ ex +'"}';
                    res.responseBody = blob.valueOf(jsonResponse);
                    return;
                    returnMessage('{"status": "Failure", "Message": "error when try to upsert Acceptance Attachment. '+ ex +'"}',200);
                    // res.statusCode = 200;
                    // jsonResponse = '{"status": "Failure", "Message": "error when try to upsert Acceptance Attachment. '+ ex +'"}';
                    // res.responseBody = blob.valueOf(jsonResponse);
                    // return;
                }
            }
            
@@ -123,23 +133,36 @@
            if (String.isNotBlank(acId)) repair.acceptance_id__c = acId;
            try {
                update repair;
                res.statusCode = 200;
                jsonResponse = '{"status": "Success", "Message": "upload Success"}';
                res.responseBody = blob.valueOf(jsonResponse);
                return;
                returnMessage('{"status": "Success", "Message": "upload Success"}',200);
                // res.statusCode = 200;
                // jsonResponse = '{"status": "Success", "Message": "upload Success"}';
                // res.responseBody = blob.valueOf(jsonResponse);
                // return;
            } catch ( Exception ex ) {
                //TODO:
                //error message:cannot update exception
                res.statusCode = 200;
                jsonResponse = '{"status": "Failure", "Message": "error when try to update repair data. '+ ex +'"}';
                res.responseBody = blob.valueOf(jsonResponse);
                return;
                returnMessage('{"status": "Failure", "Message": "error when try to update repair data. '+ ex +'"}',200);
                // res.statusCode = 200;
                // jsonResponse = '{"status": "Failure", "Message": "error when try to update repair data. '+ ex +'"}';
                // res.responseBody = blob.valueOf(jsonResponse);
                // return;
            }
        } else {
            res.statusCode = 200;
            jsonResponse = '{"status": "Failure", "Message": "no repair Id"}';
            returnMessage('{"status": "Failure", "Message": "no repair Id"}',200);
            // res.statusCode = 200;
            // jsonResponse = '{"status": "Failure", "Message": "no repair Id"}';
            // res.responseBody = blob.valueOf(jsonResponse);
            // return;
        }
    }
    public static void returnMessage(String response,Integer code){
        RestResponse res = RestContext.response;
        res.addHeader('Content-Type', 'application/json');
        String jsonResponse;
        res.statusCode = code;
        jsonResponse = response;
            res.responseBody = blob.valueOf(jsonResponse);
            return;
        }
    }
}
force-app/main/default/classes/OFSUploadImageRestTest.cls
New file
@@ -0,0 +1,212 @@
@isTest
private class OFSUploadImageRestTest {
    private static Id pricebookId = ControllerUtil.getStandardPricebook().Id;
    @isTest
    static void test_method1() {
        // 病院を作る
        Account hospital = new Account();
        hospital.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'].id;
        hospital.Name = 'test hospital';
        insert hospital;
        // 戦略科室を得る
        List<Account> strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hospital.Id AND recordType.DeveloperName = 'Department_Class_GI'];
        // 診療科を作る
        Account dep = new Account();
        dep.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_GI'].id;
        dep.Name = 'test dep';
        dep.ParentId = strategicDep[0].Id;
        dep.Department_Class__c = strategicDep[0].Id;
        dep.Hospital__c = hospital.Id;
        insert dep;
        // 製品を作る
        Product2 productA = new Product2( Name='テスト商品');
        insert productA;
        // 価格表エントリを作成する
        PricebookEntry entry = new PricebookEntry( Pricebook2Id=pricebookId, Product2Id=productA.Id);
        entry.UnitPrice = 0;
        entry.IsActive = true;
        entry.UseStandardPrice = false;
        entry.CurrencyIsoCode = 'CNY';
        entry.Product2Id = productA.Id;
        insert entry;
        // 納入機器を作成する
        Asset asset = new Asset();
        asset.Name = 'テスト機器';
        asset.AccountId = dep.Id;
        asset.Department_Class__c = strategicDep[0].Id;
        asset.Hospital__c = hospital.Id;
        asset.SerialNumber = 'testserial';
        insert asset;
        // 维修合同を作成する
        Maintenance_Contract__c contract = new Maintenance_Contract__c();
        contract.Name = 'tect contract';
        contract.Hospital__c = hospital.Id;
        contract.Department_Class__c = strategicDep[0].Id;
        contract.Department__c = dep.Id;
        insert contract;
        // 修理を作成する
        Repair__c repair = new Repair__c();
        repair.Account__c = dep.Id;
        repair.Department_Class__c = strategicDep[0].Id;
        repair.Hospital__c = hospital.Id;
        repair.Delivered_Product__c = asset.Id;
        insert repair;
        Repair_Quotation__c rq = new Repair_Quotation__c();
        rq.Name                  = 'testNFM104';
        rq.Repair__c             = repair.Id;
        rq.MessageGroupNumber__c = '1';
        insert rq;
        ContentVersion version = new ContentVersion(
            Title = 'test',
            VersionData = EncodingUtil.base64Decode('test'),
            ContentLocation = 's',
            PathOnClient = 'test.txt'
        );
        insert version;
        List<RecordType> rectDpt = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '診療科 消化科'];
        if (rectDpt.size() == 0) {
            throw new ControllerUtil.myException('not found 診療科 消化科 recordType');
        }
        String str = EncodingUtil.base64Encode(version.VersionData);
        RestRequest req = new RestRequest();
        RestResponse res = new RestResponse();
        Account depart = [select Management_Code__c from Account where RecordTypeId = :rectDpt[0].Id];
        String JsonMsg = '{"visitStartDate":"20211221033551",'+
                        '"visitPurpose":"维修跟进",'+
                        '"visitInfo":"报价任务",'+
                        '"visitEndDate":"20211221033554",'+
                        '"visitDistinction":"用户拜访",'+
                        '"synchroDate":"20211221153601",'+
                        '"replyResult":"报价跟进",'+
                        '"replyID":"88",'+
                        '"mngCd":null,'+
                            '"departmentCd":"'+depart.Management_Code__c+'",'+
                        '"applicantId":"5",'+
                        '"activityDifferentiation":"报价跟进"}';
        req.requestURI = 'services/apexrest/NFM608/execute';
        req.httpMethod = 'POST';
        req.requestBody = Blob.valueof(JsonMsg);
        RestContext.request = req;
        RestContext.response= res;
        Test.startTest();
        OFSUploadImageRest.doPost(repair.Id,str,str,rq.Id);
        OFSUploadImageRest.doPost('',str,str,rq.Id);
        // OFSUploadImageRest.doPost(repair.Id,str,str,'');
        Test.stopTest();
    }
    @isTest
    static void test_method2() {
        // 病院を作る
        Account hospital = new Account();
        hospital.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'].id;
        hospital.Name = 'test hospital';
        insert hospital;
        // 戦略科室を得る
        List<Account> strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hospital.Id AND recordType.DeveloperName = 'Department_Class_GI'];
        // 診療科を作る
        Account dep = new Account();
        dep.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_GI'].id;
        dep.Name = 'test dep';
        dep.ParentId = strategicDep[0].Id;
        dep.Department_Class__c = strategicDep[0].Id;
        dep.Hospital__c = hospital.Id;
        insert dep;
        // 製品を作る
        Product2 productA = new Product2( Name='テスト商品');
        insert productA;
        // 価格表エントリを作成する
        PricebookEntry entry = new PricebookEntry( Pricebook2Id=pricebookId, Product2Id=productA.Id);
        entry.UnitPrice = 0;
        entry.IsActive = true;
        entry.UseStandardPrice = false;
        entry.CurrencyIsoCode = 'CNY';
        entry.Product2Id = productA.Id;
        insert entry;
        // 納入機器を作成する
        Asset asset = new Asset();
        asset.Name = 'テスト機器';
        asset.AccountId = dep.Id;
        asset.Department_Class__c = strategicDep[0].Id;
        asset.Hospital__c = hospital.Id;
        asset.SerialNumber = 'testserial';
        insert asset;
        // 维修合同を作成する
        Maintenance_Contract__c contract = new Maintenance_Contract__c();
        contract.Name = 'tect contract';
        contract.Hospital__c = hospital.Id;
        contract.Department_Class__c = strategicDep[0].Id;
        contract.Department__c = dep.Id;
        insert contract;
        // 修理を作成する
        Repair__c repair = new Repair__c();
        repair.Account__c = dep.Id;
        repair.Department_Class__c = strategicDep[0].Id;
        repair.Hospital__c = hospital.Id;
        repair.Delivered_Product__c = asset.Id;
        insert repair;
        Repair_Quotation__c rq = new Repair_Quotation__c();
        rq.Name                  = 'testNFM104';
        rq.Repair__c             = repair.Id;
        rq.MessageGroupNumber__c = '1';
        insert rq;
        ContentVersion version = new ContentVersion(
            Title = 'test',
            VersionData = EncodingUtil.base64Decode('test'),
            ContentLocation = 's',
            PathOnClient = 'test.txt'
        );
        insert version;
        List<RecordType> rectDpt = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '診療科 消化科'];
        if (rectDpt.size() == 0) {
            throw new ControllerUtil.myException('not found 診療科 消化科 recordType');
        }
        String str = EncodingUtil.base64Encode(version.VersionData);
        RestRequest req = new RestRequest();
        RestResponse res = new RestResponse();
        Account depart = [select Management_Code__c from Account where RecordTypeId = :rectDpt[0].Id];
        String JsonMsg = '{"visitStartDate":"20211221033551",'+
                        '"visitPurpose":"维修跟进",'+
                        '"visitInfo":"报价任务",'+
                        '"visitEndDate":"20211221033554",'+
                        '"visitDistinction":"用户拜访",'+
                        '"synchroDate":"20211221153601",'+
                        '"replyResult":"报价跟进",'+
                        '"replyID":"88",'+
                        '"mngCd":null,'+
                            '"departmentCd":"'+depart.Management_Code__c+'",'+
                        '"applicantId":"5",'+
                        '"activityDifferentiation":"报价跟进"}';
        req.requestURI = 'services/apexrest/NFM608/execute';
        req.httpMethod = 'POST';
        req.requestBody = Blob.valueof(JsonMsg);
        RestContext.request = req;
        RestContext.response= res;
        Test.startTest();
        OFSUploadRepairImageRest.doPost(repair.Id,str,str,rq.Id);
        OFSUploadRepairImageRest.doPost('',str,str,rq.Id);
        // OFSUploadRepairImageRest.doPost(repair.Id,str,str,'');
        Test.stopTest();
    }
}
force-app/main/default/classes/OFSUploadImageRestTest.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>58.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/classes/OFSUploadRepairImageRest.cls
@@ -11,21 +11,31 @@
        String acId;            // 検収書
        
        if (String.isNotBlank(repairId)) {
            Repair__c repair = [Select Id, Agreed_Date__c, Facility_Return_Receipt_Collection_Date__c, acceptance_id__c From Repair__c Where Id= :repairId];
            if (repair == null) {
                res.statusCode = 200;
                jsonResponse = '{"'+ System.Label.OFSErrorStatus +'": "'+ System.Label.OFSErrorFailure +'", "'+ System.Label.OFSErrorMessage + '": "no repair found"}';
                res.responseBody = blob.valueOf(jsonResponse);
                return;
            Repair__c repair = null;
            try {
                repair = [Select Id, Agreed_Date__c, Facility_Return_Receipt_Collection_Date__c, acceptance_id__c From Repair__c Where Id= :repairId];
            } catch ( Exception ex ) {
                returnMessage('{"'+ System.Label.OFSErrorStatus +'": "'+ System.Label.OFSErrorFailure +'", "'+ System.Label.OFSErrorMessage + '": "no repair found"}',200);
            }
            // if (repair == null) {
            //     res.statusCode = 200;
            //     jsonResponse = '{"'+ System.Label.OFSErrorStatus +'": "'+ System.Label.OFSErrorFailure +'", "'+ System.Label.OFSErrorMessage + '": "no repair found"}';
            //     res.responseBody = blob.valueOf(jsonResponse);
            //     return;
            // }
            if (String.isNotBlank(ccImg)) {
                Repair_Quotation__c repairQ = [Select Id, contract_consent_id__c From Repair_Quotation__c Where Id= :rqId];
                if (repairQ == null) {
                    res.statusCode = 200;
                    jsonResponse = '{"'+ System.Label.OFSErrorStatus +'": "'+ System.Label.OFSErrorFailure +'", "'+ System.Label.OFSErrorMessage + '": "no RepairQuotation found"}';
                    res.responseBody = blob.valueOf(jsonResponse);
                    return;
                Repair_Quotation__c repairQ = null;
                try {
                    repairQ = [Select Id, contract_consent_id__c From Repair_Quotation__c Where Id= :rqId];
                } catch ( Exception ex ) {
                    returnMessage('{"'+ System.Label.OFSErrorStatus +'": "'+ System.Label.OFSErrorFailure +'", "'+ System.Label.OFSErrorMessage + '": "no RepairQuotation found"}',200);
                }
                // if (repairQ == null) {
                //     res.statusCode = 200;
                //     jsonResponse = '{"'+ System.Label.OFSErrorStatus +'": "'+ System.Label.OFSErrorFailure +'", "'+ System.Label.OFSErrorMessage + '": "no RepairQuotation found"}';
                //     res.responseBody = blob.valueOf(jsonResponse);
                //     return;
                // }
                // List<Attachment> attList = [Select Id, Name, Body, ParentId From Attachment Where Id= :repairQ.contract_consent_id__c];
                // Attachment att = null;
                List<ContentVersion> verisonList = [select Id,Title,VersionData from ContentVersion where Id =: repairQ.contract_consent_id__c];
@@ -62,10 +72,11 @@
                } catch ( Exception ex ) {
                    //TODO:
                    //error message:cannot update exception
                    res.statusCode = 200;
                    jsonResponse = '{"'+ System.Label.OFSErrorStatus +'": "'+ System.Label.OFSErrorFailure +'", "'+ System.Label.OFSErrorMessage + '": "error when try to upsert ContractConsent Attachment. '+ ex +'"}';
                    res.responseBody = blob.valueOf(jsonResponse);
                    return;
                    returnMessage('{"'+ System.Label.OFSErrorStatus +'": "'+ System.Label.OFSErrorFailure +'", "'+ System.Label.OFSErrorMessage + '": "error when try to upsert ContractConsent Attachment. '+ ex +'"}',200);
                    // res.statusCode = 200;
                    // jsonResponse = '{"'+ System.Label.OFSErrorStatus +'": "'+ System.Label.OFSErrorFailure +'", "'+ System.Label.OFSErrorMessage + '": "error when try to upsert ContractConsent Attachment. '+ ex +'"}';
                    // res.responseBody = blob.valueOf(jsonResponse);
                    // return;
                }
                
                try {
@@ -73,10 +84,11 @@
                } catch ( Exception ex ) {
                    //TODO:
                    //error message:cannot update exception
                    res.statusCode = 200;
                    jsonResponse = '{"'+ System.Label.OFSErrorStatus +'": "'+ System.Label.OFSErrorFailure +'", "'+ System.Label.OFSErrorMessage + '": "error when try to update RepairQuotation. '+ ex +'"}';
                    res.responseBody = blob.valueOf(jsonResponse);
                    return;
                    returnMessage('{"'+ System.Label.OFSErrorStatus +'": "'+ System.Label.OFSErrorFailure +'", "'+ System.Label.OFSErrorMessage + '": "error when try to update RepairQuotation. '+ ex +'"}',200);
                    // res.statusCode = 200;
                    // jsonResponse = '{"'+ System.Label.OFSErrorStatus +'": "'+ System.Label.OFSErrorFailure +'", "'+ System.Label.OFSErrorMessage + '": "error when try to update RepairQuotation. '+ ex +'"}';
                    // res.responseBody = blob.valueOf(jsonResponse);
                    // return;
                }
            }
            if (String.isNotBlank(acImg)) {
@@ -115,10 +127,11 @@
                } catch ( Exception ex ) {
                    //TODO:
                    //error message:cannot update exception
                    res.statusCode = 200;
                    jsonResponse = '{"'+ System.Label.OFSErrorStatus +'": "'+ System.Label.OFSErrorFailure +'", "'+ System.Label.OFSErrorMessage + '": "error when try to upsert Acceptance Attachment. '+ ex +'"}';
                    res.responseBody = blob.valueOf(jsonResponse);
                    return;
                    returnMessage('{"'+ System.Label.OFSErrorStatus +'": "'+ System.Label.OFSErrorFailure +'", "'+ System.Label.OFSErrorMessage + '": "error when try to upsert Acceptance Attachment. '+ ex +'"}',200);
                    // res.statusCode = 200;
                    // jsonResponse = '{"'+ System.Label.OFSErrorStatus +'": "'+ System.Label.OFSErrorFailure +'", "'+ System.Label.OFSErrorMessage + '": "error when try to upsert Acceptance Attachment. '+ ex +'"}';
                    // res.responseBody = blob.valueOf(jsonResponse);
                    // return;
                }
            }
            
@@ -147,16 +160,28 @@
            } catch ( Exception ex ) {
                //TODO:
                //error message:cannot update exception
                res.statusCode = 200;
                jsonResponse = '{"'+ System.Label.OFSErrorStatus +'": "'+ System.Label.OFSErrorFailure +'", "'+ System.Label.OFSErrorMessage + '": "error when try to update repair data. '+ ex +'"}';
                res.responseBody = blob.valueOf(jsonResponse);
                return;
                returnMessage('{"'+ System.Label.OFSErrorStatus +'": "'+ System.Label.OFSErrorFailure +'", "'+ System.Label.OFSErrorMessage + '": "error when try to update repair data. '+ ex +'"}',200);
                // res.statusCode = 200;
                // jsonResponse = '{"'+ System.Label.OFSErrorStatus +'": "'+ System.Label.OFSErrorFailure +'", "'+ System.Label.OFSErrorMessage + '": "error when try to update repair data. '+ ex +'"}';
                // res.responseBody = blob.valueOf(jsonResponse);
                // return;
            }
        } else {
            res.statusCode = 200;
            jsonResponse = '{"'+ System.Label.OFSErrorStatus +'": "'+ System.Label.OFSErrorFailure +'", "'+ System.Label.OFSErrorMessage + '": "no repair Id"}';
            returnMessage('{"'+ System.Label.OFSErrorStatus +'": "'+ System.Label.OFSErrorFailure +'", "'+ System.Label.OFSErrorMessage + '": "no repair Id"}',200);
            // res.statusCode = 200;
            // jsonResponse = '{"'+ System.Label.OFSErrorStatus +'": "'+ System.Label.OFSErrorFailure +'", "'+ System.Label.OFSErrorMessage + '": "no repair Id"}';
            // res.responseBody = blob.valueOf(jsonResponse);
            // return;
        }
    }
    public static void returnMessage(String response,Integer code){
        RestResponse res = RestContext.response;
        res.addHeader('Content-Type', 'application/json');
        String jsonResponse;
        res.statusCode = code;
        jsonResponse = response;
            res.responseBody = blob.valueOf(jsonResponse);
            return;
        }
    }
}
force-app/main/default/classes/OpportunityLightingButtonController.cls
@@ -4,7 +4,7 @@
 * @Author: chen jing wu
 * @Date: 2023-04-12 11:16:07
 * @LastEditors: chen jing wu
 * @LastEditTime: 2023-10-10 17:08:13
 * @LastEditTime: 2023-10-19 16:29:00
 */
public with sharing class OpportunityLightingButtonController {
    @AuraEnabled
@@ -462,7 +462,8 @@
                SI_Decide_ID__c,
                Name,
                Opportunity_No__c,
                IsAuthorized__c
                IsAuthorized__c,
                recordTypeId
                from Opportunity where Id =: recordId
            ];
            res.authorizedDBNo = oppo.Authorized_DB_No__c;
@@ -471,6 +472,7 @@
            res.name = oppo.Name;
            res.opportunityNo = oppo.Opportunity_No__c;
            res.isAuthorized = oppo.IsAuthorized__c;
            res.recordTypeId = oppo.recordTypeId;
        } catch (Exception e) {
            
        }
@@ -598,7 +600,7 @@
            update opp;
            return null;
        } catch (Exception e) {
            return errorMessage(e);
            return e.getDmlMessage(0);
        }
    }
    @AuraEnabled
@@ -610,7 +612,7 @@
            update opp;
            return null;
        } catch (Exception e) {
            return errorMessage(e);
            return e.getDmlMessage(0);
        }
    }
    @AuraEnabled
@@ -624,7 +626,7 @@
            update opp;
            return null;
        } catch (Exception e) {
            return errorMessage(e);
            return e.getDmlMessage(0);
        }
    }
    @AuraEnabled
@@ -640,7 +642,7 @@
            update opp;
            return null;
        } catch (Exception e) {
            return errorMessage(e);
            return e.getDmlMessage(0);
        }
    }
    @AuraEnabled
@@ -770,7 +772,7 @@
            processResults.add(Approval.process(request));
            return processResults[0].errors;
        } catch (Exception e) {
            return errorMessage(e);
            return e.getDmlMessage(0);
        }
    }
    @AuraEnabled
@@ -784,7 +786,7 @@
            ];
            return user.Id;
        } catch (Exception e) {
            return errorMessage(e);
            return e.getDmlMessage(0);
        }
    }
    @AuraEnabled
@@ -798,7 +800,7 @@
            ];
            return pro.Id;
        } catch (Exception e) {
            return errorMessage(e);
            return e.getDmlMessage(0);
        }
    }
    @AuraEnabled
@@ -943,25 +945,29 @@
            return '1';     
        } catch (Exception ex) {
            Database.rollback(sp);
            return errorMessage(ex);
            return ex.getDmlMessage(0);
        }
    }
    @AuraEnabled
    public static Boolean queryLostReport (String recordId){
        RecordType recordType1 = [select Id from RecordType where Name = '询价取消报告'];
        List<Lost_cancel_report__c> repList = [select Id from Lost_cancel_report__c where Opportunity__c =: recordId and RecordTypeId !=: recordType1.Id];
        if(repList.size() > 0){
            return true;
        }
        return false;
    }
    public static string errorMessage(Exception e){
        if (e.getMessage().contains(',')) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
            String exc = '' + e.getMessage();
            Integer left = exc.indexOf(':') + 1;
            Integer right = exc.lastIndexOf(':');
            String str = exc.substring(left,right);
            left = str.indexOf(',') +  1;
            String newStr = str.substring(left);
            return newStr;
        }else {
            return e.getMessage();
    @AuraEnabled
    public static Boolean queryCancelReport (String recordId){
        RecordType recordType1 = [select Id from RecordType where Name = '询价取消报告'];
        List<Lost_cancel_report__c> repList = [select Id from Lost_cancel_report__c where Opportunity__c =: recordId and RecordTypeId =: recordType1.Id];
        if(repList.size() > 0){
            return true;
        }
        return false;
        }
    }
    public class InitData{
        @AuraEnabled
        public Boolean directLossFLG;
force-app/main/default/classes/OpportunityLightingButtonControllerTest.cls
@@ -112,6 +112,11 @@
        OpportunityLightingButtonController.changeTrade(oppList[0].Id);
        OpportunityLightingButtonController.queryQuote('');
        OpportunityLightingButtonController.queryForNewOpportunityAgencyButtonToRecTypeList('Product','',true);
        Test.stopTest();
    }
    static testMethod void test2(){
        OCMManagementProvinceWebService.updateOpportunity();
    }
}
force-app/main/default/classes/PCLLostProduct2AssetHandlerTest.cls
@@ -35,7 +35,18 @@
        depart2.Department_Class__c = dc1s[0].Id;
        depart2.Hospital__c         = company1.Id;
        insert new Account[] {depart1, depart2};
        //01210000000Qem1
        Account depart3 = new Account();
        depart3.RecordTypeId = '01210000000Qem1';
        depart3.Name         = '*';
        depart3.Hospital__c         = company1.Id;
        insert new Account[] {depart1, depart2,depart3};
        String recordtypeid = '01210000000aMAE';
        if (NFMUtil.isSandbox()) {
            recordtypeid = '01210000000aMAE';
        }
        List<Product2> prdList = new List<Product2>();
        Product2 prd1 = new Product2();
        prd1.ProductCode_Ext__c     = 'HistoryPrd1';
@@ -45,6 +56,7 @@
        prd1.Manual_Entry__c        = true;
        prd1.Category5__c = '竞争对手';
        prd1.Brand_Name__c = 'STORZ';
        prd1.recordTypeId = recordtypeid; //20230221上线改为‘01210000000aMAE’,上完还原recordtypeid
        // prd1.Lost_By_Company__c= 'STORZ'; //add tcm 20211213
        Product2 prd2 = new Product2();
@@ -55,6 +67,7 @@
        prd2.Manual_Entry__c        = true;
        prd2.Category5__c = '竞争对手';
        prd2.Brand_Name__c = 'STORZ';
        prd2.recordTypeId = recordtypeid;
        // prd2.Lost_By_Company__c= 'STORZ'; //add tcm 20211213
        insert new Product2[] {prd1, prd2};
@@ -92,7 +105,7 @@
            // ProductCategory__c = '3D',
            Lost_By_Company__c = 'STORZ',
            LostPrice__c = 11,
            Agency__c = depart1.id,
            Agency__c = depart3.id,
            Lost_reason_main__c ='无信息,跟进不及时'
            );
        insert lcB;
force-app/main/default/classes/ReportController.cls
@@ -305,7 +305,7 @@
            // }else {
            //     return e.getMessage();   
            // }
            return errorMessage(e);
            return e.getDmlMessage(0);
        }
    }
    //OPDtoSIS操作更新相应数据
@@ -330,7 +330,7 @@
            // }else {
            //     return e.getMessage();   
            // }
            return errorMessage(e);
            return e.getDmlMessage(0);
        }
    }
@@ -358,7 +358,7 @@
            // }else {
            //     return e.getMessage();   
            // }
            return errorMessage(e);
            return e.getDmlMessage(0);
        }
    }
    //完毕操作更新相应数据
@@ -384,7 +384,7 @@
            // }else {
            //     return e.getMessage();   
            // }
            return errorMessage(e);
            return e.getDmlMessage(0);
        }
    }
    //OCSM要报告操作更新相应数据
@@ -409,7 +409,7 @@
            // }else {
            //     return e.getMessage();   
            // }
            return errorMessage(e);
            return e.getDmlMessage(0);
        }
    }
@@ -435,7 +435,7 @@
            // }else {
            //     return e.getMessage();   
            // }
            return errorMessage(e);
            return e.getDmlMessage(0);
        }
    }
    //DispatchOCSMQARA操作更新相应数据
@@ -460,7 +460,7 @@
            // }else {
            //     return e.getMessage();   
            // }
            return errorMessage(e);
            return e.getDmlMessage(0);
        }
    }
    //OCSM不要报告操作更新相应数据
@@ -485,7 +485,7 @@
            // }else {
            //     return e.getMessage();   
            // }
            return errorMessage(e);
            return e.getDmlMessage(0);
        }
    }
@@ -511,7 +511,7 @@
            // }else {
            //     return e.getMessage();   
            // }
            return errorMessage(e);
            return e.getDmlMessage(0);
        }
    }
    
@@ -557,7 +557,7 @@
            // }else {
            //     return e.getMessage();   
            // }
            return errorMessage(e);
            return e.getDmlMessage(0);
        }
    }
@@ -583,7 +583,7 @@
            // }else {
            //     return e.getMessage();   
            // } 
            return errorMessage(e);
            return e.getDmlMessage(0);
        }
    }
@@ -612,7 +612,7 @@
            // }else {
            //     return e.getMessage();   
            // }
            return errorMessage(e);
            return e.getDmlMessage(0);
        }
    }
    //VOC回答更新相应数据
@@ -673,7 +673,7 @@
            // }else {
            //     return e.getMessage();   
            // }
            return errorMessage(e);
            return e.getDmlMessage(0);
        }
    }
    //VOC判定更新相应数据
@@ -722,9 +722,7 @@
                }
                return null;
        } catch (Exception e) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
            String exc = e.getMessage();
            return exc;
            return e.getDmlMessage(0);
        }
    }
    //VOC完毕操作更新相应数据
@@ -736,7 +734,7 @@
            update report;
            return null;
        } catch (Exception e) {
            return errorMessage(e);
            return e.getDmlMessage(0);
            // if (e.getMessage().contains(',')) {
            //     System.debug(LoggingLevel.INFO, '*** e: ' + e);
            //     String exc = '' + e.getMessage();
@@ -771,21 +769,7 @@
        }
        return profile.Id;
    }
    public static string errorMessage(Exception e){
        if (e.getMessage().contains(',')) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
            String exc = '' + e.getMessage();
            Integer left = exc.indexOf(':') + 1;
            Integer right = exc.lastIndexOf(':');
            String str = exc.substring(left,right);
            left = str.indexOf(',') +  1;
            String newStr = str.substring(left);
            return newStr;
        }else {
            return e.getMessage();
        }
    }
    public class InitData{
        @AuraEnabled
        public String status;
force-app/main/default/classes/SetPersonalTargetBatch.cls
@@ -9,7 +9,7 @@
    // 既存目标数据
    private Map<String, Opportunity> oppMap;
    private Map<Id, OpportunityLineItem> oliMap;
    private static String[] amountCategory = new String[] {'GI','ET','BF','GS','URO','GYN','ENT','ENG'};
    private static String[] amountCategory = new String[] {'GI','ET','BF','GS','URO','GYN','ENT','ENG1','ENG2'};
    //  当前年度
    private Integer iYear;
@@ -26,7 +26,7 @@
    }
    global Database.QueryLocator start(Database.BatchableContext BC) {
        query = 'select key__c,Amount__c,user_Alias__c,SAP_Province__c,Is_Processing__c,iYear__c,Use_Start_Date__c from Amount_Major_Product__c where Is_Processing__c = true';
        query = 'select key__c,Amount__c,user_Alias__c,SAP_Province__c,TargetType__c,remarks__c,Is_Processing__c,iYear__c,Use_Start_Date__c from Amount_Major_Product__c where Is_Processing__c = true';
        return Database.getQueryLocator(query);
    }
    global void execute(Database.BatchableContext BC, List<Amount_Major_Product__c> Amount_Major_Products) {
@@ -119,6 +119,8 @@
                    opp.Amount = Amount_Major_Product.Amount__c / proportionSumMap.get(target_category);
                    opp.Target_category__c = '担当目标';
                    opp.SAP_Province__c = Amount_Major_Product.SAP_Province__c;
                    opp.TargetType__c = Amount_Major_Product.TargetType__c;
                    opp.remarks__c = Amount_Major_Product.remarks__c; // 20230510 ljh
                    opp.RecordTypeId = rt.Id;
                    opp.OCM_Target_period__c = String.valueOf(integer.valueOf(Amount_Major_Product.iYear__c) - 1867 + 'P');
                    opp.CurrencyIsoCode = 'CNY';
@@ -138,6 +140,8 @@
                    opp.Amount = Amount_Major_Product.Amount__c / proportionSumMap.get(target_category);
                    opp.Target_category__c = '担当目标';
                    opp.SAP_Province__c = Amount_Major_Product.SAP_Province__c;
                    opp.TargetType__c = Amount_Major_Product.TargetType__c;
                    opp.remarks__c = Amount_Major_Product.remarks__c;// 20230510 ljh
                    opp.RecordTypeId = rt.Id;
                    opp.OCM_Target_period__c = String.valueOf(integer.valueOf(Amount_Major_Product.iYear__c) - 1867 + 'P');
                    opp.CurrencyIsoCode = 'CNY';
@@ -238,14 +242,23 @@
                doubleOTH.add(Double.valueOf(strOTH));
            }
            proportion.put('OTH', doubleOTH);
            String strObjectiveProportionENG = System.Label.ObjectiveProportionENG;
            List<String> objectiveProportionENG = strObjectiveProportionENG.split(',');
            List<Double> doubleENG = new List<Double>();
            for (String strENG : objectiveProportionENG) {
                doubleENG.add(Double.valueOf(strENG));
            // DB202303443108 you start ENG拆分为ENG1和ENG2
            String strObjectiveProportionENG1 = System.Label.ObjectiveProportionENG;
            List<String> objectiveProportionENG1 = strObjectiveProportionENG1.split(',');
            List<Double> doubleENG1 = new List<Double>();
            for (String strENG1 : objectiveProportionENG1) {
                doubleENG1.add(Double.valueOf(strENG1));
            }
            proportion.put('ENG', doubleENG);
            proportion.put('ENG1', doubleENG1);
            String strObjectiveProportionENG2 = System.Label.ObjectiveProportionENG;
            List<String> objectiveProportionENG2 = strObjectiveProportionENG2.split(',');
            List<Double> doubleENG2 = new List<Double>();
            for (String strENG2 : objectiveProportionENG2) {
                doubleENG2.add(Double.valueOf(strENG2));
            }
            proportion.put('ENG2', doubleENG2);
            // DB202303443108 you end ENG拆分为ENG1和ENG2
        }
        //初始化既存目标数据
        oppMap = new Map<String, Opportunity>();
@@ -295,7 +308,7 @@
        Opportunity[] opportunitys = [select
                        Id, OwnerId, Opportunity_Category__c, Proportion__c, CloseDate,
                        Amount, Objective__c, Target_category__c,
                        SAP_Province__c, RecordTypeId, OCM_Target_period__c
                        SAP_Province__c,TargetType__c, RecordTypeId, OCM_Target_period__c
                 from Opportunity
                where Target_category__c = '担当目标'
                  and RecordTypeId = :rt.Id
force-app/main/default/classes/StartTradingController2.cls
New file
@@ -0,0 +1,321 @@
public with sharing class StartTradingController2 {
    static final String RC_OPP = '引合';
    /**
     * 按钮初始化,通过LeadId获取判断需要使用的字段
     */
    @AuraEnabled
    public static Lead init(String Id){
        try {
            Lead leadobject = [select Id,
                                Hospital_Name__c,
                                Close_Forecasted_Date__c,
                                Opp_Name_Search__c,
                                begin_opp_name__c,
                                Status
                            from Lead
                            where Id = :Id];
            return leadobject;
        } catch (Exception ex) {
            throw new ControllerUtil.myException(ex.getMessage());
        }
    }
    /**
     * 开始询价
     */
    @AuraEnabled
    public static String start(String Id){
        try{
            // リード情報を取得
            Lead lead = [select id, SI_OppoLeadSec__c,owner_not_automatically_update__c, Hospital_Name__c, Contact_Name__c, Contact_Name__r.Name,
                    Opportunity_stage__c,Hospital_Name__r.RecordType.DeveloperName, Hospital_Name__r.Parent.RecordType.DeveloperName,
                    LastName, FirstName, LeadSource, Other_Society__c, Opp_Name__c, Purchase_Reason__c, Trade__c, Sales_Root__c, Campaign__c,
                    Close_Forecasted_Date__c, Competitor__c, Hospital_Budget__c, Promise_Class__c, Dicision_Maker__c, Purchase_Type__c,
                    Sales_Method__c, Fund_Basis__c, OwnerId, Wholesale_Price__c, Lead_No__c,Inquiry_Num__c,CreatedDate,CreatedById,
                    Tender_information__c, Agency_Opportunity__c, SI_PromoteInquiry__c
                    ,    Contact_Name__r.AccountId //2022-6-20 yjk 增加联系人的科室查询
                    ,ET_Check__c //SWAG-CKDATG fy 【委托】【OBSAP-报价委托】报价委托项目改善1
                    from Lead where id =: Id];
            Boolean SI_Flg = lead.SI_PromoteInquiry__c;
            Boolean isAgencyOpp = false;
            // 診療科選択リストの取得(条件:病院=リード情報の病院名称)
            List<Account> departmentList = new List<Account>();
            if (lead.Hospital_Name__r.RecordType.DeveloperName == 'HP') {
                departmentList = [select id, name from Account where Hospital__c =: lead.Hospital_Name__c];
            }
            else if (lead.Hospital_Name__r.Parent.RecordType.DeveloperName == 'HP') {
                departmentList = [select id, name from Account where ParentId =: lead.Hospital_Name__c];
            }
            /*
            // xudan 20140730 販売店を選択する場合、下の契約一覧を出す
            // TODO 契約状態を見る?
            else if (this.lead.Hospital_Name__r.RecordType.DeveloperName == 'Agency') {
            departmentList = [select id, name from Account where ParentId =: this.lead.Hospital_Name__c];
            isAgencyOpp = true;
            }
            */
            // xudan 20140730 契約を選択する場合、そのまま出す、フラグ設定
            else if (lead.Hospital_Name__r.Parent.RecordType.DeveloperName == 'Agency') {
                departmentList = [select id, name from Account where Id =: lead.Hospital_Name__c];
                isAgencyOpp = true;
            }
            else {
                departmentList = [select id, name from Account where Id =: lead.Hospital_Name__c];
            }
            // 診療科選択リストの設定
            List<SelectOption> depList = new List<SelectOption>();
            // 2022-04-13 ssm 紧急应对 科室和客户人员必填 start
            // this.depList.add(new SelectOption(NONE, NONE));
            // 2022-04-13 ssm 紧急应对 科室和客户人员必填 end
            Set<ID> depIdList = new Set<ID>();
            for(Account d : departmentList){
                depIdList.add(d.id);
                depList.add(new SelectOption(String.valueOf(d.get('id')),String.valueOf(d.get('name'))));
            }
            // 2022-04-13 ssm 紧急应对 科室和客户人员必填 start
            // this.sltDep = NONE;
            String sltDep = lead.Contact_Name__r.AccountId;  //  2022-6-20 yjk 改为从联系人的科室赋值   原逻辑:this.lead.Hospital_Name__c;
            String sltCon = lead.Contact_Name__c;
            // 2022-04-13 ssm 紧急应对 科室和客户人员必填 end
            // 担当者リスト(初期設定)
            Map<String,List<SelectOption>> conMap = new Map<String,List<SelectOption>>();
            List<SelectOption> sltOptNasi = new List<SelectOption>();
            // リード所有者の取得
            User leadOnwer = [select Province_Text__c from User where Id = :lead.OwnerId];
            String oppID = null;
            if (String.isBlank(sltDep)) {
                return null;
            }
            Account dept = null;
            if(String.isNotBlank(lead.Contact_Name__c)){
                dept = getDepartment(lead.Contact_Name__r.AccountId);
                updateContact(lead.Contact_Name__c, dept);
            }
            return updateOpportunity(getDepartment(lead.Hospital_Name__c), lead, SI_Flg, isAgencyOpp, leadOnwer);
        } catch(Exception ex) {
            throw new ControllerUtil.myException(ex.getMessage());
        }
    }
    /**
     *  選択した診療科を取得
     */
    public static Account getDepartment(String depId){
        List<Account> deptList = [select Id, Hospital__c, Department_Class__c, Department_Class_Wd__c from Account where id =: depId];
        // List<Account> deptList = [select Id, Hospital__c, Department_Class__c from Account where id =: this.sltDep];
        Account dept = deptList[0];
        return dept;
    }
    /** 取引先責任者の更新
     *  @param conID 取引先責任者ID
     *  @param dept  診療科
    */
    public static void updateContact(ID conID, Account dept){
        Contact cont = [select ID,Strategic_dept_Class__c from Contact where Id=:conID];
        cont.Strategic_dept_Class__c = dept.Department_Class__c;
        update cont;
    }
    /** 引合の更新
     *  @param dept 診療科
    */
    public static String updateOpportunity(Account dept, Lead lead, Boolean SI_Flg, Boolean isAgencyOpp, User leadOnwer){
        System.debug('dept:'+dept.Id + '|' + dept.Department_Class_Wd__c);
        //SWAG-CEY8GZ 20220620 lt update
        //Opportunity opp = [select ID, AccountId, Account.Department_Class_Wd__c, Opportunity_No__c, SAP_Province_CD__c, Opp_Number__c, Opp_Code__c from Opportunity where Id=:this.oppID];
        Opportunity opp = new Opportunity();
        opp.LeadSource = lead.LeadSource;
        opp.AccountId = dept.Id;
        //SWAG-CEY8GZ 20220620 lt update
        system.debug('cccccccccccccccccccc:'+opp.SAP_Province_CD__c);
        system.debug('cccccccccccccccccccc:'+opp.Opp_Number__c);
        system.debug('cccccccccccccccccccc:'+opp.Opp_Code__c);
        system.debug('cccccccccccccccccccc:'+opp.Opportunity_No__c);
        String Opptype = SI_Flg==true?'SI询价':RC_OPP;
        RecordType rect = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity' and Name =: Opptype limit 1];
        opp.RecordTypeId = rect.id;
        // opp.Opportunity_Category__c = opp.Account.Department_Class_Wd__c;
        //SWAG-CKDATG fy 【委托】【OBSAP-报价委托】报价委托项目改善1 start
        // opp.Opportunity_Category__c = dept.Department_Class_Wd__c;
        opp.Opportunity_Category__c = lead.ET_Check__c ? 'ET' : dept.Department_Class_Wd__c;
        opp.Opp_order_Type__c = lead.ET_Check__c ? 'ET'  : null;
        //SWAG-CKDATG fy 【委托】【OBSAP-报价委托】报价委托项目改善1 end
        System.debug('this.lead.Hospital_Name__c:'+lead.Hospital_Name__c);
        System.debug('this.lead.LeadSource:'+lead.LeadSource);
        System.debug('this.lead.Other_Society__c:'+lead.Other_Society__c);
        System.debug('this.lead.Purchase_Reason__c:'+lead.Purchase_Reason__c);
        System.debug('this.lead.Trade__c:'+lead.Trade__c);
        System.debug('this.lead.Sales_Root__c:'+lead.Sales_Root__c);
        System.debug('this.lead.Close_Forecasted_Date__c:'+lead.Close_Forecasted_Date__c);
        System.debug('this.lead.Competitor__c:'+lead.Competitor__c);
        System.debug('this.lead.Hospital_Budget__c:'+lead.Hospital_Budget__c);
        System.debug('this.lead.Promise_Class__c:'+lead.Promise_Class__c);
        System.debug('this.lead.Dicision_Maker__c:'+lead.Dicision_Maker__c);
        System.debug('this.lead.Purchase_Type__c:'+lead.Purchase_Type__c);
        System.debug('this.lead.Sales_Method__c:'+lead.Sales_Method__c);
        System.debug('this.lead.Fund_Basis__c:'+lead.Fund_Basis__c);
        if(lead.Opp_Name__c != null && lead.Opp_Name__c != ''){
            opp.Name = lead.Opp_Name__c;
        }
        else{
            opp.Name = '*';
        }
        //20220412 SWAG-CBUB2W you start
        opp.Inquiry_Num__c = lead.Inquiry_Num__c;
        //20220412 SWAG-CBUB2W you end
        opp.From_Lead_TF__c = true;
        opp.Trade__c = (String.isBlank(lead.Trade__c)) ? '内貿' : lead.Trade__c;
        opp.StageName = '引合';
        opp.owner_not_automatically_update__c = lead.owner_not_automatically_update__c;
        opp.Lead_Num__c = lead.Lead_No__c;
        opp.Lead_CreateBy__c = lead.CreatedById;
        opp.Lead_CreateDate__c = lead.CreatedDate;
        opp.CurrencyIsoCode = 'CNY';
        opp.Purchase_Type__c = 'SI(手術室案件)';
        system.debug('dddddddddddddddddddddd:'+lead.owner_not_automatically_update__c);
        Integer year = date.today().year();
        Integer month = date.today().month();
        Date nextMonthEndDay = date.newInstance(year, month, 1);
        Date thisMonthEndDay = nextMonthEndDay.addMonths(1);
        thisMonthEndDay = thisMonthEndDay.addDays(-1);
        nextMonthEndDay = nextMonthEndDay.addMonths(2);
        nextMonthEndDay = nextMonthEndDay.addDays(-1);
        opp.Close_Forecasted_Date__c = lead.Close_Forecasted_Date__c;
        opp.Close_Forecasted_Date__c = opp.Close_Forecasted_Date__c == null ? thisMonthEndDay : opp.Close_Forecasted_Date__c;
        if (nextMonthEndDay > opp.Close_Forecasted_Date__c) {
            opp.CloseDate = nextMonthEndDay;
        } else {
            opp.CloseDate = opp.Close_Forecasted_Date__c.addDays(30);
        }
        // xudan 20140730 販売店から引合をConvertする場合、Hospital__cをAccountIdを同じにする
        if (isAgencyOpp) {
            opp.Hospital__c = opp.AccountId;
        } else {
            opp.Hospital__c = dept.Hospital__c;
            opp.Department_Class__c = dept.Department_Class__c;
        }
        //2021-07-08  mzy  SWAG-C4H99E 询价中的来源更改 start
        if('科室提案'.equals(lead.LeadSource) || 'OPD/SIS'.equals(lead.LeadSource)
            || '公共平台'.equals(lead.LeadSource)   //测试环境 加的  对应的是 医拓网
            || '电话'.equals(lead.LeadSource) || '医拓网'.equals(lead.LeadSource) ){
            opp.LeadSource = '直接拜访';
        }else {
            opp.LeadSource = lead.LeadSource;
        }
        //2021-07-08  mzy  SWAG-C4H99E 询价中的来源更改 end
        opp.Other_Society__c = lead.Other_Society__c;
        opp.Purchase_Reason__c = lead.Purchase_Reason__c;
        opp.Trade__c = (String.isBlank(lead.Trade__c)) ? '内貿' : lead.Trade__c;
        // 增加默认值
        opp.Sales_Root__c = String.isNotBlank(lead.Sales_Root__c) ? lead.Sales_Root__c : '販売店';
        if (lead.Competitor__c != null && lead.Competitor__c != '') {
            opp.Competitor__c = lead.Competitor__c;
        }
        if (lead.Opportunity_stage__c != null && lead.Opportunity_stage__c != '') {
            opp.Opportunity_stage__c = lead.Opportunity_stage__c;
        }
        opp.Hospital_Budget__c = lead.Hospital_Budget__c;
        // 增加默认值
        opp.Promise_Class__c = String.isNotBlank(lead.Promise_Class__c) ? lead.Promise_Class__c : '内貿';
        opp.Dicision_Maker__c = lead.Dicision_Maker__c;
        //**********************************************************************************
        opp.Purchase_Type__c = SI_Flg==true?'SI(手術室案件)':lead.Purchase_Type__c;
        opp.Opportunity_sub_owner__c = lead.SI_OppoLeadSec__c;
        //**********************************************************************************
        opp.Sales_Method__c = lead.Sales_Method__c;
        opp.Fund_Basis__c = lead.Fund_Basis__c;
        opp.SAP_Province__c = leadOnwer.Province_Text__c;
        opp.Owner_System__c = opp.OwnerId;
        if(lead.OwnerId != null ){
            opp.Ownerid = lead.OwnerId ;
        }
        opp.Wholesale_Price__c = lead.Wholesale_Price__c;
        List<Lead> leadcList = [Select (Select CampaignId From CampaignMembers order by CreatedDate desc) From Lead l where l.id =: lead.Id];
        for(Lead leadc : leadcList){
            List<CampaignMember> cmList = leadc.CampaignMembers;
            for (CampaignMember cm : cmList) {
                opp.CampaignId = cm.CampaignId;
                break;
            }
        }
        System.debug('opp.Hospital_Name__c:'+opp.Hospital__c);
        System.debug('dept12345:'+dept.Hospital__c);
        System.debug('opp.LeadSource:'+opp.LeadSource);
        System.debug('opp.Other_Society__c:'+opp.Other_Society__c);
        System.debug('opp.Purchase_Reason__c:'+opp.Purchase_Reason__c);
        System.debug('opp.Trade__c:'+opp.Trade__c);
        System.debug('opp.Sales_Root__c:'+opp.Sales_Root__c);
        System.debug('opp.Close_Forecasted_Date__c:'+opp.Close_Forecasted_Date__c);
        System.debug('opp.Competitor__c:'+opp.Competitor__c);
        System.debug('opp.Hospital_Budget__c:'+opp.Hospital_Budget__c);
        System.debug('opp.Promise_Class__c:'+opp.Promise_Class__c);
        System.debug('opp.Dicision_Maker__c:'+opp.Dicision_Maker__c);
        System.debug('opp.Purchase_Type__c:'+opp.Purchase_Type__c);
        System.debug('opp.Sales_Method__c:'+opp.Sales_Method__c);
        System.debug('opp.Fund_Basis__c:'+opp.Fund_Basis__c);
        System.debug('opp.SAP_Province__c:'+opp.SAP_Province__c);
        // 2022-04-15 OBSAP新增修改 start
        opp.CampaignId = lead.Campaign__c;
        System.debug('opp.CampaignId:'+opp.CampaignId);
        // 招标项目
        if (String.isNotBlank(lead.Tender_information__c)) {
            opp.Bidding_Project_Name_Bid__c = lead.Tender_information__c;
            //SWAG-CEY8GZ 20220620 lt update
            // 新建link
            // Tender_Opportunity_Link__c link = new Tender_Opportunity_Link__c();
            // link.Tender_information__c = this.lead.Tender_information__c;
            // link.Opportunity__c = opp.Id;
            // link.Tender_Opportunity_Uniq__c = String.valueOf(this.lead.Tender_information__c) + String.valueOf(opp.Id);
            // insert link;
            //SWAG-CEY8GZ 20220620 lt update
        }
        // 经销商询价
        // 2022-05-20 调整经销商询价的更新顺序 ssm start
        //SWAG-CEY8GZ 20220620 lt update
        // Agency_Opportunity__c ao = null;
        if (String.isNotBlank(lead.Agency_Opportunity__c)) {
            opp.Agency_Opportunity__c = lead.Agency_Opportunity__c;
            // 经销商询价绑定询价
            // ao = [select Id, Change_To_Opportunity__c from Agency_Opportunity__c where Id = :this.lead.Agency_Opportunity__c];
            // ao.Change_To_Opportunity__c = opp.Id;
        }
        // 2022-04-15 OBSAP新增修改 end
        //update opp;
        insert opp;
        lead.Status = System.Label.StateChanges;
        lead.begin_opp_name__c = opp.Id;
        lead.begin_opp_date__c = Date.today();
        update lead;
        //SWAG-CEY8GZ 20220620 lt update
        // 2022-05-20 调整经销商询价的更新顺序 ssm end
        // //SWAG-CF589P【委托】【P:OBSAP】报价委托相关新需求评估 fy start
        List<QuoteIrai__c> quoteir=[select id,Opportunity__c,Lead__c from QuoteIrai__c where Lead__c =:lead.Id];
        List<QuoteIrai__c> quoteirupdate = new List<QuoteIrai__c>();
        if(quoteir.size()>0){
            for(QuoteIrai__c quo : quoteir){
                if(quo.Opportunity__c==null||quo.Opportunity__c==''){
                    quo.Opportunity__c=opp.Id;
                    quoteirupdate.add(quo);
                }
            }
        }
        System.debug('leadId++'+lead.Id);
        System.debug('quoteir++'+quoteir);
        System.debug('quoteirupdate++'+quoteirupdate);
        if(quoteirupdate.size()>0){
            update quoteirupdate;
        }
        return opp.Id;
    }
}
force-app/main/default/classes/StartTradingController2.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>57.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/classes/TenderOpportunityLinkHandler.cls
@@ -13,6 +13,7 @@
protected override void afterInsert() {
    // 判断是否跳过
    updateTerminateTender(this.newList);  //lt 20230419 项目终止流程开发 add
    if (!StaticParameter.EscapeTOLinkTrigger) {
        updateTender(this.newList);
        updateOppotunityByInsert(this.newList);
@@ -39,6 +40,189 @@
            if (link.Tender_Opportunity_Uniq__c == null || link.Tender_Opportunity_Uniq__c == '') {
                link.Tender_Opportunity_Uniq__c = link.Tender_information__c + '' + link.Opportunity__c;
            }
        }
    }
}
//DB202306372336  you start
public void UpdateStrategic_department_Opp(List<Tender_Opportunity_Link__c> tenderList,List<Tender_information__c> UpdateTenders){
    Map<String, Set<String>> updateTenMap = new Map<String, Set<String>>();//招标项目id,战略科室分类
    //String partment_Opp='';
        if(tenderList.size() > 0){
            for (Tender_Opportunity_Link__c tender : tenderList){
                 if(String.isNotBlank(tender.Opportunity__r.Department_Class__r.Department_Class_Label__c)){
                    //String ten_Opp =tender.Opportunity__r.Department_Class__r.name.split(' ')[1];
                    //if(tender.Opportunity__r.Department_Class__r.name.split(' ').size() ==3 ){
                    //   ten_Opp =tender.Opportunity__r.Department_Class__r.name.split(' ')[2];
                    //}
                    String ten_Opp =tender.Opportunity__r.Department_Class__r.Department_Class_Label__c;
                    Set<String> temp = new Set<String>();
                    if(ten_Opp.indexOf('其他') == -1){
                        if(updateTenMap.containsKey(tender.Tender_information__c)){
                            temp= updateTenMap.get(tender.Tender_information__c);
                            temp.add(ten_Opp);
                        } else{
                            temp.add(ten_Opp);
                        }
                    }else{//其他归普外
                        if(updateTenMap.containsKey(tender.Tender_information__c)){
                            temp= updateTenMap.get(tender.Tender_information__c);
                            temp.add('普外科');
                        } else{
                            temp.add('普外科');
                        }
                    }
                    updateTenMap.put(tender.Tender_information__c,temp);
                    system.debug(tender.Opportunity__r.Department_Class__r.Department_Class_Label__c+'==temp=='+temp);
                }
            }
            if(null!=updateTenMap && updateTenMap.size()>0){
                 for(String ksy :updateTenMap.keySet()){
                    String partment_Opp=String.join(new List<String>(updateTenMap.get(ksy)), ';');
                    system.debug('=====partment_Opp='+partment_Opp);
                    partment_Opp=partment_Opp.replaceAll(',', ';');
                    if(null ==UpdateTenders || UpdateTenders.size()==0){
                      Tender_information__c tin1 =new Tender_information__c();
                      tin1.id=ksy;
                      tin1.Strategic_department_Opp__c = partment_Opp;
                      UpdateTenders.add(tin1);
                    }else{
                      for (Tender_information__c up : UpdateTenders){
                        if(up.id== ksy){
                           up.Strategic_department_Opp__c = partment_Opp;
                        }else{
                          Tender_information__c tin2 =new Tender_information__c();
                          tin2.id=ksy;
                          tin2.Strategic_department_Opp__c = partment_Opp;
                          UpdateTenders.add(tin2);
                        }
                      }
                    }
                 }
                }
        }
        //if(tenderList.size() > 0){
        //    for (Tender_Opportunity_Link__c tender : tenderList){
        //       if(String.isNotBlank(partment_Opp)){
        //           partment_Opp.substring(0, partment_Opp.length()-1);
        //           if(null ==UpdateTenders || UpdateTenders.size()==0){
        //              Tender_information__c tin1 =new Tender_information__c();
        //              tin1.id=tender.Tender_information__c;
        //              tin1.Strategic_department_Opp__c = partment_Opp;
        //              UpdateTenders.add(tin1);
        //           }else{
        //              for (Tender_information__c up : UpdateTenders){
        //                if(up.id== tender.Tender_information__c){
        //                   up.Strategic_department_Opp__c = partment_Opp;
        //                }else{
        //                  Tender_information__c tin2 =new Tender_information__c();
        //                  tin2.id=tender.Tender_information__c;
        //                  tin2.Strategic_department_Opp__c = partment_Opp;
        //                  UpdateTenders.add(tin2);
        //                }
        //              }
        //           }
        //        }
        //    }
        //}
}
 //DB202306372336  you end
//lt 20230419 项目终止流程开发 终止申请状态清除 add
//项目终止流程开发 -- 清除招标项目终止申请的信息,项目重启标识打勾
public void updateTerminateTender(List<Tender_Opportunity_Link__c> records){
    if (records != null && records.size() > 0){
        List<String> tenders = new List<String>();//DB202305552102 you 关联取消的询价 项目不重启  取一条link
        List<String> tenlinks = new List<String>();//DB202306372336  you start  取当前招标下所有link
        // 获得要更新的招标项目
        for (Tender_Opportunity_Link__c record: records) {
            String lhid=record.Tender_information__c+''+record.Opportunity__c;
            if (!tenders.contains(lhid)) {
                tenders.add(lhid);
            }
            //DB202306372336  you start
            if(!tenlinks.contains(record.Tender_information__c)){
                tenlinks.add(record.Tender_information__c);
            }
            //DB202306372336  you end
            /**
             if (!tenders.contains(record.Tender_information__c)) {
                tenders.add(record.Tender_information__c);
            }
            **/
        }
        /**
        List<Tender_information__c> UpdateTenders = new List<Tender_information__c>();
        if (tenders.size() > 0){
            List<Tender_information__c> tenderList = [SELECT id, status__c, TerminateReason__c, IsTerminate__c,
                                                             TerminateApprovalStatus__c, TerminateApprovalTime__c,
                                                             ProjectRestartFLG__c,subInfoType__c
                                                      FROM Tender_information__c
                                                      WHERE id in :tenders];
            if(tenderList.size() > 0){
                for (Tender_information__c tender : tenderList){
                    //if(tender.status__c == '09.终止' && tender.TerminateReason__c != '经销商原因' && tender.subInfoType__c != '3-1:废标公告' && tender.subInfoType__c != '3-2:流标公告')
                    if(tender.status__c == '09.终止'){
                        tender.ProjectRestartFLG__c = true;
                        tender.IsTerminate__c = null;
                        tender.TerminateApprovalTime__c = null;
                        tender.TerminateApprovalStatus__c = null;
                        UpdateTenders.add(tender);
                    }
                }
            }
        }
        **/
        //DB202305552102 you start
        List<Tender_information__c> UpdateTenders = new List<Tender_information__c>();
        List<Tender_Opportunity_Link__c> tolList = new List<Tender_Opportunity_Link__c>();
        if (tenders.size() > 0) {
           tolList =  [select id, Opportunity__r.stagename,Opportunity__r.Department_Class__r.Department_Class_Label__c, Tender_information__c,Tender_information__r.status__c,Tender_information__r.ProjectRestartFLG__c,Tender_information__r.IsTerminate__c,Tender_information__r.TerminateApprovalTime__c,Tender_information__r.TerminateApprovalStatus__c from Tender_Opportunity_Link__c where Tender_Opportunity_Uniq__c in :tenders];
        }
        if(tolList.size() > 0){
                for (Tender_Opportunity_Link__c tender : tolList){
                    system.debug(tenders+'======='+tender.Tender_information__r.status__c+'=====终止===='+tender.Opportunity__r.stagename);
                    if(tender.Tender_information__r.status__c == '09.终止' && tender.Opportunity__r.stagename !='削除'){
                        Tender_information__c tin =new Tender_information__c();
                        tin.id=tender.Tender_information__c;
                        tin.ProjectRestartFLG__c = true;
                        tin.IsTerminate__c = null;
                        tin.TerminateApprovalTime__c = null;
                        tin.TerminateApprovalStatus__c = null;
                        UpdateTenders.add(tin);
                    }
                }
        }
        //DB202305552102 you end
        //DB202306372336  you start
        List<Tender_Opportunity_Link__c> tenderList = new List<Tender_Opportunity_Link__c>();
        if (tenlinks.size() > 0){
            tenderList = [SELECT id, Opportunity__r.Department_Class__r.Department_Class_Label__c,Tender_information__c
                                                      FROM Tender_Opportunity_Link__c
                                                      WHERE Tender_information__c in :tenlinks];
        }
        if(tenderList.size() > 0){
          UpdateStrategic_department_Opp(tenderList,UpdateTenders);
        }
        system.debug('==需要更新的==='+UpdateTenders);
        //DB202306372336  you end
        if(UpdateTenders.size() > 0){
            StaticParameter.EscapeTenderInformationUpdate =false;
            update UpdateTenders;
            StaticParameter.EscapeTenderInformationUpdate =true;
        }
    }
}
@@ -188,6 +372,7 @@
                        tender.Hospital4__c = fiveHospitalMap.get('Hospital4__c');
                    }
                }
                StaticParameter.EscapeTenderInformationUpdate = false;
                if (Trigger.isAfter && Trigger.isDelete) {
                    StaticParameter.EscapeOtherUpdateTenOwner = false;
                    update tender_list;
@@ -195,6 +380,7 @@
                } else {
                    update tender_list;
                }
                StaticParameter.EscapeTenderInformationUpdate = true;
            }
        }
    }
@@ -338,6 +524,58 @@
//20220718 you 询价任务 start
//删除link时,任务取消,清空询价中标信息
public void updateOppotunityBeforeDelete(List<Tender_Opportunity_Link__c> records) {
    //DB202306372336  you start
    List<String> tenlinks = new List<String>();// 取当前招标下所有link
    List<String> tenlink = new List<String>();// 取当前删除的link
    if (records != null && records.size() > 0) {
       for (Tender_Opportunity_Link__c record: records) {
           if(!tenlinks.contains(record.Tender_information__c)){
                tenlinks.add(record.Tender_information__c);
            }
            if(!tenlink.contains(record.id)){
                tenlink.add(record.id);
            }
       }
    }
    List<Tender_information__c> UpdateTenders = new List<Tender_information__c>();
    List<Tender_Opportunity_Link__c> tenderList = new List<Tender_Opportunity_Link__c>();
    if (tenlinks.size() > 0){
        tenderList = [SELECT id, Opportunity__r.Department_Class__r.Department_Class_Label__c,Tender_information__c
                                                  FROM Tender_Opportunity_Link__c
                                                  WHERE Tender_information__c in :tenlinks and id not in :tenlink];
     }
    if(tenderList.size() > 0){
       UpdateStrategic_department_Opp(tenderList,UpdateTenders);
     } else{
        //删除招标项目最后一条link
        List<Tender_Opportunity_Link__c> tenderList1 = [SELECT id, Opportunity__r.Department_Class__r.Department_Class_Label__c,Tender_information__c
                                                  FROM Tender_Opportunity_Link__c
                                                  WHERE id in :tenlink];
        system.debug(tenderList1.size()+'==当前删除得link=='+tenlink);
        if(null!=tenderList1 && tenderList1.size()>0){
            for(Tender_Opportunity_Link__c ti :tenderList1){
                  Tender_information__c tin1 =new Tender_information__c();
                  tin1.id=ti.Tender_information__c;
                  tin1.Strategic_department_Opp__c = '';
                  system.debug('删除进来了');
                  UpdateTenders.add(tin1);
            }
        }
     }
     system.debug('=====UpdateTenders====='+UpdateTenders);
    if(UpdateTenders.size() > 0){
       StaticParameter.EscapeTenderInformationUpdate =false;
       update UpdateTenders;
       StaticParameter.EscapeTenderInformationUpdate =true;
    }
//DB202306372336  you end
    if (records != null && records.size() > 0) {
        Set<String> oppTens = new Set<String>();//询价,招标项目 拼接
        List<String> oppIds = new List<String>();
@@ -395,6 +633,7 @@
// 更新询价信息
public void updateOppotunityByDelete(List<Tender_Opportunity_Link__c> records) {
    if (records != null && records.size() > 0) {
        List<String> oppIds = new List<String>();
        //SWAG-CHL67J 【委托】【FY23询价改善】-询价页面/招标项目增加统计字段 fy start 
@@ -444,7 +683,7 @@
                        //20220718 you 询价任务 end
                        **/
                        // 20221028 ljh SWAG-CKL5UC start
                        opp.LeakageNumber__c = null;
                        //opp.LeakageNumber__c = null;  //lt 20230625 DB202306421819 【BUG】漏单数有误 update
                        // 20221028 ljh SWAG-CKL5UC end
                    } else {
                        for (Tender_Opportunity_Link__c link : links) {
@@ -505,102 +744,6 @@
}
 @TestVisible
    public static void testI() {
        integer i = 0;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
    }
}
force-app/main/default/classes/UpdateInquiryFormConfirmationBatch.cls
@@ -159,84 +159,5 @@
    }
    @TestVisible private static void test() {
        Integer i = 0;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;//可以多写点
    }
}
force-app/main/default/classes/UpdateReceivingNoteImgRest.cls
@@ -4,13 +4,19 @@
    global static void doPost(String docId, String rnId, String libId) {
        RestResponse res = RestContext.response;
        res.addHeader('Content-Type', 'application/json');
        StaticParameter.ContentDocumentTrigger = false;
        StaticParameter.ContentDocumentLink = false;
        StaticParameter.ContentVerisonTrigger = false;
        ContentDocumentLink cdl1 = new ContentDocumentLink();
        cdl1.Visibility='AllUsers';
        cdl1.ShareType='I';
        cdl1.ContentDocumentId = docId;
        cdl1.LinkedEntityId = rnId;
        // cdl1.LinkedEntityId = libId;
        // libId = null;
        System.debug('zheli03'+libId);
        // libId = null;
        ContentDocumentLink cdl2 = new ContentDocumentLink();
        if (String.isNotBlank(libId)) {
            cdl2.Visibility='AllUsers';
@@ -18,11 +24,12 @@
            cdl2.ContentDocumentId = docId;
            cdl2.LinkedEntityId = libId;
        }
        try {
            if (String.isNotBlank(libId)) {
                System.debug('zheli00');
                insert new ContentDocumentLink[] {cdl1, cdl2};    
            } else {
                System.debug('zheli01');
                insert cdl1;
            }
        } catch ( Exception ex ) {
force-app/main/default/classes/XinDailyReportController.cls
Diff too large
force-app/main/default/classes/XinDailyReportControllerTest.cls
@@ -50,7 +50,7 @@
     */
    @TestSetup
    private static void init() {
        NFM001Controller.isRunning = false;
        NFM001Controller.isRunning = true;
        loginId = UserInfo.getUserId();
        id pid = UserInfo.getProfileId();
        // id pid = System.Label.ProfileId_2S1;
@@ -1206,11 +1206,10 @@
            System.Test.stopTest();
        }
    }
    @isTest
    static void test01_08_01() {
        User user = [select Id from User where Username = 'olympusTest10@sunbridge.com'];
        System.runAs(user) {
            System.Test.startTest();
            XinDailyReportControllerTest.settTestData();
            XinDailyReportController t = new XinDailyReportController();
            t.init();
@@ -1219,6 +1218,7 @@
            PageReference ref = t.getDailyReport();
            Test.setCurrentPage(ref);
            t = new XinDailyReportController();
            Test.startTest();
            t.init();
            //          t.getEvent();
            //          t.report.Reporter__c = u1.id;
@@ -1228,7 +1228,7 @@
            t.repoStartMinuteText = '00';
            t.repoEndHourText = '18';
            t.repoEndMinuteText = '00';
            t.report.Status__c = '申請中';
            t.report.Status__c = null;
            t.activities.get(0).actStartHourText = '9';
            t.activities.get(0).actStartMinuteText = '00';
            t.activities.get(0).actEndHourText = '18';
@@ -1261,6 +1261,7 @@
            t.activities.get(0).planEndHourText = '18';
            t.activities.get(0).planEndMinuteText = '00';
            t.activities.get(0).planPurposeText = '次の活動予定目的(計画)';
            t.save();
            t.activities.get(0).act.Location__c = accDepName;
@@ -1296,14 +1297,22 @@
            String strDate = d.year() + '/' + d.month() + '/' + d.day();
            Datetime dt = datetime.now();
            String strDatetime = '2000/01/01 10:10';
            String strDatetime = '2000/01/01 10:10:00';
            System.debug('strDatetime' + strDatetime);
            System.debug('t.activities.get(0).act.id:::::' + t.activities.get(0).act.id);
            // String opId = Add_Report.addReportOP(u1.id, t.report.id, t.report.id, t.activities.get(0).act.id, 'OPD', '戦略科室分類1 診療科1test', con1.id, con2.id, con3.id, con4.id, con5.id, opp1.Id, opp2.Id, opp3.Id, opp4.Id, opp5.Id, strDate);
            // if (opId != 'false') t.activities.get(0).act.OPD_ID__c = opId;
            // t.save();
            System.Test.stopTest();
            String opId = Add_Report.addReportOP(u1.id, t.report.id, t.report.id, t.activities.get(0).act.id, 'OPD', '戦略科室分類1 診療科1test', con1.id, con2.id, con3.id, con4.id, con5.id, opp1.Id, opp2.Id, opp3.Id, opp4.Id, opp5.Id, strDate);
            Add_Report.addReportPr(u1.id, t.report.id, t.report.id, t.activities.get(0).act.id, 'OPD', '戦略科室分類1 診療科1test', con1.id, con2.id, con3.id, con4.id, con5.id,'', strDate);
            Add_Report.addReportNT(u1.id, t.report.id, t.report.id, t.activities.get(0).act.id, 'OPD', '戦略科室分類1 診療科1test', con1.id, con2.id, con3.id, con4.id, con5.id,'','', strDate);
            // Add_Report.addReportOn(u1.id, t.report.id, t.report.id, t.activities.get(0).act.id, 'OPD', '戦略科室分類1 診療科1test', strDate,'','','','','','');
            Add_Report.addReportAc(u1.id, t.report.id, t.report.id, t.activities.get(0).act.id, 'OPD', '戦略科室分類1 診療科1test', strDate,'');
            Add_Report.addClaim(u1.id, t.report.id, t.report.id, t.activities.get(0).act.id, 'OPD', '戦略科室分類1 診療科1test', strDate,'');
            Add_Report.addReportEx(u1.id, t.report.id, t.report.id, t.activities.get(0).act.id, 'OPD', '戦略科室分類1 診療科1test', con1.id, strDate,'');
            Add_Report.addReportIm(u1.id, t.report.id, t.report.id, t.activities.get(0).act.id, 'OPD', '戦略科室分類1 診療科1test', strDate,'');
            Add_Report.addRA(u1.id, t.report.id, t.report.id, t.activities.get(0).act.id, 'OPD', '戦略科室分類1 診療科1test', strDate,'','');
            if (opId != 'false') t.activities.get(0).act.OPD_ID__c = opId;
            t.save();
            Test.stopTest();
        }
    }
force-app/main/default/classes/eSignAgencyConfirmPageControllerTest.cls
@@ -151,29 +151,41 @@
        Date d = Date.today();
        eSignAgencyConfirmPageController.geteSigns('112233');
        eSignAgencyConfirmPageController.saveeSignFormEntry(eSignAgencyConfirmPageController.geteSigns('112233').eSignFormLineItems,eSignForm,'经销商确认',true,d,d,d,d,d,'111@qq.com');
        list<Attachment> attachmentList = new list<Attachment>();
        Attachment attach=new Attachment();
        attach.Name='Unit Test Attachment';
        List<ContentVersion> versionList = new List<ContentVersion>();
        Test.startTest();
        ContentVersion version = new ContentVersion();
        Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body');
        attach.body=bodyBlob;
        attach.parentId=eSignForm.id;
        version.VersionData = bodyBlob;
        version.Title = 'Unit Test Attachment';
        version.PathOnClient = 'Unit Test Attachment.txt';
        version.ContentLocation = 's';
        versionList.add(version);
        insert versionList;
        version = [select Id,ContentDocumentId from ContentVersion where Id =: version.Id];
        // list<Attachment> attachmentList = new list<Attachment>();
        // Attachment attach=new Attachment();
        // attach.Name='Unit Test Attachment';
        // Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body');
        // attach.body=bodyBlob;
        // attach.parentId=eSignForm.id;
        attachmentList.add(attach);
        // attachmentList.add(attach);
        // insert attach;
        Attachment attach1=new Attachment();
        attach1.Name='Unit Test Attachment';
        Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body');
        attach1.body=bodyBlob1;
        attach1.parentId=eSignForm.id;
        // // insert attach;
        // Attachment attach1=new Attachment();
        // attach1.Name='Unit Test Attachment';
        // Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body');
        // attach1.body=bodyBlob1;
        // attach1.parentId=eSignForm.id;
        insert attach1;
        // insert attach1;
        String fileId = String.valueOf(attach1.Id);
        String fileId = String.valueOf(version.ContentDocumentId);
        String body1 = '%2F9j%2F4AAQSkZJRgABAQAAAQABAAD%2F2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj%2F2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj%2FwAARCALuAegDASIAAhEBAxEB%2F8QAHAAAAgIDAQEAAAAAAAAAAAAAAwQCBQABBgcI%2F8QARRAAAgEDAwIFAgMGBAUCBQQDAQIDAAQRBRIhMUEGEyJRYTJxFIGRByNCUqHBFTOx0SRDYuHwcvEWNFNjggglc5ImotL%2FxAAbAQACAwEBAQAAAAAAAAAAAAADBAECBQAGB%2F%2FEADMRAAICAQQCAQQABQMEAwEAAAECAAMRBBIhMRNBIgUyUWEUI0JxgQYzkRWhsdEkUsHw%2F9oADAMBAAIRAxEAPwDwgQg8kc1IRjB4o7DHSgvKFB96yASZ63EE6gGtNgLQXnzmoebRNsuqD3Dq3fijxeUxxICM9xSQkrYkqCpjAWvEsmg2epG3LS7DFBSUjuRRBKCfVzUYIg2rB%2B2SNDbk0XaGwVPFZ5RLVAIlFqdzgCBjiMj9Mir%2By%2FcxbAcA9ar7WMJTikk0vc27iel%2BmaYacbj3Gi%2FtWg5oSDJwaOI%2BKXOBN5SzcyPWoScjFEUgVAjJzXCQ4yJX3ScfalRLtcU9fEAGqgHLinKxlZ53WN47MLOktZAyimQaq7J%2BFqwVvVSbrgz0elu3IMyx09lIZWPGanBA9zcBYslc0vp8RmkIGcZrq7CzMUWYkOcdaSusFf8AeZeqYmwzECwQCKPt9VRSwlvXywOAMCrfS7GMzBZCMtz96NcEWdyQhDLntWebjkhYpu9SrbS4oWAlUEjGasLq0S3tYXjwEbkgVHU7xLpt4GwgAE%2FFINdeYqqrF1XAA%2BKgB2wTK5JwZcWs6S6e0Z459P5UsLxrJ2YHlhtwPbOaRjufMhm2cMvCj5qOmDiW4uSHK8bakVAA5ltpkptRXznk6O%2Bc0lK5mcFY%2BTzk1jKnmPKw9Lsdo9qNKRDHu%2BOBR1AU8CGCcRc%2BYqkSPge1QtrX8Q4YjEa1KOF5m3SHC1bJEItIR1%2BqViF%2BwqWfbwJJAGBK1rYxNgjMZokatCfMX1KfTzVjdQs8EBxjfHu%2FMCkmV4Yxu5QnkVG%2FcJHBGYWO5COApKGslK7t7chjurVxGmPMUZUgUxaWayyLBK21CCyt80I4HMqwwMyN9cJdOpcYUDH59TSt9psPkI6kbn6imri3ELPFI4LDkUi%2B7AAY%2FGalAeCsjuVsmkYQuPfBqK2p27SMYq4M5FsUK985FbiCSLzjAFENje4VOJWKjIqqwyCMUheRukLRA%2Bhj0q%2FeISRMUxlRwKq7iNuN4980Suzmc6gymSHfHtHuSKXltQC27r1NWU6GMgp%2FShFS4LEcmnFcjmKWVxRrXyrfB6kZNZZQAcnjn%2BlWU0W6MHHWpW1rvyahrPjBbB7kraZrWUNH0PWrGO9jnk2TYwOi%2FNJvDtiY%2FwAtJyIQiPnDdTQcB%2BZY5lhfxLKSyZ%2BB%2FvVK6BXYNyadiuGTKk9e9bEYnbj8zVkJSQTnuLw2%2Begp%2B2tCZBxTFnb%2FABxVrDCkSl5MKqjJJ7UCy4ngQbj8QUNphMtwO9VGtatHagw2xDS9Cewoeu6%2F5gaCxOEHDP71zBOSSxyT3o%2Bn0x%2B%2ByOUaPd8rJtsvIXc7mJyTUsjHNDLYqO%2BnsZmmGVBgSbyYWk5W5NEduKUlYk0VFiWpuMhI9D9TdKMkQ6saIAAeOKLuA6md42c5MhFGf4qyi1lUJzGlQKMQNzKFHB5qtdyzVAyFzk1HdzTapieZ3CT61o8VHdWZq2J27MkDUqgKnnNQZZTJg5xUhQgampBFVMKphVcqRg0ylyMeoc0iWxWg1QVBhUvNZ4lnHOueKeikBHFUKueKPHOVI5oLVZmjp9eV7nQQ4LUfNVllchiBT2%2FFJupBxPR6a9XTImSDnionhD71MNnrS88gANcozxLWsFUtK7UpeAKSjGWqN3Jvm%2B1EgHIp8Das8i9vmuJlnbAjaafBpSBfRTAPppN%2BTPS6b4LOq8IwrNHdk43LgjNdLaXy2zOCA2egFcn4RR5GuNrbUwN1dNP5dqilRkn3rG1K5sIil3ycyQeZ5A30IDxioS3B5VMs2etL%2BfLccAHmnra1EMMk0v1AHFBwB3KbQO5SziWWXZuOOM0a2RoUKpjoW%2FKiRr%2B7Zv4j1ocq7yvOD0%2FKjbs8S%2B2AjLQFpI%2FUpO7NDgvfLnLcndwRTEOFk2qCCp71qRI%2FxzIowGOR8cVcEc5lB3iEjxcTFyCsfUCtzjfcxoemN1MwLC0oj34PQYpW45nBTnb6TQweYVYWZmjG3GB9P6jNORkS2NvESd6MSPtSMCtM0Yb1eZ0%2BD0rp44YbGWCFVWWYnLZ7DFCsbbge4OxsGJ3szbIkRMIiCPJHXPWkLiVJpXRB6QSoFX0zQzW5kRQJEba69vvXOSqIJQy5Yf8Aaq0nPBkIMiG05hLaTQSDkcA0J5Hd1EpCBCKNYKEhZ5Mqp%2FqaFexrM%2FmHgHpVxgsfxCbcCL6k7S3pGeFACn3FCnmMsaKF9SdT8VYPapGsYPLsu7J7Clp4GiXehyM5IogYHAkLzFQ7R8ZyPY1sSIehKmgS73jaQZzmtRqW5q5AhSojkcjQ%2FwDUDUPMErMCB15%2BKExdOc5FaBVz7NVQsrgiQktlMhUdKD%2BG5IphCyyNu5BopdC%2FFXDMJVlibLtTaaD5rxZ296dlYYKnv3pWaPMWR1zRFbPBgDXIMzcAnINCfLSFSeooLSsGwakXPnJ89aIFxBkTFTJyexxTlmmHK%2B4oIGXI7ZqxtgqDzHIAA5Jodh9CAb9R%2BDy4YjLKQqqMmuV1zWXvXMcLFLcdB%2FNQ9a1R7uQxREiAHp%2FN8mqdzzjNH0%2BmCfJu4%2Fp6NvybuYWqDPjNRd8CgM9OhMwr3AQpfmsBzQd4qSMCauVgRaDNyHaOaUeUA8UO6uC8hVOgoaxsRzRlTA5mbdqS7YQQnnEnvRUkUDLHmoRwcVI24Irjt6kILQMyRu46ygtae1ZXYSQW1P4lSGqQOaBk1IMadxPNiyGrYqAPFbBquIVWkw2KkDmh5rY4qCIQNCc1tTUQRWVXEIGkzWq1mt5qCJbOZsHFS3VCt10sGh4ZSjAg1eQSiWBWHXvXOg4p7Trgq%2B0n0nigXV7hmaf0%2FVmt9p6MuVekL%2BbCk0cnBxVVqcnIFBpT5TS%2BoagrSYmDuYk09a8mkI%2BtP2vBpqzqYWj5YS4t%2FpqbcZqFv0ojDLVnnuevT7BOj8LqVtp2BxkirrzGuWXzDwvAqp8OjbYkYySxq0jiY4C8Z7msu85cxcy0REUAqOBxUL2YmLys8k4oCSSQt5L84PNTUGSVpD0HSlduOZQCR8tvLKrngZNV8YZrkKTyvWrDzts6Rno55qN2qQauBwqtGOe2TVlJHEk8RGSXZMzuMEnnnisWLzdU2xsGwpk4%2FXFP3enR3FqQrEOAGHt9qBp9uli8kzby5G0cdAQaIHBH7lCQRx3CSxJhXtzggE5Pt1oVuCoVmBJbtRXlMnlpEowo2kDvRCo%2FdhiAdoxjpxVMkDEsuRwYrBMYLk%2Fyq3%2Fer%2B2t%2FwAZK03mHJw457HqKoJIn3MqAMGOf60O3acO4jZgI1JODjArmTeODOsTPM6Ag2QlO7Kn0n5Jqstybi6RH%2BjdnApSFp55NrFn%2Fjwf9ad0%2BN%2FxgYgqozzVCNoI9wqrhcyyuoRNPHbLwm7BNVmoB4HhU8gen86tLgn8RCz5VBzn3NIalB%2BIs2SJ%2FWkhce5qlZAIBnIeR%2BJG6uN6pGwIdQASandyrNZI4G1skE%2FFIafZXEtw7zyelV5Oeppq7jEdljd6vMH50XgMAJxVdwAktN078VA%2B447CqyZWiuTGRjYcGr21nFvZytnnJAH3qpjJe9M0w3KxyahCckmVw2SYnMTs9PStwMjEF%2BDTF2qh3Ef0nkUCKFpXCIMnFG3DE7HuFaF0RnzlaW2knKdasH8yKJ4pB2zzSNrIUl4AOfeuViRmVPUBI54z1oe5j9qfnjExKsu1qQlUxuVbtRUYEThz3F7iPd6l%2FOhxAmVSaYU4z81MRAOpFE3YGIJ6%2Fc3s2%2BqqzVL4sghRsIPqPvTOr3a28G0MN7f0FcjcXbO3H00zRQW%2BRi2Vrbc0bkmAOFoEk1KFzjmhs5p5a5WzWH1DvL80BpeaEzUJnooWIWakxkyk96Omdh560jHyQaO0uBiuKzq7uMtJiNUGTya20gA4FL7%2FAJrW6u2%2Fmd5gOFEMs5z1oqy80lU06VxUGcl7Ax5Jx3rKSJOayo2CGGsYSkJOa2DQw2TzUh1p%2BePDZhQxqatmgjrRF61UwysYQGp5yOKFUl6VWHUyYNSBqHapCohVaTrKxaw9aoTCibHSpVFakaiWEytxMVYGo5qVQRLKSDkS4STdGj%2FkaqtRbM%2FHSnLJ90bIarrps3BqlS4aPa27fSv7m4etWFuPUKQgHqqxgHqFRaZ2hHUtbccUTHqqMA9NEQZkFZ5PM9YBisTvvCmnh9MV5B6CCaeu7dEZccY7UTSJAukWUY4AUE%2FOTQb2bN3IwGQDWESzWEmZ6ZYnMDIC0hcnOec%2FbpW87YVC9P71KAFh8GoT5iyhHpard8S4PqKXJdZ4nUHKnP8AWmL9PxkzMnTcNvwO1WD2gmtlmjGR147HuKTKnzMqBuC5wP4h8fIqFfPU4W';
        eSignAgencyConfirmPageController.saveChunk(eSignForm.Id,'test01',body1,'image/jpeg','');
        eSignAgencyConfirmPageController.saveChunk(eSignForm.Id,'test01',body1,'image/jpeg',fileId);
        eSignAgencyConfirmPageController.deleteChunk(attach1.Id);
        eSignAgencyConfirmPageController.deleteChunk(fileId);
        Test.stopTest();
    }
force-app/main/default/classes/eSignAgencyPageControllerTest.cls
@@ -1,6 +1,13 @@
@isTest
private class eSignAgencyPageControllerTest {
    @TestSetup
    static void makeData(){
        List<String> strList= new List<String>();
        strList.add('Document');
        TestDataUtility.CreatePIPolicyConfigurations(strList);
    }
    static testMethod void testMethod1() {
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院'];
        if (rectCo.size() == 0) {
@@ -149,33 +156,48 @@
        insert eSignFormLineItemEntry2;
        eSignAgencyPageController.geteSigns('112233');
        Test.startTest();
        eSignAgencyPageController.saveeSignFormEntry(eSignAgencyPageController.geteSigns('112233').eSignFormLineItems,eSignForm,'经销商收货',true,true,null);
        list<Attachment> attachmentList = new list<Attachment>();
        Attachment attach=new Attachment();
        attach.Name='Unit Test Attachment';
        // list<Attachment> attachmentList = new list<Attachment>();
        // Attachment attach=new Attachment();
        // attach.Name='Unit Test Attachment';
        // Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body');
        // attach.body=bodyBlob;
        // attach.parentId=eSignForm.id;
        // attachmentList.add(attach);
        // // insert attach;
        // Attachment attach1=new Attachment();
        // attach1.Name='Unit Test Attachment';
        // Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body');
        // attach1.body=bodyBlob1;
        // attach1.parentId=eSignForm.id;
        // insert attach1;
        List<ContentVersion> versionList = new List<ContentVersion>();
        ContentVersion version = new ContentVersion();
        Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body');
        attach.body=bodyBlob;
        attach.parentId=eSignForm.id;
        attachmentList.add(attach);
        // insert attach;
        Attachment attach1=new Attachment();
        attach1.Name='Unit Test Attachment';
        Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body');
        attach1.body=bodyBlob1;
        attach1.parentId=eSignForm.id;
        insert attach1;
        String fileId = String.valueOf(attach1.Id);
        version.VersionData = bodyBlob;
        version.Title = 'Unit Test Attachment';
        version.PathOnClient = 'Unit Test Attachment.txt';
        version.ContentLocation = 's';
        versionList.add(version);
        insert versionList;
        version = [select Id,ContentDocumentId from ContentVersion where Id =: version.Id];
        String fileId = String.valueOf(version.ContentDocumentId);
        String body1 = '%2F9j%2F4AAQSkZJRgABAQAAAQABAAD%2F2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj%2F2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj%2FwAARCALuAegDASIAAhEBAxEB%2F8QAHAAAAgIDAQEAAAAAAAAAAAAAAwQCBQABBgcI%2F8QARRAAAgEDAwIFAgMGBAUCBQQDAQIDAAQRBRIhMUEGEyJRYTJxFIGRByNCUqHBFTOx0SRDYuHwcvEWNFNjggglc5ImotL%2FxAAbAQACAwEBAQAAAAAAAAAAAAADBAECBQAGB%2F%2FEADMRAAICAQQCAQQABQMEAwEAAAECAAMRBBIhMRNBIgUyUWEUI0JxgQYzkRWhsdEkUsHw%2F9oADAMBAAIRAxEAPwDwgQg8kc1IRjB4o7DHSgvKFB96yASZ63EE6gGtNgLQXnzmoebRNsuqD3Dq3fijxeUxxICM9xSQkrYkqCpjAWvEsmg2epG3LS7DFBSUjuRRBKCfVzUYIg2rB%2B2SNDbk0XaGwVPFZ5RLVAIlFqdzgCBjiMj9Mir%2By%2FcxbAcA9ar7WMJTikk0vc27iel%2BmaYacbj3Gi%2FtWg5oSDJwaOI%2BKXOBN5SzcyPWoScjFEUgVAjJzXCQ4yJX3ScfalRLtcU9fEAGqgHLinKxlZ53WN47MLOktZAyimQaq7J%2BFqwVvVSbrgz0elu3IMyx09lIZWPGanBA9zcBYslc0vp8RmkIGcZrq7CzMUWYkOcdaSusFf8AeZeqYmwzECwQCKPt9VRSwlvXywOAMCrfS7GMzBZCMtz96NcEWdyQhDLntWebjkhYpu9SrbS4oWAlUEjGasLq0S3tYXjwEbkgVHU7xLpt4GwgAE%2FFINdeYqqrF1XAA%2BKgB2wTK5JwZcWs6S6e0Z459P5UsLxrJ2YHlhtwPbOaRjufMhm2cMvCj5qOmDiW4uSHK8bakVAA5ltpkptRXznk6O%2Bc0lK5mcFY%2BTzk1jKnmPKw9Lsdo9qNKRDHu%2BOBR1AU8CGCcRc%2BYqkSPge1QtrX8Q4YjEa1KOF5m3SHC1bJEItIR1%2BqViF%2BwqWfbwJJAGBK1rYxNgjMZokatCfMX1KfTzVjdQs8EBxjfHu%2FMCkmV4Yxu5QnkVG%2FcJHBGYWO5COApKGslK7t7chjurVxGmPMUZUgUxaWayyLBK21CCyt80I4HMqwwMyN9cJdOpcYUDH59TSt9psPkI6kbn6imri3ELPFI4LDkUi%2B7AAY%2FGalAeCsjuVsmkYQuPfBqK2p27SMYq4M5FsUK985FbiCSLzjAFENje4VOJWKjIqqwyCMUheRukLRA%2Bhj0q%2FeISRMUxlRwKq7iNuN4980Suzmc6gymSHfHtHuSKXltQC27r1NWU6GMgp%2FShFS4LEcmnFcjmKWVxRrXyrfB6kZNZZQAcnjn%2BlWU0W6MHHWpW1rvyahrPjBbB7kraZrWUNH0PWrGO9jnk2TYwOi%2FNJvDtiY%2FwAtJyIQiPnDdTQcB%2BZY5lhfxLKSyZ%2BB%2FvVK6BXYNyadiuGTKk9e9bEYnbj8zVkJSQTnuLw2%2Begp%2B2tCZBxTFnb%2FABxVrDCkSl5MKqjJJ7UCy4ngQbj8QUNphMtwO9VGtatHagw2xDS9Cewoeu6%2F5gaCxOEHDP71zBOSSxyT3o%2Bn0x%2B%2ByOUaPd8rJtsvIXc7mJyTUsjHNDLYqO%2BnsZmmGVBgSbyYWk5W5NEduKUlYk0VFiWpuMhI9D9TdKMkQ6saIAAeOKLuA6md42c5MhFGf4qyi1lUJzGlQKMQNzKFHB5qtdyzVAyFzk1HdzTapieZ3CT61o8VHdWZq2J27MkDUqgKnnNQZZTJg5xUhQgampBFVMKphVcqRg0ylyMeoc0iWxWg1QVBhUvNZ4lnHOueKeikBHFUKueKPHOVI5oLVZmjp9eV7nQQ4LUfNVllchiBT2%2FFJupBxPR6a9XTImSDnionhD71MNnrS88gANcozxLWsFUtK7UpeAKSjGWqN3Jvm%2B1EgHIp8Das8i9vmuJlnbAjaafBpSBfRTAPppN%2BTPS6b4LOq8IwrNHdk43LgjNdLaXy2zOCA2egFcn4RR5GuNrbUwN1dNP5dqilRkn3rG1K5sIil3ycyQeZ5A30IDxioS3B5VMs2etL%2BfLccAHmnra1EMMk0v1AHFBwB3KbQO5SziWWXZuOOM0a2RoUKpjoW%2FKiRr%2B7Zv4j1ocq7yvOD0%2FKjbs8S%2B2AjLQFpI%2FUpO7NDgvfLnLcndwRTEOFk2qCCp71qRI%2FxzIowGOR8cVcEc5lB3iEjxcTFyCsfUCtzjfcxoemN1MwLC0oj34PQYpW45nBTnb6TQweYVYWZmjG3GB9P6jNORkS2NvESd6MSPtSMCtM0Yb1eZ0%2BD0rp44YbGWCFVWWYnLZ7DFCsbbge4OxsGJ3szbIkRMIiCPJHXPWkLiVJpXRB6QSoFX0zQzW5kRQJEba69vvXOSqIJQy5Yf8Aaq0nPBkIMiG05hLaTQSDkcA0J5Hd1EpCBCKNYKEhZ5Mqp%2FqaFexrM%2FmHgHpVxgsfxCbcCL6k7S3pGeFACn3FCnmMsaKF9SdT8VYPapGsYPLsu7J7Clp4GiXehyM5IogYHAkLzFQ7R8ZyPY1sSIehKmgS73jaQZzmtRqW5q5AhSojkcjQ%2FwDUDUPMErMCB15%2BKExdOc5FaBVz7NVQsrgiQktlMhUdKD%2BG5IphCyyNu5BopdC%2FFXDMJVlibLtTaaD5rxZ296dlYYKnv3pWaPMWR1zRFbPBgDXIMzcAnINCfLSFSeooLSsGwakXPnJ89aIFxBkTFTJyexxTlmmHK%2B4oIGXI7ZqxtgqDzHIAA5Jodh9CAb9R%2BDy4YjLKQqqMmuV1zWXvXMcLFLcdB%2FNQ9a1R7uQxREiAHp%2FN8mqdzzjNH0%2BmCfJu4%2Fp6NvybuYWqDPjNRd8CgM9OhMwr3AQpfmsBzQd4qSMCauVgRaDNyHaOaUeUA8UO6uC8hVOgoaxsRzRlTA5mbdqS7YQQnnEnvRUkUDLHmoRwcVI24Irjt6kILQMyRu46ygtae1ZXYSQW1P4lSGqQOaBk1IMadxPNiyGrYqAPFbBquIVWkw2KkDmh5rY4qCIQNCc1tTUQRWVXEIGkzWq1mt5qCJbOZsHFS3VCt10sGh4ZSjAg1eQSiWBWHXvXOg4p7Trgq%2B0n0nigXV7hmaf0%2FVmt9p6MuVekL%2BbCk0cnBxVVqcnIFBpT5TS%2BoagrSYmDuYk09a8mkI%2BtP2vBpqzqYWj5YS4t%2FpqbcZqFv0ojDLVnnuevT7BOj8LqVtp2BxkirrzGuWXzDwvAqp8OjbYkYySxq0jiY4C8Z7msu85cxcy0REUAqOBxUL2YmLys8k4oCSSQt5L84PNTUGSVpD0HSlduOZQCR8tvLKrngZNV8YZrkKTyvWrDzts6Rno55qN2qQauBwqtGOe2TVlJHEk8RGSXZMzuMEnnnisWLzdU2xsGwpk4%2FXFP3enR3FqQrEOAGHt9qBp9uli8kzby5G0cdAQaIHBH7lCQRx3CSxJhXtzggE5Pt1oVuCoVmBJbtRXlMnlpEowo2kDvRCo%2FdhiAdoxjpxVMkDEsuRwYrBMYLk%2Fyq3%2Fer%2B2t%2FwAZK03mHJw457HqKoJIn3MqAMGOf60O3acO4jZgI1JODjArmTeODOsTPM6Ag2QlO7Kn0n5Jqstybi6RH%2BjdnApSFp55NrFn%2Fjwf9ad0%2BN%2FxgYgqozzVCNoI9wqrhcyyuoRNPHbLwm7BNVmoB4HhU8gen86tLgn8RCz5VBzn3NIalB%2BIs2SJ%2FWkhce5qlZAIBnIeR%2BJG6uN6pGwIdQASandyrNZI4G1skE%2FFIafZXEtw7zyelV5Oeppq7jEdljd6vMH50XgMAJxVdwAktN078VA%2B447CqyZWiuTGRjYcGr21nFvZytnnJAH3qpjJe9M0w3KxyahCckmVw2SYnMTs9PStwMjEF%2BDTF2qh3Ef0nkUCKFpXCIMnFG3DE7HuFaF0RnzlaW2knKdasH8yKJ4pB2zzSNrIUl4AOfeuViRmVPUBI54z1oe5j9qfnjExKsu1qQlUxuVbtRUYEThz3F7iPd6l%2FOhxAmVSaYU4z81MRAOpFE3YGIJ6%2Fc3s2%2BqqzVL4sghRsIPqPvTOr3a28G0MN7f0FcjcXbO3H00zRQW%2BRi2Vrbc0bkmAOFoEk1KFzjmhs5p5a5WzWH1DvL80BpeaEzUJnooWIWakxkyk96Omdh560jHyQaO0uBiuKzq7uMtJiNUGTya20gA4FL7%2FAJrW6u2%2Fmd5gOFEMs5z1oqy80lU06VxUGcl7Ax5Jx3rKSJOayo2CGGsYSkJOa2DQw2TzUh1p%2BePDZhQxqatmgjrRF61UwysYQGp5yOKFUl6VWHUyYNSBqHapCohVaTrKxaw9aoTCibHSpVFakaiWEytxMVYGo5qVQRLKSDkS4STdGj%2FkaqtRbM%2FHSnLJ90bIarrps3BqlS4aPa27fSv7m4etWFuPUKQgHqqxgHqFRaZ2hHUtbccUTHqqMA9NEQZkFZ5PM9YBisTvvCmnh9MV5B6CCaeu7dEZccY7UTSJAukWUY4AUE%2FOTQb2bN3IwGQDWESzWEmZ6ZYnMDIC0hcnOec%2FbpW87YVC9P71KAFh8GoT5iyhHpard8S4PqKXJdZ4nUHKnP8AWmL9PxkzMnTcNvwO1WD2gmtlmjGR147HuKTKnzMqBuC5wP4h8fIqFfPU4W';
        eSignAgencyPageController.saveChunk(eSignForm.Id,'test01',body1,'image/jpeg','');
        eSignAgencyPageController.saveChunk(eSignForm.Id,'test01',body1,'image/jpeg',fileId);
        eSignAgencyPageController.deleteChunk(fileId);
        Test.stopTest();
        //eSignAgencyPageController.saveChunk(eSignForm.Id,'test01',body1,'image/jpeg',fileId);
        //eSignAgencyPageController.deleteChunk(fileId);
    }
    static testMethod void testMethod2() {
@@ -329,4 +351,31 @@
        eSignAgencyPageController.saveeSignFormEntry(eSignAgencyPageController.geteSigns('112233').eSignFormLineItems,eSignForm,'经销商收货',true,true,null);
        
    }
    static testMethod void testMethod3() {
        Test.startTest();
        eSignAgencyPageController.saveFile('1','2','3','4');
        Test.stopTest();
    }
    static testMethod void testMethod4() {
        Test.startTest();
        FileAddress__c FileName1 = new FileAddress__c();
        FileName1.FileName__c = 'ceshiyi1';
        FileName1.ViewLink__c = 'ceshiyi1';
        FileName1.ParentRecordId__c = '123456789';
        insert FileName1;
        eSignAgencyPageController.getFileds('123456789');
        Test.stopTest();
    }
    static testMethod void testMethod5() {
        Test.startTest();
        FileAddress__c FileName1 = new FileAddress__c();
        FileName1.FileName__c = 'ceshiyi1';
        FileName1.ViewLink__c = 'ceshiyi1';
        FileName1.ParentRecordId__c = '123456789';
        insert FileName1;
        eSignAgencyPageController.deleteFile(FileName1.Id);
        Test.stopTest();
    }
}
force-app/main/default/classes/eSignFormAttachmentControllerTest.cls
@@ -108,28 +108,67 @@
        eSignForm.DNName__c = '112233';
        insert eSignForm;
        list<Attachment> attachmentList = new list<Attachment>();
        Attachment attach=new Attachment();
        attach.Name='A-65224941-20200923--1.docx';
        Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body');
        attach.body=bodyBlob;
        attach.parentId=eSignForm.id;
        attach.ContentType = 'application/pdf';
        attachmentList.add(attach);
        Attachment attach1=new Attachment();
        attach1.Name='H-65224945-20200928--15.jpg';
        Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body');
        attach1.body=bodyBlob1;
        attach1.parentId=eSignForm.id;
        attach1.ContentType = 'application/pdf';
        attachmentList.add(attach1);
        insert attachmentList;
        Test.startTest();
        ContentVersion version = new ContentVersion(
            Title = 'A-65224941-20200923--1.docx',
            VersionData = EncodingUtil.base64Decode('test'),
            ContentLocation = 's',
            PathOnClient = 'test.txt'
        );
        insert version;
        version = [select ContentDocumentId from ContentVersion where Id =: version.Id];
        ContentDocumentLink link = new ContentDocumentLink();
        link.ContentDocumentId = version.ContentDocumentId;
        link.LinkedEntityId = eSignForm.id;
        link.ShareType = 'I';
        link.Visibility = 'AllUsers';
        insert link;
        ContentVersion version1 = new ContentVersion(
            Title = 'H-65224945-20200928--15.jpg',
            VersionData = EncodingUtil.base64Decode('test'),
            ContentLocation = 's',
            PathOnClient = 'test.txt'
        );
        insert version1;
        version1 = [select ContentDocumentId from ContentVersion where Id =: version1.Id];
        ContentDocumentLink link1 = new ContentDocumentLink();
        link1.ContentDocumentId = version1.ContentDocumentId;
        link1.LinkedEntityId = eSignForm.id;
        link1.ShareType = 'I';
        link1.Visibility = 'AllUsers';
        insert link1;
        // list<Attachment> attachmentList = new list<Attachment>();
        // Attachment attach=new Attachment();
        // attach.Name='A-65224941-20200923--1.docx';
        // Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body');
        // attach.body=bodyBlob;
        // attach.parentId=eSignForm.id;
        // attach.ContentType = 'application/pdf';
        // attachmentList.add(attach);
        // Attachment attach1=new Attachment();
        // attach1.Name='H-65224945-20200928--15.jpg';
        // Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body');
        // attach1.body=bodyBlob1;
        // attach1.parentId=eSignForm.id;
        // attach1.ContentType = 'application/pdf';
        // attachmentList.add(attach1);
        // insert attachmentList;
        PageReference page = new PageReference('/apex/eSignFormAttachment?parentId='+eSignForm.id);
        System.Test.setCurrentPage(page);
        eSignFormAttachmentController eSign = new eSignFormAttachmentController();
        eSign.init();
        Test.stopTest();
    }
}
force-app/main/default/classes/eSignHospitalConfirmControllerTest.cls
@@ -1,5 +1,13 @@
@isTest
private class eSignHospitalConfirmControllerTest {
    @TestSetup
    static void makeData(){
        List<String> strList= new List<String>();
        strList.add('Document');
        TestDataUtility.CreatePIPolicyConfigurations(strList);
    }
    static testMethod void testMethod1() {
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院'];
        if (rectCo.size() == 0) {
@@ -151,29 +159,49 @@
        eSignHospitalConfirmController.geteSigns('112233');
        eSignHospitalConfirmController.saveeSignFormEntry(eSignHospitalConfirmController.geteSigns('112233').eSignFormLineItems,eSignForm,'医院确认',true);
        list<Attachment> attachmentList = new list<Attachment>();
        Attachment attach=new Attachment();
        attach.Name='Unit Test Attachment';
        // list<Attachment> attachmentList = new list<Attachment>();
        // Attachment attach=new Attachment();
        // attach.Name='Unit Test Attachment';
        // Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body');
        // attach.body=bodyBlob;
        // attach.parentId=eSignForm.id;
        // attachmentList.add(attach);
        // // insert attach;
        // Attachment attach1=new Attachment();
        // attach1.Name='Unit Test Attachment';
        // Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body');
        // attach1.body=bodyBlob1;
        // attach1.parentId=eSignForm.id;
        // insert attach1;
        // String fileId = String.valueOf(attach1.Id);
        // String body1 = '%2F9j%2F4AAQSkZJRgABAQAAAQABAAD%2F2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj%2F2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj%2FwAARCALuAegDASIAAhEBAxEB%2F8QAHAAAAgIDAQEAAAAAAAAAAAAAAwQCBQABBgcI%2F8QARRAAAgEDAwIFAgMGBAUCBQQDAQIDAAQRBRIhMUEGEyJRYTJxFIGRByNCUqHBFTOx0SRDYuHwcvEWNFNjggglc5ImotL%2FxAAbAQACAwEBAQAAAAAAAAAAAAADBAECBQAGB%2F%2FEADMRAAICAQQCAQQABQMEAwEAAAECAAMRBBIhMRNBIgUyUWEUI0JxgQYzkRWhsdEkUsHw%2F9oADAMBAAIRAxEAPwDwgQg8kc1IRjB4o7DHSgvKFB96yASZ63EE6gGtNgLQXnzmoebRNsuqD3Dq3fijxeUxxICM9xSQkrYkqCpjAWvEsmg2epG3LS7DFBSUjuRRBKCfVzUYIg2rB%2B2SNDbk0XaGwVPFZ5RLVAIlFqdzgCBjiMj9Mir%2By%2FcxbAcA9ar7WMJTikk0vc27iel%2BmaYacbj3Gi%2FtWg5oSDJwaOI%2BKXOBN5SzcyPWoScjFEUgVAjJzXCQ4yJX3ScfalRLtcU9fEAGqgHLinKxlZ53WN47MLOktZAyimQaq7J%2BFqwVvVSbrgz0elu3IMyx09lIZWPGanBA9zcBYslc0vp8RmkIGcZrq7CzMUWYkOcdaSusFf8AeZeqYmwzECwQCKPt9VRSwlvXywOAMCrfS7GMzBZCMtz96NcEWdyQhDLntWebjkhYpu9SrbS4oWAlUEjGasLq0S3tYXjwEbkgVHU7xLpt4GwgAE%2FFINdeYqqrF1XAA%2BKgB2wTK5JwZcWs6S6e0Z459P5UsLxrJ2YHlhtwPbOaRjufMhm2cMvCj5qOmDiW4uSHK8bakVAA5ltpkptRXznk6O%2Bc0lK5mcFY%2BTzk1jKnmPKw9Lsdo9qNKRDHu%2BOBR1AU8CGCcRc%2BYqkSPge1QtrX8Q4YjEa1KOF5m3SHC1bJEItIR1%2BqViF%2BwqWfbwJJAGBK1rYxNgjMZokatCfMX1KfTzVjdQs8EBxjfHu%2FMCkmV4Yxu5QnkVG%2FcJHBGYWO5COApKGslK7t7chjurVxGmPMUZUgUxaWayyLBK21CCyt80I4HMqwwMyN9cJdOpcYUDH59TSt9psPkI6kbn6imri3ELPFI4LDkUi%2B7AAY%2FGalAeCsjuVsmkYQuPfBqK2p27SMYq4M5FsUK985FbiCSLzjAFENje4VOJWKjIqqwyCMUheRukLRA%2Bhj0q%2FeISRMUxlRwKq7iNuN4980Suzmc6gymSHfHtHuSKXltQC27r1NWU6GMgp%2FShFS4LEcmnFcjmKWVxRrXyrfB6kZNZZQAcnjn%2BlWU0W6MHHWpW1rvyahrPjBbB7kraZrWUNH0PWrGO9jnk2TYwOi%2FNJvDtiY%2FwAtJyIQiPnDdTQcB%2BZY5lhfxLKSyZ%2BB%2FvVK6BXYNyadiuGTKk9e9bEYnbj8zVkJSQTnuLw2%2Begp%2B2tCZBxTFnb%2FABxVrDCkSl5MKqjJJ7UCy4ngQbj8QUNphMtwO9VGtatHagw2xDS9Cewoeu6%2F5gaCxOEHDP71zBOSSxyT3o%2Bn0x%2B%2ByOUaPd8rJtsvIXc7mJyTUsjHNDLYqO%2BnsZmmGVBgSbyYWk5W5NEduKUlYk0VFiWpuMhI9D9TdKMkQ6saIAAeOKLuA6md42c5MhFGf4qyi1lUJzGlQKMQNzKFHB5qtdyzVAyFzk1HdzTapieZ3CT61o8VHdWZq2J27MkDUqgKnnNQZZTJg5xUhQgampBFVMKphVcqRg0ylyMeoc0iWxWg1QVBhUvNZ4lnHOueKeikBHFUKueKPHOVI5oLVZmjp9eV7nQQ4LUfNVllchiBT2%2FFJupBxPR6a9XTImSDnionhD71MNnrS88gANcozxLWsFUtK7UpeAKSjGWqN3Jvm%2B1EgHIp8Das8i9vmuJlnbAjaafBpSBfRTAPppN%2BTPS6b4LOq8IwrNHdk43LgjNdLaXy2zOCA2egFcn4RR5GuNrbUwN1dNP5dqilRkn3rG1K5sIil3ycyQeZ5A30IDxioS3B5VMs2etL%2BfLccAHmnra1EMMk0v1AHFBwB3KbQO5SziWWXZuOOM0a2RoUKpjoW%2FKiRr%2B7Zv4j1ocq7yvOD0%2FKjbs8S%2B2AjLQFpI%2FUpO7NDgvfLnLcndwRTEOFk2qCCp71qRI%2FxzIowGOR8cVcEc5lB3iEjxcTFyCsfUCtzjfcxoemN1MwLC0oj34PQYpW45nBTnb6TQweYVYWZmjG3GB9P6jNORkS2NvESd6MSPtSMCtM0Yb1eZ0%2BD0rp44YbGWCFVWWYnLZ7DFCsbbge4OxsGJ3szbIkRMIiCPJHXPWkLiVJpXRB6QSoFX0zQzW5kRQJEba69vvXOSqIJQy5Yf8Aaq0nPBkIMiG05hLaTQSDkcA0J5Hd1EpCBCKNYKEhZ5Mqp%2FqaFexrM%2FmHgHpVxgsfxCbcCL6k7S3pGeFACn3FCnmMsaKF9SdT8VYPapGsYPLsu7J7Clp4GiXehyM5IogYHAkLzFQ7R8ZyPY1sSIehKmgS73jaQZzmtRqW5q5AhSojkcjQ%2FwDUDUPMErMCB15%2BKExdOc5FaBVz7NVQsrgiQktlMhUdKD%2BG5IphCyyNu5BopdC%2FFXDMJVlibLtTaaD5rxZ296dlYYKnv3pWaPMWR1zRFbPBgDXIMzcAnINCfLSFSeooLSsGwakXPnJ89aIFxBkTFTJyexxTlmmHK%2B4oIGXI7ZqxtgqDzHIAA5Jodh9CAb9R%2BDy4YjLKQqqMmuV1zWXvXMcLFLcdB%2FNQ9a1R7uQxREiAHp%2FN8mqdzzjNH0%2BmCfJu4%2Fp6NvybuYWqDPjNRd8CgM9OhMwr3AQpfmsBzQd4qSMCauVgRaDNyHaOaUeUA8UO6uC8hVOgoaxsRzRlTA5mbdqS7YQQnnEnvRUkUDLHmoRwcVI24Irjt6kILQMyRu46ygtae1ZXYSQW1P4lSGqQOaBk1IMadxPNiyGrYqAPFbBquIVWkw2KkDmh5rY4qCIQNCc1tTUQRWVXEIGkzWq1mt5qCJbOZsHFS3VCt10sGh4ZSjAg1eQSiWBWHXvXOg4p7Trgq%2B0n0nigXV7hmaf0%2FVmt9p6MuVekL%2BbCk0cnBxVVqcnIFBpT5TS%2BoagrSYmDuYk09a8mkI%2BtP2vBpqzqYWj5YS4t%2FpqbcZqFv0ojDLVnnuevT7BOj8LqVtp2BxkirrzGuWXzDwvAqp8OjbYkYySxq0jiY4C8Z7msu85cxcy0REUAqOBxUL2YmLys8k4oCSSQt5L84PNTUGSVpD0HSlduOZQCR8tvLKrngZNV8YZrkKTyvWrDzts6Rno55qN2qQauBwqtGOe2TVlJHEk8RGSXZMzuMEnnnisWLzdU2xsGwpk4%2FXFP3enR3FqQrEOAGHt9qBp9uli8kzby5G0cdAQaIHBH7lCQRx3CSxJhXtzggE5Pt1oVuCoVmBJbtRXlMnlpEowo2kDvRCo%2FdhiAdoxjpxVMkDEsuRwYrBMYLk%2Fyq3%2Fer%2B2t%2FwAZK03mHJw457HqKoJIn3MqAMGOf60O3acO4jZgI1JODjArmTeODOsTPM6Ag2QlO7Kn0n5Jqstybi6RH%2BjdnApSFp55NrFn%2Fjwf9ad0%2BN%2FxgYgqozzVCNoI9wqrhcyyuoRNPHbLwm7BNVmoB4HhU8gen86tLgn8RCz5VBzn3NIalB%2BIs2SJ%2FWkhce5qlZAIBnIeR%2BJG6uN6pGwIdQASandyrNZI4G1skE%2FFIafZXEtw7zyelV5Oeppq7jEdljd6vMH50XgMAJxVdwAktN078VA%2B447CqyZWiuTGRjYcGr21nFvZytnnJAH3qpjJe9M0w3KxyahCckmVw2SYnMTs9PStwMjEF%2BDTF2qh3Ef0nkUCKFpXCIMnFG3DE7HuFaF0RnzlaW2knKdasH8yKJ4pB2zzSNrIUl4AOfeuViRmVPUBI54z1oe5j9qfnjExKsu1qQlUxuVbtRUYEThz3F7iPd6l%2FOhxAmVSaYU4z81MRAOpFE3YGIJ6%2Fc3s2%2BqqzVL4sghRsIPqPvTOr3a28G0MN7f0FcjcXbO3H00zRQW%2BRi2Vrbc0bkmAOFoEk1KFzjmhs5p5a5WzWH1DvL80BpeaEzUJnooWIWakxkyk96Omdh560jHyQaO0uBiuKzq7uMtJiNUGTya20gA4FL7%2FAJrW6u2%2Fmd5gOFEMs5z1oqy80lU06VxUGcl7Ax5Jx3rKSJOayo2CGGsYSkJOa2DQw2TzUh1p%2BePDZhQxqatmgjrRF61UwysYQGp5yOKFUl6VWHUyYNSBqHapCohVaTrKxaw9aoTCibHSpVFakaiWEytxMVYGo5qVQRLKSDkS4STdGj%2FkaqtRbM%2FHSnLJ90bIarrps3BqlS4aPa27fSv7m4etWFuPUKQgHqqxgHqFRaZ2hHUtbccUTHqqMA9NEQZkFZ5PM9YBisTvvCmnh9MV5B6CCaeu7dEZccY7UTSJAukWUY4AUE%2FOTQb2bN3IwGQDWESzWEmZ6ZYnMDIC0hcnOec%2FbpW87YVC9P71KAFh8GoT5iyhHpard8S4PqKXJdZ4nUHKnP8AWmL9PxkzMnTcNvwO1WD2gmtlmjGR147HuKTKnzMqBuC5wP4h8fIqFfPU4W';
        // eSignHospitalConfirmController.saveChunk(eSignForm.Id,'test01',body1,'image/jpeg','');
        Test.startTest();
        List<ContentVersion> versionList = new List<ContentVersion>();
        ContentVersion version = new ContentVersion();
        Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body');
        attach.body=bodyBlob;
        attach.parentId=eSignForm.id;
        attachmentList.add(attach);
        // insert attach;
        Attachment attach1=new Attachment();
        attach1.Name='Unit Test Attachment';
        Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body');
        attach1.body=bodyBlob1;
        attach1.parentId=eSignForm.id;
        insert attach1;
        String fileId = String.valueOf(attach1.Id);
        version.VersionData = bodyBlob;
        version.Title = 'Unit Test Attachment';
        version.PathOnClient = 'Unit Test Attachment.txt';
        version.ContentLocation = 's';
        versionList.add(version);
        insert versionList;
        version = [select Id,ContentDocumentId from ContentVersion where Id =: version.Id];
        String fileId = String.valueOf(version.ContentDocumentId);
        String body1 = '%2F9j%2F4AAQSkZJRgABAQAAAQABAAD%2F2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj%2F2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj%2FwAARCALuAegDASIAAhEBAxEB%2F8QAHAAAAgIDAQEAAAAAAAAAAAAAAwQCBQABBgcI%2F8QARRAAAgEDAwIFAgMGBAUCBQQDAQIDAAQRBRIhMUEGEyJRYTJxFIGRByNCUqHBFTOx0SRDYuHwcvEWNFNjggglc5ImotL%2FxAAbAQACAwEBAQAAAAAAAAAAAAADBAECBQAGB%2F%2FEADMRAAICAQQCAQQABQMEAwEAAAECAAMRBBIhMRNBIgUyUWEUI0JxgQYzkRWhsdEkUsHw%2F9oADAMBAAIRAxEAPwDwgQg8kc1IRjB4o7DHSgvKFB96yASZ63EE6gGtNgLQXnzmoebRNsuqD3Dq3fijxeUxxICM9xSQkrYkqCpjAWvEsmg2epG3LS7DFBSUjuRRBKCfVzUYIg2rB%2B2SNDbk0XaGwVPFZ5RLVAIlFqdzgCBjiMj9Mir%2By%2FcxbAcA9ar7WMJTikk0vc27iel%2BmaYacbj3Gi%2FtWg5oSDJwaOI%2BKXOBN5SzcyPWoScjFEUgVAjJzXCQ4yJX3ScfalRLtcU9fEAGqgHLinKxlZ53WN47MLOktZAyimQaq7J%2BFqwVvVSbrgz0elu3IMyx09lIZWPGanBA9zcBYslc0vp8RmkIGcZrq7CzMUWYkOcdaSusFf8AeZeqYmwzECwQCKPt9VRSwlvXywOAMCrfS7GMzBZCMtz96NcEWdyQhDLntWebjkhYpu9SrbS4oWAlUEjGasLq0S3tYXjwEbkgVHU7xLpt4GwgAE%2FFINdeYqqrF1XAA%2BKgB2wTK5JwZcWs6S6e0Z459P5UsLxrJ2YHlhtwPbOaRjufMhm2cMvCj5qOmDiW4uSHK8bakVAA5ltpkptRXznk6O%2Bc0lK5mcFY%2BTzk1jKnmPKw9Lsdo9qNKRDHu%2BOBR1AU8CGCcRc%2BYqkSPge1QtrX8Q4YjEa1KOF5m3SHC1bJEItIR1%2BqViF%2BwqWfbwJJAGBK1rYxNgjMZokatCfMX1KfTzVjdQs8EBxjfHu%2FMCkmV4Yxu5QnkVG%2FcJHBGYWO5COApKGslK7t7chjurVxGmPMUZUgUxaWayyLBK21CCyt80I4HMqwwMyN9cJdOpcYUDH59TSt9psPkI6kbn6imri3ELPFI4LDkUi%2B7AAY%2FGalAeCsjuVsmkYQuPfBqK2p27SMYq4M5FsUK985FbiCSLzjAFENje4VOJWKjIqqwyCMUheRukLRA%2Bhj0q%2FeISRMUxlRwKq7iNuN4980Suzmc6gymSHfHtHuSKXltQC27r1NWU6GMgp%2FShFS4LEcmnFcjmKWVxRrXyrfB6kZNZZQAcnjn%2BlWU0W6MHHWpW1rvyahrPjBbB7kraZrWUNH0PWrGO9jnk2TYwOi%2FNJvDtiY%2FwAtJyIQiPnDdTQcB%2BZY5lhfxLKSyZ%2BB%2FvVK6BXYNyadiuGTKk9e9bEYnbj8zVkJSQTnuLw2%2Begp%2B2tCZBxTFnb%2FABxVrDCkSl5MKqjJJ7UCy4ngQbj8QUNphMtwO9VGtatHagw2xDS9Cewoeu6%2F5gaCxOEHDP71zBOSSxyT3o%2Bn0x%2B%2ByOUaPd8rJtsvIXc7mJyTUsjHNDLYqO%2BnsZmmGVBgSbyYWk5W5NEduKUlYk0VFiWpuMhI9D9TdKMkQ6saIAAeOKLuA6md42c5MhFGf4qyi1lUJzGlQKMQNzKFHB5qtdyzVAyFzk1HdzTapieZ3CT61o8VHdWZq2J27MkDUqgKnnNQZZTJg5xUhQgampBFVMKphVcqRg0ylyMeoc0iWxWg1QVBhUvNZ4lnHOueKeikBHFUKueKPHOVI5oLVZmjp9eV7nQQ4LUfNVllchiBT2%2FFJupBxPR6a9XTImSDnionhD71MNnrS88gANcozxLWsFUtK7UpeAKSjGWqN3Jvm%2B1EgHIp8Das8i9vmuJlnbAjaafBpSBfRTAPppN%2BTPS6b4LOq8IwrNHdk43LgjNdLaXy2zOCA2egFcn4RR5GuNrbUwN1dNP5dqilRkn3rG1K5sIil3ycyQeZ5A30IDxioS3B5VMs2etL%2BfLccAHmnra1EMMk0v1AHFBwB3KbQO5SziWWXZuOOM0a2RoUKpjoW%2FKiRr%2B7Zv4j1ocq7yvOD0%2FKjbs8S%2B2AjLQFpI%2FUpO7NDgvfLnLcndwRTEOFk2qCCp71qRI%2FxzIowGOR8cVcEc5lB3iEjxcTFyCsfUCtzjfcxoemN1MwLC0oj34PQYpW45nBTnb6TQweYVYWZmjG3GB9P6jNORkS2NvESd6MSPtSMCtM0Yb1eZ0%2BD0rp44YbGWCFVWWYnLZ7DFCsbbge4OxsGJ3szbIkRMIiCPJHXPWkLiVJpXRB6QSoFX0zQzW5kRQJEba69vvXOSqIJQy5Yf8Aaq0nPBkIMiG05hLaTQSDkcA0J5Hd1EpCBCKNYKEhZ5Mqp%2FqaFexrM%2FmHgHpVxgsfxCbcCL6k7S3pGeFACn3FCnmMsaKF9SdT8VYPapGsYPLsu7J7Clp4GiXehyM5IogYHAkLzFQ7R8ZyPY1sSIehKmgS73jaQZzmtRqW5q5AhSojkcjQ%2FwDUDUPMErMCB15%2BKExdOc5FaBVz7NVQsrgiQktlMhUdKD%2BG5IphCyyNu5BopdC%2FFXDMJVlibLtTaaD5rxZ296dlYYKnv3pWaPMWR1zRFbPBgDXIMzcAnINCfLSFSeooLSsGwakXPnJ89aIFxBkTFTJyexxTlmmHK%2B4oIGXI7ZqxtgqDzHIAA5Jodh9CAb9R%2BDy4YjLKQqqMmuV1zWXvXMcLFLcdB%2FNQ9a1R7uQxREiAHp%2FN8mqdzzjNH0%2BmCfJu4%2Fp6NvybuYWqDPjNRd8CgM9OhMwr3AQpfmsBzQd4qSMCauVgRaDNyHaOaUeUA8UO6uC8hVOgoaxsRzRlTA5mbdqS7YQQnnEnvRUkUDLHmoRwcVI24Irjt6kILQMyRu46ygtae1ZXYSQW1P4lSGqQOaBk1IMadxPNiyGrYqAPFbBquIVWkw2KkDmh5rY4qCIQNCc1tTUQRWVXEIGkzWq1mt5qCJbOZsHFS3VCt10sGh4ZSjAg1eQSiWBWHXvXOg4p7Trgq%2B0n0nigXV7hmaf0%2FVmt9p6MuVekL%2BbCk0cnBxVVqcnIFBpT5TS%2BoagrSYmDuYk09a8mkI%2BtP2vBpqzqYWj5YS4t%2FpqbcZqFv0ojDLVnnuevT7BOj8LqVtp2BxkirrzGuWXzDwvAqp8OjbYkYySxq0jiY4C8Z7msu85cxcy0REUAqOBxUL2YmLys8k4oCSSQt5L84PNTUGSVpD0HSlduOZQCR8tvLKrngZNV8YZrkKTyvWrDzts6Rno55qN2qQauBwqtGOe2TVlJHEk8RGSXZMzuMEnnnisWLzdU2xsGwpk4%2FXFP3enR3FqQrEOAGHt9qBp9uli8kzby5G0cdAQaIHBH7lCQRx3CSxJhXtzggE5Pt1oVuCoVmBJbtRXlMnlpEowo2kDvRCo%2FdhiAdoxjpxVMkDEsuRwYrBMYLk%2Fyq3%2Fer%2B2t%2FwAZK03mHJw457HqKoJIn3MqAMGOf60O3acO4jZgI1JODjArmTeODOsTPM6Ag2QlO7Kn0n5Jqstybi6RH%2BjdnApSFp55NrFn%2Fjwf9ad0%2BN%2FxgYgqozzVCNoI9wqrhcyyuoRNPHbLwm7BNVmoB4HhU8gen86tLgn8RCz5VBzn3NIalB%2BIs2SJ%2FWkhce5qlZAIBnIeR%2BJG6uN6pGwIdQASandyrNZI4G1skE%2FFIafZXEtw7zyelV5Oeppq7jEdljd6vMH50XgMAJxVdwAktN078VA%2B447CqyZWiuTGRjYcGr21nFvZytnnJAH3qpjJe9M0w3KxyahCckmVw2SYnMTs9PStwMjEF%2BDTF2qh3Ef0nkUCKFpXCIMnFG3DE7HuFaF0RnzlaW2knKdasH8yKJ4pB2zzSNrIUl4AOfeuViRmVPUBI54z1oe5j9qfnjExKsu1qQlUxuVbtRUYEThz3F7iPd6l%2FOhxAmVSaYU4z81MRAOpFE3YGIJ6%2Fc3s2%2BqqzVL4sghRsIPqPvTOr3a28G0MN7f0FcjcXbO3H00zRQW%2BRi2Vrbc0bkmAOFoEk1KFzjmhs5p5a5WzWH1DvL80BpeaEzUJnooWIWakxkyk96Omdh560jHyQaO0uBiuKzq7uMtJiNUGTya20gA4FL7%2FAJrW6u2%2Fmd5gOFEMs5z1oqy80lU06VxUGcl7Ax5Jx3rKSJOayo2CGGsYSkJOa2DQw2TzUh1p%2BePDZhQxqatmgjrRF61UwysYQGp5yOKFUl6VWHUyYNSBqHapCohVaTrKxaw9aoTCibHSpVFakaiWEytxMVYGo5qVQRLKSDkS4STdGj%2FkaqtRbM%2FHSnLJ90bIarrps3BqlS4aPa27fSv7m4etWFuPUKQgHqqxgHqFRaZ2hHUtbccUTHqqMA9NEQZkFZ5PM9YBisTvvCmnh9MV5B6CCaeu7dEZccY7UTSJAukWUY4AUE%2FOTQb2bN3IwGQDWESzWEmZ6ZYnMDIC0hcnOec%2FbpW87YVC9P71KAFh8GoT5iyhHpard8S4PqKXJdZ4nUHKnP8AWmL9PxkzMnTcNvwO1WD2gmtlmjGR147HuKTKnzMqBuC5wP4h8fIqFfPU4W';
        eSignHospitalConfirmController.saveChunk(eSignForm.Id,'test01',body1,'image/jpeg','');
        eSignHospitalConfirmController.saveChunk(eSignForm.Id,'test01',body1,'image/jpeg',fileId);
        eSignHospitalConfirmController.deleteChunk(attach1.Id);
        eSignHospitalConfirmController.deleteChunk(fileId);
        Test.stopTest();
        // eSignHospitalConfirmController.saveChunk(eSignForm.Id,'test01',body1,'image/jpeg',fileId);
        // eSignHospitalConfirmController.deleteChunk(attach1.Id);
    }
    static testMethod void testMethod2() {
@@ -327,4 +355,32 @@
        eSignHospitalConfirmController.geteSigns('112233');
        eSignHospitalConfirmController.saveeSignFormEntry(eSignHospitalConfirmController.geteSigns('112233').eSignFormLineItems,eSignForm,'医院确认',true);
    }
    static testMethod void testMethod3() {
        Test.startTest();
        eSignHospitalConfirmController.saveFile('1','2','3','4');
        Test.stopTest();
    }
    static testMethod void testMethod4() {
        Test.startTest();
        FileAddress__c FileName1 = new FileAddress__c();
        FileName1.FileName__c = 'ceshiyi1';
        FileName1.ViewLink__c = 'ceshiyi1';
        FileName1.ParentRecordId__c = '123456789';
        insert FileName1;
        eSignHospitalConfirmController.getFileds('123456789');
        Test.stopTest();
    }
    static testMethod void testMethod5() {
        Test.startTest();
        FileAddress__c FileName1 = new FileAddress__c();
        FileName1.FileName__c = 'ceshiyi1';
        FileName1.ViewLink__c = 'ceshiyi1';
        FileName1.ParentRecordId__c = '123456789';
        insert FileName1;
        eSignHospitalConfirmController.deleteFile(FileName1.Id);
        Test.stopTest();
    }
}
force-app/main/default/classes/eSignHospitalPageControllerTest.cls
@@ -1,5 +1,13 @@
@isTest
private class eSignHospitalPageControllerTest {
    @TestSetup
    static void makeData(){
        List<String> strList= new List<String>();
        strList.add('Document');
        TestDataUtility.CreatePIPolicyConfigurations(strList);
    }
    static testMethod void testMethod1() {
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院'];
        if (rectCo.size() == 0) {
@@ -151,29 +159,49 @@
        eSignHospitalPageController.geteSigns('112233');
        eSignHospitalPageController.saveeSignFormEntry(eSignHospitalPageController.geteSigns('112233').eSignFormLineItems,eSignForm,'医院收货',true,true,true,d,d,d,'222@qq.com');
        list<Attachment> attachmentList = new list<Attachment>();
        Attachment attach=new Attachment();
        attach.Name='Unit Test Attachment';
        Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body');
        attach.body=bodyBlob;
        attach.parentId=eSignForm.id;
        // list<Attachment> attachmentList = new list<Attachment>();
        // Attachment attach=new Attachment();
        // attach.Name='Unit Test Attachment';
        // Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body');
        // attach.body=bodyBlob;
        // attach.parentId=eSignForm.id;
        attachmentList.add(attach);
        // attachmentList.add(attach);
        // insert attach;
        Attachment attach1=new Attachment();
        attach1.Name='Unit Test Attachment';
        Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body');
        attach1.body=bodyBlob1;
        attach1.parentId=eSignForm.id;
        // Attachment attach1=new Attachment();
        // attach1.Name='Unit Test Attachment';
        // Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body');
        // attach1.body=bodyBlob1;
        // attach1.parentId=eSignForm.id;
        insert attach1;
        // insert attach1;
        String fileId = String.valueOf(attach1.Id);
        // String fileId = String.valueOf(attach1.Id);
        // String body1 = '%2F9j%2F4AAQSkZJRgABAQAAAQABAAD%2F2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj%2F2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj%2FwAARCALuAegDASIAAhEBAxEB%2F8QAHAAAAgIDAQEAAAAAAAAAAAAAAwQCBQABBgcI%2F8QARRAAAgEDAwIFAgMGBAUCBQQDAQIDAAQRBRIhMUEGEyJRYTJxFIGRByNCUqHBFTOx0SRDYuHwcvEWNFNjggglc5ImotL%2FxAAbAQACAwEBAQAAAAAAAAAAAAADBAECBQAGB%2F%2FEADMRAAICAQQCAQQABQMEAwEAAAECAAMRBBIhMRNBIgUyUWEUI0JxgQYzkRWhsdEkUsHw%2F9oADAMBAAIRAxEAPwDwgQg8kc1IRjB4o7DHSgvKFB96yASZ63EE6gGtNgLQXnzmoebRNsuqD3Dq3fijxeUxxICM9xSQkrYkqCpjAWvEsmg2epG3LS7DFBSUjuRRBKCfVzUYIg2rB%2B2SNDbk0XaGwVPFZ5RLVAIlFqdzgCBjiMj9Mir%2By%2FcxbAcA9ar7WMJTikk0vc27iel%2BmaYacbj3Gi%2FtWg5oSDJwaOI%2BKXOBN5SzcyPWoScjFEUgVAjJzXCQ4yJX3ScfalRLtcU9fEAGqgHLinKxlZ53WN47MLOktZAyimQaq7J%2BFqwVvVSbrgz0elu3IMyx09lIZWPGanBA9zcBYslc0vp8RmkIGcZrq7CzMUWYkOcdaSusFf8AeZeqYmwzECwQCKPt9VRSwlvXywOAMCrfS7GMzBZCMtz96NcEWdyQhDLntWebjkhYpu9SrbS4oWAlUEjGasLq0S3tYXjwEbkgVHU7xLpt4GwgAE%2FFINdeYqqrF1XAA%2BKgB2wTK5JwZcWs6S6e0Z459P5UsLxrJ2YHlhtwPbOaRjufMhm2cMvCj5qOmDiW4uSHK8bakVAA5ltpkptRXznk6O%2Bc0lK5mcFY%2BTzk1jKnmPKw9Lsdo9qNKRDHu%2BOBR1AU8CGCcRc%2BYqkSPge1QtrX8Q4YjEa1KOF5m3SHC1bJEItIR1%2BqViF%2BwqWfbwJJAGBK1rYxNgjMZokatCfMX1KfTzVjdQs8EBxjfHu%2FMCkmV4Yxu5QnkVG%2FcJHBGYWO5COApKGslK7t7chjurVxGmPMUZUgUxaWayyLBK21CCyt80I4HMqwwMyN9cJdOpcYUDH59TSt9psPkI6kbn6imri3ELPFI4LDkUi%2B7AAY%2FGalAeCsjuVsmkYQuPfBqK2p27SMYq4M5FsUK985FbiCSLzjAFENje4VOJWKjIqqwyCMUheRukLRA%2Bhj0q%2FeISRMUxlRwKq7iNuN4980Suzmc6gymSHfHtHuSKXltQC27r1NWU6GMgp%2FShFS4LEcmnFcjmKWVxRrXyrfB6kZNZZQAcnjn%2BlWU0W6MHHWpW1rvyahrPjBbB7kraZrWUNH0PWrGO9jnk2TYwOi%2FNJvDtiY%2FwAtJyIQiPnDdTQcB%2BZY5lhfxLKSyZ%2BB%2FvVK6BXYNyadiuGTKk9e9bEYnbj8zVkJSQTnuLw2%2Begp%2B2tCZBxTFnb%2FABxVrDCkSl5MKqjJJ7UCy4ngQbj8QUNphMtwO9VGtatHagw2xDS9Cewoeu6%2F5gaCxOEHDP71zBOSSxyT3o%2Bn0x%2B%2ByOUaPd8rJtsvIXc7mJyTUsjHNDLYqO%2BnsZmmGVBgSbyYWk5W5NEduKUlYk0VFiWpuMhI9D9TdKMkQ6saIAAeOKLuA6md42c5MhFGf4qyi1lUJzGlQKMQNzKFHB5qtdyzVAyFzk1HdzTapieZ3CT61o8VHdWZq2J27MkDUqgKnnNQZZTJg5xUhQgampBFVMKphVcqRg0ylyMeoc0iWxWg1QVBhUvNZ4lnHOueKeikBHFUKueKPHOVI5oLVZmjp9eV7nQQ4LUfNVllchiBT2%2FFJupBxPR6a9XTImSDnionhD71MNnrS88gANcozxLWsFUtK7UpeAKSjGWqN3Jvm%2B1EgHIp8Das8i9vmuJlnbAjaafBpSBfRTAPppN%2BTPS6b4LOq8IwrNHdk43LgjNdLaXy2zOCA2egFcn4RR5GuNrbUwN1dNP5dqilRkn3rG1K5sIil3ycyQeZ5A30IDxioS3B5VMs2etL%2BfLccAHmnra1EMMk0v1AHFBwB3KbQO5SziWWXZuOOM0a2RoUKpjoW%2FKiRr%2B7Zv4j1ocq7yvOD0%2FKjbs8S%2B2AjLQFpI%2FUpO7NDgvfLnLcndwRTEOFk2qCCp71qRI%2FxzIowGOR8cVcEc5lB3iEjxcTFyCsfUCtzjfcxoemN1MwLC0oj34PQYpW45nBTnb6TQweYVYWZmjG3GB9P6jNORkS2NvESd6MSPtSMCtM0Yb1eZ0%2BD0rp44YbGWCFVWWYnLZ7DFCsbbge4OxsGJ3szbIkRMIiCPJHXPWkLiVJpXRB6QSoFX0zQzW5kRQJEba69vvXOSqIJQy5Yf8Aaq0nPBkIMiG05hLaTQSDkcA0J5Hd1EpCBCKNYKEhZ5Mqp%2FqaFexrM%2FmHgHpVxgsfxCbcCL6k7S3pGeFACn3FCnmMsaKF9SdT8VYPapGsYPLsu7J7Clp4GiXehyM5IogYHAkLzFQ7R8ZyPY1sSIehKmgS73jaQZzmtRqW5q5AhSojkcjQ%2FwDUDUPMErMCB15%2BKExdOc5FaBVz7NVQsrgiQktlMhUdKD%2BG5IphCyyNu5BopdC%2FFXDMJVlibLtTaaD5rxZ296dlYYKnv3pWaPMWR1zRFbPBgDXIMzcAnINCfLSFSeooLSsGwakXPnJ89aIFxBkTFTJyexxTlmmHK%2B4oIGXI7ZqxtgqDzHIAA5Jodh9CAb9R%2BDy4YjLKQqqMmuV1zWXvXMcLFLcdB%2FNQ9a1R7uQxREiAHp%2FN8mqdzzjNH0%2BmCfJu4%2Fp6NvybuYWqDPjNRd8CgM9OhMwr3AQpfmsBzQd4qSMCauVgRaDNyHaOaUeUA8UO6uC8hVOgoaxsRzRlTA5mbdqS7YQQnnEnvRUkUDLHmoRwcVI24Irjt6kILQMyRu46ygtae1ZXYSQW1P4lSGqQOaBk1IMadxPNiyGrYqAPFbBquIVWkw2KkDmh5rY4qCIQNCc1tTUQRWVXEIGkzWq1mt5qCJbOZsHFS3VCt10sGh4ZSjAg1eQSiWBWHXvXOg4p7Trgq%2B0n0nigXV7hmaf0%2FVmt9p6MuVekL%2BbCk0cnBxVVqcnIFBpT5TS%2BoagrSYmDuYk09a8mkI%2BtP2vBpqzqYWj5YS4t%2FpqbcZqFv0ojDLVnnuevT7BOj8LqVtp2BxkirrzGuWXzDwvAqp8OjbYkYySxq0jiY4C8Z7msu85cxcy0REUAqOBxUL2YmLys8k4oCSSQt5L84PNTUGSVpD0HSlduOZQCR8tvLKrngZNV8YZrkKTyvWrDzts6Rno55qN2qQauBwqtGOe2TVlJHEk8RGSXZMzuMEnnnisWLzdU2xsGwpk4%2FXFP3enR3FqQrEOAGHt9qBp9uli8kzby5G0cdAQaIHBH7lCQRx3CSxJhXtzggE5Pt1oVuCoVmBJbtRXlMnlpEowo2kDvRCo%2FdhiAdoxjpxVMkDEsuRwYrBMYLk%2Fyq3%2Fer%2B2t%2FwAZK03mHJw457HqKoJIn3MqAMGOf60O3acO4jZgI1JODjArmTeODOsTPM6Ag2QlO7Kn0n5Jqstybi6RH%2BjdnApSFp55NrFn%2Fjwf9ad0%2BN%2FxgYgqozzVCNoI9wqrhcyyuoRNPHbLwm7BNVmoB4HhU8gen86tLgn8RCz5VBzn3NIalB%2BIs2SJ%2FWkhce5qlZAIBnIeR%2BJG6uN6pGwIdQASandyrNZI4G1skE%2FFIafZXEtw7zyelV5Oeppq7jEdljd6vMH50XgMAJxVdwAktN078VA%2B447CqyZWiuTGRjYcGr21nFvZytnnJAH3qpjJe9M0w3KxyahCckmVw2SYnMTs9PStwMjEF%2BDTF2qh3Ef0nkUCKFpXCIMnFG3DE7HuFaF0RnzlaW2knKdasH8yKJ4pB2zzSNrIUl4AOfeuViRmVPUBI54z1oe5j9qfnjExKsu1qQlUxuVbtRUYEThz3F7iPd6l%2FOhxAmVSaYU4z81MRAOpFE3YGIJ6%2Fc3s2%2BqqzVL4sghRsIPqPvTOr3a28G0MN7f0FcjcXbO3H00zRQW%2BRi2Vrbc0bkmAOFoEk1KFzjmhs5p5a5WzWH1DvL80BpeaEzUJnooWIWakxkyk96Omdh560jHyQaO0uBiuKzq7uMtJiNUGTya20gA4FL7%2FAJrW6u2%2Fmd5gOFEMs5z1oqy80lU06VxUGcl7Ax5Jx3rKSJOayo2CGGsYSkJOa2DQw2TzUh1p%2BePDZhQxqatmgjrRF61UwysYQGp5yOKFUl6VWHUyYNSBqHapCohVaTrKxaw9aoTCibHSpVFakaiWEytxMVYGo5qVQRLKSDkS4STdGj%2FkaqtRbM%2FHSnLJ90bIarrps3BqlS4aPa27fSv7m4etWFuPUKQgHqqxgHqFRaZ2hHUtbccUTHqqMA9NEQZkFZ5PM9YBisTvvCmnh9MV5B6CCaeu7dEZccY7UTSJAukWUY4AUE%2FOTQb2bN3IwGQDWESzWEmZ6ZYnMDIC0hcnOec%2FbpW87YVC9P71KAFh8GoT5iyhHpard8S4PqKXJdZ4nUHKnP8AWmL9PxkzMnTcNvwO1WD2gmtlmjGR147HuKTKnzMqBuC5wP4h8fIqFfPU4W';
        // eSignHospitalPageController.saveChunk(eSignForm.Id,'test01',body1,'image/jpeg','');
        Test.startTest();
        List<ContentVersion> versionList = new List<ContentVersion>();
        ContentVersion version = new ContentVersion();
        Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body');
        version.VersionData = bodyBlob;
        version.Title = 'Unit Test Attachment';
        version.PathOnClient = 'Unit Test Attachment.txt';
        version.ContentLocation = 's';
        versionList.add(version);
        insert versionList;
        version = [select Id,ContentDocumentId from ContentVersion where Id =: version.Id];
        String fileId = String.valueOf(version.ContentDocumentId);
        String body1 = '%2F9j%2F4AAQSkZJRgABAQAAAQABAAD%2F2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj%2F2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj%2FwAARCALuAegDASIAAhEBAxEB%2F8QAHAAAAgIDAQEAAAAAAAAAAAAAAwQCBQABBgcI%2F8QARRAAAgEDAwIFAgMGBAUCBQQDAQIDAAQRBRIhMUEGEyJRYTJxFIGRByNCUqHBFTOx0SRDYuHwcvEWNFNjggglc5ImotL%2FxAAbAQACAwEBAQAAAAAAAAAAAAADBAECBQAGB%2F%2FEADMRAAICAQQCAQQABQMEAwEAAAECAAMRBBIhMRNBIgUyUWEUI0JxgQYzkRWhsdEkUsHw%2F9oADAMBAAIRAxEAPwDwgQg8kc1IRjB4o7DHSgvKFB96yASZ63EE6gGtNgLQXnzmoebRNsuqD3Dq3fijxeUxxICM9xSQkrYkqCpjAWvEsmg2epG3LS7DFBSUjuRRBKCfVzUYIg2rB%2B2SNDbk0XaGwVPFZ5RLVAIlFqdzgCBjiMj9Mir%2By%2FcxbAcA9ar7WMJTikk0vc27iel%2BmaYacbj3Gi%2FtWg5oSDJwaOI%2BKXOBN5SzcyPWoScjFEUgVAjJzXCQ4yJX3ScfalRLtcU9fEAGqgHLinKxlZ53WN47MLOktZAyimQaq7J%2BFqwVvVSbrgz0elu3IMyx09lIZWPGanBA9zcBYslc0vp8RmkIGcZrq7CzMUWYkOcdaSusFf8AeZeqYmwzECwQCKPt9VRSwlvXywOAMCrfS7GMzBZCMtz96NcEWdyQhDLntWebjkhYpu9SrbS4oWAlUEjGasLq0S3tYXjwEbkgVHU7xLpt4GwgAE%2FFINdeYqqrF1XAA%2BKgB2wTK5JwZcWs6S6e0Z459P5UsLxrJ2YHlhtwPbOaRjufMhm2cMvCj5qOmDiW4uSHK8bakVAA5ltpkptRXznk6O%2Bc0lK5mcFY%2BTzk1jKnmPKw9Lsdo9qNKRDHu%2BOBR1AU8CGCcRc%2BYqkSPge1QtrX8Q4YjEa1KOF5m3SHC1bJEItIR1%2BqViF%2BwqWfbwJJAGBK1rYxNgjMZokatCfMX1KfTzVjdQs8EBxjfHu%2FMCkmV4Yxu5QnkVG%2FcJHBGYWO5COApKGslK7t7chjurVxGmPMUZUgUxaWayyLBK21CCyt80I4HMqwwMyN9cJdOpcYUDH59TSt9psPkI6kbn6imri3ELPFI4LDkUi%2B7AAY%2FGalAeCsjuVsmkYQuPfBqK2p27SMYq4M5FsUK985FbiCSLzjAFENje4VOJWKjIqqwyCMUheRukLRA%2Bhj0q%2FeISRMUxlRwKq7iNuN4980Suzmc6gymSHfHtHuSKXltQC27r1NWU6GMgp%2FShFS4LEcmnFcjmKWVxRrXyrfB6kZNZZQAcnjn%2BlWU0W6MHHWpW1rvyahrPjBbB7kraZrWUNH0PWrGO9jnk2TYwOi%2FNJvDtiY%2FwAtJyIQiPnDdTQcB%2BZY5lhfxLKSyZ%2BB%2FvVK6BXYNyadiuGTKk9e9bEYnbj8zVkJSQTnuLw2%2Begp%2B2tCZBxTFnb%2FABxVrDCkSl5MKqjJJ7UCy4ngQbj8QUNphMtwO9VGtatHagw2xDS9Cewoeu6%2F5gaCxOEHDP71zBOSSxyT3o%2Bn0x%2B%2ByOUaPd8rJtsvIXc7mJyTUsjHNDLYqO%2BnsZmmGVBgSbyYWk5W5NEduKUlYk0VFiWpuMhI9D9TdKMkQ6saIAAeOKLuA6md42c5MhFGf4qyi1lUJzGlQKMQNzKFHB5qtdyzVAyFzk1HdzTapieZ3CT61o8VHdWZq2J27MkDUqgKnnNQZZTJg5xUhQgampBFVMKphVcqRg0ylyMeoc0iWxWg1QVBhUvNZ4lnHOueKeikBHFUKueKPHOVI5oLVZmjp9eV7nQQ4LUfNVllchiBT2%2FFJupBxPR6a9XTImSDnionhD71MNnrS88gANcozxLWsFUtK7UpeAKSjGWqN3Jvm%2B1EgHIp8Das8i9vmuJlnbAjaafBpSBfRTAPppN%2BTPS6b4LOq8IwrNHdk43LgjNdLaXy2zOCA2egFcn4RR5GuNrbUwN1dNP5dqilRkn3rG1K5sIil3ycyQeZ5A30IDxioS3B5VMs2etL%2BfLccAHmnra1EMMk0v1AHFBwB3KbQO5SziWWXZuOOM0a2RoUKpjoW%2FKiRr%2B7Zv4j1ocq7yvOD0%2FKjbs8S%2B2AjLQFpI%2FUpO7NDgvfLnLcndwRTEOFk2qCCp71qRI%2FxzIowGOR8cVcEc5lB3iEjxcTFyCsfUCtzjfcxoemN1MwLC0oj34PQYpW45nBTnb6TQweYVYWZmjG3GB9P6jNORkS2NvESd6MSPtSMCtM0Yb1eZ0%2BD0rp44YbGWCFVWWYnLZ7DFCsbbge4OxsGJ3szbIkRMIiCPJHXPWkLiVJpXRB6QSoFX0zQzW5kRQJEba69vvXOSqIJQy5Yf8Aaq0nPBkIMiG05hLaTQSDkcA0J5Hd1EpCBCKNYKEhZ5Mqp%2FqaFexrM%2FmHgHpVxgsfxCbcCL6k7S3pGeFACn3FCnmMsaKF9SdT8VYPapGsYPLsu7J7Clp4GiXehyM5IogYHAkLzFQ7R8ZyPY1sSIehKmgS73jaQZzmtRqW5q5AhSojkcjQ%2FwDUDUPMErMCB15%2BKExdOc5FaBVz7NVQsrgiQktlMhUdKD%2BG5IphCyyNu5BopdC%2FFXDMJVlibLtTaaD5rxZ296dlYYKnv3pWaPMWR1zRFbPBgDXIMzcAnINCfLSFSeooLSsGwakXPnJ89aIFxBkTFTJyexxTlmmHK%2B4oIGXI7ZqxtgqDzHIAA5Jodh9CAb9R%2BDy4YjLKQqqMmuV1zWXvXMcLFLcdB%2FNQ9a1R7uQxREiAHp%2FN8mqdzzjNH0%2BmCfJu4%2Fp6NvybuYWqDPjNRd8CgM9OhMwr3AQpfmsBzQd4qSMCauVgRaDNyHaOaUeUA8UO6uC8hVOgoaxsRzRlTA5mbdqS7YQQnnEnvRUkUDLHmoRwcVI24Irjt6kILQMyRu46ygtae1ZXYSQW1P4lSGqQOaBk1IMadxPNiyGrYqAPFbBquIVWkw2KkDmh5rY4qCIQNCc1tTUQRWVXEIGkzWq1mt5qCJbOZsHFS3VCt10sGh4ZSjAg1eQSiWBWHXvXOg4p7Trgq%2B0n0nigXV7hmaf0%2FVmt9p6MuVekL%2BbCk0cnBxVVqcnIFBpT5TS%2BoagrSYmDuYk09a8mkI%2BtP2vBpqzqYWj5YS4t%2FpqbcZqFv0ojDLVnnuevT7BOj8LqVtp2BxkirrzGuWXzDwvAqp8OjbYkYySxq0jiY4C8Z7msu85cxcy0REUAqOBxUL2YmLys8k4oCSSQt5L84PNTUGSVpD0HSlduOZQCR8tvLKrngZNV8YZrkKTyvWrDzts6Rno55qN2qQauBwqtGOe2TVlJHEk8RGSXZMzuMEnnnisWLzdU2xsGwpk4%2FXFP3enR3FqQrEOAGHt9qBp9uli8kzby5G0cdAQaIHBH7lCQRx3CSxJhXtzggE5Pt1oVuCoVmBJbtRXlMnlpEowo2kDvRCo%2FdhiAdoxjpxVMkDEsuRwYrBMYLk%2Fyq3%2Fer%2B2t%2FwAZK03mHJw457HqKoJIn3MqAMGOf60O3acO4jZgI1JODjArmTeODOsTPM6Ag2QlO7Kn0n5Jqstybi6RH%2BjdnApSFp55NrFn%2Fjwf9ad0%2BN%2FxgYgqozzVCNoI9wqrhcyyuoRNPHbLwm7BNVmoB4HhU8gen86tLgn8RCz5VBzn3NIalB%2BIs2SJ%2FWkhce5qlZAIBnIeR%2BJG6uN6pGwIdQASandyrNZI4G1skE%2FFIafZXEtw7zyelV5Oeppq7jEdljd6vMH50XgMAJxVdwAktN078VA%2B447CqyZWiuTGRjYcGr21nFvZytnnJAH3qpjJe9M0w3KxyahCckmVw2SYnMTs9PStwMjEF%2BDTF2qh3Ef0nkUCKFpXCIMnFG3DE7HuFaF0RnzlaW2knKdasH8yKJ4pB2zzSNrIUl4AOfeuViRmVPUBI54z1oe5j9qfnjExKsu1qQlUxuVbtRUYEThz3F7iPd6l%2FOhxAmVSaYU4z81MRAOpFE3YGIJ6%2Fc3s2%2BqqzVL4sghRsIPqPvTOr3a28G0MN7f0FcjcXbO3H00zRQW%2BRi2Vrbc0bkmAOFoEk1KFzjmhs5p5a5WzWH1DvL80BpeaEzUJnooWIWakxkyk96Omdh560jHyQaO0uBiuKzq7uMtJiNUGTya20gA4FL7%2FAJrW6u2%2Fmd5gOFEMs5z1oqy80lU06VxUGcl7Ax5Jx3rKSJOayo2CGGsYSkJOa2DQw2TzUh1p%2BePDZhQxqatmgjrRF61UwysYQGp5yOKFUl6VWHUyYNSBqHapCohVaTrKxaw9aoTCibHSpVFakaiWEytxMVYGo5qVQRLKSDkS4STdGj%2FkaqtRbM%2FHSnLJ90bIarrps3BqlS4aPa27fSv7m4etWFuPUKQgHqqxgHqFRaZ2hHUtbccUTHqqMA9NEQZkFZ5PM9YBisTvvCmnh9MV5B6CCaeu7dEZccY7UTSJAukWUY4AUE%2FOTQb2bN3IwGQDWESzWEmZ6ZYnMDIC0hcnOec%2FbpW87YVC9P71KAFh8GoT5iyhHpard8S4PqKXJdZ4nUHKnP8AWmL9PxkzMnTcNvwO1WD2gmtlmjGR147HuKTKnzMqBuC5wP4h8fIqFfPU4W';
        eSignHospitalPageController.saveChunk(eSignForm.Id,'test01',body1,'image/jpeg','');
        eSignHospitalPageController.saveChunk(eSignForm.Id,'test01',body1,'image/jpeg',fileId);
        eSignHospitalPageController.deleteChunk(attach1.Id);
        eSignHospitalPageController.deleteChunk(fileId);
        Test.stopTest();
        // eSignHospitalPageController.saveChunk(eSignForm.Id,'test01',body1,'image/jpeg',fileId);
        // eSignHospitalPageController.deleteChunk(attach1.Id);
    }
    static testMethod void testMethod2() {
@@ -326,4 +354,32 @@
        eSignHospitalPageController.geteSigns('112233');
        eSignHospitalPageController.saveeSignFormEntry(eSignHospitalPageController.geteSigns('112233').eSignFormLineItems,eSignForm,'医院收货',true,true,true,d,d,d,'222@qq.com');
    }
    static testMethod void testMethod3() {
        Test.startTest();
        eSignHospitalPageController.saveFile('1','2','3','4');
        Test.stopTest();
    }
    static testMethod void testMethod4() {
        Test.startTest();
        FileAddress__c FileName1 = new FileAddress__c();
        FileName1.FileName__c = 'ceshiyi1';
        FileName1.ViewLink__c = 'ceshiyi1';
        FileName1.ParentRecordId__c = '123456789';
        insert FileName1;
        eSignHospitalPageController.getFileds('123456789');
        Test.stopTest();
    }
    static testMethod void testMethod5() {
        Test.startTest();
        FileAddress__c FileName1 = new FileAddress__c();
        FileName1.FileName__c = 'ceshiyi1';
        FileName1.ViewLink__c = 'ceshiyi1';
        FileName1.ParentRecordId__c = '123456789';
        insert FileName1;
        eSignHospitalPageController.deleteFile(FileName1.Id);
        Test.stopTest();
    }
}
force-app/main/default/classes/lexLightingButtonConstantTest.cls
New file
@@ -0,0 +1,33 @@
@isTest
private class lexLightingButtonConstantTest {
    static testMethod void test1(){
       lexLightingButtonConstant s = new lexLightingButtonConstant();
        // lexLightingButtonConstant.RECORD_TYPE_NAME_Application;
        // lexLightingButtonConstant.STATUS_DRAFT;
        // lexLightingButtonConstant.STATUS_COMPLETE;
        // lexLightingButtonConstant.STATUS_CANCEL;
        // lexLightingButtonConstant.STATUS_TO_BE_REPORTED;
        // lexLightingButtonConstant.STATUS_TO_NOT_REPORT;
        // lexLightingButtonConstant.STATUS_VOC_CONFIRMED;
        // lexLightingButtonConstant.STATUS_VOC_END_OF_ANSWER;
        // lexLightingButtonConstant.STATUS_VOC_APPLYING;
        // lexLightingButtonConstant.STATUS_VOC_CHECK_OVER;
        // lexLightingButtonConstant.STATUS_VOC_WRITE_OVER;
        // lexLightingButtonConstant.STOCK_APPLY_STATUS_WRITE_OVER;
        // lexLightingButtonConstant.STOCK_APPLY_STATUS_DRAFT;
        // lexLightingButtonConstant.STATUS_VOC_FINISH;
        // lexLightingButtonConstant.QUOTEIRAI_STATUS_DRAFT;
        // lexLightingButtonConstant.STATUS_QIS_OSH_TESTING;
        // lexLightingButtonConstant.STATUS_QIS_OSH_COMPLATED;
        // lexLightingButtonConstant.STATUS_QIS_OSH_TESTING_APP;
        // lexLightingButtonConstant.STATUS_QIS_RC_COMPLATED;
        // lexLightingButtonConstant.STATUS_QIS_CANCEL;
        // lexLightingButtonConstant.STATUS_QIS_RC_CHECKING;
        // lexLightingButtonConstant.STATUS_QIS_FSE_COMPLATED;
        // lexLightingButtonConstant.STATUS_QIS_COMPLATED;
        // lexLightingButtonConstant.STATUS_OPPORTUNITY_SPECIAL_APPLY_SUBMIT;
        // lexLightingButtonConstant.SUB_INFO_TYPE_SCRAPPED_LABEL;
        // lexLightingButtonConstant.SUB_INFO_TYPE_SCRAPPED_LABEL;
        // lexLightingButtonConstant.SUB_INFO_TYPE_SCRAPPED_LABEL;
    }
}
force-app/main/default/classes/lexLightingButtonConstantTest.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>58.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/classes/lexLostCancelReportController.cls
@@ -17,7 +17,6 @@
            res.cntLostCancelDraft = opp.Cnt_Lost_cancel_Draft__c;
            res.cntLostCancelReport = opp.Cnt_Lost_cancel_report__c;
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
        }
        return res;
    }
@@ -36,7 +35,6 @@
            res.lostType = report.LostType__c;
            res.reportStatus = report.Report_Status__c;
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
        }
        return res;
    }
@@ -54,21 +52,10 @@
            return null;
        } catch (Exception e) {
            Database.rollback(sp);
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                return newStr;
            }else {
                return e.getMessage();
            return e.getDmlMessage(0);
            }
        }
    }
    class InitData {
    public class InitData {
        @AuraEnabled
        public Decimal cntLostCancelReport;
        @AuraEnabled
force-app/main/default/classes/lexLostCancelReportController.cls-meta.xml
force-app/main/default/classes/lexLostCancelReportControllerTest.cls
New file
@@ -0,0 +1,100 @@
@isTest
private class lexLostCancelReportControllerTest {
    static testMethod void test1(){
        // recode type を取得
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院'];
        if (rectCo.size() == 0) {
            throw new ControllerUtil.myException('not found 病院 recodetype');
        }
        List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '戦略科室分類 呼吸科'];
        if (rectSct.size() == 0) {
            throw new ControllerUtil.myException('not found 戦略科室分類 recodetype');
        }
        List<RecordType> rectDpt = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Account' and Name IN ('診療科 消化科', '診療科 呼吸科') order by Name desc];
        if (rectDpt.size() == 0) {
            throw new ControllerUtil.myException('not found 診療科 recodetype');
        }
        List<RecordType> rectLost = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Lost_cancel_report__c' and DeveloperName IN ('PCL_Lost_report', 'PCL_Cancel_report') order by DeveloperName desc];
        if (rectLost.size() == 0) {
            throw new ControllerUtil.myException('not found Lost_cancel_report recodetype');
        }
        // insert
        Account company1 = new Account();
        Account company2 = new Account();
        company1.RecordTypeId = rectCo[0].Id;
        company1.Name = '病院テスト1';
        company2.RecordTypeId = rectCo[0].Id;
        company2.Name = '病院テスト2';
        insert new Account[] {company1, company2};
        List<Account> dc1s = [Select Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c from Account where Parent.Id = :company1.Id order by Department_Class_Label__c];
        List<Account> dc2s = [Select Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c from Account where Parent.Id = :company2.Id order by Department_Class_Label__c];
        Account depart1 = new Account();
        depart1.RecordTypeId = rectDpt[0].Id;
        depart1.Name         = '*';
        depart1.Department_Name__c  = '診療科1';
        depart1.ParentId            = dc1s[0].Id;
        depart1.Department_Class__c = dc1s[0].Id;
        depart1.Hospital__c         = company1.Id;
        Account depart2 = new Account();
        depart2.RecordTypeId = rectDpt[1].Id;
        depart2.Name         = '*';
        depart2.Department_Name__c  = '診療科2';
        depart2.ParentId            = dc2s[1].Id;
        depart2.Department_Class__c = dc2s[1].Id;
        depart2.Hospital__c         = company2.Id;
        insert new Account[] {depart1, depart2};
        // まずひとつ追加
        List<Product2> prdList = new List<Product2>();
        Product2 prd1 = new Product2();
        prd1.ProductCode_Ext__c     = 'HistoryPrd1';
        prd1.ProductCode            = 'HistoryPrd1';
        prd1.Repair_Product_Code__c = 'HistoryPrd1_RP';
        prd1.Name                   = 'HistoryPrd1';
        prd1.Manual_Entry__c        = true;
        Product2 prd2 = new Product2();
        prd2.ProductCode_Ext__c     = 'HistoryPrd2';
        prd2.ProductCode            = 'HistoryPrd2';
        prd2.Repair_Product_Code__c = 'HistoryPrd2_RP';
        prd2.Name                   = 'HistoryPrd2';
        prd2.Manual_Entry__c        = true;
        insert new Product2[] {prd1, prd2};
        // 商談
        Opportunity opp1 = new Opportunity(Name='aiueo', StageName='contact', CloseDate=Date.today(),
            Hospital__c = company1.Id,
            Department_Class__c = dc1s[0].Id,
            AccountId = depart1.Id
        );
        Opportunity opp2 = new Opportunity(Name='aiueo', StageName='contact', CloseDate=Date.today(),
            Hospital__c = company2.Id,
            Department_Class__c = dc2s[0].Id,
            AccountId = depart2.Id
        );
        insert new Opportunity[] {opp1, opp2};
        // 失单
        Lost_cancel_report__c lcr1 = new Lost_cancel_report__c(
            Opportunity__c = opp1.Id,
            CompetitorProduct1__c = prd1.Id,
            CompetitorProduct2__c = prd2.Id,
            RecordTypeId = rectLost[0].Id
        );
        // 取消
        Lost_cancel_report__c lcr2 = new Lost_cancel_report__c(
            Opportunity__c = opp2.Id,
            RecordTypeId = rectLost[1].Id
        );
        insert new Lost_cancel_report__c[] {lcr1, lcr2};
        Test.startTest();
        lexLostCancelReportController.initForEditCancelReport(lcr2.Id);
        lexLostCancelReportController.initSubmitReportButton(lcr2.Id);
        lexLostCancelReportController.updateSubmitReportButton(lcr2.Id);
        Test.stopTest();
    }
}
force-app/main/default/classes/lexLostCancelReportControllerTest.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>58.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/classes/lexOpportunitySpecialApplyController.cls
@@ -27,18 +27,7 @@
        update opp;
        return '';
    } catch (Exception e) {
        if (e.getMessage().contains(',')) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
            String exc = '' + e.getMessage();
            Integer left = exc.indexOf(':') + 1;
            Integer right = exc.lastIndexOf(':');
            String str = exc.substring(left,right);
            left = str.indexOf(',') +  1;
            String newStr = str.substring(left);
            return newStr;
        }else {
            return e.getMessage();
        }
        return e.getDmlMessage(0);
    }
   } 
    public class InitData{
force-app/main/default/classes/lexPCLLostReportLwcController.cls
@@ -1,6 +1,6 @@
public with sharing class lexPCLLostReportLwcController {
    public static Product2 pro2 { get; set; }
    public static string oppId { get; set; }
@@ -19,16 +19,10 @@
    public static integer brandNo {get; set;}
    public static integer RemoveBrandNo {get; set;}
    public static integer setBrandNo {get; set;}
    public static integer brandCount {get; set;}
    // add tcm 20211122 start
    public static integer topNum {get; set;}
    public static integer secondNum {get; set;}
    // add tcm 20211122 end
    @AuraEnabled(cacheable=true)
@@ -105,7 +99,7 @@
            submitFlag = submitFlag1;
            return init1();
        } catch (Exception e) {
            return e.getMessage();
            return new Map<string,object>();
        }
    }
    // 初始化
@@ -211,6 +205,7 @@
                Lost_reason_main__c,Lost_Reason_Sub__c,Name,Agency__c, AgencyMannual__c,
                Lost_cancel_report__c,Lost_By_Company_Mannual__c,ChannelSpecificReasons__c,
                ( select id,PCLLostBrand__c,LostProduct__c,
                isSpec__c,
                LostProduct__r.Name,
                  LostProductMannual__c,            //SWAG-C6P9PX lt 20210913 add
                  ProductCategory__c,
@@ -382,7 +377,7 @@
            }
            
        } catch (Exception e) {
            return e.getMessage();
            return e.getDmlMessage(0);
        }
    }
    // 数据录入
@@ -393,7 +388,7 @@
        Map<String,String> messageMap = new Map <String,String>();
        system.debug('save---start:');
        Savepoint sp = Database.setSavepoint();
        try{
            // 待完成,这里需要把第一个品牌的信息赋值到这个失单报告上去,还有需要把各个品牌金额汇总加起来;
            //system.debug('LostReport.LostBrands:'+LostReport.LostBrands);
            // 设置记录类型
@@ -562,28 +557,9 @@
            // lostReportId = report.lostReport.id;
            system.debug('save---end:');
            messageMap.put('LostReport',JSON.serialize(report));
        }catch (Exception e) {
            Database.rollback(sp);
            // 这里需要写一些报错信息
            // if (e.getMessage().contains(',')) {
            //     System.debug(LoggingLevel.INFO, '*** e: ' + e);
            //     String exc = '' + e.getMessage();
            //     Integer left = exc.indexOf(':') + 1;
            //     Integer right = exc.lastIndexOf(':');
            //     String str = exc.substring(left,right);
            //     left = str.indexOf(',') +  1;
            //     String newStr = str.substring(left);
            //     messageMap.put('error', ''+ newStr);
            // }else {
            //     messageMap.put('error', ''+ e.getMessage());
            // }
            messageMap.put('error', ''+ e.getMessage());
            return messageMap;
        }
        return messageMap;
    }
    
    // 提交
    @AuraEnabled
@@ -634,18 +610,7 @@
            return objs;
        }catch(exception e) {
            Database.rollback(sp);
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                objs.put('error', ''+ newStr);
            }else {
                objs.put('error', ''+ e.getMessage());
            }
            objs.put('error',e.getDmlMessage(0));
            return objs;
        }
    }
@@ -775,7 +740,7 @@
            , ProductCategory__c 
            from Product2 where Id =:lostProduct];
        } catch (Exception e) {
            return e.getMessage();
            return e.getDmlMessage(0);
        }
        return JSON.serialize(prd);
    }
@@ -799,7 +764,7 @@
            Approval.ProcessResult result = Approval.process(req);
            return null; 
        } catch (Exception e) {
            return e.getMessage();
            return e.getDmlMessage(0);
        }
        
    }
@@ -811,7 +776,7 @@
            ApprovalHistoryUtil.reassignStep(workItemList, newActorId);
            return null;
        } catch (Exception e) {
            return e.getMessage();
            return e.getDmlMessage(0);
        }
        
    }
force-app/main/default/classes/lexPCLLostReportLwcControllerTest.cls
@@ -26,14 +26,43 @@
        lexPCLLostReportLwcController.searchBatchIfForProduct('');
        lexPCLLostReportLwcController.getNewLostBrand(0);
        lexPCLLostReportLwcController.getNewLostProduct(0);
        Test.stopTest();
    }
    static testMethod void testSave(){
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
        if (rectCo.size() == 0) {
            return;
        }
        Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
        insert myAccount2;
        // Lost_cancel_report__c report = [select Id from Lost_cancel_report__c where LostType__c = '失单'];
        Account depart1 = [select Id from Account limit 1];
        LostReport conTest2 = new LostReport();
        conTest2.lostReport.LostType__c = '失单';
        conTest2.lostReport.Opportunity__c = [select Id from Opportunity limit 1].Id;
        conTest2.LostBrands[0].lostBrand.LostPrice__c = 12;
        conTest2.LostBrands[0].lostBrand.Lost_reason_main__c = '价格';
        conTest2.LostBrands[0].LostProducts[0].LostProductss.Quantity__c =3;
        conTest2.LostBrands[0].lostBrand.Agency__c = myAccount2.Id;
        conTest2.LostBrands[0].lostBrand.Lost_By_Company__c = '其他';
        conTest2.LostBrands[0].lostBrand.Lost_By_Company_Mannual__c = 'dddddd';
        conTest2.LostBrands[0].LostProducts[0].lineNo2 = 0;
        conTest2.LostBrands[0].LostProducts[0].LostProductss = new PCLLostProduct__c(Quantity__c = 3);
        Test.startTest();
        Map<String,String> maps =  lexPCLLostReportLwcController.dataEntry(JSON.serialize(conTest2),new List<Id>(),new List<Id>());
        lexPCLLostReportLwcController.searchProduct(conTest2.LostBrands[0].LostProducts[0].LostProductss.Id);
        System.debug('chenjingwu=>'+ maps.get('error'));
        Test.stopTest();
    }
    static testMethod void testSubmit(){
        Lost_cancel_report__c report = [select Id from Lost_cancel_report__c where LostType__c = '失单' limit 1];
        Account depart1 = [select Id from Account where RecordTypeId = '01210000000QemG' limit 1];
        LostReport conTest2 = new LostReport();
        conTest2.lostReport.LostType__c = '失单';
        conTest2.lostReport.Opportunity__c = [select Id from Opportunity limit 1].Id;
        conTest2.LostBrands[0].lostBrand.LostPrice__c = 12;
        conTest2.LostBrands[0].lostBrand.Lost_reason_main__c = '价格';
        conTest2.LostBrands[0].LostProducts[0].LostProductss.Quantity__c =3;
@@ -44,7 +73,119 @@
        conTest2.LostBrands[0].LostProducts[0].LostProductss = new PCLLostProduct__c(Quantity__c = 3);
        Test.startTest();
        lexPCLLostReportLwcController.dataEntry(JSON.serialize(conTest2),new List<Id>(),new List<Id>());
        lexPCLLostReportLwcController.submit('草案',false,report.Id);
        Test.stopTest();
    }
    static testMethod void TestSubmitForApproval2(){
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
        if (rectCo.size() == 0) {
            return;
        }
        Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
        insert myAccount2;
        // Lost_cancel_report__c report = [select Id from Lost_cancel_report__c where LostType__c = '失单'];
        Account depart1 = [select Id from Account limit 1];
        LostReport conTest2 = new LostReport();
        conTest2.lostReport.LostType__c = '失单';
        conTest2.lostReport.Opportunity__c = [select Id from Opportunity limit 1].Id;
        conTest2.LostBrands[0].lostBrand.LostPrice__c = 12;
        conTest2.LostBrands[0].lostBrand.Lost_reason_main__c = '价格';
        conTest2.LostBrands[0].LostProducts[0].LostProductss.Quantity__c =3;
        conTest2.LostBrands[0].lostBrand.Agency__c = myAccount2.Id;
        conTest2.LostBrands[0].lostBrand.Lost_By_Company__c = '其他';
        conTest2.LostBrands[0].lostBrand.Lost_By_Company_Mannual__c = 'dddddd';
        conTest2.LostBrands[0].LostProducts[0].lineNo2 = 0;
        conTest2.LostBrands[0].LostProducts[0].LostProductss = new PCLLostProduct__c(Quantity__c = 3);
        Test.startTest();
        Map<String,String> maps =  lexPCLLostReportLwcController.dataEntry(JSON.serialize(conTest2),new List<Id>(),new List<Id>());
        lexPCLLostReportLwcController.submit('草案',false,conTest2.lostReport.Id);
        lexPCLLostReportLwcController.submitForApproval(conTest2.lostReport.Id,'','Approve');
        lexPCLLostReportLwcController.submitForApproval(conTest2.lostReport.Id,'','Removed');
        Test.stopTest();
    }
    static testMethod void TestSubmitForApproval1(){
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
        if (rectCo.size() == 0) {
            return;
        }
        Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
        insert myAccount2;
        // Lost_cancel_report__c report = [select Id from Lost_cancel_report__c where LostType__c = '失单'];
        Account depart1 = [select Id from Account limit 1];
        LostReport conTest2 = new LostReport();
        conTest2.lostReport.LostType__c = '失单';
        conTest2.lostReport.Opportunity__c = [select Id from Opportunity limit 1].Id;
        conTest2.LostBrands[0].lostBrand.LostPrice__c = 12;
        conTest2.LostBrands[0].lostBrand.Lost_reason_main__c = '价格';
        conTest2.LostBrands[0].LostProducts[0].LostProductss.Quantity__c =3;
        conTest2.LostBrands[0].lostBrand.Agency__c = myAccount2.Id;
        conTest2.LostBrands[0].lostBrand.Lost_By_Company__c = '其他';
        conTest2.LostBrands[0].lostBrand.Lost_By_Company_Mannual__c = 'dddddd';
        conTest2.LostBrands[0].LostProducts[0].lineNo2 = 0;
        conTest2.LostBrands[0].LostProducts[0].LostProductss = new PCLLostProduct__c(Quantity__c = 3);
        Test.startTest();
        Map<String,String> maps =  lexPCLLostReportLwcController.dataEntry(JSON.serialize(conTest2),new List<Id>(),new List<Id>());
        lexPCLLostReportLwcController.submit('草案',false,conTest2.lostReport.Id);
        lexPCLLostReportLwcController.submitForApproval(conTest2.lostReport.Id,'','Reject');
        Test.stopTest();
    }
    static testMethod void TestSubmitForApproval3(){
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
        if (rectCo.size() == 0) {
            return;
        }
        Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
        insert myAccount2;
        // Lost_cancel_report__c report = [select Id from Lost_cancel_report__c where LostType__c = '失单'];
        Account depart1 = [select Id from Account limit 1];
        LostReport conTest2 = new LostReport();
        conTest2.lostReport.LostType__c = '失单';
        conTest2.lostReport.Opportunity__c = [select Id from Opportunity limit 1].Id;
        conTest2.LostBrands[0].lostBrand.LostPrice__c = 12;
        conTest2.LostBrands[0].lostBrand.Lost_reason_main__c = '价格';
        conTest2.LostBrands[0].LostProducts[0].LostProductss.Quantity__c =3;
        conTest2.LostBrands[0].lostBrand.Agency__c = myAccount2.Id;
        conTest2.LostBrands[0].lostBrand.Lost_By_Company__c = '其他';
        conTest2.LostBrands[0].lostBrand.Lost_By_Company_Mannual__c = 'dddddd';
        conTest2.LostBrands[0].LostProducts[0].lineNo2 = 0;
        conTest2.LostBrands[0].LostProducts[0].LostProductss = new PCLLostProduct__c(Quantity__c = 3);
        Test.startTest();
        Map<String,String> maps =  lexPCLLostReportLwcController.dataEntry(JSON.serialize(conTest2),new List<Id>(),new List<Id>());
        lexPCLLostReportLwcController.submit('草案',false,conTest2.lostReport.Id);
        lexPCLLostReportLwcController.reassignStep(conTest2.lostReport.Id,UserInfo.getUserId());
        Test.stopTest();
    }
    static testMethod void TestSubmitForApproval4(){
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
        if (rectCo.size() == 0) {
            return;
        }
        Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
        insert myAccount2;
        // Lost_cancel_report__c report = [select Id from Lost_cancel_report__c where LostType__c = '失单'];
        Account depart1 = [select Id from Account limit 1];
        LostReport conTest2 = new LostReport();
        conTest2.lostReport.LostType__c = '失单';
        conTest2.lostReport.Opportunity__c = [select Id from Opportunity limit 1].Id;
        conTest2.LostBrands[0].lostBrand.LostPrice__c = 12;
        conTest2.LostBrands[0].lostBrand.Lost_reason_main__c = '价格';
        conTest2.LostBrands[0].LostProducts[0].LostProductss.Quantity__c =3;
        conTest2.LostBrands[0].lostBrand.Agency__c = myAccount2.Id;
        conTest2.LostBrands[0].lostBrand.Lost_By_Company__c = '其他';
        conTest2.LostBrands[0].lostBrand.Lost_By_Company_Mannual__c = 'dddddd';
        conTest2.LostBrands[0].LostProducts[0].lineNo2 = 0;
        conTest2.LostBrands[0].LostProducts[0].LostProductss = new PCLLostProduct__c(Quantity__c = 3);
        Test.startTest();
        Map<String,String> maps =  lexPCLLostReportLwcController.dataEntry(JSON.serialize(conTest2),new List<Id>(),new List<Id>());
        lexPCLLostReportLwcController.submit('草案',false,conTest2.lostReport.Id);
        lexPCLLostReportLwcController.init('','' + conTest2.lostReport.Id,'View','','');
        Test.stopTest();
    }
force-app/main/default/classes/lexSolutionProgrammeController.cls
@@ -36,14 +36,7 @@
            update so;
            return '';
        } catch (Exception e) {
            if(e.getMessage().contains(':')){
                String eMsg = e.getMessage();
                Integer left = eMsg.indexOf(',')+1;
                Integer right = eMsg.lastindexOf('。')+1;
                return eMsg.substring(left,right);
            }else{
                return e.getMessage();
            }
            return e.getDmlMessage(0);
        }
    }
    //提交审批
@@ -58,14 +51,7 @@
        }
        catch (Exception e) {
            Database.rollback(sp);
            if(e.getMessage().contains(':')){
                String eMsg = e.getMessage();
                Integer left = eMsg.indexOf(',')+1;
                Integer right = eMsg.lastindexOf('。')+1;
                return eMsg.substring(left,right);
            }else{
                return e.getMessage();
            }
            return e.getDmlMessage(0);
        }
    }
    public class InitData{
force-app/main/default/classes/lexSolutionProjectRequirementsController.cls
@@ -22,7 +22,7 @@
            res.userName = [select Name from User where Id =: res.userId].Name;
            maps.put('res', res);
        } catch (Exception e) {
            String message = e.getMessage();
            String message = e.getDmlMessage(0);
            maps.put('error', message);
            return maps;
        }
@@ -76,14 +76,7 @@
            update so;
            return '';
        } catch (Exception e) {
            if (e.getMessage().contains(':')) {
                String eMessage = e.getMessage();
                Integer left = eMessage.indexOf(',') + 1;
                Integer right = eMessage.lastIndexOf('。') + 1;
                return eMessage.substring(left,right);
            }else {
                return e.getMessage();
            }
            return e.getDmlMessage(0);
        }
    }
    @AuraEnabled
@@ -95,14 +88,7 @@
            update so;
            return '';
        } catch (Exception e) {
            if (e.getMessage().contains(',')) {
                String eMessage = e.getMessage();
                Integer left = eMessage.indexOf(',');
                Integer right = eMessage.length();
                return eMessage.substring(left + 1,right);
            }else {
                return e.getMessage();
            }
            return e.getDmlMessage(0);
        }
    }
force-app/main/default/lwc/activeContent/activeContent.css
New file
@@ -0,0 +1,76 @@
.activityTable1 {
    background-color: #E6E6FA;
    border-collapse: separate;
    border-spacing: 0 5px; /* 调整第二个值来控制行之间的间隔大小 */
}
.activityTable1 th {
    font-weight: bold;
    text-align: right;
    vertical-align: middle;
}
.activityTable2 {
    background-color: rgb(220, 220, 220);
    border-collapse: separate;
    border-spacing: 0 5px; /* 调整第二个值来控制行之间的间隔大小 */
}
.activityTable2 th {
    font-weight: bold;
    text-align: right;
    vertical-align: middle;
}
.activityTable3 {
    background-color: rgb(199, 255, 183);
    border-collapse: separate;
    border-spacing: 0 5px; /* 调整第二个值来控制行之间的间隔大小 */
}
.activityTable3 th {
    font-weight: bold;
    text-align: right;
    vertical-align: middle;
}
.activityTable4 {
    /* width: 90%; */
    background-color: rgb(199, 255, 183);
    border-collapse: separate;
    border-spacing: 0 5px; /* 调整第二个值来控制行之间的间隔大小 */
}
.activityTable4 th {
    font-weight: bold;
    text-align: right;
    vertical-align: middle;
}
.centered-text {
    display: flex;
    justify-content: center;
    align-items: center;
}
.centerRight-text {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}
.required-symbol {
    color: red;
    font-size: 12px;
    font-weight: bold;
    display: inline-block;
    width: 7px;
    /* margin-right: 4px; */
}
/* :host::shadow lightning-input input {
    padding-left: 12px;
    padding-right: 12px;
} */
.container {
    position: relative;
}
.mask {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.5);
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}
force-app/main/default/lwc/activeContent/activeContent.html
New file
@@ -0,0 +1,657 @@
<template>
    <div class="container">
        <!-- <template if:true={showSpinner}>
            <div class="overlay">
                <lightning-spinner alternative-text="Loading" size="large"></lightning-spinner>
            </div>
        </template> -->
        <slot name="content">
            <lightning-record-edit-form object-api-name="Event__c">
                <lightning-layout>
                    <lightning-layout-item size="3" padding="around-small" >
                        <lightning-button label="保存" onclick={saveTheActivity} disabled={saveDis}></lightning-button>
                    </lightning-layout-item>
                    <lightning-layout-item size="9" padding="around-small" >
                        <div style="background-color: red;color:white">
                            <template if:true={timeValid}>{timeValid}<br/></template>
                            <template if:true={eventMessage}>{eventMessage}<br/></template>
                            <template if:true={etAPPerrorMsg}>{etAPPerrorMsg}<br/></template>
                        </div>
                    </lightning-layout-item>
                </lightning-layout>
                <div style="width: 100%;padding-left: 10px;padding-top: 10px;">
                    <table class="activityTable1">
                        <thead>
                            <tr>
                                <th width="10%"></th>
                                <th width="13%"></th>
                                <th width="13%"></th>
                                <th width="13%"></th>
                                <th width="13%"></th>
                                <th width="12%"></th>
                                <th width="13%"></th>
                                <th width="13%"></th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <th colspan="1">工作时间<div class="required-symbol">*</div>&nbsp;</th>
                                <td colspan="2">
                                    <div style="width: 100%;">
                                        <lightning-layout>
                                            <lightning-layout-item size="2">
                                                <lightning-input style="text-align: center;" disabled={beforeHourDis} required="true" name="beforeHour" value={beforeHour} type="number" maxlength="2" variant="label-hidden" onchange={beforeHourChange}></lightning-input>
                                            </lightning-layout-item>
                                            <lightning-layout-item size="1" class="centered-text">&nbsp;<b>:</b>&nbsp;</lightning-layout-item>
                                            <template lwc:if={isNotSalesService}>
                                                <lightning-layout-item size="2"><lightning-input disabled={beforeMinuteDis}  name="beforeMinute" value={beforeMinute} type="number" maxlength="2" variant="label-hidden" onchange={beforeMinuteChange}></lightning-input></lightning-layout-item>
                                            </template>
                                            <template lwc:else>
                                                <lightning-layout-item size="2"><lightning-input disabled={beforeMinuteDis} required="true" name="beforeMinute" value={beforeMinute} type="number" maxlength="2" variant="label-hidden" onchange={beforeMinuteChange}></lightning-input></lightning-layout-item>
                                            </template>
                                            <lightning-layout-item size="1" class="centered-text">&nbsp;<b>~</b>&nbsp;</lightning-layout-item>
                                            <lightning-layout-item size="2"><lightning-input disabled={afterHourDis} required="true" name="afterHour" value={afterHour} type="number" variant="label-hidden" maxlength="2" onchange={afterHourChange}></lightning-input></lightning-layout-item>
                                            <lightning-layout-item size="1" class="centered-text">&nbsp;<b>:</b>&nbsp;</lightning-layout-item>
                                            <template lwc:if={isNotSalesService}>
                                                 <lightning-layout-item size="2"><lightning-input disabled={afterMinuteDis}  name="afterMinute" value={afterMinute} type="number" variant="label-hidden" onchange={afterMinuteChange}></lightning-input></lightning-layout-item>
                                            </template>
                                            <template lwc:else>
                                                 <lightning-layout-item size="2"><lightning-input disabled={afterMinuteDis} required="true" name="afterMinute" value={afterMinute} type="number" variant="label-hidden" onchange={afterMinuteChange}></lightning-input></lightning-layout-item>
                                            </template>
                                        </lightning-layout>
                                    </div>
                                </td>
                                <td colspan="1">
                                    <div style="width:100%;display: flex;align-items: center;">
                                        <span style="font-weight: bold;text-align: right;vertical-align: middle;width:79px;">
                                                拜访区分<div class="required-symbol">*</div>&nbsp;
                                        </span>
                                        <span style="width: 153px;">
                                            <lightning-input-field disabled={visitDis} onchange={visitChange}  required="true" field-name="Activity_Type2__c" value={activityObj.Activity_Type2__c} variant="label-hidden"></lightning-input-field>
                                            <!--  <lightning-input-field disabled={visitDis} onchange={visitChange}  required="true" field-name="Activity_Type2__c" value={activityObj.Activity_Type2__c} variant="label-hidden"></lightning-input-field> -->
                                                <p style="color: rgb(255, 0, 0);">{visitValidMes}</p>
                                        </span>
                                        <span style="font-weight: bold;text-align: right;vertical-align: middle;width:79px;">
                                            访问场所&nbsp;&nbsp;&nbsp;
                                        </span>
                                    </div>
                                </td>
                                <td colspan="8">
                                        <c-other-look-up disabled={isAccDis} unique-key="AccountID" value-id={activityObj.whatid__c} obj-name={visitorPalceObjName}
                                         icon-name="standard:account" search-label="" onvalueselect={handleAccSelection} fields={visitorPalceFields}></c-other-look-up>
                                    <!-- <template lwc:if={isAccessAcc}> -->
                                        <!-- <lightning-input-field field-name="Account_ID__c" disabled={isAccDis} value={activityObj.Account_ID__c} onchange={changeAccId} variant="label-hidden" ></lightning-input-field> -->
<!--                                     </template>
 -->                                    <!--  <template lwc:else>
                                       <c-other-look-up disabled={isAccDis} unique-key="AccountID" value-id={filter} obj-name={visitorPalceObjName}
                                        icon-name="standard:account" search-label="" onvalueselect={handleAccSelection} fields={visitorPalceFields}></c-other-look-up>
                                    </template> -->
                                   <!--  <template lwc:else>
                                        <lightning-input-field field-name="Campaign_ID__c" disabled={isAccDis} value={activityObj.Campaign_ID__c} onchange={changeCampaignId} variant="label-hidden" ></lightning-input-field>
                                    </template> -->
                                    <p style="color: rgb(255, 0, 0);">{requiredLocation}</p>
                                </td>
                            </tr>
                            <tr>
                                <th>访问对象<div class="required-symbol">*</div>&nbsp;</th>
                                <td colspan="5">
                                    <lightning-layout>
                                        <lightning-layout-item size="3">
                                            <c-look-up-util disabled={isConDis1} onnewrecord={handleNewRecord} pass-filter={filter} unique-key="AgencyContact1" value-id={activityObj.Visitor1_ID__c} agency-contact-name={agencyContactName} obj-name={objectName} icon-name="standard:account" static-resource-contact = {staticResourceContact} search-label="" onvalueselect={handleSelection} fields={fields}></c-look-up-util>
                                            <p style="color: rgb(255, 0, 0);">{requiredVisitor}</p>
                                        </lightning-layout-item>
                                        <lightning-layout-item size="1"></lightning-layout-item>
                                        <lightning-layout-item size="3">
                                            <c-look-up-util disabled={isConDis2} onnewrecord={handleNewRecord} pass-filter={filter}  unique-key="AgencyContact2" value-id={activityObj.Visitor2_ID__c} obj-name={objectName} icon-name="standard:account" search-label="" onvalueselect={handleSelection} fields={fields}></c-look-up-util>
                                        </lightning-layout-item>
                                        <lightning-layout-item size="1"></lightning-layout-item>
                                        <lightning-layout-item size="3">
                                            <c-look-up-util disabled={isConDis3} onnewrecord={handleNewRecord} pass-filter={filter}  unique-key="AgencyContact3" value-id={activityObj.Visitor3_ID__c} obj-name={objectName} icon-name="standard:account" search-label="" onvalueselect={handleSelection} fields={fields}></c-look-up-util>
                                        </lightning-layout-item>
                                    </lightning-layout>
                                </td>
                                <td colspan="2">
                                    <lightning-layout>
                                        <lightning-layout-item size="3" class="centerRight-text">
                                            <span style="font-weight: bold;">
                                                拜访目的<div class="required-symbol">*</div>&nbsp;
                                            </span>
                                        </lightning-layout-item>
                                        <lightning-layout-item size="9">
                                            <template lwc:if={isNotSalesService}>
                                                <lightning-input-field disabled={visitAimDis} required="true" onchange={visitAimChange} field-name="Activity_PurposeEscFSE__c" value={activityObj.Activity_PurposeEscFSE__c} variant="label-hidden"></lightning-input-field>
                                                <p style="color: rgb(255, 0, 0);">{requiredvisitAim}</p>
                                            </template>
                                            <template lwc:else>
                                                <lightning-input-field disabled={visitAimDis} required="true" onchange={visitAimChange} field-name="Activity_PurposeFSE__c" value={activityObj.Activity_PurposeFSE__c} variant="label-hidden"></lightning-input-field>
                                                <p style="color: rgb(255, 0, 0);">{requiredvisitAim}</p>
                                            </template>
                                        </lightning-layout-item>
                                    </lightning-layout>
                                </td>
                            </tr>
                            <tr>
                                <th>活动区分<div class="required-symbol">*</div>&nbsp;</th>
                                <td colspan="5">
                                    <template lwc:if={isNotSalesService}>
                                        <lightning-layout>
                                            <lightning-layout-item size="3">
                                                <lightning-input-field disabled={Purpose_TypeEscFSEDis} data-key='requiredPurposeType'  field-name="Purpose_TypeEscFSE__c" value={activityObj.Purpose_TypeEscFSE__c} onchange={purposeType1Change} variant="label-hidden" ></lightning-input-field>
                                                <p style="color: rgb(255, 0, 0);">{requiredPurposeType}</p>
                                            </lightning-layout-item>
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item size="3">
                                                <lightning-input-field disabled={Purpose_TypeEscFSE2Dis} field-name="Purpose_TypeEscFSE2__c" value={activityObj.Purpose_TypeEscFSE2__c} onchange={purposeType2Change} variant="label-hidden" ></lightning-input-field>
                                            </lightning-layout-item>
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item size="3">
                                                <lightning-input-field disabled={Purpose_TypeEscFSE3Dis} field-name="Purpose_TypeEscFSE3__c" value={activityObj.Purpose_TypeEscFSE3__c} onchange={purposeType3Change} variant="label-hidden" ></lightning-input-field>
                                            </lightning-layout-item>
                                        </lightning-layout>
                                    </template>
                                    <template lwc:else>
                                        <lightning-layout>
                                            <lightning-layout-item size="3">
                                                <lightning-input-field disabled={Purpose_TypeFSEDis} data-key='requiredPurposeType'  onchange={purposeType1Change} required="true" field-name="Purpose_TypeFSE__c" value={activityObj.Purpose_TypeFSE__c} variant="label-hidden" ></lightning-input-field>
                                                <p style="color: rgb(255, 0, 0);">{requiredPurposeType}</p>
                                            </lightning-layout-item>
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item size="3">
                                                <lightning-input-field disabled={Purpose_TypeFSE2Dis} onchange={purposeType2Change} field-name="Purpose_TypeFSE2__c" value={activityObj.Purpose_TypeFSE2__c} variant="label-hidden" ></lightning-input-field>
                                            </lightning-layout-item>
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item size="3">
                                                <lightning-input-field disabled={Purpose_TypeFSE3Dis} onchange={purposeType3Change} field-name="Purpose_TypeFSE3__c" value={activityObj.Purpose_TypeFSE3__c} variant="label-hidden" ></lightning-input-field>
                                            </lightning-layout-item>
                                        </lightning-layout>
                                    </template>
                                </td>
                                <template lwc:if={isNotSalesService}>
                                    <td>
                                        <lightning-layout>
                                            <lightning-layout-item size="6" class="centerRight-text">
                                                <span style="font-weight: bold;">
                                                    OPD计划&nbsp;&nbsp;&nbsp;
                                                </span>
                                            </lightning-layout-item>
                                            <lightning-layout-item size="6">
                                                <lightning-input-field field-name="OPDPlan_Flag__c" value={activityObj.OPDPlan_Flag__c} onchange={fieldChange} variant="label-hidden" disabled="true"></lightning-input-field>
                                            </lightning-layout-item>
                                        </lightning-layout>
                                    </td>
                                </template>
                                <td>&nbsp;</td>
                            </tr>
                            <template lwc:if={isNotSalesService}>
                                <tr>
                                    <th>基建项目&nbsp;&nbsp;&nbsp;</th>
                                    <td colspan="5">
                                        <lightning-layout>
                                            <lightning-layout-item size="3">
                                                <c-other-look-up disabled={isInfrastructureProjectDis1} unique-key="Infrastructure_Project1" value-id={Infrastructure_Project1}
                                                obj-name='InfrastructureProject'  visit-place-id={filter}
                                                icon-name="standard:account" search-label="" onvalueselect={handleInfrastructureProject1Selection} fields={infrastructureProjectFields}></c-other-look-up>
                                            </lightning-layout-item>
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item size="3">
                                                <c-other-look-up disabled={isInfrastructureProjectDis2} unique-key="Infrastructure_Project2" value-id={Infrastructure_Project2}
                                                obj-name='InfrastructureProject'  visit-place-id={filter}
                                                icon-name="standard:account" search-label="" onvalueselect={handleInfrastructureProject2Selection} fields={infrastructureProjectFields}></c-other-look-up>
                                            </lightning-layout-item>
                                        </lightning-layout>
                                    </td>
                                    <th colspan="2">&nbsp;</th>
                                </tr>
                                <tr>
                                    <th>涉及的询价&nbsp;&nbsp;&nbsp;</th>
                                    <td colspan="5">
                                        <lightning-layout>
                                            <lightning-layout-item size="3">
                                                <!-- <lightning-input-field disabled={isOppDis1} field-name="Related_Opportunity1_ID__c" value={activityObj.Related_Opportunity1_ID__c} onchange={fieldChange} variant="label-hidden" ></lightning-input-field> -->
                                                <c-other-look-up disabled={isOppDis1} unique-key="Related_Opportunity1_ID" value-id={Related_Opportunity1_ID}
                                                obj-name='Opportunity'  visit-place-id={filter}
                                                icon-name="standard:account" search-label="" onvalueselect={handleOppertunity1Selection} fields={opportunityFields}></c-other-look-up>
                                            </lightning-layout-item>
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item size="3">
                                                <c-other-look-up disabled={isOppDis2} unique-key="Related_Opportunity2_ID" value-id={Related_Opportunity2_ID}
                                                obj-name='Opportunity'  visit-place-id={filter}
                                                icon-name="standard:account" search-label="" onvalueselect={handleOppertunity2Selection} fields={opportunityFields}></c-other-look-up>
                                               <!--  <lightning-input-field disabled={isOppDis2} field-name="Related_Opportunity2_ID__c" value={activityObj.Related_Opportunity2_ID__c} onchange={fieldChange} variant="label-hidden" ></lightning-input-field> -->
                                            </lightning-layout-item>
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item size="3">
                                                 <c-other-look-up disabled={isOppDis3} unique-key="Related_Opportunity3_ID" value-id={Related_Opportunity3_ID}
                                                obj-name='Opportunity'  visit-place-id={filter}
                                                icon-name="standard:account" search-label="" onvalueselect={handleOppertunity3Selection} fields={opportunityFields}></c-other-look-up>
                                               <!--  <lightning-input-field disabled={isOppDis3} field-name="Related_Opportunity3_ID__c" value={activityObj.Related_Opportunity3_ID__c} onchange={fieldChange} variant="label-hidden" ></lightning-input-field> -->
                                            </lightning-layout-item>
                                        </lightning-layout>
                                    </td>
                                    <th colspan="2">&nbsp;</th>
                                </tr>
                                <tr>
                                    <th>&nbsp;</th>
                                    <td colspan="5">
                                        <lightning-layout>
                                            <lightning-layout-item size="3">
                                                <lightning-button-group style="padding-right: 7px;">
                                                    <lightning-button disabled={isOppUpdateDis1} label="询价更新" name='1' onclick={oppUpdate}></lightning-button>
                                                    <lightning-button disabled={isLoseDis1} label="失单" name='1' onclick={loseOpp}></lightning-button>
                                                </lightning-button-group>
                                            </lightning-layout-item>
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item size="3">
                                                <lightning-button-group style="padding-right: 7px;">
                                                    <lightning-button disabled={isOppUpdateDis2} label="询价更新" name='2' onclick={oppUpdate}></lightning-button>
                                                    <lightning-button disabled={isLoseDis2} label="失单" name='1' onclick={loseOpp}></lightning-button>
                                                </lightning-button-group>
                                            </lightning-layout-item>
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item size="3">
                                                <lightning-button-group style="padding-right: 7px;">
                                                    <lightning-button disabled={isOppUpdateDis3} label="询价更新" name='3' onclick={oppUpdate}></lightning-button>
                                                    <lightning-button disabled={isLoseDis3} label="失单" name='1' onclick={loseOpp}></lightning-button>
                                                </lightning-button-group>
                                            </lightning-layout-item>
                                        </lightning-layout>
                                    </td>
                                    <td colspan="2"></td>
                                </tr>
                            </template>
                            <template lwc:else>
                                <tr>
                                    <th >
                                        <div style="width:100%;display: flex;align-items: center;">
                                            <span style='width: 100%;'>涉及的维修合同&nbsp;&nbsp;</span>
                                        </div>
                                    </th>
                                     <td colspan="10">
                                        <lightning-layout>
                                            <lightning-layout-item size="4">
                                                <c-other-look-up disabled={isRelatedServiceDis} unique-key="Related_Service1_ID" value-id={Related_Service1_ID}
                                                obj-name='MaintenanceContract'  visit-place-id={filter}
                                                icon-name="standard:account" search-label="" onvalueselect={handleMCSelection} fields={mcFields}></c-other-look-up>
                                                <p style="color: rgb(255, 0, 0);">{requiredRelatedService}</p>
                                            </lightning-layout-item>
                                            <lightning-layout-item size="2">
                                                <div style='width: 100%;font-weight: bold;text-align: right;height: 32px;line-height:32px;'>合同报告书发放人&nbsp;&nbsp;</div>
                                            </lightning-layout-item>
                                            <lightning-layout-item size="2">
                                                 <lightning-input-field disabled={isReportContractDis} data-key='requiredReportContract' field-name="Report_Contract__c" value={activityObj.Report_Contract__c} onchange={fieldChange} variant="label-hidden" ></lightning-input-field>
                                                 <p style="color: rgb(255, 0, 0);">{requiredInfo.requiredReportContract}</p>
                                            </lightning-layout-item>
                                             <lightning-layout-item size="2">
                                                <div style="font-weight: bold;text-align: right;vertical-align: middle;height: 32px;line-height:32px;">合同报告书发放方式&nbsp;&nbsp;</div>
                                            </lightning-layout-item>
                                            <lightning-layout-item size="2">
                                                <lightning-input-field disabled={isReportContractTypeDis} data-key='requiredReportContractType' field-name="Report_Contract_Type__c" value={activityObj.Report_Contract_Type__c} onchange={fieldChange} variant="label-hidden" ></lightning-input-field>
                                                <p style="color: rgb(255, 0, 0);">{requiredInfo.requiredReportContractType}</p>
                                            </lightning-layout-item>
                                        </lightning-layout>
                                    </td>
                                   <!--
                                     <th > <div style="width:100%;display: flex;align-items: center;"><span style='width: 100%;'>涉及的维修合同&nbsp;&nbsp;</span></div></th>
                                   <td colspan="10">
                                        <div style="width:100%;display: flex;align-items: center;">
                                            <span style='width: 420px;'>
                                                 <c-other-look-up disabled={isRelatedServiceDis} unique-key="Related_Service1_ID" value-id={Related_Service1_ID}
                                                obj-name='MaintenanceContract'  visit-place-id={filter}
                                                icon-name="standard:account" search-label="" onvalueselect={handleMCSelection} fields={mcFields}></c-other-look-up>
                                                <p style="color: rgb(255, 0, 0);">{requiredRelatedService}</p>
                                            </span>
                                            <span style="font-weight: bold;text-align: right;vertical-align: middle;">合同报告书发放人&nbsp;&nbsp;</span>
                                            <span style='width:205px;'>
                                                <lightning-input-field disabled={isReportContractDis} data-key='requiredReportContract' field-name="Report_Contract__c" value={activityObj.Report_Contract__c} onchange={fieldChange} variant="label-hidden" ></lightning-input-field>
                                                <p style="color: rgb(255, 0, 0);">{requiredInfo.requiredReportContract}</p>
                                            </span>
                                            <span style="font-weight: bold;text-align: right;vertical-align: middle;width:130px;">合同报告书发放方式&nbsp;&nbsp;</span>
                                            <span style='width:205px;'>
                                             <lightning-input-field disabled={isReportContractTypeDis} data-key='requiredReportContractType' field-name="Report_Contract_Type__c" value={activityObj.Report_Contract_Type__c} onchange={fieldChange} variant="label-hidden" ></lightning-input-field>
                                                <p style="color: rgb(255, 0, 0);">{requiredInfo.requiredReportContractType}</p>
                                            </span>
                                        </div>
                                    </td>    -->
                                </tr>
                                <!-- <tr>
                                    <th>&nbsp;&nbsp;&nbsp;</th>
                                    <td>
                                        <lightning-layout>
                                            <lightning-layout-item size="2" class="centerRight-text">
                                                <lightning-input-field disabled={isUseReportDis} field-name="UseReport__c" value={activityObj.UseReport__c} onchange={fieldChange} variant="label-hidden" ></lightning-input-field>
                                            </lightning-layout-item>
                                            <lightning-layout-item size="10" class="centerRight-text">
                                                <lightning-button style="padding-left: 20px;" label="信息更新" disabled={isInfoUpdateDis} onclick={slaInfoPage}></lightning-button>
                                            </lightning-layout-item>
                                        </lightning-layout>
                                    </td>
                                    <td></td>
                                    <td colspan="5"></td>
                                </tr> -->
                            </template>
                        </tbody>
                    </table>
                    <table class="activityTable1">
                        <thead>
                            <tr>
                                <th width="10%"></th>
                                <th width="12%"></th>
                                <th width="12%"></th>
                                <th width="12%"></th>
                                <th width="12%"></th>
                                <th width="12%"></th>
                                <th width="11%"></th>
                                <th width="12%"></th>
                                <th width="2%"></th>
                                <th width="4%"></th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td></td>
                                <template lwc:if={isNotSalesService}>
                                    <td colspan="9">
                                        <div style="width:100%;display: flex">
                                            <template lwc:if={updateAccInfoColor}>
                                                <span style="padding-right: 15px;">
                                            <lightning-button variant="destructive-text" disabled={isupdateAccInfoDis} label="更新客户信息" onclick={updateAccInfo}></lightning-button>
                                                </span>
                                            </template>
                                            <template lwc:else>
                                                 <span style="padding-right: 15px;">
                                                    <lightning-button disabled={isupdateAccInfoDis} label="更新客户信息" onclick={updateAccInfo}></lightning-button>
                                                </span>
                                            </template>
                                            <span style="padding-right: 15px;">
                                                <lightning-button disabled={isNewBuyDis} label="新建购买意向" onclick={addLeadNew}></lightning-button>
                                            </span>
                                            <span style="padding-right: 15px;">
                                                <lightning-button disabled={isNewOpdDis} label="新建OPD计划"  onclick={newOPDPlan}></lightning-button>
                                            </span>
                                            <template lwc:if={activityObj.SIS_FLAG__c}>
                                            <span style="padding-right: 25px;">
                                                 <lightning-button disabled={isOPDSISDis} label="OPD" variant="destructive-text" onclick={OPD}></lightning-button >
                                            </span>
                                            </template>
                                            <template lwc:else>
                                                 <span style="padding-right: 25px;">
                                                <lightning-button disabled={isOPDSISDis} label="OPD" onclick={OPD}></lightning-button>
                                                  </span>
                                            </template>
                                           <!--  <span style="padding-right: 15px;">
                                                <lightning-button disabled={isOPDSISDis} label="OPD" onclick={OPD}></lightning-button>
                                            </span> -->
                                            <template lwc:if={activityObj.SIS_ET_FLAG__c}>
                                            <span style="padding-right: 25px;">
                                                 <lightning-button disabled={isOPDSISDis} label="SIS_ET" onclick={SISET} variant="destructive-text" ></lightning-button>
                                            </span>
                                            </template>
                                            <template lwc:else>
                                                 <span style="padding-right: 25px;">
                                               <lightning-button disabled={isOPDSISDis} label="SIS_ET" onclick={SISET}></lightning-button>
                                                  </span>
                                            </template>
                                            <!-- <span style="padding-right: 15px;">
                                                <lightning-button disabled={isOPDSISDis} label="SIS_ET" onclick={SISET}></lightning-button>
                                            </span> -->
                                            <template lwc:if={activityObj.SIS_ENG_FLAG__c}>
                                            <span style="padding-right: 25px;">
                                                <lightning-button disabled={isOPDSISDis} label="SIS_ENG" onclick={SISENG} variant="destructive-text"></lightning-button>
                                            </span>
                                            </template>
                                            <template lwc:else>
                                                 <span style="padding-right: 25px;">
                                               <lightning-button disabled={isOPDSISDis} label="SIS_ENG" onclick={SISENG}></lightning-button>
                                                  </span>
                                            </template>
                                           <!--  <span style="padding-right: 15px;">
                                                <lightning-button disabled={isOPDSISDis} label="SIS_ENG" onclick={SISENG}></lightning-button>
                                            </span> -->
                                            <span style="padding-right: 15px;">
                                                <lightning-button disabled={isTransferEtDis} label="转至ET APP" onclick={toETAPP}></lightning-button>
                                            </span>
                                            <span style="padding-right: 15px;">
                                                <lightning-button disabled={isActivityEtDis} label="ET APP活动" onclick={ETAPPAct}></lightning-button>
                                            </span>
                                        </div>
                                    </td>
                                </template>
                                <template lwc:else>
                                    <td colspan="9">
                                        <div style="width:100%;display: flex">
                                            <template lwc:if={updateAccInfoColor}>
                                                <span style="padding-right: 25px;">
                                            <lightning-button variant="destructive-text" disabled={isupdateAccInfoDis} label="更新客户信息" onclick={updateAccInfo}></lightning-button>
                                                </span>
                                            </template>
                                            <template lwc:else>
                                                 <span style="padding-right: 25px;">
                                                    <lightning-button disabled={isupdateAccInfoDis} label="更新客户信息" onclick={updateAccInfo}></lightning-button>
                                                </span>
                                            </template>
                                           <!--  <span style="padding-right: 25px;">
                                                <lightning-button disabled={isNewOpdDis} label="新建OPD计划" onclick={newOPDPlan}></lightning-button>
                                            </span> -->
                                            <template lwc:if={activityObj.InsReport_ID__c}>
                                            <span style="padding-right: 25px;">
                                                    <lightning-button disabled={isCheckReportDis} label="一般点检报告书" onclick={checkReport} variant="destructive-text"></lightning-button>
                                            </span>
                                            </template>
                                            <template lwc:else>
                                                 <span style="padding-right: 25px;">
                                                 <lightning-button disabled={isCheckReportDis} label="一般点检报告书" onclick={checkReport} ></lightning-button>
                                                  </span>
                                            </template>
                                            <template lwc:if={activityObj.NewInstallTarin_FLAG__c}>
                                            <span style="padding-right: 25px;">
                                                <lightning-button disabled={isNTCCDSDis} label="新品装机培训报告书"  onclick={NewInstallTarin} variant="destructive-text"></lightning-button>
                                            </span>
                                            </template>
                                            <template lwc:else>
                                                 <span style="padding-right: 25px;">
                                                 <lightning-button disabled={isNTCCDSDis} label="新品装机培训报告书"  onclick={NewInstallTarin}></lightning-button>
                                                  </span>
                                            </template>
                                           <!--  <span style="padding-right: 25px;">
                                                <lightning-button disabled={isNTCCDSDis} label="新品装机培训报告书"  onclick={NewInstallTarin}></lightning-button>
                                            </span> -->
                                            <template lwc:if={activityObj.FaultPreventionTraining_FLAG__c}>
                                            <span style="padding-right: 25px;">
                                                <lightning-button disabled={isNTCCDSDis} label="故障预防培训报告书"  onclick={FaultPreventionTraining} variant="destructive-text"></lightning-button>
                                            </span>
                                            </template>
                                            <template lwc:else>
                                                 <span style="padding-right: 25px;">
                                                 <lightning-button disabled={isNTCCDSDis} label="故障预防培训报告书"  onclick={FaultPreventionTraining}></lightning-button>
                                                  </span>
                                            </template>
                                           <!--  <span style="padding-right: 25px;">
                                                <lightning-button disabled={isNTCCDSDis} label="故障预防培训报告书"  onclick={FaultPreventionTraining}></lightning-button>
                                            </span> -->
                                            <template lwc:if={activityObj.OPD_FLAG__c}>
                                            <span style="padding-right: 25px;">
                                                <lightning-button disabled={isNTCCDSDis} label="售后服务跟台报告书"  onclick={AftermarketHeel} variant="destructive-text"></lightning-button>
                                            </span>
                                            </template>
                                            <template lwc:else>
                                                 <span style="padding-right: 25px;">
                                                 <lightning-button disabled={isNTCCDSDis} label="售后服务跟台报告书"  onclick={AftermarketHeel}></lightning-button>
                                                  </span>
                                            </template>
                                            <!-- <span style="padding-right: 25px;">
                                                <lightning-button disabled={isNTCCDSDis} label="售后服务跟台报告书"  onclick={AftermarketHeel}></lightning-button>
                                            </span> -->
                                        </div>
                                    </td>
                                </template>
                            </tr>
                            <tr>
                                <th>结果&nbsp;&nbsp;&nbsp;</th>
                                <td colspan="6">
                                    <lightning-input-field disabled={DescriptionDis} data-key='requiredDescription' field-name="Description__c" value={activityObj.Description__c} onchange={fieldChange} message-when-bad-input={customValidationMessage} variant="label-hidden" ></lightning-input-field>
                                    <p style="color: rgb(255, 0, 0);display: none;">{requiredInfo.requiredDescription}</p>
                                </td>
                                <td colspan="3">
                                    <template lwc:if={isNotSalesService}>
                                        <lightning-layout>
                                        </lightning-layout>
                                    </template>
                                    <template lwc:else>
                                        <lightning-layout>
                                            <lightning-layout-item size="2"></lightning-layout-item>
                                            <lightning-layout-item size="1">
                                                <lightning-input-field disabled={Find_Imitations_FlagDis} field-name="Find_Imitations_Flag__c" value={activityObj.Find_Imitations_Flag__c} onchange={fieldChange} variant="label-hidden" ></lightning-input-field>
                                            </lightning-layout-item>
                                            <lightning-layout-item size="9">
                                                是否发现第三方维修&nbsp;
                                            </lightning-layout-item>
                                        </lightning-layout>
                                    </template>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <!-- <div style="width: 100%;padding-left: 10px;padding-top: 10px;">
                    <table class="activityTable3">
                        <thead>
                            <tr>
                                <th width="10%"></th>
                                <th width="5%"></th>
                                <th width="10%"></th>
                                <th width="5%"></th>
                                <th width="15%"></th>
                                <th width="55%"></th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <th>下一步活动予定&nbsp;</th>
                                <th>访问日期&nbsp;</th>
                                <td><lightning-input type="Date" variant="label-hidden"></lightning-input></td>
                                <th>访问时间&nbsp;</th>
                                <td>
                                    <lightning-layout>
                                        <lightning-layout-item size="2"><lightning-input variant="label-hidden"></lightning-input></lightning-layout-item>
                                        <lightning-layout-item size="1" class="centered-text"><b>:</b></lightning-layout-item>
                                        <lightning-layout-item size="2"><lightning-input variant="label-hidden"></lightning-input></lightning-layout-item>
                                        <lightning-layout-item size="1" class="centered-text"><b>~</b></lightning-layout-item>
                                        <lightning-layout-item size="2"><lightning-input variant="label-hidden"></lightning-input></lightning-layout-item>
                                        <lightning-layout-item size="1" class="centered-text"><b>:</b></lightning-layout-item>
                                        <lightning-layout-item size="2"><lightning-input variant="label-hidden"></lightning-input></lightning-layout-item>
                                        <lightning-layout-item size="1"></lightning-layout-item>
                                    </lightning-layout>
                                </td>
                            </tr>
                            <tr>
                                <th>&nbsp;</th>
                                <th>目的(计划)&nbsp;</th>
                                <td colspan="4"><lightning-input variant="label-hidden"></lightning-input></td>
                            </tr>
                        </tbody>
                    </table>
                </div> -->
                <div style="width: 100%;padding-left: 10px;padding-top: 10px;padding-bottom: 10px;">
                    <table class="activityTable4">
                        <thead>
                            <tr>
                                <th width="10%"></th>
                                <th width="19%"></th>
                                <th width="7%"></th>
                                <th width="15%"></th>
                                <th width="18%"></th>
                                <th width="9%"></th>
                                <th width="12%"></th>
                                <th width="8%"></th>
                                <th width="2%"></th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <th>报告状态:</th>
                                <td>{activityObj.eventStatus__c}</td>
                                <th>取消理由:&nbsp;</th>
                                <td colspan="2">
                                    <template lwc:if={isNotSalesService}>
                                        <lightning-input-field disabled={cancelReasonSelectDis} field-name="cancelReasonSelect__c" value={activityObj.cancelReasonSelect__c} onchange={fieldChange} variant="label-hidden" ></lightning-input-field>
                                    </template>
                                    <template lwc:else>
                                        <lightning-input-field disabled={cancelReasonSelectFSEDis} field-name="cancelReasonSelectFSE__c" value={activityObj.cancelReasonSelectFSE__c} onchange={fieldChange} variant="label-hidden" ></lightning-input-field>
                                    </template>
                                </td>
                                <th>其他:&nbsp;</th>
                                <td>
                                    <lightning-input-field disabled={cancelReasonOtherDis} field-name="cancelReasonOther__c" value={activityObj.cancelReasonOther__c} onchange={fieldChange} variant="label-hidden" ></lightning-input-field>
                                </td>
                                <td><lightning-button disabled={cancelsaveJSDis} style="padding-left: 8px;" label="取消" onclick={cancelsaveJS}></lightning-button></td>
                                <td>&nbsp;</td>
                            </tr>
                            <tr>
                                <th>延期理由:&nbsp;</th>
                                <td class="td-width">
                                    <template lwc:if={isNotSalesService}>
                                        <lightning-input-field disabled={delayReasonSelectDis} field-name="delayReasonSelect__c" value={activityObj.delayReasonSelect__c} onchange={fieldChange} variant="label-hidden" ></lightning-input-field>
                                    </template>
                                    <template lwc:else>
                                        <lightning-input-field disabled={delayReasonSelectFSEDis} field-name="delayReasonSelectFSE__c" value={activityObj.delayReasonSelectFSE__c} onchange={fieldChange} variant="label-hidden" ></lightning-input-field>
                                    </template>
                                </td>
                                <th>其他:&nbsp;</th>
                                <td>
                                    <lightning-input-field disabled={delayReasonOtherDis} field-name="delayReasonOther__c" value={activityObj.delayReasonOther__c} onchange={fieldChange} variant="label-hidden" ></lightning-input-field>
                                </td>
                                <th>&nbsp;</th>
                                <th>延期日期选择:&nbsp;</th>
                                <td>
                                    <lightning-input-field disabled={delayToDateDis} field-name="delayToDate__c" value={activityObj.delayToDate__c} onchange={fieldChange} variant="label-hidden" ></lightning-input-field>
                                </td>
                                <td><lightning-button disabled={delaysaveJSDis} style="padding-left: 8px;" label="延期" onclick={delaysaveJS}></lightning-button></td>
                                <td>&nbsp;</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </lightning-record-edit-form>
        </slot>
        <div class="mask" if:true={showSpinner}>
            <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
        </div>
    </div>
    <template if:true={showModal}>
        <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open">
            <div class="slds-modal__container">
                <header class="slds-modal__header">
                    <button class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" title="Close" onclick={closeOPDSISDiv}>
                        <lightning-icon icon-name="utility:close"
                            alternative-text="close"
                            variant="inverse"
                            size="small" ></lightning-icon>
                        <span class="slds-assistive-text">Close</span>
                    </button>
                    <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">请选择报表类型</h2>
                </header>
                <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1">
                    <lightning-radio-group name="radioGroup" options={options} value={tempRecordTypeName} type="radio" onchange={typeChange}></lightning-radio-group>
                </div>
                <footer class="slds-modal__footer">
                    <button class="slds-button slds-button_brand" onclick={createOPDSISReport}>生成报表</button>
                    <button class="slds-button slds-button_neutral" onclick={closeOPDSISDiv}>取消</button>
                </footer>
            </div>
        </section>
        <div class="slds-backdrop slds-backdrop_open"></div>
    </template>
</template>
force-app/main/default/lwc/activeContent/activeContent.js
New file
@@ -0,0 +1,2780 @@
import { LightningElement,track,api } from 'lwc';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import saveActivity from '@salesforce/apex/LwcDailyReportController.saveActivity';
import queryDepartmentClass from '@salesforce/apex/LwcDailyReportController.queryDepartmentClass';
import queryHospital from '@salesforce/apex/LwcDailyReportController.queryHospital';
import addReportOPWithEvaluationPDF from '@salesforce/apex/LwcDailyReportController.addReportOPWithEvaluationPDF';
import addReportNT from '@salesforce/apex/LwcDailyReportController.addReportNT';
import queryAbountIndo from '@salesforce/apex/LwcDailyReportController.queryAbountIndo';
import getContactAwsIdByCOntactId from '@salesforce/apex/LwcDailyReportController.getContactAwsIdByCOntactId';
import { label } from 'c/labelUtility';
import { NavigationMixin } from 'lightning/navigation';
import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
import ProfileId_2S1 from '@salesforce/label/c.ProfileId_2S1';
import salesman2S1_Price from '@salesforce/label/c.salesman2S1_Price';
import { AWSService } from 'c/piUtils';//deloitte-zhj 调用aws 2023/07/19
import { updateRecord } from 'lightning/uiRecordApi';
import getPIPLInfo from '@salesforce/apex/LookUpUtilController.getPIPLInfo';//deloitte-zhj 获取解密信息 2023/07/19
import { refreshApex } from '@salesforce/apex';
export default class ActiveContent extends NavigationMixin(LightningElement) {
    AWSService;
    @track customLabel = label;
    @api theIndex;
    @api reportedDate;
    @api reportedId;
    @api report;
    @api reportOwner;
    @api currentUserId;
    @api cancelRequestFlg;
    @api allDisableFlg;
    @track timeValid;
    @api isNotSalesService;
    @api reportStatusFlg;
    @api reportReportFlg;
    @api shour ;
    @api sminute ;
    @api ehour ;
    @api eminute ;
    @track fields=['Contact.Name','Contact.AWS_Data_Id__c'];
    @track AccountFields=['Account.Name'];
    @track CampaignFields=['Campaign.Name'];
    @track options=[];
    @track filter = '';
    @track objectName = 'Contact';
    @track contactId1 = '';
    @track contactId2 = '';
    @track contactId3 = '';
    // @track contactId4;
    // @track contactId5;
    @track beforeHour = '';
    @track beforeMinute= '';
    @track afterHour= '';
    @track afterMinute= '';
    @track showSpinner = false;
    @track activityObj = {};
    @track requiredDescription='';
    @track requiredLocation='';
    @track requiredRelatedService='';
    @track requiredReportContract='';
    @track requiredReportContractType='';
    @track visitValidMes='';
    @track requiredVisitor = '';
    @track visit= '';
    @track visitAim= '';
    @track purposeType1= '';
    @track purposeType2= '';
    @track purposeType3= '';
    // @track purposeType4;
    // @track purposeType5;
    @track isAccessAcc= '';
    @track tempId= '';
    @track tempRecordTypeName= '';
    @track tempBtnIdHidden= '';
    @track tempRedId= '';
    @track OPDId= '';
    @track isPlaceDis=false;
    @track isConDis1=false;
    @track isConDis2=false;
    @track isConDis3=false;
    @track isOppDis1=false;
    @track isOppDis2=false;
    @track isOppDis3=false;
    @track isTransferEtDis=false;
    @track isActivityEtDis=false;
    @track isupdateAccInfoDis=false;
    @track isNewOpdDis=false;
    @track isCheckReportDis=false;
    @track isOPDSISDis=false;
    @track isNTCCDSDis=false;
    @track isNewBuyDis=false;
    @track isOppUpdateDis1=false;
    @track isLoseDis1=false;
    @track isOppUpdateDis2=false;
    @track isLoseDis2=false;
    @track isOppUpdateDis3=false;
    @track isLoseDis3=false;
    @track isRelatedServiceDis=false;
    @track isUseReportDis=false;
    @track isAccDis=false;
    @track isInfoUpdateDis=true;
    @track showModal=false;
    //zzm 230905 start
    @track beforeHourDis=false;
    @track saveDis=false;
    @track visitorPalceObjName = '';
    @track visitorPalceFields = ['Account.Name'];
    @track opportunityFields = ['Opportunity.Name'];
    @track mcFields = ['Maintenance_Contract__c.Name'];
    @track infrastructureProjectFields = ['Infrastructure_Project__c.Name'];
    @track Related_Opportunity1_ID = '';
    @track Related_Opportunity2_ID = '';
    @track Related_Opportunity3_ID = '';
    @track Related_Service1_ID = '';
    @track isReportContractDis = true;
    @track isReportContractTypeDis = true;
    @track isInfrastructureProjectDis1 = true;
    @track isInfrastructureProjectDis2 = true;
    @track Infrastructure_Project1 = '';
    @track Infrastructure_Project2 = '';
    @api readReportFlag;
    @api newLeadRecordType;
    @api updateAccInfoColor = false;
    @api requiredInfo = {};
    @track staticResourceContact={};
    @track isSaveBtn = false;
    @track agencyContactName ;
    //zzm 230905 end
    // getPIPLInfoJs() {
    //     console.log('enter connectedCallback')
    //     this.AWSService = new AWSService();
    //     getPIPLInfo().then((r) => {
    //         r = JSON.parse(JSON.stringify(r));
    //         console.log('r = ' + JSON.stringify(r))
    //         if (r.status == 'Success') {
    //             this.staticResourceContact = JSON.parse(r.entity.staticResourceContact);
    //             console.log('this.staticResourceContact.searchUrl actinveContent= ' + this.staticResourceContact.searchUrl)
    //         } else {
    //             console.log('error msg = ' + r.msg)
    //         }
    //     })
    // }
    @api
    getActivityObj() {
        let data =  JSON.parse(JSON.stringify(this.activityObj));
        let dtStr = this.reportedDate+'';
        let dt = new Date(dtStr);
        let startDt = new Date(dt.getFullYear(),dt.getMonth(),dt.getDate(),this.beforeHour,this.beforeMinute,0,0);
        let endDt = new Date(dt.getFullYear(),dt.getMonth(),dt.getDate(),this.afterHour,this.afterMinute,0,0);
        data.StartDateTime__c = startDt;
        data.EndDateTime__c = endDt;
        if(this.visit === '病院') {
            this.visitorPalceObjName = 'SearchVisitorPlace';
        }
        if(this.visit === '販売店') {
            this.visitorPalceObjName = 'SearchVisitorPlace_Sales';
        }
        if(this.visit === '社内活動') {
            this.visitorPalceObjName = 'SearchVisitorPlace_Training';
        }
        if(this.visit === '病院'||this.visit === '販売店'||this.visit === '社内活動'){
            if(this.filter){
                data.Account_ID__c = this.filter;
                data.Campaign_ID__c = '';
            }else{
                data.Account_ID__c = '';
            }
        }else if(this.visit === '社外イベント'){
            if(this.filter){
                data.Campaign_ID__c = this.filter;
                data.Account_ID__c = '';
            }else{
                data.Campaign_ID__c = '';
            }
            this.visitorPalceObjName = 'SearchVisitorPlace_Campaign';
            this.visitorPalceFields = ['Campaign.Name'];
        }else{
            data.Account_ID__c = '';
            data.Campaign_ID__c = '';
        }
        if(this.contactId1){
            data.Visitor1_ID__c = this.contactId1;
        }else{
            data.Visitor1_ID__c = '';
        }
        if(this.contactId2){
            data.Visitor2_ID__c = this.contactId2;
        }else{
            data.Visitor2_ID__c = '';
        }
        if(this.contactId3){
            data.Visitor3_ID__c = this.contactId3;
        }else{
            data.Visitor3_ID__c = '';
        }
        // if(this.contactId4){
        //     data.Visitor4_ID__c = this.contactId4;
        // }else{
        //     data.Visitor4_ID__c = '';
        // }
        // if(this.contactId5){
        //     data.Visitor5_ID__c = this.contactId5;
        // }else{
        //     data.Visitor5_ID__c = '';
        // }
        if(this.visit){
            data.Activity_Type2__c = this.visit;
        }else{
            data.Activity_Type2__c = '';
        }
        //zzm 230809 start
        if(this.Related_Opportunity1_ID){
            data.Related_Opportunity1_ID__c = this.Related_Opportunity1_ID;
        }else{
            data.Related_Opportunity1_ID__c = '';
        }
        if(this.Related_Opportunity2_ID){
            data.Related_Opportunity2_ID__c = this.Related_Opportunity2_ID;
        }else{
            data.Related_Opportunity2_ID = '';
        }
        if(this.Related_Opportunity3_ID){
            data.Related_Opportunity3_ID = this.Related_Opportunity3_ID;
        }else{
            data.Related_Opportunity3_ID = '';
        }
        if(this.Related_Service1_ID){
            data.Related_Service1_ID = this.Related_Service1_ID;
        }else{
            data.Related_Service1_ID = '';
        }
        if(this.Infrastructure_Project1){
            data.Infrastructure_Project1 = this.Infrastructure_Project1;
        }else{
            data.Infrastructure_Project1 = '';
        }
        if(this.Infrastructure_Project2){
            data.Infrastructure_Project2 = this.Infrastructure_Project2;
        }else{
            data.Infrastructure_Project2 = '';
        }
        //zzm 230809 end
        if(this.isNotSalesService){
            if(this.visitAim){
                data.Activity_PurposeEscFSE__c = this.visitAim;
            }else{
                data.Activity_PurposeEscFSE__c = '';
            }
            if(this.purposeType1){
                data.Purpose_TypeEscFSE__c = this.purposeType1;
            }else{
                data.Purpose_TypeEscFSE__c = '';
            }
            if(this.purposeType2){
                data.Purpose_TypeEscFSE2__c = this.purposeType2;
            }else{
                data.Purpose_TypeEscFSE2__c = '';
            }
            if(this.purposeType3){
                data.Purpose_TypeEscFSE3__c = this.purposeType3;
            }else{
                data.Purpose_TypeEscFSE3__c = '';
            }
            // if(this.purposeType4){
            //     data.Purpose_TypeEscFSE4__c = this.purposeType4;
            // }else{
            //     data.Purpose_TypeEscFSE4__c = '';
            // }
            // if(this.purposeType5){
            //     data.Purpose_TypeEscFSE5__c = this.purposeType5;
            // }else{
            //     data.Purpose_TypeEscFSE5__c = '';
            // }
        }else{
            if(this.visitAim){
                data.Activity_PurposeFSE__c = this.visitAim;
            }else{
                data.Activity_PurposeFSE__c = '';
            }
            if(this.purposeType1){
                data.Purpose_TypeFSE__c = this.purposeType1;
            }else{
                data.Purpose_TypeFSE__c = '';
            }
            if(this.purposeType2){
                data.Purpose_TypeFSE2__c = this.purposeType2;
            }else{
                data.Purpose_TypeFSE2__c = '';
            }
            if(this.purposeType3){
                data.Purpose_TypeFSE3__c = this.purposeType3;
            }else{
                data.Purpose_TypeFSE3__c = '';
            }
            // if(this.purposeType4){
            //     data.Purpose_TypeFSE4__c = this.purposeType4;
            // }else{
            //     data.Purpose_TypeFSE4__c = '';
            // }
            // if(this.purposeType5){
            //     data.Purpose_TypeFSE5__c = this.purposeType5;
            // }else{
            //     data.Purpose_TypeFSE5__c = '';
            // }
        }
        return data;
    }
    //报告一览对象
    _event;
    @api
    get event() {
        return this._event;
    }
    _loadFlag = false;
    //相当于初始化
    set event(newValue) {
        this._loadFlag = true;
        // this.clearLookUp();
        console.log('newvalue:activityObj:OPDPlan_Flag__c:' );
        console.log(JSON.parse(JSON.stringify(newValue)));
        console.log(newValue.OPDPlan_Flag__c );
        this._event = newValue;
        this.activityObj = newValue;
        if(this.activityObj.Activity_Type2__c){
            // this.visit = this.activityObj.Activity_Type2__c;
            this.activityObj = {
                    ...this.activityObj,
                    ['Activity_Type2__c']: this.activityObj.Activity_Type2__c
                };
        } else {
             this.activityObj = {
                    ...this.activityObj,
                    ['Activity_Type2__c']: ''
                };
        }
        this.visit = this.activityObj.Activity_Type2__c;
        if(!this.activityObj.Activity_Type2__c)
        {
            this.activityObj = {
                    ...this.activityObj,
                    ['Activity_Type2__c']: ''
                };
        }
        if(this.isNotSalesService){
            this.visitAim = this.activityObj.Activity_PurposeEscFSE__c;
            this.purposeType1 = this.activityObj.Purpose_TypeEscFSE__c;
            this.purposeType2 = this.activityObj.Purpose_TypeEscFSE2__c;
            this.purposeType3 = this.activityObj.Purpose_TypeEscFSE3__c;
            // this.purposeType4 = this.activityObj.Purpose_TypeEscFSE4__c;
            // this.purposeType5 = this.activityObj.Purpose_TypeEscFSE5__c;
        }else{
            this.visitAim = this.activityObj.Activity_PurposeFSE__c;
            this.purposeType1 = this.activityObj.Purpose_TypeFSE__c;
            this.purposeType2 = this.activityObj.Purpose_TypeFSE2__c;
            this.purposeType3 = this.activityObj.Purpose_TypeFSE3__c;
            // this.purposeType4 = this.activityObj.Purpose_TypeFSE4__c;
            // this.purposeType5 = this.activityObj.Purpose_TypeFSE5__c;
        }
        if(this.activityObj.whatid__c){
            this.filter = this.activityObj.whatid__c;
            console.log(this.filter);
        }  else {
                this.filter = '';
            }
        // this.contactId4 = this.activityObj.Visitor4_ID__c;
        // this.contactId5 = this.activityObj.Visitor5_ID__c;
        if(this.visit === '病院'){
            this.isAccessAcc = true;
            console.log(this.activityObj.Account_ID__c);
            if(this.activityObj.Visitor1_ID__c) {
                this.contactId1 = this.activityObj.Visitor1_ID__c;
            } else {
                this.contactId1 = '';
                     this.activityObj = {
                    ...this.activityObj,
                    ['Visitor1_ID__c']: ''
                };
            }
            if(this.activityObj.Visitor2_ID__c) {
                this.contactId2 = this.activityObj.Visitor2_ID__c;
            } else {
                this.contactId2 = '';
                this.activityObj = {
                    ...this.activityObj,
                    ['Visitor2_ID__c']: ''
                };
            }
            if(this.activityObj.Visitor3_ID__c) {
                this.contactId3 = this.activityObj.Visitor3_ID__c;
            } else {
                this.contactId3 = '';
                     this.activityObj = {
                    ...this.activityObj,
                    ['Visitor3_ID__c']: ''
                };
            }
            // if(this.activityObj.Account_ID__c){
            //     this.filter = this.activityObj.Account_ID__c;
            // }
            if(this.activityObj.Related_Opportunity1_ID__c) {
                this.Related_Opportunity1_ID = this.activityObj.Related_Opportunity1_ID__c;
            } else {
                this.Related_Opportunity1_ID = '';
            }
            if(this.activityObj.Related_Opportunity2_ID__c) {
                this.Related_Opportunity2_ID = this.activityObj.Related_Opportunity2_ID__c;
            }else {
                this.Related_Opportunity2_ID = '';
            }
            if(this.activityObj.Related_Opportunity3_ID__c) {
                this.Related_Opportunity3_ID = this.activityObj.Related_Opportunity3_ID__c;
            }else {
                this.Related_Opportunity3_ID = '';
            }
            if(this.activityObj.Related_Service1_ID__c) {
                this.Related_Service1_ID = this.activityObj.Related_Service1_ID__c;
            }else {
                this.Related_Service1_ID = '';
            }
            if(this.activityObj.Infrastructure_Project1__c) {
                this.Infrastructure_Project1 = this.activityObj.Infrastructure_Project1__c;
            }else {
                this.Infrastructure_Project1 = '';
            }
            if(this.activityObj.Infrastructure_Project2__c) {
                this.Infrastructure_Project2 = this.activityObj.Infrastructure_Project2__c;
            }else {
                this.Infrastructure_Project2 = '';
            }
            this.visitorPalceObjName = 'SearchVisitorPlace';
        }else if(this.visit === '販売店'){
            this.isAccessAcc = true;
            // if(this.activityObj.Account_ID__c){
            //     this.filter = this.activityObj.Account_ID__c;
            // }
            this.visitorPalceObjName = 'SearchVisitorPlace_Sales';
        }else if(this.visit === '社内活動'){
            this.isAccessAcc = true;
            // if(this.activityObj.Account_ID__c){
            //     this.filter = this.activityObj.Account_ID__c;
            // }
            if(this.activityObj.Related_Opportunity1_ID__c) {
                this.Related_Opportunity1_ID = this.activityObj.Related_Opportunity1_ID__c;
            }else {
                this.Related_Opportunity1_ID = '';
            }
            if(this.activityObj.Related_Opportunity2_ID__c) {
                this.Related_Opportunity2_ID = this.activityObj.Related_Opportunity2_ID__c;
            }else {
                this.Related_Opportunity2_ID = '';
            }
            // if(this.activityObj.Related_Opportunity3_ID__c) {
            //     this.Related_Opportunity3_ID = this.activityObj.Related_Opportunity3_ID__c;
            // }
            // if(this.activityObj.Infrastructure_Project1__c) {
            //     this.Infrastructure_Project1 = this.activityObj.Infrastructure_Project1__c;
            // }
            this.visitorPalceObjName = 'SearchVisitorPlace_Training';
        }else if(this.visit === '社外イベント'){
            this.isAccessAcc = false;
            // if(this.activityObj.Campaign_ID__c){
            //     this.filter = this.activityObj.Campaign_ID__c;
            // }
            // if(this.activityObj.whatid__c){
            //     this.filter = this.activityObj.whatid__c;
            // }
            this.visitorPalceObjName = 'SearchVisitorPlace_Campaign';
            this.visitorPalceFields = ['Campaign.Name'];
        }else {
            this.isAccessAcc = true;
            this.filter = '';
        }
        if(!this.filter)  {
             const visitorComponents = this.template.querySelectorAll('c-other-look-up');
             console.log(visitorComponents.length);
            if (visitorComponents.length > 0) {
                visitorComponents.forEach(visitorComponent => {
                    if(visitorComponent['uniqueKey'] =='AccountID' ||
                        !visitorComponent['uniqueKey']) {
                        this.isAccDis = false;
                        visitorComponent.handleRemovePill();
                        this.isAccDis = true;
                    }
                });
            }
        }
        if(this.activityObj.StartDateTime__c){
            let startTimeStr = this.activityObj.StartDateTime__c+'';
            let startDate = new Date(startTimeStr);
            startDate.setHours(startDate.getHours())
            this.beforeHour = startDate.getHours();
            this.beforeMinute = startDate.getMinutes();
        }
        else
        {
            this.beforeHour = '';
            this.beforeMinute = '';
        }
        if(this.activityObj.EndDateTime__c){
            let endTimeStr = this.activityObj.EndDateTime__c+'';
            let endDate = new Date(endTimeStr);
            endDate.setHours(endDate.getHours())
            this.afterHour = endDate.getHours();
            this.afterMinute = endDate.getMinutes();
        }else{
            this.afterHour = '';
            this.afterMinute = '';
        }
        //营业的只显示OPD/sis 也要拆分三个按钮 并带默认值
        //销售服务是涉及维修合同 显示Ntc按钮(要拆成两个按钮 新品装机培训和故障预防培训)
        this.options = [
            { label: 'OPD/(主机试用报告)', value: 'SIS' },
            { label: 'SIS-ET(SIS-ET)', value: 'SIS_ET' },
            { label: 'SIS-ENG(SIS-ENG)', value: 'SIS_ENG' }
        ];
        // if(this.reportOwner.Job_Category__c==='销售推广'){
        //     this.options = [
        //         { label: 'OPD/(主机试用报告)', value: 'SIS' },
        //         { label: 'SIS-ET(SIS-ET)', value: 'SIS_ET' },
        //         { label: 'SIS-ENG(SIS-ENG)', value: 'SIS_ENG' }
        //     ];
        //     this.options = [
        //         { label: '跟台(产品主机担当/医院担当考核)', value: 'OPD' },
        //         { label: 'OPD/(主机试用报告)', value: 'SIS' },
        //         { label: 'SIS-ET(SIS-ET)', value: 'SIS_ET' },
        //         { label: 'SIS-ENG(SIS-ENG)', value: 'SIS_ENG' }
        //     ];
        // }else{
        //     this.options = [
        //         { label: '跟台(产品主机担当/医院担当考核)', value: 'OPD' },
        //         { label: 'OPD/(主机试用报告)', value: 'SIS' },
        //         { label: 'SIS-ET(SIS-ET)', value: 'SIS_ET' },
        //         { label: 'SIS-ENG(SIS-ENG)', value: 'SIS_ENG' }
        //     ];
        // }
        this.setVisitorPlaceDisabled();
        this.vpChack1();
        debugger
        // if(this.activityObj && this.activityObj.Id) {
        //     updateRecord({fields: { Id: this.activityObj.Id }});
        // }
        //
         refreshApex(this.activityObj);
    }
    renderedCallback(){
        // console.log('activeContent renderedCallback:'+this.valueId);
        console.log('otherlookup renderedCallback');
        // this.activityObj = this._event ;
        // if(this.activityObj) {
        //  updateRecord({fields: { Id: this.activityObj.Id }});
        // }
        // if(this._loadFlag) {
        //     this.activityObj = this._event ;
        //     this._loadFlag = false;
        //     if(this.activityObj && this.activityObj.Id) {
        //         updateRecord({fields: { Id: this.activityObj.Id }});
        //     }
        // }
    }
    //新建成功后传入的客户人员id
    _conid;
    @api
    get conid() {
        return this._conid;
    }
    set conid(newValue) {
        this._conid = newValue;
    }
    //访问对象
    handleSelection(event) {
        console.log('handleSelection!!!!!!!!!!!!');
        var key = event.detail.key;
        if(key==='AgencyContact1'){
            this.requiredVisitor = '';
            this.contactId1 = event.detail.selectedId;
            this.activityObj = {
                ...this.activityObj,
                ['Visitor1_ID__c']: event.detail.selectedId
            };
        }else if(key==='AgencyContact2'){
            this.contactId2 = event.detail.selectedId;
            this.activityObj = {
                ...this.activityObj,
                ['Visitor2_ID__c']: event.detail.selectedId
            };
        }else if(key==='AgencyContact3'){
            this.activityObj = {
                ...this.activityObj,
                ['Visitor3_ID__c']: event.detail.selectedId
            };
            this.contactId3 = event.detail.selectedId;
        }
        this.checkVisitChange();
        // else if(key==='AgencyContact4'){
        //     this.contactId4 = event.detail.selectedId;
        // }else if(key==='AgencyContact5'){
        //     this.contactId5 = event.detail.selectedId;
        // }
    }
    //访问对象
    handleAccSelection(event) {
        console.log('handleAccSelection!!!!!!!!!!!!');
        this.filter = event.detail.selectedId;
        this.activityObj = {
                ...this.activityObj,
                ['whatid__c']: event.detail.selectedId
            };
        this.requiredLocation = '';
        this.changeAccId();
    }
    //询价
    handleOppertunity1Selection(event) {
        console.log('handleOppertunity1Selection!!!!!!!!!!!!');
        this.Related_Opportunity1_ID = event.detail.selectedId;
        if(!this.Related_Opportunity1_ID) {
            this.isOppUpdateDis1 = true;
            this.isLoseDis1 = true;
        } else {
            this.isOppUpdateDis1 = false;
            this.isLoseDis1 = false;
        }
        this.checkVisitChange();
    }
    handleOppertunity2Selection(event) {
        console.log('handleOppertunity2Selection!!!!!!!!!!!!');
        this.Related_Opportunity2_ID = event.detail.selectedId;
        // this.activityObj.Related_Opportunity2_ID__c = event.detail.selectedId;
        if(!this.Related_Opportunity2_ID) {
            this.isOppUpdateDis2 = true;
            this.isLoseDis2 = true;
        } else {
            this.isOppUpdateDis2 = false;
            this.isLoseDis2 = false;
        }
        this.checkVisitChange();
    }
    handleOppertunity3Selection(event) {
        console.log('handleOppertunity3Selection!!!!!!!!!!!!');
        this.Related_Opportunity3_ID = event.detail.selectedId;
        // this.activityObj.Related_Opportunity3_ID__c = event.detail.selectedId;
        if(!this.Related_Opportunity3_ID) {
            this.isOppUpdateDis3 = true;
            this.isLoseDis3 = true;
        } else {
            this.isOppUpdateDis3 = false;
            this.isLoseDis3 = false;
        }
        this.checkVisitChange();
    }
    //基建项目
    handleInfrastructureProject1Selection(event) {
        console.log('handleOppertunity1Selection!!!!!!!!!!!!');
        this.Infrastructure_Project1 = event.detail.selectedId;
        this.checkVisitChange();
    }
    //基建项目
    handleInfrastructureProject2Selection(event) {
        console.log('handleOppertunity1Selection!!!!!!!!!!!!');
        this.Infrastructure_Project2 = event.detail.selectedId;
        this.checkVisitChange();
    }
    //维修合同
    handleMCSelection(event) {
        console.log('handleMCSelection!!!!!!!!!!!!');
        this.Related_Service1_ID = event.detail.selectedId;
         this.activityObj = {
            ...this.activityObj,
            ['Related_Service1_ID__c']: event.detail.selectedId
        }
        this.requiredRelatedService = '';
        this.checkVisitChange();
    }
    get dailyTypeList() {
        return [
            { label: '通常', value: '通常' },
            { label: '一日休假', value: '一日休假' },
            { label: '全天培训', value: '全天培训' }
        ];
    }
    //信息更新按钮
    slaInfoPage(){
        var eventCId = this.activityObj.Id;
        var index = 1;
        var visitor1 = this.contactId1;
        var visitor2 = this.contactId2;
        var visitor3 = this.contactId3;
        // var visitor4 = this.contactId4;
        // var visitor5 = this.contactId5;
        var visitorPlaceId = this.activityObj.Related_Service1_ID__c;
        var serviceId = this.filter;
        var id = this.activityObj.SLAReportInfo__c;
        var url = "/apex/SLAReportDetails?serviceId="+serviceId+"&index="+index+'&';
        if(id){
            url += "id="+id+'&';
        }
        if(eventCId){
            url += "eventCId="+eventCId+'&';
        }
        if(visitor1){
            url += "visitor1="+visitor1+'&';
        }
        if(visitor2){
            url += "visitor2="+visitor2+'&';
        }
        if(visitor3){
            url += "visitor3="+visitor3+'&';
        }
        // if(visitor4){
        //     url += "visitor4="+visitor4+'&';
        // }
        // if(visitor5){
        //     url += "visitor5="+visitor5+'&';
        // }
        if(visitorPlaceId){
            url += "accountId="+visitorPlaceId+'&';
        }
        console.log(url);
        window.open(url,'_blank');
    }
    changeAccId(){
        //清空访问对象
        const childComponents = this.template.querySelectorAll('c-look-up-util');
        console.log(childComponents.length);
        if (childComponents.length > 0) {
            childComponents.forEach(childComponent => {
                childComponent.handleRemovePill();
            });
        }
        //清空其他查询组件
        const otherComponents = this.template.querySelectorAll('c-other-look-up');
        console.log(otherComponents.length);
        if (otherComponents.length > 0) {
            otherComponents.forEach(otherComponent => {
                console.log('清空其他查询组件:')
                console.log(otherComponent['uniqueKey'])
                if(otherComponent['uniqueKey'] !='AccountID') {
                    otherComponent.handleRemovePill();
                }
            });
        }
        this.visitDis = false;
    }
    clearLookUp() {
         //清空访问对象
        const childComponents = this.template.querySelectorAll('c-look-up-util');
        console.log(childComponents.length);
        if (childComponents.length > 0) {
            childComponents.forEach(childComponent => {
                childComponent.handleRemovePill();
            });
        }
        //清空其他查询组件
        const otherComponents = this.template.querySelectorAll('c-other-look-up');
        console.log(otherComponents.length);
        if (otherComponents.length > 0) {
            otherComponents.forEach(otherComponent => {
                otherComponent.handleRemovePill();
            });
        }
        this.beforeHour = '';
        this.beforeMinute = '';
        this.afterHour = '';
        this.afterMinute = '';
        this.activityObj = {
                ...this.activityObj,
                ['Activity_Type2__c']: '',
                ['Activity_PurposeEscFSE__c']: '',
                ['Activity_PurposeFSE__c']: '',
                ['Purpose_TypeEscFSE__c']: '',
                ['Purpose_TypeEscFSE2__c']: '',
                ['Purpose_TypeEscFSE3__c']: '',
                ['Purpose_TypeFSE__c']: '',
                ['Purpose_TypeFSE2__c']: '',
                ['Purpose_TypeFSE3__c']: '',
                ['OPDPlan_Flag__c']: false,
                ['Report_Contract__c']: '',
                ['Report_Contract_Type__c']: '',
                ['Description__c']: '',
                ['Find_Imitations_Flag__c']: false,
                ['cancelReasonSelect__c']: '',
                ['cancelReasonSelectFSE__c']: '',
                ['cancelReasonOther__c']: '',
                ['delayReasonSelect__c']: '',
                ['delayReasonSelectFSE__c']: '',
                ['delayReasonOther__c']: '',
                ['delayToDate__c']: '',
            };
    }
    changeCampaignId(event){
        this.filter = event.target.value;
    }
    fieldChange(event) {
        console.log('filedChange uniqueKey:');
        console.log(event.currentTarget);
        //清空错误提示信息
        if(event.currentTarget.dataset.key) {
            console.log(event.currentTarget.dataset.key)
            const { key } = event.currentTarget.dataset;
            const requiredId = event.currentTarget.dataset.key;
            this.requiredInfo = {
                ...this.requiredInfo,
                [key]: ''
            };
        }
        const { value } = event.detail;
        const { fieldName } = event.target || event.currentTarget;
        // 使用动态字段名设置对象的属性值
        let checked = event.target.value||event.currentTarget.value;
        if (value == undefined && checked != undefined) {
            this.activityObj = {
                ...this.activityObj,
                [fieldName]: checked
            };
             // this.activityObj[fieldName] = checked;
        } else {
            let theValue = value instanceof Array ? value[0] : value;
            if(theValue===undefined){
                theValue = '';
            }
            this.activityObj = {
                ...this.activityObj,
                [fieldName]: theValue
            };
            // this.activityObj[fieldName] = theValue;
        }
        console.log('1111111111111');
        if(fieldName==='Related_Opportunity1_ID__c'||fieldName==='Related_Opportunity2_ID__c'||fieldName==='Related_Opportunity3_ID__c'){
            console.log('222222222222');
            this.setVisitorPlaceDisabled();
        }
    }
    handleNewRecord(event){
        const openPageEvent = new CustomEvent('openpage', {
            detail: { activeContentIndex:this.theIndex,lookUpKey:event.detail.key },
        });
        this.dispatchEvent(openPageEvent);
    }
    @api
    validSaveReport() {
        let saveflag = false;
        console.log('validSaveReport start');
        let requiredFieldList = this.template.querySelectorAll('lightning-input-field');
        requiredFieldList.forEach(ele => {
            console.log(ele.required);
            console.log(ele.value);
            if ( ele.required == true && ele.value) {
                saveflag = true;
                return saveflag;
            }
        });
        let requiredInputList = this.template.querySelectorAll('lightning-input');
        requiredInputList.forEach(ele => {
            if ( ele.required == true && ele.value) {
                saveflag = true;
                return saveflag;
            }
        });
        console.log('validSaveReport end');
        return saveflag;
    }
    @api
    validRequired(){
        console.log('validRequired');
        let flag = true;
        // //设置必填信息
        if(this.report.Status__c === '申請中' && this.stringIsEmpty(this.activityObj.eventStatus__c)){
            console.log('1');
            //结果必填
            if(this.stringIsEmpty(this.activityObj.Description__c)){
                this.requiredInfo.requiredDescription = '请输入值';
            }
        }
        if(this.report.Status__c === '申請中' && this.visit === '病院'&& this.stringIsEmpty(this.activityObj.eventStatus__c)){
            console.log('2');
            //访问场所必填
            if(this.stringIsEmpty(this.filter)){
                this.requiredLocation = '请输入值';
            }
        }
        if (this.report.Daily_Report_Data_Type__c==='一日休假' && this.visit !== '休暇' && this.stringIsEmpty(this.activityObj.eventStatus__c)) {
            console.log('3');
            this.visitValidMes = '全天休假类型的日报拜访区分必须为休假!';
            flag = false;
        }
        if (this.report.Daily_Report_Data_Type__c==='全天培训'
            && this.visitAim !== '公司培训' && this.visitAim !== '培训' && this.stringIsEmpty(this.activityObj.eventStatus__c)){
                console.log('4');
                this.visitValidMes = '全天培训类型的日报拜访目的必须为培训!';
                flag = false;
        }
        if((this.purposeType1 === '合同季报' || this.activityObj.UseReport__c) &&
        this.stringIsEmpty(this.activityObj.Related_Service1_ID__c) && this.stringIsEmpty(this.activityObj.eventStatus__c)
        ){
            console.log('5');
            //维修合同必填
            this.requiredRelatedService = '请输入值';
             flag = false;
        }
        if((this.purposeType1 === '合同季报' || this.activityObj.UseReport__c ||this.purposeType2 === '合同季报'||this.purposeType3 === '合同季报') &&
        this.stringIsEmpty(this.activityObj.Report_Contract__c) && this.stringIsEmpty(this.activityObj.eventStatus__c)
        ){
            console.log('6');
            //发放人必填
            this.requiredInfo.requiredReportContract = '请输入值';
            flag = false;
        }
         if((this.purposeType1 === '合同季报' || this.activityObj.UseReport__c||this.purposeType2 === '合同季报'||this.purposeType3 === '合同季报') &&
        this.stringIsEmpty(this.activityObj.Report_Contract_Type__c) && this.stringIsEmpty(this.activityObj.eventStatus__c)
        ){
            console.log('6');
            //发放方式必填
            this.requiredInfo.requiredReportContractType = '请输入值';
            flag = false;
        }
        if((this.purposeType1 === '合同点检' &&
        this.stringIsEmpty(this.activityObj.Related_Service1_ID__c) && this.stringIsEmpty(this.activityObj.eventStatus__c))
        ){
            console.log('6');
            //维修合同必填
            this.requiredRelatedService='请输入值';
        }
        let requiredFieldList = this.template.querySelectorAll('lightning-input-field');
        requiredFieldList.forEach(ele => {
            if ( ele.required == true && this.stringIsEmpty(ele.value)) {
                console.log('7');
                console.log(ele.fieldName);
                ele.reportValidity();
                flag = false;
            }
        });
        let requiredInputList = this.template.querySelectorAll('lightning-input');
        requiredInputList.forEach(ele => {
            if ( ele.required == true && this.stringIsEmpty(ele.value)) {
                console.log('8-1');
                console.log(ele.fieldName);
                ele.reportValidity();
                flag = false;
            }
        });
        //zzm 230906 start 学术会议时,访问对象不是必填
        // if(this.stringIsEmpty(this.contactId1)&&this.isConDis1){
        if(this.stringIsEmpty(this.contactId1)&& !this.isConDis1){
            console.log('8');
            this.requiredVisitor = '请输入值';
            flag = false;
        }
        //zzm 230906 end
        //20210520 zh ETAPP与日报联动 start
        if(!this.isNotSalesService&& this.visitAim === 'ET APP活动'&&!this.activityObj.ETAPPAct__c&&
        this.activityObj.eventStatus__c!=='延期'&&this.activityObj.eventStatus__c!=='取消'){
            this.eventMessage = '请确认:是否需要新建目标ET或者进行目标ET的PDCA管理。';
            this.etAPPerrorMsg = '若需要建立目标ET,请点击[转至ET APP]新建目标ET。若已建立目标ET,请点击[ET APP活动]进行活动PDCA管理';
            flag = false;
        }else if(this.isNotSalesService && this.visitAim === 'ET APP活动'&&!this.activityObj.ETAPPAct__c&&
        this.activityObj.eventStatus__c!=='延期'&&this.activityObj.eventStatus__c!=='取消'){
            this.eventMessage = '请确认:是否需要新建目标ET或者进行目标ET的PDCA管理。';
            this.etAPPerrorMsg = '若需要建立目标ET,请点击[转至ET APP]新建目标ET。若已建立目标ET,请点击[ET APP活动]进行活动PDCA管理';
            flag = false;
        }
        if(flag){
            flag = this.validOther();
        }
        console.log('validRequired result:' + flag);
        return flag;
    }
    @api
    validOther(){
        console.log('validOther');
        if(this.isNotSalesService) {
            if(!this.beforeMinute && this.beforeHour && this.afterHour) {
                this.beforeMinute = 0;
            }
            if(!this.afterMinute && this.beforeHour && this.afterHour) {
                this.afterMinute = 0;
            }
        }
        var sHour = this.beforeHour;
        var sMinute = this.beforeMinute;
        var eHour = this.afterHour;
        var eMinute = this.afterMinute;
        if(!this.isNotSalesService && (this.stringIsEmpty(sMinute) || this.stringIsEmpty(eMinute) || this.stringIsEmpty(sHour)||this.stringIsEmpty(eHour)) ){
            // this.timeValid = this.customLabel.Error_Message22;
            this.showToast('error',this.customLabel.Error_Message22);
            return false;
        } else if(this.isNotSalesService && ( this.stringIsEmpty(sHour)||this.stringIsEmpty(eHour)) ) {
            // this.timeValid = this.customLabel.Error_Message22;
            this.showToast('error',this.customLabel.Error_Message22);
            return false;
        }else{
            const regexPattern = /^[0-9]+$/;
            if (!regexPattern.test(sHour) || !regexPattern.test(sMinute) || !regexPattern.test(eHour) || !regexPattern.test(eMinute)) {
                // this.timeValid = this.customLabel.Error_Message39; //不正确的日期。
                this.showToast('error',this.customLabel.Error_Message39);
                return false;
            }
            // const regexHour = /^(0?[1-9]|1[0-2])$/;
            // if(!regexHour.test(sHour)||!regexHour.test(eHour)) {
            //     this.timeValid = this.customLabel.Error_Message39; //不正确的日期。
            //     return false;
            // }
            sHour = parseInt(this.beforeHour);
            sMinute = parseInt(this.beforeMinute);
            eHour = parseInt(this.afterHour);
            eMinute = parseInt(this.afterMinute);
            // 範囲チェック
            // if(sHour > 23) {
            //     sHour =sHour%24;
            //     this.beforeHour = sHour;
            // }
            // if(eHour > 23) {
            //     eHour =eHour%24;
            //     this.afterHour = eHour;
            // }
            // if(sMinute > 59) {
            //     sMinute =sMinute%60;
            //     this.beforeMinute = sMinute;
            // }
            // if(eMinute > 59) {
            //     eMinute =eMinute%60;
            //     this.afterMinute = eMinute;
            // }
            if (sHour < 0 || sHour > 23 || sMinute < 0 || sMinute > 59 || eHour < 0 || eHour > 23 || eMinute < 0 || eMinute > 59) {
                // this.timeValid = this.customLabel.Error_Message39;
                this.showToast('error',this.customLabel.Error_Message39);
                return false;
            }else if (sHour > eHour || (sHour === eHour && sMinute > eMinute)) {
                // 逆転チェック
                // this.timeValid = this.customLabel.Error_Message2;
                this.showToast('error',this.customLabel.Error_Message2);
                return false;
            }
            this.timeValid = '';
        }
        console.log('validOther  end');
        return true;
    }
    @track eventMessage;
    @track etAPPerrorMsg;
    @track customValidationMessage;
    @track isSaveSuccess;
    validReport(type){
        console.log('validReport!!!!!!!!!!!!');
        const openPageEvent = new CustomEvent('validreport', {
            detail: { type:type,index:this.theIndex},
        });
        this.showSpinner = false;
        this.dispatchEvent(openPageEvent);
    }
    @api
    saveTheActivity(type){
        console.log('saveTheActivity');
        console.log(type);
        if( typeof(type)=='string') {
            this.isSaveBtn = true;
            console.log('save btn ');
        } else {
            this.isSaveBtn = false;
        }
        this.validReport(type);
    }
    @api
    save(type){
        console.log('save');
        console.log(type);
        this.isSaveSuccess = false;
        this.showSpinner = true;
        var flag = true;
        // if(!this.isSaveBtn && this.report.Status__c=='申請中') {
        //     flag = this.validRequired();
        // }
        // else {
        //     flag =  this.validOther();
        // }
        if(flag ){
            saveActivity({ jsonStr: JSON.stringify(this.activityObj),beforeHour:this.beforeHour,beforeMinute:this.beforeMinute
            ,afterHour:this.afterHour,afterMinute:this.afterMinute
            ,visit:this.visit,visitAim:this.visitAim,purposeType1:this.purposeType1,purposeType2:this.purposeType2,
            purposeType3:this.purposeType3,
            // purposeType4:this.purposeType4,purposeType5:this.purposeType5,
            contactId1:this.contactId1,contactId2:this.contactId2,contactId3:this.contactId3,
            // contactId4:this.contactId4, contactId5:this.contactId5,
            accountId:this.filter,
            reportJsonStr:JSON.stringify(this.report),shour:this.shour,sminute:this.sminute,ehour:this.ehour,eminute:this.eminute
            ,relatedOpportunity1:this.Related_Opportunity1_ID,relatedOpportunity2:this.Related_Opportunity2_ID
            ,relatedOpportunity3:this.Related_Opportunity3_ID,relatedService1:this.Related_Service1_ID
            ,infrastructureProject1:this.Infrastructure_Project1,infrastructureProject2:this.Infrastructure_Project2
            })
            .then(result => {
                if(result.code===200){
                    if(this.stringIsEmpty(type)){
                        this.showToast('success','保存成功');
                        this.showSpinner = false;
                    }
                    let msg = result.msg;
                    if(msg === 'update'){
                    }else{
                        this.activityObj = {
                            ...this.activityObj,
                            ['Id']: msg
                        };
                    }
                    this.isOpen = false;
                    //新建opd计划
                    if(type==='newOPDPlan'){
                        console.log('newOPDPlan!!!');
                        // var content;
                        // if(this.visit === '社外イベント'){
                        //     content = encodeDefaultFieldValues({
                        //         Campaign__c: this.filter,
                        //         Related_Opportunity1_ID__c: this.activityObj.Related_Opportunity1_ID__c,
                        //         Related_Opportunity2_ID__c: this.activityObj.Related_Opportunity2_ID__c,
                        //     });
                        // }else{
                        //     content = encodeDefaultFieldValues({
                        //         Account_Laboratory__c: this.filter,
                        //         Related_Opportunity1_ID__c: this.activityObj.Related_Opportunity1_ID__c,
                        //         Related_Opportunity2_ID__c: this.activityObj.Related_Opportunity2_ID__c,
                        //     });
                        // }
                        // const defaultFieldValues =  content;
                        // const pageReference = {
                        //     type: 'standard__objectPage',
                        //     attributes: {
                        //         objectApiName: 'OPDPlan__c',
                        //         actionName: 'new'
                        //     },
                        //     state: {
                        //         // defaultFieldValues: JSON.stringify(defaultFieldValues)
                        //         defaultFieldValues: defaultFieldValues
                        //     }
                        // };
                        // this[NavigationMixin.Navigate](pageReference);
                        // '/lightning/o/Opportunity/new?defaultFieldValues=Name=' + URLENCODE(Account.Name)+ " Opportunity" + ',AccountId=' + Account.Id + ',StageName=' + "Qualification" + ',CloseDate=' + TEXT(TODAY()+30
                        // if(!this.activityObj.Related_Opportunity1_ID__c) {
                        //     this.activityObj.Related_Opportunity1_ID__c = '';
                        // }
                        // if(!this.activityObj.Related_Opportunity2_ID__c) {
                        //     this.activityObj.Related_Opportunity2_ID__c = '';
                        // }
                        console.log('this.activityObj:');
                        console.log(this.activityObj.Related_Opportunity1_ID__c);
                        // alert(this.activityObj.Related_Opportunity1_ID__c);
                        var openUrl = '/lightning/o/OPDPlan__c/new?defaultFieldValues=Account_Laboratory__c='+this.filter;
                        if(this.Related_Opportunity1_ID) {
                            openUrl +=',Related_Opportunity1_ID__c=';
                            openUrl +=this.Related_Opportunity1_ID;
                        }
                        if(this.Related_Opportunity2_ID) {
                            openUrl += ',Related_Opportunity2_ID__c=';
                            openUrl += this.Related_Opportunity2_ID;
                        }
                        openUrl +=',OPDType__c=';
                        openUrl +=encodeURI('日报');
                        openUrl += ',Name=*';
                        this.showSpinner = false;
                        window.open(openUrl, '_blank');
                        // window.open('/lightning/o/OPDPlan__c/new?defaultFieldValues=Account_Laboratory__c='+this.filter
                        // +',Related_Opportunity1_ID__c='+this.activityObj.Related_Opportunity1_ID__c
                        // +',Related_Opportunity2_ID__c='+this.activityObj.Related_Opportunity2_ID__c
                        // +',OPDType__c='+encodeURI('日报'), '_blank');
                    }else if(type==='checkReport'){
                        console.log('checkReport!!!');
                        var eid = this.activityObj.Id;
                        if (this.stringIsEmpty(eid)) {
                            eid = this.report.Activity_ID__c;
                        }
                        var strVP = this.filter;
                        this.showSpinner = false;
                        var urlStr = '/apex/OFSInsReportLayout?rt=EndoscopeSystem&hpid=' + strVP + '&ecid=' + eid;
                        window.open(urlStr, '_blank');
                    }else if(type==='OPDOrSIS'){
                        this.openPD('OPDOrSIS',this.tempRecordTypeName,this.tempReportId);
                    }else if(type==='NTCOrCDS'){
                        this.openPD('NTCOrCDS',this.tempRecordTypeName,this.tempReportId);
                    }else if(type==='addLeadNew'){
                        this.addLead();
                    }
                }else{
                    this.showToast('error','保存失败,'+result.msg);
                    this.showSpinner = false;
                }
                // this.showSpinner = false;
            })
            .catch(error => {
                // let errorMessage = "";
                // error.body.pageErrors.forEach(element => {
                //     errorMessage += element.message;
                // });
                this.showToast('error','保存失败,'+error);
                this.showSpinner = false;
            });
        }else{
            this.showSpinner = false;
        }
    }
    //新建OPD计划
    newOPDPlan(event){
        console.log('newOPDPlan');
        this.showSpinner = true;
        if (this.stringIsEmpty(this.filter)) {
            // 訪問場所を設定してください。
            this.showToast('error',this.customLabel.Error_Message16);
            this.showSpinner = false;
            return;
        }
        this.saveTheActivity('newOPDPlan');
    }
    OPDOrSIS(event){
        console.log('OPDOrSIS');
        console.log(this.visitAim);
        console.log(this.purposeType1);
        console.log(this.purposeType2);
    }
    beforeHourChange(event) {
        this.beforeHour = event.detail.value;
    }
    beforeMinuteChange(event) {
        this.beforeMinute = event.detail.value;
    }
    afterHourChange(event) {
        this.afterHour = event.detail.value;
    }
    afterMinuteChange(event) {
        this.afterMinute = event.detail.value;
    }
    //设置拜访区分是否可点击
    checkVisitChange() {
        console.log('checkVisitChange start');
        var changeFlg = false;
        if(this.contactId1){
            changeFlg = true;
        }
        if(this.contactId2){
            changeFlg = true;
        }
        if(this.contactId3){
            changeFlg = true;
        }
        // if(this.contactId4){
        //     changeFlg = true;
        // }
        // if(this.contactId5){
        //     changeFlg = true;
        // }
        if(this.Related_Opportunity1_ID){
            changeFlg = true;
        }
        if(this.Related_Opportunity2_ID){
            changeFlg = true;
        }
        if(this.Related_Opportunity3_ID){
            changeFlg = true;
        }
        if(this.Related_Service1_ID){
            changeFlg = true;
        }
        // if(this.activityObj.Related_Opportunity4_ID__c){
        //     changeFlg = true;
        // }
        // if(this.activityObj.Related_Opportunity5_ID__c){
        //     changeFlg = true;
        // }
        // if(this.activityObj.Related_Service1_ID__c){
        //     changeFlg = true;
        // }
        if(this.activityObj.OPD_ID__c){
            changeFlg = true;
        }
        if(this.activityObj.NTC_ID__c){
            changeFlg = true;
        }
        if(this.activityObj.OnCall_ID__c){
            changeFlg = true;
        }
        if(this.activityObj.ReportAccompanied_ID__c){
            changeFlg = true;
        }
        if(this.activityObj.CityStatus_ID__c){
            changeFlg = true;
        }
        if(this.activityObj.Claim_ID__c){
            changeFlg = true;
        }
        if(this.activityObj.Conflict_ID__c){
            changeFlg = true;
        }
        console.log('changeFlg:'+changeFlg);
        // if (changeFlg) {
        //     // 値を設定または報告書を作成した場合は変更できません。设定了价格或者制作了报告书的情况下不能变更。
        //     this.visitDis = true;
        //     // this.showToast('error',this.customLabel.Error_Message21);
        //     // return;
        // }
        this.visitDis = changeFlg;
    }
    //拜访区分更改
    visitChange(event) {
        this.visitValidMes = '';
        this.requiredVisitor = '';
        console.log('visitChange');
        // this.checkVisitChange();
        this.visit = event.detail.value;
        this.visitAim = '';
        this.purposeType1 = '';
        this.purposeType2 = '';
        this.purposeType3 = '';
        // this.purposeType4 = '';
        // this.purposeType5 = '';
        console.log('----------');
        console.log(this.visit);
        const otherComponents = this.template.querySelectorAll('c-other-look-up');
            if (otherComponents.length > 0) {
                otherComponents.forEach(otherComponent => {
                    console.log('清空访问场所组件:')
                    console.log(otherComponent['uniqueKey'])
                    if(otherComponent['uniqueKey'] =='AccountID') {
                        otherComponent.handleRemovePill();
                    }
                });
            }
        if(this.visit === '病院'){
            console.log('1病院');
            this.isAccessAcc = true;
            this.visitorPalceObjName = 'SearchVisitorPlace';
        }else if(this.visit === '販売店'){
            console.log('2販売店');
            this.isAccessAcc = true;
            this.visitorPalceObjName = 'SearchVisitorPlace_Sales';
        }else if(this.visit === '社内活動'){
            console.log('3社内活動');
            this.isAccessAcc = true;
            this.visitorPalceObjName = 'SearchVisitorPlace_Training';
        }else if(this.visit === '社外イベント'){
            console.log('4社外イベント');
            this.isAccessAcc = false;
            this.visitorPalceObjName = 'SearchVisitorPlace_Campaign';
            this.visitorPalceFields = ['Campaign.Name'];
        }else {
            console.log('5');
            this.isAccessAcc = true;
            this.isAccDis = true;
        }
        this.filter = '';
        this.activityObj = {
                            ...this.activityObj,
                            ['whatid__c']: ''
                        };
        this.setVisitorPlaceDisabled();
    }
    //拜访目的更改
    visitAimChange(event) {
        console.log('visitAimChangeSales');
        this.visitAim = event.detail.value;
        this.purposeType1 = '';
        this.purposeType2 = '';
        this.purposeType3 = '';
        // this.purposeType4 = '';
        // this.purposeType5 = '';
        this.requiredvisitAim = '';
        this.activityObj = {
                            ...this.activityObj,
                            ['Purpose__c']: event.detail.value
                        };
    }
    //活动区分更改
    purposeType1Change(event) {
        this.purposeType1 = event.detail.value;
        // if(isNotSalesService) {
        //     this.activityObj ={
        //         ...this.activityObj,
        //         ['Purpose_TypeEscFSE__c']: event.detail.value
        //     }
        // } else {
        //     this.activityObj ={
        //         ...this.activityObj,
        //         ['Purpose_TypeFSE__c']: event.detail.value
        //     }
        // }
        this.requiredPurposeType = '';
        this.setReportContractDis();
        this.setInfrastructureProjectDis();
    }
    purposeType2Change(event) {
        this.purposeType2 = event.detail.value;
        // if(isNotSalesService) {
        //     this.activityObj ={
        //         ...this.activityObj,
        //         ['Purpose_TypeEscFSE2__c']: event.detail.value
        //     }
        // } else {
        //     this.activityObj ={
        //         ...this.activityObj,
        //         ['Purpose_TypeFSE2__c']: event.detail.value
        //     }
        // }
        this.setReportContractDis();
        this.setInfrastructureProjectDis();
    }
    purposeType3Change(event) {
        this.purposeType3 = event.detail.value;
        // if(isNotSalesService) {
        //     this.activityObj ={
        //         ...this.activityObj,
        //         ['Purpose_TypeEscFSE3__c']: event.detail.value
        //     }
        // } else {
        //     this.activityObj ={
        //         ...this.activityObj,
        //         ['Purpose_TypeFSE3__c']: event.detail.value
        //     }
        // }
        this.setReportContractDis();
        this.setInfrastructureProjectDis();
    }
    // purposeType4Change(event) {
    //     this.purposeType4 = event.detail.value;
    // }
    // purposeType5Change(event) {
    //     this.purposeType5 = event.detail.value;
    // }
    // purposeType5Change(event) {
    //     this.purposeType5 = event.detail.value;
    // }
    //活动区分选择“合同季报”,【涉及的维修合同】【发放人】【发放方式】必填
    // 活动区分没选择【合同季报】,【发放人】【发放方式】标灰不可填,【涉及的维修合同】不必填
    setReportContractDis() {
        if(this.purposeType1==='合同季报' || this.purposeType2==='合同季报' || this.purposeType3==='合同季报') {
            this.isReportContractDis = false;
            this.isReportContractTypeDis = false;
        } else {
            this.activityObj = {
                            ...this.activityObj,
                            ['Report_Contract__c']: ''
                        };
            this.activityObj = {
                            ...this.activityObj,
                            ['Report_Contract_Type__c']: ''
                        };
            this.requiredReportContract='';
            this.requiredReportContractType='';
            // this.activityObj['Report_Contract_Type__c'] = '';
            this.isReportContractDis = true;
            this.isReportContractTypeDis = true;
        }
    }
    setInfrastructureProjectDis() {
        if(this.purposeType1==='基建项目' || this.purposeType2==='基建项目' || this.purposeType3==='基建项目') {
            this.isInfrastructureProjectDis1 = false;
            this.isInfrastructureProjectDis2 = false;
        } else {
            this.Infrastructure_Project1 = ''
            this.Infrastructure_Project2 = ''
            this.isInfrastructureProjectDis1 = true;
            this.isInfrastructureProjectDis2 = true;
        }
    }
    //点检报告书按钮
    checkReport(event){
        console.log('checkReport');
        this.showSpinner = true;
        if (this.activityObj.InsReport_ID__c) {
            // 点検報告書IDあれば、編集モードに
            var urlStr = '/apex/OFSInsReportLayout?id=' + this.activityObj.InsReport_ID__c;
            window.open(urlStr, '_blank');
            this.showSpinner = false;
        } else {
            if (this.stringIsEmpty(this.filter)) {
                // 訪問場所を設定してください。
                this.showToast('error',this.customLabel.Error_Message16);
                this.showSpinner = false;
                return;
            }
            this.saveTheActivity('checkReport');
        }
    }
    @track OPDId;
    @track currentTypeId;
    //OPD/SIS按钮
    OPD(){
        console.log('OPD按钮');
        var id = this.activityObj.Id;
        var recordName = 'SIS';
        var hiddenId='idOPD_IdHidden';
        var redId = 'idOPD';
        var reportId = this.reportedId;
        this.activityObj = {
            ...this.activityObj,
            ['Opd_Plan__c']: ''
        };
        var _OPDId = this.activityObj.Opd_Plan__c;
        this.currentTypeId = this.activityObj.Opd_Plan__c;
        this.openPDNew('OPDOrSIS',id,recordName,hiddenId,redId,reportId,_OPDId,this.currentTypeId);
    }
    SISET(){
        console.log('SISET按钮');
        var id = this.activityObj.Id;
        var recordName = 'SIS_ET';
        var hiddenId='idOPD_IdHidden';
        var redId = 'idOPD';
        var reportId = this.reportedId;
        this.activityObj = {
            ...this.activityObj,
            ['Opd_Plan__c']: ''
        };
        var _OPDId = this.activityObj.Opd_Plan__c;
        this.currentTypeId = this.activityObj.Opd_Plan__c;
        this.openPDNew('OPDOrSIS',id,recordName,hiddenId,redId,reportId,_OPDId,this.currentTypeId);
    }
    SISENG(){
        console.log('SISENG按钮');
        var id = this.activityObj.Id;
        var recordName = 'SIS_ENG';
        var hiddenId='idOPD_IdHidden';
        var redId = 'idOPD';
        var reportId = this.reportedId;
        this.activityObj = {
            ...this.activityObj,
            ['Opd_Plan__c']: ''
        };
        var _OPDId = this.activityObj.Opd_Plan__c;
        this.currentTypeId = this.activityObj.Opd_Plan__c;
        this.openPDNew('OPDOrSIS',id,recordName,hiddenId,redId,reportId,_OPDId,this.currentTypeId);
    }
    //NTC/CDS按钮 新品装机培训
    NewInstallTarin(){
        console.log('NTC/CDS按钮');
        var id = this.activityObj.Id;
        var recordName = 'NTC';
        // var hiddenId='idNTC_IdHidden';
        var hiddenId='NewInstallTarin';
        var redId = 'idNTC';
        var reportId = this.reportedId;
        this.activityObj = {
            ...this.activityObj,
            ['NTC_ID__c']: ''
        };
        var _OPDId = this.activityObj.Opd_Plan__c;
        this.currentTypeId = this.activityObj.NTC_ID__c;
        this.openPDNew('NTCOrCDS',id,recordName,hiddenId,redId,reportId,_OPDId,this.currentTypeId);
    }
    //故障预防培训
    FaultPreventionTraining(){
        console.log('NTC/CDS按钮');
        var id = this.activityObj.Id;
        var recordName = 'NTC';
        // var hiddenId='idNTC_IdHidden';
        var hiddenId='FaultPreventionTraining';
        var redId = 'idNTC';
        var reportId = this.reportedId;
        this.activityObj = {
            ...this.activityObj,
            ['NTC_ID__c']: ''
        };
        var _OPDId = this.activityObj.Opd_Plan__c;
        this.currentTypeId = this.activityObj.NTC_ID__c;
        this.openPDNew('NTCOrCDS',id,recordName,hiddenId,redId,reportId,_OPDId,this.currentTypeId);
    }
    //售后跟台
    AftermarketHeel(){
        console.log('NTC/CDS按钮');
        var id = this.activityObj.Id;
        var recordName = 'NTC';
        // var hiddenId='idNTC_IdHidden';
        var hiddenId='AftermarketHeel';
        var redId = 'idNTC';
        var reportId = this.reportedId;
        this.activityObj = {
            ...this.activityObj,
            ['NTC_ID__c']: ''
        };
        var _OPDId = this.activityObj.Opd_Plan__c;
        this.currentTypeId = this.activityObj.NTC_ID__c;
        this.openPDNew('NTCOrCDS',id,recordName,hiddenId,redId,reportId,_OPDId,this.currentTypeId);
    }
    @track hiddenDivShowFlg = true;
    openPDNew(type,id, recordName, hiddenId, redId, reportId,_OPDId,currentTypeId) {
        console.log('openPDNew');
        var hiId = currentTypeId;
        var rsflg = this.reportStatusFlg;
        this.hiddenDivShowFlg = false;
        console.log(this.hiddenDivShowFlg);
        console.log(rsflg);
        console.log('event_id:'+hiId);
        if (rsflg === false) {
            if (hiId) {
                let urlStr = '/lightning/r/Event__c/'+hiId+'/view';
                console.log(urlStr);
                window.open(urlStr, "_blank");
                return;
            } else {
                this.showToast('error','无法新建报告书');
                return;
            }
        }
        if (this.reportedDate) {
        }else{
            // 日付を入力してください。
            this.showToast('error',this.customLabel.Error_Message22);
            this.setVisitorPlaceDisabled();
            return;
        }
         //验证报告的时间
        var flag = this.validOther();
        if(!flag){
            return;
        }
        if (this.stringIsEmpty(this.filter)) {
            // 訪問場所を設定してください。
            this.showToast('error',this.customLabel.Error_Message16);
            this.setVisitorPlaceDisabled();
            return;
        }
        if (this.stringIsEmpty(this.purposeType1)) {
            // 活動区分を設定してください。
            this.showToast('error',this.customLabel.Error_Message18);
            this.setVisitorPlaceDisabled();
            return;
        }
        this.tempId = id;
        //2022-4-22 yjk 如果职种是推广,则默认给tempRecordTypeName 将OPD的值改为 赋值 SIS start
        if(this.reportOwner.Job_Category__c === '推广' && recordName === 'OPD'){
            this.tempRecordTypeName = 'SIS';
        }else{
            this.tempRecordTypeName = recordName;
        }
        //2022-4-22 yjk 如果职种是推广,则默认给tempRecordTypeName 将OPD的值改为 赋值 SIS end
        this.tempBtnIdHidden = hiddenId;
        this.tempRedId = redId;
        this.tempReportId = reportId;
        this.OPDId = _OPDId;
        // if ((this.reportOwner.ProfileId !== '00e10000000Y3o5' || this.reportOwner.Batch_User__c !== 'true') &&
        if ((this.reportOwner.Profile.Name !== '系统管理员' || this.reportOwner.Batch_User__c !== 'true') &&
            this.report.Status__c === '承認' &&
            this.reportOwner.Id !== this.reportOwner.ManagerId &&
            this.reportOwner.Id !== this.reportOwner.BuchangApprovalManager__c &&
            this.reportOwner.Id !== this.reportOwner.BuchangApprovalManagerSales__c) {
            // alert('error 1140');
            this.showToast('error','已经批准的日报中,不能新建报告书');
            this.setVisitorPlaceDisabled();
            return;
        }
        // 活動1,2,3 も保存したいです。そしてTriggerにて商談などに情報を積み上げます
        this.saveTheActivity(type);
    }
    openPD(type,recordName,reportId) {
        console.log('openPD');
        console.log(type);
        console.log(this.currentTypeId);
        // j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':' + hiddenId))
        if (this.stringIsEmpty(this.currentTypeId)) {
            console.log('11111111111');
            var reId = reportId;
            var aId = this.filter;
            var rId = '';
            if (recordName == 'OPD' || recordName == 'SIS' || recordName == 'SIS_ET' || recordName == 'SIS_ENG') {
                console.log('xxxx');
                var dtStr = this.reportedDate+'';
                var dt = new Date(dtStr);
                var sTime = new Date(dt.getFullYear(),dt.getMonth(),dt.getDate(),this.beforeHour,this.beforeMinute,0,0);
                var eTime = new Date(dt.getFullYear(),dt.getMonth(),dt.getDate(),this.afterHour,this.afterMinute,0,0);
                // 20210107 SWAG-BX24F5 you start
                console.log(recordName + '==2021==' + this.reportOwner.Job_Category__c);
                // if (this.reportOwner.Job_Category__c == '销售服务') {
                //     console.log('1');
                //     recordName = 'OPD';
                // } else
                if (this.reportOwner.Job_Category__c === '推广' && recordName === 'OPD') {//2022-4-21 yjk 销售推广改为推广
                    console.log('2');
                    //2021/01/27 liying start
                    this.hiddenDivShowFlg = true;
                   // this.showModal = true;
                   this.createOPDSISReport();
                   // this.showSpinner = false;
                   return;
               }else if (this.hiddenDivShowFlg === false) {
                   console.log('3');
                   // 入力チェック完了したら、ここからdivを出す
                   // divから作成する時、hiddenDivShowFlgをtrueにし、報告書作成ロジックへ
                   this.hiddenDivShowFlg = true;
                   console.log('4');
                   // this.showModal = true;
                   this.createOPDSISReport();
                   console.log('5');
                   console.log(this.showModal);
                   // this.showSpinner = false;
                    return;
                }
                console.log(this.hiddenDivShowFlg);
                console.log('4');
                addReportOPWithEvaluationPDF({ repOwnerId: this.reportOwner.Id,
                    dailyReportId: reId,eventId: this.activityObj.Id, recordType: recordName, aId: aId,
                    visitor1: this.contactId1, visitor2: this.contactId2, visitor3: this.contactId3,
                    // visitor4: this.contactId4, visitor5: this.contactId5,
                    opp1: this.Related_Opportunity1_ID,
                    opp2: this.Related_Opportunity2_ID, opp3: this.Related_Opportunity3_ID,
                    // opp4: this.activityObj.Related_Opportunity4_ID__c,opp5: this.activityObj.Related_Opportunity5_ID__c,
                    reportDate: this.reportedDate, sTime: sTime, eTime: eTime})
                    .then(result => {
                        console.log('4-1');
                        rId = result;
                        this.activityObj = {
                            ...this.activityObj,
                            ['OPD_ID__c']: rId
                        };
                        if(recordName == 'SIS' ) {
                             this.activityObj = {
                                ...this.activityObj,
                                ['SIS_FLAG__c']: true
                            };
                        } else if( recordName == 'SIS_ET' ) {
                            this.activityObj = {
                                ...this.activityObj,
                                ['SIS_ET_FLAG__c']: true
                            };
                        } else if(recordName == 'SIS_ENG') {
                            this.activityObj = {
                                ...this.activityObj,
                                ['SIS_ENG_FLAG__c']: true
                            };
                        }
                        this.currentTypeId = rId;
                        this.navaicateUrl();
                    })
                    .catch(error => {
                        console.log('4-2');
                        let errorMessage = "";
                        error.body.pageErrors.forEach(element => {
                            errorMessage += element.message;
                        });
                        this.showToast('error',errorMessage);
                        this.showSpinner = false;
                        console.log('4-2-1');
                    });
            } else if (recordName === 'NTC') {
                console.log('NTC!!!!!');
                if(this.tempBtnIdHidden==='NewInstallTarin'){
                    recordName = 'NewInstallTarin';
                }else if(this.tempBtnIdHidden==='FaultPreventionTraining'){
                    recordName = 'FaultPreventionTraining';
                }else if(this.tempBtnIdHidden==='AftermarketHeel'){ //售后跟台
                    recordName = 'OPD';
                }
                addReportNT({ repOwnerId: this.reportOwner.Id, dailyReportId: reId,
                    eventId: this.activityObj.Id, recordType: recordName, aId: aId, visitor1: this.contactId1, visitor2: this.contactId2,
                    // visitor3: this.contactId3, visitor4: this.contactId4, visitor5: this.contactId5, sTime: sTime, eTime: eTime})
                    visitor3: this.contactId3,  sTime: sTime, eTime: eTime})
                    .then(result => {
                        // console.log('ntc addReportNT result:'+result);
                        rId = result;
                        this.activityObj = {
                            ...this.activityObj,
                            ['NTC_ID__c']: rId
                        };
                        if(recordName == 'NewInstallTarin' ) {
                             this.activityObj = {
                                ...this.activityObj,
                                ['NewInstallTarin_FLAG__c']: true
                            };
                        } else if( recordName == 'FaultPreventionTraining' ) {
                            this.activityObj = {
                                ...this.activityObj,
                                ['FaultPreventionTraining_FLAG__c']: true
                            };
                        } else if(recordName == 'OPD') {
                            this.activityObj = {
                                ...this.activityObj,
                                ['OPD_FLAG__c']: true
                            };
                        }
                        this.currentTypeId = rId;
                        this.navaicateUrl();
                    })
                    .catch(error => {
                        // console.log('ntc addReportNT error:' + error);
                        let errorMessage = "";
                        error.body.pageErrors.forEach(element => {
                            errorMessage += element.message;
                        });
                        this.showToast('error',errorMessage);
                        this.showSpinner = false;
                    });
            }
        }else{
            this.navaicateUrl();
        }
        // this.showSpinner = false;
        console.log('------------------');
    }
    navaicateUrl(){
        this.showSpinner = false;
        console.log('navaicateUrl');
        // var urlStr = '/' + this.currentTypeId + '/e?retURL=%2F' + this.currentTypeId+'&CF00N10000008ps6d_lkid='+this.OPDId;//2022-4-17 yjk
        var urlStr = '/' + this.currentTypeId + '/e?retURL=%2F' + this.currentTypeId+'&Report_OPDPlan__c='+this.OPDId;//2022-4-17 yjk
        console.log(urlStr+'!!!!!!!!!!!!!!!!!!!');
        window.open(urlStr, '_blank');
        this.resetOPDSISRadio();
        this.showModal = false;
    }
    typeChange(event){
        console.log('typeChange');
        this.tempRecordTypeName = event.target.value;
        console.log(this.tempRecordTypeName);
    }
    createOPDSISReport() {
        console.log('createOPDSISReport');
        console.log(this.tempRecordTypeName);
        this.hiddenDivShowFlg = true;
        this.openPD('OPDOrSIS',this.tempRecordTypeName,this.tempReportId);
    }
    closeOPDSISDiv() {
        this.showModal = false;
        this.hiddenDivShowFlg = false;
        resetOPDSISRadio();
    }
    resetOPDSISRadio() {
        if(this.reportOwner.Job_Category__c==='销售推广'){
            this.tempRecordTypeName = 'SIS';
        }else{
            this.tempRecordTypeName = 'OPD';
        }
    }
    //设置所有的按钮和输入框disable
    @api
    setVisitorPlaceDisabled() {
        // this.allDisableFlg = true;
        console.log('setVisitorPlaceDisabled:'+this.allDisableFlg);
        if(this.allDisableFlg){
            this.setNotVisible();
            return;
        }
        this.isPlaceDis=false;
        this.isConDis1=false;
        this.isConDis2=false;
        this.isConDis3=false;
        this.isOppDis1=false;
        this.isOppDis2=false;
        this.isOppDis3=false;
        this.isTransferEtDis=false;
        this.isActivityEtDis=false;
        this.isupdateAccInfoDis=false;
        this.isNewOpdDis=false;
        this.isCheckReportDis=false;
        this.isOPDSISDis=false;
        this.isNTCCDSDis=false;
        this.isNewBuyDis=false;
        this.isOppUpdateDis1=false;
        this.isLoseDis1=false;
        this.isOppUpdateDis2=false;
        this.isLoseDis2=false;
        this.isOppUpdateDis3=false;
        this.isLoseDis3=false;
        this.beforeHourDis = false;
        this.beforeMinuteDis = false;
        this.afterHourDis = false;
        this.afterMinuteDis = false;
        this.visitDis = false;
        this.visitAimDis = false;
        this.Purpose_TypeEscFSEDis = false;
        this.Purpose_TypeEscFSE2Dis = false;
        this.Purpose_TypeEscFSE3Dis = false;
        this.Purpose_TypeFSEDis = false;
        this.Purpose_TypeFSE2Dis = false;
        this.Purpose_TypeFSE3Dis = false;
        this.DescriptionDis = false;
        this.Find_Imitations_FlagDis = false;
        this.cancelReasonSelectDis = false;
        this.cancelReasonSelectFSEDis = false;
        this.cancelReasonOtherDis = false;
        this.delayReasonSelectDis = false;
        this.delayReasonSelectFSEDis = false;
        this.delayReasonOtherDis = false;
        this.delayToDateDis = false;
        this.cancelsaveJSDis = false;
        this.delaysaveJSDis = false;
        this.isUseReportDis = false;
        this.isRelatedServiceDis = false;
        this.isAccDis = false;
        this.saveDis = false;
        console.log(this.visit);
        if(this.visit === '病院'){//用户拜访
            console.log('1');
        }else if(this.visit === '販売店'){//经销商拜访
            console.log('2');
            this.isConDis1 = true;
            this.isConDis2 = true;
            this.isConDis3 = true;
            this.isTransferEtDis = true;
            this.isActivityEtDis = true;
            this.isupdateAccInfoDis = true;
            this.isNewOpdDis = true;
            this.isCheckReportDis = true;
            this.isOPDSISDis = true;
            this.isNTCCDSDis = true;
            this.isNewBuyDis = true;
            this.isRelatedServiceDis = true;
        }else if(this.visit === '社内活動'){//公司工作
            console.log('3');
            this.isConDis1 = true;
            this.isConDis2 = true;
            this.isConDis3 = true;
            this.isOppDis1 = true;
            this.isOppDis2 = true;
            this.isOppDis3 = true;
            this.isNewBuyDis = true;
            this.isNewOpdDis = true;
            this.isCheckReportDis = true;
            this.isTransferEtDis = true;
            this.isActivityEtDis = true;
            this.isupdateAccInfoDis = true;
            this.isRelatedServiceDis = true;
        }else if(this.visit === '社外イベント'){//学术会议
            console.log('4');
            this.isConDis1 = true;
            this.isConDis2 = true;
            this.isConDis3 = true;
            this.isOppDis1 = true;
            this.isOppDis2 = true;
            this.isOppDis3 = true;
            this.isTransferEtDis = true;
            this.isActivityEtDis = true;
            this.isupdateAccInfoDis = true;
            this.isNewOpdDis = true;
            this.isCheckReportDis = true;
            this.isOPDSISDis = true;
            this.isNTCCDSDis = true;
            this.isNewBuyDis = true;
            this.isRelatedServiceDis = true;
        }else{
            console.log('5');
            console.log(this.reportReportFlg);
            //访问场所
            this.isPlaceDis = true;
            this.isAccDis = true;
            //访问对象
            this.isConDis1 = true;
            this.isConDis2 = true;
            this.isConDis3 = true;
            //涉及的询价
            this.isOppDis1 = true;
            this.isOppDis2 = true;
            this.isOppDis3 = true;
            //转至ET App按钮
            this.isTransferEtDis = true;
            //ET App活动按钮
            this.isActivityEtDis = true;
            //更新客户信息按钮
            this.isupdateAccInfoDis = true;
            //新建OPD计划按钮
            this.isNewOpdDis = true;
            //点检报告书按钮
            this.isCheckReportDis = true;
            //OPD/SIS按钮
            this.isOPDSISDis = true;
            //NTC/CDS按钮
            this.isNTCCDSDis = true;
            //新建购买意向按钮
            this.isNewBuyDis = true;
            //维修合同
            this.isRelatedServiceDis = true;
        }
        this.setReportContractDis();
        this.setInfrastructureProjectDis();
        // if(this.isOppDis1===true||this.stringIsEmpty(this.activityObj.Related_Opportunity1_ID__c)){
        if(this.isOppDis1===true||this.stringIsEmpty(this.Related_Opportunity1_ID)){
            //询价更新按钮
            this.isOppUpdateDis1 = true;
            //失单按钮
            this.isLoseDis1 = true;
        }else{
            this.isOppUpdateDis1 = false;
            this.isLoseDis1 = false;
        }
        if(this.isOppDis2===true||this.stringIsEmpty(this.Related_Opportunity2_ID)){
            //询价更新按钮
            this.isOppUpdateDis2 = true;
            //失单按钮
            this.isLoseDis2 = true;
        }else{
            this.isOppUpdateDis2 = false;
            this.isLoseDis2 = false;
        }
        if(this.isOppDis3===true||this.stringIsEmpty(this.Related_Opportunity3_ID)){
            //询价更新按钮
            this.isOppUpdateDis3 = true;
            //失单按钮
            this.isLoseDis3 = true;
        }else{
            this.isOppUpdateDis3 = false;
            this.isLoseDis3 = false;
        }
        if (!this.isNotSalesService) {
            //合同点检的不需要信息更新
            if(this.activityObj.Related_Service1_ID__c){
                if(this.purposeType1==='合同季报'){
                    this.isInfoUpdateDis = false;
                }
            }
        }
        //如果没得报告书权限
        if(this.reportReportFlg){
            if(!this.isOPDSISDis){
                this.isOPDSISDis = true;
            }
            if(!this.isNTCCDSDis){
                this.isNTCCDSDis = true;
            }
        }
        this.checkVisitChange();
        this.initDelayAndCancel();
        //如果报告一览的有值,所有输入信息不准更改
        // if(!this.stringIsEmpty(this.activityObj.eventStatus__c) && !this.readReportFlag){
        if(!this.stringIsEmpty(this.activityObj.eventStatus__c) ){
            console.log('如果报告一览的状态有值,所有输入信息不准更改');
            this.isPlaceDis = true;
            this.isConDis1 = true;
            this.isConDis2 = true;
            this.isConDis3 = true;
            this.isOppDis1 = true;
            this.isOppDis2 = true;
            this.isOppDis3 = true;
            this.beforeHourDis = true;
            this.beforeMinuteDis = true;
            this.afterHourDis = true;
            this.afterMinuteDis = true;
            this.visitDis = true;
            this.visitAimDis = true;
            this.Purpose_TypeEscFSEDis = true;
            this.Purpose_TypeEscFSE2Dis = true;
            this.Purpose_TypeEscFSE3Dis = true;
            this.Purpose_TypeFSEDis = true;
            this.Purpose_TypeFSE2Dis = true;
            this.Purpose_TypeFSE3Dis = true;
            this.DescriptionDis = true;
            this.Find_Imitations_FlagDis = true;
            this.cancelReasonSelectDis = true;
            this.cancelReasonSelectFSEDis = true;
            this.cancelReasonOtherDis = true;
            this.delayReasonSelectDis = true;
            this.delayReasonSelectFSEDis = true;
            this.delayReasonOtherDis = true;
            this.delayToDateDis = true;
            this.cancelsaveJSDis = true;
            this.delaysaveJSDis = true;
            this.isUseReportDis = true;
            this.isRelatedServiceDis = true;
            this.isAccDis = true;
            this.isupdateAccInfoDis = true;
            this.isNewBuyDis = true;
            this.isNewOpdDis = true;
            this.isOPDSISDis = true;
            this.isTransferEtDis = true;
            this.isActivityEtDis = true;
            this.isCheckReportDis = true;
            this.isNTCCDSDis = true;
            this.isReportContractDis = true;
            this.isReportContractTypeDis = true;
            this.isInfrastructureProjectDis1 = true;
            this.isInfrastructureProjectDis2 = true;
        }
        console.log('setVisitorPlaceDisabled 结束');
    }
    @api
    setNotVisible(){
        console.log('activeConten setNotVisible1');
        // const allInputsAndButtons = this.template.querySelectorAll('lightning-input, lightning-button,lightning-input-field');
        // allInputsAndButtons.forEach(element => {
        //     element.disabled = true;
        // });
        // this.isAccDis = true;
        // this.isConDis1 = true;
        // this.isConDis2 = true;
        // this.isConDis3 = true;
        this.isPlaceDis=true;
        this.isConDis1=true;
        this.isConDis2=true;
        this.isConDis3=true;
        this.isOppDis1=true;
        this.isOppDis2=true;
        this.isOppDis3=true;
        this.isTransferEtDis=true;
        this.isActivityEtDis=true;
        this.isupdateAccInfoDis=true;
        this.isNewOpdDis=true;
        this.isCheckReportDis=true;
        this.isOPDSISDis=true;
        this.isNTCCDSDis=true;
        this.isNewBuyDis=true;
        this.isOppUpdateDis1=true;
        this.isLoseDis1=true;
        this.isOppUpdateDis2=true;
        this.isLoseDis2=true;
        this.isOppUpdateDis3=true;
        this.isLoseDis3=true;
        this.beforeHourDis = true;
        this.beforeMinuteDis = true;
        this.afterHourDis = true;
        this.afterMinuteDis = true;
        this.visitDis = true;
        this.visitAimDis = true;
        this.Purpose_TypeEscFSEDis = true;
        this.Purpose_TypeEscFSE2Dis = true;
        this.Purpose_TypeEscFSE3Dis = true;
        this.Purpose_TypeFSEDis = true;
        this.Purpose_TypeFSE2Dis = true;
        this.Purpose_TypeFSE3Dis = true;
        this.DescriptionDis = true;
        this.Find_Imitations_FlagDis = true;
        this.cancelReasonSelectDis = true;
        this.cancelReasonSelectFSEDis = true;
        this.cancelReasonOtherDis = true;
        this.delayReasonSelectDis = true;
        this.delayReasonSelectFSEDis = true;
        this.delayReasonOtherDis = true;
        this.delayToDateDis = true;
        this.cancelsaveJSDis = true;
        this.delaysaveJSDis = true;
        this.isUseReportDis = true;
        this.isRelatedServiceDis = true;
        this.isAccDis = true;
        this.isInfrastructureProjectDis1 = true;
        this.isInfrastructureProjectDis2 = true;
        this.saveDis = true;
        console.log('this.beforeHourDis:' + this.beforeHourDis);
    }
    @api
    setVisible(){
        console.log('activeContent setVisible 1424');
        // const allInputsAndButtons = this.template.querySelectorAll('lightning-input, lightning-button,lightning-input-field');
        // allInputsAndButtons.forEach(element => {
        //     element.disabled = false;
        // });
        this.isPlaceDis=false;
        this.isConDis1=false;
        this.isConDis2=false;
        this.isConDis3=false;
        this.isOppDis1=false;
        this.isOppDis2=false;
        this.isOppDis3=false;
        this.isTransferEtDis=false;
        this.isActivityEtDis=false;
        this.isupdateAccInfoDis=false;
        this.isNewOpdDis=false;
        this.isCheckReportDis=false;
        this.isOPDSISDis=false;
        this.isNTCCDSDis=false;
        this.isNewBuyDis=false;
        this.isOppUpdateDis1=false;
        this.isLoseDis1=false;
        this.isOppUpdateDis2=false;
        this.isLoseDis2=false;
        this.isOppUpdateDis3=false;
        this.isLoseDis3=false;
        this.beforeHourDis = false;
        this.beforeMinuteDis = false;
        this.afterHourDis = false;
        this.afterMinuteDis = false;
        this.visitDis = false;
        this.visitAimDis = false;
        this.Purpose_TypeEscFSEDis = false;
        this.Purpose_TypeEscFSE2Dis = false;
        this.Purpose_TypeEscFSE3Dis = false;
        this.Purpose_TypeFSEDis = false;
        this.Purpose_TypeFSE2Dis = false;
        this.Purpose_TypeFSE3Dis = false;
        this.DescriptionDis = false;
        this.Find_Imitations_FlagDis = false;
        this.cancelReasonSelectDis = false;
        this.cancelReasonSelectFSEDis = false;
        this.cancelReasonOtherDis = false;
        this.delayReasonSelectDis = false;
        this.delayReasonSelectFSEDis = false;
        this.delayReasonOtherDis = false;
        this.delayToDateDis = false;
        this.cancelsaveJSDis = false;
        this.delaysaveJSDis = false;
        this.isUseReportDis = false;
        this.isRelatedServiceDis = false;
    }
    //更新客户信息
    updateAccInfo(){
        if(this.filter){
            //查询该访问场所的战略科室分类
            queryDepartmentClass({ accId: this.filter})
                .then(result => {
                    if(result){
                        var urlStr = '/' + result;
                        window.open(urlStr,'_blank','');
                    }else{
                        this.showToast('error','该访问场所没有战略科室分类');
                    }
                })
                .catch(error => {
                    let errorMessage = "";
                    error.body.pageErrors.forEach(element => {
                        errorMessage += element.message;
                    });
                    this.showToast('error','失败,'+errorMessage);
                });
        }else{
            this.showToast('error','请先选择访问场所');
        }
    }
      // 2018/11/21 SWAG-B6Q8BS 判断是否需要弹窗更新客户信息 start
    // 2018/11/21 SWAG-B6Q8BS 初始化设置颜色使用
    @api
    setColor(){
        // var ProfileId_2S1 = '{!$Label.ProfileId_2S1}';
        // var salesman2S1_Price = '{!$Label.salesman2S1_Price}';
        // var completionFlg = '{!completionFlg}';
        //2S1_销售医院担当 和 2S1_销售医院担当(查看价格)
        // if("{!$Profile.Id}" != ProfileId_2S1 && "{!$Profile.Id}" != salesman2S1_Price){
        //     return;
        // }
        if(this.reportOwner.ProfileId!=this.ProfileId_2S1 && this.reportOwner.ProfileId!=this.salesman2S1_Price) {
            return false;
        } else {
            this.updateAccInfoColor = this.activityObj.IsAlertInputDep__c;
            return this.activityObj.IsAlertInputDep__c;
        }
        // var actSize =  '{!actSize}';
        // var alertflg = false;
        //  for(var i = 0;i<actSize; i++){
        //     var TempElement =  document.getElementById("Page:mainForm:idDayEdit:idActivities:"+ i +":alertStringValue");
        //     var IsAlertInputDep = 'false';
        //     if( TempElement != null && TempElement != undefined ){
        //         IsAlertInputDep = TempElement.value;
        //         TempElement.value ='false';
        //     }
        //     if(IsAlertInputDep == 'true'){
        //         TempElement = document.getElementById("Page:mainForm:idDayEdit:idActivities:"+ i +":idVisitorPlace");
        //         if(TempElement != null && TempElement != undefined ){
        //             TempElement.style.color ='red';
        //             alertflg = true;
        //         }
        //     }
        // }
        // if(alertflg ==true && typeof completionFlg != "undefined" && completionFlg != null && completionFlg != ""){
        //     alert('拜访H层客户时,请注意收集病例数信息,按"更新客户信息"按钮登录');
        // }
    }
    // 2018/11/21 SWAG-B6Q8BS 判断是否需要弹窗更新客户信息 end
    //转至ET APP
    toETAPP(){
        console.log('toETAPP');
        if(window.confirm('请先保存日报再跳转。日报是否已经保存?')){
            if(this.filter){
                //查询该访问场所的医院(科室)
                queryHospital({ accId: this.filter})
                .then(result => {
                    console.log('11111111111111111');
                    console.log('queryHospital.result:'+result);
                    if(result){
                        var urlStr = 'ocsmet://Activity/' + result;
                        console.log(urlStr);
                        window.open(urlStr, '_blank', '');
                    }else{
                        this.showToast('error','该访问场所没有医院(科室)');
                    }
                })
                .catch(error => {
                    let errorMessage = "";
                    error.body.pageErrors.forEach(element => {
                        errorMessage += element.message;
                    });
                    this.showToast('error','失败,'+errorMessage);
                });
            }else{
                this.showToast('error','没有选择医院,不能跳转');
            }
        }
    }
    //ET APP活动
    ETAPPAct(){
        if(this.filter && this.filter.startsWith("001")){
            var urlStr = '/apex/productsh?Id=' + this.filter;
            window.open(urlStr, '_blank', '');
            //查询该访问场所的战略科室分类
            // queryDepartmentClass({ accId: this.filter})
            //     .then(result => {
            //         if(result){
            //             var urlStr = '/' + result;
            //             window.open(urlStr,'_blank');
            //         }else{
            //             this.showToast('error','该访问场所没有战略科室分类');
            //         }
            //     })
            //     .catch(error => {
            //         let errorMessage = "";
            //         error.body.pageErrors.forEach(element => {
            //             errorMessage += element.message;
            //         });
            //         this.showToast('error','失败,'+errorMessage);
            //     });
        }else{
            this.showToast('error','请先选择访问场所');
        }
    }
    //访问场所不允许修改
    vpChack1() {
        console.log('vpChack1');
        console.log(!this.stringIsEmpty(this.filter));
        console.log(!this.stringIsEmpty(this.activityObj.Event_ID__c));
        if(!this.stringIsEmpty(this.filter)&&!this.stringIsEmpty(this.activityObj.Event_ID__c)){
            this.isAccDis = true;
        }
        if(!this.stringIsEmpty(this.visit)&&!this.stringIsEmpty(this.activityObj.Event_ID__c)){
            this.visitDis = true;
        }
        if (this.reportOwner.Job_Category__c === '销售服务') {
            var puroposeTypeFSE1 = this.activityObj.Purpose_TypeFSE__c;
            if ((puroposeTypeFSE1 === '合同季报'||puroposeTypeFSE1 === '合同点检') && !this.stringIsEmpty(this.activityObj.Event_ID__c)) {
                this.Purpose_TypeFSEDis = true;
                this.visitAimDis = true;
                this.isRelatedServiceDis = true;
            }
        }
    }
    setRelOppId(index, id, hiddenId){
        var str = 'Page:mainForm:idDayEdit:idActivities:'+ index + ':' + id;
        var strPD = 'Page:mainForm:idDayEdit:idActivities:'+ index + ':idVisitorPlace';
        var aNamePD = j$(escapeVfId(strPD)).value();
        if(aNamePD == ''){
            // 訪問場所を設定してください。
            document.getElementById(str).blur();
            alert(Error_Message16);
            return;
        }
        var strVP = 'Page:mainForm:idDayEdit:idActivities:'+ index + ':idVisitorPlaceId';
        var vl = j$(escapeVfId(strVP)).value();
        if(vl.length == 0){
            // 訪問場所が存在しません。
            document.getElementById(str).blur();
            alert(Error_Message15);
            return;
        }
        var match = sforce.apex.execute("Add_Report","checkAccountMatch",{name:aNamePD,id:vl});
        if(match == "NG"){
            // 訪問場所IDマッチしていない
            document.getElementById(str).blur();
            alert("无法确定访问场所,请再设定一次访问场所。");
            return;
        }
        var strPage = '/apex/Xin_SearchOpportunity?r=' + encodeURI(vl);
        jQuery(escapeVfId(str)).unbind();
        jQuery(escapeVfId(str)).suggest(strPage,{});
        //DoubleTapイベントをbind
        bindDoubleTap(index, id, hiddenId);
    }
    //询价更新按钮
    oppUpdate(event){
        var indexNumber = event.target.name;
        var oppId = '';
        if(indexNumber==='1'){
            // oppId = this.activityObj.Related_Opportunity1_ID__c;
            oppId = this.Related_Opportunity1_ID;
        }else if(indexNumber==='2'){
            oppId = this.Related_Opportunity2_ID;
        }else if(indexNumber==='3'){
            oppId = this.Related_Opportunity3_ID;
        }
        window.open("/apex/EnquiryDetails?EsetId="+oppId+"&indexNumber="+indexNumber,'_blank','width=850px,height=520px');
    }
    //失单按钮
    loseOpp(event){
        var indexNumber = event.target.name;
        var oppId = '';
        if(indexNumber==='1'){
            // oppId = this.activityObj.Related_Opportunity1_ID__c;
            oppId = this.Related_Opportunity1_ID;
        }else if(indexNumber==='2'){
            oppId = this.Related_Opportunity2_ID;
        }else if(indexNumber==='3'){
            oppId = this.Related_Opportunity3_ID;
        }
        // window.open('/apex/PCLLostReportPageLwc?pageStatus=Create&oppId=' + oppId + '&lostType=失单','_blank');
        window.open('/lightning/n/PCLLostReportPageLwc#pageStatus=Create&oppId=' + oppId + '&lostType=失单','_blank');
    }
    //新建购买意向按钮
    addLeadNew(index, eid) {
        console.log('addLeadNew');
        this.showSpinner = true;
        if (this.stringIsEmpty(this.filter)) {
            // 訪問場所を設定してください。
            this.showToast('error',this.customLabel.Error_Message16);
            this.showSpinner = false;
        }
        this.saveTheActivity('addLeadNew');
    }
    addLead() {
        console.log('addLead');
        var eid = this.activityObj.Id;
        var accountRecord = this.activityObj.Account_ID__c;
        var visitor1 = this.contactId1;
        var result = this.activityObj.Description__c;
        var dcId;
        var accName;
        var contactName;
        var contactAwsId = '';
        // if(visitor1 != null && visitor1 != ''){
        //     getContactAwsIdByCOntactId({contactId : visitor1})
        //     .then(result => {
        //         console.log('getContactAwsIdByCOntactId:'+result);
        //         contactAwsId = result;
        //     });
        // }
        queryAbountIndo({ accId: this.filter,contactId : visitor1})
        .then(result => {
            if(result){
                this.showSpinner = false;
                contactAwsId = result.awsId;
                // console.log(JSON.stringify(result));
                console.log('queryAbountIndo:');
                dcId = result.acc.Department_Class__c;
                accName = result.acc.Name;
                contactName = result.con.Name;
                console.log('queryAbountIndo agencyContactName');
                console.log(this.agencyContactName);
                // const visitorComponents = this.template.querySelectorAll('c-look-up-util');
                // if (visitorComponents.length > 0) {
                // visitorComponents.forEach(visitorComponent => {
                //     if(visitorComponent['uniqueKey'] =='AgencyContact1') {
                //         visitorComponent.handleRemovePill();
                //     }
                // });
            // }
                // contactName = result.contact.Name;
                console.log('/lightning/o/Lead/new?defaultFieldValues=Name=1111,Hospital_Name__c='+this.filter
                +',Description='+this.activityObj.Description__c+',Department_Class__c='+dcId+
                ',Company='+encodeURI(accName)+',Contact_Name__c='+visitor1+',awsDataId='+contactAwsId+',newLeadRecordType' +this.newLeadRecordType);
                window.open('/lightning/o/Lead/new?defaultFieldValues=Name='+contactName+',Hospital_Name__c='+this.filter
                                +',Description='+this.activityObj.Description__c+',Department_Class__c='+dcId+
                                ',Company='+encodeURI(accName)+
                                ',Contact_Name__c='+visitor1+',contactName='+contactName+',awsDataId='+contactAwsId+',RecordTypeId='+this.newLeadRecordType, '_blank');
                // newLeadRecordType
                // const defaultLeadValues = encodeDefaultFieldValues({
                //     Hospital_Name__c: this.filter,
                //     Description: this.activityObj.Description__c,
                //     Department_Class__c: dcId,
                //     Company: accName,
                //     Contact_Name__c: visitor1,
                //     RecordTypeId: this.newLeadRecordType,
                //     Name: '111'
                // });
                // this[NavigationMixin.Navigate]({
                //     type: 'standard__objectPage',
                //     attributes: {
                //         objectApiName: 'Lead',
                //         actionName: 'new'
                //     },
                //     state: {
                //         // nooverride: '1',
                //         defaultFieldValues: defaultLeadValues,
                //         recordTypeId: this.newLeadRecordType
                //     }
                // });
            }
        })
        .catch(error => {
            let errorMessage = "";
            error.body.pageErrors.forEach(element => {
                errorMessage += element.message;
            });
            this.showToast('error','失败,'+errorMessage);
            this.showSpinner = false;
        });
        // const defaultFieldValues =  encodeDefaultFieldValues({
        //     Hospital_Name__c: this.filter,
        //     Description: this.activityObj.Description__c,
        //     Contact_Name__c: visitor1,
        // });
        // const pageReference = {
        //     type: 'standard__objectPage',
        //     attributes: {
        //         objectApiName: 'Lead',
        //         actionName: 'new'
        //     },
        //     state: {
        //         // defaultFieldValues: JSON.stringify(defaultFieldValues)
        //         defaultFieldValues: defaultFieldValues
        //     }
        // };
        // this[NavigationMixin.Navigate](pageReference);
    }
    //延期按钮
    delaysaveJS() {
        console.log('delaysaveJS');
        var lastDate = this.activityObj.Finish_Date__c;
        var repd = new Date(this.reportedDate+'');
        var reod = this.activityObj.delayReasonOther__c;
        var reodfse = this.activityObj.delayReasonSelectFSE__c;
        var reodesc = this.activityObj.delayReasonSelect__c;
        var dlyd = '';
        if(this.activityObj.delayToDate__c) {
            dlyd = new Date(this.activityObj.delayToDate__c+'');
        }
        //获取拜访区分
        var visitQFV = this.activityObj.Activity_Type2__c;
        if (this.stringIsEmpty(reodfse) && this.stringIsEmpty(reodesc)) {
            this.showToast('error','请填写延期理由。');
            return;
        }
        if (reodfse === '其他' || reodesc === '其他') {
            if (this.stringIsEmpty(reod)) {
                this.showToast('error','延期理由为其他,请补充其他原因');
                return;
            }
        }
        console.log('-------------------');
        if (this.stringIsEmpty(dlyd)) {
            this.showToast('error','请填写延期日期。');
            return;
        }
        if (this.stringIsEmpty(this.activityObj.Event_ID__c)) {
            this.showToast('error','手动创建的日报明细不支持延期。');
            return;
        } else {
            console.log('11111111111111111');
            console.log(repd);
            var repyear = repd.getFullYear();
            console.log('x');
            var repmonth = repd.getMonth();
            var repday = repd.getDate();
            var dlyyear = dlyd.getFullYear();
            var dlymonth = dlyd.getMonth();
            var dlyday = dlyd.getDate();
            console.log('222222222222');
            var today = new Date();
            console.log('333333333333');
            console.log(this.activityObj.taskDifferent__c);
            console.log(today);
            if ((repyear == dlyyear && repmonth == dlymonth) || (repyear == dlyyear && dlymonth == repmonth + 1) || (repyear + 1 == dlyyear && dlymonth == 1)) {
                if (repyear == dlyyear && repmonth == dlymonth && repday >= dlyday) {
                    this.showToast('error','不能延期到本月之前的日期。');
                    return;
                }else if(today >= dlyd){
                    this.showToast('error','延期日期必须填写今天之后的日期。');
                    return;
                } else if (this.stringIsEmpty(this.activityObj.taskDifferent__c)) {
                    if (visitQFV === '販売店' && visitQFV === '病院' && visitQFV === '社外イベント') {
                        this.showToast('error','手动创建的日报明细不支持延期。请取消。');
                        return;
                    } else {
                        if (window.confirm('您是否要延期日历上的活动?')) {
                            this.ifDelayJS();
                        }
                    }
                } else if (this.activityObj.taskDifferent__c === '主动任务' && this.activityObj.delayTaskDelay__c) {
                    if (window.confirm('您是否要延期日历上的活动?')) {
                        this.ifDelayJS();
                    }
                } else if (this.activityObj.taskDifferent__c === '主动任务' && this.activityObj.delayTaskDelay__c && repmonth !== dlymonth) {
                    this.showToast('error','主动任务只能延期到本月。');
                    return;
                } else if (this.activityObj.taskDifferent__c === '被动任务' ||this.activityObj.taskDifferent__c === '上级分配任务') {
                //2021-10-13  mzy  任务管理改善   end
                    if (dlyd > lastDate) {
                        this.showToast('error','只能延期到' + lastDate + '之前的日期');
                        return;
                    } else {
                        if (window.confirm('您是否要延期日历上的活动?')) {
                            this.ifDelayJS();
                        }
                    }
                } else {
                    if (window.confirm('您是否要延期日历上的活动?')) {
                        this.ifDelayJS();
                    }
                }
            } else {
                this.showToast('error','只能延期到本月或者下个月。');
                return;
            }
        }
        this.showSpinner = false;
    }
    ifDelayJS(){
        this.showSpinner = true;
        console.log('ifDelayJS');
        // 延期必须是作成中才可以延期。
        if(this.report.Status__c == '作成中'){
            if (this.report.Status_With_Check__c !== '草案中') {
                this.showToast('error','只能延期到草案中的日报。');
                return;
            }
            this.activityObj = {
                ...this.activityObj,
                ['eventStatus__c']: '延期'
            };
            this.saveTheActivity('延期');
        }
    }
    initDelayAndCancel(){
        //任务区分
        var valTaskDifferent = this.activityObj.taskDifferent__c;
        //用户Job
        if(this.activityObj.taskId__c){
            //任务状态为 完成 ,则 不可以修改
            var valTaskStatus  =  this.activityObj.backEventStatus__c;
            //存在,判断是否为上级分配任务 ,是否为完成
            if(valTaskDifferent === '上级分配任务' ||valTaskStatus === '03 完成'){
                this.cancelReasonSelectDis = true;
                this.cancelReasonSelectFSEDis = true;
                this.cancelReasonOtherDis = true;
                this.delayReasonSelectDis = true;
                this.delayReasonSelectFSEDis = true;
                this.delayReasonOtherDis = true;
                this.delayToDateDis = true;
                this.cancelsaveJSDis = true;
                this.delaysaveJSDis = true;
            }
        }
    }
    //取消按钮
    cancelsaveJS(index, eventid) {
        console.log("cancelsaveJS");
        this.showSpinner = true;
        var celd = this.activityObj.cancelReasonSelectFSE__c;
        var celd1 = this.activityObj.cancelReasonSelect__c;
        var celrd = this.activityObj.cancelReasonOther__c;
        var celOPDbox2 = this.activityObj.OPDPlan_Flag__c;
        if (celOPDbox2) {
            if (window.confirm('该医院的OPD计划是否确认取消?如需改期,请选择延期及理由或进入OPD计划进行延期。') == false) {
                this.showSpinner = false;
                return;
            } else{
                this.showSpinner = false;
            }
        }
        if (this.stringIsEmpty(celd)&& this.stringIsEmpty(celd1)) {
            this.showToast('error','请填写取消理由。');
            this.showSpinner = false;
            return;
        } else if (celd === '其他' || celd1 === '其他') {
            if (!celrd) {
                this.showToast('error','取消原因为其他,请补充其他原因。');
                this.showSpinner = false;
                return;
            }
        }
        if (window.confirm('您是否要取消日历上的活动?')) {
            this.activityObj = {
                ...this.activityObj,
                ['eventStatus__c']: '取消'
            };
            this.saveTheActivity('取消');
        } else{
            this.showSpinner = false;
        }
    }
    stringIsEmpty(str) {
        if (str === '' || str === undefined || str === null) {
            return true;
        } else {
            return false;
        }
    }
    // showToast(variant,mes) {
    //     const event = new ShowToastEvent({
    //         message: mes,
    //         variant: variant,
    //     });
    //     this.dispatchEvent(event);
    // }
    showToast(type,msg) {
        if(type == 'success'){
            const event = new ShowToastEvent({
                message: msg,
                variant: type
            });
            this.dispatchEvent(event);
        }else{
            const event = new ShowToastEvent({
                message: msg,
                variant: type,
                mode: 'sticky'
            });
            this.dispatchEvent(event);
        }
    }
}
force-app/main/default/lwc/activeContent/activeContent.js-meta.xml
New file
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>57.0</apiVersion>
    <isExposed>false</isExposed>
</LightningComponentBundle>
force-app/main/default/lwc/improvedForecastTime/improvedForecastTime.js
@@ -280,6 +280,7 @@
                    this.dispatchEvent(closeEvent);
                }else{
                    this.showToast(response,"error");
                    this.IsLoading = false;
                }
            });
        }
force-app/main/default/lwc/lexCancelReport/lexCancelReport.js
@@ -10,6 +10,7 @@
import ConSent from '@salesforce/apex/BidAnnouncementController.ConSent';
import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
import {loadStyle} from 'lightning/platformResourceLoader';
import queryCancelReport  from '@salesforce/apex/OpportunityLightingButtonController.queryCancelReport';
export default class LexCancelReport extends NavigationMixin(LightningElement) {
    @api recordId;
    stageName;
@@ -26,6 +27,7 @@
    salesOwnerBuchang;
    salesOwnerBuchangID;
    recordTypeId;
    haveLostReport;
    IsLoading = true;
    @wire(CurrentPageReference)
    getStateParameters(currentPageReference) {
@@ -65,7 +67,13 @@
            this.salesOwnerBuchang = result.salesOwnerBuchang == undefined ? '' : result.salesOwnerBuchang;
            this.salesOwnerBuchangID = result.salesOwnerBuchangID == undefined ? '' : result.salesOwnerBuchangID;
            this.recordTypeId = result.recordTypeId;
            queryCancelReport({
                recordId: this.recordId
            }).then(result=>{
                this.haveLostReport = result;
            this.cancelReport();
            });
        }).catch(error=>{
            console.log("error");
            console.log(error);
@@ -110,7 +118,7 @@
            else if (this.sapSendOK == '1') {
                this.showToast("已经上传SAP、不能做 取消 了!","error");
            }
            else if (this.cntLostCancelReport - this.cntLostCancelDraft > 0) {
            else if (this.haveLostReport) {
                this.showToast("询价已经有 取消/失单报告 了!","error");
            }
            else if (this.jobCategory == '支援') {
force-app/main/default/lwc/lexCreateEvent/lexCreateEvent.js
@@ -4,7 +4,7 @@
 * @Author: chen jing wu
 * @Date: 2023-04-13 13:50:23
 * @LastEditors: chen jing wu
 * @LastEditTime: 2023-10-10 17:34:10
 * @LastEditTime: 2023-10-18 21:03:42
 */
import { api, wire,LightningElement } from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
@@ -45,18 +45,10 @@
        })
    }
    createEvent(){
        this[NavigationMixin.Navigate]({
            type: 'standard__objectPage',
            attributes: {
                objectApiName: 'Event',
                actionName: 'new'
            },
            state: {
                // retURL: '/apex/VFClosePage',
                accid: this.accountId,
                oid: this.recordId
            }
        });
        window.open(
            "/apex/SimpleEventRegister?retURL=%2Fapex%2FVFClosePage&accid="
            + this.accountId + "&oid="
            + this.recordId + "&source=AccountPCL&save_new=1&sfdc.override=1");
        this.dispatchEvent(new CloseActionScreenEvent());
    }
    showToast(msg,type) {
force-app/main/default/lwc/lexEditCancelReport/lexEditCancelReport.js
@@ -4,7 +4,7 @@
 * @Author: chen jing wu
 * @Date: 2023-09-11 10:34:37
 * @LastEditors: chen jing wu
 * @LastEditTime: 2023-09-26 09:29:28
 * @LastEditTime: 2023-10-18 11:43:59
 */
import { LightningElement, track, wire, api } from 'lwc';
import {CurrentPageReference} from 'lightning/navigation';
@@ -55,5 +55,7 @@
                nooverride: '1'
            }
        });
        this.IsLoading = false;
        this.dispatchEvent(new CloseActionScreenEvent());
    }
}
force-app/main/default/lwc/lexEnquiryNoBidding/lexEnquiryNoBidding.html
@@ -4,11 +4,10 @@
 * @Author: chen jing wu
 * @Date: 2023-09-09 13:27:59
 * @LastEditors: chen jing wu
 * @LastEditTime: 2023-09-23 12:24:56
 * @LastEditTime: 2023-10-18 17:02:07
-->
<template>
    <div class="lexCreateEventReportHolder" if:true={IsLoading}>
        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
    <div if:true={flag}>
        <c-t-enquiry-no-bidding oncloseaction={handleChildEvent} -param-o-id-str={recordId}></c-t-enquiry-no-bidding>
    </div>
</template>
force-app/main/default/lwc/lexEnquiryNoBidding/lexEnquiryNoBidding.js
@@ -4,9 +4,9 @@
 * @Author: chen jing wu
 * @Date: 2023-04-21 14:11:57
 * @LastEditors: chen jing wu
 * @LastEditTime: 2023-04-21 14:15:55
 * @LastEditTime: 2023-10-19 14:03:43
 */
import { api, wire,LightningElement } from 'lwc';
import { api, wire,LightningElement, track } from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
@@ -27,8 +27,13 @@
          }
        }
    }
    connectedCallback(){
        window.open ('/apex/EnquiryNoBiddingPage?oid=' + this.recordId, 'height=350, width=600, top=200, left=350,location=no');
    handleChildEvent(){
      console.log('close');
        this.dispatchEvent(new CloseActionScreenEvent());
    }
    @track flag = false;
    connectedCallback(){
        this.flag = true;
        // this.dispatchEvent(new CloseActionScreenEvent());
    }
}
force-app/main/default/lwc/lexFollowUpHistory/lexFollowUpHistory.html
New file
@@ -0,0 +1,9 @@
<template>
    <div class="Holder" style="
    position: relative;
    width:100%;
    height:200px;
    --sds-c-progress-ring__stroke-color: #0070d2;">
        <lightning-spinner alternative-text="Loading" size="medium" variant="brand"></lightning-spinner>
    </div>
</template>
force-app/main/default/lwc/lexFollowUpHistory/lexFollowUpHistory.js
New file
@@ -0,0 +1,55 @@
/*
 * @Description:
 * @version:
 * @Author: chen jing wu
 * @Date: 2023-10-18 20:57:28
 * @LastEditors: chen jing wu
 * @LastEditTime: 2023-10-18 20:58:14
 */
import { api, wire,LightningElement } from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
import { updateRecord } from 'lightning/uiRecordApi';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { NavigationMixin } from 'lightning/navigation';
import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
import init from '@salesforce/apex/lexFollowUpHistoryController.init';
import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
import {loadStyle} from 'lightning/platformResourceLoader';
export default class lexFollowUpHistory extends NavigationMixin(LightningElement) {
    @api recordId;
    reportId;
    @wire(CurrentPageReference)
    getStateParameters(currentPageReference) {
        if (currentPageReference) {
          const urlValue = currentPageReference.state.recordId;
          if (urlValue) {
            let str = `${urlValue}`;
            this.recordId = str;
          }
        }
    }
    connectedCallback(){
        Promise.all([
            loadStyle(this, lwcCSS)
        ]);
        init({
            recordId: this.recordId
        }).then(result=>{
            this.reportId=result.reportId;
            this.createOPDFromRentalApply();
        });
    }
    createOPDFromRentalApply(){
        let url='/lightning/r/Report/'+this.reportId+'/view?fv0='+this.recordId.substring(0,15);
        // this[NavigationMixin.Navigate]({
        //     type: 'standard__webPage',
        //     attributes: {
        //         url:url
        //     }
        // });
        window.open(url);
        this.dispatchEvent(new CloseActionScreenEvent());
    }
}
force-app/main/default/lwc/lexFollowUpHistory/lexFollowUpHistory.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" fqn="lexFollowUpHistory">
    <apiVersion>51.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__AppPage</target>
        <target>lightning__RecordPage</target>
        <target>lightning__HomePage</target>
        <target>lightning__RecordAction</target>
    </targets>
</LightningComponentBundle>
force-app/main/default/lwc/lexImprovedForecastTimeNew/lexImprovedForecastTimeNew.js
@@ -283,6 +283,7 @@
                    this.dispatchEvent(closeEvent);
                }else{
                    this.showToast(response,"error");
                    this.IsLoading = false;
                }
            });
        }
force-app/main/default/lwc/lexLoseReport/lexLoseReport.js
@@ -4,7 +4,7 @@
 * @Author: chen jing wu
 * @Date: 2023-04-20 14:08:55
 * @LastEditors: chen jing wu
 * @LastEditTime: 2023-10-10 17:35:29
 * @LastEditTime: 2023-10-16 14:45:16
 */
/*
 * @Description: 
@@ -20,6 +20,7 @@
import { updateRecord } from 'lightning/uiRecordApi';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import init  from '@salesforce/apex/OpportunityLightingButtonController.initForLostReportButton';
import queryLostReport  from '@salesforce/apex/OpportunityLightingButtonController.queryLostReport';
import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
import {loadStyle} from 'lightning/platformResourceLoader';
export default class LexLoseReport extends LightningElement {
@@ -35,6 +36,7 @@
    salesOwnerBuchang;
    salesOwnerBuchangID;
    cntLostCancelDraft;
    haveLostReport;
    IsLoading = true;
    @wire(CurrentPageReference)
    getStateParameters(currentPageReference) {
@@ -75,7 +77,13 @@
                this.dispatchEvent(new CloseActionScreenEvent());
                return;
            }
            queryLostReport({
                recordId: this.recordId
            }).then(result=>{
                this.haveLostReport = result;
            this.loseReport();
            });
        })
    }
    loseReport(){
@@ -88,27 +96,12 @@
        else if (this.sapSendOK == '1') {
            this.showToast("已经上传SAP、不能做 失单 了!","error");
        }
        else if (this.cntLostCancelReport - this.cntLostCancelDraft > 0) {
            // this.showToast("询价已经有 取消/失单报告 了!","error");
        else if (this.haveLostReport) {
            this.showToast('询价已经有 取消/失单报告 了!','error');
        }
        //else if({!Not(ISBLANK(Opportunity.Bidding_Project_Name_Bid__c))} && //'{!Opportunity.InfoTypeBid__c}' != '3:结果' ){
        //alert("关联招投标项目的询价,只能在有结果后做失单报告!");
        //}
        else {
            var url = '/lightning/n/PCLLostReportPageLwc#pageStatus=Create&oppId=' + this.recordId + '&lostType=失单';
            location.href = url;
            // location.href = '/a1U/e?retURL=%2F' + this.recordId +
            // '&RecordType=01210000000R4hM' +
            // '&CF00N10000004lbGT=' + this.name +
            // '&CF00N10000004lbGT_lkid=' + this.recordId +
            // '&CF00N10000006QShg=' + this.salesAssistantName +
            // '&CF00N10000006QShg_lkid=' + this.salesAssistantID +
            // '&CF00N10000006QShq=' + this.managerName +
            // '&CF00N10000006QShq_lkid=' + this.salesManagerDepartmentID +
            // '&CF00N10000006QShb=' + this.salesOwnerBuchang +
            // '&CF00N10000006QShb_lkid=' + this.salesOwnerBuchangID +
            // '';
        }
        this.dispatchEvent(new CloseActionScreenEvent());
    }
force-app/main/default/lwc/lexNewOpportunityFile/lexNewOpportunityFile.js
@@ -4,7 +4,7 @@
 * @Author: chen jing wu
 * @Date: 2023-06-29 16:43:08
 * @LastEditors: chen jing wu
 * @LastEditTime: 2023-10-10 17:36:38
 * @LastEditTime: 2023-10-18 10:49:04
 */
import { api, wire,LightningElement } from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
@@ -19,6 +19,7 @@
export default class LexNewOpportunityFile extends NavigationMixin(LightningElement) {
    @api recordId;
    stockApplyStatus;
    profileId;
    @wire(CurrentPageReference)
    getStateParameters(currentPageReference) {
            console.log(111);
@@ -60,6 +61,7 @@
            recordId: this.recordId
        }).then(result=>{
            this.stockApplyStatus = result.stockApplyStatus;
            this.profileId = result.profileId;
            this.newOpportunityFile();
        });
    }
force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.html
@@ -4,7 +4,7 @@
 * @Author: chen jing wu
 * @Date: 2023-09-09 13:27:59
 * @LastEditors: chen jing wu
 * @LastEditTime: 2023-10-11 14:52:27
 * @LastEditTime: 2023-10-13 11:40:41
-->
<!--
 * @Description: 
@@ -250,7 +250,13 @@
                                                                                                <template if:true={product.LostProductss.ProductClass__c}>
                                                                                                    
                                                                                                    <template if:true={product.LostProductss.LostProduct__c}>
                                                                                                        <template if:true={product.LostProductss.isSpec__c}>
                                                                                                            <lightning-combobox variant="label-hidden"  class="ProductClass" data-id={i} placeholder="--无--" title={i} name={j} options={productClassOptions} value={product.LostProductss.ProductClass__c} onchange={handleProductClassChange}></lightning-combobox>
                                                                                                        </template>
                                                                                                        <template if:false={product.LostProductss.isSpec__c}>
                                                                                                        <lightning-combobox variant="label-hidden" read-only="true" class="ProductClass" data-id={i} placeholder="--无--" title={i} name={j} options={productClassOptions} value={product.LostProductss.ProductClass__c} onchange={handleProductClassChange}></lightning-combobox> 
                                                                                                        </template>
                                                                                                    </template>
                                                                                                    <template if:false={product.LostProductss.LostProduct__c}>
                                                                                                        <lightning-combobox variant="label-hidden"  class="ProductClass" data-id={i} placeholder="--无--" title={i} name={j} options={productClassOptions} value={product.LostProductss.ProductClass__c} onchange={handleProductClassChange}></lightning-combobox> 
@@ -274,6 +280,7 @@
                                                                                        <td>
                                                                                           
                                                                                            <template if:true={isEdit}>
                                                                                                <lightning-combobox variant="label-hidden" class="ProductCategory" data-id={i} placeholder="--无--" title={i} name={j} options={product.productOptions} value={product.LostProductss.ProductCategory__c} onchange={handleProductCategoryChange} read-only="true"></lightning-combobox> 
                                                                                            </template>
                                                                                            <template if:false={isEdit}>
force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.js
@@ -4,7 +4,7 @@
 * @Author: chen jing wu
 * @Date: 2023-04-20 15:04:03
 * @LastEditors: chen jing wu
 * @LastEditTime: 2023-10-11 18:24:16
 * @LastEditTime: 2023-10-16 11:48:33
 */
let columns2=[
    { label: '--无--', value: '' },
@@ -139,6 +139,8 @@
    userId;
    allowUserId;
    submitUserId;
    specProFlg;
    loadingFlg;
    @track isSubmitUser = false;
    @track isAllowUser = false;
    handleCustomButtonClick(event) {
@@ -370,6 +372,38 @@
            }
            
        });
        // if(this.pageStatus = 'Edit' && this.loadingFlg == false){
        //     var elements1 = this.template.querySelectorAll('.ProductClass[data-id="' + 0 + '"]');
        //     var elements2 = this.template.querySelectorAll('.ProductCategory[data-id="' + 0 + '"]');
        //         console.log('lnm');
        //                     console.log(elements1);
        //                     console.log(elements2);
        //         console.log('lnm');
        //     console.log('in=>');
        //     this.loadingFlg = true;
        //     var j = 0;
        //     var i = 0;
        //     this.LostReport.LostBrands.forEach(brand=>{
        //         brand.LostProducts.forEach(product=>{
        //             if(product.LostProductss.LostProduct__r !=undefined){
        //                 if(product.LostProductss.LostProduct__r.ProductClass__c ==undefined && product.LostProductss.LostProduct__r.ProductCategory__c ==undefined){
        //                     console.log('cnm');
        //                     console.log(elements1[i]);
        //                     console.log(elements2[i]);
        //                     console.log('cnm');
        //                     elements1[i].readOnly = false;
        //                     elements2[i].readOnly = false;
        //                 }
        //             }
        //             i++;
        //         });
        //         j++;
        //     });
        // }else if(this.pageStatus = 'View'){
        //     this.loadingFlg = false;
        // }
        // if((value == '' || value == null) && this.LostReport.LostBrands[index].lostBrand.Lost_By_Company__c == '其他'){
        //     var elements = 
        //     elements[index].disabled = false;
@@ -535,7 +569,12 @@
        getNewLostProduct({
            lineNo2: this.LostReport.LostBrands[index].LostProducts.length
        }).then(result=>{
            if(this.LostReport.LostBrands[index].lostBrand.Lost_By_Company__c == '其他' && (this.LostReport.LostBrands[index].lostBrand.Lost_By_Company_Mannual__c != null && this.LostReport.LostBrands[index].lostBrand.Lost_By_Company_Mannual__c != undefined && this.LostReport.LostBrands[index].lostBrand.Lost_By_Company_Mannual__c != '')){
                result.LostProductss.LostBrandName__c = this.LostReport.LostBrands[index].lostBrand.Lost_By_Company_Mannual__c;
            }else{
            result.LostProductss.LostBrandName__c = this.LostReport.LostBrands[index].lostBrand.Lost_By_Company__c;
            }
            this.LostReport.LostBrands[index].LostProducts.push(result);
            console.log('***');
            console.log(this.LostReport);
@@ -1070,7 +1109,7 @@
    handleModalSubmit(){
        
        this.IsLoading = true;
        const comment = this.template.querySelector('.comment');
        const comment = this.template.querySelector('.textAreaBody');
        console.log(this.isLookup == true && this.newActorId == null);
        if(this.isLookup == true && this.newActorId == null){
            this.showToast('请填入新分配人','error');
@@ -1093,11 +1132,18 @@
                
            });
        }else{
            console.log('1nm');
            console.log(this.LostReport.lostReport.Id);
            console.log(comment.value);
            console.log(this.action);
            console.log('1nm');
            submitForApproval({
                recordId: this.LostReport.lostReport.Id,
                comments: comment.value,
                action: this.action
            }).then(result=>{
                console.log('sb');
                console.log(result);
                if(result){
                    if(this.action == 'Approve'){
                        this.showToast('您无权批准','error');
@@ -1110,8 +1156,12 @@
                    this.IsLoading = false;
                }else{
                    // window.location = '/' + this.LostReport.lostReport.Id;
                    this.remoteUrl();
                } 
            }).catch(error=>{
                console.log('error');
                console.log(error);
            });
        }
        
@@ -1277,6 +1327,14 @@
            var temps1 =this.template.querySelectorAll('.ProductCategory[data-id="'+ index1 +'"]');
            temps1[index2].readOnly = false;
            this.LostReport.LostBrands[index1].LostProducts[index2].productOptions = this.productOptionsList[val];
            searchProduct({
                lostProduct:this.LostReport.LostBrands[index1].LostProducts[index2].LostProductss.LostProduct__c
            }).then(result=>{
                var prd = JSON.parse(result);
                if(prd.ProductClass__c == undefined && prd.ProductCategory__c == undefined){
                    this.LostReport.LostBrands[index1].LostProducts[index2].LostProductss.isSpec__c = true;
                }
            });
        }
       
    }
force-app/main/default/lwc/lexQuotationProductNotUse/lexQuotationProductNotUse.html
New file
@@ -0,0 +1,9 @@
<template>
    <div class="Holder" style="
    position: relative;
    width:100%;
    height:200px;
    --sds-c-progress-ring__stroke-color: #0070d2;">
        <lightning-spinner alternative-text="Loading" size="medium" variant="brand"></lightning-spinner>
    </div>
</template>
force-app/main/default/lwc/lexQuotationProductNotUse/lexQuotationProductNotUse.js
New file
@@ -0,0 +1,59 @@
/*
 * @Description:
 * @version:
 * @Author: chen jing wu
 * @Date: 2023-10-18 21:00:37
 * @LastEditors: chen jing wu
 * @LastEditTime: 2023-10-18 21:01:01
 */
import { api, wire,LightningElement } from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
import { updateRecord } from 'lightning/uiRecordApi';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { NavigationMixin } from 'lightning/navigation';
import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
import init from '@salesforce/apex/lexQuotationProductNotUseController.init';
import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
import {loadStyle} from 'lightning/platformResourceLoader';
export default class lexQuotationProductNotUse extends NavigationMixin(LightningElement) {
    @api recordId;
    id;
    reportId;
    @wire(CurrentPageReference)
    getStateParameters(currentPageReference) {
        if (currentPageReference) {
          const urlValue = currentPageReference.state.recordId;
          if (urlValue) {
            let str = `${urlValue}`;
            this.recordId = str;
          }
        }
    }
    connectedCallback(){
        Promise.all([
            loadStyle(this, lwcCSS)
        ]);
        init({
            recordId: this.recordId
        }).then(result=>{
            this.id = result.Id.substring(0,15);
            this.reportId=result.reportId;
            this.createOPDFromRentalApply();
        });
    }
    createOPDFromRentalApply(){
        Promise.all([
            loadStyle(this, lwcCSS)
        ]);
        let url='/lightning/r/Report/'+this.reportId+'/view?fv0='+this.id;
        // this[NavigationMixin.Navigate]({
        //     type: 'standard__webPage',
        //     attributes: {
        //         url:url
        //     }
        // });
        window.open(url);
        this.dispatchEvent(new CloseActionScreenEvent());
    }
}
force-app/main/default/lwc/lexQuotationProductNotUse/lexQuotationProductNotUse.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" fqn="lexQuotationProductNotUse">
    <apiVersion>51.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__AppPage</target>
        <target>lightning__RecordPage</target>
        <target>lightning__HomePage</target>
        <target>lightning__RecordAction</target>
    </targets>
</LightningComponentBundle>
force-app/main/default/lwc/lexSISubmit/lexSISubmit.js
@@ -7,6 +7,9 @@
import init from '@salesforce/apex/ISOpportunityDemand.initISOpportunityController';
import submit from '@salesforce/apex/ISOpportunityDemand.submit';
import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
import {loadStyle} from 'lightning/platformResourceLoader';
import LightningConfirm from 'lightning/confirm';
export default class LexSiSubmit extends LightningElement {
    @api recordId;
@@ -28,14 +31,25 @@
     }
     connectedCallback(){
        Promise.all([
          loadStyle(this, lwcCSS)
        ]);
        this.IsLoading = false;
        // this.submit();
        init({recordId:this.recordId})
        .then(result=>{
            console.log("lexsubmit------>>>",result)
            if (!confirm("一旦提交此记录以待批准,根据您的设置您可能不再能够编辑此记录或将他从批准过程中调回。是否继续?")) {
              return;
            }
            // if (!confirm("一旦提交此记录以待批准,根据您的设置您可能不再能够编辑此记录或将他从批准过程中调回。是否继续?")) {
            //   return;
            // }
            // this.handleConfirmClick();
            LightningConfirm.open({
              message: "一旦提交此记录以待批准,根据您的设置您可能不再能够编辑此记录或将他从批准过程中调回。是否继续?",
              variant: 'headerless',
              label: '提示信息',
              // setting theme would have no effect
          }).then(res=>{
            if(!res) return;
            if (result.checkTf !=true ) {
              this.showToast('请营业担当提交审批','error')
              return;
@@ -63,6 +77,7 @@
              window.location.reload();
            })
        })
        })
        .catch(e=>{console.log(e)})
        .finally(()=>{
            this.dispatchEvent(new CloseActionScreenEvent());
@@ -71,12 +86,22 @@
     showToast(msg,type) {
      if(type == "success"){
      const event = new ShowToastEvent({
          title: '',
            // title: '',
          message: msg,
          variant: type
      });
      this.dispatchEvent(event);
      }else{
        const event = new ShowToastEvent({
            // title: '',
            message: msg,
            variant: type,
            mode:'sticky'
        });
        this.dispatchEvent(event);
      }
      this.dispatchEvent(new CloseActionScreenEvent());
    }
force-app/main/default/lwc/lexSelectAssetEstimateVM/lexSelectAssetEstimateVM.css
New file
@@ -0,0 +1,91 @@
.THIS .bottom .slds-form-element__control {
    display: inline-flex;
}
/*合同:xxx 一行输出*/
.vmItems{
    display: flex;
    align-items: center;
}
.vmItems span{
    width: 122px;
}
.c-container span{
    display: inline-block;
    padding: 10px 0;
    font-weight: bold;
}
.custom-box lightning-button{
    margin-top: 10px;
}
.pdfCheck{
    display: inline-flex;
}
/*button 样式改动*/
.bottomBtn button {
    border: 1px solid #0176d3;
    background-color: #fff;
    color: #0176d3;
    width: 90px;
    height: 35px ;
    /*overflow: hidden;
    white-space: nowrap ;
    text-overflow: ellipsis ;*/
    margin: 5px;
    border-radius: 5px;
}
.bottomBtn button:disabled,
.bottomBtn button[disabled]{
  border: 1px solid #c9c9c9;
  color: #c9c9c9;
}
/*底部 合同开始日 合同结束日*/
.bottomVMItem{
    display: flex;
    align-items: center;
    margin-left: 10px;
}
.bottomVMItem span{
    width: 90px;
}
/*.bottomVMItem  lightning-input-field{
    width: 230px;
}*/
.accordion {
    --slds-c-accordion-summary-color-background:#f3f3f3;
    /*--slds-c-accordion-heading-text-color:white;*/
    --slds-c-accordion-heading-font-size:18px;
}
/*覆盖原有padding*/
.accordion .slds-accordion__summary{
    padding-top: 5px !important;
    padding-bottom: 5px !important;
}
/*合同信息*/
.line{
    display: flex;
}
.line div{
    margin-right: 5px;
}
/*table 样式*/
.list tr th,.list tr td{
    border: 1px solid #ededed;
    white-space: normal;
}
.headerRow{
    background-color: #f2f3f3;
    font-weight: bold;
    font-size:.9em;
    border-width: 0 0 1px 1px;
    border-color: #e0e3e5;
}
/*必填*/
.required{
    display: inline !important;
    float: none;
    font-weight: var(--lwc-fontWeightBold,700) !important;
}
force-app/main/default/lwc/lexSelectAssetEstimateVM/lexSelectAssetEstimateVM.html
New file
@@ -0,0 +1,748 @@
<!-- input del onchange = handle -->
<template>
    <div class="exampleHolder" if:true={IsLoading}>
        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
        <div class="slds-backdrop slds-backdrop_open"></div>
    </div>
    <lightning-card  variant="Narrow" title="服务合同报价" if:true={IsRefresh}>
        <div class="custom-box" style="text-align: center;padding-bottom: 15px;
                                border-bottom: 1px solid #e5e5e5">
            <div style="display: inline-block;">
                <!-- // del testMax -->
                <!-- <lightning-button variant="brand-outline" label="TEST MAX" onclick={test} class="slds-m-left_x-small"></lightning-button> -->
                <lightning-button variant="brand-outline" label="保存" onclick={handleSave} disabled={SaveBtnDisabled} class="slds-m-left_x-small"></lightning-button>
                <lightning-button variant="brand-outline" label="过去三年维修实绩计算" onclick={AlertPriceBtnJs} class="slds-m-left_x-small"></lightning-button>
                <lightning-button variant="brand-outline" label="提交待审批" onclick={handleApprove} disabled={ApprovalBtnDisabled} class="slds-m-left_x-small"></lightning-button>
            </div>
            <div style="float: right;margin-right: 10px;">
                <lightning-button variant="brand-outline" label="不保存(返回)" onclick={cancel} class="slds-m-left_x-small"></lightning-button>
                <lightning-button variant="brand-outline" label="保存(返回)" onclick={handleSaveAndCancel} class="slds-m-left_x-small" disabled={SaveBtnDisabled}></lightning-button>
            </div>
            <!-- allData.IS_Clone_After_Decide  改变不及时-->
            <div style="color:red;font-size:20px;text-align: center;" if:true={IS_Clone_After_Decide}>请提交待审批</div>
        </div>
        <lightning-accordion allow-multiple-sections-open="true"
                             active-section-name={activeSections}
                             class="accordion"
                             >
            <lightning-record-edit-form object-api-name={objName} record-id={recordId}>
                <!-- decide 页面初始化是禁用处理 -->
                <lightning-accordion-section name="A" label="服务合同" id="myAccordionSection">
                    <div class="c-container">
                        <lightning-layout pull-to-boundary="medium">
                            <lightning-layout-item flexibility="auto"  size="4" padding="horizontal-medium">
                                <div class="custom-box vmItems">
                                     <span>合同询价编码</span>
                                    <lightning-record-edit-form
                                            record-id={contract.Id}
                                            object-api-name='Maintenance_Contract__c'>
                                        <lightning-output-field field-name="Management_Code__c" variant="label-hidden"></lightning-output-field>
                                    </lightning-record-edit-form>
                                </div>
                            </lightning-layout-item>
                            <lightning-layout-item flexibility="auto" size="4" padding="horizontal-medium">
                                <div class="custom-box vmItems">
                                    <span>医院</span><br />
                                    <div style="border-bottom: 1px solid;display: inline-block;">
                                        <lightning-record-edit-form
                                            record-id={contract.Hospital__c}
                                            object-api-name='Account'>
                                            <lightning-output-field field-name="Name" variant="label-hidden" data-param={contract.Hospital__c} onclick={handlePageNagivateTo} style="cursor: pointer;">
                                            </lightning-output-field>
                                        </lightning-record-edit-form>
                                    </div>
                                </div>
                            </lightning-layout-item>
                            <lightning-layout-item flexibility="auto" size="4" padding="horizontal-medium">
                                <div class="custom-box vmItems">
                                    <span>报价状态</span>
                                    <lightning-output-field field-name="Process_Status__c" value={estimate.Process_Status__c} variant="label-hidden"> </lightning-output-field>
                                </div>
                            </lightning-layout-item>
                        </lightning-layout>
                        <lightning-layout pull-to-boundary="medium">
                            <lightning-layout-item flexibility="auto" size="4" padding="horizontal-medium">
                                <div class="custom-box vmItems">
                                    <span>报价编码</span>
                                    <lightning-output-field field-name="Name" value={estimate.Name} variant="label-hidden"> </lightning-output-field>
                                </div>
                            </lightning-layout-item>
                            <lightning-layout-item flexibility="auto" size="4" padding="horizontal-medium">
                                <div class="custom-box vmItems">
                                    <span>科室</span>
                                    <lightning-input-field label="科室" variant="label-hidden" field-name="Department__c" onchange={changeDepartment} disabled={PageDisabled} value={estimate.Department__c}></lightning-input-field>
                                </div>
                            </lightning-layout-item>
                            <lightning-layout-item flexibility="auto" size="4" padding="horizontal-medium">
                                <div class="custom-box vmItems">
                                    <span>用户类型</span>
                                    <!-- <lightning-input-field field-name="EndUserType__c"  value={estimate.EndUserType__c} variant = "label-hidden" disabled> </lightning-input-field> -->
                                    <p>{estimate.EndUserType__c}</p>
                                </div>
                            </lightning-layout-item>
                        </lightning-layout>
                        <lightning-layout pull-to-boundary="medium">
                            <lightning-layout-item flexibility="auto" size="4" padding="horizontal-medium">
                                <div class="custom-box vmItems">
                                    <span>合同开始预订日<span class="required">*</span></span>
                                    <lightning-input-field label="合同开始预订日" field-name="Contract_Esti_Start_Date__c" variant="label-hidden" onchange={changeEstiStartdate} value={estimate.Contract_Esti_Start_Date__c} disabled={IsContractEstiStartDateDisabled} required> </lightning-input-field>
                                </div>
                            </lightning-layout-item>
                            <lightning-layout-item size="4" padding="horizontal-medium" >
                                <div class="custom-box vmItems">
                                    <span>报价提交对象</span>
                                    <div style="display: flex;align-items: flex-end;margin-top: -5px;">
                                        <div style="width: 120px;">
                                            <lightning-input-field label="报价提交对象" field-name="Estimate_Target__c" variant = "label-hidden" value={estimate.Estimate_Target__c} onchange={handleChangeEstimateTarget} disabled={PageDisabled}> </lightning-input-field>
                                        </div>
                                        <lightning-button variant="brand-outline" label="变更" disabled={DecideBtnDisabled} onclick={controlDisabled} class="slds-m-left_x-small"></lightning-button>
                                    </div>
                                </div>
                            </lightning-layout-item>
                            <lightning-layout-item flexibility="auto" size="4" padding="horizontal-medium">
                                <div class="custom-box vmItems">
                                    <span>状态</span>
                                    <lightning-record-edit-form
                                            record-id={contract.Id}
                                            object-api-name='Maintenance_Contract__c'>
                                        <lightning-output-field field-name="Status__c" variant="label-hidden"></lightning-output-field>
                                    </lightning-record-edit-form>
                                </div>
                            </lightning-layout-item>
                        </lightning-layout>
                        <lightning-layout pull-to-boundary="medium">
                            <lightning-layout-item flexibility="auto" size="4" padding="horizontal-medium">
                                <div class="custom-box vmItems">
                                    <span>合同结束预订日</span>
                                    <lightning-input-field label="合同结束预订日" field-name="Contract_Esti_End_Date__c" variant="label-hidden" value={estimate.Contract_Esti_End_Date__c} readonly> </lightning-input-field>
                                </div>
                            </lightning-layout-item>
                            <lightning-layout-item size="4" padding="horizontal-medium">
                                <div class="custom-box vmItems">
                                    <span>经销商名</span>
                                    <lightning-input-field label="经销商名" field-name="Dealer__c" variant = "label-hidden" value={estimate.Dealer__c} onchange={handleChangeDealer} disabled={IsDealerDisabled} class="dealer" if:true={EstimateTargetIsDealer} style="    width: 65%;"> </lightning-input-field>
                                </div>
                            </lightning-layout-item>
                            <lightning-layout-item flexibility="auto" size="4" padding="horizontal-medium">
                                <div class="custom-box vmItems">
                                    <span>制定日</span>
                                    <lightning-output-field type="date" label="制定日" variant = "label-hidden" field-name="CreatedDate" value={estimate.CreatedDate}></lightning-output-field>
                                </div>
                            </lightning-layout-item>
                        </lightning-layout>
                        <lightning-layout pull-to-boundary="medium">
                            <lightning-layout-item flexibility="auto" size="4" padding="horizontal-medium">
                                <div class="custom-box vmItems">
                                    <span>合同月数<span class="required">*</span></span>
                                    <lightning-input type="number" variant="label-hidden" value={estimate.Contract_Range__c}  onchange={handleChangeContractRange} required calss="monthRange" disabled={PageDisabled}></lightning-input>
                                </div>
                            </lightning-layout-item>
                            <lightning-layout-item flexibility="auto" padding="horizontal-medium">
                                <div class="custom-box vmItems">
                                    <span>先款标识(经销商)</span>
                                    <!-- 最终是否勾选取决于是否  经销商名 是否有值,勾选无意义 改为只读  IsFirstParagraphEndDisabled onchange={handleIsRecognitionModel} -->
                                    <lightning-input-field label="先款标识(经销商)"  field-name="Is_RecognitionModel__c" type="checkbox" variant = "label-hidden" value={estimate.Is_RecognitionModel__c} class="FirstParagraphEnd" checked={estimate.Is_RecognitionModel__c} disabled if:true={EstimateTargetIsDealer}> </lightning-input-field>
                                </div>
                            </lightning-layout-item>
                        </lightning-layout>
                    </div>
                </lightning-accordion-section>
            </lightning-record-edit-form>
            <lightning-accordion-section name="B" label="合同对象设备">
                <div style="max-height: 450px;overflow: auto;margin-top: 10px;">
                    <table class="list" border="0" cellspacing="0" cellpadding="0">
                        <tr class="headerRow" height="30px">
                            <!-- todo 根据下面内容勾选决定 全选状态 -->
                            <th style="width:25px" class="headerRow  booleanColumn"><lightning-input label="全选" variant="label-hidden"  type='checkbox' data-param="checkedAssets" onchange={checkAllcheckedAsset} checked={IsCheckAllcheckedAsset} value={IsCheckAllcheckedAsset}></lightning-input></th>
                            <th style="width:200px" class="headerRow  booleanColumn">保有设备名</th>
                            <th style="width:75px" class="headerRow  booleanColumn">设备状态</th>
                            <th style="width:60px" class="headerRow  booleanColumn">机身编码</th>
                            <th style="width:40px" class="headerRow  booleanColumn">新合同备品确保提供</th>
                            <th style="width:80px" class="headerRow  booleanColumn">安装日期</th>
                            <!--add点检改善:新增一个点检对象复选框字段,默认为true 2021.6.8 fxk Star-->
                            <th style="width:30px" class="headerRow  booleanColumn">点检对象</th>
                            <!--add点检改善:新增一个点检对象复选框字段,默认为true 2021.6.8 fxk end-->
                            <th style="width:30px" class="headerRow  booleanColumn">新品</th>
                            <th style="width:55px" class="headerRow  booleanColumn">科室</th>
                            <th style="width:120px" class="headerRow  booleanColumn">维修合同号码</th>
                            <th style="width:40px" class="headerRow  booleanColumn">市场多年保设备</th>
                            <th style="width:65px" class="headerRow  booleanColumn">消费率</th>
                            <th style="width:80px" class="headerRow  booleanColumn">最近一期维修合同结束日</th>
                            <!-- 实绩联动价格计算 start -->
                            <th style="width:90px" class="headerRow  booleanColumn">本次设备签约最高价格</th>
                            <th style="width:90px" class="headerRow  booleanColumn">本次设备签约最低价格</th>
                            <th style="width:140px" class="headerRow  booleanColumn">参保修理金额</th>
                            <!-- (2022年12月上线)故障品加费 start -->
                            <th style="width:90px" class="headerRow ">修理金额</th>
                           <!-- (2022年12月上线)故障品加费 end  style="width:70px"-->
                            <th style="width:100px" class="headerRow  booleanColumn">备注</th>
                            <!-- (2022年12月上线)故障品加费 第三方回归 -->
                            <th style="width:40px" class="headerRow  booleanColumn">第三方回归</th>
                        </tr>
                        <template for:each={checkedAssetData} for:item="ar">
                            <tr key={ar.lineNo}>
                                <td>
                                    <lightning-input data-index={ar.lineNo} type="checkbox" label="勾选" value={ar.rec_checkBox_c} if:false={ar.IsManual} variant = "label-hidden" disabled={PageDisabled} checked={ar.rec_checkBox_c} onchange={handleTableRecCheckBox}></lightning-input>
                                </td>
                                <!--lightning-input readonly 改用span  避免input内容显示不完全-->
                                <td>
                                    <template if:false={ar.IsManual}>
                                        <!-- <lightning-input type="text" label="保有设备名" value={ar.Name} variant="label-hidden" readonly ></lightning-input> -->
                                        <span>{ar.Name}</span>
                                    </template>
                                    <template if:true={ar.IsManual}>
                                        <lightning-record-edit-form
                                            record-id=''
                                            object-api-name={checkedAssetRelatedMaintenanceContractAssetEstimate}
                                        >
                                            <lightning-input-field data-index={ar.lineNo} label='保有设备名' field-name="Product_Manual__c" value={ar.Name} onchange={handleTableProductManualChange} variant="label-hidden" disabled={ar.IsAssertDisabled}></lightning-input-field>
                                        </lightning-record-edit-form>
                                    </template>
                                </td>
                                <td class="dataCell">
                                    <!-- <lightning-input type="text" label="设备状态" value={ar.Asset_situation__c} variant="label-hidden" if:false={ar.IsManual}  readonly></lightning-input> -->
                                    <span if:false={ar.IsManual}>{ar.Asset_situation__c}</span>
                                </td>
                                <td class="dataCell">
                                    <!-- <lightning-input type="text" label="机身编码" value={ar.SerialNumber} variant="label-hidden" if:false={ar.IsManual}  readonly></lightning-input> -->
                                    <span if:false={ar.IsManual} style="text-decoration: underline;cursor: pointer;" data-param={ar.recId} onclick={handlePageNagivateTo}>{ar.SerialNumber}</span>
                                </td>
                                <td class="dataCell" style="text-align:center">
                                    <lightning-input type="checkbox" label="新合同备品确保提供" value={ar.EquipmentGuaranteeFlgTxt__c} variant="label-hidden" checked={ar.EquipmentGuaranteeFlgTxt__c} disabled ></lightning-input>
                                </td>
                                <td class="dataCell" style="text-align:center" >
                                    <!-- <lightning-input type="text" label="安装日期" value={ar.InstallDate} variant="label-hidden" if:false={ar.IsManual}  readonly></lightning-input> -->
                                    <span if:false={ar.IsManual}>{ar.InstallDate}</span>
                                </td>
                                <td class="dataCell" style="text-align:center" >
                                    <lightning-input type="checkbox" label="点检对象" value={ar.Check_Object__c} variant="label-hidden" disabled={ar.CheckRows} data-index={ar.lineNo} onchange={handleTableCheckObjectChange} checked={ar.Check_Object__c}></lightning-input>
                                </td>
                                <td class="dataCell" style="text-align:center" >
                                    <lightning-input type="checkbox" label="新品" value={ar.IsNew__c} variant="label-hidden" disabled="true" checked={ar.IsNew__c}></lightning-input>
                                </td>
                                <td class="dataCell">
                                    <!-- <lightning-input type="text" label="科室" value={ar.Department_Name__c} variant="label-hidden" if:false={ar.IsManual} readonly></lightning-input> -->
                                    <span if:false={ar.IsManual}>{ar.Department_Name__c}</span>
                                </td>
                                <td class="dataCell">
                                    <!-- <lightning-input type="text" label="维修合同号码" value={ar.Maintenance_Contract_No_F__c} variant="label-hidden" if:false={ar.IsManual}  readonly></lightning-input> -->
                                    <span if:false={ar.IsManual}>{ar.Maintenance_Contract_No_F__c}</span>
                                </td>
                                <td class="dataCell" style="text-align:center">
                                    <lightning-input type="checkbox" label="市场多年保设备" value={ar.IS_VMContract_Asset__c} variant="label-hidden" if:false={ar.IsManual} checked={ar.IS_VMContract_Asset__c} disabled></lightning-input>
                                </td>
                                <!-- style="text-align:right"  -->
                                <td class="dataCell">
                                    <!-- <lightning-input type="percent" label="消费率" value={ar.Asset_Consumption_rate__c} variant="label-hidden" if:false={ar.IsManual}  readonly></lightning-input> -->
                                    <span if:false={ar.IsManual}>
                                        <span if:true={ar.Asset_Consumption_rate__c}>{ar.Asset_Consumption_rate__c}%</span>
                                    </span>
                                </td>
                                <td class="dataCell">
                                    <template if:true={ar.IsCurrentContract}>
                                        <!-- <lightning-input type="text" label="最近一期维修合同结束日" value={ar.CurrentContract_End_Date__c} variant="label-hidden" if:false={ar.IsManual} readonly></lightning-input> -->
                                        <span if:false={ar.IsManual}>{ar.CurrentContract_End_Date__c}</span>
                                    </template>
                                </td>
                                <td class="dataCell">
                                    <!-- <lightning-input type="text" label="本次设备签约最高价格" value={ar.Adjustment_Upper_price__c} variant="label-hidden" readonly></lightning-input> -->
                                    <!-- <span>{ar.Adjustment_Upper_price__c}</span> -->
                                    <p><lightning-formatted-number value={ar.Adjustment_Upper_price__c}></lightning-formatted-number></p>
                                </td>
                                <td class="dataCell">
                                    <!-- <lightning-input type="text" label="本次设备签约最低价格" value={ar.Adjustment_Lower_price__c} variant="label-hidden" readonly></lightning-input> -->
                                    <!-- <span>{ar.Adjustment_Lower_price__c}</span> -->
                                    <p><lightning-formatted-number value={ar.Adjustment_Lower_price__c}></lightning-formatted-number></p>
                                </td>
                                <td class="dataCell" style="text-align:right" >
                                    <lightning-input type="number" label="参保修理金额" value={ar.Repair_Price__c} variant="label-hidden" data-index={ar.lineNo} onblur={handleTableRepairPriceChange} disabled={ar.IsRepairPriceDisabled} step="0.01"></lightning-input>
                                </td>
                                 <td class="dataCell" style="text-align:right" >
                                    <!-- <lightning-input type="number" label="修理金额" value={ar.Repair_Price_Auto} variant="label-hidden" readonly style="width:95%; disabled:disabled;" if:true={ar.ShowAssetSituation}></lightning-input> -->
                                    <span if:true={ar.ShowAssetSituation}>{ar.Repair_Price_Auto}</span>
                                </td>
                                <!--  width="70px"  style="text-align:right"-->
                                <td class="dataCell" >
                                    <lightning-input type="text" label="备注" value={ar.Comment__c} title={ar.commentTitle} variant="label-hidden" data-index={ar.lineNo} onchange={handleTableCommentChange} disabled={ar.ISCommentDisabled}></lightning-input>
                                </td>
                                <td class="dataCell" style="text-align:center;" >
                                    <lightning-input type="checkbox" label="第三方回归" value={ar.Third_Party_Return__c} variant="label-hidden" checked={ar.Third_Party_Return__c} data-index={ar.lineNo} disabled={ar.IsThirdPartyReturnDisabled} onchange={handleTableThirdPartyReturnChange}></lightning-input>
                                </td>
                            </tr>
                        </template>
                    </table>
                </div>
                <!-- 合同对象设备 其他按钮 -->
                <div style="display: flex;
                    align-items: center;
                    justify-content: space-between;
                    padding: 10px 10px 0 10px;" >
                    <!-- <div style="display: flex;
                        align-items: center;
                        justify-content: space-between;
                        width: 80%;"> -->
                        <lightning-button-group>
                            <lightning-button label="行追加" disabled={lineAddBtn}  onclick={handleAddNewRows} ></lightning-button>
                            <lightning-button label="刷新选中的保有设备" disabled={refreshAssetBtnLWC} onclick={handleExchangeAsset}></lightning-button>
                            <!-- 放开点击,添加能否 成功取决于 确认添加 -->
                            <lightning-button label="添加新的保有设备" disabled={SaveBtnDisabled} onclick={showUnCheckedAsset}></lightning-button>
                        </lightning-button-group>
                        <!-- <lightning-button-group>
                            <lightning-button label="提交RC评估" onclick={handleSendEmail} disabled={SendEmailBtnDisabled}></lightning-button>
                            <lightning-button label="提交修理减价审批" onclick={handleToApprovalProcess} disabled={ApprovalBtnNewDisabled}></lightning-button>
                        </lightning-button-group> -->
                    <!-- </div> -->
                    <span><lightning-button-group style="display: inline-block;margin-right: 10px;">
                            <lightning-button label="提交RC评估" onclick={handleSendEmail} disabled={SendEmailBtnDisabled}></lightning-button>
                            <lightning-button label="提交修理减价审批" onclick={handleToApprovalProcess} disabled={ApprovalBtnNewDisabled}></lightning-button>
                        </lightning-button-group>
                        设备数量&nbsp;&nbsp;{productCount3} &nbsp;&nbsp;&nbsp; 修理总额   &nbsp;&nbsp;{assetRepairSumNum}</span>
                </div>
            </lightning-accordion-section>
            <lightning-card  variant="Narrow" if:true={IsShowUnCheckedAsset}>
                <section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open slds-modal_large" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1">
                    <div class="slds-modal__container">
                        <header class="slds-modal__header" style="color: black;">
                            <button class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" onclick={hiddenUnCheckedAsset} title="Close" style="background-color: #e5e4e2;">
                                <lightning-icon class="greyIcon" icon-name="utility:close" alternative-text="Connected" variant="inverse" size="small"
                                    title="Close"  style="color: black;"></lightning-icon>
                              <span class="slds-assistive-text">Close</span>
                            </button>
                            <h2 id="modal-heading-01" class="slds-modal__title slds-hyphenate">未选择的保有设备</h2>
                        </header>
                        <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1" style="font-size: 16px;text-align: left;height: auto;" >
                            <!-- 未选择的保有设备 搜索条件 -->
                            <span style="margin-left: 10px;">选择条件:</span>
                            <div style="display: inline-block;">
                                <div style="display: inline-block;">
                                    <lightning-combobox
                                        name="text1"
                                        value={text1}
                                        options={textOpts}
                                        onchange={handleChangeText1}
                                        variant = "label-hidden"
                                        ></lightning-combobox>
                                </div>
                                <div style="display: inline-block;margin-left: 10px;">
                                    <lightning-combobox
                                        name="cond1"
                                        value={cond1}
                                        options={equalOpts}
                                        onchange={handleChangeCond1}
                                        variant = "label-hidden"
                                        ></lightning-combobox>
                                </div>
                                <div style="display: inline-block;margin-left: 10px;">
                                    <lightning-input type="text" label="" value={val1} variant = "label-hidden" onchange={handleChangeVal1} ></lightning-input>
                                </div>
                                <div style="display: inline-block;">
                                    <lightning-button variant="brand-outline" label="检索" onclick={searchJs} class="slds-m-left_x-small"></lightning-button>
                                    <lightning-button variant="brand-outline" label="清除条件" onclick={clearAndSearch} class="slds-m-left_x-small"></lightning-button>
                                </div>
                            </div>
                            <div style="margin-top: 10px; " if:true={unCheckedAssetNowData}>
                                <div class="exampleHolder" if:true={IsLoading}>
                                    <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
                                    <div class="slds-backdrop slds-backdrop_open"></div>
                                </div>
                                <!-- table custome -->
                                <div>
                                    <table class="list" border="0" cellspacing="0" cellpadding="0">
                                        <tr class="headerRow" height="30px">
                                            <th style="width:25px" class="headerRow  booleanColumn"><lightning-input label="全选" variant="label-hidden" type='checkbox' data-param="unCheckedAssetNowData" onchange={checkAllUncheckedAsset} checked={IsCheckAllUncheckedAsset} value={IsCheckAllUncheckedAsset}></lightning-input></th>
                                            <th style="width:250px" class="headerRow  booleanColumn">保有设备名</th>
                                            <th style="width:80px" class="headerRow  booleanColumn">设备状态</th>
                                            <th style="width:75px" class="headerRow  booleanColumn">机身编码</th>
                                            <th style="width:70px" class="headerRow  booleanColumn">科室</th>
                                            <th style="width:90px" class="headerRow  booleanColumn">是否可以参保(服务合同)</th>
                                            <th style="width:90px" class="headerRow  booleanColumn">主机/耗材</th>
                                            <th style="width:75px" class="headerRow  booleanColumn">新合同备品确保提供</th>
                                            <th style="width:70px" class="headerRow  booleanColumn">不可参保原因</th>
                                            <th style="width:100px" class="headerRow  booleanColumn">安装日期</th>
                                            <th style="width:90px" class="headerRow  booleanColumn">累计修理金额</th>
                                            <!-- <th style="width:90px" class="headerRow  booleanColumn">维修合同月额</th> -->
                                            <th style="width:110px" class="headerRow  booleanColumn">最近一期维修合同结束日</th>
                                        </tr>
                                        <template for:each={unCheckedAssetNowData} for:item="ar">
                                            <tr key={ar.Id}>
                                                <td style="width:25px">
                                                    <lightning-input data-id={ar.Id} type="checkbox" label="勾选" value={ar.rec_checkBox_c} variant = "label-hidden" disabled={ar.uncheckedDisable} checked={ar.rec_checkBox_c} onchange={handleTableUncheckedRecCheckBox}></lightning-input>
                                                </td>
                                                <td  style="width:250px">
                                                    <!-- 改用span 显示换行 -->
                                                    <!-- <lightning-input type="text" label="保有设备名" value={ar.name} variant="label-hidden" readonly></lightning-input> -->
                                                     <span>{ar.name}</span>
                                                </td>
                                                <td class="dataCell" width="80px">
                                                    <lightning-input type="text" label="设备状态" value={ar.Asset_situation__c} variant="label-hidden" readonly></lightning-input>
                                                </td>
                                                <td class="dataCell" width="75px">
                                                    <!-- <lightning-input type="text" label="机身编码" value={ar.SerialNumber} variant="label-hidden" readonly></lightning-input> -->
                                                    <span>{ar.SerialNumber}</span>
                                                </td>
                                                <td class="dataCell" width="70px">
                                                    <!-- <lightning-input type="text" label="科室" value={ar.Department_Name__c} variant="label-hidden" readonly></lightning-input> -->
                                                    <span>{ar.Department_Name__c}</span>
                                                </td>
                                                <td class="dataCell" width="90px" style="text-align:center">
                                                    <lightning-input type="text" label="是否可以参保(服务合同)" value={ar.IF_Warranty_Service__c} variant="label-hidden" radonly disabled></lightning-input>
                                                </td>
                                                <td class="dataCell" width="90px" style="text-align:center">
                                                    <lightning-input type="text" label="主机/耗材" value={ar.AssetMark__c} variant="label-hidden" readonly></lightning-input>
                                                </td>
                                                <td class="dataCell" style="text-align:center" >
                                                    <lightning-input type="checkbox" label="新合同备品确保提供" value={ar.EquipmentGuaranteeFlg__c} variant="label-hidden" checked={ar.EquipmentGuaranteeFlg__c} disabled></lightning-input>
                                                </td>
                                                <td class="dataCell" width="70px" style="text-align:center">
                                                    <lightning-input type="text" label="不可参保原因" value={ar.Reson_Can_not_Warranty__c} variant="label-hidden" readonly></lightning-input>
                                                </td>
                                                <td class="dataCell" width="100px" style="text-align:center" >
                                                    <lightning-input type="text" label="安装日期" value={ar.InstallDate} variant="label-hidden" readonly></lightning-input>
                                                </td>
                                                <td class="dataCell" width="90px" style="text-align:right" >
                                                    <lightning-input type="text" label="累计修理金额" value={ar.Accumulation_Repair_Amount__c} variant="label-hidden" readonly></lightning-input>
                                                </td>
                                                <td class="dataCell" width="100px" style="text-align:right" >
                                                    <lightning-input type="text" label="最近一期维修合同结束日" value={ar.CurrentContract_End_Date__c} variant="label-hidden" readonly></lightning-input>
                                                </td>
                                            </tr>
                                        </template>
                                    </table>
                                </div>
                            </div>
                            <div> {unCheckedAssetDataShow1}&nbsp;-&nbsp;{unCheckedAssetDataShow2} &nbsp;&nbsp; 共{unCheckedAssetDataLength}个 &nbsp;&nbsp;  显示 &nbsp;&nbsp;
                                <div style="display: inline-block;">
                                    <lightning-combobox
                                            name="progress"
                                            value={pageDataLimit}
                                            options={pageDataLimitOptions}
                                            onchange={handlePageLimitChange}
                                            disabled={IsChangePageLimit}
                                            ></lightning-combobox>
                                </div>&nbsp;&nbsp;
                                条记录 &nbsp;&nbsp;  第{currentPage}页&nbsp;&nbsp;
                                <div style="display: inline-block;">
                                    <lightning-button-group>
                                        <lightning-button label="首页" onclick={toTop} disabled={IsTop}></lightning-button>
                                        <lightning-button label="上一页" onclick={toPre} disabled={IsPre}></lightning-button>
                                        <lightning-button label="下一页" onclick={toNext} disabled={IsNext}></lightning-button>
                                        <lightning-button label="尾页" onclick={toEnd} disabled={IsEnd}></lightning-button>
                                    </lightning-button-group>
                                </div>&nbsp;&nbsp;
                                共{pageCount}页</div>
                        </div>
                    <footer class="slds-modal__footer">
                        <!-- 刷新选中 -->
                        <lightning-button variant="brand" disabled={refreshAssetBtn} label="确认添加" class="slds-var-m-left_x-small" onclick={handleExchangeAsset}></lightning-button>
                        <lightning-button variant="neutral" label="取消" class="slds-var-m-left_x-small" onclick={hiddenUnCheckedAsset}></lightning-button>
                    </footer>
                    </div>
                </section>
                <div class="slds-backdrop slds-backdrop_open"></div>
            </lightning-card>
            <lightning-accordion-section name="D" label="合同信息">
                <lightning-record-edit-form
                    object-api-name={objName}
                    record-id={recordId}
                >
                <!-- if:true={IsRefresh} flexibility="auto"-->
                <div class="c-container" style="width: 100%">
                    <span>请结合实际可以签约的日期,选择恰当的申请金额,以免后续空白期变化导致标准金额变化,再次申请价格延误时间</span>
                    <div class="line">
                        <div class="custom-box" style="display: inline-block;width: 20%;">
                            <span>本次计划【合同预定开始日】:{allData.startdateaddsix4}</span>
                        </div>
                        <div class="custom-box" style="display: inline-block;width: 13%;">
                            <span>标准价格的最低价总额</span>
                            <!-- <lightning-input type="number" label="标准价格的最低价总额" value={estimate.GuidePrice_Down__c} variant="label-hidden" readonly></lightning-input> -->
                            <p><lightning-formatted-number value={estimate.GuidePrice_Down__c}></lightning-formatted-number></p>
                        </div>
                        <div class="custom-box" style="display: inline-block;width: 13%;">
                                <span>标准价格的最高价总额</span>
                                <!-- <lightning-input type="number" label="标准价格的最高价总额" value={estimate.GuidePrice_Up__c} variant="label-hidden" readonly></lightning-input> -->
                                <p><lightning-formatted-number value={estimate.GuidePrice_Up__c}></lightning-formatted-number></p>
                            </div>
                        <div class="custom-box" style="display: inline-block;width: 14%;">
                                <span>申请报价金额</span>
                                <!-- 数值验证 -->
                                <lightning-input type="number" label="申请报价金额" value={estimate.Request_quotation_Amount__c} variant="label-hidden"  disabled={IsRequestQuotationAmountDisabled} onblur={checkDiscount} step="any"></lightning-input>
                            </div>
                        <div class="custom-box" style="display: inline-block;width: 12%;">
                                <span>合同设备修理总额</span>
                                <!-- <lightning-input type="number" label="合同设备修理总额" value={estimate.Asset_Repair_Sum_Price__c} variant="label-hidden" readonly></lightning-input> -->
                                <p><lightning-formatted-number value={estimate.Asset_Repair_Sum_Price__c}></lightning-formatted-number></p>
                            </div>
                        <div class="custom-box" style="display: inline-block;width: 12%;">
                                <span>合同总金额</span>
                                <!-- <lightning-input type="number" label="合同总金额" value={estimate.Maintenance_Price__c} variant="label-hidden" readonly></lightning-input> -->
                                <p><lightning-formatted-number value={estimate.Maintenance_Price__c}></lightning-formatted-number></p>
                            </div>
                        <div class="custom-box" style="display: inline-block;width: 12%;">
                                <span>上限金额</span>
                                <lightning-input type="number" label="上限金额" value={estimate.Limit_Price_Amount__c} variant="label-hidden" onblur={handleLimitPriceAmount} disabled={IsLimitPriceAmountDisabled} style="ime-mode: disabled; text-align: right;" step="any"></lightning-input>
                            </div>
                    </div>
                    <div class="line">
                        <div class="custom-box" style="display: inline-block;width: 20%;">
                            <span>当【合同预定开始日】在{allData.startdateaddsix1}之前</span>
                        </div>
                        <div class="custom-box" style="display: inline-block;width: 13%;">
                            <span>标准价格的最低价总额</span>
                            <div>CNY &nbsp;&nbsp;<lightning-formatted-number value={estimate.GuidePrice_Down1__c}></lightning-formatted-number></div>
                        </div>
                        <div class="custom-box" style="display: inline-block;width: 13%;">
                                <span>标准价格的最高价总额</span>
                                <div>CNY &nbsp;&nbsp;<lightning-formatted-number value={estimate.GuidePrice_Up1__c}></lightning-formatted-number></div>
                            </div>
                        <div class="custom-box" style="display: inline-block;width: 14%;">
                                <span>相对标准价格范围的折扣率</span>
                                <!-- <lightning-input-field label="相对标准价格范围的折扣率" type="text" variant = "label-hidden" field-name="Service_discount_Rate__c" value={estimate.Service_discount_Rate__c} readonly></lightning-input-field> -->
                                <p><lightning-formatted-number value={estimate.Service_discount_Rate__c}></lightning-formatted-number>%</p>
                            </div>
                        <div class="custom-box" style="display: inline-block;width: 12%;">
                                <span>合同定价总额</span>
                                <!-- <lightning-input type="number" label="合同定价总额" value={estimate.Total_Contract_Price__c} variant="label-hidden" readonly></lightning-input> -->
                                <p><lightning-formatted-number value={estimate.Total_Contract_Price__c}></lightning-formatted-number></p>
                            </div>
                        <div class="custom-box" style="display: inline-block;width: 12%;">
                                <span>最近一期合同消费率</span>
                                <!-- <lightning-input-field label="最近一期合同消费率" type="date" variant = "label-hidden" field-name="Combined_rate__c" value={estimate.Combined_rate__c} readonly></lightning-input-field> -->
                                <p><lightning-formatted-number value={estimate.Combined_rate__c}></lightning-formatted-number>%</p>
                            </div>
                        <div class="custom-box" style="display: inline-block;width: 12%;">
                                 <span>预测消费率</span>
                                <!-- input -readOnly 有黑底框 -->
                                <lightning-output-field type="number" variant = "label-hidden" field-name="Consumption_rate_Forecast__c"  value={estimate.Consumption_rate_Forecast__c}></lightning-output-field>
                            </div>
                    </div>
                    <div class="line">
                        <div class="custom-box" style="display: inline-block;width: 20%;">
                            <span>当【合同预定开始日】在{allData.startdateaddsix2}之后</span>
                        </div>
                        <div class="custom-box" style="display: inline-block;width: 13%;">
                            <span>标准价格的最低价总额</span>
                                <div>CNY &nbsp;&nbsp;<lightning-formatted-number value={estimate.GuidePrice_Down2__c}></lightning-formatted-number></div>
                        </div>
                        <div class="custom-box" style="display: inline-block;width: 13%;">
                                <span>标准价格的最高价总额</span>
                                <div>CNY &nbsp;&nbsp;<lightning-formatted-number value={estimate.GuidePrice_Up2__c}></lightning-formatted-number></div>
                            </div>
                        <div class="custom-box" style="display: inline-block;width: 14%;">
                                <span>价格范围</span>
                                <p><lightning-formatted-text  value={estimate.Estimate_Price_range__c}></lightning-formatted-text></p>
                            </div>
                        <div class="custom-box" style="display: inline-block;width: 12%;">
                                <span>申请价格级别</span>
                                <p><lightning-formatted-text  value={estimate.ContractPriceType__c}></lightning-formatted-text></p>
                            </div>
                        <div class="custom-box" style="display: inline-block;width: 12%;">
                                <span>合同种类</span>
                                <!-- 改为p -->
                                <p><lightning-formatted-text value={estimate.New_Contract_Type_TxT__c}></lightning-formatted-text></p>
                                <!-- <lightning-input type="text" variant="label-hidden" value={estimate.New_Contract_Type_TxT__c} readonly></lightning-input> -->
                            </div>
                    </div>
                    <div class="line">
                        <div class="custom-box" style="display: inline-block;width: 20%;">
                            <span>当【合同预定开始日】在{allData.startdateaddsix3}之前</span>
                        </div>
                        <div class="custom-box" style="display: inline-block;width: 13%;">
                            <span>标准价格的最低价总额</span>
                                <div>CNY &nbsp;&nbsp;<lightning-formatted-number value={estimate.GuidePrice_Down3__c}></lightning-formatted-number></div>
                        </div>
                        <div class="custom-box" style="display: inline-block;width: 13%;">
                                <span>标准价格的最高价总额</span>
                                <div>CNY &nbsp;&nbsp;<lightning-formatted-number value={estimate.GuidePrice_Up3__c}></lightning-formatted-number></div>
                            </div>
                        <div class="custom-box" style="display: inline-block;width: 14%;">
                                <span>无缝续签折扣</span>
                                <lightning-input-field label="无缝续签折扣" type="checkbox" variant = "label-hidden" field-name="renewTen_OFF__c" value={estimate.renewTen_OFF__c} disabled={IsRenewTenOFFDisabled}  onchange={handleRenewTenOFF}></lightning-input-field>
                            </div>
                        <!-- 2023/09/06 报价规则改善新增 if:false={allData.isLimitPrice} -->
                        <div class="custom-box" style="display: inline-block;width: 12%;" if:false={allData.isLimitPrice}>
                                <span>同意无缝续签</span>
                                <lightning-input-field label="同意无缝续签" type="checkbox" variant = "label-hidden" field-name="AgreeRenewTen_OFF__c" value={estimate.AgreeRenewTen_OFF__c} disabled={AgreeRenewTenDisabled} onchange={handleAgreeRenewTenOFF}></lightning-input-field>
                        </div>
                    </div>
                </div>
                </lightning-record-edit-form>
            </lightning-accordion-section>
            <lightning-accordion-section name="E" label="申请背景">
                <lightning-record-edit-form
                    object-api-name={objName}
                    record-id={recordId}
                >
                <div class="c-container">
                    <lightning-layout pull-to-boundary="medium">
                        <lightning-layout-item size="3" padding="horizontal-medium">
                            <div class="custom-box">
                                <span>最终价格决定形式</span>
                                <lightning-input-field label="最终价格决定形式" field-name="finalPriceDecideWay__c" variant = "label-hidden" value={estimate.finalPriceDecideWay__c} disabled={PageDisabled} onchange={handleFinalPriceDecideWay}> </lightning-input-field>
                            </div>
                        </lightning-layout-item>
                        <lightning-layout-item size="2" padding="horizontal-medium">
                            <div class="custom-box">
                                <span>是否销售附带</span>
                                <lightning-input-field label="是否销售附带" type="checkbox" field-name="Sales_incidental__c" variant = "label-hidden" value={estimate.Sales_incidental__c} disabled={PageDisabled} checked={estimate.Sales_incidental__c} onchange={handleSalesIncidental}> </lightning-input-field>
                            </div>
                        </lightning-layout-item>
                        <lightning-layout-item size="2" padding="horizontal-medium">
                            <div class="custom-box">
                                <span>主要谈判次数</span>
                                <lightning-input-field label="主要谈判次数" field-name="mainTalksTime__c" variant = "label-hidden" value={estimate.mainTalksTime__c} disabled={PageDisabled} onchange={handleMainTalksTime}> </lightning-input-field>
                            </div>
                        </lightning-layout-item>
                        <lightning-layout-item size="3" padding="horizontal-medium">
                            <div class="custom-box">
                                <span>谈判的开始时间</span>
                                <lightning-input-field label="谈判的开始时间" field-name="talksStartDate__c" variant = "label-hidden" value={estimate.talksStartDate__c} disabled={PageDisabled} onchange={handleTalksStartDate}> </lightning-input-field>
                            </div>
                        </lightning-layout-item>
                        <lightning-layout-item size="2" padding="horizontal-medium">
                            <div class="custom-box">
                                <span>经销商和医院的价格</span>
                                <!-- classic 仅保存两位小数 -->
                                <lightning-input type="number" label="经销商和医院的价格" value={estimate.AgencyHos_Price__c} variant="label-hidden" disabled={PageDisabled} onblur={handleAgencyHosPrice} step="0.01"></lightning-input>
                            </div>
                        </lightning-layout-item>
                    </lightning-layout>
                    <!-- <lightning-layout pull-to-boundary="medium">
                    </lightning-layout>
                    <lightning-layout pull-to-boundary="medium">
                    </lightning-layout> -->
                    <!-- <lightning-layout pull-to-boundary="medium">
                    </lightning-layout> -->
                    <lightning-layout pull-to-boundary="medium">
                        <lightning-layout-item flexibility="auto" padding="horizontal-medium">
                            <div class="custom-box">
                                <span>价格申请理由</span>
                                <lightning-input-field label="价格申请理由" field-name="Discount_reason__c" variant = "label-hidden" value={estimate.Discount_reason__c} disabled={PageDisabled} onchange={handleDiscountReason}> </lightning-input-field>
                            </div>
                        </lightning-layout-item>
                        <lightning-layout-item flexibility="auto" padding="horizontal-medium">
                            <div class="custom-box">
                                <span>消费率改善方案</span>
                                <lightning-input-field  label="消费率改善方案" type="textarea" field-name="Improve_ConsumptionRate_Idea__c" variant = "label-hidden" value={estimate.Improve_ConsumptionRate_Idea__c} disabled={PageDisabled} onchange={handleImproveConsumptionRateIdea}> </lightning-input-field>
                            </div>
                        </lightning-layout-item>
                    </lightning-layout>
                </div>
                </lightning-record-edit-form>
            </lightning-accordion-section>
        </lightning-accordion>
         <lightning-record-edit-form
                object-api-name={objName}
                record-id={recordId}
            >
        <!-- 按钮 -->
        <!-- display: flex;
            align-items: center;
            justify-content: flex-end; -->
        <div class="bottom c-container" style="padding: 20px 0 0 0;border-top: 1px solid #e5e5e5;">
                <div class="pdf" style="background-color: #ffd6c1;margin: 0 10px;padding: 0 10px;">
                    <div class=" c-container" style="display: flex;
                        align-items: center;
                        justify-content: space-between;" if:true={printFlag}>
                        <span>打印报价</span>
                        <div class="pdfCheck">
                            <lightning-input-field label="完整版+折扣前" field-name="Print_ListPrice__c" data-param='Print_ListPrice__c' type="checkbox" variant="label-hidden" checked={estimate.Print_ListPrice__c} value={estimate.Print_ListPrice__c} onchange={handleSimply}></lightning-input-field>完整版+折扣前
                        </div>
                        <div class="pdfCheck">
                            <lightning-input-field  label="完整版+折扣后" field-name="Print_Simplify__c" data-param='Print_Simplify__c' type="checkbox" variant="label-hidden" checked={estimate.Print_Simplify__c} value={estimate.Print_Simplify__c} onchange={handleSimply}></lightning-input-field>完整版+折扣后
                        </div>
                        <div class="pdfCheck">
                            <lightning-input-field label="简化版+折扣前" field-name="Print_RepairPrice__c" data-param='Print_RepairPrice__c' type="checkbox" variant="label-hidden" checked={estimate.Print_RepairPrice__c} value={estimate.Print_RepairPrice__c} onchange={handleSimply}></lightning-input-field>简化版+折扣前
                        </div>
                        <div class="pdfCheck">
                            <lightning-input-field label="简化版+折扣后" field-name="Print_SumPrice__c" data-param='Print_SumPrice__c' type="checkbox" variant="label-hidden" checked={estimate.Print_SumPrice__c} value={estimate.Print_SumPrice__c} onchange={handleSimply}></lightning-input-field>简化版+折扣后
                        </div>
                        <lightning-button variant="brand-outline" label="PDF印刷" title="Primary action with lighter look" onclick={handlePrint} class="slds-m-left_x-small"></lightning-button>
                    </div>
                    <!--医院合同,代理商合同 原page不可点  -->
                    <!-- <div class=" c-container" style="display: flex;
                        align-items: center;
                        justify-content: space-between;">
                        <span>打印合同配置</span>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;医院合同
                        <div if:true={EnablePrintContract} style="font-weight: normal;">
                            <lightning-input-field label="三方协议" field-name="Print_Tripartite__c" type="checkbox" data-param='Print_Tripartite__c' variant = "label-hidden" checked={estimate.Print_Tripartite__c} value={estimate.Print_Tripartite__c} onchange={handlePrintContract} style="display: inline-block;"></lightning-input-field>三方协议
                        </div>
                        <span if:false={EnablePrintContract} style="font-weight: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;三方协议</span>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;代理商合同
                        <lightning-button variant="brand-outline" label="PDF印刷" title="Primary action with lighter look" onclick={handlePrint} class="slds-m-left_x-small"></lightning-button>
                    </div> -->
                </div>
            <div style="display: flex;justify-content: space-between;text-align: right;align-items: center;justify-content: flex-end;">
                <!-- <div style="display: flex;margin-top: 5px; ">
                    <div class="custom-box bottomVMItem">
                        <span>合同开始日</span>
                        <lightning-input-field label="合同开始日" field-name="Contract_Start_Date__c" variant = "label-hidden" value={estimate.Contract_Start_Date__c} disabled={IsContractstartdateDisabled} onchange={handleContractStartDate} style="display: inline-block;width: 120px;"></lightning-input-field>
                    </div>
                    <div class="custom-box bottomVMItem">
                        <span>合同结束日</span>
                        <lightning-input-field label="合同结束日"  field-name="Contract_End_Date__c" variant = "label-hidden" value={estimate.Contract_End_Date__c} disabled style="width: 120px;"></lightning-input-field>
                    </div>
                </div> -->
                <div  class="bottomBtn" style="text-align: right;margin-top: 10px;display: flex;">
                    <div style="display: flex;margin-top: 2px; ">
                        <div class="custom-box bottomVMItem">
                            <span>合同开始日</span>
                            <lightning-input-field label="合同开始日" field-name="Contract_Start_Date__c" variant = "label-hidden" value={estimate.Contract_Start_Date__c} disabled={IsContractstartdateDisabled} onchange={handleContractStartDate} style="display: inline-block;width: 120px;"></lightning-input-field>
                        </div>
                        <div class="custom-box bottomVMItem">
                            <span>合同结束日</span>
                            <lightning-input-field label="合同结束日"  field-name="Contract_End_Date__c" variant = "label-hidden" value={estimate.Contract_End_Date__c} disabled style="width: 120px;"></lightning-input-field>
                        </div>
                    </div>
                    <!-- 2023/09/06 disabled={SaveBtnDisabled}-->
                    <!-- 2023/09/18  计算预测消费率 暂注释-->
                    <!-- <button onclick={consumptionbtnJs} disabled={SaveBtnDisabled} style="width: 120px;">计算预测消费率</button> -->
                    <button onclick={handleSave} disabled={SaveBtnDisabled}>保存</button>
                    <button onclick={handleApprove} disabled={ApprovalBtnDisabled}>提交待审批</button>
                    <button onclick={decideJs} disabled={DecideBtnDisabled}>Decide</button>
                    <button onclick={handleUndecide} disabled={UnDecideBtnDisabled}>取消Decide</button>
                    <div style="color:red;font-size:20px;text-align: center;font-weight: normal;" if:true={IS_Clone_After_Decide}>请提交待审批</div>
                </div>
            </div>
        </div>
    </lightning-record-edit-form>
    </lightning-card>
</template>
force-app/main/default/lwc/lexSelectAssetEstimateVM/lexSelectAssetEstimateVM.js
New file
@@ -0,0 +1,2808 @@
import { LightningElement,wire,track,api} from 'lwc';
import LightningConfirm from 'lightning/confirm';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { NavigationMixin } from 'lightning/navigation';
import { CurrentPageReference } from "lightning/navigation";
import estimateUtility from 'c/lexSelectEstimateUtility';
import init from "@salesforce/apex/lexSelectAssetEstimateVMController.init";
import save from "@salesforce/apex/lexSelectAssetEstimateVMController.save";
import refreshProductData from "@salesforce/apex/lexSelectAssetEstimateVMController.refreshProductData";
import saveAndCancel from "@salesforce/apex/lexSelectAssetEstimateVMController.saveAndCancel";
import addNewRows from "@salesforce/apex/lexSelectAssetEstimateVMController.addNewRows";
import searchBtn from "@salesforce/apex/lexSelectAssetEstimateVMController.searchBtn";
import exchangeAsset from "@salesforce/apex/lexSelectAssetEstimateVMController.exchangeAsset";
import approvalProcess from "@salesforce/apex/lexSelectAssetEstimateVMController.approvalProcess";
import ComputeLTYRepair from "@salesforce/apex/lexSelectAssetEstimateVMController.ComputeLTYRepair";
import ShowLTYRepair from "@salesforce/apex/lexSelectAssetEstimateVMController.ShowLTYRepair";
import toApprovalProcess from "@salesforce/apex/lexSelectAssetEstimateVMController.toApprovalProcess";
import decide from "@salesforce/apex/lexSelectAssetEstimateVMController.decide";
import decideCancle from "@salesforce/apex/lexSelectAssetEstimateVMController.decideCancle";
import undecide from "@salesforce/apex/lexSelectAssetEstimateVMController.undecide";
import print from "@salesforce/apex/lexSelectAssetEstimateVMController.print";
import sendEmail from "@salesforce/apex/lexSelectAssetEstimateVMController.sendEmail";
// 前端分页 - del
// import firstPage from "@salesforce/apex/lexSelectAssetEstimateVMController.firstPage";
// import previousPage from "@salesforce/apex/lexSelectAssetEstimateVMController.previousPage";
// import nextPage from "@salesforce/apex/lexSelectAssetEstimateVMController.nextPage";
// import endPage from "@salesforce/apex/lexSelectAssetEstimateVMController.endPage";
// import recordNumChange from "@salesforce/apex/lexSelectAssetEstimateVMController.recordNumChange";
import getApprovalBtnNewDisabled from "@salesforce/apex/lexSelectAssetEstimateVMController.getApprovalBtnNewDisabled";
import ToConsumptionRate from "@salesforce/apex/ConsumptionRateWebService.ToConsumptionRate";
import interceptsend from "@salesforce/apex/lexSelectAssetEstimateVMController.interceptsend";
//前端需要补充方法
import getMCAEIsCreateable from "@salesforce/apex/lexSelectAssetEstimateVMController.getMCAEIsCreateable";
import saveBeforeCheckPriceChangeAsset from "@salesforce/apex/lexSelectAssetEstimateVMController.saveBeforeCheckPriceChangeAsset";
import saveBeforeCheckPriceChangeProduct2 from "@salesforce/apex/lexSelectAssetEstimateVMController.saveBeforeCheckPriceChangeProduct2";
import onChDealerUpdate from "@salesforce/apex/lexSelectAssetEstimateVMController.onChDealerUpdate";
import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
import {loadStyle} from 'lightning/platformResourceLoader';
import lexSendNfm103 from '@salesforce/resourceUrl/lexSendNfm103';
// import test from "@salesforce/apex/lexSelectAssetEstimateVMController.test";
//completion=? page里跳转回原编辑页面  id=传回参数
export default class lexSelectAssetEstimateVM extends NavigationMixin(LightningElement){
    activeSections = ['A', 'B','C','D','E'];
    // @track activeSections = ['A'];
    IsLoading = true;
    objName = 'Maintenance_Contract_Estimate__c';
    recordId;
    params;
    goTo;
    IsParams;
    //三方协议 勾选是否显示
    EnablePrintContract;
    //请提交待审批 文字提示
    IS_Clone_After_Decide;
    @track
    estimate = {};
    contract = {};
    @track estimateTemp = {Request_quotation_Amount__c : 0,AgencyHos_Price__c : 0};
    @track estimateAgencyHosPrice = {AgencyHos_Price__c : 0};
    //存放初始化所有数据
    allData = {};
    checkedAssetRelatedMaintenanceContractAssetEstimate = 'Maintenance_Contract_Asset_Estimate__c';
    //页面数据显示  recId -- rec.Id(原通过后端的get方法取值)
    checkedAssetData = [];
    IsCheckAllcheckedAsset = false;
    //选中保有设备  数据统计 //allData.productCount3 可替换
    productCount3 = 0;
    checkedAssetDataSize = true;
    //修理总额--仅页面显示
    assetRepairSumNum;
    //未选中保有设备 弹框显示与否
    IsShowUnCheckedAsset;
    unCheckedAssetData = [];
    IsCheckAllUncheckedAsset = false;
    unCheckedAssetDataLength;
    //分页处理--是否可以直接在前端处理
    currentPage = 1;
    pageDataLimit = 20;
    pageCount;
    //未选中保有设备  下方文字
    unCheckedAssetDataShow1 ;
    unCheckedAssetDataShow2 ;
    //当前页数据
    unCheckedAssetNowData = [];
    //保有设备 搜索条件  -> allData里
    text1 = 'S:AssetMark__c';                      // 对象
    cond1 = 'equals';                   // 条件
    val1;
    //前端判断按钮是否可以点击
    SaveBtnDisabled;
    ApprovalBtnDisabled;
    //后台返回结果
    ApprovalBtnNewDisabled;
    PageDisabled;
    hasSendEmail;
    //allData.productCount 可替换
    productCount;
    //报价提交对象 变更按钮 Disabled  DecideBtnDisabled
    DecideBtnDisabled;
    UnDecideBtnDisabled;
    //提交RC评估 btn
    SendEmailBtnDisabled;
    //补充初始化数据
    approvalDate = '';
    refreshAssetBtn;
    // lwc 刷新按钮禁用
    refreshAssetBtnLWC;
    IsTop;
    IsPre;
    IsNext;
    IsEnd;
    lineAddBtn;
    IsChangePageLimit;
    printFlag = true;
    //相关字段改动导致禁用或不显示
    IsContractstartdateDisabled;
    IsDealerDisabled;
    // del 该禁用字段已改为只读
    // IsFirstParagraphEndDisabled;
    AgreeRenewTenDisabled;
    IsRequestQuotationAmountDisabled;
    IsLimitPriceAmountDisabled;
    IsContractEstiStartDateDisabled;
    //页面数据刷新
    IsRefresh = true;
    EstimateTargetIsDealer;
    EstimatePricerange;
    ContractPriceType;
    //获取Id
    @wire(CurrentPageReference)
    getStateParameters(currentPageReference) {
        if (currentPageReference) {
            const urlValue = currentPageReference.state.fragment;
            if (urlValue) {
                this.otherParams = urlValue;
                let str = `${urlValue}`;
                this.params = str.split('=');
                this.recordId = str.split('=')[1];
                this.IsParams = this.params[0] == 'id';
                this.goTo = true;
            }else{
                estimateUtility.toast.showToast(this, 'error', '请从合同和报价页面进入');
                setTimeout(function() {
                         window.open('/lightning/page/home','_self');
                    }, 3000);
                this.goTo = false;
            }
        }
    }
    //页面初始化
    connectedCallback() {
         Promise.all([
            loadStyle(this, lwcCSS),
            loadStyle(this, lexSendNfm103)
           ]);
         if (this.goTo) {
            init({
                recordId: this.recordId,
                param: this.params[0],
            }).then(result => {
                result = JSON.parse(result);
                console.log('result',result);
                console.log('estimate===',JSON.stringify(result.estimate));
                if (result != null) {
                    this.allData = result;
                    this.handleInitSimpleData(result);
                    this.allData.checkedAssets = this.refreshAsset(result.checkedAssets.length,result.checkedAssets);
                    this.handleCheckedAssetColumnsAndData(this.allData.checkedAssets);
                    this.handleunCheckedAssetColumnsAndData(this.allData.unCheckedAssets);
                    this.calonLoad();
                    this.allDataInfo();
                }
            }).catch(error => {
                console.log('错误==='+error);
                estimateUtility.toast.showToast(this, 'error', '无法显示维修合同报价');
            }).finally(() => {
                const sections = this.template.querySelectorAll('lightning-accordion-section');
                    sections.forEach(section => {
                        if(section.id.includes('myAccordionSection')) {
                            section.active = true;
                        }
                    });
                this.IsLoading = false;
            });
         }
    }
    handleCheckedAssetColumnsAndData(checkedAssets){
        console.log('handleCheckedAssetColumnsAndData');
        this.IsRefresh = false;
        let checkedAssetsData = [];
        let index = 0;
        let assetsCount = 0;
        let refreshAssetBtnLWCDisabled = true;
        checkedAssets.forEach(function(ar) {
            let objData = {};
            objData['lineNo'] = ar.lineNo;
            objData['rec_checkBox_c'] =  ar.rec_checkBox_c;
            objData['IsManual'] = ar.isManual;
            objData['CheckRows'] =ar.CheckRows;
            objData['Repair_Price_Auto'] =ar.Repair_Price_Auto;
            //共有字段
            if (ar.mcae != null) {
                objData['EquipmentGuaranteeFlgTxt__c'] = ar.mcae.EquipmentGuaranteeFlgTxt__c;
                objData['Check_Object__c'] = ar.mcae.Check_Object__c;
                objData['IsNew__c'] = ar.mcae.IsNew__c;
                // if (ar.mcae.Adjustment_Upper_price__c !=null && ar.mcae.Adjustment_Upper_price__c !='') {
                //     let aup  = 0;
                //     aup = ar.mcae.Adjustment_Upper_price__c;
                //     objData['Adjustment_Upper_price__c'] = parseFloat(aup.toLocaleString('en-US', { style: 'currency', currency: 'USD', minimumFractionDigits: 2 }));
                // }
                objData['Adjustment_Upper_price__c'] = ar.mcae.Adjustment_Upper_price__c;
                objData['Adjustment_Lower_price__c'] = ar.mcae.Adjustment_Lower_price__c;
                objData['Repair_Price__c'] = ar.mcae.Repair_Price__c;
                objData['Comment__c'] = ar.mcae.Comment__c;
                objData['commentTitle'] = ar.mcae.Comment__c ? ar.mcae.Comment__c : '';
                objData['Third_Party_Return__c'] = ar.mcae.Third_Party_Return__c;
            }
            if (ar.rec != null) {
                objData['IsCurrentContract'] = ar.rec.CurrentContract_F__c != null;
                objData['recId'] = ar.rec.Id;
                objData['CurrentContract_F__c'] = ar.rec.CurrentContract_F__c;
            }
            if (ar.isManual == true && ar.mcae != null) {
              objData['Name'] = ar.mcae.Product_Manual__c;
              if (ar.mcae.Product_Manual__c) {
                assetsCount += 1;
              }
            }else if ( ar.isManual == false) {
                assetsCount += 1;
                if (ar.rec != null) {
                  objData['Name'] = ar.rec.Name;
                  refreshAssetBtnLWCDisabled = false;
                  objData['CurrentContract_End_Date__c'] = ar.rec.CurrentContract_End_Date__c;
                  objData['Asset_situation__c'] = ar.rec.Asset_situation__c;
                  objData['SerialNumber'] = ar.rec.SerialNumber;
                  objData['InstallDate'] = ar.rec.InstallDate;
                  objData['Department_Name__c'] = ar.rec.Department_Name__c;
                  if (ar.rec.CurrentContract_F__r != null) {
                    if (ar.rec.CurrentContract_F_asset__r != null) {
                        objData['IS_VMContract_Asset__c'] =  ar.rec.CurrentContract_F_asset__r.IS_VMContract_Asset__c;
                    }
                    objData['Maintenance_Contract_No_F__c'] = ar.rec.CurrentContract_F__r.Maintenance_Contract_No_F__c;
                    objData['Contract_End_Date__c'] =  ar.rec.CurrentContract_F__r.Contract_End_Date__c;
                  }
              }
              if (ar.mcae != null) {
                objData['Asset_Consumption_rate__c'] =  ar.mcae.Asset_Consumption_rate__c;
              }
            }
            //补充字段可否编辑
            objData['IsAssertDisabled'] =  ar.IsAssertDisabled;
            objData['IsRepairPriceDisabled'] =  ar.IsRepairPriceDisabled;
            objData['ISCommentDisabled'] =  ar.ISCommentDisabled;
            objData['IsThirdPartyReturnDisabled'] =  ar.IsThirdPartyReturnDisabled;
            objData['ShowAssetSituation'] =  ar.ShowAssetSituation;
            checkedAssetsData.push(objData);
        });
        this.checkedAssetData = checkedAssetsData;
        //已选择保有设备
        //this.productCount3 统计
        this.productCount3 = assetsCount;
        this.allData.productCount3 = this.productCount3;
        this.refreshAssetBtnLWC = this.refreshAssetBtnLWC || refreshAssetBtnLWCDisabled;
        this.IsRefresh = true;
    }
    handleunCheckedAssetColumnsAndData(unCheckedAssets){
        console.log('handleunCheckedAssetColumnsAndData');
        this.IsRefresh = false;
        let uncheckedAssetsData = [];
        let refreshAssetBtnDisabled = true;
        unCheckedAssets.forEach(function(ar) {
             let objData = {};
            //共有字段
            objData['rec_checkBox_c'] = ar.rec_checkBox_c;
            if (ar.mcae != null) {
            }
            if (ar.rec != null) {
                objData['Id'] = ar.rec.Id;
                //复选框可勾选判断 disabled="{!IF(ar.rec.Maintenance_Price_Month__c == 0 || ar.rec.IF_Warranty_Service__c = '否', 'true', 'false')}"
                objData['uncheckedDisable'] = ar.rec.Maintenance_Price_Month__c == 0 || ar.rec.IF_Warranty_Service__c == '否';
                // 未选择 有可勾选内容
                if (!objData['uncheckedDisable']) {
                    refreshAssetBtnDisabled = false;
                }
                objData['EquipmentGuaranteeFlg__c'] = ar.rec.EquipmentGuaranteeFlg__c;
                objData['name'] = ar.rec.Name;
                objData['Asset_situation__c'] = ar.rec.Asset_situation__c;
                objData['SerialNumber'] = ar.rec.SerialNumber;
                objData['InstallDate'] = ar.rec.InstallDate;
                objData['Department_Name__c'] = ar.rec.Department_Name__c;
                objData['IF_Warranty_Service__c'] = ar.rec.IF_Warranty_Service__c;
                objData['AssetMark__c'] = ar.rec.AssetMark__c;
                objData['EquipmentGuaranteeFlg__c'] = ar.rec.EquipmentGuaranteeFlg__c;
                objData['Reson_Can_not_Warranty__c'] = ar.rec.Reson_Can_not_Warranty__c;
                objData['Accumulation_Repair_Amount__c'] = ar.rec.Accumulation_Repair_Amount__c;
                // objData['Maintenance_Price_Month__c'] = ar.rec.Maintenance_Price_Month__c;
                objData['CurrentContract_End_Date__c'] = ar.rec.CurrentContract_End_Date__c;
            }
            uncheckedAssetsData.push(objData);
        });
        this.unCheckedAssetData = uncheckedAssetsData;
        console.log('this.unCheckedAssetData',this.unCheckedAssetData);
        this.getUnCheckedAssetNowData();
        this.refreshAssetBtn = this.refreshAssetBtn || refreshAssetBtnDisabled;
        this.IsRefresh = true;
    }
    handleInitSimpleData(result) {
        console.log('handleInitSimpleData');
        this.IsRefresh = false;
        this.estimate = result.estimate;
        this.handleEstimateTargetIsHospitalTrue();
        if (this.estimate.Is_RecognitionModel__c  == null || !this.estimate.Is_RecognitionModel__c) {
            this.estimate.Is_RecognitionModel__c = false;
        }
        if (this.estimate.Print_RepairPrice__c == null || !this.estimate.Print_RepairPrice__c) {
            this.estimate.Print_RepairPrice__c = false;
        }
        if (this.estimate.Print_SumPrice__c == null || !this.estimate.Print_SumPrice__c) {
            this.estimate.Print_SumPrice__c = false;
        }
        if (this.estimate.Print_Contract__c == null || !this.estimate.Print_Contract__c) {
            this.estimate.Print_Contract__c = false;
        }
        if (this.estimate.Print_Tripartite__c == null || !this.estimate.Print_Tripartite__c) {
            this.estimate.Print_Tripartite__c = false;
        }
        if (this.estimate.Print_Agent__c == null || !this.estimate.Print_Agent__c) {
            this.estimate.Print_Agent__c = false;
        }
        this.contract = result.contract;
        this.pageDataLimit = result.selRecordOption;
        this.currentPage = result.currPage;
        this.pageCount = result.totalPage;
        this.IsChangePageLimit = result.totalRecords<10;
        this.hasSendEmail = result.hasSendEmail;
        this.productCount = result.checkedAssets.length;
        this.val1 = result.val1;
        this.productCount3 = result.productCount3;
        this.IS_Clone_After_Decide = result.IS_Clone_After_Decide;
        this.allData.text1 = this.text1 ;                  // 对象
        this.allData.cond1 = this.cond1 ;
        if (this.contract.Decided_Estimation__c || this.estimate.Process_Status__c && this.estimate.Process_Status__c != '草案中') {
            this.SaveBtnDisabled = true;
            this.ApprovalBtnDisabled  = true;
            this.PageDisabled = true;
            this.SendEmailBtnDisabled = true;
        }else{
            this.SaveBtnDisabled = false;
            this.ApprovalBtnDisabled = false;
            this.SendEmailBtnDisabled = false;
            this.PageDisabled = false;
            if(this.hasSendEmail == true){
                this.SendEmailBtnDisabled = true;
            }
        }
        if(this.contract.Decided_Estimation__c || this.estimate.Process_Status__c != '批准'
            || (this.estimate.Change_Dealer_Approval__c && this.estimate.Change_Dealer_Approval__c != '批准'
                && this.estimate.Change_Dealer_Approval__c != '未批准')){
            this.DecideBtnDisabled = true;
        }else{
            this.DecideBtnDisabled = false;
        }
        if (this.contract.Decided_Estimation__c) {
            this.EnablePrintContract = this.estimate.Estimation_Decision__c;
            if (this.estimate.Estimation_Decision__c) {
                this.UnDecideBtnDisabled = false;
            }
        }else{
            this.UnDecideBtnDisabled = true;
            this.EnablePrintContract = false;
        }
        getMCAEIsCreateable({
        }).then(result => {
            console.log('getMCAEIsCreateable result',result);
            this.lineAddBtn = this.PageDisabled || !result;
        }).catch(error => {
        }).finally(() => {
        });
        if (this.contract.Decided_Estimation__c || this.estimate.Process_Status__c && this.estimate.Process_Status__c != '草案中') {
            // TODO 特別資格があれば 申請可能にする
            this.ApprovalBtnNewDisabled = true;
        }else{
            getApprovalBtnNewDisabled({
            }).then(result => {
                this.ApprovalBtnNewDisabled = result;
                console.log('getApprovalBtnNewDisabled this.ApprovalBtnNewDisabled',this.ApprovalBtnNewDisabled);
            }).catch(error => {
            }).finally(() => {
            });
        }
        // 报价规则改善 20230713 start
        if (result.isAgreeRenewTen == true) {
            this.AgreeRenewTenDisabled = false;
        }else{
            this.AgreeRenewTenDisabled = true;
        }
        this.refreshAssetBtn = this.SaveBtnDisabled;
        console.log('this.refreshAssetBtn ',this.refreshAssetBtn);
        this.refreshAssetBtnLWC = this.refreshAssetBtn;
        this.recordId = this.allData.targetEstimateId;
        this.IsRefresh = true;
    }
    pageBtnDiasbled(){
        console.log('pageBtnDiasbled');
        this.IsTop = this.pageCount == 0 || this.currentPage == 1;
        this.IsPre = this.pageCount == 0 || this.currentPage == 1;
        this.IsNext = this.pageCount == 0 || this.currentPage == this.pageCount;
        this.IsEnd = this.pageCount == 0 || this.currentPage == this.pageCount;
    }
    //页面按钮禁用初始化
    async calonLoad() {
        console.log('calonLoad');
        // refreshAsset 再次 空白期会被修改,实际显示值可能会与第一次计算不一致
        this.allData.checkedAssets = this.refreshAsset(this.allData.checkedAssets.length,this.allData.checkedAssets);
        this.handleCheckedAssetColumnsAndData(this.allData.checkedAssets);
        var RequestquotationAmount = this.estimate.Request_quotation_Amount__c;
        var AssetRepairSumPrice    = this.estimate.Asset_Repair_Sum_Price__c;
        var Limit_Price_Amount = (this.localParseFloat(AssetRepairSumPrice)+this.localParseFloat(RequestquotationAmount))*1.3;
        Limit_Price_Amount = Math.round(Limit_Price_Amount);
        var Limit_Price_AmountOne =  this.estimate.Limit_Price_Amount__c;
        var Limit_PriceHidden =  this.allData.OldLimitPrice;
        if (Limit_PriceHidden*1==0) {
            this.estimate.Limit_Price_Amount__c = Limit_Price_Amount;
        }
        var Limit_PriceHidden2 =  this.allData.isLimitPrice;
        if (Limit_PriceHidden2 == false) {
            this.estimate.Limit_Price_Amount__c = '';
        }
        var Price111 = this.estimate.Limit_Price_Amount__c;
        await this.pageSetDisabled();
        var createdDate = new Date(this.estimate.CreatedDate);
        // 报价中设备的机身编码为空时的新品合同有效期延长 20200710 gzw
        var aLLManual = 'true';
        var cntWithKara = this.productCount;
        for (var i = 0; i < cntWithKara; i++) {
            var isManual = this.allData.checkedAssets[i].isManual;
            if (isManual != true) {
                aLLManual = 'false';
                break;
            }
        }
        var nowDate = new Date();
        if (aLLManual == 'false') {
            createdDate = createdDate.setMonth(createdDate.getMonth() + 3);
            // FIX liang JSの時間って addMonthsないですか? そかも 1/1 なら、 4/1もだめですよ。
            if (createdDate < Date.parse(nowDate)) {
                this.SaveBtnDisabled = true;
                this.ApprovalBtnDisabled = true;
                this.SendEmailBtnDisabled = true;
                if (await estimateUtility.toast.handleConfirmClick("已超过创建日3个月,是否更新报价?")) {
                    window.location.href=window.location.origin+"/lightning/n/lexSelectAssetEstimateVM#copyid="+this.allData.targetEstimateId;
                    location.reload();
                    return true;
                } else {
                    if (!this.DecideBtnDisabled) {
                        // decide可能の場合、別途decideのチェックが必要、
                        // チェック後再度画面refreshされるため、decide可能の場合、decideボタンが使えるようになります。
                        this.changeContractStartdate(this.estimate.Contract_Start_Date__c);
                    }
                    return false;
                }
            }
        }else{
            createdDate = createdDate.setMonth(createdDate.getMonth() + 6);
            // FIX liang JSの時間って addMonthsないですか? そかも 1/1 なら、 4/1もだめですよ。
            if (createdDate < Date.parse(nowDate)) {
                this.SaveBtnDisabled = true;
                this.ApprovalBtnDisabled = true;
                this.SendEmailBtnDisabled = true;
                if (await estimateUtility.toast.handleConfirmClick("已超过创建日6个月,是否更新报价?")) {
                    window.location.href=window.location.origin+"/lightning/n/lexSelectAssetEstimateVM#copyid="+this.allData.targetEstimateId;
                    location.reload();
                    return true;
                } else {
                    if (!this.DecideBtnDisabled) {
                        // decide可能の場合、別途decideのチェックが必要、
                        // チェック後再度画面refreshされるため、decide可能の場合、decideボタンが使えるようになります。
                        this.changeContractStartdate(this.estimate.Contract_Start_Date__c);
                    }
                    return false;
                }
            }
        }
        if (!this.DecideBtnDisabled) {
            this.allData.OldMaintenancePrice = this.estimate.Maintenance_Price__c;
        }
    }
    pageSetDisabled(){
        console.log('pageSetDisabled');
        var hasSendEmail = this.allData.hasSendEmail;
        if(hasSendEmail == true){
            this.SendEmailBtnDisabled = true;
        }
        var isDisabled = this.PageDisabled;
        if (isDisabled) {
            this.IsContractEstiStartDateDisabled = true;
            var rowCnt = this.productCount;
            for (var i = 0; i < rowCnt; i++) {
                var isManual = this.allData.checkedAssets[i].isManual;
                if (isManual == true) {
                    this.allData.checkedAssets[i].IsAssertDisabled = true;
                }
                this.allData.checkedAssets[i].CheckRows = true;
                this.allData.checkedAssets[i].IsRepairPriceDisabled = true;
                this.allData.checkedAssets[i].ISCommentDisabled = true;
                this.allData.checkedAssets[i].IsThirdPartyReturnDisabled = true;
            }
            //Examination_Count,disPercent,disMoney 未找到
            //此处的 disabled 可以用PageDisabled替换
            this.IsRequestQuotationAmountDisabled = true;
            this.IsContractstartdateDisabled = true;
            var target = this.estimate.Estimate_Target__c;
            if (target != '医院') {
                this.IsDealerDisabled = true;
            }
        }
        if (!this.DecideBtnDisabled) {
            this.IsContractstartdateDisabled = false;
            // 2023/09/06 报价规则改善空白期 start +-
            var renewTenOFF = this.estimate.renewTen_OFF__c;
            var startime1 =  new Date(this.allData.Past_Contract_end_day);
            var startime2 = new Date(this.estimate.Contract_Esti_Start_Date__c);
            var result = (startime2-startime1)/(3600*24*1000);
            var VMProductCountAll = this.allData.VMProductCountAll;
            var ProductCountAll = this.allData.ProductCountAll;
            console.log('VMProductCountAll',VMProductCountAll);
            console.log('ProductCountAll',ProductCountAll);
            // 不能 添加有值判定
            if (VMProductCountAll ==ProductCountAll) {
                result = 0;
            }
            console.log('result',result);
            if (renewTenOFF) {
                if (result==0) {
                }else{
                    this.IsContractstartdateDisabled = true;
                }
            }
             // 报价规则改善空白期 end
        }
        //补充页面数据处理
        this.handleCheckedAssetColumnsAndData(this.allData.checkedAssets);
    }
    //
    async changeContractStartdate(val) {
        var oldDateStr = this.estimate.Contract_Start_Date__c;
        console.log('changeContractStartdate oldDateStr',oldDateStr);
        console.log('changeContractStartdate Date',new Date(this.estimate.Contract_Start_Date__c));
        var oldDate = new Date();
        if (oldDateStr != null && oldDateStr != '') {
            oldDate = new Date(oldDateStr);
        }
        if (!this.DecideBtnDisabled) {
            var monthStr = '00' + (oldDate.getMonth()+1);
            monthStr = monthStr.substring(monthStr.length-2, monthStr.length);
            var dayStr = '00' + oldDate.getDate();
            dayStr = dayStr.substring(dayStr.length-2, dayStr.length);
            var oldDateVal = oldDate.getFullYear() + '/' + monthStr + '/' + dayStr;
            this.allData.OldContractStartDate = oldDateVal;
            if (await this.saveBeforeCheckPriceChange()) {
            }
            this.allData.checkedAssets = this.refreshAsset(this.allData.checkedAssets.length,this.allData.checkedAssets);
            this.handleCheckedAssetColumnsAndData(this.allData.checkedAssets);
        } else {
            var cntWithKara = this.productCount;
            var haveLine = 'false';
            for (var i = 0; i < cntWithKara; i++) {
                var isManual = this.allData.checkedAssets[i].isManual;
                if (isManual) {
                    //Assert_lkid id未找到
                } else {
                    haveLine = 'true';
                }
            }
            if (haveLine == 'false') {
                return false;
            }
            var contractStartDate = new Date(val);
            var strCreatedDate = this.estimate.CreatedDate;
            var createDate = new Date();
            if (strCreatedDate != '') {
                createDate = new Date(strCreatedDate);
            }
            createDate = new Date(createDate.toDateString());
            var threeMA = new Date(createDate.setMonth(createDate.getMonth() + 3));
            var isnewMA = new Date(createDate.setMonth(createDate.getMonth() - 3 - this.allData.isNewAddMonth));
            this.estimate.Contract_Start_Date__c = val;
            //blockme();
            //contractStartDateChange();
            this.allData.checkedAssets = this.refreshAsset(this.allData.checkedAssets.length,this.allData.checkedAssets);
            this.handleCheckedAssetColumnsAndData(this.allData.checkedAssets);
        }
    }
    //分页Limit
    get pageDataLimitOptions() {
        return [
            { label: '10', value: '10' },
            { label: '20', value: '20' },
            { label: '50', value: '50' },
            { label: '100', value: '100' },
            { label: '200', value: '200' },
        ];
    }
    handlePageLimitChange(event) {
        this.IsLoading = true;
        // this.allDataInfo();
        this.pageDataLimit = event.detail.value;
        this.allData.selRecordOption = event.detail.value;
        this.allData.selctRecordNum = this.allData.selRecordOption *1;
        // recordNumChange({
        //     initDataStr: JSON.stringify(this.allData),
        // }).then(result => {
        //     this.handlePageBtnReturn(result);
        // }).catch(error => {
        // }).finally(() => {
        // });
        // 前端 处理
        this.currentPage = 1;
        this.allData.currPage = 1;
        // this.getUnCheckedAssetNowData();
        this.handleunCheckedAssetColumnsAndData(this.allData.unCheckedAssets);
        this.IsLoading = false;
    }
    //首页
    toTop(event) {
        this.IsLoading = true;
        // this.allDataInfo();
        // firstPage({
        //     initDataStr: JSON.stringify(this.allData),
        // }).then(result => {
        //     this.handlePageBtnReturn(result);
        // }).catch(error => {
        // }).finally(() => {
        // });
        // 前端 处理
        this.currentPage = 1;
        this.allData.currPage = 1;
        // this.getUnCheckedAssetNowData();
        this.handleunCheckedAssetColumnsAndData(this.allData.unCheckedAssets);
        this.IsLoading = false;
    }
    //上一页
    toPre(event) {
        this.IsLoading = true;
        // currentPage 后台未对currentPage值判断,补充--页面禁用
        if (this.currentPage <= 1) {
            this.IsLoading = false;
            return;
        } else {
            this.currentPage--;
        }
        this.allData.currPage = this.currentPage;
        // this.getUnCheckedAssetNowData();
        this.handleunCheckedAssetColumnsAndData(this.allData.unCheckedAssets);
        this.IsLoading = false;
    }
    //下一页
    toNext(event) {
        this.IsLoading = true;
        if (this.currentPage >= this.pageCount) {
            this.IsLoading = false;
            return;
        } else {
            this.currentPage++;
        }
        this.allData.currPage = this.currentPage;
        this.handleunCheckedAssetColumnsAndData(this.allData.unCheckedAssets);
        this.IsLoading = false;
    }
    //尾页
    toEnd(event) {
        this.IsLoading = true;
        // this.allDataInfo();
        // endPage({
        //     initDataStr: JSON.stringify(this.allData),
        // }).then(result => {
        //     this.handlePageBtnReturn(result);
        // }).catch(error => {
        // }).finally(() => {
        // });
        // 前端 处理
        this.currentPage = this.pageCount;
        this.allData.currPage = this.currentPage;
        // this.getUnCheckedAssetNowData();
        this.handleunCheckedAssetColumnsAndData(this.allData.unCheckedAssets);
        this.IsLoading = false;
    }
    //分页后台数据返回后处理
    handlePageBtnReturn(result){
        result = JSON.parse(result);
        this.allData = result;
        //页面相关数据初始化
        this.handleInitSimpleData(result);
        //unCheckedAssets 处理
        this.handleunCheckedAssetColumnsAndData(result.unCheckedAssets);
        this.IsLoading = false;
    }
    // 取已选择资产的机身编码 -未选择保有设备-分页按钮点击 处仅用户获取数据量-后台分页该方法不处理。
    // 前端处理:当前数据筛选  assetSerialNumberList(not contains)
    // public static void getAssetSerialNumber(InitData initData) {
    //     //LJPH-BSS6E2  ---20200911 ---add by rentongxiao start
    //     initData.contr = '2';
    //     //LJPH-BSS6E2  ---20200911 ---add by rentongxiao end
    //     initData.assetSerialNumberList = new List<String>();
    //     initData.assetSerialNumberList.clear();
    //     for (AssetInfo ai : initData.checkedAssets) {
    //         if (String.isNotEmpty(ai.rec.SerialNumber)) {
    //             initData.assetSerialNumberList.add(ai.rec.SerialNumber);
    //         }
    //     }
    // }
    //保有设备 搜索条件
    get textOpts() {
        return [
            { label: '主机/耗材', value: 'S:AssetMark__c' },
            { label: '保有设备名', value: 'S:Name' },
            { label: '机身编码', value: 'S:SerialNumber' },
            { label: '最近一期维修合同', value: 'S:CurrentContract__r.Management_Code__c' },
            { label: '装机地点', value: 'S:Installation_Site__c' },
            { label: '科室', value: 'S:Department_Name__c' },
        ];
    }
    get equalOpts() {
        return [
            { label: '等于', value: 'equals' },
            { label: '包含', value: 'contains' },
            { label: '不等于', value: 'notequals' },
        ];
    }
    //获取当前未选择的保有设备--util
    getUnCheckedAssetNowData(){
        if(this.unCheckedAssetData && this.unCheckedAssetData.length > 0){
            this.unCheckedAssetNowData = this.unCheckedAssetData.slice((this.currentPage-1)*this.allData.selRecordOption,this.currentPage*this.allData.selRecordOption);
            // this.unCheckedAssetNowData = this.unCheckedAssetData;
        }else{
            this.unCheckedAssetNowData = [];
        }
        this.unCheckedAssetDataLength = this.unCheckedAssetData.length;
        this.pageCount = Math.ceil(this.unCheckedAssetData.length / this.allData.selRecordOption);
        this.allData.currPage = this.currentPage;
        //  下方文字 所在位置
        this.unCheckedAssetDataShow1 = (this.currentPage-1)*this.pageDataLimit;
        // 数据下标 -1(最后一条数据位置)
        this.unCheckedAssetDataShow2 = this.currentPage*this.pageDataLimit >= this.allData.totalRecords ? this.allData.totalRecords : this.currentPage*this.pageDataLimit - 1;
        this.pageBtnDiasbled();
    }
    handleTableUncheckedRecCheckBox(event) {
        let index = event.currentTarget.dataset.id;
        console.log('handleTableUncheckedRecCheckBox index',index);
        this.allData.unCheckedAssets.forEach(function(ar) {
            if (ar.rec.Id == index) {
                ar.rec_checkBox_c = event.detail.checked;
                console.log('ar.rec_checkBox_c',ar.rec_checkBox_c);
            }
        });
    }
    //报价提交对象 变更 --util
    controlDisabled(event) {
        window.open("/apex/ChangeDealerApproval?eid=" + this.recordId,'ChangeDealerApproval','height=300,width=700,toolbar=no,menubar=no,left=20%,top=30%,scrollbars=yes,resizable=no,location=no,status=no');
    }
    //服务合同 内容修改   todo 通过传入参数,制定字段值
    changeDepartment(event) {
        this.estimate.Department__c = event.detail.value;
    }
    //合同开始预订日
    changeEstiStartdate(event) {
        this.IsRefresh = false;
        let val = event.detail.value;
        // event.target.value = '2022/12/12';
        this.estimate.Contract_Esti_Start_Date__c = event.detail.value;
        // 2023/09/01 合同结束预订日 显示同步
        // this.handleChangeContractEstiEndDate(this.estimate.Contract_Esti_Start_Date__c);
        // 报价规则改善 20230310 start val 2022-12-12
        var startday = estimateUtility.handleInfo.addMonths(val,6);
        var startday1 = estimateUtility.handleInfo.addMonths(val,12);
        // del startdateaddsix1-3 seamlessRenew 会重新赋值,这里给值无意义 - page好像有改动逻辑?简单看了下逻辑,依旧会重新赋值
        this.allData.startdateaddsix1 = startday;
        this.allData.startdateaddsix2 = startday;
        this.allData.startdateaddsix3 = startday1;
        this.allData.startdateaddsix4 = val;
        console.log('this.allData.startdateaddsix1 ',this.allData.startdateaddsix1 );
        console.log('this.allData.startdateaddsix2 ',this.allData.startdateaddsix2 );
        console.log('this.allData.startdateaddsix3 ',this.allData.startdateaddsix3 );
        console.log('this.allData.startdateaddsix4 ',this.allData.startdateaddsix4 );
        var rowCnt = this.productCount;
        this.allDataInfo();
        let returnData = estimateUtility.handleInfo.seamlessRenew(this,rowCnt,this.allData,this.allData.checkedAssets,this.PageDisabled,this.IsContractEstiStartDateDisabled);
        this.allData = returnData.allData;
        this.allData.checkedAssets = returnData.checkedAssets;
        this.handleInitSimpleData(this.allData);
        this.handleCheckedAssetColumnsAndData(this.allData.checkedAssets);
        // 2023/09/18 seamlessRenew 可能修改 IsContractEstiStartDateDisabled 值,handleInitSimpleData中未处理该禁用
        this.IsContractEstiStartDateDisabled = returnData.IsContractEstiStartDateDisabled;
        // 报价规则改善 20230310 end
        if (!this.SaveBtnDisabled) {
            this.estimate.Contract_Start_Date__c =val;
            this.changeContractStartdate(val);
        }
        this.makeRealPrice(1);
        this.IsRefresh = true;
    }
    // == checkContractRange
    handleChangeContractRange(event) {
        let errorMsg = '';
        //页面 required
        if (isNaN(parseInt(event.target.value))) {
            errorMsg = '必须输入合同月数!';
        }else if (event.target.value <= 0) {
            errorMsg = '合同月数必须大于0';
        }else if (event.target.value > 60) {
            errorMsg = '合同期最长只能选择60个月!';
        }
        if (errorMsg != '') {
            estimateUtility.toast.showToast(this, 'error', errorMsg);
            //页面值同步刷新
            event.target.value = null;
        }
        this.estimate.Contract_Range__c = event.target.value;
        // 2023/09/01 合同结束预订日 显示同步
        // this.handleChangeContractEstiEndDate(this.estimate.Contract_Esti_Start_Date__c);
        console.log('this.estimate.Contract_Range__c',this.estimate.Contract_Range__c);
        //页面数据刷新 --checkAssetData reresh
        this.allData.checkedAssets = this.refreshAsset(this.allData.checkedAssets.length,this.allData.checkedAssets);
        this.handleCheckedAssetColumnsAndData(this.allData.checkedAssets);
    }
    //合同结束预订日 - 有计算逻辑,填写无意义 -> 同步 初步计算
    handleChangeContractEstiEndDate(val) {
        console.log('handleChangeContractEstiEndDate');
        if (this.estimate.Contract_Esti_Start_Date__c && this.estimate.Contract_Range__c) {
            let datearr = val.split("-");//基础日期
            let months = this.estimate.Contract_Range__c *1;//增加月数 *1 转Number
            let year = parseInt(datearr[0]);
            let month = parseInt(datearr[1][0] == 0 ? datearr[1][1] : datearr[1]) - 1;
            let day = parseInt(datearr[2][0] == 0 ? datearr[2][1] : datearr[2]);
            year += Math.floor((month + months) / 12); //计算年
            month = Math.floor((month + months) % 12) + 1; //计算月
            let d_max = new Date(year + "/" + (month + 1) + "/0").getDate();  //获取计算后的月的最大天数
            if (day > d_max) {
                day = d_max;
            }
            let date = year + "-" + (month < 10 ? ("0" + month) : month) + "-" + (day < 10 ? ("0" + day) : day);
            // val = new Date(val);
            // this.estimate.Contract_Esti_End_Date__c = val.getFullYear()+'-'+(val.getMonth()+1+this.estimate.Contract_Range__c)+'-'+val.getDate();
            this.estimate.Contract_Esti_End_Date__c = date;
        }
        console.log('this.estimate.Contract_Esti_End_Date__c',this.estimate.Contract_Esti_End_Date__c);
    }
    //报价提交对象
    handleChangeEstimateTarget(event) {
        this.estimate.Estimate_Target__c = event.detail.value;
        //resetDealer 处理页面隐藏
        this.handleEstimateTargetIsHospitalTrue();
    }
    handleEstimateTargetIsHospitalTrue(){
        this.EstimateTargetIsDealer = this.estimate.Estimate_Target__c == '经销商';
    }
    //==onChDealerUpdateJs 报价提交对象 为经销商 才能触发该事件
    handleChangeDealer(event) {
        this.estimate.Dealer__c = event.detail.value[0] ? event.detail.value[0] : '';
        onChDealerUpdate({
            estimateStr: JSON.stringify(this.estimate),
            checkDealerId : this.estimate.Dealer__c
        }).then(result => {
            if (result != null) {
                this.estimate = JSON.parse(result);
            }
        }).catch(error => {
        }).finally(() => {
            if (this.estimate.Is_RecognitionModel__c) {
                estimateUtility.toast.showToast(this, 'warning', '请注意,当前经销商为先款对象。');
            }
        });
    }
    //申请报价金额
    checkDiscount(event) {
        console.log('checkDiscount');
        console.log('event.detail.value;',event.currentTarget.value);
        // this.IsRefresh = false;
        let val = event.currentTarget.value;
        this.estimateTemp = {Request_quotation_Amount__c : Math.round(val)};
        if (!val) {
            val = '';
            this.estimate.Request_quotation_Amount__c = "";
            this.estimate.Service_discount_Rate__c = 0.00;
            this.IsRefresh = true;
            return;
        }
        // 非数字,并不会触发,页面会有提示
        if (isNaN(parseInt(val))) {
            estimateUtility.toast.showToast(this, 'error', '请输入数值');
            val = 0.00;
            this.estimate.Request_quotation_Amount__c = 0.00;
            this.IsRefresh = true;
            return;
        }
        //type number 自带数值判断,只进行无效值提示,Service_discount_Rate__c 在makeRealPrice方法中赋值
        // if (!val) {
        //     this.estimate.Request_quotation_Amount__c = 0.00;
        //     this.estimate.Service_discount_Rate__c = 0.00;
        //     if (isNaN(parseInt(val))) {
        //         estimateUtility.toast.showToast(this, 'error', '请输入数值');
        //     }
        //     this.IsRefresh = true;
        //     return;
        // }
        this.allDataInfo();
        let returnData = estimateUtility.handleInfo.checkDiscount(this,val,this.allData,this.IsContractEstiStartDateDisabled,this.IsContractstartdateDisabled,this.IsRequestQuotationAmountDisabled,this.refreshAssetBtn,this.AgreeRenewTenDisabled);
        console.log('this.estimate.Request_quotation_Amount__c before',this.estimate.Request_quotation_Amount__c);
        this.allData = returnData.allData;
        this.handleInitSimpleData(this.allData);
        console.log('this.estimate.Request_quotation_Amount__c after',this.estimate.Request_quotation_Amount__c);
        this.IsContractEstiStartDateDisabled = returnData.IsContractEstiStartDateDisabled;
        this.IsContractstartdateDisabled = returnData.IsContractstartdateDisabled;
        this.IsRequestQuotationAmountDisabled = returnData.IsRequestQuotationAmountDisabled;
        this.refreshAssetBtn = returnData.refreshAssetBtn;
        this.refreshAssetBtnLWC = this.refreshAssetBtn;
        console.log('Until checkDiscount after',returnData.AgreeRenewTenDisabled);
        this.AgreeRenewTenDisabled = returnData.AgreeRenewTenDisabled;
        this.makeRealPrice(1);
        //上限金额清空
        this.estimate.Limit_Price_Amount__c = '';
        // this.estimate.Request_quotation_Amount__c = Math.round(val);
        // event.detail.value = this.estimate.Request_quotation_Amount__c;
        console.log('this.estimate.Request_quotation_Amount__c final',this.estimate.Request_quotation_Amount__c);
        this.estimate.Request_quotation_Amount__c = 0;
        console.log('this.estimate.Request_quotation_Amount__c 0',this.estimate.Request_quotation_Amount__c);
        this.event1 = setTimeout(() => {
          this.estimate.Request_quotation_Amount__c = Math.round(val);
          console.log('setTimeout',this.estimate.Request_quotation_Amount__c);
        }, 1);
        console.log('this.estimate.Request_quotation_Amount__c 01',this.estimate.Request_quotation_Amount__c);
        this.estimate = JSON.parse(JSON.stringify(this.estimate));
        console.log('this.estimate.Request_quotation_Amount__c 02',this.estimate.Request_quotation_Amount__c);
        // this.IsRefresh = true;
    }
    get quotationAmount(){
        return this.estimateTemp.Request_quotation_Amount__c;
    }
    // 上限金额
    handleLimitPriceAmount(event) {
        console.log('handleLimitPriceAmount',event.currentTarget.value);
        // this.estimate.Limit_Price_Amount__c = event.detail.value;
        // console.log('estimate handleLimitPriceAmount',this.estimate.Limit_Price_Amount__c);
        let num = event.currentTarget.value;
        this.estimate.Limit_Price_Amount__c = 0;
        this.event1 = setTimeout(() => {
          // this.estimate.AgencyHos_Price__c = num.toFixed(2);
            this.estimate.Limit_Price_Amount__c = Math.round(num);
            console.log('this.estimate.Limit_Price_Amount__c event1',this.estimate.Limit_Price_Amount__c);
        }, 1);
        this.estimate = JSON.parse(JSON.stringify(this.estimate));
        console.log('this.estimate.AgencyHos_Price__c',this.estimate.Limit_Price_Amount__c);
    }
    /*
     * @param t   1: 金額により割引
     */
    makeRealPrice(t) {
        // 実際金額合計
        // 申请报价金额
        var sum1 = this.localParseFloat(this.estimate.Request_quotation_Amount__c);
        // 修理总额
        var sum2 = this.estimate.Asset_Repair_Sum_Price__c ? this.estimate.Asset_Repair_Sum_Price__c : null ;
        //*1 避免NaN
        var sum1 = this.localParseFloat(sum1*1);
        // 上限
        var upPrice = this.estimate.GuidePrice_Up__c;
        upPrice = this.localParseFloat(upPrice*1);
        // 下限
        var downPrice = this.estimate.GuidePrice_Down__c;
        downPrice = this.localParseFloat(downPrice*1);
        // 相对标准价格范围的折扣率 计算
        // 1)标准价格范围内时,结果为0;
        // 2)比标准价格低时,结果是1-希望价格/标准价的最低价格
        // 3)比标准价格高时,结果是1-希望价格/标准价的最高价格
        var disMP = 0.00;
        var disP = this.estimate.Service_discount_Rate__c;
        if(sum1 < downPrice){
            disMP = ((1 - sum1/downPrice) * 100)*1;
        }else if(sum1 >= downPrice && sum1 <= upPrice){
            disMP = 0.00;
        }else if(sum1 > upPrice){
            disMP = 1*((1 - sum1/upPrice) * 100);
        }
        //出现精度浮动
        if (disMP != disP) {
            disMP = '' + disMP.toFixed(2) +  '%';
            // 20% -parseFloat = 20
            this.estimate.Service_discount_Rate__c = parseFloat(disMP);
        }
        // 修理総額を計上
        let sum = sum1 + this.localParseFloat(sum2*1);
        this.estimate.Maintenance_Price__c = sum*1;
    }
    //最终价格决定形式
    handleFinalPriceDecideWay(event) {
        this.estimate.finalPriceDecideWay__c = event.detail.value;
    }
    //是否销售附带
    handleSalesIncidental(event) {
        this.estimate.Sales_incidental__c = event.detail.checked;
    }
    //主要谈判次数
    handleMainTalksTime(event) {
        this.estimate.mainTalksTime__c = event.detail.value;
    }
    //谈判的开始时间
    handleTalksStartDate(event) {
        this.estimate.talksStartDate__c = event.detail.value;
    }
    //经销商和医院的价格 classic 保存两位小数,四舍五入  页面显示依旧是多位,但实际值已经变化(classic效果)
    handleAgencyHosPrice(event) {
        // console.log('handleAgencyHosPrice',event.detail.value);
        let num = event.currentTarget.value * 1;
        // event
        this.estimate.AgencyHos_Price__c = num.toFixed(2);
        console.log('this.handleAgencyHosPrice.AgencyHos_Price__c',this.estimate.AgencyHos_Price__c);
    }
    //价格申请理由
    handleDiscountReason(event) {
        this.estimate.Discount_reason__c = event.detail.value;
    }
    //消费率改善方案
    handleImproveConsumptionRateIdea(event) {
        this.estimate.Improve_ConsumptionRate_Idea__c = event.detail.value;
    }
    //打印报价 复选框选择  单选
    handleSimply(event){
        let param = event.currentTarget.dataset.param;
        this.estimate[param] = event.detail.checked;
        this.printFlag = false;
        let paramsList = ["Print_ListPrice__c","Print_Simplify__c","Print_RepairPrice__c","Print_SumPrice__c"];
        for (var i = 0; i < paramsList.length; i++) {
            if (param != paramsList[i]) {
                this.estimate[paramsList[i]] = false;
            }
        }
        this.printFlag = true;
    }
    //三方协议
    handlePrintContract(event) {
        let param = event.currentTarget.dataset.param;
        this.estimate[param] = event.detail.checked;
    }
    //合同开始日
    handleContractStartDate(event) {
        this.estimate.Contract_Start_Date__c = event.detail.value;
        //changeContractStartdate
        this.changeContractStartdate(this.estimate.Contract_Start_Date__c);
    }
    //无缝续签折扣
    handleRenewTenOFF(event) {
        this.estimate.renewTen_OFF__c = event.detail.checked;
        console.log('this.estimate.renewTen_OFF__c',this.estimate.renewTen_OFF__c);
    }
    handleAgreeRenewTenOFF(event) {
        this.estimate.AgreeRenewTen_OFF__c = event.detail.checked;
    }
    //保存
    async handleSave(event){
        //onclick
        this.IsLoading = true;
        let resEGFlgconfim = await this.EGFlgconfim();
        if (resEGFlgconfim) {
            this.allDataInfo();
            // 2023/09/18 unCheckedAssets 后台方法未涉及该属性,直接置空,避免数据量过大,如果后台返回异常信息,则将原数据重新赋值
            let oldUnCheckedAssets = JSON.stringify(this.allData.unCheckedAssets);
            this.allData.unCheckedAssets = [];
            let saveDataStr = JSON.stringify(this.allData);
            console.log('handleSave');
            await save({
                saveData: saveDataStr,
            }).then(result => {
                console.log('handleSave result',result);
                if (result != null && result.indexOf('completion=5') != -1) {
                    //重新跳转该页面 携带参数
                    estimateUtility.toast.showToast(this, 'success', '保存好了');
                    window.location.href=window.location.origin+"/lightning/n/lexSelectAssetEstimateVM#id="+result.split('/')[1];
                    location.reload();
                }else{
                    estimateUtility.toast.showToast(this, 'error', result);
                    // 2023/09/18 返回异常,旧数据返回赋值 - 页面数据并没有更改(未调用 handleunCheckedAssetColumnsAndData),页面数据不会异常
                    this.allData.unCheckedAssets = JSON.parse(oldUnCheckedAssets);
                }
            }).catch(error => {
                // 2023/09/18 返回异常,旧数据返回赋值
                this.allData.unCheckedAssets = JSON.parse(oldUnCheckedAssets);
            }).finally(() => {
                this.IsLoading = false;
            });
            //oncomplete
            this.unblockUI();
        }
        this.IsLoading = false;
    }
    //
    async EGFlgconfim() {
        await this.getEstimateCost();
        var cntWithKara = this.productCount;
        // 新合同备品确保提供 是否改变
        var alert1s = 0;
        for (var i = 0; i < cntWithKara; i++) {
            var isManual =this.allData.checkedAssets[i].isManual;
            var EGFlgtxt =this.allData.checkedAssets[i].mcae.EquipmentGuaranteeFlgTxt__c;
            var EGFlgnow =this.allData.checkedAssets[i].etGFlg;
            console.log('EGFlgtxt',EGFlgtxt);
            console.log('EGFlgnow',EGFlgnow);
            //补充 undefined的判定
            if (EGFlgtxt != undefined && EGFlgnow != undefined && EGFlgtxt != EGFlgnow) {
                alert1s = 1;
            }
        }
        if (alert1s == 1) {
            let confirmResult = await estimateUtility.toast.handleConfirmClick("选择的保有设备[新合同备品确保提供]发生变化,是否继续?");
            if (!confirmResult) {
                return false;
            }
        }
        return this.onclickCheckchangedAfterPrint('true','true');
    }
    //ok 获取实际报价金额 按照上限比例算
    getEstimateCost() {
        // 行数
        var rowcount = this.productCount;
        // 6.合同价格
        var mainteReal = parseFloat(this.estimate.Maintenance_Price__c);
        // 5.修理总额
        var assetRepairSumPrice = parseFloat(this.estimate.Asset_Repair_Sum_Price__c);
        // 计算实际报价总金额
        var realprice = mainteReal - assetRepairSumPrice;
        // 标准价格的最高价总额
        var GuidePriceUp = parseFloat(this.estimate.GuidePrice_Up__c);
        for (var i = 0; i < rowcount; i++) {
            // 去上限价格
            var assetListPrice = parseFloat(this.allData.checkedAssets[i].mcae.Adjustment_Upper_price__c);
            if(GuidePriceUp == 0){
                this.allData.checkedAssets[i].mcae.Estimate_Cost__c = 0;
            }else{
                var Estimate_Cost = (realprice * (assetListPrice / GuidePriceUp)).toFixed(2);
                //parseFloat 可能会为NAN
                this.allData.checkedAssets[i].mcae.Estimate_Cost__c = isNaN(Estimate_Cost) ? 0 : Estimate_Cost;
            }
        }
    }
   //
    async onclickCheckchangedAfterPrint(saveBtnDisabled, saveOrApproval) {
        console.log('onclickCheckchangedAfterPrint');
        var cntWithKara = this.productCount;
        var alerts = 0;
        // 新合同备品确保提供 是否改变
        var alert1s = 0;
        var today = new Date();
        today.setMonth(today.getMonth() - 3);
        for (var i = 0; i < cntWithKara; i++) {
            var isManual = this.allData.checkedAssets[i].isManual;//value boolean
            if (isManual) {
                //原页面未找到对应id  Assert_lkid
            }
            if (!isManual) {
                var strDate = this.allData.checkedAssets[i].rec.Final_Examination_Date__c ? this.allData.checkedAssets[i].rec.Final_Examination_Date__c : '';
                strDate = strDate.replace(/(^\s*)|(\s*$)/g, "");
                if (strDate == "" || Date.parse(strDate) < Date.parse(today)) {
                    alerts = 1;
                }
            }
        }
        if (alerts == 1) {
            let confirmResult = await estimateUtility.toast.handleConfirmClick("选择的保有设备[最后点检日]为空或已经超过三个月之前,是否继续?");
            if (!confirmResult) {
                return false;
            }
        }
        if (saveOrApproval == "true") {
            if (await this.saveBeforeCheckPriceChange()) {
                let confirmResult = await estimateUtility.toast.handleConfirmClick("行信息有变化(服务合同价格),是否更新报价?");
                if (confirmResult) {
                    this.allData.changedSubmitPrice = true;
                }else{
                    this.allData.changedSubmitPrice = false;
                    this.unblockUI();
                    return false;
                }
            }
            this.allData.isSaveOrApproval = true;
        }
       return true;
    }
    //
    unblockUI(){
        // 2021、8、26 合同报价页面的优化,无保有设备点检对象选择框变黑 fxk star
        // disable1();
        // 2021、8、26 合同报价页面的优化,无保有设备点检对象选择框变黑 fxk end
        this.pageSetDisabled();
        var isChange = this.allData.changedSubmitPrice;
        if (isChange) {
            this.allData.changedSubmitPrice = false;
            //页面数据刷新 --checkAssetData reresh 后handleCheckedAssetColumnsAndData
            this.allData.checkedAssets = this.refreshAsset(this.allData.checkedAssets.length,this.allData.checkedAssets);
            this.handleCheckedAssetColumnsAndData(this.allData.checkedAssets);
        }
        //未找到该id
    }
    //
    async saveBeforeCheckPriceChange() {
        console.log('saveBeforeCheckPriceChange');
        var needClearId = false;
        //this.productCount =>  this.allData.productCount
        var rowCnt = this.productCount;
        var assIds = "";
        var proIds = "";
        var priceMap = new Map();
        var newProductMap = new Map();
        var newProductCheck = false;
        var nowDate = new Date();
        var createdDate = null;
        var createdDateShow = this.estimate.CreatedDate;
        var contractDate = new Date(this.estimate.Contract_Start_Date__c);
        if (createdDateShow && createdDateShow.trim() != '') {
            createdDate = new Date(createdDateShow);
            newProductCheck = true;
        } else {
            createdDate = new Date();
        }
        var threeMonthAfter = new Date(createdDate.setMonth(createdDate.getMonth() + 3));
        createdDate = new Date(createdDate.setMonth(createdDate.getMonth() - 3));
        for (var i = 0; i < rowCnt; i++) {
            var isManual = this.allData.checkedAssets[i].isManual;
            //mcae 不会为null
            var isnew = this.allData.checkedAssets[i].mcae.IsNew__c;
            var price = this.allData.checkedAssets[i].mcae.Estimate_List_Price__c ;
            if (isManual) {
                var a = this.allData.checkedAssets[i].mcae.Product_Manual__c;
                //补充 a 有值的判定
                if ( a != "000000000000000000" && a != "" && a) {
                    if (proIds == "") {
                        proIds = "'" + a + "'";
                    } else {
                        proIds = proIds + ",'" + a + "'";
                    }
                    if (isnew) {
                        priceMap.set(a, price/this.allData.isNewPriceAdj);
                    } else {
                        priceMap.set(a, price);
                    }
                    newProductMap.set(a, isnew);
                } else {
                    continue;
                }
            }else {
                var aId = this.allData.checkedAssets[i].rec.Id;
                if (assIds == "") {
                    assIds = "'" + aId + "'";
                } else if (aId) {////补充 aId 有值的判定
                    assIds = assIds + ",'" + aId + "'";
                }
                if (isnew) {
                    priceMap.set(aId, price/this.allData.isNewPriceAdj);
                } else {
                    priceMap.set(aId, price);
                }
                newProductMap.set(aId, isnew);
            }
        }
        // 选择设备后价格变更check
        if (assIds.length > 0) {
            //后台查询1
            await saveBeforeCheckPriceChangeAsset({
                assIds : assIds
            }).then(asList => {
                if (asList != null) {
                    for(var i=0;i<asList.length;i++) {
                        var asvar = asList[i];
                        var asId = asvar["Id"];
                        var mprice = asvar["Maintenance_Price_Month__c"];
                        var ptDt = asvar["Posting_Date__c"];
                        var postingDate = null;
                        if (ptDt != null && ptDt != '') {
                            postingDate = new Date(ptDt);
                        }
                        var inDt = asvar["InstallDate"];
                        var installDate = null;
                        if (inDt != null && inDt != '') {
                            installDate = new Date(inDt);
                        }
                        var priceShow = priceMap.get(asId);
                        var isNew = newProductMap.get(asId);
                        if (this.DecideBtnDisabled) {
                            if (Number(mprice).toFixed(2) != Number(priceShow).toFixed(2)) {
                                needClearId = true;
                                return needClearId;
                            }
                        }
                    }
                }
            }).catch(error => {
            }).finally(() => {
            });
        }
        console.log('proIds',proIds);
        if (proIds.length > 0) {
            if (!this.DecideBtnDisabled) {
                var oldDateStr = this.estimate.Contract_Start_Date__c;
                console.log('proIds oldDateStr',oldDateStr);
                var oldDate = new Date();
                if (oldDateStr != null && oldDateStr != '') {
                    oldDate = new Date(oldDateStr);
                }
                var crdt = new Date(this.estimate.CreatedDate);
                var newContractDate = new Date(this.estimate.Contract_Start_Date__c);
                var sixMonthAfter = new Date(crdt.setMonth(crdt.getMonth() + 6));
                if ((newContractDate > sixMonthAfter && oldDate <= sixMonthAfter) || (newContractDate <= sixMonthAfter && oldDate > sixMonthAfter)) {
                    this.allData.changedAfterPrint = true;
                    return true;
                }
            } else {
                //后台查询2
                await saveBeforeCheckPriceChangeProduct2({
                    proIds : proIds
                }).then(pdList => {
                    if (pdList != null) {
                        for(var i=0;i<pdList.length;i++) {
                            var pdvar = pdList[i];
                            var pdId = pdvar["Id"];
                            var mprice = pdvar["Maintenance_Price_Month__c"];
                            var priceShow = priceMap.get(pdId);
                            if (Number(mprice).toFixed(2) != Number(priceShow).toFixed(2)) {
                                needClearId = true;
                                return needClearId;
                            }
                        }
                    }
                }).catch(error => {
                }).finally(() => {
                });
            }
        }
        return needClearId;
    }
    // 不保存返回
    cancel(event) {
        if (this.allData.targetMaintenanceContractId) {
            //返回原报价页面
            this.navigateToOtherObj(this.allData.targetMaintenanceContractId);
        }else{
            location.reload();
        }
    }
    // 保存返回
    async handleSaveAndCancel(event){
        this.IsLoading = true;
        //onclick
        let checkResult = await this.onclickCheckchangedAfterPrint('true','true');
        if (checkResult) {
            //修改值传回
            this.allDataInfo();
            // 2023/09/16 unCheckedAssets 后台方法未涉及该属性,直接置空
            let oldUnCheckedAssets = JSON.stringify(this.allData.unCheckedAssets);
            this.allData.unCheckedAssets = [];
            //checkedAssets unCheckedAssetData 在更改的时候同步改动
            let saveDataStr = JSON.stringify(this.allData);
            console.log('saveDataStr',JSON.stringify(this.allData.estimate));
            await saveAndCancel({
                saveData: saveDataStr,
            }).then(result => {
                console.log('handleSaveAndCancel result',result);
                if (result != null && result.indexOf('navigateTo') == -1) {
                    estimateUtility.toast.showToast(this, 'error', result);
                    // 2023/09/18 返回异常,旧数据返回赋值
                    this.allData.unCheckedAssets = JSON.parse(oldUnCheckedAssets);
                }else if (result != null) {
                    this.navigateToOtherObj(result.split('=')[1]);
                }
            }).catch(error => {
                // 2023/09/18 返回异常,旧数据返回赋值
                this.allData.unCheckedAssets = JSON.parse(oldUnCheckedAssets);
            }).finally(() => {
            });
        }
        this.IsLoading = false;
    }
    //行追加
    handleAddNewRows(event){
        this.IsLoading = true;
        addNewRows({
            checkedAssetsStr: JSON.stringify(this.allData.checkedAssets),
        }).then(result => {
            result = JSON.parse(result);
            this.allData.checkedAssets = this.refreshAsset(result.length,result);
        }).catch(error => {
        }).finally(() => {
            this.handleCheckedAssetColumnsAndData(this.allData.checkedAssets);
            this.unblockUI();
            this.IsLoading = false;
        });
    }
    //合同对象设备 数据修改处理
    handleTableProductManualChange(event) {
        let index = event.currentTarget.dataset.index;
        this.allData.checkedAssets[index].mcae.Product_Manual__c = event.detail.value[0] ? event.detail.value[0] : null;
        refreshProductData({
            checkedAssetsStr : JSON.stringify(this.allData.checkedAssets),
            topProductModelStr : JSON.stringify(this.allData.TopProductModel),
            productIdx : index,
            isNewPriceAdj : this.allData.isNewPriceAdj,
        }).then(result => {
            result = JSON.parse(result);
            console.log('handleTableProductManualChange result',result);
            //对后台返回数据 进行处理
            this.allData.checkedAssets = this.refreshAsset(result.length,result);
        }).catch(error => {
        }).finally(() => {
            this.handleCheckedAssetColumnsAndData(this.allData.checkedAssets);
            this.unblockUI();
        });
    }
    //合同对象设备 机身编码跳转保有设备
    handlePageNagivateTo(event) {
        let param = event.currentTarget.dataset.param;
        // console.log('index',param);
        this.navigateToOtherObj(param);
    }
    //合同对象设备 全选
    checkAllcheckedAsset(event){
        this.IsCheckAllcheckedAsset = event.detail.checked;
        for (var i = 0; i < this.allData.checkedAssets.length; i++) {
            this.allData.checkedAssets[i].rec_checkBox_c = event.detail.checked;
        }
        this.handleCheckedAssetColumnsAndData(this.allData.checkedAssets);
    }
    handleTableRecCheckBox(event) {
        let index = event.currentTarget.dataset.index;
        this.allData.checkedAssets[index].rec_checkBox_c = event.detail.checked;
    }
    handleTableCheckObjectChange(event) {
        let index = event.currentTarget.dataset.index;
        this.allData.checkedAssets[index].mcae.Check_Object__c = event.detail.checked;
    }
    // ==changeAsset
    async handleTableRepairPriceChange(event) {
        // classic 参保修理金额 在实际保存时依旧只留两位小数
        let num = event.currentTarget.value*1;
        num = num.toFixed(2);
        let index = event.currentTarget.dataset.index;
        // event.detail.value = num;
        this.allData.checkedAssets[index].mcae.Repair_Price__c = num;
        //changeAsset  页面数据同步刷新--工具类中
        this.allDataInfo();
        console.log('this.allData.checkedAssets[index].mcae.Repair_Price__c before changeAsset',this.allData.checkedAssets[index].mcae.Repair_Price__c);
        let changeAssetReturnData = await estimateUtility.handleInfo.changeAsset(this,this.allData.checkedAssets.length,this.allData.checkedAssets,this.PageDisabled,this.approvalDate,this.allData);
        //changeAsset alert Info  --工具类中alert
        // estimateUtility.toast.showToast(this, 'error', '合同期最长只能选择60个月!');
        this.allData = changeAssetReturnData.allData;
        this.approvalDate = changeAssetReturnData.approvalDate;
        // 仅保留两位小数
        this.assetRepairSumNum = changeAssetReturnData.assetRepairSumNum.toFixed(2);
        //页面相关数据初始化
        this.handleInitSimpleData(this.allData);
        this.handleCheckedAssetColumnsAndData(this.allData.checkedAssets);
        // examinationPriceCal(cnt);
        this.getLastContractRate();
        this.makeRealPrice(1);
        //上限合同 20230214 hql start
        var RequestquotationAmount = this.estimate.Request_quotation_Amount__c;
        var AssetRepairSumPrice    = this.estimate.Asset_Repair_Sum_Price__c;
        var Limit_Price_Amount = (this.localParseFloat(AssetRepairSumPrice)+this.localParseFloat(RequestquotationAmount))*1.3;
        Limit_Price_Amount = Math.round(Limit_Price_Amount);
        var Limit_Price_AmountOne =  this.estimate.Limit_Price_Amount__c;
        var Limit_PriceHidden =  this.allData.OldLimitPrice;
        this.estimate.Limit_Price_Amount__c = Limit_Price_Amount;
        var Limit_PriceHidden2 =  this.allData.isLimitPrice;
        if (Limit_PriceHidden2 == false) {
            this.estimate.Limit_Price_Amount__c = '';
        }
        //上限合同 20230214 hql end
        // 报价规则改善 20230315 start
        this.allDataInfo();
        let returnData = estimateUtility.handleInfo.seamlessRenew(this,this.allData.checkedAssets.length,this.allData,this.allData.checkedAssets,this.PageDisabled,this.IsContractEstiStartDateDisabled);
        this.allData = returnData.allData;
        this.handleInitSimpleData(this.allData);
        this.allData.checkedAssets = returnData.checkedAssets;
        // 2023/09/18 seamlessRenew 可能修改 IsContractEstiStartDateDisabled 值,handleInitSimpleData中未处理该禁用
        this.IsContractEstiStartDateDisabled = returnData.IsContractEstiStartDateDisabled;
        // 报价规则改善 20230315 end
        this.handleCheckedAssetColumnsAndData(this.allData.checkedAssets);
        this.makeRealPrice(1);
        console.log('this.allData.checkedAssets[index].mcae.Repair_Price__c before refresh',this.allData.checkedAssets[index].mcae.Repair_Price__c);
        // 刷新赋值
        // num = this.allData.checkedAssets[index].mcae.Repair_Price__c;
        // this.allData.checkedAssets[index].mcae.Repair_Price__c = 0;
        // this.event1 = setTimeout(() => {
        //   this.allData.checkedAssets[index].mcae.Repair_Price__c = num.toFixed(2);
        // }, 1);
        // this.allData.checkedAssets[index].mcae = JSON.parse(JSON.stringify(this.allData.checkedAssets[index].mcae));
        // console.log('this.allData.checkedAssets[index].mcae.Repair_Price__c',this.allData.checkedAssets[index].mcae.Repair_Price__c);
    }
    //page
    getLastContractRate(){
        var rowCnt = this.productCount;
        var Contractrate = 0.00;
        var count = 0;
        for (var i = 0; i < rowCnt; i++) {
            var LastMContractID = this.allData.checkedAssets[i].rec ? this.allData.checkedAssets[i].rec.CurrentContract_F__c : null;
            if(LastMContractID){
                var tempContractrate = parseFloat((this.allData.checkedAssets[i].mcae.Asset_Consumption_rate__c ? this.allData.checkedAssets[i].mcae.Asset_Consumption_rate__c : null)*1);
                if(tempContractrate){
                    Contractrate = Contractrate + tempContractrate;
                }
                count++;
            }
        }
        var allContractRate = '' + 0.00 + '%';
        if( count > 0){
            allContractRate = '' + (Contractrate/count).toFixed(2) + '%';
        }
        this.estimate.Combined_rate__c = parseFloat(allContractRate);
        return allContractRate;
    }
    //合同对象设备 备注
    handleTableCommentChange(event) {
        let index = event.currentTarget.dataset.index;
        this.allData.checkedAssets[index].mcae.Comment__c = event.detail.value;
    }
    //合同对象设备 第三方回归
    handleTableThirdPartyReturnChange(event) {
        let index = event.currentTarget.dataset.index;
        this.allData.checkedAssets[index].mcae.Third_Party_Return__c = event.detail.checked;
    }
    // 合同对象设备 数据计算处理 todo 核对涉及变量
    refreshAsset(cnt,checkedAssets) {
        console.log('cnt',cnt);
        // 提交后就页面不计算了
        var isDisabled = this.PageDisabled;
        //  报价页面【合同定价总额】字段添加 20230608 start
        var TotalMaintenancePriceYear = 0.0;
        //  报价页面【合同定价总额】字段添加 20230608 end
        // 合同总理
        var newCount = 0;
        var isresduce = 0;
        var oyearCount = 0;
        var firstCCount = 0;
        var conCCount = 0;
        // row金額合計
        var repairSum = 0;
        var listSum = 0;
        // 新品合同 判断
        var newCon = true;
        var contractStartDate = new Date(this.estimate.Contract_Start_Date__c);
        //多年保续签合同数量 thh 20220316 start
        var GuranteeCount = 0;
        // 报价规则改善 20230310 start
        // 2023/09/06 报价规则改善新增 - 显示页面部分整体处理
        this.IsRenewTenOFFDisabled = true;
        var renewTenOFF = this.estimate.renewTen_OFF__c;
        // 2023/09/06  result 变量无意义,后面js 有同名变量重新赋值
        var startime1 =  new Date(this.allData.Past_Contract_end_day);
        var startime2 = new Date(this.estimate.Contract_Esti_Start_Date__c);
        var result = (startime2-startime1)/(3600*24*1000);
        var VMProductCountAll = this.allData.VMProductCountAll;
        var ProductCountAll = this.allData.VMProductCountAll;
        if (VMProductCountAll ==ProductCountAll) {
            result = 0;
        }
        if (renewTenOFF == true) {
            this.IsContractEstiStartDateDisabled = true;
            this.IsRequestQuotationAmountDisabled = true;
            this.IsContractstartdateDisabled = true;
            this.refreshAssetBtn = true;
            this.refreshAssetBtnLWC = this.refreshAssetBtn;
            //2023/09/06 同意无缝续签 禁用
            this.AgreeRenewTenDisabled = true;
        }
        // 报价规则改善 20230310 end
        //2022故障品加费 获取userInfo简档名称 是否为FSE start
        var isFSE = this.allData.isFSE;
        //2022故障品加费 获取userInfo简档名称 end
        //20230208 上限合同开发 hql start
        if (isFSE) {
            this.IsLimitPriceAmountDisabled = true;
        }
        //20230208 上限合同开发 hql end
        // 预定开始日
        var startdate = new Date(this.estimate.Contract_Esti_Start_Date__c);
        // 预定开始日-6个月
        startdate.setMonth(startdate.getMonth() - 6);
        // 申请日 当前日期
        if(this.approvalDate != ''){
            //申请日
            this.approvalDate = new Date(this.approvalDate.toLocaleDateString());
            if (Date.parse(this.approvalDate) < Date.parse(startdate)) {
                newCon = false;
            }
        }
        // 最高、最低价格合计
        var downPriceSum = 0;
        var upPriceSum = 0;
        // 合同月数乗算  parseFloat(null.'',undefined) 为NAN  补充判断
        var month = parseFloat(this.estimate.Contract_Range__c);
        if (month == undefined || month == "" || isNaN(month)) {
            month = 1;
        }
        var month2 = 0;
        if (month > 12) {
            month2 = month - 12;
            month = 12;
        }
        for (var i = 0; i < cnt; i++) {
            console.log('refreshAsset i'+i);
            //字段按钮 默认可用
            checkedAssets[i].ShowAssetSituation = true;
            var strMoney = 0;
            var repairMoney = 0;
            // 行项目 最高、最低价格合计
            // 续签价格取联动价格页面计算,首签或产品取 实际价格
            // 下线价格
            var downPrice = 0;
            // 上线价格
            var upPrice = 0;
            // 12个月合同金额
            var Price_YearTXT = 0;
            var isManual = checkedAssets[i].isManual; //return boolean
            var isnew = checkedAssets[i].mcae.IsNew__c; //return boolean
            var assetListmonth = checkedAssets[i].mcae.Estimate_List_Price__c;
            //市场多年保修价格开发 DC 2023/02/09 start
            var VMassetListmonth = checkedAssets[i].rec ? (checkedAssets[i].rec.CurrentContract_F_asset__r ? checkedAssets[i].rec.CurrentContract_F_asset__r.Maintenance_Price_Year__c : '') : '';
            //市场多年保修价格开发 DC 2023/02/09 end
            //  报价页面【合同定价总额】字段添加 20230608 start
            var Product2MaintenancePriceYear = checkedAssets[i].rec ? (checkedAssets[i].rec.Product2 ? checkedAssets[i].rec.Product2.Maintenance_Price_Year__c : '') : '';
            //page outputField 原本就是 隐藏
            Product2MaintenancePriceYear = this.localParseFloat(Product2MaintenancePriceYear);
            TotalMaintenancePriceYear += Product2MaintenancePriceYear;
            //  报价页面【合同定价总额】字段添加 20230608 end
            if (isManual) {
                var a = checkedAssets[i].mcae.Product_Manual__c ? checkedAssets[i].mcae.Product_Manual__c : '';
                console.log('isManual true a',a);
                if (a != '') {
                    strMoney = assetListmonth;
                    // alert(strMoney);
                    Price_YearTXT = strMoney * 12;
                    if (isnew) {
                        newCount ++;
                        strMoney = month * strMoney + month2 * strMoney / this.allData.isNewPriceAdj;
                    } else {
                        newCon = false;
                        strMoney = month * strMoney + month2 * strMoney;
                    }
                    //补充空指针
                    var b = checkedAssets[i].rec ? (checkedAssets[i].rec.CurrentContract_F__r ? checkedAssets[i].rec.CurrentContract_F__r.Maintenance_Contract_No_F__c : '') : '';
                    var LastMContractRecord = checkedAssets[i].rec ? (checkedAssets[i].rec.CurrentContract_F__r ? checkedAssets[i].rec.CurrentContract_F__r.RecordType_DeveloperName__c : '') : '';
                    console.log('b product',b);
                    if(b != ''){
                        conCCount ++;
                        // 1.合同期不满一年时,合同期超过一半才可开始续签报价。(eg:11个月的合同从6个月后才可报价。)
                        // 2.一年以上的合同,在结束前6个月开始可以开放续签报价。
                        var lastendDate = new Date(checkedAssets[i].rec.CurrentContract_End_Date__c);
                        var lastContRange = 0;
                        if(LastMContractRecord == 'VM_Contract'){
                            newCount++;
                            //多年保续签合同数量,多年保续签到服务合同时视为首签设备 thh 20220316 start
                            GuranteeCount++;
                            newCon = false;
                            //多年保续签合同数量,多年保续签到服务合同时视为首签设备 thh 20220316 end
                            lastendDate = new Date(checkedAssets[i].rec.CurrentContract_F_asset__r.endDateGurantee_Text__c);
                            lastContRange = 36;
                        }else{
                            lastContRange = checkedAssets[i].rec.CurrentContract_F__r.Contract_Range__c;
                        }
                        //最后结束日+1年
                        lastendDate.setMonth(lastendDate.getMonth() + 12);
                        if (Date.parse(contractStartDate) > Date.parse(lastendDate) ) {
                            oyearCount ++;
                        }
                        // 取联动价格
                        // 上一期合同实际报价月额
                        // * 1 避免 parseFloat(null) ->NAN
                        var LastMContract_Price = parseFloat(checkedAssets[i].mcae.LastMContract_Price__c  * 1);
                        var Adjustment_ratio_Lower = parseFloat(checkedAssets[i].mcae.Adjustment_ratio_Lower__c   * 1);
                        var Adjustment_ratio_Upper = parseFloat(checkedAssets[i].mcae.Adjustment_ratio_Upper__c   * 1);
                        //计算惩罚率
                        var Punish = this.calculateNtoMRatio( lastContRange,(month + month2));
                        if(Punish == 0){
                            return;
                        }
                        // 判断有无报价:没有按照标准价格实际联动
                        var Estimate_Num = checkedAssets[i].rec.CurrentContract_F__r.Estimate_Num__c ;
                        if(Estimate_Num == 0){
                            if(LastMContractRecord == 'VM_Contract'){
                                // gzw 20220630  实际联动6个月价格区分
                                var nowdate = new Date();
                                lastendDate = new Date(checkedAssets[i].rec.CurrentContract_F_asset__r.endDateGurantee_Text__c);
                                nowdate = nowdate.setMonth(nowdate.getMonth() + 6);
                                //市场多年保修价格开发 DC 2023/1/30 start
                                var Maxcoefficient =0;
                                var Mincoefficient =0;
                                var ContractMonth = this.localParseFloat(this.estimate.Contract_Range__c);
                                var AssetRate = this.localParseFloat(checkedAssets[i].rec.CurrentContract_F_asset__r.Asset_Consumption_Rate__c);
                                checkedAssets[i].mcae.Asset_Consumption_rate__c = AssetRate;
                                if(AssetRate<= 50){
                                    Maxcoefficient = (1-0.3);
                                    Mincoefficient = (1-0.4);
                                }else if(AssetRate>50 &&AssetRate<=60){
                                    Maxcoefficient = (1-0.2);
                                    Mincoefficient = (1-0.3);
                                }else if(AssetRate>60 &&AssetRate<=70){
                                    Maxcoefficient = (1-0.15);
                                    Mincoefficient = (1-0.25);
                                }else if(AssetRate>70 &&AssetRate<=80){
                                    Maxcoefficient = (1-0.1);
                                    Mincoefficient = (1-0.2);
                                }else if(AssetRate>80 &&AssetRate<=90){
                                    Maxcoefficient = (1-0.05);
                                    Mincoefficient = (1-0.15);
                                }else if(AssetRate>90 &&AssetRate<=100){
                                    Maxcoefficient = 1;
                                    Mincoefficient = (1-0.05);
                                }else if(AssetRate>100 &&AssetRate<=110){
                                    Maxcoefficient = (1+0.05);
                                    Mincoefficient = 1;
                                }else if(AssetRate>110 &&AssetRate<=120){
                                    Maxcoefficient = (1+0.1);
                                    Mincoefficient = 1;
                                }else if(AssetRate>120 &&AssetRate<=130){
                                    Maxcoefficient = (1+0.2);
                                    Mincoefficient = (1+0.1);
                                }else if(AssetRate>130 &&AssetRate<=140){
                                    Maxcoefficient = (1+0.25);
                                    Mincoefficient = (1+0.15);
                                }else if(AssetRate>140){
                                    Maxcoefficient = (1+0.3);
                                    Mincoefficient = (1+0.2);
                                }
                                //市场多年保修价格开发 DC 2023/1/30 end
                                if(nowdate < Date.parse(lastendDate)){
                                    // 市场多年保修价格开发 start DC 2023/01/19
                                    //市场多年保设备小于2年半
                                    var AssetModelNo = checkedAssets[i].rec.Product2 ? checkedAssets[i].rec.Product2.Asset_Model_No__c : 0;
                                    var Category4 = checkedAssets[i].rec.Product2 ? checkedAssets[i].rec.Product2.Category4__c : '';
                                    //设备设备消费率小于1.4
                                    if(AssetRate<140){
                                        upPrice = VMassetListmonth * ContractMonth /12;
                                        if((AssetModelNo.includes('290')&&( Category4 =='BF'|| Category4=='BF扇扫'||Category4=='CF'))|| Category4 =='URF'){
                                            downPrice = upPrice;
                                        }else{
                                            downPrice = upPrice * 0.8;
                                        }
                                    }else{
                                        upPrice = VMassetListmonth * ContractMonth *Maxcoefficient / 12;
                                        downPrice = VMassetListmonth * ContractMonth * Mincoefficient / 12;
                                    }
                                    // 市场多年保修价格开发 end DC 2023/01/19
                                }else{
                                    //市场多年保修价格开发 DC 2023/1/30 start  设备大于2年半 续签价格 = 定价 *消费率对应系数 / 12 *合同月数
                                    upPrice = VMassetListmonth * ContractMonth *Maxcoefficient / 12;
                                    downPrice = VMassetListmonth * ContractMonth * Mincoefficient / 12;
                                    //市场多年保修价格开发 DC 2023/1/30 end
                                }
                                // gzw 20220630  实际联动6个月价格区分
                            }else{
                                upPrice = strMoney;
                                downPrice = strMoney * 0.8;
                            }
                        }else{
                            upPrice = (LastMContract_Price * Punish) * (1 + Adjustment_ratio_Upper/100);
                            downPrice = (LastMContract_Price * Punish) * (1 + Adjustment_ratio_Lower/100);
                        }
                    }else{
                        upPrice = strMoney;
                        downPrice = strMoney * 0.8;
                    }
                    // 上下限四舍五入
                    upPrice = upPrice.toFixed(2);
                    downPrice = downPrice.toFixed(2);
                    console.log('downPrice Product',downPrice);
                    // 12个月合同金额
                    if (!isDisabled) {
                        // 实际联动价格 start
                        //*1 转化为Number类型 结果保留两位小数
                        checkedAssets[i].mcae.Adjustment_Lower_price__c = (downPrice*1).toFixed(2);
                        checkedAssets[i].mcae.Adjustment_Upper_price__c = (upPrice*1).toFixed(2);
                        // 实际联动价格 end
                    }
                    checkedAssets[i].mcae.Estimate_List_Price_Page__c = strMoney * 1;
                    //Repair_Price__c null Number类型  .trim()
                    repairMoney = (checkedAssets[i].mcae.Repair_Price__c == undefined ? null : checkedAssets[i].mcae.Repair_Price__c ) *1;
                } else {
                    // TODO 一時的な対応、なんで別行の金額リフレッシュされた?
                    checkedAssets[i].mcae.Estimate_List_Price_Page__c = '';
                    // 12个月合同金额
                    if (!isDisabled) {
                        // 实际联动价格 start
                        checkedAssets[i].mcae.Adjustment_Lower_price__c = '';
                        checkedAssets[i].mcae.Adjustment_Upper_price__c = '';
                        // 实际联动价格 end
                     }
                }
            }
            else {
                // 所有设备按安装日、发货日(最早的),距离合同开始日6个月内都是新品合同
                var isNewDate = new Date( checkedAssets[i].rec.isNewDate_use__c);
                isNewDate.setMonth(isNewDate.getMonth() + 6);
                if (Date.parse(contractStartDate) > Date.parse(isNewDate)) {
                    newCon = false;
                }
                strMoney = assetListmonth ;
                Price_YearTXT = strMoney * 12;
                if (isnew) {
                    strMoney = month * strMoney + month2 * strMoney / this.allData.isNewPriceAdj;
                } else {
                    strMoney = month * strMoney + month2 * strMoney;
                }
                var b = checkedAssets[i].rec.CurrentContract_F__r ? checkedAssets[i].rec.CurrentContract_F__r.Maintenance_Contract_No_F__c : '';
                var LastMContractRecord = checkedAssets[i].rec.CurrentContract_F__r ? checkedAssets[i].rec.CurrentContract_F__r.RecordType_DeveloperName__c : '';
                if(b != ''){
                    conCCount ++;
                    // 1.合同期不满一年时,合同期超过一半才可开始续签报价。(eg:11个月的合同从6个月后才可报价。)
                    // 2.一年以上的合同,在结束前6个月开始可以开放续签报价。
                    var lastendDate = new Date(checkedAssets[i].rec.CurrentContract_End_Date__c);
                    var lastendDate = new Date(checkedAssets[i].rec.CurrentContract_F__r.Contract_End_Date__c);
                    var lastContRange = 0;
                    if(LastMContractRecord == 'VM_Contract'){
                        newCount++;
                        //多年保续签合同数量,多年保续签到服务合同时视为首签设备 thh 20220316 start
                        GuranteeCount++;
                        newCon = false;
                        //多年保续签合同数量,多年保续签到服务合同时视为首签设备 thh 20220316 end
                        lastendDate = new Date(checkedAssets[i].rec.CurrentContract_F_asset__r.endDateGurantee_Text__c) ;
                        lastContRange = 36;
                    }else{
                        lastContRange = checkedAssets[i].rec.CurrentContract_F__r.Contract_Range__c;
                    }
                    //最后结束日+1年
                    lastendDate.setMonth(lastendDate.getMonth() + 12);
                    if (Date.parse(contractStartDate) > Date.parse(lastendDate)) {
                        oyearCount ++;
                    }
                    // 取联动价格
                    // 上一期合同实际报价月额
                    var LastMContract_Price = parseFloat(checkedAssets[i].mcae.LastMContract_Price__c * 1);
                    var Adjustment_ratio_Lower = parseFloat(checkedAssets[i].mcae.Adjustment_ratio_Lower__c * 1);
                    var Adjustment_ratio_Upper = parseFloat(checkedAssets[i].mcae.Adjustment_ratio_Upper__c * 1);
                    //计算惩罚率   return month 不可能为0
                    var Punish = this.calculateNtoMRatio( lastContRange,(month + month2));
                    if(Punish == 0){
                        return;
                    }
                    // 判断有无报价:没有按照标准价格实际联动
                    var Estimate_Num = checkedAssets[i].rec.CurrentContract_F__r.Estimate_Num__c ;
                    if(Estimate_Num == 0){
                        if(LastMContractRecord == 'VM_Contract'){
                            // gzw 20220630  实际联动6个月价格区分
                            var nowdate = new Date();
                            lastendDate = new Date(checkedAssets[i].rec.CurrentContract_F_asset__r.endDateGurantee_Text__c);
                            nowdate = nowdate.setMonth(nowdate.getMonth() + 6);
                            //市场多年保修价格开发 DC 2023/1/30 start
                            var Maxcoefficient =0;
                            var Mincoefficient =0;
                            var ContractMonth = this.localParseFloat(this.estimate.Contract_Range__c);
                            var AssetRate = this.localParseFloat(checkedAssets[i].rec.CurrentContract_F_asset__r.Asset_Consumption_Rate__c);
                            checkedAssets[i].mcae.Asset_Consumption_rate__c = AssetRate;
                            if(AssetRate<= 50){
                                Maxcoefficient = (1-0.3);
                                Mincoefficient = (1-0.4);
                            }else if(AssetRate>50 &&AssetRate<=60){
                                Maxcoefficient = (1-0.2);
                                Mincoefficient = (1-0.3);
                            }else if(AssetRate>60 &&AssetRate<=70){
                                Maxcoefficient = (1-0.15);
                                Mincoefficient = (1-0.25);
                            }else if(AssetRate>70 &&AssetRate<=80){
                                Maxcoefficient = (1-0.1);
                                Mincoefficient = (1-0.2);
                            }else if(AssetRate>80 &&AssetRate<=90){
                                Maxcoefficient = (1-0.05);
                                Mincoefficient = (1-0.15);
                            }else if(AssetRate>90 &&AssetRate<=100){
                                Maxcoefficient = 1;
                                Mincoefficient = (1-0.05);
                            }else if(AssetRate>100 &&AssetRate<=110){
                                Maxcoefficient = (1+0.05);
                                Mincoefficient = 1;
                            }else if(AssetRate>110 &&AssetRate<=120){
                                Maxcoefficient = (1+0.1);
                                Mincoefficient = 1;
                            }else if(AssetRate>120 &&AssetRate<=130){
                                Maxcoefficient = (1+0.2);
                                Mincoefficient = (1+0.1);
                            }else if(AssetRate>130 &&AssetRate<=140){
                                Maxcoefficient = (1+0.25);
                                Mincoefficient = (1+0.15);
                            }else if(AssetRate>140){
                                Maxcoefficient = (1+0.3);
                                Mincoefficient = (1+0.2);
                            }
                            //市场多年保修价格开发 DC 2023/1/30 end
                            if(nowdate < Date.parse(lastendDate)){
                                // 市场多年保修价格开发 start DC 2023/01/19
                                //市场多年保设备小于2年半
                                var AssetModelNo = checkedAssets[i].rec.Product2 ? checkedAssets[i].rec.Product2.Asset_Model_No__c : 0;
                                var Category4 = checkedAssets[i].rec.Product2 ? checkedAssets[i].rec.Product2.Category4__c : '';
                                //设备设备消费率小于1.4
                                if(AssetRate<140){
                                    upPrice = VMassetListmonth *ContractMonth / 12;
                                    if((AssetModelNo.includes('290')&&( Category4 =='BF'|| Category4=='BF扇扫'||Category4=='CF'))|| Category4 =='URF'){
                                        downPrice = upPrice;
                                    }else{
                                        downPrice = upPrice * 0.8;
                                    }
                                }else{
                                    upPrice = VMassetListmonth * ContractMonth *Maxcoefficient / 12;
                                    downPrice = VMassetListmonth * ContractMonth * Mincoefficient / 12;
                                }
                                // 市场多年保修价格开发 end DC 2023/01/19
                            }else{
                                //市场多年保修价格开发 DC 2023/1/30 start  设备大于2年半 续签价格 = 定价 *消费率对应系数 / 12 *合同月数
                                upPrice = VMassetListmonth * ContractMonth *Maxcoefficient / 12;
                                downPrice = VMassetListmonth * ContractMonth * Mincoefficient / 12;
                                //市场多年保修价格开发 DC 2023/1/30 end
                            }
                            // gzw 20220630  实际联动6个月价格区分
                        }else{
                            upPrice = strMoney;
                            downPrice = strMoney * 0.8;
                        }
                    }else{
                        upPrice = (LastMContract_Price * Punish) * (1 + Adjustment_ratio_Upper/100);
                        downPrice = (LastMContract_Price * Punish) * (1 + Adjustment_ratio_Lower/100);
                    }
                }else{
                    if (isnew) {
                        newCount ++;
                    } else {
                        newCon = false;
                        firstCCount ++;
                    }
                    upPrice = strMoney;
                    downPrice = strMoney * 0.8;
                }
                // 上下限四舍五入
                upPrice = upPrice.toFixed(2);
                downPrice = downPrice.toFixed(2);
                console.log('upPrice Asset',upPrice);
                console.log('strMoney Asset',strMoney);
                console.log('VMassetListmonth Asset',VMassetListmonth);
                console.log('LastMContract_Price Asset',LastMContract_Price);
                console.log('ContractMonth Asset',ContractMonth);
                console.log('Maxcoefficient Asset',Maxcoefficient);
                if (!isDisabled) {
                    // 实际联动价格 start
                    checkedAssets[i].mcae.Adjustment_Lower_price__c = (downPrice*1).toFixed(2);
                    checkedAssets[i].mcae.Adjustment_Upper_price__c = (upPrice*1).toFixed(2);
                    // 实际联动价格 end
                }
                console.log('checkedAssets[i].mcae.Adjustment_Upper_price__c Asset',checkedAssets[i].mcae.Adjustment_Upper_price__c );
                checkedAssets[i].mcae.Estimate_List_Price_Page__c = strMoney * 1;
                //<!-- (2022年12月上线)故障品加费 start -->
                let Repair_Price_Auto = checkedAssets[i].Repair_Price_Auto;
                // Repair_Price_Auto = Repair_Price_AutoPrice.value(); 避免下面条件误判
                repairMoney = checkedAssets[i].mcae.Repair_Price__c == undefined  ? null : checkedAssets[i].mcae.Repair_Price__c;
                // Repair_Price_pass__c 没有值为null 避免下面条件误判   == null ? undefined : checkedAssets[i].mcae.Repair_Price_pass__c
                let Repair_Price_pass = checkedAssets[i].mcae.Repair_Price_pass__c;
                if ((repairMoney+1)==1) {
                    checkedAssets[i].mcae.Repair_Price__c = Repair_Price_Auto;
                }
                if ((Repair_Price_pass+1)==1) {
                    checkedAssets[i].mcae.Repair_Price_pass__c = Repair_Price_Auto;
                }
                let repairMoney1 = parseFloat(repairMoney * 1);
                let ISReducedpriceapproval = this.estimate.IS_Reduced_price_approval__c;
                if (ISReducedpriceapproval =='有八折以下待审批' || ISReducedpriceapproval =='是' || isDisabled) {
                    checkedAssets[i].IsRepairPriceDisabled = true;
                }else{
                    checkedAssets[i].IsRepairPriceDisabled = false;
                }
                //在该部分js代码 未使用变量
                // ISReducedpriceapproval1 = checkedAssets[i].mcae.IS_Reduced_price_approval__c;
                // ISReduced = ISReducedpriceapproval ;
                if (repairMoney1> 0 && (repairMoney1 <Repair_Price_Auto*0.80)) {
                    isresduce = isresduce+1;
                }
                //+ '' 避免获取值是undefined 或者 null 导致引用异常
                let ResonCannotWarranty = checkedAssets[i].rec.Reson_Can_not_Warranty__c + '';
                if(!(ResonCannotWarranty.indexOf("弃修") != -1)&&(repairMoney+1)==1){
                    checkedAssets[i].ShowAssetSituation = false;
                    checkedAssets[i].mcae.Repair_Price__c = '';
                }
                //在该部分js代码 未使用变量
                // let situation = checkedAssets[i].rec.Asset_situation__c + '';
            }
            repairSum = repairSum + parseFloat(repairMoney* 1);
            listSum = listSum + parseFloat(strMoney* 1);
            downPriceSum = downPriceSum + parseFloat(downPrice* 1);
            upPriceSum =  upPriceSum + parseFloat(upPrice* 1);
        }
        // 仅保留两位小数
        this.assetRepairSumNum = (repairSum * 1).toFixed(2);
        if (!isDisabled) {
            this.estimate.GuidePrice_Up__c = Math.round(upPriceSum) * 1;
            this.estimate.GuidePrice_Down__c = Math.round(downPriceSum) * 1;
        }
        this.estimate.Asset_Repair_Sum_Price__c = repairSum * 1;
        var allcount = this.productCount3 ;
        var result = '';
        if (allcount == 0) {
            result = null;
        //如果所有设备的上期合同都是多年保合同,则合同种类为市场多年保续签合同 thh 20220315 start
        }else if(GuranteeCount > 0 && GuranteeCount == allcount){
            result = '市场多年保续签合同';
        //如果所有设备的上期合同都是多年保合同,则合同种类为市场多年保续签合同 thh 20220315 end
        }else if (newCount > 0 && newCount == allcount && newCon == true) {
            result = '新品合同';
        }else if (((newCount > 0 && newCount == allcount) ||(newCount + firstCCount == allcount)) && newCon == false) {
            result = '首签合同';
        }else if(firstCCount > 0 && firstCCount == allcount){
            result = '首签合同';
        }else if(oyearCount > 0 && oyearCount == conCCount && allcount == oyearCount ){
            // 20220328 ljh update  LJPH-C8FB4P【委托】配合PBI设备覆盖率的数据准备 start
            result = '非续签合同(空白期一年以上)';
        }else{
            result = '续签合同';
        }
        console.log('result',result);
        this.estimate.New_Contract_Type_TxT__c = result;
        this.allData.typeresult = result;
        // 取消酸化水
        //NotUseOxygenatedWaterAmount(1);
        //next  makeRealPrice 暂时补充 examinationPriceCal--方法 目前可走逻辑:makeRealPrice(1)
        // examinationPriceCal(cnt);
        this.makeRealPrice(1);
        this.getLastContractRate();
        // 报价规则改善 20230315 start todo
        this.allDataInfo();
        let returnData = estimateUtility.handleInfo.seamlessRenew(this,checkedAssets.length,this.allData,checkedAssets,this.PageDisabled,this.IsContractEstiStartDateDisabled);
        this.allData = returnData.allData;
        this.handleInitSimpleData(this.allData);
        // 2023/09/18 seamlessRenew 可能修改 IsContractEstiStartDateDisabled 值,handleInitSimpleData中未处理该禁用
        this.IsContractEstiStartDateDisabled = returnData.IsContractEstiStartDateDisabled;
        checkedAssets = returnData.checkedAssets;
        // 报价规则改善 20230315 end
        if (TotalMaintenancePriceYear!=0) {
            TotalMaintenancePriceYear = this.localParseFloat(TotalMaintenancePriceYear).toFixed(2);
            var ContractMonth1 = this.localParseFloat(this.estimate.Contract_Range__c).toFixed(2);
            var result = ((TotalMaintenancePriceYear/12)*ContractMonth1).toFixed(2);
            this.estimate.Total_Contract_Price__c = result;
        }
        //  报价页面【合同定价总额】字段添加 20230608 end
        //返回处理后的结果给allData的checkAsset
        this.makeRealPrice(1);
        return checkedAssets;
    }
    //
    calculateNtoMRatio(lastContRange, month ){
        var lastContRangeYear = Math.ceil(parseFloat(lastContRange* 1)/12);
        var currentMonthYear = Math.ceil(parseFloat(month* 1)/12);
        // 2023/09/06 报价规则改善新增 +-
        // var rateF = this.estimate.Consumption_rate_Forecast__c;
        // var coefficient = this.allData.coefficient;
        // if (this.localParseFloat(rateF) * this.localParseFloat(coefficient) < 100) {
        //     return month;
        // }
        // 报价规则改善新增
        if(currentMonthYear == lastContRangeYear || currentMonthYear == 1){
            return month;
        }else if(month <= 24) {
            return 12+ (month- 12) *1.1;
        }else if(month <= 36) {
            return 25.2 + (month- 24) *1.21;
        }else if(month <= 48) {
            return 39.72 + (month- 36) *1.331;
        }else if(month <= 60) {
            return 55.692 + (month- 48) *1.4641;
        }else {
            estimateUtility.toast.showToast(this, 'error', '合同期最长只能选择60个月!');
            return 0;
        }
    }
    //未选择的保有设备 当前页 全选
    checkAllUncheckedAsset(event){
        this.IsCheckAllUncheckedAsset = event.detail.checked;
        for (var i = 0; i < this.unCheckedAssetNowData.length; i++) {
            let index = this.unCheckedAssetNowData[i].Id;
            this.allData.unCheckedAssets.forEach(function(ar) {
                if (ar.rec.Id == index && !(ar.rec.Maintenance_Price_Month__c == 0 || ar.rec.IF_Warranty_Service__c == '否')) {
                    ar.rec_checkBox_c = event.detail.checked;
                }
            });
        }
        this.handleunCheckedAssetColumnsAndData(this.allData.unCheckedAssets);
    }
    //显示未选择保有设备
    showUnCheckedAsset(event){
        this.IsShowUnCheckedAsset = true;
    }
    //隐藏未选择保有设备
    hiddenUnCheckedAsset(event){
        this.IsShowUnCheckedAsset = false;
    }
    //未选择保有设备 搜索处理
    handleChangeText1(event){
        this.text1 = event.detail.value;
    }
    handleChangeCond1(event){
        this.cond1 = event.detail.value;
    }
    handleChangeVal1(event){
        this.val1 = event.detail.value;
    }
    //检索
    searchJs(event){
        this.IsLoading = true;
        this.allData.text1 = this.text1;
        this.allData.cond1 = this.cond1;
        this.allData.val1 = this.val1;
        this.allDataInfo();
        // 2023/09/16 unCheckedAssets 后台方法重新赋值,直接置空
        let oldUnCheckedAssets = JSON.stringify(this.allData.unCheckedAssets);
        this.allData.unCheckedAssets = [];
        searchBtn({
            initDataStr: JSON.stringify(this.allData),
        }).then(result => {
            result = JSON.parse(result);
            console.log('searchJs result',result);
            this.allData = result;
            this.handleInitSimpleData(result);
            //unCheckedAssets 处理
            this.currentPage = 1;
            this.handleunCheckedAssetColumnsAndData(result.unCheckedAssets);
        }).catch(error => {
            // 2023/09/18 返回异常,旧数据返回赋值
            this.allData.unCheckedAssets = JSON.parse(oldUnCheckedAssets);
        }).finally(() => {
            // classic 一致,优化:改用flag,页面显示和后台处理条件不一致(清除条件时,页面显示为 S:AssetMark__c,实际为 '')
            this.allData.text1 = this.allData.text1 == '' ? 'S:AssetMark__c' : this.allData.text1;
            this.text1 = this.allData.text1;
            this.cond1 = this.allData.cond1;
            this.val1 = this.allData.val1;
            this.IsLoading = false;
        });
    }
    //清除条件
    clearAndSearch() {
        this.text1 = '';
        this.cond1 = 'equals';
        this.val1 = '';
        this.searchJs();
    }
    //确认添加 -- 刷新行选中
    handleExchangeAsset(template,event) {
        this.IsLoading = true;
        this.IsRefresh = false;
        this.allDataInfo();
        //2023/09/16 unCheckedAssets 仅保留勾选数据 后台unCheckedAssets 会重新查询赋值
        let oldUnCheckedAssets = JSON.stringify(this.allData.unCheckedAssets);
        let checkedNewUnCheckedAssets = [];
        this.allData.unCheckedAssets.forEach(function(ar) {
            if (ar.rec_checkBox_c) {
                checkedNewUnCheckedAssets.push(ar);
            }
        });
        this.allData.unCheckedAssets = checkedNewUnCheckedAssets;
        exchangeAsset({
            initDataStr:JSON.stringify(this.allData)
        }).then(result => {
            result = JSON.parse(result);
            console.log('handleExchangeAsset result',result);
            if (result != null) {
                this.allData = result;
                //页面相关数据初始化
                this.handleInitSimpleData(result);
                this.allData.checkedAssets = this.refreshAsset(result.checkedAssets.length,result.checkedAssets);
                this.handleCheckedAssetColumnsAndData(this.allData.checkedAssets);
                //param : unCheckedAssetsView
                this.currentPage = 1;
                this.handleunCheckedAssetColumnsAndData(this.allData.unCheckedAssets);
            }else{
                // 2023/09/18 返回异常,旧数据返回赋值
                this.allData.unCheckedAssets = JSON.parse(oldUnCheckedAssets);
            }
        }).catch(error => {
            console.log(error);
            // 2023/09/18 返回异常,旧数据返回赋值
            this.allData.unCheckedAssets = JSON.parse(oldUnCheckedAssets);
        }).finally(() => {
            this.IsLoading = false;
            this.IsShowUnCheckedAsset = false;
            // 两个表格的 全选 勾选 清除
            this.IsCheckAllUncheckedAsset = false;
            this.IsCheckAllcheckedAsset = false;
            this.IsRefresh = true;
        });
    }
    //提交待审批
    async handleApprove(event){
        //onclick
        this.IsLoading = true;
        let resKindsAndMonths = await this.KindsAndMonths();
        let resEGFlgconfim = await this.EGFlgconfim();
        await this.approvalJs();
        console.log('resKindsAndMonths',resKindsAndMonths);
        console.log('resEGFlgconfim',resEGFlgconfim);
        if (resKindsAndMonths && resEGFlgconfim) {
            this.allDataInfo();
            console.log('approvalProcess result');
            // 2023/09/18 unCheckedAssets 后台方法未涉及该属性,直接置空
            let oldUnCheckedAssets = JSON.stringify(this.allData.unCheckedAssets);
            this.allData.unCheckedAssets = [];
            await approvalProcess({
                initDataStr: JSON.stringify(this.allData),
            }).then(result => {
                console.log('approvalProcess result',result);
                if (result.indexOf('navigateTo') != -1) {
                    this.navigateToOtherObj(result.split('=')[1]);
                }else{
                    estimateUtility.toast.showToast(this, 'error', result);
                    // 2023/09/18 返回异常,旧数据返回赋值
                    this.allData.unCheckedAssets = JSON.parse(oldUnCheckedAssets);
                }
            }).catch(error => {
                // 2023/09/18 返回异常,旧数据返回赋值
                this.allData.unCheckedAssets = JSON.parse(oldUnCheckedAssets);
            }).finally(() => {
            });
            //oncomplete
            this.unblockUI();
        }
        this.IsLoading = false;
    }
    //
    async KindsAndMonths() {
       //   故障品加费 系统检查修理减价审批完成 Start
        let ISReduced = this.estimate.IS_Reduced_price_approval__c;
        if( ISReduced == '审批中' || ISReduced == '有八折以下待审批'){
            estimateUtility.toast.showToast(this, 'error', '请通过修理减价审批再提交');
            return false;
        }
        //   故障品加费 系统检查修理减价审批完成 end
        var months      = parseFloat(this.estimate.Contract_Range__c == undefined ? null : this.estimate.Contract_Range__c);
        var contrNew    = this.estimate.New_Contract_Type_TxT__c;
        if(months>12 && months<60 && contrNew == '新品合同'){
            let confirmResult = await estimateUtility.toast.handleConfirmClick("本次您提交的报价为多年期新品合同,请您在正式提交报价前先将经销商与医院签订的多年期合同邮件发送服务本部报价窗口。若已经提交请点击确定,继续保存提交。");
            return confirmResult;
        }
        // 先款后修-提交报价时如果是先款对象进行提示 thh 20220408 start
        var FirstParagraphEnd = this.estimate.Is_RecognitionModel__c;
        if(FirstParagraphEnd){
            let confirmResult = await estimateUtility.toast.handleConfirmClick("本次签约经销商是先款对象,请确认是否提交报价?");
            return confirmResult;
        }
        // 先款后修-提交报价时如果是先款对象进行提示 thh 20220408 end
        return true;
    }
    //
    approvalJs() {
        this.approvalDate = new Date();
        var rowCnt = this.productCount;
        this.allData.checkedAssets = this.refreshAsset(rowCnt,this.allData.checkedAssets);
        this.handleCheckedAssetColumnsAndData(this.allData.checkedAssets);
    }
    // 过去三年维修实绩计算
    async AlertPriceBtnJs(){
        this.IsLoading = true;
        var  PStatus   = this.estimate.Process_Status__c;
        if(PStatus!='申请中'&& PStatus!='批准'){
            await ComputeLTYRepair({
                targetEstimateId: this.allData.targetEstimateId,
            }).then(result => {
                if (result != null) {
                    estimateUtility.toast.showToast(this, 'error', result);
                }
            }).catch(error => {
            }).finally(() => {
            });
        }else if(PStatus == '申请中'||PStatus == '批准'){
            await ShowLTYRepair({
                targetEstimateId: this.allData.targetEstimateId,
            }).then(result => {
                result = JSON.parse(result);
                if (result != null) {
                    //allData 赋值
                    this.allData.lastFriYearsPriceSum = result.lastFriYearsPriceSum;
                    this.allData.lastSecYearsPriceSum = result.lastSecYearsPriceSum;
                    this.allData.alertString = result.alertString;
                    this.allData.alertString2 = result.alertString2;
                    this.allData.alertString3 = result.alertString3;
                }
            }).catch(error => {
            });
        }
        this.IsLoading = false;
    }
    // 提交修理减价审批
    handleToApprovalProcess(){
        this.IsLoading = true;
        this.allDataInfo();
        // 2023/09/18 unCheckedAssets 后台方法未涉及该属性,直接置空
        let oldUnCheckedAssets = JSON.stringify(this.allData.unCheckedAssets);
        this.allData.unCheckedAssets = [];
        toApprovalProcess({
            initDataStr: JSON.stringify(this.allData),
        }).then(result => {
            if (result != null && result.indexOf('completion=5') != -1) {
                //重新跳转该页面 携带参数
                estimateUtility.toast.showToast(this, 'success', '提交修理减价审批成功');
                window.location.href=window.location.origin+"/lightning/n/lexSelectAssetEstimateVM#id="+result.split('/')[1];
                location.reload();
            }else{
                estimateUtility.toast.showToast(this, 'error', result);
                // 2023/09/18 返回异常,旧数据返回赋值
                this.allData.unCheckedAssets = JSON.parse(oldUnCheckedAssets);
            }
        }).catch(error => {
            // 2023/09/18 返回异常,旧数据返回赋值
            this.allData.unCheckedAssets = JSON.parse(oldUnCheckedAssets);
        }).finally(() => {
            this.IsLoading = false;
        });
    }
    // Decide
    async decideJs() {
        console.log('decideJs');
        if(this.allData.MaintanceContractPackId && this.estimate.McpDecide__c == false) {
            estimateUtility.toast.showToast(this, 'error', '只能对决定报价组合里的报价进行decide!');
            return;
        }
        this.IsLoading = true;
        if (await this.checkDecideDate()) {
            if (await this.onclickCheckchangedAfterPrint('true','false')) {
                var oldDate = this.allData.OldContractStartDate;
                var contractDate = new Date(this.estimate.Contract_Start_Date__c);
                var monthStr = '00' + (contractDate.getMonth()+1);
                monthStr = monthStr.substring(monthStr.length-2, monthStr.length);
                var dayStr = '00' + contractDate.getDate();
                dayStr = dayStr.substring(dayStr.length-2, dayStr.length);
                var contractDateStr = contractDate.getFullYear() + '/' + monthStr + '/' + dayStr;
                //贸易合规 you 20230414 start
                var AccDealerBlacklist = this.contract.AccDealerBlacklist__c;//黑名单,警示名单
                var TradeComplianceStatusFlagFW = this.allData.TradeComplianceStatusFlagFW;//贸易合规开关
                var IFTradeComplianceAlert = this.allData.IFTradeComplianceAlert;//贸易合规提醒
                if(TradeComplianceStatusFlagFW=='true'){
                   if(AccDealerBlacklist =='1'){
                       estimateUtility.toast.showToast(this, 'warning', '您所选择的医院存在贸易合规风险,无法签订服务合同,建议您向客户做好不签约说明,'+IFTradeComplianceAlert);
                       var reflag = handleInterceptsend();//后台
                       this.unblockUI();
                       return null;
                    }else if(AccDealerBlacklist =='2'){
                       estimateUtility.toast.showToast(this, 'warning', '您所选择的经销商存在贸易合规风险,无法签订服务合同,建议您向客户做好不签约说明,'+IFTradeComplianceAlert);
                       var reflag = handleInterceptsend();
                       this.unblockUI();
                       return null;
                    }else if(AccDealerBlacklist =='12'){
                       estimateUtility.toast.showToast(this, 'warning', '您所选择的医院和经销商存在贸易合规风险,无法签订服务合同,建议您向客户做好不签约说明,'+IFTradeComplianceAlert);
                       var reflag = handleInterceptsend();
                       this.unblockUI();
                       return null;
                    }else if(AccDealerBlacklist =='5'){
                       if (!(await estimateUtility.toast.handleConfirmClick('您所选择的医院存在贸易合规警示风险,不建议签订服务合同,请您确认是否继续申请,'+IFTradeComplianceAlert))) {
                        this.unblockUI();
                        return null;
                        }
                    }else if(AccDealerBlacklist =='6'){
                       if (!confirm('您所选择的经销商存在贸易合规警示风险,不建议签订服务合同,请您确认是否继续申请,'+IFTradeComplianceAlert)) {
                        this.unblockUI();
                        return null;
                        }
                    }else if(AccDealerBlacklist =='56'){
                       if (!(await estimateUtility.toast.handleConfirmClick('您所选择的医院和经销商存在贸易合规警示风险,不建议签订服务合同,请您确认是否继续申请,'+IFTradeComplianceAlert))) {
                        this.unblockUI();
                        return null;
                        }
                    }
                }
                //贸易合规 you 20230414 end
                if (oldDate == contractDateStr) {
                    this.allData.changedAfterPrint = false;
                    this.handleDecide();
                } else {
                    var oldp = parseFloat(this.allData.OldMaintenancePrice*1);
                    var newp = parseFloat(this.estimate.Maintenance_Price__c);
                    console.log('oldp',oldp);
                    console.log('newp',newp);
                    if (oldp != newp) {
                        // 20201106 高章伟 提醒消息修改 start
                        this.allData.changedAfterPrint = true;
                        if (await estimateUtility.toast.handleConfirmClick("合同金额发生变化,请您确认。")) {
                            this.handleDecide();
                        } else {
                            estimateUtility.toast.showToast(this, 'warning', '请确认全部内容后点击Decide。');
                            this.estimate.Contract_Start_Date__c = oldDate;
                            this.allData.OldContractStartDate = '';
                            this.allData.changedAfterPrint = false;
                            this.handleDecideCancle();
                        }
                    } else {
                        this.allData.changedAfterPrint = false;
                        this.handleDecide();
                    }
                    // 20201106 高章伟 提醒消息修改 end
                }
            }else{
                this.IsLoading = false;
            }
        }else{
            this.IsLoading = false;
        }
    }
    handleInterceptsend(){
        this.allDataInfo();
        //sendEmail 目前登录用户没有权限,提交RC同方法 SendEmail failed. First exception on row 0; first error: NO_MASS_MAIL_PERMISSION, Single email is not enabled for your organization or profile.
        interceptsend({
            estimateStr: JSON.stringify(this.allData.estimate),
            targetEstimateId: this.allData.targetEstimateId,
        }).then(result => {
            return result;
        }).catch(error => {
        }).finally(() => {
            this.IsLoading = false;
        });
    }
    //
    async checkDecideDate() {
        console.log('checkDecideDate');
        // 报价有效期
        var strSubmitDate = this.estimate.Submit_quotation_day__c;
        // 上期合同结束日 取最晚的
        var conEndDate = await this.getLastContractendDate();
        console.log(11);
        conEndDate = new Date(conEndDate);
        // 今天
        var submitDate = new Date();
        var nowDate = new Date();
        nowDate = new Date(nowDate.toLocaleDateString());
        /// 报价中设备的机身编码为空时的新品合同有效期延长 20200710 gzw
        // 默认为3月,全是产品为6月;
        var monthGap = 6;
        var cntWithKara = this.productCount;
        for (var i = 0; i < cntWithKara; i++) {
            var isManual = this.allData.checkedAssets[i].isManual;
            if (isManual != true) {
                monthGap = 3;
                break;
            }
        }
        if (strSubmitDate != '') {
            submitDate = new Date(strSubmitDate);
            submitDate = new Date(submitDate.setMonth(submitDate.getMonth() + monthGap));
            if(Date.parse(conEndDate)  > Date.parse(submitDate)){
                submitDate = new Date(conEndDate);
            }
        }
        if (strSubmitDate != '' && nowDate > submitDate) {
            estimateUtility.toast.showToast(this, 'error','已超出报价申请日'+ monthGap+'个月,不允许DECIDE。');
            return false;
        }
        return true;
    }
    //
    getLastContractendDate(){
        console.log('getLastContractendDate');
        var rowCnt = this.productCount;
        var lastdate = null;
        for (var i = 0; i < rowCnt; i++) {
            var LastMContractID = this.allData.checkedAssets[i].rec ? this.allData.checkedAssets[i].rec.CurrentContract_F__c : null;
            if(LastMContractID){
                var endDate = new Date(this.allData.checkedAssets[i].rec.CurrentContract_End_Date__c);
                if(lastdate == null){
                    lastdate = new Date(endDate);
                }else if(Date.parse(endDate) > Date.parse(lastdate)){
                    lastdate = new Date(endDate);
                }
            }
        }
        return lastdate;
    }
    //decide
    handleDecide(){
        this.IsLoading = true;
        this.allDataInfo();
        // 2023/09/16 unCheckedAssets 后台方法重新赋值,直接置空
        let oldUnCheckedAssets = JSON.stringify(this.allData.unCheckedAssets);
        this.allData.unCheckedAssets = [];
        decide({
            initDataStr: JSON.stringify(this.allData),
        }).then(result => {
            if (result != null && result.indexOf('completion=') != -1) {
                //重新跳转该页面 携带参数
                window.location.href=window.location.origin+"/lightning/n/lexSelectAssetEstimateVM#id="+result.split('/')[1];
                location.reload();
            }else{
                estimateUtility.toast.showToast(this, 'error', result);
                // 2023/09/18 返回异常,旧数据返回赋值
                this.allData.unCheckedAssets = JSON.parse(oldUnCheckedAssets);
            }
        }).catch(error => {
            // 2023/09/18 返回异常,旧数据返回赋值
            this.allData.unCheckedAssets = JSON.parse(oldUnCheckedAssets);
        }).finally(() => {
            this.IsLoading = false;
        });
    }
    //decideCancle
    handleDecideCancle(){
        //后台页面跳转原页面  替换成location.reload();
        this.IsLoading = true;
        this.allDataInfo();
        // 2023/09/16 unCheckedAssets 后台方法重新赋值,直接置空,后台处理后,页面重载,不考虑旧值 重新赋值
        this.allData.unCheckedAssets = [];
        decideCancle({
            initDataStr: JSON.stringify(this.allData),
        }).then(result => {
        }).catch(error => {
        }).finally(() => {
            location.reload();
            this.IsLoading = false;
        });
    }
    //取消Decide
    handleUndecide(){
        this.IsLoading = true;
        this.allData.estimate = this.estimate;
        undecide({
            targetEstimateId: this.allData.targetEstimateId,
            estimateStr: JSON.stringify(this.allData.estimate),
        }).then(result => {
            if (result != null && result.indexOf('completion=1') != -1) {
                window.location.href=window.location.origin+"/lightning/n/lexSelectAssetEstimateVM#id="+result.split('/')[1];
                location.reload();
            }else{
               estimateUtility.toast.showToast(this, 'error', result);
            }
        }).catch(error => {
        }).finally(() => {
            location.reload();
            this.IsLoading = false;
        });
    }
    //PDF打印按钮
    async handlePrint(){
        this.IsLoading = true;
        if (await this.onclickCheckchangedAfterPrint(this.SaveBtnDisabled,'false')) {
            this.allDataInfo();
            // 2023/09/16 unCheckedAssets 后台方法重新赋值,直接置空
            let oldUnCheckedAssets = JSON.stringify(this.allData.unCheckedAssets);
            this.allData.unCheckedAssets = [];
            print({
                initDataStr: JSON.stringify(this.allData),
            }).then(result => {
                if (result != null && result.indexOf('printAsset') == -1) {
                    estimateUtility.toast.showToast(this, 'error', result);
                    // 2023/09/18 返回异常,旧数据返回赋值
                    this.allData.unCheckedAssets = JSON.parse(oldUnCheckedAssets);
                }else if (result != null) {
                    result = JSON.parse(result);
                    this.allData = result;
                    //页面相关数据初始化
                    this.handleInitSimpleData(result);
                }
            }).catch(error => {
                // 2023/09/18 返回异常,旧数据返回赋值
                this.allData.unCheckedAssets = JSON.parse(oldUnCheckedAssets);
            }).finally(() => {
                //complete
                this.PDFDataChang();
                this.unblockUI();
                ComputeLTYRepair({
                    targetEstimateId: this.allData.targetEstimateId,
                }).then(result => {
                    if (result != null) {
                        estimateUtility.toast.showToast(this, 'error', result);
                    }
                    this.IsLoading = false;
                }).catch(error => {
                }).finally(() => {
                });
            });
        }else{
            this.IsLoading = false;
        }
    }
    //page 后台js 方法 检测printAsset是否满足
    PDFDataChang(){
        if (this.allData.printAsset) {
            //打印保有設備
            // //必须选择打印报价(详细还是简化)
            var con = 0;
            if (this.estimate.Print_ListPrice__c) {
                con ++;
            }
            if (this.estimate.Print_Simplify__c) {
                con ++;
            }
            if (this.estimate.Print_RepairPrice__c) {
                con ++;
            }
            if (this.estimate.Print_SumPrice__c) {
                con ++;
            }
            if(con != 1){
                estimateUtility.toast.showToast(this, 'error', '请您勾选打印报价版本,只能勾选一个。');
            }else{
                 window.open('/apex/MaintenanceContractEstimateVMPDF?id='+this.allData.targetEstimateId, 'MaintenanceContractEstimateVMPDF');
            }
        } else if (this.allData.printContract) {
            // 打印医院合同配置
            window.open('/apex/MceConfigPDF?id='+this.allData.targetEstimateId+'&flag=printContract', 'MceConfigPDF');
        } else if (this.allData.printTripartite) {
            //打印三方合同
            window.open('/apex/MceConfigPDF?id='+this.allData.targetEstimateId+'&flag=printTripartite', 'MceConfigPDF');
        } else if (this.allData.printAgent) {
            //打印经销商合同
            window.open('/apex/MceConfigPDF?id='+this.allData.targetEstimateId+'&flag=printAgent', 'MceConfigPDF');
        }else {}
    }
    //ok 提交RC评估
    async handleSendEmail(){
        this.IsLoading = true;
        if (await this.EGFlgconfim()) {
            this.allDataInfo();
            // 2023/09/16 unCheckedAssets 后台方法重新赋值,直接置空
            let oldUnCheckedAssets = JSON.stringify(this.allData.unCheckedAssets);
            this.allData.unCheckedAssets = [];
            sendEmail({
                initDataStr: JSON.stringify(this.allData),
            }).then(result => {
                //判断是否返回initData  targetEstimateId
                if (result != null && result.indexOf('currPage') != -1) {
                    result = JSON.parse(result);
                    console.log('handleSendEmail result',result);
                    this.allData = result;
                    //页面相关数据初始化
                    this.handleInitSimpleData(result);
                    if (this.allData.sendEmailSuccess) {
                        estimateUtility.toast.showToast(this, 'success', '邮件发送成功!');
                    }else{
                        estimateUtility.toast.showToast(this, 'error', '邮件发送失败,请联系管理员!');
                        // 2023/09/18 返回异常,旧数据返回赋值
                        this.allData.unCheckedAssets = JSON.parse(oldUnCheckedAssets);
                    }
                }else{
                    estimateUtility.toast.showToast(this, 'error', result);
                    // 2023/09/18 返回异常,旧数据返回赋值
                    this.allData.unCheckedAssets = JSON.parse(oldUnCheckedAssets);
                }
            }).catch(error => {
                // 2023/09/18 返回异常,旧数据返回赋值
                this.allData.unCheckedAssets = JSON.parse(oldUnCheckedAssets);
            }).finally(() => {
                this.unblockUI();
                this.IsLoading = false;
            });
        }else{
           this.IsLoading = false;
        }
    }
    //计算预测消费率
    consumptionbtnJs(){
        this.IsLoading = true;
        var mceId = this.allData.targetEstimateId;
        // sforce.connection.sessionId = '{!$Api.Session_ID}';
        ToConsumptionRate({
            mceId: mceId,
        }).then(flg => {
            if (flg == '计算完成') {
                estimateUtility.toast.showToast(this, 'success', flg);
            }else{
                estimateUtility.toast.showToast(this, 'error', flg);
            }
        }).catch(error => {
        }).finally(() => {
            this.IsLoading = false;
        });
    }
    //estimate contract 同步
    allDataInfo(){
        this.allData.estimate = this.estimate;
        this.allData.contract = this.contract;
    }
    //parseFloat 避免NAN
    localParseFloat(val){
        val = val == undefined ? null : val;
        return parseFloat(val*1);
    }
    //页面对象跳转
    navigateToOtherObj(recordId){
        // this.IsLoading = true;
        this[NavigationMixin.Navigate]({
            type:'standard__recordPage',
            attributes:{
                recordId:recordId,
                objectApiName:'Account',
                actionName:'view'
            }
        });
    }
    // del testMax
    // test(){
    //     let max = {};
    //     max.max1 = this.allData;
    //     max.max1.unCheckedAssets = null;
    //     max.max2 = this.allData.checkedAssets;//282 - 564
    //     max.max3 = max.max2.slice(0, 70);
    //     let str = JSON.stringify(max);
    //     console.log('str',str);
    //     test({
    //         str:str,
    //     }).then(result => {
    //         console.log(result);
    //         estimateUtility.toast.showToast(this, 'error', result);
    //     }).catch(error => {
    //         console.log(error);
    //         estimateUtility.toast.showToast(this, 'error', '数据量过大');
    //     }).finally(() => {
    //     });
    // }
}
force-app/main/default/lwc/lexSelectAssetEstimateVM/lexSelectAssetEstimateVM.js-meta.xml
New file
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexSelectAssetEstimateVM">
    <apiVersion>56.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__Tab</target>
        <target>lightning__RecordPage</target>
        <target>lightning__AppPage</target>
        <target>lightning__HomePage</target>
        <target>lightning__RecordAction</target>
    </targets>
</LightningComponentBundle>
force-app/main/default/lwc/lexStartTrading/lexStartTrading.js
@@ -69,17 +69,24 @@
                console.log('start result==========',result);
                if(result!=null){
                    this.showToast('已成功转化询价','success');
                    window.open('/lightning/r/Opportunity/'+result+'/view','_parent');
                    // this[NavigationMixin.GenerateUrl]({
                    //     type: "standard__recordPage",
                    //     attributes: {
                    //         recordId: result,
                    //         objectApiName:"Opportunity",
                    //         actionName:"edit"
                    //     }
                    // })
                    console.log(result);
                    // window.location = '/lightning/r/Opportunity/'+result+'/view';
                    this[NavigationMixin.Navigate]({
                        type: "standard__recordPage",
                        attributes: {
                            recordId: result,
                            actionName:"edit"
                        },
                        state: {
                            nooverride: '1',
                            backgroundContext: '/lightning/r/Opportunity/'+result+'/view'
                }
            });
                }
            }).catch(error=>{
                console.log('error');
                console.log(error);
            });
            // .catch(err=>{
            //     console.log("start error:");
            //     console.log(err);
force-app/main/default/lwc/lexStockCancel/lexStockCancel.html
@@ -1,5 +1,9 @@
<template>
    <div class="Holder" if:true={IsLoading}>
        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
    <div class="Holder" style="
    position: relative;
    width:100%;
    height:200px;
    --sds-c-progress-ring__stroke-color: #0070d2;">
        <lightning-spinner alternative-text="Loading" size="medium" variant="brand"></lightning-spinner>
    </div>
</template>
force-app/main/default/lwc/lexStockCancel/lexStockCancel.js
@@ -6,6 +6,8 @@
import init from '@salesforce/apex/LexStockCancelController.init';
import updateOppotunity from '@salesforce/apex/LexStockCancelController.updateOppotunity';
import submitApprovalRequest from '@salesforce/apex/LexStockCancelController.submitApprovalRequest';
import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
import {loadStyle} from 'lightning/platformResourceLoader';
export default class lexStockCancel extends LightningElement {
    @api recordId;
    IsLoading=true;
@@ -28,6 +30,10 @@
    connectedCallback(){
        Promise.all([
            loadStyle(this, lwcCSS)
        ]);
        console.log(this.recordId);
        init({recordId:this.recordId}).then(result=>{
            console.log(result);
@@ -52,8 +58,10 @@
        let reason = this.data.Stock_cancel_reason__c;
        if (reason == null || reason == '') {
            const event = new ShowToastEvent({
                title: '提示信息',
                message:'必须填写撤销备货理由。'
                title: '',
                message:'必须填写撤销备货理由。',
                variant: 'warning',
                mode: 'sticky'
            });
            this.dispatchEvent(event);
            return;
@@ -63,8 +71,10 @@
        let stage = this.data.Whether_Upload_Question_Document__c;
        if (stage == '0') {
            const event = new ShowToastEvent({
                title: "提示信息",
                message:'请上传质疑函。'
                title: "",
                message:'请上传质疑函。',
                variant: 'warning',
                mode: 'sticky'
            });
            this.dispatchEvent(event);
            return;
@@ -72,8 +82,8 @@
        // CHAN-BCS8T5 LHJ 20190604 End
        const resul = await LightningConfirm.open({
            message: "一旦提交此记录以待批准,根据您的设置您可能不再能够编辑此记录或将他从批准过程中调回。是否继续?",
            variant: 'headerless',
            label: '提示信息',
            variant: '',
            label: '',
            // setting theme would have no effect
        });
        if (resul==false) {
@@ -87,8 +97,10 @@
                flag=false;
                messages=res.errors[0];
                const event = new ShowToastEvent({
                    title: '提示信息',
                    message:"操作失败,提示信息:"+messages
                    title: '',
                    message:""+messages,
                    variant: 'error',
                    mode: 'sticky'
                });
                this.dispatchEvent(event);
                return;
@@ -132,8 +144,10 @@
                    flag=false;
                    messages=res.errors[0];
                    const event = new ShowToastEvent({
                        title: '提示信息',
                        message:"操作失败,提示信息:"+messages,
                        title: '',
                        message:""+messages,
                        variant: 'warning',
                        mode: 'sticky'
                    });        
                    this.dispatchEvent(event);
                    return;
@@ -141,11 +155,11 @@
            });
            if(flag==false)return;
            const event = new ShowToastEvent({
                title: '提示信息',
                message:ress
                title: '',
                message:ress,
                mode: 'sticky'
            });
            this.dispatchEvent(event);
            return;
        }
        // window.location.reload();
    };
force-app/main/default/lwc/lexsurface/lexsurface.css
New file
@@ -0,0 +1,11 @@
.surface{
    position: relative;
    display: inline-block;
    width: 80px;
    height: 80px;
    text-align: center;
}
.container .uiContainerManager{
    display : none !important;
}
force-app/main/default/lwc/lexsurface/lexsurface.html
New file
@@ -0,0 +1,5 @@
<template>
    <div class="surface" if:true={IsLoading}>
        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
    </div>
</template>
force-app/main/default/lwc/lexsurface/lexsurface.js
New file
@@ -0,0 +1,32 @@
import { LightningElement,api, track, wire } from 'lwc';
import {CurrentPageReference} from 'lightning/navigation';
import { NavigationMixin } from 'lightning/navigation';
export default class Lexsurface extends NavigationMixin(LightningElement) {
    @api recordId;
    IsLoading=true;
    @wire(CurrentPageReference)
    getStateParameters(currentPageReference){
        console.log("进入页面");
        console.log(currentPageReference);
        if(currentPageReference){
            const urvalue=currentPageReference.state.recordId;
            if(urvalue){
                let str=`${urvalue}`;
                console.log('str');
                console.log(str);
                this.recordId=str;
            }
        }
    }
    connectedCallback(){
        this[NavigationMixin.Navigate]({
            type: 'standard__webPage',
            attributes: {
               url:'/apex/Ordergoods?accid='+this.recordId
            }
        });
        this.IsLoading = false
    }
}
force-app/main/default/lwc/lexsurface/lexsurface.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>57.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/multiSelectCombobox/multiSelectCombobox.html
@@ -4,7 +4,7 @@
 * @Author: chen jing wu
 * @Date: 2023-04-25 17:41:26
 * @LastEditors: chen jing wu
 * @LastEditTime: 2023-10-11 11:34:42
 * @LastEditTime: 2023-10-16 13:23:10
-->
<!-- Code by CafeForce || www.cafeforce.com || support@cafeforce.com || Mandatory Header -->
@@ -53,7 +53,7 @@
        </div>
    </div>
    <template if:true={errorFlag}>
        <div style="color:#EA001E;font-size:10px">填写此字段。</div>
        <div style="color:#BA0517;font-size:12px">填写此字段。</div>
    </template>
    <!-- Multi Select Pills -->
    <template for:each={optionData} for:item="option">
force-app/main/default/lwc/oppLoseButton/oppLoseButton.html
@@ -1,8 +1,9 @@
<template>
    <div class="slds-is-relative">
        <template if:true={showSpinner}>
            <lightning-spinner size="medium" variant="brand"></lightning-spinner>
        </template>
    <div class="Holder" style="
    position: relative;
    width:100%;
    height: 200px;
    --sds-c-progress-ring__stroke-color: #0070d2;">
        <lightning-spinner alternative-text="Loading" size="medium" variant="brand"></lightning-spinner>
    </div>
</template>
force-app/main/default/lwc/oppLoseButton/oppLoseButton.js
@@ -3,35 +3,51 @@
import { CloseActionScreenEvent } from 'lightning/actions';
import { NavigationMixin } from 'lightning/navigation';
import  init  from '@salesforce/apex/OppLoseController.init';
export default class OppLoseButton extends LightningElement {
    @api
    taskId;
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
import {loadStyle} from 'lightning/platformResourceLoader';
export default class OppLoseButton extends NavigationMixin(LightningElement) {
    @api recordId;
    opp;
    stageName;
    SAP_Send_OK;
    Cnt_Lost_cancel_report;
    Name;
    Sales_assistant_name;
    Sales_assistant_ID;
    Manager_name;
    Sales_manager_departmentID;
    Sales_owner_buchang;
    Sales_owner_buchangID;
    OpportunityId;
    StageName; //阶段
    SAP_Send_OK;//SAP上传(WIN)
    Cnt_Lost_cancel_report;//累计汇总 (COUNT 询价失单/取消报告)
    Name;//    业务机会名
    Sales_assistant_name;//询价助理
    Sales_assistant_ID;//询价助理ID
    Manager_name;//询价所有人的CL6 经理级
    Sales_manager_departmentID;//询价所有人的CL6 经理级ID
    Sales_owner_buchang;//询价所有人的 CL5 总监级
    Sales_owner_buchangID;//询价所有人的CL5 经理级ID
    OpportunityId; //任务 询价
    task;
    taskStatusOne;
    reId;
    @wire(CurrentPageReference)
    getStateParameters(currentPageReference){
        if(currentPageReference){
            const urlValue=currentPageReference.state.recordId;
            if(urlValue){
                let str=`${urlValue}`;
                this.recordId=str;
            }
        }
    }
    connectedCallback(){
        console.log(this.taskId);
        init({
            taskId: this.taskId
        }).then(result => {
            console.log(result);
            if (result != null) {
                
        Promise.all([
            loadStyle(this, lwcCSS)
        ]);
        console.log(this.recordId);
        init({
            taskId: this.recordId
        }).then(result => {
            console.log("==========================");
            console.log(result);
                this.IsLoading = false;
                this.opp = result.opp;
                this.stageName = result.stageName;
            this.StageName = result.StageName;
                this.SAP_Send_OK = result.SAP_Send_OK;
                this.Cnt_Lost_cancel_report = result.Cnt_Lost_cancel_report;
                this.Name = result.Name;
@@ -42,45 +58,118 @@
                this.Sales_owner_buchang = result.Sales_owner_buchang;
                this.Sales_owner_buchangID = result.Sales_owner_buchangID;
                this.OpportunityId = result.OpportunityId;
            this.taskStatusOne = result.taskStatusOne;
                this.task = result.task;
            this.reId=result.reId;
                this.changeContractType();
                this.dispatchEvent(new CloseActionScreenEvent());
                // window.location.reload();
            }
        }).catch(error => {
            console.log("error");
            console.log(error);
        }).finally(() => {
        });
        })
    }
    changeContractType(){
        if(this.StageName != '引合' && this.StageName != '询价'){
            alert('状态1: '+ this.StageName + '、不能做 失单 了!');
            // alert('状态1: '+ this.StageName + '、不能做 失单 了!');
            this.showToast("状态1:" + this.StageName + "、不能做 失单 了!","error");
            return;
        }
        else if(this.SAP_Send_OK == '1'){
            alert('已经上传SAP、不能做 失单 了!');
            // alert('已经上传SAP、不能做 失单 了!');
            this.showToast("已经上传SAP、不能做 失单 了!","error");
            return;
        }
        else if(this.Cnt_Lost_cancel_report__c > 0){
            alert('询价已经有 取消/失单报告 了!');
        else if(this.Cnt_Lost_cancel_report > 0){
            // alert('询价已经有 取消/失单报告 了!');
            this.showToast("询价已经有 取消/失单报告 了!","error");
            return;
             // window.location.reload();
        }else{
            location.href =
            '/a1U/e?retURL=%2F' + this.OpportunityId +
            '&RecordType=01210000000R4hM' +
            '&CF00N10000004lbGT={!URLENCODE('+this.Name+')}' +
            '&CF00N10000004lbGT_lkid=' + this.OpportunityId +
            var url = '/lightning/n/PCLLostReportPageLwc#pageStatus=Create&oppId=' + this.OpportunityId + '&lostType=失单';
            location.href = url;
            // const defaultValues = encodeDefaultFieldValues({
            //     Opportunity__c:this.OpportunityId,
            //     Sales_assistant__c:this.Sales_assistant_ID,
            //     Manager_sales__c:this.Sales_manager_departmentID,
            //     Buchang_sales__c:this.Sales_owner_buchangID
            // });
            // this[NavigationMixin.Navigate]({
            //     type: 'standard__objectPage',
            //     attributes: {
            //         objectApiName: 'Lost_cancel_report__c',
            //         actionName: 'new'
            //     },
            //     state: {
            //         // nooverride: '1',
            //         defaultFieldValues: defaultValues,
            //         recordTypeId: this.reId
            //     }
            // });
            '&CF00N10000006QShg={!URLENCODE('+this.Sales_assistant_name+')}' +
            '&CF00N10000006QShg_lkid={!URLENCODE('+this.Sales_assistant_ID+')}' +
            '&CF00N10000006QShq={!URLENCODE('+this.Manager_name+')}' +
            '&CF00N10000006QShq_lkid={!URLENCODE('+this.Sales_manager_departmentID+')}' +
            '&CF00N10000006QShb={!URLENCODE('+this.Sales_owner_buchang+')}' +
            '&CF00N10000006QShb_lkid={!URLENCODE('+this.Sales_owner_buchangID+')}' +
            '';
            // location.href =
            // '/a1U/e?retURL=%2F' + this.OpportunityId +
            // '&RecordType=' + this.reId+
            // // '&CF00N10000004lbGT='+ this.Name +
            // '&Opportunity__c=' + this.OpportunityId +
            // // '&CF00N10000006QShg='+this.Sales_assistant_name+
            // '&Sales_assistant__c='+this.Sales_assistant_ID +
            // // '&CF00N10000006QShq='+this.Manager_name +
            // '&Manager_sales__c='+this.Sales_manager_departmentID +
            // // '&CF00N10000006QShb='+this.Sales_owner_buchang +
            // '&Buchang_sales__c='+this.Sales_owner_buchangID +
            // '';
            this.dispatchEvent(new CloseActionScreenEvent());
        }
    }
    showToast(msg,type) {
        if(type == 'success'){
            const event = new ShowToastEvent({
                message: msg,
                variant: type
            });
            // this.updateRecordView(this.recordId);
            this.dispatchEvent(event);
            this.dispatchEvent(new CloseActionScreenEvent());
        }else{
            const event = new ShowToastEvent({
                message: msg,
                variant: type,
                mode: 'sticky'
            });
            // this.updateRecordView(this.recordId);
            this.dispatchEvent(event);
            this.dispatchEvent(new CloseActionScreenEvent());
        }
        }
    }
}
// var sql = "select Sales_owner_buchangID__c,Manager_name__c,Sales_owner_buchang__c,Sales_manager_departmentID__c,name,Sales_assistant_name__c,Sales_assistant_ID__c,id,StageName,SAP_Send_OK__c,Cnt_Lost_cancel_report__c,Bidding_Project_Name_Bid__c from Opportunity where id = '{!task__c.OpportunityIdId__c}'";
// var opp_recourd = sforce.connection.query(sql);
// var opp = opp_recourd.getArray("records")[0];
// if (opp.StageName != '引合'
// && opp.StageName != '询价'
// ) {
// alert("状态1:" + opp.StageName + "、不能做 失单 了!");
// }
// else if (opp.SAP_Send_OK__c == '1') {
// alert("已经上传SAP、不能做 失单 了!");
// }
// else if (opp.Cnt_Lost_cancel_report__c > 0) {
// alert("询价已经有 取消/失单报告 了!");
// }
// else {
// location.href =
// '/a1U/e?retURL=%2F{!task__c.OpportunityIdId__c}' +
// '&RecordType=01210000000R4hM' +
// '&CF00N10000004lbGT={!URLENCODE('+opp.name+')}' +
// '&CF00N10000004lbGT_lkid={!task__c.OpportunityIdId__c}' +
// '&CF00N10000006QShg={!URLENCODE('+opp.Sales_assistant_name__c+')}' +
// '&CF00N10000006QShg_lkid={!URLENCODE('+opp.Sales_assistant_ID__c+')}' +
// '&CF00N10000006QShq={!URLENCODE('+opp.Manager_name__c+')}' +
// '&CF00N10000006QShq_lkid={!URLENCODE('+opp.Sales_manager_departmentID__c+')}' +
// '&CF00N10000006QShb={!URLENCODE('+opp.Sales_owner_buchang__c+')}' +
// '&CF00N10000006QShb_lkid={!URLENCODE('+opp.Sales_owner_buchangID__c+')}' +
// '';
// }
force-app/main/default/lwc/tEnquiryNoBidding/tEnquiryNoBidding.html
@@ -58,7 +58,13 @@
        <div if:true={BCIsShow}>
          <label class="slds-form-element__label" for="select-02">补充说明:</label>
          <div class="slds-form-element__control">
            <template if:true={InspectData.RepsExtraContent__c}>
            <input type="text" id="text-input-id-3" placeholder="请输入补充说明" required="" onchange={handleBCSMFn} value={InspectData.RepsExtraContent__c} aria-describedby="error-message-unique-id" class="slds-input" aria-invalid="true" />
            </template>
            <template if:false={InspectData.RepsExtraContent__c}>
              <input type="text" id="text-input-id-4" placeholder="请输入补充说明" required="" onchange={handleBCSMFn}  aria-describedby="error-message-unique-id" class="slds-input" aria-invalid="true" />
            </template>
            <!-- <input type="text" id="text-input-id-3" placeholder="请输入补充说明" required="" onchange={handleBCSMFn} value={InspectData.RepsExtraContent__c} aria-describedby="error-message-unique-id" class="slds-input" aria-invalid="true" /> -->
          </div>
          <!-- <div class="slds-form-element__help" id="error-message-unique-id2" if:true={qtLyFlag}>补充说明不能为空</div> -->
        </div>
@@ -66,7 +72,12 @@
        <div if:true={YSJEIsShow}>
          <label class="slds-form-element__label" for="select-02">涉及预算金额:</label>
          <div class="slds-form-element__control">
            <template if:true={InspectData.InvolveBudgetAmount__c}>
            <input type="text" id="text-input-id-5" placeholder="请输入涉及预算金额" required="" onchange={handleYSJEFn} value={InspectData.InvolveBudgetAmount__c} aria-describedby="error-message-unique-id" class="slds-input" aria-invalid="true" if:false={IsYSJE} />
            </template>
            <template if:false={InspectData.InvolveBudgetAmount__c}>
              <input type="text" id="text-input-id-6" placeholder="请输入涉及预算金额" required="" onchange={handleYSJEFn}  aria-describedby="error-message-unique-id" class="slds-input" aria-invalid="true" if:false={IsYSJE} />
            </template>
          </div>
          <!-- <div class="slds-form-element__help" id="error-message-unique-id2" if:true={qtLyFlag}>补充说明不能为空</div> -->
        </div>
force-app/main/default/lwc/tEnquiryNoBidding/tEnquiryNoBidding.js
@@ -1,13 +1,14 @@
import { LightningElement, track } from 'lwc';
import { LightningElement,api, track } from 'lwc';
import GetInspectById from '@salesforce/apex/EnquiryNoBiddingController.GetInspectById';
import SaveDataYB from '@salesforce/apex/EnquiryNoBiddingController.SaveDataYB';
import ChangeDataYB from '@salesforce/apex/EnquiryNoBiddingController.ChangeDataYB';
import GetIrresponsibleReason from '@salesforce/apex/EnquiryNoBiddingController.GetIrresponsibleReason';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import CheckOwnerRequest from '@salesforce/apex/EnquiryNoBiddingController.CheckOwner';
import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
import {loadStyle} from 'lightning/platformResourceLoader';
import GetTenderInformationById from '@salesforce/apex/EnquiryNoBiddingController.GetTenderInformationById';
import { CloseActionScreenEvent } from 'lightning/actions';
import GetDataById from '@salesforce/apex/EnquiryNoBiddingController.GetDataById';
@@ -30,6 +31,25 @@
TongzhiIcon = 'standard:account'  //提示显示的标签
IsLeftStyle = ""  //提示显示的样式
BgColorStyle = ""
showToast(msg,type) {
    if(type == 'success'){
      const event = new ShowToastEvent({
        title: '',
        message: msg,
        variant: type
      });
      this.dispatchEvent(event);
    }else{
      const event = new ShowToastEvent({
        title: '',
        message: msg,
        variant: type,
        mode: 'sticky'
    });
    this.dispatchEvent(event);
    }
}
Alert(content,error = false,left = false){
    this.SaveShowText = content;
    this.Tongzhishow = true;
@@ -72,23 +92,28 @@
        }
        return(false);
    }
    ParamIdStr = '' //不应标申请iD
    ParamOIdStr = '' //询价ID
    ParamPIdStr = '' //招投标ID
    @api ParamIdStr = ''; //不应标申请iD
    @api ParamOIdStr = '';//询价ID
    @api ParamPIdStr = ''; //招投标ID
    
    connectedCallback(){
        Promise.all([
            loadStyle(this, lwcCSS)
           ]);
        console.log('123456');
        console.log(this.ParamOIdStr);
        this.OnLoading(true);
        
        var paramId =  this.getQueryVariable('id');
        var paramOId =  this.getQueryVariable('oid');
        var paramTId =  this.getQueryVariable('tid');
        // var paramId =  this.getQueryVariable('id');
        // var paramOId =  this.getQueryVariable('oid');
        // var paramTId =  this.getQueryVariable('tid');
        // paramId = 'a4Y1m0000000dhGEAQ';
        // paramOId = '0061000000QL9M4AAL';
        this.ParamIdStr= paramId;
        this.ParamOIdStr = paramOId;
        this.ParamPIdStr = paramTId;
        // this.ParamIdStr= paramId;
        // this.ParamOIdStr = paramOId;
        // this.ParamPIdStr = paramTId;
     
        debugger;
@@ -96,7 +121,7 @@
       
        // Opp_Bid__c | Bidding_Project_Name_BidId__c
        if(this.ParamOIdStr !=undefined && this.ParamOIdStr!=false)
        if(this.ParamOIdStr !='' && this.ParamOIdStr!=false)
        {
            GetDataById({Id:this.ParamOIdStr}).then(response=>{
                var data = JSON.parse(response);
@@ -109,7 +134,10 @@
                setTimeout(()=>{
                    this.OnLoading(false);
                },1500);
            })
            }).catch(error=>{
                console.log('error');
                console.log(error);
            });
        }
    }
@@ -237,7 +265,7 @@
    //数据保存方法
    saveFn(event,temp){
        if(!this.IsCheck){return;}
        this.IsLoading = true;
        this.IsCheck = false;
        
        debugger;
@@ -262,18 +290,27 @@
            debugger;
            var IsInsert = this.InspectData.Id==undefined?"是":"否";
            const closeEvent = new CustomEvent('closeaction', {
                bubbles: true, // 允许事件冒泡至父组件
                composed: true, // 允许事件穿越 Shadow DOM 界限
            });
            if (temp == 1) {
                ChangeDataYB({JsonData:JSON.stringify(this.InspectData),Id:this.ParamOIdStr,IsInsert:IsInsert}).then((response)=>{
                    if (response.indexOf("成功") != -1) {
                        this.Alert("提交成功");
                        // this.Alert("提交成功");
                        this.showToast("提交成功","success");
                        this.DisabledSet();
                        this.IsLoading = false;
                        this.IsCheck = true;
                        window.location.hash = "Refresh"+"=="+this.ParamOIdStr;
                        setTimeout(() => {
                            window.location = '/' + this.ParamOIdStr;
                        }, 2000);
                        this.dispatchEvent(closeEvent);
                        // window.location.hash = "Refresh"+"=="+this.ParamOIdStr;
                    }else{
                        this.Alert(response,true);
                        this.showToast(response,"error");
                        this.IsLoading = false;
                        // this.Alert(response,true);
                        this.IsCheck = true;
                    }
                });
@@ -281,11 +318,19 @@
            {
                SaveDataYB({JsonData:JSON.stringify(this.InspectData),Id:this.ParamOIdStr,IsInsert:IsInsert}).then((response)=>{
                    if (response=="成功") {
                        this.Alert("保存成功",false,true);
                        window.location.hash = "Refresh"+"=="+this.ParamOIdStr;
                        // this.Alert("保存成功",false,true);
                        this.showToast("保存成功","success");
                        this.IsLoading = false;
                        // window.location.hash = "Refresh"+"=="+this.ParamOIdStr;
                        setTimeout(() => {
                            window.location = '/' + this.ParamOIdStr;
                        }, 2000);
                        this.dispatchEvent(closeEvent);
                        this.IsCheck = true;
                    }else{
                        this.Alert(response,true);
                        // this.Alert(response,true);
                        this.showToast(response,"error");
                        this.IsLoading = false;
                        this.IsCheck = true;
                    }
                });
force-app/main/default/pages/CheckAllOlympusAsset.page
@@ -1017,7 +1017,7 @@
                        <tr class="dataRow" id="tableData_L_{!Cnt_L}" onmouseover="if (window.hiOn){hiOn(this);} " onmouseout="if (window.hiOff){hiOff(this);} " onblur="if (window.hiOff){hiOff(this);}" onfocus="if (window.hiOn){hiOn(this);}">
                            <!-- 全选 -->
                            <td class="dataCellBorder1" style="width:20px" align="center">
                                <apex:inputCheckbox id="rowCheck" value="{!eachAssetData.isCheck}" disabled="{!IF((internalAssetLocationLogin != 'All' && eachAssetData.assetQuertResult['Internal_asset_location__c'] != internalAssetLocationLogin), true, false)}" onchange="checkboxOnclick(); return false;" />
                                <apex:inputCheckbox id="rowCheck" value="{!eachAssetData.isCheck}" disabled="{!IF(columnLeftRWMap[leftApiList[0][0]]=='r' || (internalAssetLocationLogin != 'All' && eachAssetData.assetQuertResult['Internal_asset_location__c'] != internalAssetLocationLogin), true, false)}" onchange="checkboxOnclick(); return false;" />
                                <apex:inputHidden id="canChange" />
                            </td>
                            <apex:variable value="{!0}" var="cnt2" />
force-app/main/default/triggers/ContentDocumentLink.trigger
@@ -2,6 +2,7 @@
    if(StaticParameter.ContentDocumentLink == false){
        return;
    }
    if((!Test.isRunningTest())&&UserInfo.getUserId()==System.Label.ByPassTrigger){
        return;
    }
@@ -60,6 +61,7 @@
    List<String> rentaldeleteApplyFaultIds = new List<String>();
    Map<String,List<Id>> deleteImages = new Map<String,List<Id>>();
    // sx 20230210end 备品借出申请故障报告附件提取
    Set<Id> docidList = new Set<Id>();
    if (Trigger.isBefore && Trigger.isInsert) {
        for (ContentDocumentLink link : Trigger.new) {
            if(String.valueOf(link.LinkedEntityId).startsWith(System.Label.Oppor_sepKey)){
@@ -69,6 +71,23 @@
            if(String.valueOf(link.LinkedEntityId).startsWith('a3Z')){
                opportunityFileOrderIds.add(link.LinkedEntityId);
            }
            docidList.add(link.ContentDocumentId);
        }
    }
    if (Trigger.isAfter && Trigger.isInsert) {
        for (ContentDocumentLink link : Trigger.new) {
            docidList.add(link.ContentDocumentId);
        }
    }
    ContentVersion ver = new ContentVersion();
    System.debug('docidList.size=>' + docidList.size());
    if(docidList.size() > 0){
        ver = [select FileType,TextPreview from ContentVersion where ContentDocumentId in: docidList limit 1];
        System.debug('TextPreview=>' + ver.TextPreview);
        System.debug('FileType=>' + ver.TextPreview);
        if(ver.FileType == 'SNOTE'){
            System.debug('可恶的备注!!!');
            return;
        }
    }
    if (Trigger.isBefore && Trigger.isDelete) {
@@ -401,9 +420,12 @@
                System.debug(Trigger.isBefore+'陈京武');
                return;
            }else{
                System.debug(Trigger.isBefore+'武');
                if(link.LinkedEntityId.getSObjectType().getDescribe().getName() != 'User'){
                DeleteReIds.add(link.LinkedEntityId);
            }
                // System.debug(Trigger.isBefore+'武');
                // DeleteReIds.add(link.LinkedEntityId);
            }
        }
    }
    if(DeleteReIds.size() > 0){
force-app/main/default/triggers/ContentDocumentTrigger.trigger
@@ -322,6 +322,7 @@
                for(Account_Delay_Apply__c accapp : adaList){                    
                    if(Trigger.isUpdate && Trigger.isBefore){
                        for(ContentDocument doc : Trigger.New){
                            System.debug('状态1=》' + accapp.Is_Active__c);
                            if(accapp.Is_Active__c != '草案中'){
                                doc.addError('非草案中,附件不允许编辑。');
                
@@ -332,6 +333,7 @@
                    if(Trigger.isDelete && Trigger.isBefore){
                        for(ContentDocument doc : Trigger.old){
                            // if(attMap.containsKey(att.ParentID) && accapp.Is_Active__c != '草案中'){
                                System.debug('状态2=》' + accapp.Is_Active__c);
                            if(accapp.Is_Active__c != '草案中'){
                                doc.addError('非草案中,附件不允许删除。');