<?xml version="1.0" encoding="UTF-8"?>
<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="${/parameter/@layout_code}con_contract_query_link"
                url="${/request/@context_path}/modules/cont/CON505/con_contract_modify.lview"/>
        <script src="${/request/@context_path}/javascripts/hap/dynamicStopAutoQuery.js" type="text/javascript"/>

        <script type="text/javascript"><![CDATA[
        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;
        };
        function open_contract_win(ds_id, record_id) {
            var record = $(ds_id).findById(record_id);
            var param = record.data;
            param['function_code'] = 'CON301';
            param['function_usage'] = 'QUERY';
            param['winid'] = 'con_contract_modify_win_id';
            param['url_title'] = '${l:CON301.CONTRACT_DETAIL}';
            hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, '${/parameter/@layout_code}con_contract_query_link', ds_id);
        }

        window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function() {
            var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'GENERAL');
            var record=$(ds_id).getAt(0);
            if(record.get('due_date_from')&&record.get('due_date_to')&&record.get('base_date')){
                var ds = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract');
                $(ds).setQueryUrl("${/request/@context_path}/autocrud/cont.CON3300.contract_item_report_query/query");
               $(ds).setQueryParameter('due_date_from',record.get('due_date_from'));
               $(ds).setQueryParameter('due_date_to',record.get('due_date_to'));
               $(ds).setQueryParameter('base_date',record.get('base_date'));
                $(ds).setQueryParameter('business_type',record.get('business_type'));
                $(ds).query();
            }else{
                $L.showInfoMessage("提示",'请输入字段：租赁开始日从、租赁开始日到、基准日!');
            }
        }

        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>
