<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zhangyu  
    $Date: 2016-12-22 下午14:45:13  
    $Revision: 1.0  
    $Purpose: 项目报告审批流程提交界面
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true">
    <a:init-procedure/>
    <a:view>
        <a:link id="zj_wfl_approve_upload1_link_id" url="${/request/@context_path}/uploadFile.lview"/>
        <a:link id="zj_wfl_approve_query1_link_id" url="${/request/@context_path}/downloadFile.lview"/>
        <a:link id="meeting_minutes_link_id" url="${/request/@context_path}/modules/wfl_screen/PRJ_PROJECT/meeting_minutes_print.lview"/>
        <a:link id="hn_project_approve_submit_link" model="prj.PRJ501A.hn_project_submit" modelaction="execute"/>
        <script type="text/javascript"><![CDATA[
            function prj501a_project_approve_close() {
                $('${/parameter/@winid}').close();
            }
            
            function prj501a_project_approve_confirm() {
                var submit_type, submit_type_desc;
                submit_type = '${/parameter/@submit_type}';
                if (submit_type == 'agree') {
                    submit_type_desc = '同意';
                } else if (submit_type == 'discuss') {
                    submit_type_desc = '再议';
                } else if (submit_type == 'disagree') {
                    submit_type_desc = '不同意';
                }
                var ds_1 = $('bgfl_csh_payment_conditions_result_ds');
                var ds_2 = $('con555_detail_result_ds');
                var ds_3 = $('summmary_comments_ds');
                var ds_4 = $('con555_detail_cdd_project_result_ds');
                var ds_5 = $('hn_prj_manage_require_result_ds');
                var ds_6 = $('hn_meeting_attachment_ds');
                if(ds_1.isModified()){
                    ds_1.submit();
                }
                if(ds_2.isModified()){
                    ds_2.submit();
                }
                if(ds_3.isModified()){
                    ds_3.submit();
                }
                if(ds_4.isModified()){
                    ds_4.submit();
                }
                if(ds_5.isModified()){
                    ds_5.submit();
                }
                if(ds_6.isModified()){
                    ds_6.submit();
                }
                Leaf.showConfirm('提示', '您的意见为<font color="red">'+submit_type_desc+'</font>,确定提交吗?', function() {
                    Leaf.Masker.mask($('${/parameter/@winid}').wrap, '正在提交...');
                    Leaf.request({
                        url: $('hn_project_approve_submit_link').getUrl(),
                        para: {
                            project_id: '${/parameter/@project_id}',
                            submit_type: submit_type
                        },
                        success: function(res) {
                            Leaf.Masker.unmask($('${/parameter/@winid}').wrap);
                            parent.Leaf.SideBar.enable = true;
                            parent.Leaf.SideBar.show({
                                msg: '${l:HLS.SUBMIT_SUCCESS}',
                                duration: 2000
                            });
                            $('${/parameter/@winid}').close();
                        },
                        error: function(res) {
                            Leaf.Masker.unmask($('${/parameter/@winid}').wrap);
                        },
                        faliure: function() {
                            Leaf.Masker.unmask($('${/parameter/@winid}').wrap);
                        },
                        scope: this
                    });
                }, null, 400);
            }
            
            (function() {
                var checker_list = {};
            
                zjwfl5110_ApproveChecker_add = function(name, fun) {
                    checker_list[name] = fun;
                };
            
                zjwfl5110_ApproveChecker_remove = function(name) {
                    delete checker_list[name];
                };
            
                zjwfl5110_ApproveChecker_check = function(type) {
                    for (var key in checker_list) {
                        if (checker_list[key](type) == true) {
            
                           } else {
                            return false;
                        }
                    }
                    return true;
                };
            
            })();
            
            function go_to_upload_page() {
                var approval_id = '${/parameter/@approval_id}';
                new Leaf.Window({
                    id: 'zj_wfl_approve_history_downloadfile_win',
                    url: $('zj_wfl_approve_upload1_link_id').getUrl() + '?table_name=ZJ_WFL_APPROVE_RECORD&header_id=' + approval_id + '&useSubFolder=Y',
                    title: '会议纪要',
                    width: 1250,
                    height: 350
                });
            }
            
            function meeting_minutes_generate(){
                var project_id = '${/parameter/@project_id}';                  
                var templt_name ='meeting_minutes.xml';
                var file_name ='项目评审委员会会议纪要';         	
                  if (project_id) {                   
                    Leaf.Masker.unmask(Ext.getBody()); //解锁
                    var url = $('meeting_minutes_link_id').getUrl() + '?templt_name=' + templt_name + '&project_id=' + project_id + '&file_name=' + file_name;
                    var form = document.createElement("form");
                    form.target = "word_export_window";
                    form.method = "post";
                    form.action = url;
                    var iframe = Ext.get('word_export_window') || new Ext.Template('<iframe id ="word_export_window" name="word_export_window" style="position:absolute;left:-10000px;top:-10000px;width:1px;height:1px;display:none"></iframe>').insertFirst(document.body, {}, true);
                    document.body.appendChild(form);
                    form.submit();
                    Ext.fly(form).remove();
                }
       
            }
        ]]></script>
        <a:screenBody>
            <!-- <a:screen-include screen="modules/wfl_screen/PRJ_PROJECT/prj_project_approval_summary.lview?project_id=${/parameter/@project_id}&amp;approval_id=${/parameter/@approval_id}&amp;show_approver=Y&amp;show_summary=W&amp;show_reply=N&amp;show_upload=W&amp;conditions_editor=Y&amp;query_flag=N&amp;show_meeting=Y"/> -->
            <a:screenTopToolbar>
                <a:gridButton click="prj501a_project_approve_close" text="关闭"/>
                <a:gridButton click="prj501a_project_approve_confirm" text="确定提交"/>
                <a:gridButton id="upload_id" click="go_to_upload_page" text="会议纪要上传"/>
                <a:gridButton click="meeting_minutes_generate" text="生成上会会议纪要"/>
            </a:screenTopToolbar>
            <a:screen-include screen="modules/wfl_screen/PRJ_PROJECT/prj_project_document_project_info.lview?project_id=${/parameter/@project_id}&amp;show_meeting=Y&amp;approval_id=${/parameter/@approval_id}"/>
            <a:screen-include screen="modules/wfl_screen/PRJ_PROJECT/sdic_prj_approver_comment_conditions.lview?project_id=${/parameter/@project_id}&amp;approval_id=${/parameter/@approval_id}&amp;conditions_editor=Y&amp;required=false&amp;show_save=N&amp;show_approve_result=N&amp;query_flag=N"/>
            <a:screen-include screen="modules/wfl_screen/PRJ_PROJECT/prj_project_approver_comment_list.lview?project_id=${/parameter/@project_id}&amp;approval_id=${/parameter/@approval_id}"/>
            <a:screen-include screen="modules/wfl_screen/PRJ_PROJECT/prj_project_approval_comment_summary.lview?project_id=${/parameter/@project_id}&amp;approval_id=${/parameter/@approval_id}&amp;readOnly=false&amp;show_save=Y"/>
            <a:screen-include screen="modules/prj/PRJ501A/hn_prj_research_metting_record.lview?wfl_instance_id_2=${/parameter/@wfl_instance_id_2}&amp;wfl_instance_id=${/parameter/@wfl_instance_id}"/>
            <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
        </a:screenBody>
    </a:view>
</a:screen>