legal_opinion_letter_create1.lview 10.4 KB
Newer Older
Spencer Chang's avatar
Spencer Chang committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
<?xml version="1.0" encoding="UTF-8"?>
<!--
  create by nyl  2014-12-3 
  for contract context create
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" dynamiccreateenabled="true" trace="true">
    <a:init-procedure>
        <a:model-query fetchAll="true" model="leg.LEG600.leg_default_law_firm" rootPath="default_law_firm"/>
        <a:model-query fetchAll="true" model="leg.LEG600.get_sysdate" rootPath="sysdate"/>
        <a:model-query fetchAll="true" model="leg.LEG100.get_default_country" rootPath="get_default_country"/>
    </a:init-procedure>
    <a:view>
        <a:link id="legal_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
        <a:link id="leg_legal_letter_submit_link_id" model="leg.LEG600.leg_legal_letter_submit" modelaction="update"/>
        <a:link id="leg_legal_letter_fee_link_id" model="leg.LEG600.leg_legal_letter_submit" modelaction="execute"/>
        <a:link id="leg_uploadFile_id" url="${/request/@context_path}/uploadFile.lview"/>
        <a:link id="leg_downloadFile_id" url="${/request/@context_path}/downloadFile.lview"/>
        <a:link id="leg400_print_link_id" url="${/request/@context_path}/modules/leg/LEG400/leg_content_print_detail.lview"/>
        <script type="text/javascript"><![CDATA[
            function leg600_open_contract_win(ds_id, record_id, name, type) {
            
                //  var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'leg_legal_letter');
                var legal_record;
            
                var url_id = 'leg_uploadFile_id';
                if (type == '1') {
                    ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'leg_legal_letter');
                    legal_record = $(ds_id).getCurrentRecord();
                    url_id = 'leg_uploadFile_id';
                } else {
                    legal_record = $(ds_id).findById(record_id);
                    url_id = 'leg_downloadFile_id';
                }
                var url;
                //
                if (type == 1) {
                    url = $(url_id).getUrl() + '?table_name=LEG_LEGAL_LETTER&header_id=' + '${/parameter/@legal_letter_id}';
                } else {
                    url = $(url_id).getUrl() + '?table_name=LEG_LEGAL_LETTER&header_id=' + legal_record.data['legal_letter_id'];
                }
                new Leaf.Window({
                    url: url,
                    title: '附件',
                    id: 'leg_legal_letter_id',
                    width: 850,
                    height: 400
                });
            }
            
            
            window['${/parameter/@layout_code}_dynamic_link_renderer'] = function(value, record, name, config_record) {
                if (name == 'attachment') {
                    return '<a href="javascript:leg600_open_contract_win(\'' + record.ds.id + '\',\'' + record.id + '\',\'' + 'attachment' + '\',' + '2' + ')">' + '附件' + '</a>';
                }
            
                return value;
            };
            //按钮渲染
            window['${/parameter/@layout_code}_dynamic_button_renderer'] = function(value, record, name, config_record, bp_seq) {
                var link_function = '';
                if (name == 'attachment') {
                    link_function = 'leg600_open_contract_win';
                }
                if (Ext.isIE || Ext.isIE9 || Ext.isIE10) {
                    return '<button style="font-size:11px;height:22px;width:70%;text-align:center;padding:0 4px 4px 0" onclick="window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',' + '1' + ');"><div style="height: 18px; line-height: 16px; text-decoration: none;">' + config_record.get('prompt') + '</div></button>';
                } else {
                    return '<button style="font-size:11px;height:22px;width:70%;text-align:center;" onclick="window[\'' + link_function + '\'](\'' + record.id + '\',null,\'' + name + '\',' + '1' + ');">' + config_record.get('prompt') + '</button>';
                }
            };
            
 
            //保存前调用
            window['${/parameter/@layout_code}_on_layout_dynamic_before_submit'] = function(ds, record) {
                window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
                var contract_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract');
                var letter_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'leg_legal_letter');
                if (contract_ds_id && letter_ds_id) {
                    var contract_record = $(contract_ds_id).getCurrentRecord();
                    var letter_record = $(letter_ds_id).getCurrentRecord();
                    letter_record.set('overdue_amount', contract_record.data['overdue_amount']);
                    letter_record.set('overdue_times', contract_record.data['overdue_times']);
                    var check_flag = true;
                }
                return check_flag;
            };
            //生成律师函
            window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function() {
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'leg_legal_letter');
                if (ds_id) {
                    var record = $(ds_id).getCurrentRecord();
                    var param = new Object();
                    param['legal_letter_id'] = record.get('legal_letter_id');
                    param['contract_id'] = record.get('contract_id');
                    param['winid'] = 'leg_print_detail_winid';
                    param['function'] = 'LEG600D';
                    new Leaf.Window({
                        id: 'leg_print_detail_winid',
                        params: param,
                        url: $('leg400_print_link_id').getUrl(),
                        title: '法务文本打印',
                        width: 900,
                        height: 450
                    });
                }
            };
            //创建费用现金流
            window['${/parameter/@layout_code}_user_button2_layout_dynamic_click'] = function() {
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'leg_legal_letter');
                if (ds_id) {
                    var record = $(ds_id).getCurrentRecord();
                    var legal_letter_id = record.get('legal_letter_id');
                    var contract_id = record.get('contract_id');
                    if (record.dirty != true) {
                        window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
                        Leaf.request({
                            url: $('leg_legal_letter_fee_link_id').getUrl(),
                            para: {
                                legal_letter_id: legal_letter_id,
                                contract_id: contract_id
                            },
                            success: function(res) {
                                window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                            },
                            failure: function() {
                                window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                            },
                            error: function() {
                                window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                            },
                            scope: this
                        });
                    } else {
                        Leaf.showMessage('提示', '请先保存!', null, 350);
                    }
                }
            };
            
            //提交审批
            window['${/parameter/@layout_code}_submit_approval_layout_dynamic_click'] = function() {
            
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'leg_legal_letter');
                if (ds_id) {
                    var record = $(ds_id).getCurrentRecord();
                    var legal_letter_id = record.get('legal_letter_id');
                    var contract_id = record.get('contract_id');
            
                    if (record.dirty != true) {
            
                        window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
                        Leaf.request({
                            url: $('leg_legal_letter_submit_link_id').getUrl(),
                            para: {
                                legal_letter_id: legal_letter_id,
                                contract_id: contract_id
                            },
                            success: function(res) {
                                window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                                $('${/parameter/@winid}').close();
            
                            },
                            failure: function() {
                                window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                            },
                            error: function() {
                                window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                            },
                            scope: this
                        });
                    } else {
                        Leaf.showMessage('提示', '请先保存再提交审批!', null, 350);
                    }
                }
            
            };
            
            //查询时调用(grid,table,gridBox)
            window['${/parameter/@layout_code}_on_layout_dynamic_grid_query'] = function(ds, qpara, bp_seq) {
                var con_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'leg_legal_letter_history');
                var letter_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'leg_legal_letter');
                //leg_legal_letter
                if (ds.id == con_ds_id && con_ds_id && letter_ds_id) {
                    qpara.contract_id = ${/parameter/@contract_id};
                }
            
            };
        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>