buli
2022-04-06 2d4a8d2dcad5a17127d2c73c48ddc4b67ec79448
force-app/main/default/pages/BMEWorkPage.page
@@ -5,6 +5,12 @@
<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
<apex:includeScript value="{!URLFOR($Resource.BmeWorkJs)}"/>
<!-- 20220222 PI改造 by Bright--start -->
<apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" />
<script src="../../soap/ajax/53.0/connection.js" type="text/javascript"></script>
<!-- 20220222 PI改造 by Bright--end -->
<style>
    td .dateFormat  {
        display: none;
@@ -83,6 +89,11 @@
}
body .pbBody table.list tr.headerRow td.col_Scroll {width:0px; padding:0px; border-width:0px;}
body .pbBody table.list tr.dataRow td.col_Scroll {width:0px; padding:0px; border-width:0px;}
.decrypt{position: absolute;top: 0;left: 100%;display: none;text-align: left;
    padding-left: 5px;}
a:hover .decrypt{display: block;width: 100px}
</style>
<script type="text/javascript">
var heightAjustment = 120;
@@ -96,14 +107,14 @@
</script>
</head>
    <apex:form id="allForm">
        <apex:actionFunction name="saveAndSearch" action="{!save}" rerender="allPanel" oncomplete="unblockUI();">
        <apex:actionFunction name="saveAndSearch" action="{!save}" rerender="allPanel" oncomplete="afterSaveAndSearch();">
             <apex:param name="firstParam" assignTo="{!saveType}" value="" />
        </apex:actionFunction>
         <apex:actionFunction name="saveAndSort" action="{!save}" rerender="allPanel" oncomplete="unblockUI();">
            <apex:param name="firstParam" assignTo="{!saveType}" value="" />
            <apex:param name="secondParam" assignTo="{!sortKey}" value="" />
        </apex:actionFunction>
        <apex:actionFunction name="searchOpp" action="{!chick}" rerender="allPanel" oncomplete="unblockUI();"/>
        <apex:actionFunction name="searchOpp" action="{!chick}" rerender="allPanel" oncomplete="afterSearchOpp();"/>
        <apex:actionFunction name="sortTable" action="{!sortTable}" rerender="allPanel" oncomplete="unblockUI();">
            <apex:param name="firstParam" assignTo="{!sortKey}" value="" />
        </apex:actionFunction>
@@ -113,7 +124,7 @@
                    <tr>
                        <td width="150px">
                            <apex:commandButton onclick="blockme()" oncomplete="unblockUI();" action="{!save}" value="保存"  style="height:30px;width:50px;"/>&nbsp;&nbsp;
                            <apex:commandButton value="检索" onclick="searchOppJs_Account_copy();return false;" style="height:30px;width:70px;"/>
                            <apex:commandButton value="检索" onclick="NewSearch();return false;" style="height:30px;width:70px;"/>
                        </td>
                        <td width="1000px">
                            <apex:pageMessages />
@@ -149,10 +160,11 @@
                            <apex:selectList value="{!numtextC1}" size="1" style="width:110px"><apex:selectOptions value="{!textOpts02}"/></apex:selectList>
                        </td>
                        <td width="130px">  
                            <apex:selectList value="{!numtextC2}" size="1" style="width:110px"><apex:selectOptions value="{!equalOpts}"/></apex:selectList>
                            <apex:selectList value="{!numtextC2}" size="1" style="width:110px"><apex:selectOptions value="{!equalOpts2}"/></apex:selectList>
                        </td>
                         <td width="200px">
                          <apex:inputText style="width:150px" value="{!numtextC}"/>
                          <apex:inputHidden id="AwsDataIds" value="{!AwsDataIds}"/>
                          <apex:inputText id="numtextC" style="width:150px" value="{!numtextC}"/>
                        </td>
                        <td width="200px">
                            <font>数&nbsp;据&nbsp;字&nbsp;段&nbsp;</font>&nbsp;
@@ -165,7 +177,7 @@
                          <apex:inputText style="width:150px" value="{!numtextD}"/>
                        </td>
                        <td width="230px">显示&nbsp;
                          <apex:selectList value="{!limits}" size="1" onchange="searchOppJs_Account_copy();return false;">
                          <apex:selectList value="{!limits}" size="1" onchange="NewSearch();return false;">
                          <apex:selectOptions value="{!limitOpts}"/></apex:selectList> 条数据
                        </td>
                    </tr>
@@ -245,8 +257,10 @@
                                    <apex:outputField value="{!or.con.CampaignOwnerName__c}" />
                                    </apex:outputLink>
                                  </td>
                                  <td align="center">
                                    <apex:outputField value="{!or.Agcmmc.Contact__c}"/>
                                  <td align="center" >
                                    <a style="position: relative" href="/{!or.con.Id}" aws-data-id="{!or.con.AWS_Data_Id__c}" title=""><span>{!or.con.MedicalStaff_Full_name__c}</span><span class="decrypt"></span></a>
                                  </td>
                                  <td>
                                    <apex:outputField value="{!or.con.Accountid}"/>
@@ -304,45 +318,131 @@
                    </div>
                </apex:outputPanel>
            </apex:pageBlock>
