From b6f2c55d21463def425048aba48bed273156e9a9 Mon Sep 17 00:00:00 2001 From: buli <137736985@qq.com> Date: 星期五, 08 四月 2022 21:01:02 +0800 Subject: [PATCH] PIPLFunctionV10408 --- force-app/main/default/pages/NewReplacementOpportunity.page | 47 +++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 45 insertions(+), 2 deletions(-) diff --git a/force-app/main/default/pages/NewReplacementOpportunity.page b/force-app/main/default/pages/NewReplacementOpportunity.page index 9934402..0b04ed8 100644 --- a/force-app/main/default/pages/NewReplacementOpportunity.page +++ b/force-app/main/default/pages/NewReplacementOpportunity.page @@ -1,12 +1,54 @@ <apex:page id="Page" Controller="NewReplacementOpportunityController" 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 = ''; + function getPIData(){ + let opportunityPayloadList = []; + let opportunityPIData = new Object(); + opportunityPIData.dealerSalesStaffName = document.getElementById('Page:mainForm:idSearchSetProduct:j_id35:j_id38:opp_DealerSalesStaffName').value + opportunityPayloadList.push(opportunityPIData); + return JSON.stringify(opportunityPayloadList); + } function saveJs() { blockme(); - saveBtn(); + new Promise(function(resolve,reject){ + //鍔犲瘑 + let queryPostBack = function(data){ + document.getElementById('Page:mainForm:idSearchSetProduct:j_id35:j_id38:opp_DealerSalesStaffName').value = data.object[0].dealerSalesStaffName; + document.getElementById('Page:mainForm:idSearchSetProduct:j_id35: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){ + //娓呯┖浠g悊鍟嗛攢鍞媴褰撹�呭悕 + document.getElementById('Page:mainForm:idSearchSetProduct:j_id35:j_id38:opp_DealerSalesStaffName').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; } function saveYesJs() { @@ -30,7 +72,7 @@ </script> <apex:form id="mainForm"> - <apex:actionFunction action="{!saveBtn}" name="saveBtn" reRender="mainForm,message" oncomplete="unblockUI();"/> + <apex:actionFunction action="{!saveBtn}" name="saveBtn" reRender="mainForm,message" oncomplete="Trans();unblockUI();"/> <apex:actionFunction action="{!saveBtnYes}" name="saveBtnYes" reRender="mainForm,message" oncomplete="unblockUI();"/> <apex:actionFunction action="{!saveBtnNo}" name="saveBtnNo" reRender="mainForm,message" oncomplete="unblockUI();"/> @@ -99,6 +141,7 @@ <apex:outputLabel value="浠g悊鍟嗛攢鍞媴褰撹�呭悕" for="opp_DealerSalesStaffName"/> <apex:inputField value="{!opp.DealerSalesStaffName__c}" id="opp_DealerSalesStaffName" required="true"/> </apex:pageBlockSectionItem> + <apex:inputHidden id="opportunityAWSDataId" value="{!opp.AWS_Data_Id__c}"/> </apex:pageBlockSection> </apex:pageBlock> -- Gitblit v1.9.1