彭锟
2022-04-24 b3dc8e8ce0a120b4f484ef787abd21832c40ec63
force-app/main/default/pages/StartTrading.page
@@ -13,13 +13,31 @@
         selectedIndexContact=myselect.selectedIndex
      }
      function preparePayloadForSearchContact() {
         let accountId = document.getElementById('Page:mainForm:idDayEdit:idDep').value;
         if (accountId != '--无--') {
         // 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('accountId:' + accountId);
            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 AccountId='" + accountId + "'");//sfid,awsdataId
            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++) {
@@ -30,20 +48,22 @@
            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);
         }
         // 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();
@@ -56,16 +76,19 @@
            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() {
         var val = document.getElementById('Page:mainForm:idDayEdit:idDep').selectedIndex;
         if (val == 0) {
            //「診療科名を選択してください。」
            alert('{!$Label.StartTrading_Alert}');
         }
         // 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>
@@ -94,9 +117,11 @@
               <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" oncomplete="preparePayloadForSearchContact()">
                     <!-- 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>
                     </apex:actionSupport> -->
                     <!-- 2022-04-13 ssm 紧急应对 科室和客户人员必填 end -->
                  </apex:selectList>
               </td>
            </tr>
@@ -105,7 +130,10 @@
               <!-- 担当者 -->
               <td>{!$ObjectType.Contact.Label}</td>
               <td>
                  <apex:selectList value="{!sltCon}" onchange="setSelectedIndex()" multiselect="false" size="1" id="idCon" style="width:200px;">
                  <!-- 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>