<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zhangyu  
    $Date: 2016-11-10 下午14:26:12  
    $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="prj_project_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
        <a:link id="prj_project_modify_link" url="${/request/@context_path}/modules/prj/PRJ501N/prj_project_create_tree_n.lview"/>
        <a:link id="hn_get_project_close_id_link" model="prj.PRJ900.hn_project_close" modelaction="update"/>
        <a:link id="prj900_project_close_new_en_link" url="${/request/@context_path}/modules/prj/PRJ900/hn_project_close_modify.lview"/>
        <script type="text/javascript"><![CDATA[
            function open_project_modify_win(record_id, ds_id) {
                var record = $(ds_id).findById(record_id);
                var maintain_type = 'READONLY';
                var param = record.data;
                param['document_id'] = record.get('project_id');
                param['function_code'] = 'PRJ505';
                param['function_usage'] = 'QUERY';
                param['cond_para2'] = record.get('hn_industry_classification');
                param['maintain_type'] = maintain_type;
                param['url_title'] = '${l:HLS.PROJECT_MAITAIN}';
                param['prj_report_read_flag'] = 'Y';
                hls_doc_get_layout_code('prj_project_get_layout_code_link_id', param, 'prj_project_modify_link');
            }
            
            window['${/parameter/@layout_code}_dynamic_link_renderer'] = function(value, record, name, config_record) {
                if (name == 'project_number' && value) {
                    return '<a href="javascript:open_project_modify_win(\'' + record.id + '\',\'' + record.ds.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'], 'prj_project');
                var prj_project_result_ds = $(ds_id);
                var records = prj_project_result_ds.getSelected();
                if (records.length != 1) {
                    Leaf.showMessage('${l:PROMPT}', '${l:HLS.SELECT_RECORD}');
                    return;
                }
                var record = records[0];
                window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
                Leaf.request({
                    url: $('hn_get_project_close_id_link').getUrl(),
                    para: {
                        project_id: record.get('project_id')
                    },
                    success: function(res) {
                        var param = {};

                        param['function_code'] = 'PRJ900_NEW';
                        //alert(res.result.get('prj_close_id'));
                        param['prj_close_id'] = res.result['prj_close_id'];
                        param['function_usage'] = 'UPDATE';
                        param['url_title'] = '项目关闭维护';
                        param['winid'] = 'prj900_project_close_new_en_link_id';
                        param['screen_height'] = '400';
                        param['screen_width'] = '600';
                        hls_doc_get_layout_code('prj_project_get_layout_code_link_id', param, 'prj900_project_close_new_en_link', ds_id);
                        window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                    },
                    error: function(res) {
                        window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                    },
                    faliure: function() {
                        window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                    },
                    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'], 'prj_project');
            
                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=PROJECT&amp;function_code=PRJ501"/>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>