hls_bp_master_create.lview 28.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
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zhangxing5129
    $Date: 2014-8-29 下午03:53:38
    $Revision: 1.0
    $Purpose: 商业伙伴创建 明细页面
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" dynamiccreateenabled="true"
          trace="true">
    <a:view>
        <a:link id="get_special_fields_link_id" model="cont.CON500.con_contract_get_special_fields"
                modelaction="update"/>
        <a:link id="gh_nc_post_addsupplierinfo_link" model="hls.HLS213.hls_bp_master_nc_post" modelaction="update"/>
        <a:link id="hls214N_cdd_uploadFile_id" url="${/request/@context_path}/uploadFile.lview"/>
        <a:link id="hls214N_cdd_downloadFile_id" url="${/request/@context_path}/downloadFile.lview"/>
        <script src="${/request/@context_path}/modules/prj/PRJ500N/javascripts/input_validator.js" type="text/javascript"/>
        <a:link id="gh_nc_post_addcustomerinfo_link" model="hls.HLS213.hls_bp_master_nc_post" modelaction="execute"/>
18 19 20 21
<!--        <a:link id="hls213_sap_eai_create_customer_link"-->
<!--                url="${/request/@context_path}/modules/interface/INTERFACE_EAI/hls_sap_eai_CrCustomer.lsc"/>-->
<!--        <a:link id="hls213_sap_eai_create_vender_link"-->
<!--                url="${/request/@context_path}/modules/interface/INTERFACE_EAI/hls_sap_eai_CrVender.lsc"/>-->
22 23
        <!--  <a:link id="Identity_ccx_link"
                  url="${/request/@context_path}/modules/interface/INTERFACE_CCX/hlcm_ccxIdentity_interface.lsc"/>-->
