<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: wangwei  
    $Date: 2016-12-20 上午9:04:27  
    $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="con640_con_collection_law_detail_link_id" url="${/request/@context_path}/modules/cont/CON641/con_collection_law_detail.lview"/>
        <a:link id="con640_confirm_link_id" model="cont.CON641.con_collection_update_status" modelaction="update"/>
        <script type="text/javascript"><![CDATA[
            //诉讼明细
            window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function() {
                var coll_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_collection');
                var record = $(coll_ds_id).getSelected()[0];
                param = {};
                param['col_id'] = record.get('col_id');
                if (record.get('document_status') == 'NEW' || record.get('document_status') == 'REJECT') {
                    param['function_code'] = 'CON641D';
                    param['function_usage'] = 'MODIFY';
                    param['maintain_type'] = 'UPDATE';
                } else {
                    param['function_code'] = 'CON641D_QUERY';
                    param['function_usage'] = 'READONLY';
                    param['maintain_type'] = 'QUERY';
                }
                param['url_title'] = '诉讼明细信息';
                param['winid'] = 'con641_con_collection_law_detail_winid';
                hls_doc_get_layout_code('prj_project_get_layout_code_link_id', param, 'con640_con_collection_law_detail_link_id', coll_ds_id);
            };
            //诉讼确认完成
            window['${/parameter/@layout_code}_user_button2_layout_dynamic_click'] = function() {
                window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
                var coll_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_collection');
                var record = $(coll_ds_id).getSelected()[0];
                var status = record.get('document_status');
                if(status == 'APPROVED'){
                    window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                    Leaf.showMessage('提示', '该单据已审批通过,请勿重复操作!');
                    return;
                }
                Leaf.showConfirm('提示', '确认诉讼完成?', function() {
                    Leaf.request({
                        url: $('con640_confirm_link_id').getUrl(),
                        para: {
                        col_id: record.get('col_id')
                        },
                        success: function(res) {
                            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                            Leaf.SideBar.show({
                                msg: '${l:HLS.SUBMIT_SUCCESS}',
                                duration: 2000
                            });
                            $(coll_ds_id).query();
                        },
                        failure: function() {
                            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                        },
                        error: function() {
                            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                        },
                        scope: this
                    });
            
                }, function() {
                    window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                });
            
            
            
            };
        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>