<?xml version="1.0" encoding="UTF-8"?> <!-- $Author: qwm $Date: 2014-10-28 上午11:11:15 $Revision: 1.0 $Purpose: --> <a:screen xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" trace="true"> <a:init-procedure> <s:server-script import="contract_print_path.js"><![CDATA[ $ctx.parameter.file_path = con_print_path['con_print_path']; $ctx.parameter.tomcat_source = con_print_path['tomcat_source']; ]]></s:server-script> </a:init-procedure> <a:view package="leaf.ui.std" template="default"> <div/> <a:link id="rsc_rick_mon_upload_link" url="${/request/@context_path}/downloadFile.lview"/> <a:link id="view_pdf_id" url="${/request/@context_path}/modules/view_pdf.lview"/> <script type="text/javascript"><![CDATA[ function mon_upload_win(table_name, table_pk_value) { var url = $('rsc_rick_mon_upload_link').getUrl() + '?table_name=' + table_name + '&header_id=' + table_pk_value; new Leaf.Window({ url: url, title: '${l:HLS.SUPPORTING_DOCUMENT}', id: 'rsc_risk_mon_report_win', width: 850, height: 400 }); } function upload_renderer(value, record, name) { return '<a href="javascript:mon_upload_win(\'' + 'HLS_ATTACHMENT_MODULE' + '\',' + record.get('attachment_module_id') + ');">' + '附件上传/下载' + '</a>'; } function bpQueryScreen_query() { $('upload_ds').query(); } function bpQueryScreen_back() { history.go(-1); } window['file_name_link_render'] = function(value, record, name) { if (name == 'pdf_attachment_id' && value != null) { if (value != null) { var url = '<a href=javascript:view_pdf(\'' + value + '\')>PDF预览</a>'; } return url; } else if (name != 'pdf_attachment_id' && value != null) { var link = '${/request/@context_path}/atm_download.lsc?attachment_id='; var str = value.split(';;'); var file_name; url = ''; for (var i = 0;i < str.length;i++) { var temp = str[i].split('--'); if (!Leaf.isEmpty(temp[0])) { file_name = temp[0].toUpperCase(); if (file_name.indexOf('.PDF') >= 0) { url = url + '<a style="color:red" href=javascript:view_pdf(\'' + temp[1] + '\')>' + temp[0] + '</a>'; } else { url = url + '<a style="color:red" href=' + link + temp[1] + ' ref="img">' + temp[0] + '</a>' + ','; } } } return url; } }; function view_pdf(attachment_id) { // new Leaf.Window({ // params: { // attachment_id: attachment_id, // num : 3 // }, // url: $('view_pdf_id').getUrl(), // id: 'view_pdf1_id', // title: '${l:PRJ501.PRJ_HISTORY_VERSION}', // fullScreen: true // }); Leaf.request({ url: '${/request/@context_path}/autocrud/fnd.fnd_atm_attachment/query', para: { attachment_id: attachment_id }, success: function(res) { var path = res.result.record.file_path; path = path.substr(path.indexOf('hls_attachment')); var tomcat_source = '${/parameter/@tomcat_source}'; var source_path = 'http://' + window.location.host + '/' + tomcat_source + '/' + path; var oWin = window.open(source_path); }, scope: this }); } // function view_pdf(attachment_id) { // Leaf.request({ // url: '${/request/@context_path}/autocrud/fnd.fnd_atm_attachment/query', // para: { // attachment_id: attachment_id // }, // success: function(res) { // var path = res.result.record.file_path; // path = path.substr(path.indexOf('hls_attachment')); // var tomcat_source = '${/parameter/@tomcat_source}'; // var source_path = 'http://' + window.location.host + '/' + tomcat_source + '/' + path; // var oWin = window.open(source_path); // }, // scope: this // }); // } ]]></script> <a:dataSets> <a:dataSet id="para_bpQueryDs" autoCreate="true"><![CDATA[ ]]></a:dataSet> <a:dataSet id="upload_ds" autoQuery="true" fetchAll="true" model="sys.SYS120.hls_attachment_module" queryDataSet="para_bpQueryDs"><![CDATA[ ]]></a:dataSet> </a:dataSets> <a:screenBody> <a:screenTopToolbar> <a:screenTitle/> <a:gridButton click="bpQueryScreen_back" text="后退"/> <a:gridButton click="bpQueryScreen_query" text="HLS.QUERY"/> </a:screenTopToolbar> <a:form column="2" labelWidth="120" title="模板查询" width="600"> <a:textField name="description" bindTarget="para_bpQueryDs" prompt="模板名称"/> </a:form> <a:grid id="mon_grid_id" bindTarget="upload_ds" marginHeight="200" marginWidth="200" navBar="true" width="600"> <a:columns> <a:column name="description" prompt="模板名称" width="200"/> <a:column name="upload" align="center" prompt="附件上传/下载" renderer="upload_renderer"/> <a:column name="file_name" align="left" prompt="附件名称" renderer="file_name_link_render" width="880"/> </a:columns> <a:editors> <a:textField id="mon_tf"/> <a:checkBox id="mon_cb"/> </a:editors> </a:grid> </a:screenBody> </a:view> </a:screen>