<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: lpc 9874
    $Date: $
    $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="con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
        <a:link id="con_contract_modify_link" url="${/request/@context_path}/modules/cont/CON505/con_contract_modify.lview"/>
        <a:link id="car_modify_special_link" url="${/request/@context_path}/modules/prj/PRJ500N/prj_project_create.lview"/>
        <a:link id="con_contract_storage_apply_link" url="${/request/@context_path}/modules/cont/CON570/con_contract_storage_apply.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'] = 'CON301'; /* param['function_usage'] = 'QUERY'; */
                param['maintain_type'] = 'UPDATE';
                param['url_title'] = '${l:CON301.CONTRACT_DETAIL}';
                hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, 'con_contract_modify_link', null);
            }
            
            function open_project_Window(record_id, ds_id) {

                var record = $(ds_id).findById(record_id);
                var param = {};
                param['company_id'] = record.get('company_id');
                param['project_id'] = record.get('project_id');
                param['function_code'] = 'PRJ502D';
                param['function_usage'] = 'QUERY';
                param['bp_class'] = record.get('bp_class');
                param['maintain_type'] = 'QUERY';
                /*  param['window_open_flag'] = 'Y';
                 param['show_history_flag'] = 'Y'; */
                param['url_title'] = '${l:HLS.PROJECT_MAITAIN}';
                hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, 'car_modify_special_link', ds_id, '${/parameter/@layout_code}');
            }
            
            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>';
                }
                if (name == 'project_number' && value) {
                    return '<a href="javascript:open_project_Window(\'' + record.id + '\',\'' + record.ds.id + '\')">' + value + '</a>';
                }
                return value;
            };
            
            
            //归档
            window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function() {
                var records = $('CONTRACT_CONTENT_ENTRANCE_G_CONTRACT_CONTENT_RESULT_con_contract_ds').getSelected();
                // if (records.length != 1) {
                    // Leaf.showMessage('${l:HLS.PROMPT}', '请选择一个合同进行归档操作！');
                    // return;
                // }

                var url = $('con_contract_storage_apply_link').getUrl();
                var contract_id = records[0].get('contract_id');
                var cdd_list_id = records[0].get('cdd_list_id');
                var win = new Leaf.Window({
                    id: 'con_contract_storage_apply_window',
                    url: url,
                    params: {
                        contract_id: contract_id,
                        cdd_list_id: cdd_list_id
                    },
                    title: '资料收集',
                    fullScreen: true
                });
                win.on('close', function() {
                    // $('con_contract_v_for_query_result_ds').query();
                });
            };
        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>
