| | |
| | | <apex:stylesheet value="{!URLFOR($Resource.ConsumTrialPageCss)}"/> |
| | | <apex:includeScript value="{!URLFOR($Resource.ReceivingNotePageJS)}"/> |
| | | <apex:includeScript value="{!URLFOR($Resource.CommonUtilJs)}"/> |
| | | <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }"/> |
| | | <apex:form id="allForm"> |
| | | <style> |
| | | table.headTable td { |
| | |
| | | <script type="text/javascript"> |
| | | var heightAjustment = 120; |
| | | var widthAjustment = 30; |
| | | var staticResource = JSON.parse('{!staticResource}'); |
| | | |
| | | // 适用按钮 |
| | | function applyJs() { |
| | |
| | | } |
| | | } |
| | | |
| | | //2022 02 24 张华建 display PI Data start |
| | | var rowBList; |
| | | var TrialUser = {}; |
| | | var ids = []; |
| | | |
| | | queryUser(); |
| | | |
| | | function q1(){ |
| | | var p = new Promise(function(resolve, reject){ |
| | | rowBList = JSON.parse('{!rowListString}') |
| | | var x = 0; |
| | | var y = 0; |
| | | let searchCallBack = function searchCallBack(result){ |
| | | let contacts = result.object; |
| | | if(contacts == null){ |
| | | return; |
| | | } |
| | | let temp = {} |
| | | temp.trialUser = contacts.trialUser; |
| | | TrialUser[contacts.dataId] = temp; |
| | | x++; |
| | | }; |
| | | for(var i=0;i<rowBList.length;i++){ |
| | | if(rowBList[i].AWSDataId ){ |
| | | y++; |
| | | ids.push(rowBList[i].AWSDataId + '_' + rowBList[i].Id); |
| | | AWSService.query(staticResource.queryUrl,rowBList[i].AWSDataId,searchCallBack,staticResource.token); |
| | | } |
| | | } |
| | | var id = setInterval(function(){ |
| | | if(x == y){ |
| | | console.log('success') |
| | | resolve('success'); |
| | | clearInterval(id); |
| | | } |
| | | },500); |
| | | }); |
| | | return p; |
| | | } |
| | | |
| | | function q2(value){ |
| | | var p = new Promise(function(resolve, reject){ |
| | | console.log('进入q2'+value) |
| | | for(var i=0;i<ids.length;i++){ |
| | | console.log('i = '+i); |
| | | document.getElementById(ids[i]).children[0].children[0].innerText = TrialUser[ids[i].substring(0,18)].trialUser; |
| | | console.log('i = '+i); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | function queryUser(){ |
| | | unblockUI() |
| | | rowBList = JSON.parse('{!rowListString}') |
| | | console.log('pageB.fixMode = '+'{!pageB.fixMode}') |
| | | if('{!pageB.fixMode}' == 'true'){ |
| | | q1().then(function(data){ |
| | | return q2(data); |
| | | }) |
| | | unblockUI(); |
| | | }else{ |
| | | blockme(); |
| | | console.log(rowBList) |
| | | let searchCallBack = function searchCallBack(result){ |
| | | let contacts = result.object; |
| | | if(contacts == null){ |
| | | return; |
| | | } |
| | | let temp = {} |
| | | temp.trialUser = contacts.trialUser; |
| | | TrialUser[contacts.dataId] = temp; |
| | | }; |
| | | for(var i=0;i<rowBList.length;i++){ |
| | | ids.push(rowBList[i].AWSDataId + '_' + rowBList[i].Id); |
| | | AWSService.query(staticResource.queryUrl,rowBList[i].AWSDataId,searchCallBack,staticResource.token); |
| | | } |
| | | unblockUI(); |
| | | } |
| | | } |
| | | |
| | | function showPIDiv(awsDataId){ |
| | | if(awsDataId.length == 0){ |
| | | return |
| | | } |
| | | if(TrialUser[awsDataId.substring(0,18)] == null){ |
| | | return |
| | | } |
| | | console.log('awsDataId Value:'+awsDataId); |
| | | let parentNode = document.getElementById(awsDataId); |
| | | let createDiv = document.createElement("div"); |
| | | createDiv.id = awsDataId+"_PI"; |
| | | let piInformation = TrialUser[awsDataId.substring(0,18)].trialUser |
| | | //let piInformation = 'Name:'+contact['943114607025717249'].lastName +'\n' +'Phone:'+contact['943114607025717249'].phone |
| | | createDiv.innerText = piInformation; |
| | | let x=window.event.x; |
| | | let y=window.event.y; |
| | | createDiv.style.left=x; |
| | | createDiv.style.top=y; |
| | | createDiv.style.background="#dddddd"; |
| | | createDiv.style.position = "absolute"; |
| | | parentNode.appendChild(createDiv); |
| | | parentNode.style.position = "relative"; |
| | | } |
| | | |
| | | function hidePIDiv(awsDataId){ |
| | | if(awsDataId.length == 0){ |
| | | return |
| | | } |
| | | if(TrialUser[awsDataId.substring(0,18)] == null){ |
| | | return |
| | | } |
| | | document.getElementById(awsDataId+'_PI').remove(); |
| | | } |
| | | |
| | | function q3(){ |
| | | var p = new Promise(function(resolve, reject){ |
| | | console.log('saveRecordJS') |
| | | |
| | | var a = 0; |
| | | var b = 0; |
| | | let newCallBack = function newCallBack(result,indexNumber){ |
| | | |
| | | console.log('result = '+JSON.stringify(result)) |
| | | //赋值dataId和trialUser |
| | | document.getElementById('allPage:allForm:dataBlock:dataline_R_aws:'+indexNumber+':EditAWSDataId').value = result.object[0].dataId; |
| | | document.getElementById('allPage:allForm:dataBlock:dataline_R:'+indexNumber+':inputField:6:inputField').value = result.object[0].trialUser; |
| | | let transParameters = { |
| | | txId: result.txId, |
| | | isSuccess: 1 |
| | | }; |
| | | let confirmCallBack = function confirmCallBack(result){ |
| | | console.log('confirmCallBack = '+JSON.stringify(result)) |
| | | } |
| | | b++; |
| | | AWSService.confirmTrans(staticResource.transactionUrl,JSON.stringify(transParameters),confirmCallBack,staticResource.token) |
| | | }; |
| | | for(var i=0;i<rowBList.length;i++){ |
| | | if(document.getElementById('allPage:allForm:dataBlock:dataline_L:'+i+':rowCheck').checked == true){ |
| | | a++; |
| | | } |
| | | } |
| | | debugger |
| | | for(var i=0;i<rowBList.length;i++){ |
| | | if(document.getElementById('allPage:allForm:dataBlock:dataline_L:'+i+':rowCheck').checked == true){ |
| | | //加密试用者 |
| | | var trialUser = document.getElementById('allPage:allForm:dataBlock:dataline_R:'+i+':inputField:6:j_id86').children[0].children[0].value |
| | | let consumApplyPayloadList = []; |
| | | let consumApplyPIData = new Object(); |
| | | consumApplyPIData.trialUser = trialUser; |
| | | consumApplyPIData.sfRecordId = ''; |
| | | consumApplyPayloadList.push(consumApplyPIData); |
| | | AWSService.postConsumTrial(staticResource.newUrl,i,JSON.stringify(consumApplyPayloadList),newCallBack,staticResource.token); |
| | | } |
| | | } |
| | | var id = setInterval(function(){ |
| | | if(a == b){ |
| | | console.log('a==b success') |
| | | resolve('success'); |
| | | clearInterval(id); |
| | | } |
| | | },500); |
| | | }); |
| | | return p; |
| | | } |
| | | |
| | | function q4(){ |
| | | debugger |
| | | saveRecord(); |
| | | } |
| | | function saveRecordJS(){ |
| | | if('{!pageB.fixMode}' != 'true'){ |
| | | return |
| | | } |
| | | // q3().then(function(data){ |
| | | // return q4(data); |
| | | // }) |
| | | saveRecord(); |
| | | unblockUI(); |
| | | } |
| | | //2022 02 24 张华建 display PI Data end |
| | | |
| | | </script> |
| | | <apex:pageMessages /> |
| | | <apex:actionFunction name="saveRecord" action="{!saveRecord}" oncomplete="unblockUI();refopener();" rerender="allForm"/> |
| | |
| | | <apex:commandButton value="适用" rendered="{!canEdit}" onclick="applyJs();return false;"/> |
| | | </span> |
| | | <span style="margin-left: 10px;"> |
| | | <apex:commandButton value="保存" onclick="blockme(); saveRecord(); return false;" rendered="{!canEdit}" reRender="allForm"/> |
| | | <apex:commandButton value="保存" onclick="blockme(); saveRecordJS(); return false;" rendered="{!canEdit}" reRender="allForm"/> |
| | | </span> |
| | | </td> |
| | | </tr> |
| | |
| | | </apex:repeat> |
| | | </table> |
| | | </div> |
| | | <apex:repeat id="dataline_R_aws" value="{!pageB.rowBList}" var="var"> |
| | | <apex:inputHidden value="{!var.rnd.AWS_Data_Id__c}" id="EditAWSDataId"/> |
| | | </apex:repeat> |
| | | <div id="in_Div" style="overflow:auto;"> |
| | | <table class="list" style="border-bottom-width: 0px; font-size:11px; border-spacing:0;" border="" id="tableData"> |
| | | <apex:variable value="{!0}" var="Cnt_R" /> |
| | |
| | | <tr id="tableData_R_{!Cnt_R}" class="dataRow" onmouseover="if (window.hiOn){hiOn(this);} " onmouseout="if (window.hiOff){hiOff(this);} " onblur="if (window.hiOff){hiOff(this);}" onfocus="if (window.hiOn){hiOn(this);}" > |
| | | <apex:variable value="{!0}" var="Col_R" /> |
| | | <apex:repeat value="{!inputFieldList}" var="info" id="inputField" > |
| | | <td class="dataCellBorder1 intf {!info.value} col_{!info.value}" style="{!IF(info.value=='RAESD_Status__c' && var.rnd[info.value]=='申请者收货NG','background-color: #009DDC','')}"> |
| | | <td class="dataCellBorder1 intf {!info.value} col_{!info.value}" style="{!IF(info.value=='RAESD_Status__c' && var.rnd[info.value]=='申请者收货NG','background-color: #009DDC','')}" id="{! IF(info.value=='Trial_User__c',var.rnd.AWS_Data_Id__c+'_'+var.rnd.Id,info.value)}" onmouseover="showPIDiv('{! IF(info.value=='Trial_User__c',var.rnd.AWS_Data_Id__c+'_'+var.rnd.Id,'')}')" onmouseout="hidePIDiv('{! IF(info.value=='Trial_User__c',var.rnd.AWS_Data_Id__c+'_'+var.rnd.Id,'')}')"> |
| | | |
| | | <apex:outputPanel rendered="{!((contains(var.canChangeField, info.value) || var.canChangeField == '') && pageB.fixMode == true && var.canChange == true)}"> |
| | | <apex:inputField id="inputField" value="{!var.rnd[info.value]}" onchange="setChangeFlg('{!var.lineNo-1}');changeEditable('{!var.lineNo-1}');" rendered="{!info.value != 'Asset_loaner_category__c' || var.haveAsset}" /> |
| | | |