| | |
| | | <apex:page id="Page" showHeader="false" sidebar="false" controller="BatchSelectRepairPageController" applyBodyTag="false" applyHtmlTag="false" action="{!init}"> |
| | | <apex:page id="Page" showHeader="false" sidebar="false" controller="BatchSelectRepairPageController" applyBodyTag="false" applyHtmlTag="false" action="{!init}" lightningStylesheets="true" > |
| | | <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/> |
| | | <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/> |
| | | <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/> |
| | | <apex:includeScript value="{!URLFOR($Resource.CommonUtilJs)}"/> |
| | | <apex:includeScript value="{!URLFOR($Resource.connection20)}"/> |
| | | <apex:includeScript value="{!URLFOR($Resource.apex20)}"/> |
| | | <apex:includeScript value="{!URLFOR($Resource.xlsxCoreMinJs)}"/> |
| | | <title>批量选择修理功能</title> |
| | | <style type="text/css"> |
| | | .pure-table { |
| | |
| | | text-align: center; |
| | | vertical-align: bottom; |
| | | } |
| | | |
| | | .bPageBlock{ |
| | | border-top: 3px solid #3044b5; |
| | | } |
| | | |
| | | .pure-table td { |
| | | background-color: transparent; |
| | |
| | | //全选功能 |
| | | function checkAll() { |
| | | var cnt = j$(escapeVfId('raCnt')).val(); |
| | | if (j$(escapeVfId('Page:Form:Block:j_id53:checkAll')).attr('checked') == 'checked') { |
| | | // alert(jQuery('input[id$=checklist]').length); |
| | | if (jQuery('input[id$=checkAll]').attr('checked') === 'checked') { |
| | | // alert(j$('input[id$=checklist]')[0].checked); |
| | | for (var i = 0; i < cnt; i++) { |
| | | j$(escapeVfId('Page:Form:Block:j_id53:records:' + i + ':checklist')).attr('checked',true); |
| | | j$('input[id$=checklist]')[i].checked = true; |
| | | } |
| | | } else { |
| | | for (var i = 0; i < cnt; i++) { |
| | | j$(escapeVfId('Page:Form:Block:j_id53:records:' + i + ':checklist')).attr('checked',false); |
| | | j$('input[id$=checklist]')[i].checked = false; |
| | | } |
| | | } |
| | | } |
| | | //检索功能 |
| | | // function RetrievalBtnJS() { |
| | | // var RepairName = j$(escapeVfId("Page:Form:Block:RAInfoList:0:RepairName")).value(); |
| | | // var SAPRepairNo = j$(escapeVfId("Page:Form:Block:RAInfoList:0:SAPRepairNo")).value(); |
| | | // var HospitalName = j$(escapeVfId("Page:Form:Block:RAInfoList:0:HospitalName")).value(); |
| | | // blockme(); |
| | | // RetrievalBtn(); |
| | | // } |
| | | //跳转打印PDF页面 |
| | | // function showPDFJS() { |
| | | // blockme(); |
| | | // showPDF(); |
| | | // var raIdList = j$(escapeVfId('raIdList')).val(); |
| | | // if(raIdList != null && raIdList != ''){ |
| | | // var Id = raIdList.split(); |
| | | // for(var i = 0; i < Id.size(); i++){ |
| | | // window.open('apex/MaintenanceCommissionPDF?id=' + Id[i]); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | //跳转到pdf页面 |
| | | function skipPage() { |
| | | var pdfURL = j$(escapeVfId('pdfURL')).val(); |
| | | window.open(pdfURL, "维修委托书PDF", ""); |
| | | } |
| | | |
| | | // table转Excel文件 |
| | | function exportExcel() { |
| | | var csv = table2csv(j$(escapeVfId('theTable table'))[0]); |
| | | // console.log(csv) |
| | | var sheet = csv2sheet(csv); |
| | | var blob = sheet2blob(sheet); |
| | | openDownloadDialog(blob,'修理明细表.xlsx'); |
| | | } |
| | | |
| | | function table2csv(table) { |
| | | var csv = []; |
| | | var trSize = j$(j$(escapeVfId('theTable table'))[0]).find('tr').length; |
| | | var spanSize = j$(j$(escapeVfId('theTable table'))[0]).find('tr td span').length; |
| | | var aSize = j$(j$(escapeVfId('theTable table'))[0]).find('tr td span a').length; |
| | | var fixSize = 0; |
| | | var g = 0; |
| | | var nbsp = '&nb' + 'sp;'; |
| | | for(var i = 0; i < trSize; i++){ |
| | | var temp = []; |
| | | // 标题列用td |
| | | if(i == 0){ |
| | | for(var j = 0; j < 15; j++){ |
| | | temp.push(j$(table).find('tr td')[j].innerHTML); |
| | | } |
| | | temp.shift(); // 移除第一个全选按钮 |
| | | } else{ |
| | | for(var k = fixSize; k < fixSize + 14; k++){ |
| | | var htmlText = j$(table).find('tr td span')[k].innerHTML; |
| | | if(htmlText.slice(1,2) == 'a' && htmlText.slice(htmlText.length-2,htmlText.length-1) == 'a'){ |
| | | temp.push(j$(table).find('tr td span a')[g].innerHTML); |
| | | g++; |
| | | } else{ |
| | | if(j$(table).find('tr td span')[k].innerHTML == nbsp){ |
| | | temp.push(''); |
| | | }else{ |
| | | temp.push(j$(table).find('tr td span')[k].innerHTML); |
| | | } |
| | | } |
| | | } |
| | | if(fixSize < spanSize){ |
| | | fixSize += 14; |
| | | } |
| | | } |
| | | csv.push(temp.join(';')); |
| | | } |
| | | temp.push(''); |
| | | csv.push(temp.join(';')); |
| | | // csv.shift(); |
| | | return csv.join('\n'); |
| | | } |
| | | |
| | | function csv2sheet(csv) { |
| | | var sheet = {}; // 将要生成的sheet |
| | | csv = csv.split('\n'); |
| | | csv.forEach(function(row, i) { |
| | | row = row.split(';'); |
| | | if(i == 0) sheet['!ref'] = 'A1:'+String.fromCharCode(65+row.length-1)+(csv.length-1); |
| | | row.forEach(function(col, j) { |
| | | sheet[String.fromCharCode(65+j)+(i+1)] = {v: col}; |
| | | }); |
| | | }); |
| | | return sheet; |
| | | } |
| | | |
| | | function sheet2blob(sheet, sheetName) { |
| | | sheetName = sheetName || 'sheet1'; |
| | | var workbook = { |
| | | SheetNames: [sheetName], |
| | | Sheets: {} |
| | | }; |
| | | workbook.Sheets[sheetName] = sheet; |
| | | // 生成excel的配置项 |
| | | var wopts = { |
| | | bookType: 'xlsx', // 要生成的文件类型 |
| | | bookSST: false, // 是否生成Shared String Table,官方解释是,如果开启生成速度会下降,但在低版本IOS设备上有更好的兼容性 |
| | | type: 'binary' |
| | | }; |
| | | var wbout = XLSX.write(workbook, wopts); |
| | | var blob = new Blob([s2ab(wbout)], {type:"application/octet-stream"}); |
| | | // 字符串转ArrayBuffer |
| | | function s2ab(s) { |
| | | var buf = new ArrayBuffer(s.length*2); // 每个字符占⽤2个字节 |
| | | var view = new Uint8Array(buf); |
| | | for (var i=0; i!=s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF; |
| | | return buf; |
| | | } |
| | | return blob; |
| | | } |
| | | |
| | | /** |
| | | * 通用的打开下载对话框方法,没有测试过具体兼容性 |
| | | * @param url 下载地址,也可以是一个blob对象,必选 |
| | | * @param saveName 保存文件名,可选 |
| | | */ |
| | | function openDownloadDialog(url, saveName) { |
| | | if(typeof url == 'object' && url instanceof Blob) { |
| | | url = URL.createObjectURL(url); // 创建blob地址 |
| | | } |
| | | var aLink = document.createElement('a'); |
| | | aLink.href = url; |
| | | aLink.download = saveName || ''; // HTML5新增的属性,指定保存文件名,可以不要后缀,注意,file:///模式下不会生效 |
| | | var event; |
| | | if(window.MouseEvent) event = new MouseEvent('click'); |
| | | else { |
| | | event = document.createEvent('MouseEvents'); |
| | | event.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); |
| | | } |
| | | aLink.dispatchEvent(event); |
| | | } |
| | | </script> |
| | | <apex:form id="allForm" style="margin: 10px 10px;"> |
| | | <apex:actionFunction name="RetrievalBtn" action="{!RetrievalBtn}" rerender="Form, message" onComplete="unblockUI();"/> |
| | | <!-- <apex:actionFunction name="showPDF" action="{!showPDF}" rerender="Form, message" onComplete="unblockUI();" /> --> |
| | | <!-- <apex:actionFunction name="RetrievalBtn" action="{!RetrievalBtn}" rerender="allForm, message" onComplete="unblockUI();"/> --> |
| | | <!-- <apex:actionFunction name="showPDF" action="{!showPDF}" rerender="allForm, message" onComplete="skipPage();unblockUI();"/> --> |
| | | <!-- 后台报错信息显示的关键 --> |
| | | <apex:outputPanel id="message"> |
| | | <apex:pageMessages ></apex:pageMessages> |
| | | </apex:outputPanel> |
| | | <apex:outputPanel id="allPanel"> |
| | | <input type="hidden" id="pdfURL" value="{!pdfURL}" /> |
| | | <apex:pageBlock mode="maindetail" Id="allBlock"> |
| | | <div style="position: relative; width:100%; "> |
| | | <apex:pageBlock title="检索列" id="Editable"> |
| | | <table> |
| | | <tr><td style="text-align: left;padding-right: 100px;"> </td></tr> |
| | | <apex:repeat value="{!RevalInfoList}" var="reval" id="RevalInfoList"> |
| | | <!--<tr><td> </td></tr>--> |
| | | <tr> |
| | | <!-- <td style="text-align: left;padding-right: 100px;"> </td> --> |
| | | <td style="text-align: right; width:200px;"> |
| | | <apex:outputLabel style="font-weight: bold; padding-right: 5px;" value="状态2"/> |
| | | <td style="text-align: left; position: relative; top: 7px; padding-left: 50px;"> |
| | | <apex:outputLabel style="font-weight: bold; padding-right: 25px;" value="状态1"/> |
| | | <apex:selectList value="{!RevalInfo.Status1}" size="1" style="width: 150px; height: 24px;"> |
| | | <apex:selectOptions value="{!StatusItems1}"/> |
| | | </apex:selectList><p/> |
| | | </td> |
| | | <td style="text-align: left;"> |
| | | <apex:inputText id="Status2" value="{!reval.Status2}"/> |
| | | <td style="text-align: left; position: relative; top: 7px; padding-left: 50px;"> |
| | | <apex:outputLabel style="font-weight: bold; padding-right: 25px;" value="状态2"/> |
| | | <apex:selectList value="{!RevalInfo.Status2}" size="1" style="width: 150px; height: 24px;"> |
| | | <apex:selectOptions value="{!StatusItems}"/> |
| | | </apex:selectList><p/> |
| | | </td> |
| | | <td style="text-align: right; width:200px;"> |
| | | <td style="text-align: left;padding-left: 50px;"> |
| | | <apex:outputLabel style="font-weight: bold; padding-right: 5px;" value="RS修理单号"/> |
| | | <apex:inputText id="RepairName" value="{!RevalInfo.RepairName}"/> |
| | | </td> |
| | | <td style="text-align: left;"> |
| | | <apex:inputText id="RepairName" value="{!reval.RepairName}"/> |
| | | </td> |
| | | <td style="text-align: right; width:150px;"> |
| | | <apex:outputLabel style="font-weight: bold; padding-right: 5px;" value="SAP修理单号"/> |
| | | </td> |
| | | <td style="text-align: left;padding-right: 100px;"> |
| | | <apex:inputText id="SAPRepairNo" value="{!reval.SAPRepairNo}"/> |
| | | </td> |
| | | <td style="text-align: left;padding-left: 50px;"> |
| | | <apex:outputLabel style="font-weight: bold; padding-right: 6px;" value="SAP修理单号"/> |
| | | <apex:inputText id="SAPRepairNo" value="{!RevalInfo.SAPRepairNo}"/> |
| | | </td> |
| | | </tr> |
| | | <tr><td style="text-align: left;padding-right: 100px;"> </td></tr> |
| | | <!--<tr><td> </td></tr>--> |
| | | <tr> |
| | | <!-- <td style="text-align: left;padding-right: 100px;"> </td> --> |
| | | <td style="text-align: right; width:100px;"> |
| | | <td style="text-align: left; padding-left: 50px;"> |
| | | <apex:outputLabel style="font-weight: bold; padding-right: 5px;" value="机身编码"/> |
| | | <apex:inputText id="SerialNumber" value="{!RevalInfo.SerialNumber}"/> |
| | | </td> |
| | | <td style="text-align: left;"> |
| | | <apex:inputText id="SerialNumber" value="{!reval.SerialNumber}"/> |
| | | <td style="text-align: left; padding-left: 50px;"> |
| | | <apex:outputLabel style="font-weight: bold; padding-right: 50px;" value="省份"/> |
| | | <apex:inputText id="State_Hospital" value="{!RevalInfo.State_Hospital}"/> |
| | | </td> |
| | | <td style="text-align: right; width:200px;"> |
| | | <apex:outputLabel style="font-weight: bold; " value="修理委托者"/> |
| | | <td style="text-align: left; padding-left: 50px;"> |
| | | <apex:outputLabel style="font-weight: bold; padding-right: 50px;" value="医院名称"/> |
| | | <apex:inputText id="HP_Name" value="{!RevalInfo.HospitalName}"/> |
| | | </td> |
| | | <td style="text-align: left;"> |
| | | <apex:inputField id="InchargeStaffName" value="{!reval.repair.Incharge_Staff__c}"/> |
| | | </td> |
| | | <td style="text-align: right; width:150px;"> |
| | | <apex:outputLabel style="font-weight: bold; padding-right: 5px;" value="FSE申请日"/> |
| | | </td> |
| | | <td style="text-align: left;padding-right: 80px;"> |
| | | <apex:inputField id="FSE_ApplyForRepair_Day" value="{!reval.repair.Final_complete_day__c}"/> |
| | | <td style="text-align: left; padding-left: 50px;" > |
| | | <apex:outputLabel style="font-weight: bold; padding-right: 22px;" value="FSE申请日"/> |
| | | <apex:inputField id="FSE_ApplyForRepair_Day" value="{!RevalInfo.repair.Aware_date__c}"/>-<apex:inputField value="{!RevalInfo.repair.Aware_date2__c}"/> |
| | | </td> |
| | | </tr> |
| | | </apex:repeat> |
| | | <tr><td style="text-align: left;padding-right: 100px;"> </td></tr> |
| | | <!--<tr><td> </td></tr>--> |
| | | <tr> |
| | | <td style="text-align: left; position: relative; top: 7px;padding-left: 50px;"> |
| | | <apex:outputLabel style="font-weight: bold; padding-right: 5px;" value="服务方式"/> |
| | | <apex:selectList value="{!RevalInfo.onSiteRepair}" size="1" style="width: 150px; height: 24px;"> |
| | | <apex:selectOptions value="{!SiteRepairItems}"/> |
| | | </apex:selectList><p/> |
| | | </td> |
| | | <td style="text-align: left; padding-left: 50px;"> |
| | | <apex:outputLabel style="font-weight: bold; padding-right: 22px;" value="维修中心"/> |
| | | <apex:inputText id="workLocationSelect" value="{!RevalInfo.workLocationSelect}"/> |
| | | <!-- <apex:selectList value="{!RevalInfo.workLocationSelect}" size="1" style="width: 150px; height: 24px;"> |
| | | <apex:selectOptions value="{!workLocationSelect}"/> |
| | | </apex:selectList><p/> --> |
| | | </td> |
| | | <td style="text-align: left;padding-left: 50px;"> |
| | | <div style="float:left;padding-right: 22px;"><apex:outputLabel style="font-weight: bold; " value="修理委托者"/></div> |
| | | <div style="float:left"><apex:inputField id="InchargeStaffName" value="{!RevalInfo.repair.Incharge_Staff__c}"/></div> |
| | | </td> |
| | | </tr> |
| | | <tr> |
| | | <td style="text-align: center;" colspan="6"> |
| | | <apex:commandButton style="width:80px;" value="检索" action="{!RetrievalBtn}" onclick="blockme();" reRender="allForm,message" onComplete="unblockUI();"/> |
| | |
| | | </tr> |
| | | </table> |
| | | </apex:pageBlock> |
| | | <!-- <div style="font-size:12px;"> --> |
| | | <apex:pageBlock title="详细信息" > |
| | | <input type="hidden" id="raCnt" value="{!RACount}" /> |
| | | <apex:commandButton style="width:80px;" value="打印PDF" action="{!showPDF}" onclick="blockme();" reRender="allForm,message" onComplete="unblockUI();"/> |
| | | <div style="width:100%;height:385px;overflow:auto;"> |
| | | <table class="pure-table pure-table-horizontal" id="theTable_header" style="width:99%; margin-top:10px;border-collapse: collapse;table-layout:fixed;"> |
| | | <tr style="background-color:#f2f3f3;"> |
| | | <th style="align:left; width:2%"><apex:inputCheckbox id="checkAll" onclick="checkAll();" style="text-align:left;"/></th> |
| | | <th style="text-align:left; width:6%">状态1</th> |
| | | <th style="text-align:left; width:6%">状态2</th> |
| | | <th style="text-align:left; width:7%">RS修理单号</th> |
| | | <th style="text-align:left; width:10%">SAP修理单号</th> |
| | | <th style="text-align:left; width:10%">型号</th> |
| | | <th style="text-align:left; width:5%">机身编号</th> |
| | | <th style="text-align:left; width:8%">医院名称</th> |
| | | <th style="text-align:left; width:5%">省份</th> |
| | | <th style="text-align:left; width:5%">修理委托者</th> |
| | | <th style="text-align:left; width:8%">FSE申请日期</th> |
| | | <th style="text-align:left; width:5%">维修中心</th> |
| | | <th style="text-align:left; width:5%">服务方式</th> |
| | | <th style="text-align:left; width:8%">有无维修合同对象</th> |
| | | <th style="text-align:left; width:8%">无偿区别标志</th> |
| | | <apex:commandButton style="width:80px;" value="打印PDF" action="{!showPDF}" onclick="blockme();" reRender="allForm,message" onComplete="unblockUI();skipPage();"/> |
| | | <apex:commandButton style="width:80px;" value="导出Excel" onclick="exportExcel();"/> |
| | | <div id="theTable" style="width:100%;height:385px;overflow:auto;"> |
| | | <!-- <table class="pure-table pure-table-horizontal" id="theTable_header" style="width:99%; margin-top:10px;border-collapse: collapse;table-layout:fixed;font-weight:bold;word-break:break-all;word-break:break-all;"> |
| | | </table> --> |
| | | <table class="pure-table pure-table-horizontal" id="theTable_header" style="margin-top:10px; width:99%; border-collapse: collapse;table-layout:fixed;"> |
| | | <tr style="background-color:#f2f3f3;font-weight:bold;"> |
| | | <td style="align:left; width:2%"><apex:inputCheckbox id="checkAll" onclick="checkAll();" style="text-align:left;"/></td> |
| | | <td style="text-align:center; width:6%">状态1</td> |
| | | <td style="text-align:center; width:6%">状态2</td> |
| | | <td style="text-align:center; width:8%">RS修理单号</td> |
| | | <td style="text-align:center; width:9%">SAP修理单号</td> |
| | | <td style="text-align:center; width:10%">型号</td> |
| | | <td style="text-align:center; width:6%">机身编号</td> |
| | | <td style="text-align:center; width:8%">医院名称</td> |
| | | <td style="text-align:center; width:5%">省份</td> |
| | | <td style="text-align:center; width:5%">修理委托者</td> |
| | | <td style="text-align:center; width:7%">FSE申请日期</td> |
| | | <td style="text-align:center; width:6%">维修中心</td> |
| | | <td style="text-align:center; width:6%">服务方式</td> |
| | | <td style="text-align:center; width:8%;">有无维修合同对象</td> |
| | | <td style="text-align:center; width:6%">无偿区别标志</td> |
| | | </tr> |
| | | </table> |
| | | <table class="pure-table pure-table-horizontal" id="theTable_header" style="width:99%; border-collapse: collapse;table-layout:fixed;"> |
| | | <apex:repeat value="{!RAInfoList}" var="ra" id="records"> |
| | | <tr> |
| | | <td align="left" width="2%"> |
| | | <td align="center" width="2%"> |
| | | <apex:inputCheckbox style="text-align:left;" id="checklist" value="{!ra.IFCheck}" /> |
| | | </td> |
| | | <td align="left" width="6%"> |
| | | <td align="center" width="6%"> |
| | | <apex:outputField id="Status1" value="{!ra.repair.Status1__c}"/> |
| | | </td> |
| | | <td align="left" width="6%"> |
| | | <td align="center" width="6%"> |
| | | <apex:outputField id="Status2" value="{!ra.repair.Status2__c}"/> |
| | | </td> |
| | | <td align="left" width="7%"> |
| | | <td align="center" width="8%"> |
| | | <apex:outputField id="OTCode" value="{!ra.repair.Name}"/> |
| | | </td> |
| | | <td align="left" width="10%"> |
| | | <td align="center" width="9%"> |
| | | <apex:outputField id="SAP_Service_Repair_No" value="{!ra.repair.SAP_Service_Repair_No__c}"/> |
| | | </td> |
| | | <td align="left" width="10%"> |
| | | <td align="center" width="10%"> |
| | | <apex:outputField id="Delivered_Product" value="{!ra.repair.Delivered_Product__c}"/> |
| | | </td> |
| | | <td align="left" width="5%"> |
| | | <td align="center" width="6%" style="word-wrap:break-word;word-break:break-all;"> |
| | | <apex:outputField id="SerialNumber" value="{!ra.repair.SerialNumber__c}"/> |
| | | </td> |
| | | <td align="left" width="8%"> |
| | | <td align="center" width="8%"> |
| | | <apex:outputField id="HP_Name" value="{!ra.repair.HP_Name__c}"/> |
| | | </td> |
| | | <td align="left" width="5%"> |
| | | <td align="center" width="5%"> |
| | | <apex:outputField id="State_Hospital" value="{!ra.repair.State_Hospital__c}"/> |
| | | </td> |
| | | <td align="left" width="5%"> |
| | | <td align="center" width="5%"> |
| | | <apex:outputField id="Incharge_Staff" value="{!ra.repair.Incharge_Staff__c}"/> |
| | | </td> |
| | | <td align="left" width="8%"> |
| | | <td align="center" width="7%"> |
| | | <apex:outputField id="FSE_ApplyForRepair_Day" value="{!ra.repair.FSE_ApplyForRepair_Day__c}"/> |
| | | </td> |
| | | <td align="left" width="5%"> |
| | | <td align="center" width="6%"> |
| | | <apex:outputField id="work_location_select" value="{!ra.repair.work_location_select__c}"/> |
| | | </td> |
| | | <td align="left" width="5%"> |
| | | <td align="center" width="6%"> |
| | | <apex:outputField id="On_site_repair" value="{!ra.repair.On_site_repair__c}"/> |
| | | </td> |
| | | <td align="center" width="8%"> |
| | | <apex:outputField id="Number_of_EffectiveContract" value="{!ra.repair.Number_of_EffectiveContract__c}"/> |
| | | </td> |
| | | <td align="left" width="8%"> |
| | | <td align="center" width="6%"> |
| | | <apex:outputField id="NewProductGuaranteeObject" value="{!ra.repair.NewProductGuaranteeObject__c}"/> |
| | | </td> |
| | | </tr> |
| | |
| | | </table> |
| | | </div> |
| | | </apex:pageBlock> |
| | | <!-- </div> --> |
| | | </div> |
| | | </apex:pageBlock> |
| | | </apex:outputPanel> |