prj_project_maintain_manager.lview 51.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 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 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: wangwei5743  
    $Date: 2014-10-8 下午3:16:19  
    $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="get_special_fields_link_id" model="cont.CON500.con_contract_get_special_fields" modelaction="update"/>
        <a:link id="get_calc_id" model="prj.PRJ500D.calc_quotation" modelaction="update"/>
        <a:link id="submit_approval_link" model="prj.PRJ500D.prj_project_workflow_start" modelaction="update"/>
        <a:link id="prj500_cdd_uploadFile_id" url="${/request/@context_path}/uploadFile.lview"/>
        <a:link id="prj500_cdd_downloadFile_id" url="${/request/@context_path}/downloadFile.lview"/>
        <a:link id="get_id_card_no_info_id" model="prj.PRJ500D.hls_bp_master_np_v" modelaction="query"/>
        <a:link id="hls_fin_doc_quotation_link_id" url="${/request/@context_path}/modules/hls/HLS500/hls_fin_doc_quotation.lsc"/>
        <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="hls_fin_calc_quotation_header_link_id" url="${/request/@context_path}/modules/hls/HLS500/hls_fin_calc_quotation_header.lview"/>
        <a:link id="update_prj_project_quotation_info_id" model="prj.PRJ500D.update_project_quotation_info" modelaction="update"/>
        <a:link id="get_organization_code_id" model="prj.PRJ500D.hls_bp_master_org_v" modelaction="query"/>
        <a:link id="get_id_card_no_tenant_sec_id" model="prj.PRJ500D.hls_bp_master_np_tenant_sec_v" modelaction="query"/>
        <a:link id="get_id_card_no_info_guar_id" model="prj.PRJ500D.hls_bp_master_np_guar" modelaction="query"/>
        <a:link id="get_org_code_info_guar_id" model="prj.PRJ500D.hls_bp_master_org_guar" modelaction="query"/>
        <a:link id="get_calc_validate_sql_link" model="prj.PRJ500D.prj_get_calc_validate_sql" modelaction="query"/>
        <a:link id="get_car_organization_id_link" model="prj.PRJ500D.get_hls_car_organization" modelaction="query"/>
        <a:link id="tenant_history_project_link" url="${/request/@context_path}/modules/prj/PRJ501N/tenant_history_project.lview"/>
        <a:link id="prj_project_dowload_uploadfile" url="${/request/@context_path}/modules/prj/lease_atm_batch_dl.lsc"/>
        <link href="${/request/@context_path}/css/lightbox.css" rel="stylesheet" type="text/css"/>
        <script src="${/request/@context_path}/javascripts/lightbox.js" type="text/javascript"/>
        <script src="${/request/@context_path}/modules/prj/PRJ500N/javascripts/input_validator.js" type="text/javascript"/>
        <script src="${/request/@context_path}/modules/prj/PRJ500N/javascripts/check_org_code.js" type="text/javascript"/>
        <script src="${/request/@context_path}/javascripts/jquery-1.6.4.min.js" type="text/javascript"/>
        <style type="text/css"><![CDATA[
        .redBG{
            background-color:#FFC0CB;
            }
        .yellowBG{
            background-color:#FFFF00;
            }
    	]]></style>
        <script type="text/javascript"><![CDATA[
           jQuery.noConflict();
            
            var isLoaded = 'N';
            //	set单元格颜色  load事件无法实现效果
            //hongquan.dai 20180125 
            var count = 0;
            var check_isload = setInterval(function() {
                if(count > 3){
                    isLoaded = 'Y';
                    }
                if (isLoaded == 'N') {                    
                    var ids = $('${/parameter/@layout_code}_ACY_prj_cdd_item_doc_ref_ds');
                    var idsRecord = ids.getAll();
                    for (var i = 0;i < idsRecord.length;i++) {
                        var rowData = idsRecord[i];
                        var important_flag = rowData.get('important_flag');
                        //important_flag   是否必须上传
                        if (important_flag == 'Y') {
                            //普通动态布局 布局代码+组件名+基表名+_layout_grid_id-u-
                            //支撑文件   布局代码+组件名+基表名+_grid_id-u-
                            //tr_id = '#${/parameter/@layout_code}_ACY_prj_cdd_item_doc_ref_layout_grid_id-u-' + rowData.id;
                            tr_id = '#${/parameter/@layout_code}_ACY_con_contract_grid_id-u-' + rowData.id;
                            jQuery(tr_id).addClass('redBG');
                        }
                    }
                    count = count +1;
                } else {
                    clearInterval(check_isload);
                }
            }, 1000);
            Ext.ux.Lightbox.register('a[ref=img]', true);
            //忽略保存校验方法
            window['${/parameter/@layout_code}_ignore_required_before_save'] = function() {
                window['${/parameter/@layout_code}_not_ignore_required_flag'] = false;
            };
            
            window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function() {
                new Leaf.Window({
                    id: 'contract_history_window',
                    url: $('tenant_history_project_link').getUrl(),
                    params: {
                        project_id: '${/parameter/@project_id}'
                    },
                    fullScreen: true
                });
            };
            
            //审批页面中打包下载
            window['${/parameter/@layout_code}_user_button2_layout_dynamic_click'] = function() {
                var prj_project_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
                var prj_project_record = $(prj_project_ds_id).getAt(0);
                var tenant_info_record = $('${/parameter/@layout_code}_BP_INFO_MANAGER_prj_project_bp_ds').getAt(0);
                var project_id = prj_project_record.get('project_id');
                var project_number = prj_project_record.get('project_number');
                var bp_name = tenant_info_record.get('bp_name');
                var doc_code = project_number + '_' + bp_name;
                var url_l = $('prj_project_dowload_uploadfile').getUrl() + '?document_id=' + project_id + '&document_table=PRJ_PROJECT' + '&doc_code=' + encodeURI(doc_code) + '&all_flag=Y';
                window.open(href = url_l, target = "_self");
            
            };
            
            //保存前调用,生成项目编号
            window['${/parameter/@layout_code}_on_layout_dynamic_before_submit'] = function(ds, record) {
                window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
                var ds1 = $('${/parameter/@layout_code}_BP_INFO_MANAGER_prj_project_bp_ds');
                var ds1Record = ds1.getCurrentRecord();
                if (ds1Record) {
                    if (!Leaf.isEmpty(ds1Record.get('cell_phone'))) {
                        if (!checkMobile(ds1Record.get('cell_phone'))) {
                            Leaf.showMessage('提示', '申请人信息中,请输入正确格式的手机号码!');
                            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                            return false;
                        }
                    }
                    if (!Leaf.isEmpty(ds1Record.get('organization_code'))) {
                        if (check_org_code(ds1Record.get('organization_code')) != 0) {
                            Leaf.showMessage('提示', '申请人组织机构代码格式错误,请重新维护!');
                            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                            return false;
                        }
                    }
                    if (!Leaf.isEmpty(ds1Record.get('id_card_no'))) {
                        if (ds1Record.get('bp_class') == 'NP' && ds1Record.get('id_type') == 'ID_CARD') {
                            if (!checkCard(ds1Record.get('id_card_no'))) {
                                Leaf.showMessage('提示', '申请人信息中,请输入正确格式的身份证!');
                                window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                                return false;
                            }
                        }
                    }
                }
                var ds2 = $('${/parameter/@layout_code}_BP_TENANT_SEC_INFO_prj_project_bp_ds');
                var ds2Record = ds2.getCurrentRecord();
                if (ds2Record) {
                    if (!Leaf.isEmpty(ds2Record.get('cell_phone'))) {
                        if (!checkMobile(ds2Record.get('cell_phone'))) {
                            Leaf.showMessage('提示', '联合承租人信息中,请输入正确格式的手机号码!');
                            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                            return false;
                        }
                    }
                    if (!Leaf.isEmpty(ds2Record.get('id_card_no'))) {
                        if (ds2Record.get('bp_class') == 'NP' && ds2Record.get('id_type') == 'ID_CARD') {
                            if (!checkCard(ds2Record.get('id_card_no'))) {
                                Leaf.showMessage('提示', '联合承租人信息中,请输入正确格式的身份证!');
                                window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                                return false;
                            }
                        }
                    }
                }
                var ds3 = $('${/parameter/@layout_code}_G_INS_LP_prj_project_bp_ds');
                var ds3Record = ds3.getCurrentRecord();
                if (ds3Record) {
                    if (!Leaf.isEmpty(ds3Record.get('cell_phone'))) {
                        if (!checkMobile(ds3Record.get('cell_phone'))) {
                            Leaf.showMessage('提示', '担保人信息中,请输入正确格式的手机号码!');
                            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                            return false;
                        }
                    }
                    if (!Leaf.isEmpty(ds3Record.get('id_card_no'))) {
                        if (ds3Record.get('bp_class') == 'NP' && ds3Record.get('id_type') == 'ID_CARD') {
                            if (!checkCard(ds3Record.get('id_card_no'))) {
                                Leaf.showMessage('提示', '担保人信息中,请输入正确格式的身份证!');
                                window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                                return false;
                            }
                        }
                    }
                }
                var check_flag = false;
                var prj_project_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
                var prj_project_record = $(prj_project_ds_id).getAt(0);
                //紧急联系人不能为申请人和联合承租人、担保人,紧急联系人电话不能重复
                if (prj_project_record.get('bp_class') == 'NP') {
                    var tenant_info_record = $('${/parameter/@layout_code}_BP_INFO_MANAGER_prj_project_bp_ds').getAt(0);
                    var g_tenant_sec_info_record = $('${/parameter/@layout_code}_BP_TENANT_SEC_INFO_prj_project_bp_ds').getAt(0);
                    var guar_info_record = $('${/parameter/@layout_code}_G_INS_LP_prj_project_bp_ds').getAt(0);
                    var prj_project_bp_contact_ds = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_bp_contact_info');
                    prj_project_bp_contact_record = $(prj_project_bp_contact_ds).getAt(0);
                    //申请人和紧急联系人存在
                    if (tenant_info_record && prj_project_bp_contact_record) {
                        if (tenant_info_record.get('bp_name') && prj_project_bp_contact_record.get('contact_person')) {
                            if (tenant_info_record.get('bp_name').trim() == prj_project_bp_contact_record.get('contact_person').trim() && !Ext.isEmpty(prj_project_bp_contact_record.get('contact_person')) && !Ext.isEmpty(tenant_info_record.get('bp_name'))) {
                                Leaf.showMessage('${l:PROMPT}', '申请人、紧急联系人不能重复');
                                window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                                return check_flag;
                            }
                        }
                        //配偶和紧急联系人存在
                        if (tenant_info_record.get('bp_name_sp') && prj_project_bp_contact_record.get('contact_person')) {
                            if (tenant_info_record.get('bp_name_sp').trim() == prj_project_bp_contact_record.get('contact_person').trim() && !Ext.isEmpty(prj_project_bp_contact_record.get('contact_person')) && !Ext.isEmpty(tenant_info_record.get('bp_name_sp'))) {
                                Leaf.showMessage('${l:PROMPT}', '配偶、紧急联系人不能重复');
                                window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                                return check_flag;
                            }
                        }
                    }
                    //存在联合承租人和紧急联系人
                    if (g_tenant_sec_info_record && prj_project_bp_contact_record) {
                        if (g_tenant_sec_info_record.get('bp_name') && prj_project_bp_contact_record.get('contact_person')) {
                            if (g_tenant_sec_info_record.get('bp_name').trim() == prj_project_bp_contact_record.get('contact_person').trim() && !Ext.isEmpty(prj_project_bp_contact_record.get('contact_person')) && !Ext.isEmpty(g_tenant_sec_info_record.get('bp_name'))) {
                                Leaf.showMessage('${l:PROMPT}', '联合承租人、紧急联系人不能重复');
                                window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                                return check_flag;
                            }
                        }
                    }
                    //存在担保人和紧急联系人
                    if (prj_project_bp_contact_record && guar_info_record) {
                        if (prj_project_bp_contact_record.get('contact_person') && guar_info_record.get('bp_name')) {
                            if (prj_project_bp_contact_record.get('contact_person').trim() == guar_info_record.get('bp_name').trim() && !Ext.isEmpty(guar_info_record.get('bp_name')) && !Ext.isEmpty(prj_project_bp_contact_record.get('contact_person'))) {
                                Leaf.showMessage('${l:PROMPT}', '紧急联系人、担保人不能重复');
                                window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                                return check_flag;
                            }
                        }
                    }
                }
                if (record.get('project_number')) {
                    return true;
                }
                Leaf.request({
                    url: $('get_special_fields_link_id').getUrl(),
                    para: {
                        document_category: '${/parameter/@document_category}',
                        document_type: record.get('document_type'),
                        function_code: '${/parameter/@function_code}',
                        function_usage: '${/parameter/@function_usage}'
                    },
                    success: function(res) {
            
                        var document_number = res.result.document_number;
                        record.set('project_number', document_number);
                        record.set('document_category', '${/parameter/@document_category}');
                        check_flag = true;
                    },
                    error: function() {
                        window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                    },
                    failure: function() {
                        window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                    },
                    sync: true,
                    scope: this
                });
                return check_flag;
            };
            
            //全局变量,提交工作流标志,默认为Y
            var submit_wfl_flag = 'N';
            
            //提交审批
            window['${/parameter/@layout_code}_submit_approval_layout_dynamic_click'] = function() {
                Leaf.showConfirm('${l:HLS.PROMPT}', '确认提交审批?', function() {
                    window['${/parameter/@layout_code}_not_ignore_required_flag'] = true;
                    var root_ds = $('${/parameter/@layout_code}_virtual_ds');
                    if (root_ds.validate()) {
                        submit_wfl_flag = 'Y';
                        //提交先保存
                        window['${/parameter/@layout_code}_SAVE_LAYOUT_DYNAMIC_CLICK']();
                        //设置提交字段为Y
            
                    }
                });
            
            };
            
            //行批量下载
            
            function batch_download(check_id) {

                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
                // var document_id = $(ds_id).getAt(0).get('project_id');
                var project_number = $(ds_id).getAt(0).get('project_number');
                var project_id = $(ds_id).getAt(0).get('project_id');
                var document_table = 'PRJ_PROJECT';
                url = '${/request/@context_path}/modules/prj/lease_atm_batch_dl.lsc?document_table=' + document_table + '&document_id=' + project_id + '&check_id=' + check_id + '&doc_code=' + project_number + '&type=ZIP';
                window.open(url);
            }
            
            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 = $('prj500_cdd_downloadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id');
                    } else {
                        url = $('prj500_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: 'prj500_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) {
                var link_function = '';
                window['${/parameter/@layout_code}_hls_link_render_record'][record.id + '---' + name] = record;
                if (name == 'attachment') {
                    link_function = 'upload_file';
                    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] + ' ref="img">' + temp[0] + '</a>' + ',';
                            }
                        }
                        return url;
            
                    }
                } else if (name == 'batch_download') {

                    var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
                    var project_id = $(ds_id).getAt(0).get('project_id');
                    return '<a href="javascript:batch_download(' + record.get('check_id') + ')">' + config_record.get('prompt') + '</a>';
                    //
                    //window.open(url);
                }
            };
            
            
            
            //保存submitsuccess调用
            window['${/parameter/@layout_code}_on_layout_dynamic_submitsuccess'] = function(ds, record, res) {
                window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
                if (ds_id) {
                    record = $(ds_id).getAt(0);
                    project_id = record.get('project_id');
                    $('${/parameter/@layout_code}_ACY_prj_cdd_item_doc_ref_ds').setQueryParameter('cdd_list_id', record.get('cdd_list_id'));
                    $('${/parameter/@layout_code}_ACY_prj_cdd_item_doc_ref_ds').query();
                    $('${/parameter/@layout_code}_ACY_prj_cdd_item_doc_ref_ds').submit();
                }
                var quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation');
                var cacl_ln_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_fin_calculator_ln');
                $(quotation_ds_id).setQueryParameter('project_id', project_id);
                $(quotation_ds_id).query();
                $(cacl_ln_ds_id).setQueryParameter('project_id', project_id);
                $(cacl_ln_ds_id).query();
                //保存成功后,如果提交工作流标志为Y
                if (submit_wfl_flag == 'Y') {
                    submit_wfl_flag = 'N';
                    Leaf.request({
                        url: $('submit_approval_link').getUrl(),
                        para: {
                            project_id: record.get('project_id')
                        },
                        success: function() {
                            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                            $('${/parameter/@winid}').close();
                            Leaf.SideBar.show({
                                msg: '操作成功',
                                duration: 2000
                            });
            
                        },
                        failure: function() {
                            submit_wfl_flag = 'N';
                            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                        },
                        error: function() {
                            submit_wfl_flag = 'N';
                            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                        },
                        scope: this
                    });
            
                } else {
                    window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                }
            
            };
            
            //更新时调用
            window['${/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'], 'prj_project_lease_item');
                if (ds.id == ds_id) {
                    if (name == 'plate_resource') {
                        //自有外牌备注必输,牌照提供方必填
                        if (value == 'OWN_LICENCE') {
                            record.getField('nonlocal_plate_desc').setRequired(true);
                            $('${/parameter/@layout_code}_RECEIPT_INFO_prj_project_ds').getCurrentRecord().getField('license_provider_name').setRequired(true);
                            $('${/parameter/@layout_code}_RECEIPT_INFO_prj_project_ds').getCurrentRecord().getField('license_provider_code').setRequired(true);
                        } //自有上海牌备注不必输,牌照提供方必填
                        else if (value == 'OWN_SH_LICENCE') {
                            record.getField('nonlocal_plate_desc').setRequired(false);
                            $('${/parameter/@layout_code}_RECEIPT_INFO_prj_project_ds').getCurrentRecord().getField('license_provider_name').setRequired(true);
                            $('${/parameter/@layout_code}_RECEIPT_INFO_prj_project_ds').getCurrentRecord().getField('license_provider_code').setRequired(true);
                        } else {
                            record.getField('nonlocal_plate_desc').setRequired(false);
                            $('${/parameter/@layout_code}_RECEIPT_INFO_prj_project_ds').getCurrentRecord().getField('license_provider_name').setRequired(false);
                            $('${/parameter/@layout_code}_RECEIPT_INFO_prj_project_ds').getCurrentRecord().getField('license_provider_code').setRequired(false);
                        }
                    }
                    //管理员报价
                    if (name == 'price_list') {
                        if (value == 'YONDA_STAFF_PRODUCT') {
                            record.getField('lease_start_date').setReadOnly(false);
                            record.getField('lease_start_date').setRequired(true);
                            record.getField('pmt').setReadOnly(false);
                            // record.getField('balloon').setReadOnly(false);
                            // record.getField('balloon').setRequired(true);
                        } else {
                            record.set('lease_start_date', null);
                            record.set('pmt', '');
                            // record.set('balloon', '');
                            record.getField('lease_start_date').setReadOnly(true);
                            record.getField('lease_start_date').setRequired(false);
                            record.getField('pmt').setReadOnly(true);
                            // record.getField('balloon').setReadOnly(true);
                            // record.getField('balloon').setRequired(false);
                        }
                        //宝马厂商贴息产品自由选择保证金比例
                        if (value == 'YONDA_BMW_DR_PRODUCT' || value == 'YONDA_TD_PRODUCT') {
            
                            record.getField('deposit_ratio_n').setReadOnly(false);
                            record.getField('deposit_ratio_n').setRequired(true);
                        } else {
                            record.set('deposit_ratio_n', null);
                            record.set('deposit_ratio', '');
                            record.getField('deposit_ratio_n').setReadOnly(true);
                            record.getField('deposit_ratio_n').setRequired(false);
                        }
                        //根据报价设置期数,支付频率,首付款
                        if (value) {
                            Leaf.request({
                                url: $('get_calc_validate_sql_link').getUrl(),
                                para: {
                                    price_list: value
                                },
                                success: function(data) {
                                    if (data.result.record && !data.result.record.length) {
                                        //设置期数和支付频率validate_sql同时设置默认值
                                        var lese_item_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_lease_item');
                                        $(lese_item_ds_id).getField('annual_pay_times_n').setOptions('${/parameter/@layout_code}G_INFO_annual_pay_times_combobox_ds');
                                        $(lese_item_ds_id).getField('lease_times_n').setOptions('${/parameter/@layout_code}G_INFO_lease_times_combobox_ds');
                                        $('${/parameter/@layout_code}G_INFO_annual_pay_times_combobox_ds').setQueryParameter('validation_sql', data.result.record.validate_sql_2);
                                        $('${/parameter/@layout_code}G_INFO_lease_times_combobox_ds').setQueryParameter('validation_sql', data.result.record.validate_sql_1);
                                        var lease_item_record = $(lese_item_ds_id).getAt(0);
                                        lease_item_record.set('annual_pay_times', data.result.record.default_value_2);
                                        lease_item_record.set('annual_pay_times_n', data.result.record.default_value_n_2);
                                        lease_item_record.set('lease_times', data.result.record.default_value_1);
                                        lease_item_record.set('lease_times_n', data.result.record.default_value_n_1);
                                        lease_item_record.set('down_payment_ratio', data.result.record.default_value_3);
                                        //修改必输
                                        lease_item_record.getField('annual_pay_times_n').setReadOnly(false);
                                        lease_item_record.getField('annual_pay_times_n').setRequired(true);
                                        lease_item_record.getField('lease_times_n').setReadOnly(false);
                                        lease_item_record.getField('lease_times_n').setRequired(true);
                                        lease_item_record.getField('down_payment_ratio').setReadOnly(false);
                                        lease_item_record.getField('down_payment_ratio').setRequired(true);
                                    }
            
                                },
                                failure: function() {
            
                                   },
                                error: function() {
            
                                   },
                                scope: this
                            });
                        } else {
                            var lese_item_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_lease_item');
                            var lease_item_record = $(lese_item_ds_id).getAt(0);
                            lease_item_record.set('annual_pay_times', '');
                            lease_item_record.set('annual_pay_times_n', '');
                            lease_item_record.set('lease_times', '');
                            lease_item_record.set('lease_times_n', '');
                            lease_item_record.set('down_payment_ratio', '');
                            //修改必输
                            lease_item_record.getField('annual_pay_times_n').setReadOnly(true);
                            lease_item_record.getField('annual_pay_times_n').setRequired(false);
                            lease_item_record.getField('lease_times_n').setReadOnly(true);
                            lease_item_record.getField('lease_times_n').setRequired(false);
                            lease_item_record.getField('down_payment_ratio').setReadOnly(true);
                            lease_item_record.getField('down_payment_ratio').setRequired(false);
                        }
                    }
                    //设置车牌
                    if (name == 'financial_range_code') {
                        if (value == '10' || value == '20' || value == '30' || value == '80' || Ext.isEmpty(value)) {
                            record.set('plate_price', '');
                            record.getField('plate_price').setReadOnly(true);
                            record.getField('plate_price').setRequired(false);
                        } else {
                            record.getField('plate_price').setReadOnly(false);
                            record.getField('plate_price').setRequired(true);
                        }
                        //设置保险费
                        if (value == '30' || value == '40' || value == '80') {
                            record.getField('insurance_price').setReadOnly(false);
                            record.getField('insurance_price').setRequired(true);
                        } else {
                            record.set('insurance_price', '');
                            record.getField('insurance_price').setReadOnly(true);
                            record.getField('insurance_price').setRequired(false);
                        }
                        //不含购置税
                        // if (value == '10' || value == '50' || value == '60' || value == '80') {
                            // record.set('purchase_tax', '');
                        // } else {
                            // if (value && record.get('guide_price')) {
                                // var purchase_tax = Math.ceil(record.get('guide_price') / 11.7);
                                // record.set('purchase_tax', purchase_tax);
                            // }
                        // }
                    }
                    //求优惠幅度
                    // if (name == 'guide_price' || name == 'invoice_price') {
                        // if (record.get('guide_price') && record.get('guide_price')) {
                            // var preferential_price = record.get('guide_price') - record.get('invoice_price');
                            // record.set('preferential_price', preferential_price);
                            // var guide_price_check = document.getElementById('${/parameter/@layout_code}_G_INFO_PRJ_PROJECT_LEASE_ITEM_GUIDE_PRICE');
                            // var invoice_price_check = document.getElementById('${/parameter/@layout_code}_G_INFO_PRJ_PROJECT_LEASE_ITEM_INVOICE_PRICE');
                            // if (record.get('guide_price') < record.get('invoice_price')) {
                                // guide_price_check.style.color = "#FF0000";
                                // invoice_price_check.style.color = "#FF0000";
                            // } else {
                                // guide_price_check.style.color = "black";
                                // invoice_price_check.style.color = "black";
                            // }
                        // }
                        // if (name == 'guide_price' && record.get('guide_price')) {
                            // //求购置税,选购置税才算购置税
                            // if (record.get('financial_range_code') == '20' || record.get('financial_range_code') == '30' || record.get('financial_range_code') == '40' || record.get('financial_range_code') == '70') {
                                // purchase_tax = Math.ceil(record.get('guide_price') / 11.7);
                                // record.set('purchase_tax', purchase_tax);
                            // }
                        // }
                    // }
                }
                if (ds.id == '${/parameter/@layout_code}_BP_INFO_MANAGER_prj_project_bp_ds') {
                    //无贷款月供为0
                    if (name == "house_loans_flag") {
                        if (value == 'N') {
                            record.set('house_month_amount', 0);
                        }
                    }
                    if (name == 'bp_name') {
                        var project_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
                        project_record = $(project_ds_id).getAt(0);
                        project_record.set('bp_name', value);
                    }
                    if (name == 'organization_code') {
                        Leaf.request({
                            url: $('get_organization_code_id').getUrl(),
                            para: {
                                organization_code: value
                            },
                            success: function(data) {
                                if (data.result.record && !data.result.record.length) {
                                    //申请人信息
                                    for (var name in data.result.record) {
                                        record.set(name, data.result.record[name]);
                                    }
            
                                }
            
                            },
                            failure: function() {
            
                               },
                            error: function() {
            
                               },
                            scope: this
                        });
                    }
                    if (name == 'id_card_no') {
                        Leaf.request({
                            url: $('get_id_card_no_info_id').getUrl(),
                            para: {
                                id_card_no: value
                            },
                            success: function(data) {
                                if (data.result.record && !data.result.record.length) {
                                    //申请人信息
                                    for (var name in data.result.record) {
                                        record.set(name, data.result.record[name]);
                                    }
            
                                }
            
                            },
                            failure: function() {
            
                               },
                            error: function() {
            
                               },
                            scope: this
                        });
                    }
                }
            
                if (ds.id == '${/parameter/@layout_code}_BP_INFO_MANAGER_prj_project_bp_ds') {
                    //无贷款月供为0
                    if (name == "house_loans_flag") {
                        if (value == 'N') {
                            record.set('house_month_amount', 0);
                        }
                    }
                    if (name == 'organization_code') {
                        Leaf.request({
                            url: $('get_organization_code_id').getUrl(),
                            para: {
                                organization_code: value
                            },
                            success: function(data) {
                                if (data.result.record && !data.result.record.length) {
                                    //申请人信息
                                    for (var name in data.result.record) {
                                        record.set(name, data.result.record[name]);
                                    }
            
                                }
            
                            },
                            failure: function() {
            
                               },
                            error: function() {
            
                               },
                            scope: this
                        });
                    }
                }
                if (ds.id == '${/parameter/@layout_code}_BP_TENANT_SEC_INFO_prj_project_bp_ds') {
                    //无贷款月供为0
                    if (name == "house_loans_flag") {
                        if (value == 'N') {
                            record.set('house_month_amount', 0);
                        }
                    }
                    if (name == 'id_card_no') {
                        id_type = record.get('id_type');
                        Leaf.request({
                            url: $('get_id_card_no_tenant_sec_id').getUrl(),
                            para: {
                                id_card_no: value,
                                id_type: id_type
                            },
                            success: function(data) {
                                if (data.result.record && !data.result.record.length) {
                                    // 联合承租人
                                    for (var name in data.result.record) {
                                        record.set(name, data.result.record[name]);
                                    }
                                }
            
                            },
                            failure: function() {
            
                               },
                            error: function() {
            
                               },
                            scope: this
                        });
                    }
                }
                if (ds.id == '${/parameter/@layout_code}_G_INS_LP_prj_project_bp_ds') {
                    //无贷款月供为0
                    if (name == "house_loans_flag") {
                        if (value == 'N') {
                            record.set('house_month_amount', 0);
                        }
                    }
                    if (name == 'id_card_no') {
                        var id_type = record.get('id_type');
                        Leaf.request({
                            url: $('get_id_card_no_info_guar_id').getUrl(),
                            para: {
                                id_card_no: value,
                                id_type: id_type
                            },
                            success: function(data) {
                                if (data.result.record && !data.result.record.length) {
                                    // 担保人
                                    for (var name in data.result.record) {
                                        record.set(name, data.result.record[name]);
                                    }
                                }
            
                            },
                            failure: function() {
            
                               },
                            error: function() {
            
                               },
                            scope: this
                        });
                    }
                }
                
                if (ds.id == '${/parameter/@layout_code}_G_INS_P_ORG_prj_project_bp_ds') {
                    if (name == 'organization_code') {
                        Leaf.request({
                            url: $('get_org_code_info_guar_id').getUrl(),
                            para: {
                                organization_code: value,
                            },
                            success: function(data) {
                                if (data.result.record && !data.result.record.length) {
                                    // 担保人
                                    for (var name in data.result.record) {
                                        record.set(name, data.result.record[name]);
                                    }
                                }
            
                            },
                            failure: function() {
            
                               },
                            error: function() {
            
                               },
                            scope: this
                        });
                    }
                }
            };
            
            //新增和加载时调用(form)
            window['${/parameter/@layout_code}_on_layout_dynamic_form_add_and_load'] = function(ds, record, config_records) {
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_lease_item');
                if (ds.id == ds_id && ds_id) {
                    // var guide_price = record.get('guide_price');
                    // var invoice_price = record.get('invoice_price');
                    // var guide_price_check = document.getElementById('${/parameter/@layout_code}_G_INFO_PRJ_PROJECT_LEASE_ITEM_GUIDE_PRICE');
                    // var invoice_price_check = document.getElementById('${/parameter/@layout_code}_G_INFO_PRJ_PROJECT_LEASE_ITEM_INVOICE_PRICE');
                    // if (!Ext.isEmpty(guide_price) && !Ext.isEmpty(invoice_price) && guide_price < invoice_price) {
                        // guide_price_check.style.color = "#FF0000";
                        // invoice_price_check.style.color = "#FF0000";
                    // } else {
                        // guide_price_check.style.color = "black";
                        // invoice_price_check.style.color = "black";
                    // }
                    var value = record.get('financial_range_code');
                    if (!Ext.isEmpty(value) && '${/parameter/@maintain_type}' != 'QUERY') {
                        if (value == '10' || value == '20' || value == '30' || value == '80' || Ext.isEmpty(value)) {
                            record.set('plate_price', '');
                            record.getField('plate_price').setReadOnly(true);
                            record.getField('plate_price').setRequired(false);
                        } else {
                            record.getField('plate_price').setReadOnly(false);
                            record.getField('plate_price').setRequired(true);
                        }
                        //设置保险费
                        if (value == '30' || value == '40' || value == '80') {
                            record.getField('insurance_price').setReadOnly(false);
                            record.getField('insurance_price').setRequired(true);
                        } else {
                            record.set('insurance_price', '');
                            record.getField('insurance_price').setReadOnly(true);
                            record.getField('insurance_price').setRequired(false);
                        }
                        //不含购置税
                        // if (value == '10' || value == '50' || value == '60' || value == '80') {
                            // record.set('purchase_tax', '');
                        // } else {
                            // if (value && record.get('guide_price')) {
                                // var purchase_tax = Math.ceil(record.get('guide_price') / 11.7);
                                // record.set('purchase_tax', purchase_tax);
                            // }
                        // }
                    }
                    var price_list = record.get('price_list');
                    if (!Ext.isEmpty(price_list) && '${/parameter/@maintain_type}' != 'QUERY') {
                        //让配置为只读的可输
                        record.getField('annual_pay_times_n').setReadOnly(false);
                        record.getField('annual_pay_times_n').setRequired(true);
                        record.getField('lease_times_n').setReadOnly(false);
                        record.getField('lease_times_n').setRequired(true);
                        record.getField('down_payment_ratio').setReadOnly(false);
                        record.getField('down_payment_ratio').setRequired(true);
                        if (price_list == 'YONDA_STAFF_PRODUCT') {
                            record.getField('lease_start_date').setReadOnly(false);
                            record.getField('lease_start_date').setRequired(true);
                            record.getField('pmt').setReadOnly(false);
                            // record.getField('balloon').setReadOnly(false);
                            // record.getField('balloon').setRequired(true);
                        } else {
                            record.set('lease_start_date', null);
                            record.set('pmt', '');
                            record.set('balloon', '');
                            record.getField('lease_start_date').setReadOnly(true);
                            record.getField('lease_start_date').setRequired(false);
                            record.getField('pmt').setReadOnly(true);
                           c
                        }
                        //厂方贴息保证金可输
                        if (price_list == 'YONDA_BMW_DR_PRODUCT'|| price_list == 'YONDA_TD_PRODUCT') {
                            record.getField('deposit_ratio_n').setReadOnly(false);
                            record.getField('deposit_ratio_n').setRequired(true);
                        } else {
                            record.set('deposit_ratio_n', null);
                            record.set('deposit_ratio', '');
                            record.getField('deposit_ratio_n').setReadOnly(true);
                            record.getField('deposit_ratio_n').setRequired(false);
                        }
                    }
                    var plate_resource = record.get('plate_resource');
                    if (!Ext.isEmpty(plate_resource) && '${/parameter/@maintain_type}' != 'QUERY' && '${/parameter/@wfl_flag}' != 'Y') {
                        //自有外牌备注必输,牌照提供方必填
                        if (plate_resource == 'OWN_LICENCE') {
                            record.getField('nonlocal_plate_desc').setRequired(true);
                            $('${/parameter/@layout_code}_RECEIPT_INFO_prj_project_ds').getCurrentRecord().getField('license_provider_name').setRequired(true);
                            $('${/parameter/@layout_code}_RECEIPT_INFO_prj_project_ds').getCurrentRecord().getField('license_provider_code').setRequired(true);
                        } //自有上海牌备注不必输,牌照提供方必填
                        else if (plate_resource == 'OWN_SH_LICENCE') {
                            record.getField('nonlocal_plate_desc').setRequired(false);
                            $('${/parameter/@layout_code}_RECEIPT_INFO_prj_project_ds').getCurrentRecord().getField('license_provider_name').setRequired(true);
                            $('${/parameter/@layout_code}_RECEIPT_INFO_prj_project_ds').getCurrentRecord().getField('license_provider_code').setRequired(true);
                        } else {
                            record.getField('nonlocal_plate_desc').setRequired(false);
                            $('${/parameter/@layout_code}_RECEIPT_INFO_prj_project_ds').getCurrentRecord().getField('license_provider_name').setRequired(false);
                            $('${/parameter/@layout_code}_RECEIPT_INFO_prj_project_ds').getCurrentRecord().getField('license_provider_code').setRequired(false);
                        }
                    }
            
                }
            };
        ]]></script>
        <!-- <a:switch test="/parameter/@wfl_flag">
            <a:case value="Y">
                <script type="text/javascript"><![CDATA[
            //工作流中同意按钮调用保存
            zjwfl5110_ApproveChecker_add('agree', function() {
                prj_project_ds_save();
                return true;
            });
            
            function prj_project_ds_save(s) {
                window['${/parameter/@layout_code}_SAVE_LAYOUT_DYNAMIC_CLICK']();
                return true;
            }
        ]]></script>
            </a:case>
        </a:switch> -->
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>