From cdff37596ef14a95a3e557b0d978f50140410308 Mon Sep 17 00:00:00 2001
From: 涂煌豪 <tuhuanghao@prec-tech.com>
Date: 星期二, 10 五月 2022 16:17:59 +0800
Subject: [PATCH] 【委托】URF限次修理合同的最高价格修改

---
 force-app/main/default/pages/StartTrading.page |  231 ++++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 162 insertions(+), 69 deletions(-)

diff --git a/force-app/main/default/pages/StartTrading.page b/force-app/main/default/pages/StartTrading.page
index c9806e8..c6f125c 100644
--- a/force-app/main/default/pages/StartTrading.page
+++ b/force-app/main/default/pages/StartTrading.page
@@ -1,72 +1,165 @@
 <apex:page id="Page" standardController="Lead" extensions="StartTradingController" sidebar="false" action="{!init}">
-	<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
-    <script type="text/javascript">
-		function requiredCheck(){
-			var val = document.getElementById('Page:mainForm:idDayEdit:idDep').selectedIndex;
-			if (val == 0) {
-				//銆岃ê鐧傜鍚嶃倰閬告姙銇椼仸銇忋仩銇曘亜銆傘��
-				alert('{!$Label.StartTrading_Alert}');
-			}
+	<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}" />
+	<apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" />
+	<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}" />
+	<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}" />
+	<script src="../../soap/ajax/53.0/connection.js" type="text/javascript"></script>
+
+	<script type="text/javascript">
+		var staticResources = JSON.parse('{!staticResource}');
+		var selectedIndexContact = 0;
+		function setSelectedIndex(){
+			var myselect=document.getElementById("Page:mainForm:idDayEdit:idCon")
+			selectedIndexContact=myselect.selectedIndex
 		}
