con_contract_content_confirm.lview 66.1 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 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: ZLF  
    $Date: 2014-11-20 下午8:50:38  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:s="leaf.plugin.script" xmlns:a="http://www.leaf-framework.org/application"
          customizationEnabled="true" trace="true">
    <a:init-procedure>
        <s:server-script import="con_print_path.js"><![CDATA[
            set_parameter_file_path();
            ]]>
        </s:server-script>
    </a:init-procedure>
    <a:view>
        <a:link id="con_contract_content_asset_detail_link_id"
                url="${/request/@context_path}/modules/cont/CON505/con_contract_content_asset_detail.lview"/>
        <!--         <a:link id="con_contract_update_print_fin_link_id" url="${/request/@context_path}/modules/cont/CON500/con_contract_update_print_word.lview"/> -->
        <a:link id="con_contract_create_content_link_id" model="cont.CON505.con_contract_create_content"
                modelaction="update"/>
        <a:link id="con_contract_save_print_information_link_id" model="cont.CON505.con_contract_save_print_information"
                modelaction="update"/>
        <a:link id="con_contract_uploadfile" url="${/request/@context_path}/uploadFile.lview"/>
        <a:link id="con_contract_downloadfile" url="${/request/@context_path}/downloadFile.lview"/>
        <a:link id="con_contract_content_confirm_link"
                url="${/request/@context_path}/modules/cont/CON504/con_contract_content_print.lview"/>
        <a:link id="con_contract_content_delete_link" model="cont.CON505.con_contract_content_delete"
                modelaction="batch_update"/>
        <a:link id="con_contract_dowload_uploadfile"
                url="${/request/@context_path}/modules/cont/CON500/con_atm_batch_dl.lsc"/>
        <a:link id="con_atm_batch_download_pdf_link_id"
                url="${/request/@context_path}/modules/cont/CON500/con_atm_batch_download_pdf.lsc"/>
        <!--<a:link id="con_atm_batch_download_pdf_link_id"
                url="${/request/@context_path}/modules/cont/CON500/con_atm_batch_dl.lsc"/>-->
        <a:link id="con_atm_batch_pdf_link_id"
                url="${/request/@context_path}/modules/cont/CON500/con_atm_batch_pdf.lsc"/>
        <a:link id="con504_change_confirm_status_link" model="cont.CON504.con_change_content_confirm_status"
                modelaction="execute"/>
        <a:link id="con_contract_update_print_fin_link_id"
                url="${/request/@context_path}/modules/cont/CON504/con_contract_update_print_word.lsc"/>
        <a:link id="file_copy_from_template_link_id"
                url="${/request/@context_path}/office_edit_online/file_copy_from_template.lsc"/>
        <a:link id="con_contract_content_edit_office_online_link_id"
                url="${/request/@context_path}/modules/cont/CON500/con_contract_content_edit_office_online.lview"/>
        <a:link id="con_doc_batch_create_link_id"
                url="${/request/@context_path}/modules/cont/CON500/con_doc_batch_create.lsc"/>


