<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author:  Yimeng
    $Date: 2015-05-6 下午01:58:31  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" dynamiccreateenabled="true" trace="true">
    <a:init-procedure/>
    <a:view>
        <a:link id="con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
        <a:link id="con_contract_update_link_id" url="${/request/@context_path}/modules/cont/CON501N/con_contract_modify.lview"/>
        <a:link id="con_contract_penatly_link" url="${/request/@context_path}/modules/cont/CON733/con_contract_penatly_change_detail.lview"/>
        <a:link id="con733_create_debt_exemption_link" model="cont.CON733.con_create_debt_exemption" modelaction="execute"/>
        <a:link id="con_contract_copy_link" model="cont.CON733.con_create_debt_exemption" modelaction="update"/>
        <script type="text/javascript"><![CDATA[
            
            window['${/parameter/@layout_code}_con733_contract_query'] = function(id, name) {
                var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
                var param = record.data;
                param['document_id'] = record.get('contract_id');
                param['function_code'] = 'CON301';
                param['function_usage'] = 'QUERY';
                param['maintain_type'] = 'READONLY';
                param['url_title'] = '${l:CON301.CONTRACT_DETAIL}';
                hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, 'con_contract_update_link_id');
            };
            
            //超链接
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_dynamic_link_renderer'] = function(value, record, name, config_record, bp_seq) {
                var link_function = '${/parameter/@layout_code}_con733_contract_query';
                window['${/parameter/@bp_seq}${/parameter/@layout_code}_hls_link_render_record'][record.id + '---' + name] = record;
                if (name == 'contract_number') {
                    return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\');">' + record.get('contract_number') + '</a>';
                }
            };
            
            //罚息免除处理
            window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function() {
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract');
                //
                  
                var record = $(ds_id).getSelected();
                var contract_ids = '';
                if (record.length == 0){
                    Leaf.showMessage('${l:PROMPT}','请先选择一条数据！');
                    return;
                }
                for(i=0 ; i<record.length-1 ; i++){
                    contract_ids = contract_ids + record[i].get('contract_id') + ',';
                }
                contract_ids = contract_ids + record[record.length-1].get('contract_id');
                
                Leaf.request({
                    url: $('con_contract_copy_link').getUrl(),
                    para: {contract_id: contract_ids},
                    success:function(){},
                    scope:this,
                    sync:true
                });
				
                Leaf.Masker.mask(Ext.getBody());
                 Leaf.request({
                    url: $('con733_create_debt_exemption_link').getUrl(),
                    para: {contract_id: record[0].get('contract_id')},
                    success: function(res) {
                        var param = {
			                function_code: 'CON733W',
			                change_req_id: res.result.change_req_id,
			                document_id: res.result.change_req_id,
					        contract_id: record[0].get('contract_id'),
			                document_type: 'DEBT_EXEMPTION_REQ',
			                layout_code: 'CCR_DEBT_EXEMPTION_1',
			                url_title: '罚息免除'
		                };
		                hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, 'con_contract_penatly_link',ds_id);
                        Leaf.Masker.unmask(Ext.getBody());
                        return;
                    },
                    failure: function() {
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    error: function() {
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    scope: this
                });
            };
            
            
              window['${/parameter/@layout_code}_on_layout_dynamic_grid_query'] = function(ds, qpara, bp_seq) {
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract');
            
                if (ds.id == ds_id) {
                    aut_authority_list_validate_query(ds, qpara);
            
                }
            };
        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_authority_list_validate.lview?document_category=CONTRACT&amp;function_code=CON733"/>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>
