prj_project_maintain_special.lview 46.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 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
<?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:init-procedure>
        <a:model-query defaultWhereClause="t1.user_id=${/session/@user_id}" model="prj.PRJ500D.sys_user_lv" rootPath="user_name_path"/>
    </a:init-procedure>
    <a:view>
        <a:link id="get_car_organization_id" model="prj.PRJ500D.yonda_car_organization" modelaction="query"/>
        <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="get_organization_code_id" model="prj.PRJ500D.hls_bp_master_org_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_id_card_no_tenant_sec_id" model="prj.PRJ500D.hls_bp_master_np_tenant_sec_v" modelaction="query"/>
        <a:link id="user_id_query_link" model="prj.PRJ500D.sys_user_lv" 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_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="get_bp_id_invoice_link" model="prj.PRJ500D.get_bp_id_invoice" modelaction="query"/>
        <a:link id="prj_project_dowload_uploadfile" url="${/request/@context_path}/modules/prj/lease_atm_batch_dl.lsc"/>
        <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"/>
        <a:link id="get_plate_source_link" model="prj.PRJ500D.prj_project_get_license_type" modelaction="query"/>
        <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 check_isload = setInterval(function() {
                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');
                        }
                    }
                } else {
                    clearInterval(check_isload);
                }
            }, 1000);
            
            //Author:zlf
            //这个页面为零售特批工作流审批页面
            //校验与prj_project_maintain页面对比,在  新增和加载时调用(form)和  更新时调用  两段js有很大区别
            //该页面是复制于modules/prj/PRJ500N/prj_project_create_special.screen,然后再做修改,源码作为备份
            
            
            //申请历史
            window['${/parameter/@layout_code}_user_button2_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_button3_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_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_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;
                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;
            };
            
            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()) {
                        //设置提交字段为Y
                        submit_wfl_flag = 'Y';
                        //提交先保存
                        window['${/parameter/@layout_code}_SAVE_LAYOUT_DYNAMIC_CLICK']();
            
                    }
                });
            
            };
            
            
            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] + '>' + temp[0] + '</a>' + ',';
                            }
                        }
                        return url;
            
                    }
                }
            };
            
            //报价
            
            // function winOpen_quotation() {
                // var head_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
                // var head_ds = $(head_ds_id);
                // var head_record = head_ds.getAt(0);
                // var prj_quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation');
                // var hls_fin_calculator_ln_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_fin_calculator_ln');
                // record = $(prj_quotation_ds_id).getAt(0);
                // if (!head_record.get('project_id')) {
                    // Leaf.showMessage('${l:HLS.PROMPT}', '请先保存!');
                    // return;
                // }
                // var parent_base_table_pk = 'project_id';
                // var url;
                // if ('${/parameter/@calc_type}' == 'LITE_CALCULATOR') {
                    // url = $('hls_fin_calc_quotation_header_link_id').getUrl();
                // } else if ('${/parameter/@calc_type}' == 'CLASSIC_CALCULATOR') {
                    // url = $('hls_fin_calculator_update_link_id').getUrl();
                // } else {
                    // Leaf.showMessage('${l:PROMPT}', '${l:HLS.CALC_TYPE_IS_NULL}');
                    // return;
                // }
                // var project_id = head_record.get('project_id');
                // var parent_pk_value = head_record.get('project_id');
                // record.set('document_category', '${/parameter/@document_category}');
                // record.set('function_code', '${/parameter/@function_code}');
                // record.set('function_usage', '${/parameter/@function_usage}');
                // record.set('document_id', parent_pk_value);
                // record.set('to_doc_table', 'HLS_FIN_CALCULATOR_HD');
                // record.set('from_doc_table', 'PRJ_QUOTATION');
                // record.set('from_doc_pk', record.get('quotation_id'));
                // record.set('calculate_flag', 'N');
                // //写死一些参数
                // record.set('contract_seq', 1);
                // record.set('version', '1');
                // record.set('internal_confirm', 'Y');
                // record.set('external_confirm', 'Y');
                // record.set('enabled_flag', 'Y');
                // var lease_item_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_lease_item');
                // var lease_item_record = $(lease_item_ds_id).getAt(0);
                // record.set('price_list', lease_item_record.get('price_list'));
                // record.set('annual_pay_times', record.get('annual_pay_times_num'));
                // record.set('company_id', head_record.get('company_id'));
                // var calc_recreate_L_formula;
                // if (record.get('quotation_id') && !record.get('calc_session_id')) {
                    // calc_recreate_L_formula = 'Y';
                    // record.set('_status', 'update');
                // } else if (record.get('quotation_id') && record.get('calc_session_id')) {
                    // calc_recreate_L_formula = 'N';
                    // record.set('_status', 'execute');
                // } else {
                    // calc_recreate_L_formula = 'Y';
                    // record.set('_status', 'insert');
                // }
                // 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'];
                        // $(prj_quotation_ds_id).query();
                        // var quotation_id = record.get('quotation_id') || res.result.quotation_id;
                        // var win = new Leaf.Window({
                            // id: 'hls_fin_calc_quotation_link_winid',
                            // params: {
                                // document_id: parent_pk_value,
                                // document_category: '${/parameter/@document_category}',
                                // maintain_type: 'update',
                                // calc_session_id: res.result.record.calc_session_id,
                                // quotation_id: quotation_id,
                                // dsId: prj_quotation_ds_id,
                                // winId: 'hls_fin_calc_quotation_link_winid',
                                // global_flag: 'Y',
                                // id_num: 0,
                                // calc_type: '${/parameter/@calc_type}',
                                // recreate_L_formula: calc_recreate_L_formula,
                                // currency_code: 'CNY'
                            // },
                            // url: url,
                            // fullScreen: true,
                            // draggable: true
                        // });
                        // win.on('close', function() {
                            // $(prj_quotation_ds_id).setQueryParameter('project_id', project_id);
                            // $(hls_fin_calculator_ln_ds_id).setQueryParameter('project_id', project_id);
                            // $(prj_quotation_ds_id).query();
                            // $(hls_fin_calculator_ln_ds_id).query();
                            // window['${/parameter/@layout_code}_unlock_layout_dynamic_window'];
                        // });
                    // },
                    // failure: function() {
                        // window['${/parameter/@layout_code}_unlock_layout_dynamic_window'];
                    // },
                    // error: function() {
                        // window['${/parameter/@layout_code}_unlock_layout_dynamic_window'];
                    // },
                    // scope: this
                // });
            // }
            
            
            
            //按钮渲染
            // window['${/parameter/@bp_seq}${/parameter/@layout_code}_dynamic_button_renderer'] = function(value, record, name, config_record, bp_seq) {
                // var link_function = '';
                // if (name == 'quotation') {
                    // link_function = 'winOpen_quotation';
                // }
                // if (Ext.isIE || Ext.isIE9 || Ext.isIE10) {
                    // return '<button style="font-size:11px;height:22px;width:70%;text-align:center;padding:0 4px 4px 0" onclick="window[\'' + link_function + '\']();"><div style="height: 18px; line-height: 16px; text-decoration: none;">' + config_record.get('prompt') + '</div></button>';
                // } else {
                    // return '<button style="font-size:11px;height:22px;width:70%;text-align:center;" onclick="window[\'' + link_function + '\']();">' + config_record.get('prompt') + '</button>';
                // }
            
            // };
            
            
            
            // function get_project_bp_ds_id(layoutDataSetList, bp_category) {
                // var base_table_temp = 'prj_project_bp_ds';
                // for (var i = 0;i < layoutDataSetList.length;i++) {
                    // var dsId = layoutDataSetList[i];
                    // if (dsId.substring(dsId.length - base_table_temp.length, dsId.length) == base_table_temp) {
                        // var record = $(dsId).getAt(0);
                        // if (record) {
                            // if (record.get('bp_category') == bp_category) {
                                // return dsId;
                            // }
                        // }
                    // }
                // }
                // return '';
            // }
            
            //保存submitsuccess调用
            window['${/parameter/@layout_code}_on_layout_dynamic_submitsuccess'] = function(ds, record, res) {
                window['${/parameter/@layout_code}_lock_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 == '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 (ds.id == '${/parameter/@layout_code}_BP_INFO_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') {
                            var id_type = record.get('id_type');
                            Leaf.request({
                                url: $('get_id_card_no_info_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}_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') {
                            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
                        });
                    }
                }
                
            };
            
            Leaf.onReady(function() {
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
                var head_record = $(ds_id).getAt(0);
                head_record.set('owner_user_id', '${/model/user_name_path/record/@user_id}');
                head_record.set('owner_user_id_n', '${/model/user_name_path/record/@user_id_n}');
                head_record.set('owner_user_tel', '${/model/user_name_path/record/@phone}');
                Leaf.request({
                    url: $('get_car_organization_id').getUrl(),
                    para: {
                        unit_id: head_record.get('unit_id')
                    },
                    success: function(data) {
                        if (data.result.record && !data.result.record.length) {
                            head_record.set('organization_id', data.result.record.organization_id);
                            head_record.set('organization_id_n', data.result.record.organization_name);
                        } else {
                            //没有找到值置空
                            head_record.set('organization_id', '');
                            head_record.set('organization_id_n', '');
                        }
            
                    },
                    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');
                var prj_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
                if (ds.id == prj_ds_id && prj_ds_id) {
                    var license_provider_name = record.get('license_provider_name');
                    head_record = $(prj_ds_id).getAt(0);
                    if ('${/parameter/@wfl_flag}' != 'Y' &&'${/parameter/@maintain_type}' != 'QUERY' &&'${/parameter/@maintain_type}' != 'READONLY') {
                        Leaf.request({
                            url: $('get_plate_source_link').getUrl(),
                            para: {
                                project_id: head_record.get('project_id')
                            },
                            success: function(data) {
                                if (data.result.record && !data.result.record.length) {
                                    if (!Ext.isEmpty(data.result.record.plate_resource)) {

                                        if (data.result.record.plate_resource == 'OWN_LICENCE' || data.result.record.plate_resource == 'OWN_SH_LICENCE') {
                                            record.getField('license_provider_name').setRequired(true);
                                            record.getField('license_provider_code').setRequired(true);
                                        } else {
                                            record.getField('license_provider_name').setRequired(false);
                                            record.getField('license_provider_code').setRequired(false);
                                        }
            
                                    }
                                }
                            },
                            failure: function() {
            
                               },
                            error: function() {
            
                               },
                            scope: this
                        });
                    }
                }
                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_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);
                        } //自有上海牌备注不必输,牌照提供方必填
                        else if (plate_resource == 'OWN_SH_LICENCE') {
                            record.getField('nonlocal_plate_desc').setRequired(false);
                        } else {
                            record.getField('nonlocal_plate_desc').setRequired(false);
                        }
                    }
            
                }
            };
        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>