<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zlf 
    $Date: 2014-11-10 下午5:42:24  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" dynamiccreateenabled="true" trace="true">
    <a:view>
        <a:link id="contract_lease_item_query_link" url="${/request/@context_path}/modules/cont/CON504/con_lease_item_query.lview"/>
        <a:link id="contract_history_window_link" url="${/request/@context_path}/modules/cont/CON501N/con_document_history_query.lview"/>
        <a:link id="con505_hls_bp_master_query_link" url="${/request/@context_path}/modules/cont/CON505/hls_bp_master_query.lview"/>
        <a:link id="con_contract_update_print_detail_link_id" url="${/request/@context_path}/modules/cont/CON504/con_contract_content_confirm.lview"/>
        <a:link id="con504_change_confirm_status_link" model="cont.CON504.con_change_content_confirm_status" modelaction="execute"/>
        <a:link id="con_contract_get_layout_code_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
        <script type="text/javascript"><![CDATA[
            
            
            window['${/parameter/@layout_code}_dynamic_link_renderer'] = function(value, record, name, config_record, bp_seq) {
                var link_function = '';
                window['${/parameter/@layout_code}_hls_link_render_record'][record.id + '---' + name] = record;
                if (name == 'bp_link' && record.get('bp_id') && record.get('record_id')) {
                    link_function = '${/parameter/@layout_code}_open_bp_detail_window';
                    return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\');">' + config_record.get('prompt') + '</a>';
                } else if (name == 'car_detail' && record.get('contract_lease_item_id')) {
                    link_function = '${/parameter/@layout_code}_open_lease_item_detail_window';
                    return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\');">' + config_record.get('prompt') + '</a>';
                }
            };
            
            window['${/parameter/@layout_code}_open_lease_item_detail_window'] = function(id, name) {
                var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
                var param = record.data;
                var contract_lease_item_id = record.get('contract_lease_item_id');
                new Leaf.Window({
                    id: 'contract_lease_item_maintain_window',
                    url: $('contract_lease_item_query_link').getUrl(),
                    params: {
                        contract_lease_item_id: contract_lease_item_id,
                        winid: 'contract_lease_item_maintain_window'
                    },
                    draggable: true,
                    fullScreen: true
                });
            };
            
            window['${/parameter/@layout_code}_open_bp_detail_window'] = function(id, name) {
                var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
                var param = record.data;
                param['function_code'] = 'CON505H';
                param['function_usage'] = 'MODIFY';
                param['url_title'] = '${l:HLS212.BP_MASTER_MAINTAIN}';
                hls_doc_get_layout_code('con_contract_get_layout_code_id', param, 'con505_hls_bp_master_query_link', record.ds.id);
            };
            
            
            // function open_contract_window(record_id, ds_id) {
            
                // var record = $(ds_id).findById(record_id);
            
                // var param = record.data;
                // var contract_lease_item_id = record.get('contract_lease_item_id');
                // new Leaf.Window({
                    // id: 'contract_lease_item_maintain_window',
                    // url: $('contract_lease_item_maintain_link').getUrl(),
                    // params: {
                        // contract_lease_item_id: contract_lease_item_id
                    // },
                    // fullScreen: true
                // });
                // // param['function_code'] = 'CON501D';
                // // param['function_usage'] = 'MODIFY';
                // // param['maintain_type'] = 'UPDATE';
                // // param['url_title'] = '${l:CON301.CONTRACT_DETAIL}';
                // // hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, 'con_contract_modify_link',ds_id);
            // }
        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>
