con_extension_detail.lview 11.6 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 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gaoyang  
    $Date: 2015-12-02 下午1:29:07  
    $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="con_contract_extension_change_req_submit_link_id" model="cont.CON704.con_contract_extension_change_req_submit" modelaction="update"/>
        <a:link id="con_contract_extension_change_req_cancel_link_id" model="cont.CON704.con_contract_extension_change_req_cancel" modelaction="update"/>
        <a:link id="con_contract_change_req_extension_calc_link_id" model="cont.CON704.con_contract_change_req_extension_calc" modelaction="update"/>
        <a:link id="hls_fin_calculator_readonly_link_id" url="${/request/@context_path}/modules/hls/HLS500/hls_fin_calculator_readonly.lview"/>
        <script type="text/javascript"><![CDATA[
            function get_warning_message(msg) {
                var warning_message, duration;
                if (msg) {
                    warning_message = msg;
                    warning_message = '<font color="red">' + warning_message + '</font>';
                    duration = 8000;
                } else {
                    warning_message = '${l:HLS.SUBMIT_SUCCESS}';
                    duration = 2000;
                }
                parent.Leaf.SideBar.enable = true;
                parent.Leaf.SideBar.show({
                    html: '<div style="background-color:#ccfbd5;position:absolute;padding-top:5px;padding-bottom:5px;padding-left:20px;padding-right:20px;border:0px solid #009900"><b>' + warning_message + '</b></div>',
                    duration: duration
                });
            }
            
            function con704_extension_calc() {
                var req_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract_change_req');
                var contract_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract');
                var req_record = $(req_ds_id).getCurrentRecord(),
                    contract_record = $(contract_ds_id).getCurrentRecord();
                var calc_session_id = req_record.get('ccr_calc_session_id');
                var document_category = req_record.get('document_category');
                if ($(req_ds_id).validate() && $(contract_ds_id).validate()) {
                    if (req_record.dirty || contract_record.dirty) {
                        Leaf.showMessage('${l:HLS.PROMPT}', '${l:HLS.EXECUTE_AFTER_SAVE}');
                        return;
                    }
                    window['${/parameter/@bp_seq}${/parameter/@layout_code}_lock_layout_dynamic_window']();
                    Leaf.request({
                        url: $('con_contract_change_req_extension_calc_link_id').getUrl(),
                        para: {
                            change_req_id: ${/parameter/@change_req_id},
                            calc_session_id: calc_session_id
                        },
                        success: function(res) {
                            window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                            if (!calc_session_id) {
                                req_record.set('ccr_calc_session_id', res.result.calc_session_id);
                            }
                            get_warning_message(res.result.warning_message);
                            $(contract_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
                    });
                }
            }
            
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_lock_layout_dynamic_window']();
            var change_req_load_flag = 'N',
                con_contract_load_flag = 'N';
            
            //新增和加载时调用(form)
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_form_add_and_load'] = function(ds, record, config_records, bp_seq) {
                if (ds.id.match(/con_contract_ds$/)) {
                    con_contract_load_flag = 'Y';
                }
                if (ds.id.match(/con_contract_change_req_ds$/)) {
                    if (!record.get('change_req_number')) {
                        record.dirty = true;
                    }
                    change_req_load_flag = 'Y';
                }
                if (change_req_load_flag == 'Y' && con_contract_load_flag == 'Y') {
                    window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                }
            };
            
            
            window['${/parameter/@layout_code}_quote_layout_dynamic_click'] = function() {
                Leaf.SideBar.enable = false;
                window['${/parameter/@bp_seq}${/parameter/@layout_code}_SAVE_LAYOUT_DYNAMIC_CLICK'](con704_extension_calc);
            };
            
            window['${/parameter/@layout_code}_submit_approval_layout_dynamic_click'] = function() {
                var ajax_flag = 'N';
                window['${/parameter/@bp_seq}${/parameter/@layout_code}_lock_layout_dynamic_window']();
                var confirm_win = Leaf.showConfirm('${HLS.PROMPT}', '${l:HLS.ARE_YOU_SURE_TO_SUBMIT}', function() {
                    ajax_flag = 'Y';
                    Leaf.request({
                        url: $('con_contract_extension_change_req_submit_link_id').getUrl(),
                        para: {
                            change_req_id: '${/parameter/@change_req_id}'
                        },
                        success: function(res) {
                            window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                            parent.Leaf.SideBar.enable = true;
                            parent.Leaf.SideBar.show({
                                msg: '${l:HLS.SUBMIT_SUCCESS}',
                                duration: 2000
                            });
                            $('${/parameter/@winid}').close();
                        },
                        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() {
                    window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                });
                confirm_win.on('close', function() {
                    if (ajax_flag == 'N') {
                        window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                    }
                });
            };
            
            window['${/parameter/@layout_code}_user_button2_layout_dynamic_click'] = function() {
                var ajax_flag = 'N';
                window['${/parameter/@bp_seq}${/parameter/@layout_code}_lock_layout_dynamic_window']();
                var confirm_win = Leaf.showConfirm('${HLS.PROMPT}', '是否确认取消?', function() {
                    ajax_flag = 'Y';
                    Leaf.request({
                        url: $('con_contract_extension_change_req_cancel_link_id').getUrl(),
                        para: {
                            change_req_id: '${/parameter/@change_req_id}'
                        },
                        success: function(res) {
                            window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                            parent.Leaf.SideBar.enable = true;
                            parent.Leaf.SideBar.show({
                                msg: '取消成功',
                                duration: 2000
                            });
                            $('${/parameter/@winid}').close();
                        },
                        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() {
                    window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                });
                confirm_win.on('close', function() {
                    if (ajax_flag == 'N') {
                        window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                    }
                });
            };
            
            
            window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function() {
                var req_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract_change_req');
                var req_record = $(req_ds_id).getCurrentRecord();
                var calc_session_id = req_record.get('ccr_calc_session_id');
                var calc_type = 'CLASSIC_CALCULATOR';
                var document_category = req_record.get('document_category');
                if (calc_session_id) {
                    var quo_win = new Leaf.Window({
                        id: '${/parameter/@layout_code}_hls_fin_calc_quotation_link_winid',
                        params: {
                            document_id: ${/parameter/@change_req_id},
                            document_category: document_category,
                            maintain_type: 'READONLY',
                            calc_session_id: calc_session_id,
                            winId: '${/parameter/@layout_code}_hls_fin_calc_quotation_link_winid',
                            calc_type: calc_type,
                            global_flag: 'Y'
                        },
                        url: $('hls_fin_calculator_readonly_link_id').getUrl(),
                        fullScreen: true,
                        draggable: true
                    });
                } else {
                    Leaf.showMessage('${l:PROMPT}', '请先保存!');
                }
            
            };
            
            
            
            //更新时调用
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_update'] = function(ds, record, name, value, old_value, bp_seq) {
                if (ds.id.match(/con_contract_ds$/) && (name == 'ccr_start_times' || name == 'ccr_outstanding_times' || name == 'ccr_financing_overdue_rental')) {
                    var req_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract_change_req');
                    var req_record = $(req_ds_id).getCurrentRecord();
                    if (req_record) {
                        req_record.set('is_calc_flag', 'N');
                    }
                }
            };
        ]]></script>
    </a:view>
</a:screen>