<?xml version="1.0" encoding="UTF-8"?>
<a:screen xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" customizationEnabled="true" dynamiccreateenabled="true" trace="true">
    <a:init-procedure>
        <s:server-script import="con_print_path.js"><![CDATA[
            set_parameter_file_path();
        ]]></s:server-script>
    </a:init-procedure>
    <a:view>
        <a:link id="${/parameter/@layout_code}_con_collection_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
        <a:link id="${/parameter/@layout_code}_con_open_detail_id" url="${/request/@context_path}/modules/cont/CON636/con_collection_last_detail.lview"/>
        <a:link id="${/parameter/@layout_code}_hls_doc_file_content_link_id" model="cont.CON632C.con632_hls_doc_file_content" modelaction="update"/>
        <a:link id="${/parameter/@layout_code}_hls_doc_file_batch_create_print_link_id" url="${/request/@context_path}/modules/cont/CON632C/hls_doc_file_batch_create.lsc"/>
        <a:link id="${/parameter/@layout_code}_hls_doc_batch_download_pdf_print_link_id" url="${/request/@context_path}/modules/cont/CON632C/hls_doc_batch_download_pdf.lsc"/>
        <script type="text/javascript"><![CDATA[
            function con_openwin(ds_id) {
                var record = $(ds_id).getCurrentRecord();

                param = record.data;
                param['function_code'] = 'CON636D';
                param['function_usage'] = 'MODIFY';
                param['collection_id'] = record.get('collection_id');
                param['url_title'] = '车辆管理岗确认';
                hls_doc_get_layout_code('${/parameter/@layout_code}_con_collection_get_layout_code_link_id', param, '${/parameter/@layout_code}_con_open_detail_id', ds_id);
            }
            
            window['${/parameter/@layout_code}_dynamic_link_renderer'] = function(value, record, name, config_record) {
                if (name == 'tool_number' && value) {
                    return '<a href="javascript:con_openwin(\'' + record.ds.id + '\')">' + value + '</a>';
                }
                return value;
            };
            
             window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function() {
                var content_id;
                var con_collection_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_collection_tool');
                var record = $(con_collection_id).getCurrentRecord();
                var  collection_id=record.get('collection_id')
                Leaf.request({
                    url: $('${/parameter/@layout_code}_hls_doc_file_content_link_id').getUrl(),
                    para: {
                        content_id: content_id,
                        document_table: 'con_collection_tool',
                        document_id: collection_id,
                        temp_code:'COL_TAKE_CAR'
                    },
                    success: function(rsc) {
                        Leaf.request({
                            url: $('${/parameter/@layout_code}_hls_doc_file_batch_create_print_link_id').getUrl(),
                            para: {
                                document_id: collection_id,
                                document_table: 'con_collection_tool',
                                batch_flag: 'Y',
                                source_type: 'COMMON'
                            },
                            success: function(res) {
                                var url_l = $('${/parameter/@layout_code}_hls_doc_batch_download_pdf_print_link_id').getUrl() + '?content_id=' + rsc.result.content_id + '&download_file_flag=Y&file_path=${/parameter/@file_path}&source_type=COMMON&type=SIN&fnd_atm_flag=Y';
                                window.open(href = url_l, target = "_self");
                            }
            
                        });
                    }
                });
            };
        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>
