rpt5014_report_print.lview 4.02 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: niminmin
    $Date: 2018-12-20 上午9:30:25  
    $Revision: 1.0  
    $Purpose: 三期管理表打印
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" customizationEnabled="true" trace="true">
    <a:init-procedure><![CDATA[
    ]]></a:init-procedure>
    <a:view>
        <a:link id="rpt5012_print_link_id" model="rpt.RPT5012.rpt5012_result_query" modelaction="execute"/>
        <script><![CDATA[
            function rpt5014_reset() {
                $('rpt5014_query_ds').reset();
            }
            
            function ref_n01_time(record, name, value) {
                var reg = /^\d\d\d\d\d\d$/;
                if (reg.test(value)) {
                    return true;
                }
                return '时间格式应为【yyyymm】,举例【201812】';
            }
            
            function rpt5014_print() {
                debugger;
               // Leaf.Masker.mask(Ext.getBody(), '${l:BEING_IMPLEMENTED}');
                var record = $('rpt5014_query_ds').getAt(0);
                if (!record) {
                    Leaf.Masker.unmask(Ext.getBody());
                    Leaf.showMessage('${l:PROMPT}', '年月未填写');
                    return;
                }
                var month = record.get('month');
                if (!month) {
                    Leaf.Masker.unmask(Ext.getBody());
                    Leaf.showMessage('${l:PROMPT}', '年月未填写');
                    return;
                }

                Leaf.request({
                    url: $('rpt5012_print_link_id').getUrl(),
                    para: {
                        month: month
                    },
                    success: function(res) {
                        $('rpt5014_prin_btn_id').disable();
                        Leaf.Masker.unmask(Ext.getBody());
                        var cur_begin = Leaf.formatDate(res.result.cur_begin),
                            cur_end = Leaf.formatDate(res.result.cur_end),
                            before_begin = Leaf.formatDate(res.result.before_begin),
                            before_end = Leaf.formatDate(res.result.before_end);
                        var url = '${/request/@context_path}/modules/rpt/RPT5014/export_excel_sheets.lsc?month=' + month+ '&cur_begin=' + cur_begin+ '&cur_end=' + cur_end+ '&before_begin=' + before_begin+ '&before_end=' + before_end+'&file_name=' + month + '三期管理表.xls';
                        window.open(encodeURI(url), '_self');
                        $('rpt5014_prin_btn_id').enable();
                    },
                    error: function() {
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    failure: function() {
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    scope: this
                });


            }
            

        ]]></script>
        <a:dataSets>
            <a:dataSet id="four_month_date_ds" loadData="true" model="rpt.RPT5010.rpt5010_four_month"/>
            <a:dataSet id="rpt5014_query_ds">
                <a:fields>
                    <a:field name="month"/>
                    <a:field name="month_desc" displayField="value_name" options="four_month_date_ds" required="true" returnField="month" valueField="value_code"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton id="rpt5014_prin_btn_id" click="rpt5014_print" text="打印"/>
                <a:gridButton  click="rpt5014_reset" text="HLS.RESET"/>
<!--                <a:gridButton click="rpt5110_run_job" text="发起校准任务"/>-->
            </a:screenTopToolbar>
            <a:form Width="250" column="1" labelWidth="100" title="条件" width="300">
                <a:comboBox name="month_desc" bindTarget="rpt5014_query_ds" prompt="年月"/>
            </a:form>
        </a:screenBody>
    </a:view>
</a:screen>