buli
2022-05-13 2f4492ee18f90274582fcc2bb06f5e9bf64136e8
force-app/main/default/pages/NewOpportunity.page
@@ -1,75 +1,12 @@
<apex:page id="Page" Controller="NewOpportunityController" sidebar="true" showHeader="true" action="{!init}">
    <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" />
    <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
    <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
    <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
    <script>
        var staticResource = JSON.parse('{!staticResource}');
        var txId = '';
        // var DealerSalesStaffNameId = 'Page:mainForm:idSearchSetProduct:j_id53:j_id56:opp_DealerSalesStaffName';
        // var DealerServiceId = 'Page:mainForm:idSearchSetProduct:j_id53:j_id62:opp_DealerService';
        var DealerSalesStaffNameId = 'page:form:block:j_id50:6:j_id51:j_id52:1:j_id53';
        var DealerServiceId = 'page:form:block:j_id50:6:j_id51:j_id52:2:j_id53';
        var opportunityAWSDataId = 'Page:mainForm:idSearchSetProduct:j_id53:opportunityAWSDataId';
        function getPIData(){
            let opportunityPayloadList = [];
            let opportunityPIData = new Object();
            if(document.getElementById(DealerSalesStaffNameId)){
                opportunityPIData.dealerSalesStaffName = document.getElementById(DealerSalesStaffNameId).value
            }
            if(document.getElementById(DealerServiceId)){
                opportunityPIData.dealerService = document.getElementById(DealerServiceId).value
            }
            opportunityPayloadList.push(opportunityPIData);
            return JSON.stringify(opportunityPayloadList);
        }
    function saveJs() {
        blockme();
        new Promise(function(resolve,reject){
            //加密
            let queryPostBack = function(data){
                if(document.getElementById(DealerSalesStaffNameId)){
                    document.getElementById(DealerSalesStaffNameId).value = data.object[0].dealerSalesStaffName;
                }
                if(document.getElementById(DealerServiceId)){
                    document.getElementById(DealerServiceId).value = data.object[0].dealerService;
                }
                if(document.getElementById(opportunityAWSDataId)){
                    document.getElementById(opportunityAWSDataId).value = data.object[0].dataId;
                }
                txId = data.txId;
                resolve('success');
            };
            AWSService.post(staticResource.newUrl,getPIData(),queryPostBack,staticResource.token);
        }).then(function(data){
            saveBtn();
            Trans();
        })
    }
    //aws 确认
    function Trans(){
        let b = HasError();
        if(b){
            //清空代理商销售担当者名
            if(document.getElementById(DealerSalesStaffNameId)){
                document.getElementById(DealerSalesStaffNameId).value=''
            }
            if(document.getElementById(DealerServiceId)){
                document.getElementById(DealerServiceId).value=''
            }
        }
        AWSService.post(staticResource.transactionUrl, JSON.stringify({
                "txId":txId,
                "isSuccess":b ? 0 : 1
            }), function(result){
                console.log('Trans result = '+ JSON.stringify(result));
            }, staticResource.token);
    }
    function HasError(){
        let e = document.getElementById("Page:mainForm:message");
        return e.children[0]!=null;
        saveBtn();
    }
    function saveYesJs() {
@@ -154,10 +91,10 @@
                    <apex:outputLabel value="COMPO询价" for="compo_opp"/>
                    <apex:inputField value="{!opp.compo_opp__c}" id="compo_opp"/>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem rendered="{!IF(ProductSegment == 'BS', true, false)}">
                <!-- <apex:pageBlockSectionItem rendered="{!IF(ProductSegment == 'BS', true, false)}">
                    <apex:outputLabel value="用途" for="useing"/>
                    <apex:inputField value="{!opp.useing__c}" id="useing"/>
                </apex:pageBlockSectionItem>
                </apex:pageBlockSectionItem> -->
            </apex:pageBlockSection>
            <apex:pageBlockSection title="结果信息" columns="2">
@@ -217,7 +154,6 @@
                    <apex:outputLabel value="代理商服务担当者名" for="opp_DealerService"/>
                    <apex:inputField value="{!opp.DealerService__c}" id="opp_DealerService"/>
                </apex:pageBlockSectionItem>
                <apex:inputHidden id="opportunityAWSDataId" value="{!opp.AWS_Data_Id__c}"/>
            </apex:pageBlockSection>
            <apex:pageBlockSection title="竞争者信息" columns="2">
@@ -399,7 +335,6 @@
                    <apex:outputLabel value="代理商服务担当者名." for="opp_DealerService"/>
                    <apex:inputField value="{!opp.Dealer_Service_D__c}" id="opp_DealerService"/>
                </apex:pageBlockSectionItem>
                <apex:inputHidden id="opportunityAWSDataId" value="{!opp.AWS_Data_Id__c}"/>
            </apex:pageBlockSection>
            <apex:pageBlockSection title="竞争者信息" columns="2">