From 4420517bbbffea48cabe7a7dcdf2e1c4b440fc85 Mon Sep 17 00:00:00 2001
From: GWY <guweiyi@prec-tech.com>
Date: 星期一, 30 五月 2022 16:15:26 +0800
Subject: [PATCH] 两个LS特殊条件在说明的增减
---
force-app/main/default/pages/NewHighProductsOpp.page | 169 +++++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 135 insertions(+), 34 deletions(-)
diff --git a/force-app/main/default/pages/NewHighProductsOpp.page b/force-app/main/default/pages/NewHighProductsOpp.page
index a275d18..597f068 100644
--- a/force-app/main/default/pages/NewHighProductsOpp.page
+++ b/force-app/main/default/pages/NewHighProductsOpp.page
@@ -2,35 +2,135 @@
<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
-
+ <apex:includeScript value="{!URLFOR($Resource.CommonUtilJs)}"/>
+ <apex:includeScript value="{!URLFOR($Resource.AWSService, 'AWSService.js') }" />
+ <apex:includeScript value="/soap/ajax/40.0/connection.js"/>
<script>
- function saveJs() {
- blockme();
- saveBtn();
- }
-
- function saveYesJs() {
- blockme();
- saveBtnYes();
- }
-
- function saveNoJs() {
- blockme();
- saveBtnNo();
- }
-
- function cancelJs() {
- var baseUrl = '{!baseUrl}';
- var rtUrl = '{!rtUrl}';
- if (rtUrl == 'null' || rtUrl == '') {
- rtUrl = '{!conId}';
+ aws_result = '';
+ function saveJs() {
+ blockme();
+ if(document.getElementById("page:mainForm:idSearchSetProduct:DealerInfo:ReceiveInfo:dssn:opp_DealerSalesStaffName") || document.getElementById("page:mainForm:idSearchSetProduct:DealerInfo:ReceiveInfo:ds:opp_DealerService")){
+ ProcessPI({},GetObj(),function(){
+ saveBtn();
+ });
+ }else{
+ saveBtn();
+ }
+
}
- window.location.href = baseUrl + "/" + rtUrl;
- }
+
+ function saveYesJs() {
+ blockme();
+ saveBtnYes();
+ }
+
+ function saveNoJs() {
+ blockme();
+ saveBtnNo();
+ }
+
+ function cancelJs() {
+ var baseUrl = '{!baseUrl}';
+ var rtUrl = '{!rtUrl}';
+ if (rtUrl == 'null' || rtUrl == '') {
+ rtUrl = '{!conId}';
+ }
+ window.location.href = baseUrl + "/" + rtUrl;
+ }
+ function GetObj(){
+ return JSON.stringify([{
+ dataId : document.getElementById("Page:mainForm:idSearchSetProduct:DealerInfo:AWS_Data_Id__c").value,
+ dealerSalesStaffName : document.getElementById("page:mainForm:idSearchSetProduct:DealerInfo:ReceiveInfo:dssn:opp_DealerSalesStaffName").value,
+ dealerService : document.getElementById("page:mainForm:idSearchSetProduct:DealerInfo:ReceiveInfo:ds:opp_DealerService").value,
+ }]);
+
+ }
+ function ProcessPI(sobjJson, payloadForNewPI,callback) {
+ console.log('---insert---');
+ AWSService.post(staticResource.newUrl, payloadForNewPI, function(result){
+ aws_result = result
+ SetEditObj();
+ if(callback){
+ callback();
+ }
+ }, staticResource.token);
+ }
+ function SetEditObj(){
+ let obj = GetAWSResultObj();
+ if(obj){
+ document.getElementById("Page:mainForm:idSearchSetProduct:DealerInfo:AWS_Data_Id__c").value = obj.dataId;
+
+ document.getElementById("page:mainForm:idSearchSetProduct:DealerInfo:ReceiveInfo:dssn:opp_DealerSalesStaffName").value = obj.dealerSalesStaffName;
+ document.getElementById("page:mainForm:idSearchSetProduct:DealerInfo:ReceiveInfo:ds:opp_DealerService").value = obj.dealerService;
+
+ document.getElementById("page:mainForm:idSearchSetProduct:DealerInfo:DealerSalesStaffName_Encrypted__c").value = obj.dealerSalesStaffNameEncrypt;
+ document.getElementById("page:mainForm:idSearchSetProduct:DealerInfo:DealerService_Encrypted__c").value = obj.dealerServiceEncrypt;
+ }
+ }
+ function GetAWSResultObj(){
+ if(aws_result && aws_result.object && aws_result.object.length > 0){
+ return aws_result.object[0];
+ }
+ return null;
+ }
+ var oppid = '';
+ function Redirect(){
+ window.location.href = '/'+oppid;
+ }
+ //aws 纭
+ function Trans(){
+ let b = HasError();
+ console.log('---HasError---');
+ console.log(b);
+ console.log('---aws_result---');
+ console.log(aws_result);
+ if(b){
+ //娓呯┖pi
+ document.getElementById('page:mainForm:DealerInfo:ReceiveInfo:dssn:opp_DealerSalesStaffName').value=''
+ document.getElementById('page:mainForm:DealerInfo:ReceiveInfo:ds:opp_DealerService').value=''
+ }
+ AWSService.post(staticResource.transactionUrl, JSON.stringify({
+ "txId":aws_result.txId,
+ "isSuccess":b ? 0 : 1
+ }), function(result){
+ console.log('---result---');
+ console.log(result);
+ console.log('finish');
+ Redirect();
+ //window.location.reload();
+ }, staticResource.token);
+
+ }
+ function HasError(){
+ let e = document.getElementById("page:mainForm:message");
+ console.log(e);
+ if (!e) {
+ return false;
+ }
+ if(j$(e).find(".editListError").length > 0){
+ return true;
+ }
+ let divs = j$(e).find("div.message");
+ for (let i = 0; i < divs.length; i++) {
+ for (let j = 0; j < divs[i].classList.length; j++) {
+ for(let cls of divs[i].classList){
+ if (cls.indexOf('error')>-1) {
+ return true;
+ }
+ }
+
+ }
+
+ }
+ return false;
+ }
</script>
<apex:form id="mainForm">
- <apex:actionFunction action="{!saveBtn}" name="saveBtn" reRender="mainForm,message" oncomplete="unblockUI();"/>
+ <script>
+ oppid = '{!oppid}';
+ </script>
+ <apex:actionFunction action="{!saveBtn}" name="saveBtn" reRender="mainForm,message" oncomplete="unblockUI();Trans();"/>
<apex:actionFunction action="{!saveBtnYes}" name="saveBtnYes" reRender="mainForm,message" oncomplete="unblockUI();"/>
<apex:actionFunction action="{!saveBtnNo}" name="saveBtnNo" reRender="mainForm,message" oncomplete="unblockUI();"/>
@@ -118,27 +218,28 @@
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
- <apex:pageBlockSection title="缁忛攢鍟嗙浉鍏充俊鎭�" columns="2">
+ <apex:pageBlockSection id="DealerInfo" title="缁忛攢鍟嗙浉鍏充俊鎭�" columns="2">
<apex:pageBlockSectionItem >
<apex:outputLabel value="浠g悊鍟嗗悕" for="opp_Dealer"/>
<apex:inputField value="{!opp.Dealer__c}" id="opp_Dealer"/>
</apex:pageBlockSectionItem>
- <apex:pageBlockSectionItem >
- <apex:outputLabel value="浠g悊鍟嗛攢鍞媴褰撹�呭悕" for="opp_DealerSalesStaffName"/>
- <apex:inputField value="{!opp.DealerSalesStaffName__c}" id="opp_DealerSalesStaffName"/>
- </apex:pageBlockSectionItem>
-
-
-
+ <apex:pageBlockSectionItem id="dssn" >
+ <apex:outputLabel value="浠g悊鍟嗛攢鍞媴褰撹�呭悕" for="opp_DealerSalesStaffName"/>
+ <apex:inputField value="{!opp.DealerSalesStaffName__c}" id="opp_DealerSalesStaffName"/><!--pi-->
+ </apex:pageBlockSectionItem>
+
<apex:pageBlockSectionItem >
<apex:outputLabel value="涓棿鍟嗗悕" for="opp_SubDealer"/>
<apex:inputField value="{!opp.SubDealer__c}" id="opp_SubDealer"/>
</apex:pageBlockSectionItem>
- <apex:pageBlockSectionItem >
+ <apex:pageBlockSectionItem id="ds" >
<apex:outputLabel value="浠g悊鍟嗘湇鍔℃媴褰撹�呭悕" for="opp_DealerService"/>
- <apex:inputField value="{!opp.DealerService__c}" id="opp_DealerService"/>
+ <apex:inputField value="{!opp.DealerService__c}" id="opp_DealerService"/><!--pi-->
</apex:pageBlockSectionItem>
+ <apex:inputHidden id="AWS_Data_Id__c" value="{!opp.AWS_Data_Id__c}"/>
+ <apex:inputHidden id="DealerSalesStaffName_Encrypted__c" value="{!opp.DealerSalesStaffName_Encrypted__c}"/>
+ <apex:inputHidden id="DealerService_Encrypted__c" value="{!opp.DealerService_Encrypted__c}"/>
</apex:pageBlockSection>
--
Gitblit v1.9.1