<script type="text/javascript">
j$(function() {
    var tableWidth = 0;
    j$('body .pbBody table#tableHeader tr.headerRow td').each(function() {
        var colClass = getColClassName(this);
        if (colClass != 'col_Scroll') {
            var headerCol = j$('body .pbBody table.list tr.headerRow td.' + colClass);
            tableWidth += headerCol.width();
        }
    });
    j$('table#tableData').css('width', (tableWidth + 2) + 'px');
    j$('table#tableHeader').css('width', (tableWidth + 2) + 'px');
    // list の headerRow の tdに toggleWidth() を追加
    bindTdToggleWidth();
});
var elements = document.getElementsByTagName("select");
for (i = 0; i < elements.length; i++) {
    var id = elements[i].id;
    if (id.length > 5 && id.substring(id.length - 5, id.length) == 'mlktp') {
        elements[i].style.display = "none";
    }
}
var tbl_l = document.getElementById("tableData_L");
var input_l = tbl_l.getElementsByTagName("input");
for (i = 0; i < input_l.length; i++) {
    var id = input_l[i].id + '_lkid';
    if (document.getElementById(id) != null) {
        input_l[i].style.width = "75%";
    }
}
var tbl = document.getElementById("tableData");
var input = tbl.getElementsByTagName("input");
for (i = 0; i < input.length; i++) {
    var id = input[i].id + '_lkid';
    if (document.getElementById(id) != null) {
        input[i].style.width = "75%";
    }
}
</script>
            <script type="text/javascript">
              j$(function() {
                  var tableWidth = 0;
                  j$('body .pbBody table#tableHeader tr.headerRow td').each(function() {
                      var colClass = getColClassName(this);
                      if (colClass != 'col_Scroll') {
                          var headerCol = j$('body .pbBody table.list tr.headerRow td.' + colClass);
                          tableWidth += headerCol.width();
                      }
                  });
                  j$('table#tableData').css('width', (tableWidth + 2) + 'px');
                  j$('table#tableHeader').css('width', (tableWidth + 2) + 'px');
                  // list の headerRow の tdに toggleWidth() を追加
                  bindTdToggleWidth();
              });
              var elements = document.getElementsByTagName("select");
              for (i = 0; i < elements.length; i++) {
                  var id = elements[i].id;
                  if (id.length > 5 && id.substring(id.length - 5, id.length) == 'mlktp') {
                      elements[i].style.display = "none";
                  }
              }
              var tbl_l = document.getElementById("tableData_L");
              var input_l = tbl_l.getElementsByTagName("input");
              for (i = 0; i < input_l.length; i++) {
                  var id = input_l[i].id + '_lkid';
                  if (document.getElementById(id) != null) {
                      input_l[i].style.width = "75%";
                  }
              }
              var tbl = document.getElementById("tableData");
              var input = tbl.getElementsByTagName("input");
              for (i = 0; i < input.length; i++) {
                  var id = input[i].id + '_lkid';
                  if (document.getElementById(id) != null) {
                      input[i].style.width = "75%";
                  }
              }
              AWSService.sfSessionId = '{!GETSESSIONID()}';
              var staticResource = JSON.parse('{!staticResource}');
              document.body.onload = function(){
                NewSearch();
              }
              var awsdata_map={};
              function NewSearch(){
                // 如果有填写姓名,先去aws查询,再用awsdataid查询后台,如果没有填写直接查询后台
                awsdata_map={};
                let e = document.getElementById("allPage:allForm:searchBlock:numtextC");
                if(e && e.value){
                  blockme();
                  AWSService.search(staticResource.searchUrl,JSON.stringify({
                    "contactName":e.value
                  }),function(data){
                    unblockUI();
                    if(data.object && data.object.length > 0){
                      let aws_data_ids = [];
                      for(let d of data.object){
                        if(d.dataId){
                          awsdata_map[d.dataId] = d;
                          aws_data_ids.push(d.dataId);
                        }
                      }
                      document.getElementById("allPage:allForm:searchBlock:AwsDataIds").value = aws_data_ids.join(";");
                    }else{
                      document.getElementById("allPage:allForm:searchBlock:AwsDataIds").value = new Date().getTime();
                    }
                    searchOppJs_Account_copy();
                  },staticResource.token);
                }else{
                  searchOppJs_Account_copy();
                }
              }
              function afterSearchOpp(){
                DecryptContactName(()=>unblockUI());
              }
              function afterSaveAndSearch(){
                DecryptContactName(()=>unblockUI());
              }
              function DecryptContactName(callback){
                let no_in_ids = [];
                j$("[aws-data-id]").each(function(i,e){
                  let id = e.getAttribute("aws-data-id");
                  if(!(id && awsdata_map.hasOwnProperty(id))){
                    no_in_ids.push(id);
                  }
                });
                if(no_in_ids.length>0){
                  AWSService.search(staticResource.searchUrl,JSON.stringify({
                    "dataIds":no_in_ids
                  }),function(data){
                    if(data.object && data.object.length > 0){
                      for(let d of data.object){
                        if(d.dataId){
                          awsdata_map[d.dataId] = d;
                        }
                      }
                    }
                    BindToTile();
                    if(callback)callback();
                  },staticResource.token);
                }
                else{
                  BindToTile();
                  if(callback)callback();
                }
              }
              function BindToTile(){
                j$("[aws-data-id]").each(function(i,e){
                  let id = e.getAttribute("aws-data-id");
                  if(id && awsdata_map.hasOwnProperty(id) && awsdata_map[id].medicalStaffFullName){
                    j$(e).find(".decrypt").html(awsdata_map[id].medicalStaffFullName);
                  }
                });
              }
            </script>
        </apex:outputPanel>
    </apex:form>
</apex:page>