24 25
<!--        <script src="${/request/@context_path}/javascripts/identity_card_info_query.js" type="text/javascript"/>-->
<!--        <a:link id="identity_query_link" model="interface.CCX_INTERFACE.identity_query" modelaction="update"/>-->
Spencer Chang's avatar
Spencer Chang committed
26 27 28 29 30
        <script type="text/javascript"><![CDATA[
        Leaf.onReady(function () {
            var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_bp_master_role');

            var bp_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_bp_master');
31 32


Spencer Chang's avatar
Spencer Chang committed
33
            var bp_record = $(bp_ds_id).getCurrentRecord();
34 35
            bp_record.set('bp_category','${/parameter/@bp_category}');
            bp_record.set('owner_user_id','${/session/@user_id}');
Spencer Chang's avatar
Spencer Chang committed
36 37
            if ('${/parameter/@bp_type}' == 'AGENT') {
                bp_record.getField('agent_type_n').setReadOnly(false);
38
                // bp_record.getField('agent_type_n').setRequired(true);
Spencer Chang's avatar
Spencer Chang committed
39 40
            } else {
                bp_record.getField('agent_type_n').setReadOnly(true);
41
                // bp_record.getField('agent_type_n').setRequired(false);
Spencer Chang's avatar
Spencer Chang committed
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
            }
            if (ds_id && '${/parameter/@default_value_dsid}') {
                var head_record = $('${/parameter/@default_value_dsid}').getCurrentRecord();
                var bp_master_role_ds = $(ds_id);
                var record = new Leaf.Record({
                    'primary_flag': 'Y',
                    'bp_category': head_record.get('bp_category'),
                    'bp_category_n': head_record.get('bp_category_n'),
                    'bp_type': head_record.get('bp_type'),
                    'bp_type_n': head_record.get('bp_type_n'),
                    'bp_class': head_record.get('bp_class'),
                    'bp_class_n': head_record.get('bp_class_n'),
                    'company_nature': head_record.get('company_nature'),
                    'conpany_personal': head_record.get('conpany_personal'),
                    'actual_online': head_record.get('actual_online'),
                    'brand_unbrand': head_record.get('brand_unbrand'),
                    'enabled_flag': 'Y'
                });
                bp_master_role_ds.add(record);
                var current_record = bp_master_role_ds.getAt(0);
                current_record.getField('bp_type_n').setReadOnly(true);
                current_record.getField('enabled_flag').setReadOnly(true);

                if (head_record.get('bp_category') == 'MANUFACTURER') {
                    bp_record.set('company_nature_n', '');
                    bp_record.getField('company_nature_n').setReadOnly(true);
                    bp_record.set('conpany_personal_n', '');
                    bp_record.getField('conpany_personal_n').setReadOnly(true);
                    bp_record.set('actual_online_n', '');
                    bp_record.getField('actual_online_n').setReadOnly(true);
                    bp_record.set('brand_unbrand_n', '');
                    bp_record.getField('brand_unbrand_n').setReadOnly(true);
                    current_record.getField('bp_type_n').setReadOnly(true);
                    current_record.getField('enabled_flag').setReadOnly(true);
                } else {
                    current_record.getField('bp_type_n').setReadOnly(true);
                    current_record.getField('enabled_flag').setReadOnly(true);
                }
            }
        });


        //保存submitsuccess调用
        window['${/parameter/@layout_code}_on_layout_dynamic_submitsuccess'] = function (ds, record, res, bp_seq) {
            var bp_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_bp_master');

88
            console.log($(bp_ds_id));
Spencer Chang's avatar
Spencer Chang committed
89 90 91
            var bp_record = $(bp_ds_id).getCurrentRecord();
            var bp_id = bp_record.get('bp_id');

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
            // Leaf.request({
            //     url: $('hls213_sap_eai_create_customer_link').getUrl(),
            //     para: {
            //         bp_id: bp_id
            //     },
            //     scope: this,
            //     success: function () {
            //         Leaf.request({
            //             url: $('hls213_sap_eai_create_vender_link').getUrl(),
            //             para: {
            //                 bp_id: bp_id
            //             },
            //             scope: this,
            //             success: function () {
            //                 $(bp_ds_id).setQueryParameter('bp_id', bp_id);
            //                 $(bp_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']();
            //             },
            //             sync: true
            //         });
            //     },
            //     failure: function () {
            //         window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
            //     },
            //     error: function () {
            //         window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
            //     },
            //     sync: true
            // });
            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
Spencer Chang's avatar
Spencer Chang committed
128 129 130 131 132 133 134 135 136

        };

        window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_form_add_and_load'] = function (ds, record, config_records, bp_seq) {
            if ((ds.id).indexOf('hls_bp_master') != -1) {

                //身份证验证
                if (ds.fields.id_card_no) {

137
                    //ds.fields.id_card_no.pro.validator = id_card_no_validate;
Spencer Chang's avatar
Spencer Chang committed
138 139 140 141 142 143 144 145 146 147 148
                }

                if (ds.fields.parent_id) {
                    record.getField('parent_id_n').setReadOnly(true);
                }
            }
        };
        var card_identity_flag;
        var sp_identity_flag;

        function id_card_no_validate(record, name, value) {
149

Spencer Chang's avatar
Spencer Chang committed
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
            if (name == 'id_card_no') {
                var bp_name = record.get('bp_name');
            } else if (name == 'id_no_sp') {
                bp_name = record.get('bp_name_sp');
            }
            if (!checkCard(value)) {
                Leaf.showMessage('提示', '请输入正确格式的身份证!');
                return '请输入正确格式的身份证';
            } else {
                card_identity_flag = 'N';
                sp_identity_flag = 'N';
//
                //由于中诚信测试环境只能测试张三,所以这里限定身份证号为张三的123456199001011233
//            if(value=='123456199001011233'){
//
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
                // var url1 = $('identity_query_link').getUrl();
                // window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
                /*     Leaf.request({
                         url: url1,
                         para: {
                             id_card_no: value,//身份证号码
                             bp_name: bp_name
                         },
                         success: function (res) {
                             var resmsg_1 = res.result.resmsg_1;
                             if (resmsg_1 == '1') {
                                 if (name == 'id_card_no') {
                                     record.set('ccx_resmsg', '身份验证成功');
                                     card_identity_flag = 'Y';
                                 } else {
                                     record.set('ccx_resmsg1', '身份验证成功');
                                     sp_identity_flag = 'Y';
                                 }
                             } else {
                                 //个人身份验证
                                 var url = $('Identity_ccx_link').getUrl();

                                 window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
                                 Leaf.request({
                                     url: url,
                                     para: {
                                         bp_name: bp_name,//姓名
                                         id_card_no: value//身份证号码
                                     },
                                     success: function (res) {


                                         var resmsg = res.result.resmsg;
                                         if (name == 'id_card_no') {
                                             record.set('ccx_resmsg', resmsg);
                                             if (resmsg == '身份验证成功') {
                                                 card_identity_flag = 'Y';
                                             }
                                         } else {
                                             record.set('ccx_resmsg1', resmsg);
                                             if (resmsg == '身份验证成功') {
                                                 sp_identity_flag = 'Y';
                                             }

                                         }

                                         window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                                         Leaf.SideBar.show({
                                             msg: '${l:HLS.SUBMIT_SUCCESS}',
                                             duration: 2000
                                         });
                                     },
                                     failure: function () {
                                         window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                                     },
                                     error: function () {
                                         window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                                     },
                                     scope: this,
                                     sync: true
                                 });
                             }
                             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,
                         sync: true
                     });*/
Spencer Chang's avatar
Spencer Chang committed
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
            }

            if (value.length == 18) {
                record.set('date_of_birth', new Date(value.substr(6, 4) + '/' + value.substr(10, 2) + '/' + value.substr(12, 2)));
                record.set('age', new Date().getFullYear() - value.substr(6, 4));
                if (value.substr(16, 1) % 2 == 1) {
                    record.set('gender', 'MALE');
                    record.set('gender_n', '男');
                } else if (value.substr(16, 1) % 2 == 0) {
                    record.set('gender', 'FEMALE');
                    record.set('gender_n', '女');
                }

            }
            return true;
        }


        //商业伙伴分类选择企业   且类型选择 制造商时  集团内外、企业个人、实体虚拟、品牌非品牌   给出只读默认值
        // Leaf.onReady(function() {
        // var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_bp_master_role');
        // if (ds_id && '${/parameter/@default_value_dsid}') {
        // var head_record = $('${/parameter/@default_value_dsid}').getCurrentRecord();
        // var bp_master_role_ds = $(ds_id);
        // var record = new Leaf.Record({
        // 'primary_flag': 'Y',
        // 'bp_category': head_record.get('bp_category'),
        // 'bp_category_n': head_record.get('bp_category_n'),
        // 'bp_type': head_record.get('bp_type'),
        // 'bp_type_n': head_record.get('bp_type_n'),
        // 'bp_class': head_record.get('bp_class'),
        // 'bp_class_n': head_record.get('bp_class_n'),
        // 'enabled_flag': 'Y'
        // });
        // bp_master_role_ds.add(record);
        // var current_record = bp_master_role_ds.getAt(0);
        // current_record.getField('bp_type_n').setReadOnly(true);
        // current_record.getField('enabled_flag').setReadOnly(true);
        // }
        // });


        //保存前调用,生成商机编号
        window['${/parameter/@layout_code}_on_layout_dynamic_before_submit'] = function (ds, record) {
            //
283

Spencer Chang's avatar
Spencer Chang committed
284 285 286 287 288
            var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_bp_master');
            var head_record = $(ds_id).getCurrentRecord();
            var bp_class = head_record.get('bp_class');
            //alert('${/parameter/@unbrand}');
            if (bp_class == 'NP') {
289
                if (card_identity_flag == 'N' || sp_identity_flag == 'N') {
Spencer Chang's avatar
Spencer Chang committed
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
                    window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
                    var check_flag = false;
                    if (head_record.get('bp_code')) {
                        return true;
                    }
                    Leaf.request({
                        url: $('get_special_fields_link_id').getUrl(),
                        para: {
                            document_category: 'BP',
                            // document_type: head_record.get('bp_type'),
                            document_type: 'TENANT',
                            bp_class: head_record.get('bp_class'),
                            id_type: head_record.get('id_type'),
                            id_card_no: head_record.get('id_card_no'),
                            bp_info: head_record.get('bp_info'),
                            province_id: head_record.get('province_id'),
                            organization_code: head_record.get('organization_code'),
                            function_code: '${/parameter/@function_code}',
                            function_usage: '${/parameter/@function_usage}'
                        },
                        success: function (res) {
                            var document_number = res.result.document_number;
                            head_record.set('bp_code', document_number);
                            head_record.set('company_id', '${/session/@company_id}');
                            head_record.set('unbrand', '${/parameter/@unbrand}');
                            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
                    });
                } else {
                    Leaf.showMessage('${l:HLS.PROMPT}', '身份证校验未通过,不能保存!');
                    window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                    return false;
                }
            } else {
                window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
                var check_flag = false;
                if (head_record.get('bp_code')) {
                    return true;
                }
                Leaf.request({
                    url: $('get_special_fields_link_id').getUrl(),
                    para: {
                        document_category: 'BP',
                        // document_type: head_record.get('bp_type'),
                        document_type: 'TENANT',
                        bp_class: head_record.get('bp_class'),
                        id_type: head_record.get('id_type'),
                        id_card_no: head_record.get('id_card_no'),
                        bp_info: head_record.get('bp_info'),
                        province_id: head_record.get('province_id'),
                        organization_code: head_record.get('organization_code'),
                        function_code: '${/parameter/@function_code}',
                        function_usage: '${/parameter/@function_usage}'
                    },
                    success: function (res) {
                        var document_number = res.result.document_number;
                        head_record.set('bp_code', document_number);
                        head_record.set('company_id', '${/session/@company_id}');
                        head_record.set('unbrand', '${/parameter/@unbrand}');
                        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;
        };

        function fin_institution_code_validate(record, name, value) {
            // if (!value) {
            // return '金融机构代码不能为空';
            // } else {
            // if (value.length != 11) {
            // return '金融机构代码长度必须为11位';
            // }
            // }
            // return true;
        }

        // function trade_type_code_validate(record, name, value) {
        // var trade_type_code = record.get('trade_type_code');
        // if(!trade_type_code){
        // if(trade_type_code != trade_type_code.toLowerCase()){
        // return '行业分类代码必须为小写字母';
        // }}
        // return true;
        // }

        //        //新增和加载时调用form
        //        window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_form_add_and_load'] = function(ds, record, config_records, bp_seq) {
        //            if ((ds.id).indexOf('hls_bp_master_credit') != -1 && (ds.id).indexOf('F_ORG_CREDIT') != -1) {
        //                // if (ds.fields.fin_institution_code) {
        //                // ds.fields.fin_institution_code.pro.validator = fin_institution_code_validate;
        //                // }
        //                // if (ds.fields.trade_type_code) {
        //                // ds.fields.trade_type_code.pro.validator = trade_type_code_validate;
        //                // }
        //            }
        //        };

        /* //保存submitsuccess调用
         window['${/parameter/@layout_code}_on_layout_dynamic_submitsuccess'] = function(ds, record, res, bp_seq) {
         window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
         var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_bp_master');
         var head_record = $(ds_id).getCurrentRecord();

         if (head_record.get('bp_class') == 'AGENT') {
         var url = $('gh_nc_post_addsupplierinfo_link').getUrl();
         }
         Leaf.request({
         url: url,
         para: {
         bp_id: head_record.get('bp_id')
         },
         success: function(res) {
         window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
         },
         error: function() {
         window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
         },
         failure: function() {
         window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
         },
         sync: true,
         scope: this
         });
         }; */
        window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_update'] = function (ds, record, name, value, old_value, bp_seq) {
            var f_bp_create_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_bp_master');
            var gird_ds_id = 'BP_NP_CREATE_BP_ASSETS01_hls_bp_assets_ds';
            var gird_ds_id2 = 'BP_NP_CREATE_BP_ASSETS04_hls_bp_assets_ds';
            var gird_ds_id3 = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_bp_bank_flow');
            if (gird_ds_id == ds.id || gird_ds_id2 == ds.id) {
                if (name == 'relationship_with_bp') {
                    if (value == 'A7501') {
                        record.set('owership', $(f_bp_create_ds_id).getAt(0).get('bp_name'));
                    }
                    else if (value == 'A7502') {
                        record.set('owership', $(f_bp_create_ds_id).getAt(0).get('bp_name_sp'));
                    }
                    else {
                        record.set('owership', '');
                    }
                }
            }
            if (gird_ds_id3 == ds.id) {
                if (name == 'relationship_with_bp') {
                    if (value == 'A7501') {
                        record.set('owner_name', $(f_bp_create_ds_id).getAt(0).get('bp_name'));
                    }
                    else if (value == 'A7502') {
                        record.set('owner_name', $(f_bp_create_ds_id).getAt(0).get('bp_name_sp'));
                    }
                    else {
                        record.set('owner_name', '');
                    }
                }
            }

            if ((ds.id).indexOf('hls_bp_master') != -1 && (ds.id).indexOf('F_BASIC') != -1) {
                if (name == 'agent_type') {
                    if (value == 'AGENT_NO_REBATE' || value == 'AGENT_EE') {
                        record.getField('parent_id_n').setReadOnly(false);
                    } else {
                        record.getField('parent_id_n').setReadOnly(true);
                    }
                }
            }

            var hls_bp_master_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_bp_master');
            if (ds.id == hls_bp_master_ds_id && hls_bp_master_ds_id) {
//
                if (name == 'id_card_no') {
                    // record = $(hls_bp_master_ds_id).getCurrentRecord();
                    // var id_num = record.get('id_card_no');
                    // var bp_age = getAge(id_num);
                    // record.set('age', bp_age);
                    if (!value) {
                        record.set('ccx_resmsg', '');
                    }
                    ds.fields.id_card_no.pro.validator = id_card_no_validate;
                    //自动带出籍贯
                    record.set('resident_addres', get_native_place(value))
                }

                if (name == 'id_no_sp') {
                    if (!value) {
                        record.set('ccx_resmsg1', '');
                    }
                    ds.fields.id_no_sp.pro.validator = id_card_no_validate;
                    record.set('resident_addres_sp', get_native_place(value))
                }


            }


        };

        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 = $('hls214N_cdd_downloadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id');
                } else {
                    url = $('hls214N_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) {
            //
            window['${/parameter/@layout_code}_hls_link_render_record'][record.id + '---' + name] = record;
            if (name == 'attachment') {
                link_function = 'upload_file';
                if (record.get('attach_count') == 0 || !record.get('attach_count')) {
                    return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>';
                } else {
                    return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '(' + record.get('attach_count') + ')' + '</a>';
                }
            } else if (name == '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])) {
                            var file_name = temp[0].toUpperCase();
                            var file_suffix = temp[0].substr(temp[0].lastIndexOf('.') + 1).toUpperCase();
                            if (file_name.indexOf('.PDF') >= 0) {
                                url = url + '<a href=javascript:view_pdf(\'' + temp[1] + '\')>' + temp[0] + '</a>' + ',';
                            } else if (file_suffix == 'BMP' || file_suffix == 'JPG' || file_suffix == 'JPEG' || file_suffix == 'PNG' || file_suffix == 'GIF') {
                                url = url + '<a href=' + link + temp[1] + ' ref="img">' + temp[0] + '</a>' + ',';
                            } else {
                                url = url + '<a href=' + link + temp[1] + '>' + temp[0] + '</a>' + ',';
                            }
                        }
                    }
                    return url;

                }
            } else if (name == 'description') {
                if (record.get('important_flag') == 'Y') {
                    return '<font color="RED">' + value + '</font>';
                }
                return value;
            }
        };

        ]]></script>
    </a:view>
</a:screen>