excel_export_info.lview 3.31 KB
Newer Older
Spencer Chang's avatar
Spencer Chang committed
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
<?xml version="1.0" encoding="UTF-8"?>

<!--
    $Author: chenlingfeng7543
$Date: 2019-02-26 10:11:00
$Revision: 1.0
$Purpose: 异步导出
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" dynamiccreateenabled="true" trace="true">
    <a:init-procedure>
        <a:model-query fetchAll="true" model="basic.get_sys_default_time" rootPath="sys_default_time"/>
    </a:init-procedure>
    <a:view>
        <a:link id="sys3010_create_excel_atm_link" model="sys.SYS3010.create_excel_atm" modelaction="update"/>
        <a:link id="sys3010_download_link_id" url="${/request/@context_path}/atm_download.lsc"/>
        <script src="${/request/@context_path}/javascripts/hap/dynamicStopAutoQuery.js" type="text/javascript"/>
        <script type="text/javascript"><![CDATA[

        function create_excel_atm(id, name) {
            var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
            var ds = record.ds;

            var download_url = $('sys3010_download_link_id').getUrl();
            if (!record.get('attachment_id')) {
                window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
                Leaf.request({
                    url: $('sys3010_create_excel_atm_link').getUrl(),
                    para: {
                        table_pk: record.get('export_id'),
                        table_name: 'EXCEL_EXPORT_INFO',
                        file_type_code:record.get('file_type') ,
                        file_name: record.get('file_name_t'),
                        file_path: record.get('save_path')
                    },
                    success: function (res) {
                        window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                        ds.query(ds.currentPage);
                        if(res.result.attachment_id){
                        Leaf.go(download_url+'?attachment_id='+res.result.attachment_id);
                        }
                    },
                    failure: function () {
                        window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                    },
                    error: function () {
                        window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                    },
                    scope: this
                });
            }else{
                Leaf.go(download_url+'?attachment_id='+record.get('attachment_id'));
            }
        }

        //超链接渲染
        window['${/parameter/@bp_seq}${/parameter/@layout_code}_dynamic_link_renderer'] = function (value, record, name, config_record, bp_seq) {
            var link_function = '';
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_hls_link_render_record'][record.id + '---' + name] = record;
            if (name == 'download_atm') {
                if(record.get('status') == 'FINISH'){
                link_function = 'create_excel_atm';
                return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\');">' + config_record.get('prompt') + '</a>';
                }
                return '';
                }
        };
        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>