virtual_contract_modify.lview 29.5 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 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: wangwei  
    $Date: 2015-12-9 上午10:36:28  
    $Revision: 1.0  
    $Purpose: 虚拟合同维护
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" dynamiccreateenabled="true" trace="true">
    <a:view>
        <a:link id="prj506_cdd_uploadFile_id" url="${/request/@context_path}/uploadFile.lview"/>
        <a:link id="prj506_cdd_downloadFile_id" url="${/request/@context_path}/downloadFile.lview"/>
        <a:link id="hls_fin_calculator_query_link_id" url="${/request/@context_path}/modules/hls/HLS500/hls_fin_calculator_readonly.lview"/>
        <a:link id="hls_fin_calculator_update_link_id" url="${/request/@context_path}/modules/hls/HLS500N/hls_fin_calculator_update_n.lview"/>
        <a:link id="prj_project_update_print_detail_link_id" url="${/request/@context_path}/modules/prj/PRJ506/prj_project_print_detail.lview"/>
        <a:link id="prj_project_virtual_con_submit_link_id" model="prj.PRJ506.prj_project_create_content" modelaction="execute"/>
        <a:link id="${/parameter/@layout_code}_offer_contract_upload_link_id" url="${/request/@context_path}/modules/prj/PRJ506/prj_offer_contract_excel_import.lview"/>
        <a:link id="hls_fin_doc_quotation_link_id" url="${/request/@context_path}/modules/hls/HLS500/hls_fin_doc_quotation.lsc"/>
        <a:link id="prj506_project_side_query_id" url="${/request/@context_path}/modules/prj/PRJ811/hn_project_side_detail.lview"/>
        <a:link id="${/parameter/@layout_code}_lease_item_upload_link_id" url="${/request/@context_path}/modules/prj/PRJ501N/prj_lease_item_upload.lview"/>
        <a:link id="${/parameter/@layout_code}_prj506_mortgage_detail_link" url="${/request/@context_path}/modules/prj/PRJ501N/prj_mortgage_detail_modify.lview"/>
        <a:link id="${/parameter/@layout_code}_con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
        <a:link id="prj_project_print_consultancy_service_link_id" url="${/request/@context_path}/modules/prj/PRJ506/hn_consultancy_service_contract_template_print.lview"/>
        <a:link id="create_consultancy_service_init_link" model="prj.PRJ506.hn_create_consultancy_service_init_link" modelaction="execute"/>
        <script type="text/javascript"><![CDATA[
            //忽略保存校验方法
            //诡异bug,某个字段必输,换种方法
            window['${/parameter/@layout_code}_ignore_required_before_save'] = function() {
                window['${/parameter/@layout_code}_not_ignore_required_flag'] = false;
            };
            
            //保存前调用
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_before_submit'] = function(ds, record) {
                window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
                var records = $(ds_id).getAt(0);
                if (!records.get('virtual_con_name')) {
                    Leaf.showMessage('${l:HLS.PROMPT}', '合同名称不能为空!');
                    window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                    return false;
                }
                $('${/parameter/@layout_code}_virtual_ds').setSubmitParameter('document_id', records.get('project_id'));
                $('${/parameter/@layout_code}_virtual_ds').setSubmitParameter('document_category', 'PRJ_CONTENT');
                window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                return true;
            };
            
            function upload_file(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 = $('prj506_cdd_downloadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id');
                    } else {
                        url = $('prj506_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: 'tre610_cdd_uploadFile_screen_id',
                        width: 850,
                        height: 400
                    });
            
                    win.on('close', function() {
                        record.ds.query();
                    });
                } else {
                    Leaf.showMessage('${l:HLS.PROMPT}', '请先保存!');
            
                }
            }
            
            function open_window_of_content() {
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
                var record = $(ds_id).getAt(0);
                var url = $('prj_project_update_print_detail_link_id').getUrl();
                var win = new Leaf.Window({
                    url: url,
                    title: '合同文本',
                    params: {
                        project_id: record.get('project_id'),
                        winid: 'prj_project_create_content_print_win_id'
                    },
                    id: 'prj_project_create_content_print_win_id',
                    width: 970,
                    height: 500
                });
            }
            
            window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function() {
                window['${/parameter/@layout_code}_SAVE_LAYOUT_DYNAMIC_CLICK'](open_window_of_content);
            
            };
            
            function virtual_con_submit_approval(){
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
                var record = $('projectQueryScreen_mainDs').getSelected()[0];
                var current_record = $(ds_id).getCurrentRecord();
                var prj_finance_amount = current_record.get('prj_finance_amount');
                var total_virtual_con_amount = current_record.get('total_virtual_con_amount');
                var finance_amount = current_record.get('finance_amount');
                var remaining_amount = prj_finance_amount - total_virtual_con_amount - finance_amount;
                if(remaining_amount <0 ){
                    Leaf.showErrorMessage('${l:HLS.PROMPT}', '本合同所属项目过会额度'+prj_finance_amount+'元,已用项目额度'+total_virtual_con_amount+'元,当前合同金额'+finance_amount+'元,已经超出可用项目额度,请调整合同金额后再次提交!',null,400,130);
                    return;    
                }
                Leaf.showConfirm('${l:HLS.PROMPT}', '本合同所属项目过会额度' + prj_finance_amount + '元,已用项目额度' + total_virtual_con_amount + '元,当前合同金额' + finance_amount + '元,提交后剩余可用项目额度' + remaining_amount + '元,确认提交?', function() {
                    window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                    Leaf.request({
                        url: $('prj_project_virtual_con_submit_link_id').getUrl(),
                        para: {
                            project_id: record.get('project_id')
                        },
                        scope: this,
                        success: function() {
                            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                            $('${/parameter/@winid}').close();
                            $('projectQueryScreen_mainDs').query();
                        },
                        failure: function() {
                            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                        },
                        error: function() {
                            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                        }
                    });
                },null,400,130);
            }
            
            //提交审批
            window['${/parameter/@layout_code}_submit_approval_layout_dynamic_click'] = function() {
                window['${/parameter/@layout_code}_SAVE_LAYOUT_DYNAMIC_CLICK'](virtual_con_submit_approval);
                
            };
            
            //报价链接
            
            function prj_project_quote(id, name, query_only) {
                var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
                var quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation');
                var head_record = $(ds_id).getAt(0);
                // url = $('hls_fin_calculator_query_link_id').getUrl();
                url = $('hls_fin_calculator_update_link_id').getUrl();
            
                var parent_pk_value = head_record.get('project_id');
                record.set('function_code', 'PRJ506D');
                record.set('function_usage', 'UPDATE');
                record.set('project_id', parent_pk_value);
            
                window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                //直接进入报价页面
                if (!record.get('calc_session_id')) {
                    record.set('to_doc_table', 'HLS_FIN_CALCULATOR_HD');
                    var calc_recreate_L_formula;
                    calc_recreate_L_formula = 'Y';
                    record.set('_status', 'update');
                    record.set('from_doc_table', 'PRJ_QUOTATION');
                    record.set('from_doc_pk', record.get('quotation_id'));
                    record.set('calculate_flag', 'N');
            
                    var saveData = [];
                    saveData.push(record.data);
                    Leaf.request({
                        url: $('hls_fin_doc_quotation_link_id').getUrl(),
                        para: saveData,
                        success: function(res) {
                            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                            $(quotation_ds_id).query();
                            var quotation_id = record.get('quotation_id') || res.result.record.quotation_id;
                            var win = new Leaf.Window({
                                id: 'hls_fin_calc_quotation_link_winid',
                                params: {
                                    document_id: parent_pk_value,
                                    document_category: 'PORJECT',
                                    maintain_type: 'MODIFY',
                                    calc_session_id: res.result.record.calc_session_id,
                                    quotation_id: quotation_id,
                                    dsId: quotation_ds_id,
                                    winId: 'hls_fin_calc_quotation_link_winid',
                                    global_flag: 'Y',
                                    id_num: 0,
                                    calc_type: 'CLASSIC_CALCULATOR',
                                    recreate_L_formula: calc_recreate_L_formula
                                },
                                url: url,
                                fullScreen: true,
                                draggable: true
                            });
                            win.on('close', function() {
                                $(quotation_ds_id).query();
            					$(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
                    });
                } else {
                    var win = new Leaf.Window({
                        id: 'hls_fin_calc_quotation_update_link_winid',
                        params: {
                            document_id: parent_pk_value,
                            document_category: 'PORJECT',
                            maintain_type: 'MODIFY',
                            calc_session_id: record.get('calc_session_id'),
                            quotation_id: record.get('quotation_id'),
                            dsId: quotation_ds_id,
                            winId: 'hls_fin_calc_quotation_update_link_winid',
                            global_flag: 'Y',
                            id_num: 0,
                            calc_type: 'CLASSIC_CALCULATOR',
                            recreate_L_formula: 'Y'
                        },
                        url: url,
                        fullScreen: true,
                        draggable: true
                    });
            
                    win.on('close', function() {
                        $(quotation_ds_id).query();
                        $(ds_id).query();
                    });
                }
            
            }
            
            //项目补充超链接
            
            function side_detail(id, name, query_only) {
                var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
                var project_id = record.get('ref_project_id');
                var prj_side_id = record.get('prj_side_id');
                
                var url = $('prj506_project_side_query_id').getUrl();
                var win = new Leaf.Window({
                    url: url,
                    params: {
                        project_id: project_id,
                        prj_side_id: prj_side_id,
                        query_flag: 'Y'
                    },
                    title: '项目补充明细',
                    id: 'prj506_project_side_query_win_id',
                    fullScreen: true
                });
            
                win.on('close', function() {
                    record.ds.query();
                });
            }
            
            //超链接渲染
            window['${/parameter/@layout_code}_dynamic_link_renderer'] = function(value, record, name, config_record) {
                var link_function = '';
                window['${/parameter/@layout_code}_hls_link_render_record'][record.id + '---' + name] = record;
                if (name == 'attachment') {
                    link_function = 'upload_file';
                    if (record.get('attach_count') == 0 || !record.get('attach_count')) {
                        return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>';
                    } else {
                        return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '(' + record.get('attach_count') + ')' + '</a>';
                    }
                } else if (name == 'quote' && !record.isNew) {
                    link_function = 'prj_project_quote';
                    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;
            
                    }
                } else if (name == 'side_detail') {
                    link_function = 'side_detail';
                    return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>';
                }
                //add by zhangyu for huaneng
                else if (name == 'mortgage_detail') {
                    var text;
                    if (record.get('data_exists_flag') != 'Y') {
                        text = '<font color="red">编辑明细</font>';
                    } else {
                        text = '编辑明细';
                    }
                    link_function = '${/parameter/@layout_code}_prj506_mortgage_detail';
                    if (record.get('prj_mortgage_id')) {
                        return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + text + '</a>';
                    }
                }
            
            };
            
            window['${/parameter/@layout_code}_prj506_mortgage_detail'] = function(record_id, name, query_only) {
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_mortgage');
                var record = window['${/parameter/@layout_code}_hls_link_render_record'][record_id + '---' + name];
                if (!record.isNew) {
                    var param = record.data;
                    var maintain_type = '${/parameter/@maintain_type}';
                    if (maintain_type == 'READONLY') {
                        param['function_code'] = 'PRJ501M_WFL';
                    } else {
                        param['function_code'] = 'PRJ501M';
                    }
                    param['cond_para2'] = record.get('mortgage_asset_detail');
                    param['maintain_type'] = '${/parameter/@maintain_type}';
                    param['function_usage'] = '${/parameter/@function_usage}';
                    param['url_title'] = '抵质押物明细';
                    hls_doc_get_layout_code('${/parameter/@layout_code}_con_contract_get_layout_code_link_id', param, '${/parameter/@layout_code}_prj506_mortgage_detail_link', ds_id);
                }
            };
            
            //查询时调用(grid,table,gridBox)
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_query'] = function(ds, qpara, bp_seq) {
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_bp');
                $(ds_id).setQueryParameter('bp_seq', 1);
            };
            
            //加载时调用(grid,table,gridBox)
            var count_flag = 0;
            //项目类匹配上bp_seq
            window['${/parameter/@layout_code}_on_layout_dynamic_grid_load'] = function(ds, record) {
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_bp');
                $(ds_id).setQueryParameter('bp_seq', 1);
                if (ds.id == ds_id && count_flag < 1) {
                    count_flag = count_flag + 1;
                    $(ds_id).query();
                }
            };
            
            window['${/parameter/@layout_code}_on_layout_dynamic_grid_add'] = function(ds, record, config_records) {
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hn_virtual_offer_contract');
                if (ds_id == ds.id && ds_id) {
                    //设置序号
                    var records = ds.getAll(),
                        seq_num = 0;
                    if (records.length) {
                        for (var i = 0;i < records.length;i++) {
                            var current_record = records[i],
                                offer_con_seq = current_record.get('offer_con_seq');
                            if (seq_num <= offer_con_seq) {
                                seq_num = offer_con_seq;
                            }
                        }
                    }
                    var rk_value = seq_num + 1;
                    record.set('offer_con_seq', rk_value);
                }
            };
            
            window['${/parameter/@layout_code}_on_layout_dynamic_submitsuccess'] = function(ds, record, res, bp_seq) {
                window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                var grid_ds = $('${/parameter/@layout_code}_G_CON_LEASE_ITEM_prj_project_lease_item_ds'),
                    grid_ds_02 = $('${/parameter/@layout_code}_G_CON_LEASE_ITEM_02_prj_project_lease_item_ds');
                ds.query();
                grid_ds.query();
                grid_ds_02.query();
            };
            
            window['${/parameter/@layout_code}_F_CONTRACT_LIST_USER_BUTTON1_layout_dynamic_tab_click'] = function() {
                var project_id = '${/parameter/@project_id}';
                var url_l = $('${/parameter/@layout_code}_offer_contract_upload_link_id').getUrl();
                var con_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
                var record = $(con_ds_id).getCurrentRecord();
                if (Ext.isEmpty(project_id)) {
                    project_id = record.data['project_id'];
                }
                if (!Ext.isEmpty(project_id)) {
            
                    var win = new Leaf.Window({
                        id: 'con_offer_contract_import_handle_win',
                        url: url_l,
                        params: {
                            'winid': 'con_offer_contract_import_handle_win',
                            'project_id': project_id,
                            'session_id': '${/session/@session_id}',
                            'type': 'OFFER_CON',
                            'parent_ds': '${/parameter/@layout_code}_F_CONTRACT_LIST_hn_virtual_offer_contract_ds'
                        },
                        title: '供货合同导入',
                        width: 430,
                        height: 290
                    });
                    win.on('close', function() {
            
                        $('${/parameter/@layout_code}_F_CONTRACT_LIST_hn_virtual_offer_contract_ds').query();
            
                    });
            
                } else {
                    Leaf.showMessage('提示', '请选择合同项目信息!', null, 350);
                    return;
                }
            
            
            };
            
            //租赁物导入回租
            window['${/parameter/@layout_code}_G_CON_LEASE_ITEM_USER_BUTTON1_layout_dynamic_tab_click'] = function() {
                var project_id = '${/parameter/@project_id}';
                var url_l = $('${/parameter/@layout_code}_lease_item_upload_link_id').getUrl();
                var prj_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
                var record = $(prj_ds_id).getCurrentRecord();
                if (Ext.isEmpty(project_id)) {
                    project_id = record.data['project_id'];
                }
                if (!Ext.isEmpty(project_id)) {
            
                    var win = new Leaf.Window({
                        id: 'prj_project_lease_item_import_handle_win',
                        url: url_l,
                        params: {
                            'winid': 'prj_project_lease_item_import_handle_win',
                            'project_id': project_id,
                            'session_id': '${/session/@session_id}',
                            'type': 'GZ_2',
                            'parent_ds_id': '${/parameter/@layout_code}_G_CON_LEASE_ITEM_prj_project_lease_item_ds'
                        },
                        title: '租赁物导入',
                        width: 430,
                        height: 290
                    });
                    win.on('close', function() {
            
                        $('${/parameter/@layout_code}_G_CON_LEASE_ITEM_prj_project_lease_item_ds').query();
                        $('${/parameter/@layout_code}_G_CON_LEASE_ITEM_02_prj_project_lease_item_ds').query();
            
                    });
            
                } else {
                    Leaf.showMessage('提示', '请选择合同项目信息!', null, 350);
                    return;
                }
            };
            
            //租赁物导入直租
            window['${/parameter/@layout_code}_G_CON_LEASE_ITEM_02_USER_BUTTON1_layout_dynamic_tab_click'] = function() {
                var project_id = '${/parameter/@project_id}';
                var url_l = $('${/parameter/@layout_code}_lease_item_upload_link_id').getUrl();
                var prj_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
                var record = $(prj_ds_id).getCurrentRecord();
                if (Ext.isEmpty(project_id)) {
                    project_id = record.data['project_id'];
                }
                if (!Ext.isEmpty(project_id)) {
            
                    var win = new Leaf.Window({
                        id: 'prj_project_lease_item_import_handle_win_2',
                        url: url_l,
                        params: {
                            'winid': 'prj_project_lease_item_import_handle_win_2',
                            'project_id': project_id,
                            'session_id': '${/session/@session_id}',
                            'type': 'GZ_1',
                            'parent_ds_id': '${/parameter/@layout_code}_G_CON_LEASE_ITEM_02_prj_project_lease_item_ds'
                        },
                        title: '租赁物导入',
                        width: 430,
                        height: 290
                    });
                    win.on('close', function() {
            
                        $('${/parameter/@layout_code}_G_CON_LEASE_ITEM_prj_project_lease_item_ds').query();
                        $('${/parameter/@layout_code}_G_CON_LEASE_ITEM_02_prj_project_lease_item_ds').query();
            
                    });
            
                } else {
                    Leaf.showMessage('提示', '请选择合同项目信息!', null, 350);
                    return;
                }
            };
            
            //生成顾问服务合同
            window['${/parameter/@layout_code}_user_button2_layout_dynamic_click'] = function() {
                var prj_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
                var record = $(prj_ds_id).getCurrentRecord();
                var project_id = record.data['project_id'];
                var service_con_number = record.data['service_con_number'];
                var text = '';
                
                if (Ext.isEmpty(service_con_number)) {
                     text = '本次操作将会生成新的咨询服务合同编号,您确认吗?';
                } else {
                     text = '确定打印咨询服务合同吗?';
                }
                if ($(prj_ds_id).validate()) {
                    Leaf.showConfirm('提示', text, function() {
                        Leaf.request({
                            url: $('create_consultancy_service_init_link').getUrl(),
                            para: {
                                project_id: project_id
                            },
                            success: function(res) {
                                Leaf.Masker.unmask(Ext.getBody()); //解锁
                                var templt_name = 'hn_consultancy_service_contract_template_print.xml';
                                Leaf.Masker.unmask(Ext.getBody()); //解锁
                                var url = $('prj_project_print_consultancy_service_link_id').getUrl() + '?templt_name=' + templt_name + '&project_id=' + project_id;
                                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();
                            },
                            failure: function() {
                                Leaf.Masker.unFmask(Ext.getBody());
                            },
                            error: function() {
                                Leaf.Masker.unmask(Ext.getBody());
                            },
                            scope: this
                        });
                    })
                }
            };
        ]]></script>
    </a:view>
</a:screen>