<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: xuls  
    $Date: 2017-5-3 下午1:17:11  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" dynamiccreateenabled="true">
    <a:init-procedure/>
    <a:view>
        <a:link id="con517_delete_link" model="db.con_cashflow_pkg.delete_cahsflow" 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'], 'con_contract_cashflow');
                var cashs_ds = $(ds_id).getSelected();
                var param = {};
                var saveData = [];
                var record;
                var cashflow_id;
                Leaf.showConfirm('提示', '是否确认要删除？', function() {
                    for (var i = 0;i < cashs_ds.length;i++) {
                        record = cashs_ds[i];
                        var cashflow_id = record.get('cashflow_id');
                        if(cashflow_id){
                        	saveData.push({
                            '_status':'delete',
                            'cashflow_id':record.get('cashflow_id')
                        	});    
                        }
                    }
                    Leaf.request({
                        url: $('con517_delete_link').getUrl(),
                        para: saveData,
                        success: function() {
                            Leaf.SideBar.show({
                                msg: '${l:HLS.SUBMIT_SUCCESS}',
                                duration: 2000
                            });
                            $(ds_id).query();
                            Leaf.Masker.unmask($('${/parameter/@winId}').wrap);
                        },
                        failure: function() {
                            Leaf.Masker.unmask($('${/parameter/@winId}').wrap);
                        },
                        error: function() {
                            Leaf.Masker.unmask($('${/parameter/@winId}').wrap);
                        },
                        scope: this
                    });
                });
            };
		]]></script>
    </a:view>
</a:screen>
