自訂參數面板和工具欄

1. 概述

1.1 問題描述

FineReport 本身自帶多種可編輯元件,可以實現複雜參數介面的製作。但是有時為了實現與系統介面中元件的一致,希望不使用 FR 內建參數介面和內建工具欄,而是自己定義參數介面以及工具欄,此時要如何設定呢?

效果如下圖所示:

①為參數面板,②為:自訂工具欄

1.2 實現思路

在 自訂參數界面 中介紹了 自定义按钮 的實現方式,在自訂工具欄章節中介紹了各種按鈕的實現方式,那麼只需要將這兩個實現程式結合起來即可。

2. 操作步驟

2.1 編輯範本

以自訂參數介面中的最終範本/demo/parameter/庫存查詢每頁顯示固定行.cpt範本為例,將其嵌入到頁面中去,並且不顯示範本參數介面和內建工具欄。

2.2 網頁設計

網頁設計參見 自訂參數界面,只需要重新整理增一個工具欄即可,工具欄新增的詳細介紹請查看 自定义按钮

HTML 完整程式碼如下:

<html>
  <head>  
  
<title>自訂參數介面及工具欄</title>  
  
<meta http-equiv="Content-Type" content="text/htmlcharset=UTF-8" />  
  
<script type="text/javascript">
    
function autoSubmit({
    
var num = document.getElementById('num').value; //獲取正文元件的值
    
var row = document.getElementById('row').value; //獲取下拉框元件的值
    
//連接出最終報表存取路徑,並對完整的路徑進行編碼轉換,防止亂碼問題
    
var reportURL = encodeURI("/webroot/decision/view/report?viewlet=/demo/parameter/庫存查詢每頁顯示固定行.cpt&para=" + num + "&row=" + row);
    
document.paraForm.action = reportURL; //透過form的name獲取表單,並將報表存取路徑賦給表單的action
    
document.paraForm.submit(); //觸發表單提交事件
    }
  
</script>
  
</head>  
  
<body>
 
  
<fieldset>
    
<legend>查詢表單:</legend>
  
<form name="paraForm" method="post" target="reportFrame">
    最小庫存量:
<input type="text" name="num" id="num" value="1"/>
    每頁顯示行數:
<select name="row" id="row">  
    
<option value="10" select>10  
    
<option value="20">20
    
<option value="30">30
    
<input type="button" name="show" value="查詢" onclick="autoSubmit()"/>
   
</form> <!-- 自訂工具欄-->  
    
<div id="toolbar">       
    
<button type="button" onclick="document.getElementById('reportFrame').contentWindow._g().gotoFirstPage()">首頁</button>  
    
<button type="button" onclick="document.getElementById('reportFrame').contentWindow._g().gotoPreviousPage()">上一頁</button>       
    
<button type="button" onclick="document.getElementById('reportFrame').contentWindow._g().gotoNextPage()">下一頁</button>       
    
<button type="button" onclick="document.getElementById('reportFrame').contentWindow._g().gotoLastPage()">末頁</button>              
    
<button type="button" onclick="document.getElementById('reportFrame').contentWindow._g().noClientPrint()">零用戶端列印</button>          
    
<button type="button" onclick="document.getElementById('reportFrame').contentWindow._g().exportReportToExcel('page')">匯出[Excel](分頁)</button>  
    
<button type="button" onclick="document.getElementById('reportFrame').contentWindow._g().exportReportToWord()">匯出[Word]</button>              
    
</div>  
  
</fieldset>
    
<iframe id="reportFrame" name="reportFrame" width="100%" height="100%" ></iframe>  
  
</body>  
</html>
显示代码

2.3 效果預覽

啟動工程,在瀏覽器輸入:http://localhost:8075/webroot/help/page_demo/parameter_toolbar.html,效果如下圖:

支援在行動端查看頁面,只需要將上述地址中 localhost 換成伺服器 IP,然後透過 URL 在行動端存取即可。

附件列表


主題: 部署集成
已經是第一篇
已經是最後一篇
  • 有幫助
  • 沒幫助
  • 只是瀏覽
中文(繁體)

滑鼠選中內容,快速回饋問題

滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

不再提示

9s后關閉

獲取幫助
線上支援
獲取專業技術支援,快速幫助您解決問題
工作日9:00-12:00,13:30-17:30在线
頁面反饋
針對當前網頁的建議、問題反饋
售前咨詢
業務咨詢
電話:0933-790886或 0989-092892
郵箱:taiwan@fanruan.com
頁面反饋
*問題分類
不能為空
問題描述
0/1000
不能為空

反馈已提交

网络繁忙

反饋已提交

網絡繁忙