con_cchag_detail.lview 15.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 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 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287
<?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_cchag_change_req_submit_link_id" model="cont.CON711.con_contract_cchag_change_req_submit" modelaction="update"/>
        <a:link id="con_contract_cchag_change_req_cancel_link_id" model="cont.CON711.con_contract_cchag_change_req_cancel" modelaction="update"/>
        <a:link id="hls_fin_calculator_update_n_link_id" url="${/request/@context_path}/modules/hls/HLS500N/hls_fin_calculator_update_n.lview"/>
        <a:link id="${/parameter/@layout_code}_con500_cdd_uploadFile_id" url="${/request/@context_path}/uploadFile.lview"/>
        <a:link id="${/parameter/@layout_code}_con_contract_cchag_change_price_list_id" url="${/request/@context_path}/modules/cont/CON711/con_contract_cchag_change_price_list.lview"/>
        <a:link id="${/parameter/@layout_code}_con500_cdd_downloadFile_id" url="${/request/@context_path}/downloadFile.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 con710_cchag_calc() {
                var contract_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract');
                var contract_record = $(contract_ds_id).getCurrentRecord();
                var calc_session_id = contract_record.get('calc_session_id');
                var document_category = contract_record.get('document_category');
                if ($(contract_ds_id).validate()) {
                    if (contract_record.dirty) {
                        Leaf.showMessage('${l:HLS.PROMPT}', '${l:HLS.EXECUTE_AFTER_SAVE}');
                        return;
                    }
                    if (!calc_session_id) {
                        Leaf.showMessage('${l:HLS.PROMPT}', '该合同还未报价,请核查数据!');
                        return;
                    }
                    window['${/parameter/@bp_seq}${/parameter/@layout_code}_lock_layout_dynamic_window']();
                    var win = new Leaf.Window({
                        id: 'hls_fin_calculator_update_n_link_winid',
                        params: {
                            calc_session_id: calc_session_id,
                            document_id: '${/parameter/@contract_id}',
                            document_category: document_category,
                            maintain_type: 'MODIFY',
                            dsId: contract_ds_id,
                            winId: 'hls_fin_calculator_update_n_link_winid',
                            global_flag: 'Y',
                            id_num: 0,
                            calc_type: 'CLASSIC_CALCULATOR'
                        },
                        url: $('hls_fin_calculator_update_n_link_id').getUrl(),
                        title: '${l:HLS.FIN_CALCULATOR}',
                        fullScreen: true,
                        draggable: true
                    });
                    win.on('close', function() {
                        function calc_window_load() {
                            $(contract_ds_id).un('load', calc_window_load);
                            window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                        }
                        $(contract_ds_id).on('load', calc_window_load);
                        $(contract_ds_id).query();
                    });
                }
            }
            
            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';
                    var records = ds.getAll();
                    if (!records.length) {
                        return;
                    }
            
                    for (var i = 0;i < records.length;i++) {
                        //已确认的不可编辑
                        if (records[i].data['insured_flag'] == 'Y') {
            
                            records[i].getField('valid_from').setReadOnly(true);
                            records[i].getField('valid_to').setReadOnly(true);
                        }
                    }
                }
                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'](con710_cchag_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_cchag_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_cchag_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 con_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract');
                var con_record = $(con_id).getCurrentRecord();
                var quo_win = new Leaf.Window({
                    id: '${/parameter/@layout_code}_con_contract_cchag_change_price_list_winid',
                    params: {
                        change_req_id: ${/parameter/@contract_id},
                        winid: '${/parameter/@layout_code}_con_contract_cchag_change_price_list_winid',
                        pre_price_list: con_record.get('price_list'),
                        pre_price_list_name: con_record.get('price_list_n'),
                        ds_id: con_id
                    },
                    url: $('${/parameter/@layout_code}_con_contract_cchag_change_price_list_id').getUrl(),
                    width: 750,
                    height: 170
                });
                quo_win.on('close', function() {
                    window['${/parameter/@bp_seq}${/parameter/@layout_code}_lock_layout_dynamic_window']();
            
                    function change_ref_calc(ds) {
                        $(con_id).un('load', change_ref_calc);
                        if (con_record.get('change_price_list_flag') == 'Y') {
                            con_record.set('change_price_list_flag', 'N');
                            con710_cchag_calc();
                        }
                    }
                    $(con_id).on('load', change_ref_calc);
                    $(con_id).query();
                });
            };
            
            
            
            //更新时调用
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_update'] = function(ds, record, name, value, old_value, bp_seq) {
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract');
                var con_contract_mortgage_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract_mortgage');
                if (ds.id == con_contract_mortgage_id && name == 'mortgage_class') {
                    if (record.get('mortgage_class') == 'SUBSTANTIVE_MORTGAGE') {
                        var mortgage_serial_number = record.getField('mortgage_serial_number');
                        mortgage_serial_number.setRequired(true);
                    }
                }
            };
            
            window['${/parameter/@layout_code}_con500_cdd_attachtment_upload'] = function(id, name, query_only) {
                var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
                if (record.get('check_id')) {
                    var url;
                    if (query_only == 'Y') {
                        url = $('${/parameter/@layout_code}_con500_cdd_downloadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id');
                    } else {
                        url = $('${/parameter/@layout_code}_con500_cdd_uploadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id');
                    }
                    var win = new Leaf.Window({
                        url: url,
                        title: '${l:HLS.SUPPORTING_DOCUMENT}',
                        id: '${/parameter/@layout_code}_con_cdd_uploadFile_screen_id',
                        width: 850,
                        height: 400
                    });
            
                    win.on('close', function() {
                        record.ds.query();
                    });
                } else {
                    Leaf.showMessage('${l:HLS.PROMPT}', '请先保存!');
                }
            };
            
            window['${/parameter/@layout_code}_dynamic_link_renderer'] = function(value, record, name, config_record) {
                window['${/parameter/@layout_code}_hls_link_render_record'][record.id + '---' + name] = record;
                var ds_id = record.ds.id;
                if (name == 'attachment') {
                    link_function = '${/parameter/@layout_code}_con500_cdd_attachtment_upload';
                    return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>';
                } else if (name == 'attach_file_name') {
                    if (value != null) {
                        var link = '${/request/@context_path}/atm_download.lsc?attachment_id=';
                        var str = value.split(';;');
                        var url = '';
                        for (var i = 0;i < str.length;i++) {
                            var temp = str[i].split('--');
                            if (!Leaf.isEmpty(temp[0])) {
                                url = url + '<a href=' + link + temp[1] + '>' + temp[0] + '</a>' + ',';
                            }
                        }
                        return url;
            
                    }
                }
            };
        ]]></script>
    </a:view>
</a:screen>