<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: Administrator  
    $Date: 2016-5-18 下午3:41:00  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" dynamiccreateenabled="true" trace="true">
    <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="prj811_project_side_new_en_link_id" url="${/request/@context_path}/modules/prj/PRJ811/hn_prj_project_side_new_en.lview"/>
        <a:link id="prj_project_modify_link" url="${/request/@context_path}/modules/prj/PRJ501N/prj_project_create_tree_n.lview"/>
        <a:link id="prj811d_project_side_detail_modify_link_id" url="${/request/@context_path}/modules/prj/PRJ811/hn_project_side_detail.lview"/>
        <a:link id="prj811d_project_side_delete_link_id" model="prj.PRJ811.hn_create_project_side" modelaction="delete"/>
        <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'], 'hn_prj_project_side');
                var param={};
                param['function_code'] = 'PRJ811D';
                //param['document_id'] = record.get('project_id');
                param['function_usage'] = 'UPDATE';
                //param['maintain_type'] = maintain_type;
                param['url_title'] = '项目补充新增';
                param['winid']='prj811d_prj_project_side_new_en_link';
                param['screen_height']='280';
                param['screen_width']='400';
                hls_doc_get_layout_code('prj_project_get_layout_code_link_id', param, 'prj811_project_side_new_en_link_id', ds_id);
            };
            
            
            //项目补充新增
            window['${/parameter/@layout_code}_user_button2_layout_dynamic_click'] = function() {
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hn_prj_project_side');
                var record=$(ds_id).getSelected()[0];
                  Leaf.showConfirm('${l:HLS.PROMPT}', '确认删除当前申请吗?', function() {
                  window['${/parameter/@bp_seq}${/parameter/@layout_code}_lock_layout_dynamic_window']();
                    Leaf.request({
                        url: $('prj811d_project_side_delete_link_id').getUrl(),
                        para: {
                            prj_side_id: record.get('prj_side_id')
                        },
                        success: function() {
                             window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                             $(ds_id).query();
                             
                        } ,
                        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
                    });
                });
            };
            
            
               function open_project_side_win(record_id, ds_id,flag) {
                var record = $(ds_id).findById(record_id);
                 var win = new Leaf.Window({
                        id: 'prj811d_project_side_detail_modify_link_winid',
                        url: $('prj811d_project_side_detail_modify_link_id').getUrl(),
                        params: {
                            project_id: record.get('project_id'),
                            prj_side_id:record.get('prj_side_id'),
                            query_flag:flag,
                            winid:'prj811d_project_side_detail_modify_link_winid'
                        },
                        fullScreen:true,
                        title: '项目补充明细'
                    });
                    win.on('close', function() {
                        $(ds_id).query();
                    });
            }
               
              window['${/parameter/@layout_code}_dynamic_link_renderer'] = function(value, record, name, config_record) {
                
                var flag ='Y';
                if (record.get('wfl_status') =='NEW'||record.get('wfl_status') =='RETURN'||(record.get('wfl_status') =='DISCUSSION'&&record.get('side_discuss_times')<2)){
                    flag ='N';
                }
                if (name == 'project_number' && value) {
                    return '<a href="javascript:open_project_side_win(\'' + record.id + '\',\'' + record.ds.id +'\',\'' + flag+ '\')">' + value + '</a>';
                }
                return value;
            };
            
            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'], 'hn_prj_project_side');
            	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=PRJ811"/>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>