<?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="loan_fee_modify_link"
                url="${/request/@context_path}/modules/lon/LON140/loan_fee_modify.lview"/>
        <a:link id="get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
        <a:link id="insert_loan_fee_link" model="lon.lon140.insert_loan_fee" modelaction="batch_update"/>
        <script type="text/javascript"><![CDATA[
        window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function () {
            var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'tre_loan_contract');
            var records = $(ds_id).getSelected();
            if (records.length == 0) {
                Leaf.showMessage('${l:PROMPT}', '请选择一行数据');
                return;
            }
            var datas = [];
            for (var i = 0; i < records.length; i++) {
                var obj = {};
                obj['loan_contract_id'] = records[i].get('loan_contract_id');
                obj['_status'] = 'update';
                datas[i] = obj;
            }
            Leaf.request({
                url: $('insert_loan_fee_link').getUrl(),
                para: datas,
                success: function (res) {
                    window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                    Leaf.SideBar.show({
                        msg: '${l:HLS.SUBMIT_SUCCESS}',
                        duration: 2000
                    });
                    var param = {};
                    param['function_code'] = 'LON140M';
                    param['function_usage'] = 'CREATE';
                    param['url_title'] = '融资合同还款';
                    param['winid'] = 'lon140_loan_fee_create_winid';
                    hls_doc_get_layout_code('get_layout_code_link_id', param, 'loan_fee_modify_link', ds_id);
                },
                failure: function () {
                    window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                },
                error: function () {
                    window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                },
                scope: this
            });
        };

        window['${/parameter/@layout_code}_user_button2_layout_dynamic_click'] = function () {
            var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'tre_loan_contract');
            var param = {};
            param['function_code'] = 'LON140M';
            param['function_usage'] = 'MODIFY';
            param['url_title'] = '融资合同还款维护';
            param['winid'] = 'lon140_loan_fee_modify_winid';
            hls_doc_get_layout_code('get_layout_code_link_id', param, 'loan_fee_modify_link', ds_id);
        };

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