<?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:init-procedure>
        <a:model-query fetchAll="true" model="leg.LEG600.get_sysdate" rootPath="sysdate"/>
    </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="pageLink_bpQueryScreen_welcome" url="${/request/@context_path}/welcome.lview"/>
        <a:link id="con_contract_update_link_id" url="${/request/@context_path}/modules/cont/CON301/con_contract_query_n.lview"/>
        <a:link id="leg400_downloadFile_id" url="${/request/@context_path}/downloadFile.lview"/>
        <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');
                var record = $(ds_id).getCurrentRecord();
                var param = new Object();
                param['contract_id'] = ${/parameter/@contract_id};
                maintain_type = 'READONLY';
                param['function_code'] = 'CON301R';
                param['function_usage'] = 'MODIFY';
                param['url_title'] = '合同明细';
                url_l = 'con_contract_update_link_id';
                param['maintain_type'] = maintain_type;
                //
                new Leaf.Window({
                    id: 'con_get_layout_code_winid',
                    params: param,
                    url: $('con_contract_update_link_id').getUrl(),
                    title: param['url_title'] + '(' + 'CONTRACT_QUERY' + ')',
                    fullScreen: true,
                    draggable: true
                });
                // hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, url_l);
            
            };
            
            function open_bp_modify_win(ds_id, record_id) {
                var record = $(ds_id).findById(record_id);
                var param = record.data;
            
            }
            
            function open_attachment_win(ds_id, record_id) {
            
                var record = $(ds_id).findById(record_id);
                var param = record.data;
                var url_id = 'leg400_downloadFile_id';
            
                var url = $(url_id).getUrl() + '?table_name=LEG_LEGAL_LETTER&header_id=' + param['legal_letter_id'];
                new Leaf.Window({
                    url: url,
                    title: '附件',
                    id: 'leg_legal_letter_id',
                    width: 850,
                    height: 400
                });
            }
            
            window['${/parameter/@layout_code}_dynamic_link_renderer'] = function(value, record, name, config_record) {
                if (name == 'contract_number') {
                    return '<a href="javascript:open_bp_modify_win(\'' + record.ds.id + '\',\'' + record.id + '\')">' + value + '</a>';
                }
                if (name == 'attachment') {
                    return '<a href="javascript:open_attachment_win(\'' + record.ds.id + '\',\'' + record.id + '\')">' + '附件' + '</a>';
                }
            
                return value;
            };
            
            
            
            //新增和加载时调用(form)
            window['${/parameter/@layout_code}_on_layout_dynamic_form_add_and_load'] = function(ds, record, config_records, bp_seq) {
                var law_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract_law');
            
                var law_record = $(law_ds_id).getCurrentRecord();
            
                law_record.set('country_id', 32);
                law_record.set('country_id_n', '中国');
            };
            
            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=LEGAL_ACTION&amp;function_code=LAW_CREATE_01&amp;custom_code=LEG100D"/>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>