<?xml version="1.0" encoding="UTF-8"?>

<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" dynamiccreateenabled="true"
          trace="true">
    <a:view>
        <a:link id="tre_withdrawal_tre_withdrawal_con_contract_get_layout_code_link_id"
                model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
        <a:link id="import_upload_link"
                url="${/request/@context_path}/modules/tre/TRE505/tre_situation_import_upload.lview"/>

        <script type="text/javascript"><![CDATA[

        window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function () {
            var ds_id1 = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'tre_loan_con_withdrawal_plan');
            var record = $(ds_id1).getCurrentRecord();

            if (record.get('widthdrawal_wfl_status') == 'CONFIRM') {
                Leaf.showMessage('提示', '已确认的单据不能导入还款计划!');
                return;
            }
            var win = new Leaf.Window({
                id: 'upload_window',
                url: $('import_upload_link').getUrl(),
                params: {
                    'winid': 'upload_window',
                    'widthdrawal_plan_id': '${/parameter/@widthdrawal_plan_id}'
                },
                title: '导入实例',
                width: 420,
                height: 275
            });
            win.on('close', function () {
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'tre_loan_con_repayment_plan');
                $(ds_id).setQueryParameter('widthdrawal_id', '${/parameter/@widthdrawal_plan_id}');
                $(ds_id).query();
            });


        };


        //        window['${/parameter/@layout_code}_on_layout_dynamic_grid_load'] = function (ds, record, config_records, bp_seq) {
        //
        //            window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
        //            var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'tre_loan_con_repayment_plan');
        //            if (ds_id) {
        //                $(ds_id).setQueryParameter('widthdrawal_id','${/parameter/@widthdrawal_plan_id}');
        //                $(ds_id).query();
        //            }
        //            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
        //        };

        //            //超链接渲染
        //            window['${/parameter/@layout_code}_dynamic_link_renderer'] = function(value, record, name, config_record) {
        //                var link_function = '';
        //                window['${/parameter/@layout_code}_hls_link_render_record'][record.id + '---' + name] = record;
        //                if (name == 'tre_loan_con_quotaion_quote' && !record.isNew) {
        //                    link_function = 'tre_loan_con_quotaion_quote';
        //                    return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>';
        //                }else if(name == 'main_quote' && !record.isNew){
        //                    link_function = 'tre_loan_con_main_quote';
        //                    return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>';
        //                }else if(name == 'contract_info' && !record.isNew){
        //                    link_function = 'tre_loan_contract_info';
        //                    return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>';
        //                }else if(name == 'withdraw_info' && !record.isNew) {
        //                    link_function = 'withdraw_info';
        //                    return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>';
        //                }
        //
        //            };

        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>