From 559771a80cf779dc13a84ecd2f178e6ca5a8353a Mon Sep 17 00:00:00 2001 From: FUYU <fuyu@prec-tech.com> Date: 星期五, 19 五月 2023 15:52:16 +0800 Subject: [PATCH] 备份省目标录入 --- force-app/main/default/pages/OFSInsReportLayout.page | 176 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 167 insertions(+), 9 deletions(-) diff --git a/force-app/main/default/pages/OFSInsReportLayout.page b/force-app/main/default/pages/OFSInsReportLayout.page index ba81af1..c1826ae 100644 --- a/force-app/main/default/pages/OFSInsReportLayout.page +++ b/force-app/main/default/pages/OFSInsReportLayout.page @@ -1,4 +1,4 @@ -<apex:page id="Page" showHeader="false" sidebar="false" controller="OFSInsReportLayoutController" applyBodyTag="false" applyHtmlTag="false" action="{!init}"> +<apex:page id="Page" showHeader="false" sidebar="false" controller="OFSInsReportLayoutController" applyBodyTag="false" applyHtmlTag="false" action="{!init}" lightningStylesheets="true"> <!-- <apex:page id="Page" showHeader="false" sidebar="false" standardcontroller="Inspection_Item__c" extensions="OFSInsReportLayoutController" applyBodyTag="false" applyHtmlTag="false" action="{!init}"> --> <html> <head> @@ -8,6 +8,7 @@ <apex:includeScript value="{!URLFOR($Resource.connection20)}"/> <apex:includeScript value="{!URLFOR($Resource.apex20)}"/> <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/> + <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" /> <style type="text/css"> table#AssetTable select { width: 98%; @@ -80,6 +81,11 @@ sortTablefunc(key); } + function exchangeAssetJs() { + blockme(); + exchangeAssetfunc(); + } + function saveByRepairJs(aid, an, ahid, ahn, adid, adn, aaid, aan, rstr) { tmpaid = aid; tmpan = an; @@ -127,6 +133,142 @@ } //add by rentx 20210809 鍏ㄩ�夊姛鑳� end + + +AWSService.sfSessionId = '{!GETSESSIONID()}'; +var staticResource = JSON.parse('{!staticResource}'); +var aws_data = {}; +var txid = null; +function Encrypt(callback){ + blockme(); + //callback();return; + //<input type="hidden" value="{!ir.Id}" id="IrId"/> + let e_id = document.getElementById("IrId"); + let url = staticResource.newUrl; + + aws_data = { + "phone":j$("[field-api='phone__c']").val(), + "responsiblePerson":j$("[field-api='Responsible_Person__c']").val(), + }; + + if(e_id && e_id.value){ + url = staticResource.updateUrl; + aws_data.dataId = document.getElementById("Page:Form:Block:AWS_Data_Id__c").value; + } + + + + AWSService.post(url, JSON.stringify([aws_data]), function(data){ + + if (!(data && data.object && data.object.length)) { + console.log('AWSService.post failed'); + return; + } + let aws_data1 = data.object[0]; + txid = data.txId; + + document.getElementById("Page:Form:Block:AWS_Data_Id__c").value = aws_data1.dataId; + j$("[field-api='phone__c']").val(aws_data1.phone); + j$("[field-api='Responsible_Person__c']").val(aws_data1.responsiblePerson); + + if (callback) { + callback(); + } + }, staticResource.token); +} + +function saveBtnJs(){ + Encrypt(saveBtn); +} +function submitJs(){ + Encrypt(submit); +} +function showPDFJs(){ + Encrypt(showPDF); +} + +function afterSaveBtnJs(){ + Trans(); +} + +function afterSubmitJs(){ + Trans(); +} + +function afterShowPDFJs(){ + Trans(function(){ + if (!HasError()) { + window.location.href = '/apex/InsReportPDFOuter?id=' + document.getElementById("IrId").value; + } + + }); +} + +function HasError(){ + + // if (IsAddmessage) { + // return true; + // } + let e = document.getElementById("Page:Form:MessageP"); + if (!e) { + return false; + } + + 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 clsi in divs[i].classList){let cls=divs[i].classList[clsi]; + if (typeof cls == 'string' && cls.indexOf('error')>-1) { + return true; + } + } + + } + + } + + + return false; +} + +function Decrypt(data){ + + j$("[field-api='phone__c']").val(data.phone); + j$("[field-api='Responsible_Person__c']").val(data.responsiblePerson); + + +} + +function Trans(callback){ + let payload = { + "txId":txid, + "sfRecordId":document.getElementById("IrId").value, + "isSuccess":(txid && !HasError()) ? 1 : 0 + }; + AWSService.post(staticResource.transactionUrl, JSON.stringify(payload), function(result){ + Decrypt(aws_data); + if(callback)callback(); + unblockUI(); + }, staticResource.token); +} + +function Query(){ + let ele = document.getElementById("Page:Form:Block:AWS_Data_Id__c"); + if (ele && ele.value) { + blockme(); + AWSService.query(staticResource.queryUrl, ele.value, function(data){ + if (data && data.object) { + Decrypt(data.object); + } + unblockUI(); + }, staticResource.token); + } +} + +j$(function(){ + Query(); +}) + </script> <title>{!ir.Name}</title> </head> @@ -138,8 +280,13 @@ // 淇濆瓨寰屻�佹柊瑕忋伄鍫卞憡鏇窱D銈掑彇寰� tmpinsid = '{!ir.Id}'; tmpinsn = '{!JSENCODE(ir.Name)}'; + //var IsAddmessage = {IsAddmessage}; + var isPDF = {!isPDF}; + </script> <apex:actionFunction name="searchfunc" action="{!searchBtn}" rerender="Form,Block,UnCheckSection" onComplete="unblockUI();"></apex:actionFunction> + +<apex:actionFunction name="exchangeAssetfunc" action="{!exchangeAsset}" rerender="Form" onComplete="unblockUI();"></apex:actionFunction> <apex:actionFunction name="sortTablefunc" action="{!sortTable}" rerender="Form" onComplete="unblockUI();"> <apex:param name="firstParam" assignTo="{!sortKey}" value="" /> @@ -149,9 +296,14 @@ <apex:actionFunction name="saveByRepair" action="{!saveBtn}" rerender="Form" onComplete="unblockUI();openRepair();"/> +<apex:actionFunction name="saveBtn" action="{!saveBtn}" rerender="Form" onComplete="afterSaveBtnJs();"/> +<apex:actionFunction name="submit" action="{!submit}" rerender="Form" onComplete="afterSubmitJs();"/> +<apex:actionFunction name="showPDF" action="{!showPDF}" rerender="Form" onComplete="afterShowPDFJs();"/> + <apex:outputPanel id="MessageP"> <apex:pageMessages /> </apex:outputPanel> + <div><apex:pageBlock mode="maindetail" Id="Block" rendered="{!initFlag}"> <div style="position: relative;top:0;width:100%;"> @@ -162,10 +314,10 @@ <apex:outputLabel value="{!$ObjectType.Inspection_Report__c.fields.Name_Manual__c.Label}" for="Name_Manual"/>锛� <apex:inputField value="{!ir.Name}" id="Ir_Name" html-disabled="disabled" style="border-width:0px;font-size:18px;font-weight:bold;padding-right:20px;-webkit-text-fill-color:black;"/> </td> - <td style="text-align: center;padding-right: 100px;"><apex:commandButton style="width:80px;" value="淇濆瓨" action="{!saveBtn}" onclick="blockme();" rerender="Form" onComplete="unblockUI();"/></td> - <td style="text-align: center;padding-right: 100px;"><apex:commandButton value="鎻愪氦" action="{!submit}" onclick="blockme();" style="width:80px" rerender="Form" id="submitButton" onComplete="unblockUI();"/></td> + <td style="text-align: center;padding-right: 100px;"><input class="btn" type="Button" style="width:80px;" value="淇濆瓨" action="" onclick="saveBtnJs();" rerender="Form" onComplete="unblockUI();"/></td> + <td style="text-align: center;padding-right: 100px;"><input class="btn" type="Button" value="鎻愪氦" action="" onclick="submitJs();" style="width:80px" rerender="Form" id="submitButton" onComplete="unblockUI();"/></td> <td style="text-align: center;padding-right: 100px;"><apex:commandButton style="width:80px;" value="鍏抽棴绐楀彛" onclick="location.href='/apex/OFSWindowClose';return false;" id="closeButton"/></td> - <td style="text-align: center;"><apex:commandButton style="width:80px;" value="PDF" action="{!showPDF}" onclick="blockme();" rerender="Form" onComplete="unblockUI();"/></td> + <td style="text-align: center;"><input class="btn" type="Button" style="width:80px;" value="PDF" action="" onclick="showPDFJs();" rerender="Form" onComplete="unblockUI();"/></td> </tr> </table> <apex:pageBlockSection title="{!sectionList[0].title}" columns="{!sectionList[0].column}" showHeader="{!sectionList[0].showHeader}" rendered="{!sectionList.size>0}"> @@ -207,11 +359,16 @@ </div> <div style="position: relative;top:0;height:700px;overflow:hidden;overflow-y:auto;-webkit-overflow-scrolling: touch;"> <input type="hidden" value="{!ir.Id}" id="IrId"/> + <apex:inputHidden value="{!ir.AWS_Data_Id__c}" id="AWS_Data_Id__c"/> + + + + <apex:repeat value="{!sectionList}" var="section" id="SectionList"> <apex:pageBlockSection title="{!section.title}" columns="{!section.column}" showHeader="{!section.showHeader}" rendered="{!!section.isTop}"> <apex:repeat value="{!section.sectionItemList}" var="sectionItem" id="SectionItemList"> <apex:outputField value="{!ir[sectionItem.api]}" rendered="{!NOT(sectionItem.isDummy)&&NOT(sectionItem.isCustomize)&&NOT(sectionItem.isInput)}"/> - <apex:inputField style="width:{!sectionItem.width};height:{!sectionItem.height};" value="{!ir[sectionItem.api]}" rendered="{!NOT(sectionItem.isDummy)&&NOT(sectionItem.isCustomize)&§ionItem.isInput}" required="{!sectionItem.isRequired}" html-tabindex="{!sectionItem.index}"/> + <apex:inputField html-field-api="{!sectionItem.api}" style="width:{!sectionItem.width};height:{!sectionItem.height};" value="{!ir[sectionItem.api]}" rendered="{!NOT(sectionItem.isDummy)&&NOT(sectionItem.isCustomize)&§ionItem.isInput}" required="{!sectionItem.isRequired}" html-tabindex="{!sectionItem.index}"/> <apex:pageblockSectionItem rendered="{!NOT(sectionItem.isDummy)&&(sectionItem.isCustomize)&&Not(isNull(sectionItem.customizeLable))}"> <apex:outputLabel value="{!sectionItem.customizeLable}"/> <apex:outputPanel layout="none"> @@ -222,7 +379,7 @@ </apex:outputPanel> <apex:outputPanel layout="none" rendered="{!NOT(api == 'Hospital__c' && ir.Id != '')}"> <apex:outputLabel style="font-weight: bold; padding-right: 5px;" value="{!sectionItem.apiLabelMap[api]}"/> -<apex:inputField value="{!ir[api]}" style="{!sectionItem.apiStyleMap[api]}" rendered="{!NOT(api=='') && (sectionItem.isInput || sectionItem.apiInputMap[api])}" required="{!sectionItem.apiRequireMap[api]}" html-tabindex="{!sectionItem.index}"/> +<apex:inputField html-field-api="{!api}" value="{!ir[api]}" style="{!sectionItem.apiStyleMap[api]}" rendered="{!NOT(api=='') && (sectionItem.isInput || sectionItem.apiInputMap[api])}" required="{!sectionItem.apiRequireMap[api]}" html-tabindex="{!sectionItem.index}"/> <apex:outputPanel style="display:inline-block;{!sectionItem.apiStyleMap[api]}" rendered="{!NOT(api=='') && NOT((sectionItem.isInput || sectionItem.apiInputMap[api]))}"> <apex:outputField value="{!ir[api]}"/> </apex:outputPanel> @@ -234,7 +391,7 @@ <apex:outputPanel layout="none"> <apex:repeat value="{!sectionItem.apiList}" var="api"> <apex:outputLabel style="font-weight: bold; padding-right: 5px;" value="{!sectionItem.apiLabelMap[api]}"/> -<apex:inputField value="{!ir[api]}" style="{!sectionItem.apiStyleMap[api]}" rendered="{!NOT(api=='') && (sectionItem.isInput || sectionItem.apiInputMap[api])}" required="{!sectionItem.apiRequireMap[api]}" html-tabindex="{!sectionItem.index}"/> +<apex:inputField html-field-api="api" value="{!ir[api]}" style="{!sectionItem.apiStyleMap[api]}" rendered="{!NOT(api=='') && (sectionItem.isInput || sectionItem.apiInputMap[api])}" required="{!sectionItem.apiRequireMap[api]}" html-tabindex="{!sectionItem.index}"/> <apex:outputPanel style="display:inline-block;{!sectionItem.apiStyleMap[api]}" rendered="{!NOT(api=='') && NOT((sectionItem.isInput || sectionItem.apiInputMap[api]))}"> <apex:outputField value="{!ir[api]}"/> </apex:outputPanel> @@ -382,7 +539,8 @@ <td> <apex:commandButton value="琛岃拷鍔�" action="{!addNewRows}" disabled="{!Not($ObjectType.Inspection_Item__c.createable)}" style="margin-left:10px;float:left;" onclick="blockme();" oncomplete="unblockUI();" rerender="Form" /> - <apex:commandButton value="鍒锋柊閫変腑鐨勪繚鏈夎澶�" action="{!exchangeAsset}" onclick="blockme();" oncomplete="unblockUI();" rerender="Form" /> + <apex:commandButton value="鍒锋柊閫変腑鐨勪繚鏈夎澶�" onclick="exchangeAssetJs();return false;" rerender="dummy"/> + <!-- <apex:commandButton value="鍒锋柊閫変腑鐨勪繚鏈夎澶�" action="{!exchangeAsset}" onclick="blockme();" oncomplete="unblockUI();" rerender="Form" /> --> <!-- <apex:commandButton value="鍒锋柊鍖婚櫌涓嬬殑鍏ㄩ儴淇濇湁璁惧" action="{!getAssetFromHp}" onclick="blockme();" oncomplete="unblockUI();" rerender="Form" /> --> </td> </tr> @@ -414,7 +572,7 @@ <td style="width:95px" align="left"><apex:inputText value="{!val1}" id="val1" style="width:100px"/></td> <td align="left"> - <apex:commandButton value="妫�绱�" onclick="searchJs();" style="width:130px" rerender="dummy"/> + <apex:commandButton value="妫�绱�" onclick="searchJs();return false;" style="width:130px" rerender="dummy"/> <apex:commandButton value="娓呴櫎鏉′欢" onclick="clearAndSearch();" style="width:130px" rerender="dummy"/> -- Gitblit v1.9.1