<?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="${/parameter/@layout_code}_hls214n_uploadFile_id" url="${/request/@context_path}/downloadFile.lview"/>
        <a:link id="${/parameter/@layout_code}_hls214n_approved_id" model="hls.HLS223.approve_bp_taxpayer_request" modelaction="batch_update"/>
        <script type="text/javascript"><![CDATA[
             function hls223_attachment_link_fun(bp_id){
                var url = $('${/parameter/@layout_code}_hls214n_uploadFile_id').getUrl() + '?table_name=HLS_BP_MASTER&header_id=' + bp_id;
	             var win = new Leaf.Window({
                        url: url,
                        title: '${l:ATM.UPLOAD_ATTACHMENT}',
                        id: '${/parameter/@layout_code}_hls214n_uploadFile_screen_id',
                        width: 600,
                        height: 400
                    }); 
             }
            //超链接渲染
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_dynamic_link_renderer'] = function(value, record, name, config_record, bp_seq) {
                if (name == 'attachment') {
                    var bp_id = record.get('bp_id');
                    return '<a href="javascript:hls223_attachment_link_fun(' + bp_id +');">'+config_record.get('prompt')+'</a>';
                }
            };
            
            window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function() {
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_bp_master');
                var rs = $(ds_id).getSelected();
                if (rs.length < 1) {
                    Leaf.showMessage('${l:PROMPT}', '${l:HLS.SELECT_RECORD}');
                    return;
                }
                var datas = [];
                for(var i=0;i<rs.length;i++)
                {
                    var obj={};
                    obj['bp_id']=rs[i].get('bp_id');
                    obj['_status']='update';
                    datas[i]=obj;
                }
                Leaf.Masker.mask(Ext.getBody(), '${l:HLS.EXECUTING}');
                Leaf.request({
                    url: $('${/parameter/@layout_code}_hls214n_approved_id').getUrl(),
                    para:datas,
                    success: function(res) {
                        Leaf.Masker.unmask(Ext.getBody());
                        parent.Leaf.SideBar.enable = true;
                        parent.Leaf.SideBar.show({
                            msg: '${l:HLS.SUBMIT_SUCCESS}',
                            duration: 2000
                        });
                        $(ds_id).query();
                    },
                    failure: function() {
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    error: function() {
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    scope: this
                });
            };
            
        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>