<!--        <a:link id="pdf_download_link" url="${/request/@context_path}/modules/xxx/pdf_download.lsc"/>-->

        <a:link id="update_content_type_link" model="cont.CON501N.con_contract_signature" modelaction="update"/>

        <a:link id="cancel_sign_link" model="cont.CON501N.con_contract_signature" modelaction="delete"/>


        <script type="text/javascript"><![CDATA[
        //设置header token
        var header = $jq('meta[name=_csrf_header]').attr('content');
        var token = $jq('meta[name=_csrf]').attr('content');
        $jq(document).ajaxSend(function (e, xhr, options) {
            xhr.setRequestHeader(header, token);
        });
        var numnn = 'Y';

        function on_result_query(ds) {
            if (change_flag == numnn) {
                if (ds.id == 'con_contract_update_print_detail_line_ds') {
                    records = $('con_contract_update_print_detail_line_ds').getAll();
                    var datas = [];
                    for (var i = 0; i < records.length; i++) {
                        var obj = {};
                        obj['content_id'] = records[i].get('content_id');
                        obj['_status'] = 'delete';
                        datas[i] = obj;
                    }
                    Leaf.request({
                        url: $('con_contract_content_delete_link').getUrl(),
                        para: datas,
                        success: function () {
                            Leaf.SideBar.show({
                                msg: '操作成功',
                                duration: 2000
                            });
                            $('con_contract_update_print_detail_line_ds').query();
                        },
                        scope: this
                    });
                    change_flag = 'N';

                }

            }
        }

        function set_print_detail_btn_disable() {
            $('con_print_detail_print_id').disable();
        }

        function set_print_detail_btn_enable() {
            $('con_print_detail_print_id').enable();
        }

        function con_print_detail_query() {
            $('con_contract_update_print_detail_line_ds').query();
            $('con_print_detail_print_id').enable();
        }

        function con_print_detail_clear() {
            $('con_contract_update_print_detail_grid_id').clear();
        }

        function line_refresh() {
            $('con_contract_update_print_detail_line_ds').query();
        }


        function con_print_detail_print() {
            var result_ds = $('con_contract_update_print_detail_line_ds');
            var records = result_ds.getAll();
            var total_count = 0;
            for (var m = 0; m < records.length; m++) {
                if (records[m].get('file_exists_flag') != 'Y') {
                    total_count = total_count + 1;
                }
            }
            if (total_count === 0) {
                Leaf.showMessage('${l:PROMPT}', '文本都已生成');
                return;
            }
            var rd = result_ds.getSelected();
            var content_id = rd[0].get('content_id');
            Leaf.request({
                url: $('file_copy_from_template_link_id').getUrl(),
                para: {
                    contract_id: '${/parameter/@contract_id}',
                    content_id: content_id,
                    file_path: '${/parameter/@file_path}',
                    batch_flag: 'Y'
                },
                success: function (res) {
                    var global_i = 0;
                    var execute_i = 0;

                    function open_batch_window(i) {
                        var record = records[i];
                        if (record.get('content_id') && record.get('file_exists_flag') != 'Y') {
                            execute_i++;
                            Leaf.Masker.mask($('${/parameter/@winid}').wrap, '正在执行第' + execute_i + '条,' + record.get('content_number') + ',请等待,' + '总计' + total_count + '条');
                            var win = new Leaf.Window({
                                id: 'edit_office_online_link_winid' + i,
                                url: $('con_contract_content_edit_office_online_link_id').getUrl(),
                                params: {
                                    content_id: record.get('content_id'),
                                    winid: 'edit_office_online_link_winid' + i,
                                    first_copy_flag: 'Y',
                                    contract_id: '${/parameter/@contract_id}',
                                    batch_flag: 'Y'
                                },
                                width: 1000,
                                height: 1000,
                                x: -10000,
                                y: -10000,
                                draggable: true,
                                modal: false
                            });
                            win.on('close', function () {
                                Leaf.Masker.unmask($('${/parameter/@winid}').wrap);
                                if (global_i == records.length - 1) {
                                    result_ds.query(result_ds.currentPage);
                                } else {
                                    global_i++;
                                    open_batch_window(global_i);
                                }
                            });
                        } else {
                            global_i++;
                            open_batch_window(global_i);
                        }
                    }

                    open_batch_window(global_i);
                },
                error: function () {
                    unlock_current_window();
                },
                failure: function () {
                    unlock_current_window();
                },
                scope: this
            });

        }


        //保留历史版本
        // function con_print_rec(record) {
        // Leaf.request({
        // url: $('con_contract_save_print_information_link_id').getUrl(),
        // para: {
        // contract_id: '${/parameter/@contract_id}',
        // content_id: record.get('content_id')
        // },
        // sync: true,
        // // 同步请求,保证批量打印顺序进行
        // success: function() {
        // var ds1 = $('con_contract_update_print_detail_header_ds');
        // var rec = ds1.getCurrentRecord();
        // var contract_number = rec.get('contract_number');
        // var templt_name, clause_usage = record.get('clause_usage'),
        // business_type = '${/parameter/@business_type}',
        // templet_id = record.get('templet_id'),
        // templet_code = record.get('templet_code'),
        // bp_id = record.get('bp_id'),
        // bp_class = record.get('bp_class'),
        // mortgage_id = record.get('mortgage_id') || '',
        // couple_guarantee_flag = record.get('couple_guarantee_flag'),
        // content_number = record.get('content_number'),
        // content_id = record.get('content_id'),
        // spv_company_code = rec.get('spv_company_code');
        // var link;
        // var pdf_key_path = 'D:/projects/HLS/web/WEB-INF/leaf.plugin.export.word/';
        // var doc_name = 'D:/projects/HLS/excel/' + clause_usage + '/'; // server path
        // if (clause_usage == 'FIN') {
        // templt_name = 'yonda_fin_contract.xml';
        // link = $('con_contract_update_print_fin_link_id').getUrl();
        // con_name = '零售业租赁合同';
        // } else if (clause_usage == 'MOR') {
        // templt_name = 'yonda_mor_contract.xml';
        // con_name = '抵押合同(上海)';
        // link = $('con_contract_update_print_fin_link_id').getUrl();
        // } else if (clause_usage == 'FIN_ADMIN') {
        // templt_name = 'yonda_fin_contract.xml';
        // con_name = '管理人员租赁合同';
        // link = $('con_contract_update_print_fin_link_id').getUrl();
        // } else if (clause_usage == 'FIN_TEST_DRIVE') {
        // templt_name = 'yonda_fin_contract.xml';
        // con_name = '试乘试驾租赁合同';
        // link = $('con_contract_update_print_fin_link_id').getUrl();
        // } else if (clause_usage == 'PAY_AGR') {
        // templt_name = 'yonda_other_contract.xml';
        // con_name = '付款承诺书';
        // link = $('con_contract_update_print_fin_link_id').getUrl();
        // } else if (clause_usage == 'MOR_OUT_SH') {
        // templt_name = 'yonda_mor_contract.xml';
        // con_name = '抵押合同(外地)';
        // link = $('con_contract_update_print_fin_link_id').getUrl();
        // } else if (clause_usage == 'LOAN_AGR') {
        // templt_name = 'yonda_loan_agr_contract.xml';
        // con_name = '借款协议书';
        // link = $('con_contract_update_print_fin_link_id').getUrl();
        // } else if (clause_usage == 'MOR_CONFIROM') {
        // templt_name = 'yonda_other_contract.xml';
        // con_name = '抵押确认书';
        // link = $('con_contract_update_print_fin_link_id').getUrl();
        // } else if (clause_usage == 'RISK_CONFIROM') {
        // templt_name = 'yonda_other_contract.xml';
        // con_name = '风险确认书';
        // link = $('con_contract_update_print_fin_link_id').getUrl();
        // } else if (clause_usage == 'CAR_TRANS') {
        // templt_name = 'yonda_other_contract.xml';
        // con_name = '汽车转让协议';
        // link = $('con_contract_update_print_fin_link_id').getUrl();
        // } else if (clause_usage == 'SUP_TRANS') {
        // templt_name = 'yonda_other_contract.xml';
        // con_name = '补充协议';
        // link = $('con_contract_update_print_fin_link_id').getUrl();
        // } else if (clause_usage == 'COMMON_TENANT_ADMIN') {
        // templt_name = 'yonda_other_contract.xml';
        // con_name = '共同承租人确认书(管理人员)';
        // link = $('con_contract_update_print_fin_link_id').getUrl();
        // } else if (clause_usage == 'COMMON_TENANT_RETAIL') {
        // templt_name = 'yonda_other_contract.xml';
        // con_name = '共同承租人确认书(零售)';
        // link = $('con_contract_update_print_fin_link_id').getUrl();
        // } else if (clause_usage == 'PRINCIPAL_PROD') {
        // templt_name = 'yonda_prod_contract.xml';
        // con_name = '委托采购合同';
        // link = $('con_contract_update_print_fin_link_id').getUrl();
        // } else if (clause_usage == 'FINISH') {
        // templt_name = 'yonda_other_contract.xml';
        // con_name = '结清用表单';
        // link = $('con_contract_update_print_fin_link_id').getUrl();
        // } else if (clause_usage == 'ABNORMAL_FINISH') {
        // templt_name = 'yonda_other_contract.xml';
        // con_name = '非正常结清用表单';
        // link = $('con_contract_update_print_fin_link_id').getUrl();
        // }
        // //templet_id租赁物件验收证明    上牌过户确认书不存在签章字段的,
        // var sign_flag;
        // if (templet_id == 1363 || templet_id == 1283) {
        // sign_flag = 'N';
        // } else {
        // sign_flag = 'Y';
        // }
        // var url = link + '?templt_name=' + templt_name + '&contract_id=' + '${/parameter/@contract_id}' + '&document_category=' + '${/parameter/@document_category}' + '&clause_usage=' + clause_usage + '&templet_id=' + templet_id + '&bp_id=' + bp_id + '&mortgage_id=' + mortgage_id + '&content_number=' + content_number + '&contract_number=' + contract_number + '&couple_guarantee_flag=' + couple_guarantee_flag + '&content_id=' + content_id + '&doc_name=' + doc_name + '&company_id=' + '${/parameter/@company_id}' + '&business_type=' + business_type + '&templet_code=' + templet_code + '&con_name=' + con_name + '&pdf_key_path=' + pdf_key_path + '&spv_company_code=' + spv_company_code + '&sign_flag=' + sign_flag;
        // var form = document.createElement("form");
        // form.target = "word_export_window";
        // form.method = "post";
        // form.action = url;
        // var iframe = Ext.get('word_export_window') || new Ext.Template('<iframe id ="word_export_window" name="word_export_window" style="position:absolute;left:-10000px;top:-10000px;width:1px;height:1px;display:none"></iframe>').insertFirst(document.body, {}, true);
        // document.body.appendChild(form);
        // form.submit();
        // Ext.fly(form).remove();
        // //unlock_current_window();
        // set_print_detail_btn_enable();
        // },
        // failure: function() {
        // //unlock_current_window();
        // set_print_detail_btn_enable();
        // },
        // error: function() {
        // //unlock_current_window();
        // set_print_detail_btn_enable();
        // },
        // scope: this
        // });

        // }

        function con_print_rec(record) {
            Leaf.request({
                url: $('con_contract_save_print_information_link_id').getUrl(),
                para: {
                    contract_id: '${/parameter/@contract_id}',
                    content_id: record.get('content_id')
                },
                sync: true,
                // 同步请求,保证批量打印顺序进行
                success: function () {
                    var ds1 = $('con_contract_update_print_detail_header_ds');
                    var rec = ds1.getCurrentRecord();
                    var contract_number = rec.get('contract_number');
                    var templt_name, clause_usage = record.get('clause_usage'),
                        business_type = '${/parameter/@business_type}',
                        templet_id = record.get('templet_id'),
                        templet_code = record.get('templet_code'),
                        bp_id = record.get('bp_id'),
                        bp_class = record.get('bp_class'),
                        mortgage_id = record.get('mortgage_id') || '',
                        couple_guarantee_flag = record.get('couple_guarantee_flag'),
                        content_number = record.get('content_number'),
                        content_id = record.get('content_id'),
                        spv_company_code = rec.get('spv_company_code');
                    var link;
                    var pdf_key_path = get_pdf_key_path();
                    var doc_name = get_doc_path() + clause_usage + '/'; // server path
                    if (clause_usage == 'FIN') {
                        templt_name = 'yonda_fin_contract.xml';
                        link = $('con_contract_update_print_fin_link_id').getUrl();
                        con_name = '零售业租赁合同';
                    } else if (clause_usage == 'MOR') {
                        templt_name = 'yonda_mor_contract.xml';
                        con_name = '抵押合同(上海)';
                        link = $('con_contract_update_print_fin_link_id').getUrl();
                    } else if (clause_usage == 'FIN_ADMIN') {
                        templt_name = 'yonda_fin_contract.xml';
                        con_name = '管理人员租赁合同';
                        link = $('con_contract_update_print_fin_link_id').getUrl();
                    } else if (clause_usage == 'FIN_TEST_DRIVE') {
                        templt_name = 'yonda_fin_contract.xml';
                        con_name = '试乘试驾租赁合同';
                        link = $('con_contract_update_print_fin_link_id').getUrl();
                    } else if (clause_usage == 'PAY_AGR') {
                        templt_name = 'yonda_other_contract.xml';
                        con_name = '付款承诺书';
                        link = $('con_contract_update_print_fin_link_id').getUrl();
                    } else if (clause_usage == 'MOR_OUT_SH') {
                        templt_name = 'yonda_mor_contract.xml';
                        con_name = '抵押合同(外地)';
                        link = $('con_contract_update_print_fin_link_id').getUrl();
                    } else if (clause_usage == 'LOAN_AGR') {
                        templt_name = 'yonda_loan_agr_contract.xml';
                        con_name = '借款协议书';
                        link = $('con_contract_update_print_fin_link_id').getUrl();
                    } else if (clause_usage == 'MOR_CONFIROM') {
                        templt_name = 'yonda_other_contract.xml';
                        con_name = '抵押确认书';
                        link = $('con_contract_update_print_fin_link_id').getUrl();
                    } else if (clause_usage == 'RISK_CONFIROM') {
                        templt_name = 'yonda_other_contract.xml';
                        con_name = '风险确认书';
                        link = $('con_contract_update_print_fin_link_id').getUrl();
                    } else if (clause_usage == 'CAR_TRANS') {
                        templt_name = 'yonda_other_contract.xml';
                        con_name = '汽车转让协议';
                        link = $('con_contract_update_print_fin_link_id').getUrl();
                    } else if (clause_usage == 'SUP_TRANS') {
                        templt_name = 'yonda_other_contract.xml';
                        con_name = '补充协议';
                        link = $('con_contract_update_print_fin_link_id').getUrl();
                    } else if (clause_usage == 'COMMON_TENANT_ADMIN') {
                        templt_name = 'yonda_other_contract.xml';
                        con_name = '共同承租人确认书(管理人员)';
                        link = $('con_contract_update_print_fin_link_id').getUrl();
                    } else if (clause_usage == 'COMMON_TENANT_RETAIL') {
                        templt_name = 'yonda_other_contract.xml';
                        con_name = '共同承租人确认书(零售)';
                        link = $('con_contract_update_print_fin_link_id').getUrl();
                    } else if (clause_usage == 'PRINCIPAL_PROD') {
                        templt_name = 'yonda_prod_contract.xml';
                        con_name = '委托采购合同';
                        link = $('con_contract_update_print_fin_link_id').getUrl();
                    } else if (clause_usage == 'FINISH') {
                        templt_name = 'yonda_other_contract.xml';
                        con_name = '结清用表单';
                        link = $('con_contract_update_print_fin_link_id').getUrl();
                    } else if (clause_usage == 'ABNORMAL_FINISH') {
                        templt_name = 'yonda_other_contract.xml';
                        con_name = '非正常结清用表单';
                        link = $('con_contract_update_print_fin_link_id').getUrl();
                    } else if (clause_usage == 'PRJ') {
                        templt_name = 'yonda_fin_contract.xml';
                        con_name = '项目类合同';
                        link = $('con_contract_update_print_fin_link_id').getUrl();
                    }
                    //templet_id租赁物件验收证明    上牌过户确认书不存在签章字段的,
                    var sign_flag;
                    if (templet_id == 1363 || templet_id == 1283) {
                        sign_flag = 'N';
                    } else {
                        sign_flag = 'Y';
                    }
                    var url = link + '?templt_name=' + templt_name + '&contract_id=' + '${/parameter/@contract_id}' + '&document_category=' + '${/parameter/@document_category}' + '&clause_usage=' + clause_usage + '&templet_id=' + templet_id + '&bp_id=' + bp_id + '&mortgage_id=' + mortgage_id + '&content_number=' + content_number + '&contract_number=' + contract_number + '&couple_guarantee_flag=' + couple_guarantee_flag + '&content_id=' + content_id + '&doc_name=' + doc_name + '&company_id=' + '${/parameter/@company_id}' + '&business_type=' + business_type + '&templet_code=' + templet_code + '&con_name=' + con_name + '&pdf_key_path=' + pdf_key_path + '&spv_company_code=' + spv_company_code + '&sign_flag=' + sign_flag;
                    Leaf.request({
                        url: url,
                        para: null,
                        success: function (obj) {
                            var status = obj.result.sign_status;
                            if (status == true) {
                                Leaf.showMessage('${l:PROMPT}', content_number + '打印合同成功!');
                                $('con_contract_update_print_detail_line_ds').query();
                                // 修改合同打印字段信息
                            } else {
                                Leaf.showMessage('${l:PROMPT}', content_number + '合同打印失败,请重新打印!');
                            }
                            unlock_current_window();
                        },
                        failure: function () {
                            Leaf.showMessage('${l:PROMPT}', content_number + '合同打印失败,请重新打印!');
                            unlock_current_window();
                        },
                        error: function () {
                            Leaf.showMessage('${l:PROMPT}', content_number + '合同打印错误,请重新打印!');
                            unlock_current_window();
                        },
                        scope: this
                    });
                },
                failure: function () {
                    unlock_current_window();

                },
                error: function () {
                    unlock_current_window();

                },
                scope: this
            });

        }

        function on_print_detail_lov(record, name) {
            if (record.isNew) {
                return 'print_detail_grid_lov_id';
            } else {
                return '';
            }
        }

        function on_print_detail_combobox(record, name) {
            if (record.isNew) {
                return 'print_detail_grid_combobox_id';
            } else {
                return '';
            }
        }

        function con_print_detail_add() {
            $('con_contract_update_print_detail_grid_id').showEditorByRecord($('con_contract_update_print_detail_line_ds').create());
        }

        //function lock_current_window() {
        //    Leaf.Masker.mask($('${/parameter/@winid}').wrap, '${l:HLS.EXECUTING}');
        //}

        //function unlock_current_window() {
        //    Leaf.Masker.unmask($('${/parameter/@winid}').wrap);
        //}

        function con_print_detail_create() {


            lock_current_window();
            Leaf.request({
                url: $('con_contract_create_content_link_id').getUrl(),
                para: {
                    contract_id: '${/parameter/@contract_id}'
                },
                success: function (res) {
                    var result_ds = $('con_contract_update_print_detail_line_ds');
                    result_ds.query(result_ds.currentPage);
                    unlock_current_window();
                },
                error: function () {
                    unlock_current_window();
                },
                failure: function () {
                    unlock_current_window();
                },
                scope: this
            });
        }

        function con_print_detail_save() {
            lock_current_window();
            if ($('con_contract_update_print_detail_line_ds').validate(true)) {
                //$('con_contract_update_print_detail_line_ds').submitSelected();
                $('con_contract_update_print_detail_line_ds').submit();
            } else {
                unlock_current_window();
            }
        }

        function on_result_submitsuccess() {
            unlock_current_window();
            line_refresh();
        }

        function on_result_submitfailed() {
            unlock_current_window();
            line_refresh();
        }

        function on_result_add(ds, record, index) {
            record.set('contract_id', '${/parameter/@contract_id}');
        }

        function see_asset_detail_renderer(value, record, name) {
            if (name == 'asset_detail' && record.get('content_id')) {
                return '<a href="javascript:con505_asset_detail(' + record.get('content_id') + ',' + record.get('con_contract_bp_id') + ',\'' + record.get('bp_category') + '\');">' + '资产明细' + '</a>';
            }
        }

        function con505_asset_detail(content_id, con_contract_bp_id, bp_category) {
            new Leaf.Window({
                id: 'con_contract_content_asset_detail_winid',
                url: $('con_contract_content_asset_detail_link_id').getUrl(),
                params: {
                    contract_id: '${/parameter/@contract_id}',
                    content_id: content_id,
                    con_contract_bp_id: con_contract_bp_id,
                    bp_category: bp_category,
                    winid: 'con_contract_content_asset_detail_winid'
                },
                title: '${l:CON505.CON_CONTENT_ASSET_DETAIL}',
                width: 500,
                height: 460
            });
        }

        function on_print_detail_lov_focus(lov) {
            var record = lov.record,
                display_name = lov.binder.name;
            record.getField(display_name).setLovPara('templet_usage', record.get('clause_usage'));
        }

        function set_required_field(record, set_name, value) {
            var set_field = record.getField(set_name);
            if (value == 'N') {
                set_field.setRequired(false);
            } else {
                set_field.setRequired(true);
            }
        }

        function on_result_update(ds, record, name, value, old_value) {
            if (name == 'available_flag') {
                //set_required_field(record, 'content_number', value);
                set_required_field(record, 'templet_name', value);
            } else if (name == 'templet_name') {
                var ds1 = $('con_contract_update_print_detail_header_ds');
                var rec = ds1.getCurrentRecord();
                var contract_number = rec.get('contract_number');

                record.set('content_number', contract_number + '-' + record.get('clause_usage') + '-' + record.get('templet_id'), false);
            }
        }

        function on_result_load(ds) {
            var records = ds.getAll();
            for (var i = 0; i < records.length; i++) {
                var record = records[i];
                //set_required_field(record, 'content_number', record.get('available_flag'));
                set_required_field(record, 'templet_name', record.get('available_flag'));
            }

            // 20160427 合同初审 页面 设置只读
            var action = '${/parameter/@action}';
            if (action == 'VIEW') {

                for (var m = 0; m < records.length; m++) {
                    records[m].getField('clause_usage_name').setReadOnly(true);
                    records[m].getField('bp_name').setReadOnly(true);
                    records[m].getField('bp_category_desc').setReadOnly(true);
                    records[m].getField('bp_class_desc').setReadOnly(true);
                    records[m].getField('templet_name').setReadOnly(true);
                    records[m].getField('content_number').setReadOnly(true);
                }
            }

        }

        function update_attachment_renderer(value, record, name) {
            var content_id = record.get('content_id');
            return '<a href="javascript:open_uploadfile_win(' + content_id + ')">附件</a>';
        }

        function open_uploadfile_win(content_id) {
            new Leaf.Window({
                url: $('con_contract_uploadfile').getUrl(),
                title: '${l:HLS.SUPPORTING_DOCUMENT}',
                params: {
                    'table_name': 'CON_CONTRACT_CONTENT',
                    'header_id': content_id
                },
                width: 850,
                height: 400
            });
        }

        function open_downloadfile_win(content_id) {
            new Leaf.Window({
                url: $('con_contract_downloadfile').getUrl(),
                title: '${l:HLS.SUPPORTING_DOCUMENT}',
                params: {
                    'table_name': 'CON_CONTRACT_CONTENT',
                    'header_id': content_id
                },
                width: 850,
                height: 400
            });
        }

        function download_renderer(value, record, name) {
            var content_id = record.get('content_id');
            var content_print_flag = record.get('content_print_flag');
            var status = record.get('status');

            var records = $('con_contract_update_print_detail_line_ds').getAll();
            var count = 0;
            var agent_count = 0;
            for (var i = 0; i < records.length; i++) {
                if (records[i].get('content_print_flag') == 'Y') {
                    count = count + 1;
                }

                if (records[i].get('agent_content_flag') == 'Y') {
                    agent_count = agent_count + 1
                }

            }
            if (count != records.length) {
                return '';
            } else if (agent_count == 0) {
                return '';
            } else {
                //change by hsx 先注释下载pdf的方法,后续恢复
                //if (content_print_flag == 'Y') {
                //if (status == '4') {
                //return '<a href="javascript:open_downloadfile_win(' + content_id + ')">下载</a>';
                return '<input id="button_i" type="button" value="下载" style="border:none;color:blue;cursor:pointer;" onmouseover="this.style.color=\'red\'" onmouseout="this.style.color=\'blue\'"   onclick = "download_uploadfile_win(\'' + content_id + '\')"/>';
                // // return '<a href="javascript:download_uploadfile_win(\'' + content_id + '\')">下载</a>';
                //} else {

            }
        }

        /*function download_renderer(value, record, name) {
            var content_id = record.get('content_id');
            var content_print_flag = record.get('content_print_flag');
            var status = record.get('status');
            //change by hsx 先注释下载pdf的方法,后续恢复
            if (content_print_flag == 'Y') {

                //return '<a href="javascript:open_downloadfile_win(' + content_id + ')">下载</a>';
                //return '<input id="button_i" type="button" value="下载" style="border:none;color:blue;cursor:pointer;" onmouseover="this.style.color=\'red\'" onmouseout="this.style.color=\'blue\'"   onclick = "download_uploadfile_win(\'' + content_id + '\')"/>';
                return '<a href="javascript:download_uploadfile_win(\'' + content_id + '\')">下载</a>';
            } else {
                return '';
            }
        }*/

        function download_uploadfile_win(content_id) {
            //var content_id = record.get('content_id');
            var doc_code = '合同文本附件';
            //var url_l = $('con_atm_batch_download_pdf_link_id').getUrl() + '?content_id=' + content_id + '&doc_code=' + encodeURI(doc_code) + '&type=SIN&fnd_atm_flag=Y';


            var url_l = $('pdf_download_link').getUrl() + '?content_id=' + content_id + '&type=SIN';

            window.open(href = url_l, target = "_self");


        }


        function con_content_delete() {


            Leaf.showConfirm('确认', '确认删除合同文本?', function () {
                records = $('con_contract_update_print_detail_line_ds').getSelected();
                if (records.length < 1) {
                    Leaf.showMessage('${l:PROMPT}', '请选择记录!');
                    return;
                }
                var datas = [];
                for (var i = 0; i < records.length; i++) {
                    var obj = {};
                    obj['content_id'] = records[i].get('content_id');
                    obj['_status'] = 'delete';
                    datas[i] = obj;
                }
                Leaf.request({
                    url: $('con_contract_content_delete_link').getUrl(),
                    para: datas,
                    success: function () {
                        Leaf.SideBar.show({
                            msg: '操作成功',
                            duration: 2000
                        });
                        $('con_paper_signature_id').enable();
                        if ('${/parameter/@simple_contract}' == 'N') {
                            $('con_signature_id').enable();
                            $('cancel_signature_id').enable();
                            $('agent_signature_id').enable();
                        }

                        $('con_contract_update_print_detail_line_ds').query();
                    },
                    scope: this
                });
            });
        }

        function con_atm_download() {

            if ($('con_contract_update_print_detail_line_ds').getAll().length <= 0) {
                Leaf.showMessage('提示', '请先生成合同文本!');
                return;
            }

            var contract_id = $('con_contract_update_print_detail_line_ds').getAt(0).get('contract_id');
            var download_flag = $('con_contract_update_print_detail_line_ds').getAt(0).get('download_flag');
            if (download_flag == 0) {
                Leaf.showMessage('提示', '至少有一条已盖章合同才能下载!');
                return;
            }
            /*var doc_code = '合同文本附件';
             var url_l = $('con_atm_batch_download_pdf_link_id').getUrl() + '?contract_id=' + contract_id + '&doc_code=' + encodeURI(doc_code) + '&type=ZIP&fnd_atm_flag=Y';*/

            var url_l = $('pdf_download_link').getUrl() + '?contract_id=' + contract_id + '&type=ZIP';
            window.open(href = url_l, target = "_self");
        }


        function con_atm_paper_download() {

            if ($('con_contract_update_print_detail_line_ds').getAll().length <= 0) {
                Leaf.showMessage('提示', '请先生成合同文本!');
                return;
            }
            var contract_id = $('con_contract_update_print_detail_line_ds').getAt(0).get('contract_id');
            var doc_code = '合同文本附件';


            Leaf.request({
                url: $('update_content_type_link').getUrl(),
                para: {
                    contract_id: contract_id,
                    content_type: '02'
                },
                success: function () {
                    $('con_signature_id').disable();
                    $('cancel_signature_id').disable();
                    $('agent_signature_id').disable();

                    var url_l = $('con_atm_batch_download_pdf_link_id').getUrl() + '?contract_id=' + contract_id + '&doc_code=' + encodeURI(doc_code) + '&type=ZIP&fnd_atm_flag=Y';
                    window.open(href = url_l, target = "_self");
                },
                failure: function () {

                },
                error: function () {

                },
                scope: this
            });


        }


        function con_contract_content_confirm() {
            if ($('con_contract_update_print_detail_line_ds').getAll().length <= 0) {
                Leaf.showMessage('提示', '请先生成合同文本!');
                return;
            }
            records = $('con_contract_update_print_detail_line_ds').getSelected();
            var confirm_flag = true;
            for (i = 0; i < records.length; i++) {
                if (records[i].get('content_print_flag') != 'Y') {
                    confirm_flag = false;
                    break;
                }
            }
            if (confirm_flag) {
                Leaf.showConfirm('提示', '您确定该合同信息无误?', function () {
                    Leaf.request({
                        url: $('con504_change_confirm_status_link').getUrl(),
                        para: {
                            contract_id: '${/parameter/@contract_id}'
                        },
                        success: function () {
                            Leaf.SideBar.show({
                                msg: '已确认',
                                duration: 2000
                            });
                            Leaf.go($('con_contract_content_confirm_link').getUrl());
                            $('con505_contract_result_ds').query();
                        },
                        scope: this
                    });
                });
            } else {
                Leaf.showMessage('提示', '请先确认所有合同已经确认打印!');
                return;
            }

        }

        function edit_office_attachment_renderer(value, record, name) {
            //if (record.get('file_exists_flag') == 'Y') {
            return '<a href="javascript:open_office_link(' + record.id + ')">在线编辑</a>';
            //}
        }

        function open_office_link(record_id) {
            doc_plugin_template_copy(record_id);
        }

        function doc_plugin_template_copy(record_id) {
            var result_ds = $('con_contract_update_print_detail_line_ds');
            var record = result_ds.findById(record_id);
            var content_id = record.get('content_id');
            Leaf.request({
                url: $('file_copy_from_template_link_id').getUrl(),
                para: {
                    content_id: record.get('content_id'),
                    file_path: '${/parameter/@file_path}'
                },
                success: function (res) {
                    var win = new Leaf.Window({
                        id: 'edit_office_online_link_winid',
                        url: $('con_contract_content_edit_office_online_link_id').getUrl(),
                        params: {
                            content_id: content_id,
                            winid: 'edit_office_online_link_winid',
                            first_copy_flag: res.result.first_copy_flag,
                            contract_id: record.get('contract_id'),
                            bar_code: record.get('bar_code')
                        },
                        fullScreen: true,
                        draggable: true
                    });
                    win.on('close', function () {
                        result_ds.query(result_ds.currentPage);
                    });
                    unlock_current_window();
                },
                error: function () {
                    unlock_current_window();
                },
                failure: function () {
                    unlock_current_window();
                },
                scope: this
            });
        }

        function con_print_detail_print_new() {
            lock_current_window();
            var result_ds = $('con_contract_update_print_detail_line_ds');
            var records = result_ds.getAll();
            var total_count = 0;
            for (var m = 0; m < records.length; m++) {
                if (records[m].get('file_exists_flag') != 'Y') {
                    total_count = total_count + 1;
                }
            }
            if (!records.length) {
                Leaf.showMessage('${l:PROMPT}', '请先生成文本!');
                unlock_current_window();
                return;
            }

            if (total_count === 0 && records.length) {
                Leaf.showMessage('${l:PROMPT}', '文本都已生成');
                unlock_current_window();
                return;
            }
            lock_current_window();
            Leaf.request({
                url: $('con_doc_batch_create_link_id').getUrl(),
                para: {
                    contract_id: '${/parameter/@contract_id}',
                    file_path: '${/parameter/@file_path}',
                    batch_flag: 'Y'
                },
                success: function (res) {
                    var contract_id = $('con_contract_update_print_detail_line_ds').getAt(0).get('contract_id');
                    var doc_code = '合同文本附件';
                    Leaf.request({
                        url: $('con_atm_batch_pdf_link_id').getUrl(),
                        para: {
                            contract_id: contract_id,
                            doc_code: encodeURI(doc_code),
                            type: 'ZIP',
                            fnd_atm_flag: 'Y'
                        },
                        success: function (res) {
                            Leaf.SideBar.enable = true;
                            Leaf.SideBar.show({
                                msg: '生成完毕',
                                duration: 2000
                            });
                            result_ds.query(result_ds.currentPage);
                            unlock_current_window();
                        },
                        error: function () {
                            unlock_current_window();
                        },
                        failure: function () {
                            unlock_current_window();
                        },
                        scope: this
                    });
                    Leaf.SideBar.enable = true;
                    Leaf.SideBar.show({
                        msg: '生成完毕',
                        duration: 2000
                    });
                    /*result_ds.query(result_ds.currentPage);
                    unlock_current_window();*/
                },
                error: function () {
                    unlock_current_window();
                },
                failure: function () {
                    unlock_current_window();
                },
                scope: this
            });
        }


        function con_signature() {
            var records = $('con_contract_update_print_detail_line_ds').getAll();
            var count = 0;
            var agent_count = 0;
            for (var i = 0; i < records.length; i++) {
                if (records[i].get('content_print_flag') == 'Y') {
                    count = count + 1;
                }

                if (records[i].get('agent_content_flag') == 'Y') {
                    agent_count = agent_count + 1
                }

            }
            if (count != records.length) {
                Leaf.showMessage('消息', '请先生成合同!');
            } else if (agent_count == 0) {
                Leaf.showMessage('消息', '请先点击代理商盖章!');
            }
            else {

                /*Leaf.request({
                    url: '${/request/@context_path}/contract/signature',
                    para: {
                        contractId: '${/parameter/@contract_id}'
                    },
                    success: function (res) {
                        alert(1);
                        Leaf.showMessage('消息', res.message);

                    },
                    error: function (res) {
                        alert(2);
                        Leaf.showMessage('消息', res.message);

                    },
                    failure: function (res) {
                        alert(3);
                        Leaf.showMessage('消息', res.message);
                    },
                    scope: this
                });*/

                lock_current_window();
                $jq.ajax({
                    url: '${/request/@context_path}/contract/signature',
                    method: 'post',
                    data: {
                        contractId: '${/parameter/@contract_id}'
                    },
                    success: function (args) {
                        unlock_current_window();
                        if (args.success) {
                            Leaf.SideBar.show({
                                msg: '${l:HLS.SUBMIT_SUCCESS}',
                                duration: 2000
                            });
                        } else {
                            Leaf.showMessage('提示', args.message);
                            return;
                        }
                        $('con_contract_update_print_detail_line_ds').query();
                    },
                    failure: function (args) {
                        unlock_current_window();
                        Leaf.SideBar.show({
                            msg: 'failure',
                            duration: 2000
                        });

                    },
                    error: function (args) {
                        unlock_current_window();
                        Leaf.SideBar.show({
                            msg: 'error',
                            duration: 2000
                        });
                    },
                });

                /*
                                var con810_formData = new FormData();
                                con810_formData.append('contractId', '${/parameter/@contract_id}');

                                var record_id;

                                $jq.ajax({
                                    url: '${/request/@context_path}/contract/signature',
                                    type: "post",
                                    data: con810_formData,
                                    contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
                                    async: false,
                                    processData: false,
                                    success: function (res) {
                                        Leaf.showMessage('消息', res.message);
                                    },
                                    failure: function (res) {
                                        Leaf.showMessage('消息', res.message);
                                    },
                                    error: function (res) {
                                        Leaf.showMessage('消息', res.message);
                                    }
                                });


                            }*/


            }
        }

        /* function print_detail_header_load(ds) {

            var records = ds.getCurrentRecord();
            alert('${/parameter/@contract_number}');
            records.set('contract_number', '${/parameter/@contract_number}');
            records.set('contract_name', '${/parameter/@contract_name}');
        } */

        function agent_signature() {

            var records = $('con_contract_update_print_detail_line_ds').getAll();
            var count = 0;
            for (var i = 0; i < records.length; i++) {
                if (records[i].get('content_print_flag') == 'Y') {
                    count = count + 1;
                }
            }
            if (count != records.length) {
                Leaf.showMessage('消息', '请先生成合同!');
            } else {

                lock_current_window();
                $jq.ajax({
                    url: '${/request/@context_path}/contract/signature/agent',
                    method: 'post',
                    data: {
                        contractId: '${/parameter/@contract_id}'
                    },
                    success: function (args) {
                        unlock_current_window();
                        if (args.success) {
                            Leaf.SideBar.show({
                                msg: '${l:HLS.SUBMIT_SUCCESS}',
                                duration: 2000
                            });

                            Leaf.request({
                                url: $('update_content_type_link').getUrl(),
                                para: {
                                    contract_id: '${/parameter/@contract_id}',
                                    content_type: '01'
                                },
                                success: function () {
                                    $('con_paper_signature_id').disable();


                                },
                                failure: function () {

                                },
                                error: function () {

                                },
                                scope: this
                            });
                            $('con_contract_update_print_detail_line_ds').query();


                        } else {
                            Leaf.showMessage('提示', args.message);
                            return;
                        }
                    },
                    failure: function (args) {
                        unlock_current_window();
                        Leaf.SideBar.show({
                            msg: 'failure',
                            duration: 2000
                        });

                    },
                    error: function (args) {
                        unlock_current_window();
                        Leaf.SideBar.show({
                            msg: 'error',
                            duration: 2000
                        });
                    },
                });


            }
        }

        function cancel_signature() {

            lock_current_window();
            $jq.ajax({
                url: '${/request/@context_path}/contract/signature/cancel',
                method: 'post',
                data: {
                    contractId: '${/parameter/@contract_id}'
                },
                success: function (args) {
                    unlock_current_window();
                    if (args.success) {
                        Leaf.SideBar.show({
                            msg: '${l:HLS.SUBMIT_SUCCESS}',
                            duration: 2000
                        });
                        $('con_contract_update_print_detail_line_ds').query();
                    } else {
                        Leaf.showMessage('提示', args.message);
                        return;
                    }
                },
                failure: function (args) {
                    unlock_current_window();
                    Leaf.SideBar.show({
                        msg: 'failure',
                        duration: 2000
                    });

                },
                error: function (args) {
                    unlock_current_window();
                    Leaf.SideBar.show({
                        msg: 'error',
                        duration: 2000
                    });
                },
            });
        }

        ]]></script>
        <a:dataSets>
            <a:dataSet id="basic_clause_tmplet_usage_ds" lookupCode="CON_TMPLET_USAGE"/>
            <a:dataSet id="con_contract_update_print_detail_header_ds" autoCreate="true">
                <a:fields>
                    <a:field name="contract_number" defaultValue="${/parameter/@contract_number}" readOnly="true"/>
                    <a:field name="contract_name" defaultValue="${/parameter/@contract_name}" readOnly="true"/>
                </a:fields>
                <!-- <a:events>
                    <a:event name="load" handler="print_detail_header_load"/>
                </a:events> -->
            </a:dataSet>
            <a:dataSet id="con_contract_update_print_detail_line_ds" autoQuery="true" fetchAll="true" pageSize="100"
                       queryUrl="${/request/@context_path}/autocrud/cont.CON500.con_contract_content_v/query?contract_id=${/parameter/@contract_id}"
                       selectable="true"
                       submitUrl="${/request/@context_path}/modules/cont/CON505/con_contract_content_save.lsc">
                <a:fields>
                    <a:field name="bp_name" lovGridHeight="350" lovHeight="500" lovLabelWidth="100"
                             lovService="cont.CON505.con_contract_content_bp_for_lov?contract_id=${/parameter/@contract_id}"
                             lovWidth="550" required="true" title="HLS.BP_TITLE">
                        <a:mapping>
                            <a:map from="record_id" to="con_contract_bp_id"/>
                            <a:map from="bp_name" to="bp_name"/>
                            <a:map from="bp_category" to="bp_category"/>
                            <a:map from="bp_category_desc" to="bp_category_desc"/>
                            <a:map from="bp_class" to="bp_class"/>
                            <a:map from="bp_class_desc" to="bp_class_desc"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="clause_usage_name" displayField="code_value_name"
                             options="basic_clause_tmplet_usage_ds" required="true" returnField="clause_usage"
                             valueField="code_value"/>
                    <a:field name="clause_usage"/>
                    <a:field name="templet_name" lovGridHeight="350" lovHeight="500"
                             lovService="basic.con_clause_templet_for_lov" lovWidth="500" readOnly="true"
                             required="true" title="CON505.CON_CONTENT_TEMPLET_NAME">
                        <a:mapping>
                            <a:map from="templet_id" to="templet_id"/>
                            <a:map from="description" to="templet_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="contract_id"/>
                    <a:field name="content_number" readOnly="true"/>
                    <a:field name="available_flag" checkedValue="Y" defaultValue="Y" uncheckedValue="N"/>
                </a:fields>
                <a:events>
                    <a:event name="update" handler="on_result_update"/>
                    <a:event name="load" handler="on_result_load"/>
                    <a:event name="submitsuccess" handler="on_result_submitsuccess"/>
                    <a:event name="submitfailed" handler="on_result_submitfailed"/>
                    <a:event name="add" handler="on_result_add"/>
                    <!--   <a:event name="load" handler="on_result_query"/> -->
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <div id="screenTopToolbardiv">
                <a:screenTopToolbar style="width:1100px">
                    <a:gridButton id="con_print_id" click="con_print_detail_create" text="CON505.CON_CONTENT_CREATE"/>
                    <!-- <a:gridButton click="con_print_detail_add" text="HLS.NEW"/>
                <a:gridButton click="con_print_detail_clear" text="HLS.CLEAR"/> -->
                    <!-- <a:gridButton click="con_print_detail_save" text="HLS.SAVE"/> -->
                    <a:gridButton id="con_delete_id" click="con_content_delete" text="删除"/>
                    <!-- <a:gridButton id="con_print_detail_print_id" click="con_print_detail_print" text="HLS.PRINT_CONFIRM"/> -->
                    <a:gridButton id="con_print_detail_print_id" click="con_print_detail_print_new" text="生成合同"/>
                    <!--<a:gridButton id="agent_signature_id" click="agent_signature" text="代理商盖章"/>
                    <a:gridButton id="con_signature_id" click="con_signature" text="电子签章"/>
                    <a:gridButton id="con_atm_download_id" click="con_atm_download" text="一键下载"/>-->
                    <!-- <a:gridButton id="con_atm_download_id" click="con_atm_download" text="打包下载"/> -->
                    <!-- <a:gridButton click="con_contract_content_confirm" text="合同审核通过"/> -->
                </a:screenTopToolbar>
                <a:form column="2" title="CON505.CON_CONTENT_PRINT" width="1100">
                    <a:textField name="contract_number" bindTarget="con_contract_update_print_detail_header_ds"
                                 prompt="HLS.CONTRACT_NUMBER"/>
                    <a:textField name="contract_name" bindTarget="con_contract_update_print_detail_header_ds"
                                 prompt="HLS.CONTRACT_NAME" width="330"/>
                </a:form>
            </div>
            <a:tabPanel width="1350" height="480">
                <a:tabs>
                    <a:tab prompt="纸质合同" width="100">
                        <a:grid id="con_contract_update_print_detail_grid_id"
                                bindTarget="con_contract_update_print_detail_line_ds"
                                height="400" navBar="true" width="1280">

                            <a:toolBar>
                                <a:button id="con_paper_signature_id" click="con_atm_paper_download" text="打包下载"
                                          style="float:left"/>
                            </a:toolBar>
                            <a:columns>
                                <a:column name="clause_usage_name" editorFunction="on_print_detail_combobox"
                                          prompt="HLS.CONTRACT_USAGE" width="150"/>
                                <a:column name="bp_name" editorFunction="on_print_detail_lov" prompt="HLS.BP_NAME"
                                          width="120"/>
                                <a:column name="bp_category_desc" prompt="HLS.BP_CATEGORY"/>
                                <a:column name="bp_class_desc" prompt="HLS.BP_CLASS"/>
                                <a:column name="templet_name" editor="print_detail_grid_lov_id"
                                          prompt="CON505.CON_CONTENT_TEMPLET_NAME" width="230"/>
                                <a:column name="content_number" editor="print_detail_grid_textfield_id"
                                          prompt="CON505.CON_CONTENT_NUMBER" width="180"/>
                                <!-- <a:column name="content_print_flag_name" align="center" prompt="CON505.CON_CONTENT_STATUS" width="80"/> -->
                                <!-- <a:column name="available_flag" editor="print_detail_grid_checkbox_id" prompt="CON505.AVAILABLE_FLAG" width="60"/> -->
                                <!-- <a:column name="edit_office" align="center" prompt="在线编辑" renderer="edit_office_attachment_renderer" width="80"/> -->
                                <a:column name="content_print_flag_name" align="center" prompt="合同生成状态" width="100"/>
                                <a:column name="download_content_flag_name" align="center" prompt="合同打印状态" width="100"/>
                                <!--<a:column name="status_desc" align="center" prompt="电签状态" width="100"/>-->
                                <!--<a:column name="download" align="center" prompt="下载" renderer="download_renderer" width="50"/>-->
                            </a:columns>
                            <a:editors>
                                <a:lov id="print_detail_grid_lov_id">
                                    <a:events>
                                        <a:event name="focus" handler="on_print_detail_lov_focus"/>
                                    </a:events>
                                </a:lov>
                                <a:comboBox id="print_detail_grid_combobox_id"/>
                                <a:textField id="print_detail_grid_textfield_id"/>
                                <!-- <a:checkBox id="print_detail_grid_checkbox_id"/> -->
                            </a:editors>
                        </a:grid>
                    </a:tab>

                    <a:tab prompt="电子合同" width="100">
                        <a:grid id="con_contract_update_print_detail_grid_id2"
                                bindTarget="con_contract_update_print_detail_line_ds"
                                height="400" navBar="true" width="1280">
                            <a:toolBar>
                                <a:button id="cancel_signature_id" click="cancel_signature" text="撤回"
                                          style="float:left;margin-left:-7px"/>
                                <a:button id="con_signature_id" click="con_signature" text="推送" style="float:left"/>
                                <a:button id="agent_signature_id" click="agent_signature" text="代理商盖章"
                                          style="float:left"/>
                            </a:toolBar>
                            <a:columns>
                                <a:column name="clause_usage_name" editorFunction="on_print_detail_combobox"
                                          prompt="HLS.CONTRACT_USAGE" width="150"/>
                                <a:column name="bp_name" editorFunction="on_print_detail_lov" prompt="HLS.BP_NAME"
                                          width="120"/>
                                <a:column name="bp_category_desc" prompt="HLS.BP_CATEGORY"/>
                                <a:column name="bp_class_desc" prompt="HLS.BP_CLASS"/>
                                <a:column name="templet_name" editor="print_detail_grid_lov_id"
                                          prompt="CON505.CON_CONTENT_TEMPLET_NAME" width="230"/>
                                <a:column name="content_number" editor="print_detail_grid_textfield_id"
                                          prompt="CON505.CON_CONTENT_NUMBER" width="180"/>
                                <!-- <a:column name="content_print_flag_name" align="center" prompt="CON505.CON_CONTENT_STATUS" width="80"/> -->
                                <!-- <a:column name="available_flag" editor="print_detail_grid_checkbox_id" prompt="CON505.AVAILABLE_FLAG" width="60"/> -->
                                <!-- <a:column name="edit_office" align="center" prompt="在线编辑" renderer="edit_office_attachment_renderer" width="80"/> -->
                                <a:column name="content_print_flag_name" align="center" prompt="合同生成状态" width="100"/>
                                <a:column name="agent_content_flag_name" align="center" prompt="代理商盖章状态" width="100"/>
                                <a:column name="status_desc" align="center" prompt="电签状态" width="100"/>
                                <a:column name="download" align="center" prompt="下载" renderer="download_renderer"
                                          width="50"/>
                            </a:columns>

                        </a:grid>
                    </a:tab>
                </a:tabs>
            </a:tabPanel>
        </a:screenBody>
        <script type="text/javascript"><![CDATA[
        // Leaf.onReady(init);
        // 20160427 合同初审 页面 设置隐藏
        function init() {
            var action = '${/parameter/@action}';
            if (action == 'VIEW') {
                var grid_id = $('con_contract_update_print_detail_grid_id');
                grid_id.hideColumn('edit_office');
                document.getElementById('con_print_id').style.display = "none";
                document.getElementById('con_delete_id').style.display = "none";
                document.getElementById('con_print_detail_print_id').style.display = "none";
                // document.getElementById('con_atm_download_id').style.display = "none";
                // document.getElementById('con_print_detail_create').style.display = "none";
                // document.getElementById('con_print_detail_save_id').style.display = "none";
                // document.getElementById('con_content_delete_id').style.display = "none";
                // document.getElementById('con_print_detail_print_id').style.display = "none";
            }
            if ('${/parameter/@content_type}' == '02' || '${/parameter/@simple_contract}' == 'Y' || '${/parameter/@agent_customer_id}' == null ) {
                $('con_signature_id').disable();
                $('cancel_signature_id').disable();
                $('agent_signature_id').disable();
            } else {
                $('con_signature_id').enable();
                $('cancel_signature_id').enable();
                $('agent_signature_id').enable();
            }

        }

        init();
        ]]></script>
    </a:view>
</a:screen>