<?xml version="1.0" encoding="UTF-8"?> <!-- $Author: xiaobo $Date: 2012-11-23 下午1:50:45 $Revision: 1.0 $Purpose: --> <a:screen xmlns:a="http://www.leaf-framework.org/application"> <a:init-procedure/> <a:view package="leaf.ui.std" template="default"> <div/> <a:link id="psr_report_create" url="${/request/@context_path}/modules/psr/PSR1010/psr_report_create.lview"/> <a:link id="psr_report_delete" url="${/request/@context_path}/autocrud/psr.PSR1010.psr_report_delete/execute"/> <a:link id="psr_report_mail" url="${/request/@context_path}/modules/psr/PSR1010/psr_report_mail.lsc"/> <a:link id="psr_report_preview_link" url="${/request/@context_path}/modules/psr/PSR1010/psr_report_preview.lview"/> <a:link id="psr_report_check" url="${/request/@context_path}/modules/psr/PSR1010/psr_report_check.lsc"/> <a:link id="psr_report_parameter_dynamic" url="${/request/@context_path}/modules/psr/PSR1020/psr_report_parameter_dynamic.lview"/> <a:link id="psr_report_parameter_preview_dynamic" url="${/request/@context_path}/modules/psr/PSR1020/psr_report_parameter_preview_dynamic.lview"/> <a:link id="psr_report_output" url="${/request/@context_path}/modules/psr/PSR1010/psr_report_output.lsc"/> <script type="text/javascript"><![CDATA[ function queryFun() { $('psr_report_headers_ds').query(); } function resetFun() { $('psr_report_headers_query_ds').reset(); } function previewFun(value, record, name) { return '<a href="javascript:outputPreview(' + record.id + ')" >预览</a>'; } function asynchronization_runFun(value, record, name) { var synchronization_flag = 'N'; return '<a href="javascript:outputFun(' + record.id + ',\'' + synchronization_flag + '\')" >异步运行</a>'; } function synchronization_runFun(value, record, name) { var synchronization_flag = 'Y'; return '<a href="javascript:outputFun(' + record.id + ',\'' + synchronization_flag + '\')" >同步运行</a>'; } function runFun(value, record, name) { var synchronization_flag = record.get('synchronization_flag'); return '<a href="javascript:outputFun(' + record.id + ',\'' + synchronization_flag + '\')" >运行</a>'; } function mailFun(value, record, name) { var report_header_id = record.get('report_header_id'); return '<a href="javascript:outputMail(' + report_header_id + ')" >发送</a>'; } function finnal_outputpreview(params) { params['winid'] = 'psr_report_preview_screen'; new Leaf.Window({ url: $('psr_report_preview_link').getUrl(), params: params, id: 'psr_report_preview_screen', fullScreen: true }); } function outputPreview(record_id) { var record = $('psr_report_headers_ds').findById(record_id); var report_header_id = record.get('report_header_id'), layout_code = record.get('layout_code'), width = record.get('width'), height = record.get('height'); var fullScreen = true; if (width && height) { fullScreen = false; } if (layout_code) { new Leaf.Window({ url: $('psr_report_parameter_preview_dynamic').getUrl(), title: '选择预览参数', params: { winid: 'psr_report_parameter_preview_dynamic_winid', report_header_id: report_header_id, layout_code: layout_code }, id: 'psr_report_parameter_preview_dynamic_winid', fullScreen: fullScreen, width: width, height: height, draggable: true }); } else { finnal_outputpreview({ report_header_id: report_header_id }); } } function reportEditorFun(value, record, name) { var report_header_id = record.get('report_header_id'); //var url = $('psr_report_create').getUrl() + '?report_header_id=' + report_header_id; return '<a href="javascript:outputEditor(' + report_header_id + ')" >编辑</a>'; //return '<a href="' + url + '" >编辑</a>'; } function outputEditor(report_header_id) { var url1 = $('psr_report_create').getUrl() + '?report_header_id=' + report_header_id; Leaf.request({ url: $('psr_report_check').getUrl(), para: { report_header_id: report_header_id }, success: function(res) { window.location.href = url1; }, error: function() { } }); } function reportDelFun(value, record, name) { var report_header_id = record.get('report_header_id'); return '<a href="javascript:reportDelFunction(' + report_header_id + ')" >删除</a>'; } function reportDelFunction(report_header_id) { Leaf.showConfirm('提示', '是否删除?', function okFun() { Leaf.request({ url: $('psr_report_delete').getUrl(), para: { report_header_id: report_header_id }, success: function(res) { queryFun(); }, error: function() { } }); }, function canFun() { }); } function synchronization_ajax_download_deal(report_id, path, name) { var file_path = path; var file_name_desc = name; file_path = file_path.replace(/\\/g, '/'); var index = file_path.lastIndexOf('/'); index = index + 1; var fileName = file_path.substring(index); if (!file_name_desc) { file_name_desc = fileName; } var download_url = '${/request/@context_path}/task_report/download?report_id=' + report_id + '&fileName=' + fileName + '&fileNameDesc=' + file_name_desc; Leaf.post(download_url); } function synchronization_ajax_report(params) { if (params['synchronization_flag'] == 'Y') { if (params['winid']) { Leaf.Masker.mask($(params['winid']).wrap, '${l:HLS.EXECUTING}'); } Ext.Ajax.request({ url: $('psr_report_output').getUrl(), params: { _request_data: Ext.util.JSON.encode({ parameter: params }) }, success: function(res) { var obj = eval('(' + res.responseText + ')'); if (obj.result.report_id) { synchronization_ajax_download_deal(obj.result.report_id, obj.result.file_path, obj.result.file_name); } else { alert(res.responseText); } if (params['winid']) { Leaf.Masker.unmask($(params['winid']).wrap); } } }); } else { Leaf.request({ url: $('psr_report_output').getUrl(), para: params, success: function(res) { Leaf.showMessage('${l:HLS.PROMPT}', '文件生成中,请稍后查看任务列表'); }, scope: this }); } } function outputFun(record_id, synchronization_flag) { var record = $('psr_report_headers_ds').findById(record_id); var report_header_id = record.get('report_header_id'), layout_code = record.get('layout_code'), width = record.get('width'), height = record.get('height'); var fullScreen = true; if (width && height) { fullScreen = false; } if (layout_code) { new Leaf.Window({ url: $('psr_report_parameter_dynamic').getUrl(), title: '选择运行参数', params: { winid: 'psr_report_parameter_dynamic_winid', report_header_id: report_header_id, layout_code: layout_code, synchronization_flag: synchronization_flag, function_code: 'PSR1020' }, id: 'psr_report_parameter_dynamic_winid', fullScreen: fullScreen, width: width, height: height, draggable: true }); } else { synchronization_ajax_report({ report_header_id: report_header_id, layout_code: layout_code, synchronization_flag: synchronization_flag }); } } function outputMail(id) { var param = {}; param['report_header_id'] = id; Leaf.request({ url: $('psr_report_mail').getUrl(), para: param, success: function(argss) { // Leaf.showMessage('${l:HAP_MESSAGE}', '发送成功'); }, failure: function(response, options) { Leaf.showMessage('${l:HAP_MESSAGE}', '错误'); }, scope: this }); } ]]></script> <!-- <a:screen-include screen="modules/cont/CON500/con_contract_authority_list_validate.lview?document_category=CONFIG_REPORT&function_code=PSR1020"/> --> <a:dataSets> <a:dataSet id="psr_view_range_code_ds" lookupCode="PSR_VIEW_RANGE_CODE"/> <a:dataSet id="psr_report_type_code_ds" lookupCode="PSR_REPORT_TYPE_CODE"/> <a:dataSet id="psr_report_headers_query_ds" autoCreate="true"> <a:fields> <a:field name="all_query_flag" defaultValue="Y"/> </a:fields> </a:dataSet> <a:dataSet id="psr_report_headers_ds" autoQuery="true" model="psr.PSR1010.psr_report_headers" pageSize="20" queryDataSet="psr_report_headers_query_ds"> <a:fields> <a:field name="view_range_dis" displayField="code_value_name" options="psr_view_range_code_ds" returnField="view_range" valueField="code_value"/> <a:field name="report_type_dis" displayField="code_value_name" options="psr_report_type_code_ds" returnField="report_type" valueField="code_value"/> </a:fields> <!-- <a:events> <a:event name="query" handler="aut_authority_list_validate_query"/> </a:events> --> </a:dataSet> </a:dataSets> <a:screenBody> <a:hBox> <a:form column="1" marginWidth="50" title="查询条件"> <a:textField name="report_header_name" bindTarget="psr_report_headers_query_ds" prompt="报表名称"/> </a:form> </a:hBox> <a:hBox> <a:button click="queryFun" text="查询"/> <a:button click="resetFun" text="重置"/> <!-- <a:button click="queryTask" text="查看任务"/> --> </a:hBox> <a:hBox> <a:table bindTarget="psr_report_headers_ds" marginWidth="50" navBar="true" width="1050"> <a:columns> <a:column name="report_header_name" align="center" percentWidth="20" prompt="报表名称"/> <a:column name="report_header_description" align="center" percentWidth="20" prompt="报表描述"/> <a:column name="view_range_dis" align="center" percentWidth="5" prompt="查看范围"/> <a:column name="report_type_dis" align="center" percentWidth="10" prompt="报表类型"/> <a:column name="report_creation_date" align="center" percentWidth="10" prompt="创建日期" renderer="Leaf.formatDate"/> <a:column name="report_view" align="center" percentWidth="5" prompt="预览" renderer="previewFun"/> <a:column name="report_run" align="center" percentWidth="6" prompt="运行" renderer="runFun"/> <!-- <a:column name="report_run1" align="center" percentWidth="6" prompt="同步运行" renderer="synchronization_runFun"/> --> <!-- <a:column name="report_run2" align="center" percentWidth="6" prompt="异步运行" renderer="asynchronization_runFun"/> --> <!-- <a:column name="report_mail" align="center" percentWidth="5" prompt="发送" renderer="mailFun"/> --> <a:column name="report_editor" align="center" percentWidth="5" prompt="编辑" renderer="reportEditorFun"/> <a:column name="report_del" align="center" percentWidth="5" prompt="删除" renderer="reportDelFun"/> </a:columns> </a:table> </a:hBox> </a:screenBody> </a:view> </a:screen>