-    </script>
-    <style>
-    </style>
-    <!-- 銉兗銉� 鍙栧紩銇枊濮� -->
-    <apex:sectionHeader title="{!$ObjectType.Lead.Label}" subtitle="{!$Label.StartTrading_Subtitle}"/>
-	    <apex:form id="mainForm">
-	        <apex:pageMessages />
-	        <apex:pageBlock id="idDayEdit" title="" mode="edit" >
-		        <apex:pageBlockButtons >
-		        	<!-- 鍙栧紩銇枊濮� -->
-		            <apex:commandButton action="{!start}" value="{!$Label.StartTrading_Subtitle}" onclick="requiredCheck();" />
-		            <!-- 銈儯銉炽偦銉� -->
-		            <apex:commandButton action="{!cancel}" value="{!$Label.StartTrading_Cancel}"/>
-		        </apex:pageBlockButtons>
-		        <div class="pbSubheader first tertiaryPalette">
-                    <span class="pbSubExtra"><span class="requiredLegend"><span class="requiredExampleOuter"><span class="requiredExample">&nbsp;</span></span><span class="requiredText"> = 蹇呭~淇℃伅</span></span></span><!-- 蹇呴爤鎯呭牨 -->
-                    <!-- 鍩烘湰鎯呭牨 -->
-                    <h3>{!$Label.Basic_Information}</h3>
-                </div>
-                <table>
-                	<tr>
-                		<td width="100px"></td>
-                		<!-- 瑷虹檪绉戝悕 -->
-                		<td>{!$Label.Department_Name}</td>
-                		<td>
-                			<apex:selectList value="{!sltDep}" multiselect="false" size="1" id="idDep" style="width:400px;" >
-			                	<apex:selectOptions value="{!depList}" ></apex:selectOptions>
-				                <apex:actionSupport event="onchange" onsubmit="" onbeforedomupdate="" action="{!depChange}" rerender="idCon">
-				                    <apex:param name="sltD" value="{!sltDep}"/>
-				                </apex:actionSupport>
-				            </apex:selectList>
-		                </td>
-	                </tr>
-	                <tr>
-	                	<td width="100px"></td>
-	                	<!-- 鎷呭綋鑰� -->
-	                	<td>{!$ObjectType.Contact.Label}</td>
-	                	<td><apex:selectList value="{!sltCon}" multiselect="false" size="1" id="idCon" style="width:200px;">
-				                	<apex:selectOptions value="{!conList}" />
-				                </apex:selectList>
-				        </td>
-	                </tr>
-	                <tr>
-	                	<td width="100px"></td>
-	                	<td>
-	                	{!$ObjectType.lead.fields.SI_OppoLeadSec__c.label}
-	                	</td>
-	                	<td>
-	                		<apex:inputField value="{!lead.SI_OppoLeadSec__c}"/>
-	                	</td>
-	                </tr>
-	                 <tr>
-	                	<td width="100px"></td>
-	                	<!-- 鏄惁SI鏈儴鍏卞悓鎺ㄨ繘璇环 -->
-	                	<td>鏄惁SI鏈儴鍏卞悓鎺ㄨ繘璇环</td>
-	                	<td><apex:inputCheckbox value="{!SI_Flg}" id="SI_Flg" />
-				        </td>
-	                </tr>
-	            </table>
-	        </apex:pageBlock>
-	    </apex:form>
+		function preparePayloadForSearchContact() {
+			// 2022-04-13 ssm 绱ф�ュ簲瀵� 绉戝鍜屽鎴蜂汉鍛樺繀濉� start
+			// let accountId = document.getElementById('Page:mainForm:idDayEdit:idDep').value;
+			// if (accountId != '--鏃�--') {
+			// 	blockme();
+			// 	console.log('accountId:' + accountId);
+			// 	//query contact
+			// 	sforce.connection.sessionId = '{!GETSESSIONID()}';
+			// 	let result = sforce.connection.query("SELECT Id,Name,AWS_Data_Id__c from Contact where AccountId='" + accountId + "'");//sfid,awsdataId
+			// 	let dataIds = [];
+			// 	let records = result.getArray("records");
+			// 	for (let i = 0; i < records.length; i++) {
+			// 		dataIds.push(records[i].AWS_Data_Id__c)
+			// 	}
+			// 	let searchPayload = new Object();
+			// 	searchPayload.dataIds = dataIds;
+			// 	searchPayload.contactName = '';
+			// 	AWSService.search(staticResources.searchUrl, JSON.stringify(searchPayload), queryBack, staticResources.token);
+			// }
+			let contactId = document.getElementById('Page:mainForm:idDayEdit:idCon').value;
+			if (contactId != undefined) {
+				blockme();
+				console.log('contactId:' + contactId);
+				//query contact
+				sforce.connection.sessionId = '{!GETSESSIONID()}';
+				let result = sforce.connection.query("SELECT Id,Name,AWS_Data_Id__c from Contact where Id='" + contactId + "'");//sfid,awsdataId
+				let dataIds = [];
+				let records = result.getArray("records");
+				for (let i = 0; i < records.length; i++) {
+					dataIds.push(records[i].AWS_Data_Id__c)
+				}
+				let searchPayload = new Object();
+				searchPayload.dataIds = dataIds;
+				searchPayload.contactName = '';
+				AWSService.search(staticResources.searchUrl, JSON.stringify(searchPayload), queryBack, staticResources.token);
+			}
+			// 2022-04-13 ssm 绱ф�ュ簲瀵� 绉戝鍜屽鎴蜂汉鍛樺繀濉� end
+		}
+
+		var queryBack = function queryBack(result) {
+			// 2022-04-13 ssm 绱ф�ュ簲瀵� 绉戝鍜屽鎴蜂汉鍛樺繀濉� start
+			let select = document.getElementById('Page:mainForm:idDayEdit:idCon');
+			//娓呴櫎select閲岄潰鐨勫��
+			for (var i = select.childNodes.length - 1; i >= 1; i--) {
+				select.removeChild(select.childNodes[i]);
+			}
+			// if (select.options[0] == undefined) {
+			// 	let blankValue = new Option();
+			// 	blankValue.value = '--鏃�--';
+			// 	blankValue.text = '--鏃�--';
+			// 	select.options.add(blankValue);
+			// }
+			for (var i = 0; i < result.object.length; i++) {
+				if (result.object[i].sfRecordId) {
+					let a = new Option();
+					a.value = result.object[i].sfRecordId;
+					a.text = result.object[i].lastName.replace(/"/g, "");
+					select.options.add(a);
+				}
+			}
+			if(selectedIndexContact !=0 ){
+				var myselect=document.getElementById("Page:mainForm:idDayEdit:idCon").options
+				myselect[selectedIndexContact].selected = true;
+			}
+			// 2022-04-13 ssm 绱ф�ュ簲瀵� 绉戝鍜屽鎴蜂汉鍛樺繀濉� end
+			unblockUI();
+		}
+		//2021/02/21 寮犲崕寤� 鏌ユ壘瀹㈡埛浜哄憳 end
+
+		function requiredCheck() {
+			// 2022-04-13 ssm 绱ф�ュ簲瀵� 绉戝鍜屽鎴蜂汉鍛樺繀濉� start
+			// var val = document.getElementById('Page:mainForm:idDayEdit:idDep').selectedIndex;
+			// if (val == 0) {
+			// 	//銆岃ê鐧傜鍚嶃倰閬告姙銇椼仸銇忋仩銇曘亜銆傘��
+			// 	alert('{!$Label.StartTrading_Alert}');
+			// }
+			// 2022-04-13 ssm 绱ф�ュ簲瀵� 绉戝鍜屽鎴蜂汉鍛樺繀濉� end
+		}
+	</script>
+	<style>
+	</style>
+	<!-- 銉兗銉� 鍙栧紩銇枊濮� -->
+	<apex:sectionHeader title="{!$ObjectType.Lead.Label}" subtitle="{!$Label.StartTrading_Subtitle}"/>
+	<apex:form id="mainForm">
+		<apex:pageMessages id="errorMsg" />
+		<apex:pageBlock id="idDayEdit" title="" mode="edit" >
+			<apex:pageBlockButtons >
+				<!-- 鍙栧紩銇枊濮� -->
+				<apex:commandButton action="{!start}" value="{!$Label.StartTrading_Subtitle}" onclick="requiredCheck();" reRender="mainForm"/>
+				<!-- 銈儯銉炽偦銉� -->
+				<apex:commandButton action="{!cancel}" value="{!$Label.StartTrading_Cancel}"/>
+			</apex:pageBlockButtons>
+			<div class="pbSubheader first tertiaryPalette">
+				<span class="pbSubExtra"><span class="requiredLegend"><span class="requiredExampleOuter"><span class="requiredExample">&nbsp;</span></span><span class="requiredText"> = 蹇呭~淇℃伅</span></span></span><!-- 蹇呴爤鎯呭牨 -->
+				<!-- 鍩烘湰鎯呭牨 -->
+				<h3>{!$Label.Basic_Information}</h3>
+			</div>
+			<table>
+				<tr>
+					<td width="100px"></td>
+					<!-- 瑷虹檪绉戝悕 -->
+					<td>{!$Label.Department_Name}</td>
+					<td>
+						<apex:selectList value="{!sltDep}" multiselect="false" size="1" id="idDep" style="width:400px;" >
+							<apex:selectOptions value="{!depList}" ></apex:selectOptions>
+							<!-- 2022-04-13 ssm 绱ф�ュ簲瀵� 绉戝鍜屽鎴蜂汉鍛樺繀濉� start -->
+							<!-- <apex:actionSupport event="onchange" onsubmit="" onbeforedomupdate="" action="{!depChange}" rerender="idCon" oncomplete="preparePayloadForSearchContact()">
+								<apex:param name="sltD" value="{!sltDep}" />
+							</apex:actionSupport> -->
+							<!-- 2022-04-13 ssm 绱ф�ュ簲瀵� 绉戝鍜屽鎴蜂汉鍛樺繀濉� end -->
+						</apex:selectList>
+					</td>
+				</tr>
+				<tr>
+					<td width="100px"></td>
+					<!-- 鎷呭綋鑰� -->
+					<td>{!$ObjectType.Contact.Label}</td>
+					<td>
+						<!-- 2022-04-13 ssm 绱ф�ュ簲瀵� 绉戝鍜屽鎴蜂汉鍛樺繀濉� start -->
+						<!-- <apex:selectList value="{!sltCon}" onchange="setSelectedIndex()" multiselect="false" size="1" id="idCon" style="width:200px;"> -->
+						<!-- 2022-04-13 ssm 绱ф�ュ簲瀵� 绉戝鍜屽鎴蜂汉鍛樺繀濉� end -->
+						<apex:selectList value="{!sltCon}" multiselect="false" size="1" id="idCon" style="width:200px;">
+							<apex:selectOptions value="{!conList}" />
+						</apex:selectList>
+						<script>
+							sfdcPage.appendToOnloadQueue(function () {
+								preparePayloadForSearchContact();
+							});
+						</script>
+					</td>
+				</tr>
+				<tr>
+					<td width="100px"></td>
+					<td>
+						{!$ObjectType.lead.fields.SI_OppoLeadSec__c.label}
+					</td>
+					<td>
+						<apex:inputField value="{!lead.SI_OppoLeadSec__c}" />
+					</td>
+				</tr>
+				<tr>
+					<td width="100px"></td>
+					<!-- 鏄惁SI鏈儴鍏卞悓鎺ㄨ繘璇环 -->
+					<td>鏄惁SI鏈儴鍏卞悓鎺ㄨ繘璇环</td>
+					<td><apex:inputCheckbox value="{!SI_Flg}" id="SI_Flg" />
+					</td>
+				</tr>
+			</table>
+		</apex:pageBlock>
+	</apex:form>
 </apex:page>
\ No newline at end of file

--
Gitblit v1.9.1