<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author:   
    $Date: 2014-8-4 下午01:58:31  
    $Revision: 1.0  
    $Purpose: 商业伙伴查询
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" dynamiccreateenabled="true" trace="true">
    <a:view>
        <a:link id="hls_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
        <a:link id="hls_get_law_number_link_id" model="leg.LEG100.leg_get_law_number" modelaction="execute"/>
        <a:link id="hls_welcome" url="${/request/@context_path}/welcome.lview"/>
        <a:link id="leg_create_link_id" url="${/request/@context_path}/modules/leg/LEG100/leg_application_create.lview"/>
        <script type="text/javascript"><![CDATA[
            function open_contract_win(ds_id, record_id) {
                var record = $(ds_id).findById(record_id);
                var param = record.data;
            
                param['function_code'] = 'LEG102';
                param['function_usage'] = 'CREATE';
                param['url_title'] = '法务申请创建';
                param['master_type'] = 'LEGAL_ACTION';
                param['master_id'] = param['contract_id'];
                hls_doc_get_layout_code('hls_get_layout_code_link_id', param, 'leg_create_link_id', ds_id);
            }
            
            
            window['${/parameter/@layout_code}_dynamic_link_renderer'] = function(value, record, name, config_record) {
                if (name == 'contract_number' && value) {
                    return '<a href="javascript:open_contract_win(\'' + record.ds.id + '\',\'' + record.id + '\')">' + value + '</a>';
                }
                return value;
            };
            //
            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 records = $(ds_id).getSelected();
                var datas = [];
                for(i=0;i<records.length;i++){
                    var obj = {};
                    obj['contract_id'] = record.get('contract_id');
                    obj['_status'] = 'update';
                    datas[i] = obj;
                }
                window['${/parameter/@bp_seq}${/parameter/@layout_code}_lock_layout_dynamic_window']();
                 Leaf.request({
                    url: $('con733_create_debt_exemption_link').getUrl(),
                    para: datas,
                    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);
                      window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                        return;
                    },
                    failure: function() {
                   window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                    },
                    error: function() {
                        window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                    },
                    scope: this
                });
                
                if(records.length != 1){
                    Leaf.showMessage("${l:PROMPT}", "请选择单条记录!");
                }else{
                    open_contract_win(ds_id, records[0].id);
                }
            };
            
            
         
            
            
            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 == $(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=LEG100"/>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>