con_collection_callback.lview 33.5 KB
Newer Older
Spencer Chang's avatar
Spencer Chang committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 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
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: Calvin  
    $Date: 2017年11月22日18:21:48
    $Revision: 1.0  
    $Purpose:发起清收页面 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" dynamiccreateenabled="true" trace="true">
    <a:init-procedure>
        <a:model-query fetchAll="true" model="cont.CON632.get_batch_id" rootPath="batch_id_path"/>
        <!-- <a:model-query fetchAll="true" model="cont.CON632.get_col_count" rootPath="col_count_path"/> -->
        <s:server-script import="contract_print_path.js"><![CDATA[
           $ctx.parameter.file_path = con_print_path['con_print_path'];
           $ctx.parameter.tomcat_source = con_print_path['tomcat_source'];
        ]]></s:server-script>
    </a:init-procedure>
    <a:view>
        <a:link id="con632_update_col_link" url="${/request/@context_path}/modules/cont/CON632/con_collection_insert_tmp.lsc"/>
        <a:link id="con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
        <a:link id="car_modify_special_link" url="${/request/@context_path}/modules/prj/PRJ500N/prj_project_create.lview"/>
        <a:link id="con_contract_modify_link" url="${/request/@context_path}/modules/cont/CON505/con_contract_modify.lview"/>
        <a:link id="${/parameter/@layout_code}_col_detail_link" url="${/request/@context_path}/modules/cont/CON632/con_collection_phone_detail.lview"/>
        <a:link id="${/parameter/@layout_code}_submit_approval_link" model="cont.CON632.con_collection_callback_wfl" modelaction="update"/>
        <a:link id="${/parameter/@layout_code}_insert_management_link" url="${/request/@context_path}/modules/cont/CON632/con_collection_insert_management.lsc"/>
        <a:link id="${/parameter/@layout_code}_cdd_uploadFile_id" url="${/request/@context_path}/uploadFile.lview"/>
        <a:link id="${/parameter/@layout_code}_cdd_downloadFile_id" url="${/request/@context_path}/downloadFile.lview"/>
        <link href="${/request/@context_path}/css/lightbox.css" rel="stylesheet" type="text/css"/>
        <script src="${/request/@context_path}/javascripts/lightbox.js" type="text/javascript"/>
        <script src="${/request/@context_path}/javascripts/jquery-1.6.4.min.js" type="text/javascript"/>
        <a:link id="get_col_count_link" model="cont.CON632.get_col_count" modelaction="update"/>
        <a:link id="update_assign_user_link" model="cont.CON632.update_assign_user" modelaction="update"/>
        <a:link id="hls_bp_master_modify_link" url="${/request/@context_path}/modules/hls/HLS214N/hls_bp_master_modify.lview"/>
        <script type="text/javascript"><![CDATA[
            jQuery.noConflict();
            Ext.ux.Lightbox.register('a[ref=img]', true);
            //锁屏
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_lock_layout_dynamic_window'] = function() {
                var detail_mask;
                if ('${/parameter/@winid}') {
                    if (parent.$L.CmpManager.get('${/parameter/@winid}')) {
                        detail_mask = parent.$('${/parameter/@winid}').wrap;
                        parent.Leaf.Masker.mask(detail_mask, '${l:HLS.EXECUTING}');
                    } else {
                        detail_mask = $('${/parameter/@winid}').wrap;
                        Leaf.Masker.mask(detail_mask, '${l:HLS.EXECUTING}');
                    }
                } else {
                    detail_mask = Ext.getBody();
                    Leaf.Masker.mask(detail_mask, '${l:HLS.EXECUTING}');
                }
            };
            //解屏
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window'] = function() {
                var detail_mask;
                if ('${/parameter/@winid}') {
                    if (parent.$L.CmpManager.get('${/parameter/@winid}')) {
                        detail_mask = parent.$('${/parameter/@winid}').wrap;
                        parent.Leaf.Masker.unmask(detail_mask);
                    } else {
                        detail_mask = $('${/parameter/@winid}').wrap;
                        Leaf.Masker.unmask(detail_mask);
                    }
                } else {
                    detail_mask = Ext.getBody();
                    Leaf.Masker.unmask(detail_mask);
                }
                if (Ext.get(document.documentElement)) {
                    $L.Masker.unmask(Ext.get(document.documentElement));
                }
            };
            
            function check_releated_layout(releated_table) {
                var str = '${/parameter/@layout_code}';
                //商机
                if (str.indexOf(releated_table) >= 0) {
                    return true;
                } else {
                    return false;
                }
            }
            
            //提交审批
            window['${/parameter/@layout_code}_submit_approval_layout_dynamic_click'] = function() {
                //
                //提交先保存
                window['${/parameter/@layout_code}_SAVE_LAYOUT_DYNAMIC_CLICK']();
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_collection_callback');
                var lease_item_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_bp_master');
                // window['${/parameter/@layout_code}_not_ignore_required_flag'] = true;
                var record = $(ds_id).getCurrentRecord();
                var contract_ds_id = $('${/parameter/@layout_code}_G_CAR_hls_bp_master_ds');
                var contract_records = contract_ds_id.getSelected();
                if (record.get('wfl_status') == 'REJECT') {
                    var param = {};
                    var datas = [];
                    var saveData = [];
                    var batch_id = ${/model/batch_id_path/record/@batch_id};
                    for (var j = 0;j < contract_records.length;j++) {
                        saveData.push({
                            'contract_lease_item_id': contract_records[j].get('contract_lease_item_id'),
                            'callback_id': record.get('callback_id'),
                            'batch_id': batch_id,
                            '_status': 'insert'
                        });
                    }
                    param['details'] = saveData;
                    Leaf.request({
                        url: $('con632_update_col_link').getUrl(),
                        para: param,
                        success: function() {},
                        failure: function() {},
                        error: function() {},
                        scope: this
                    });
                    //
                    for (var i = 0;i < contract_records.length;i++) {
                        var callback_flag = contract_records[i].get('callback_flag');
                        // var real_callback_flag = contract_records[i].get('real_callback_flag');
                        if (contract_records[i].get('contract_lease_item_id')) {
                            var obj = {};
                            obj['callback_id'] = record.get('callback_id');
                            obj['contract_lease_item_id'] = contract_records[i].get('contract_lease_item_id');
                            obj['callback_flag'] = callback_flag;
                            // obj['real_callback_flag'] = real_callback_flag;
                            obj['_status'] = 'update';
                            datas[i] = obj;
                        }
                    }
                    // if (!callback_flag && !real_callback_flag) {
                    // Leaf.showMessage('${l:HLS.PROMPT}', '请至少选择一个清收状态!');
                    // } else {
                    Leaf.showConfirm('${l:HLS.PROMPT}', '确认提交?', function() {
                        //插入待处置清单表
                        Leaf.request({
                            url: $('${/parameter/@layout_code}_insert_management_link').getUrl(),
                            para: datas,
                            success: function() {
                                //启动工作流
                                Leaf.request({
                                    url: $('${/parameter/@layout_code}_submit_approval_link').getUrl(),
                                    para: {
                                        callback_id: record.get('callback_id')
                                    },
                                    success: function(res) {
                                        window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                                        $('${/parameter/@winid}').close();
                                        Leaf.SideBar.show({
                                            msg: '操作成功',
                                            duration: 2000
                                        });
                                    },
                                    failure: function() {
                                        window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                                    },
                                    error: function() {
                                        window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                                    },
                                    scope: this
                                });
                            },
                            failure: function() {
                                window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                            },
                            error: function() {
                                window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                            },
                            scope: this
                        });
                    });
                } else {
                    if (contract_records.length == 0) {
                        Leaf.showMessage('提示', '请至少选择一条租赁物!');
                        return;
                    } else {
                        var param = {};
                        var datas = [];
                        var saveData = [];
                        var batch_id = ${/model/batch_id_path/record/@batch_id};
                        for (var j = 0;j < contract_records.length;j++) {
                            saveData.push({
                                'contract_lease_item_id': contract_records[j].get('contract_lease_item_id'),
                                'callback_id': record.get('callback_id'),
                                'batch_id': batch_id,
                                '_status': 'insert'
                            });
                        }
                        param['details'] = saveData;
                        Leaf.request({
                            url: $('con632_update_col_link').getUrl(),
                            para: param,
                            success: function() {},
                            failure: function() {},
                            error: function() {},
                            scope: this
                        });
                        //
                        for (var i = 0;i < contract_records.length;i++) {
                            var callback_flag = contract_records[i].get('callback_flag');
                            // var real_callback_flag = contract_records[i].get('real_callback_flag');
                            if (contract_records[i].get('contract_lease_item_id')) {
                                var obj = {};
                                obj['callback_id'] = record.get('callback_id');
                                obj['contract_lease_item_id'] = contract_records[i].get('contract_lease_item_id');
                                obj['callback_flag'] = callback_flag;
                                // obj['real_callback_flag'] = real_callback_flag;
                                obj['_status'] = 'update';
                                datas[i] = obj;
                            }
                        }
                        // if (!callback_flag && !real_callback_flag) {
                        // Leaf.showMessage('${l:HLS.PROMPT}', '请至少选择一个清收状态!');
                        // } else {
                        Leaf.showConfirm('${l:HLS.PROMPT}', '确认提交?', function() {
                            //插入待处置清单表
                            Leaf.request({
                                url: $('${/parameter/@layout_code}_insert_management_link').getUrl(),
                                para: datas,
                                success: function() {
                                    //启动工作流
                                    Leaf.request({
                                        url: $('${/parameter/@layout_code}_submit_approval_link').getUrl(),
                                        para: {
                                            callback_id: record.get('callback_id')
                                        },
                                        success: function(res) {
                                            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                                            $('${/parameter/@winid}').close();
                                            Leaf.SideBar.show({
                                                msg: '操作成功',
                                                duration: 2000
                                            });
                                        },
                                        failure: function() {
                                            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                                        },
                                        error: function() {
                                            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                                        },
                                        scope: this
                                    });
                                },
                                failure: function() {
                                    window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                                },
                                error: function() {
                                    window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                                },
                                scope: this
                            });
                        });
                        // }
                    }
                }
            };
            
            // 加载时调用(grid,table,gridBox)
            window['${/parameter/@layout_code}_on_layout_dynamic_grid_load'] = function(ds, record) {
            
                var ds_call_id = '${/parameter/@layout_code}_G_CAR_hls_bp_master_ds';
                jQuery("div").hover(function() {
                    if (ds_call_id) {
                        var records = $(ds_call_id).getAll();
                        for (var i = 0;i < records.length;i++) {
                            //
                            var id = "#${/parameter/@layout_code}_G_CAR_hls_bp_master_layout_grid_id__" + records[i].id;
                            //获取实际清收状态,如果有值,则不能选择
                            if (records[i].get('col_management_status') == 'WAIT_FOR_MANAGEMENT' || records[i].get('col_management_status') == 'FINISH_MANAGEMENT' || records[i].get('col_management_status') == 'MANAGEMENTING') {
                                //
                                jQuery(id).removeClass("grid-ckb item-ckb-u").addClass('grid-ckb item-ckb-readonly-u');
                            }
                            jQuery("div").unbind(); //移除所有
                        }
                    }
                });
            
            };
            
            //保存submitsuccess调用
            window['${/parameter/@layout_code}_on_layout_dynamic_submitsuccess'] = function(ds, record, res, bp_seq) {
                //
                dirty_flag = 'N';
                if ('${/parameter/@layout_code}' == 'COL_CALLBACK_DETAIL_WFL') {
                    var collection_call_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_collection_callback');
            		if (collection_call_id) {
                        var collection_record = $(collection_call_id).getCurrentRecord();
                        var callback_id = collection_record.get('callback_id');
                        var assign_user_id = collection_record.get('assign_user_id');
                        // collection_record.set('col_count', ${/model/col_count_path/record/@col_count});
                        Leaf.request({
                            url: $('update_assign_user_link').getUrl(),
                            para: {
                                callback_id: callback_id,
                                assign_user_id: assign_user_id
                            },
                            success: function() {
                                window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                            },
                            scope: this
                        });
                    }
                }
                if ('${/parameter/@layout_code}' != 'COL_CALLBACK_DETAIL_WFL' && '${/parameter/@layout_code}' != 'COL_CALLBACK_DETAIL_REFUSED') {
                    var collection_call_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_collection_callback');
                    if (collection_call_id) {
                        var collection_record = $(collection_call_id).getCurrentRecord();
                        var callback_id = collection_record.get('callback_id');
                        // collection_record.set('col_count', ${/model/col_count_path/record/@col_count});
                        Leaf.request({
                            url: $('get_col_count_link').getUrl(),
                            para: {
                                callback_id: callback_id,
                                col_number: '${/parameter/@col_number}'
                            },
                            success: function() {
                                window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                            },
                            scope: this
                        });
                    }
                } else {
                    window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                }
            };
            
            var isLoaded = 'N';
            //	ds_call_id 进入后无法自动刷新,设置定时刷新
            var check_isload = setInterval(function() {
                if (isLoaded == 'N') {
                    if (isLoaded == 'N') {
                        var ds_call_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_collection_call_hd');
                        if (ds_call_id) {
                            jQuery("#${/parameter/@layout_code}_G_PHONE_COLLECTION_con_collection_call_hd_layout_grid_id_wrap .nav-refresh").click();
                            jQuery("div").unbind(); //移除所有
                            isLoaded = 'Y';
                        }
                    }
                } else {
                    clearInterval(check_isload);
                }
            }, 1000);
            
            
            //查询时调用(grid,table,gridBox)
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_query'] = function(ds, qpara, bp_seq) {
                //
                var ds_check_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_bp_master');
                var ds_call_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_collection_call_hd');
                if (ds_check_id == ds.id && ds_check_id) {
                    $(ds_check_id).setQueryParameter('bp_id', '${/parameter/@bp_id}');
                } else if (ds.id == '${/parameter/@layout_code}_G_CAR_hls_bp_master_ds') {
                    $('${/parameter/@layout_code}_G_CAR_hls_bp_master_ds').setQueryParameter('bp_id', '${/parameter/@bp_id}');
                }
            
                if (ds_call_id == ds.id && ds_call_id) {
                    var col_number = '${/parameter/@col_number}';
                    col_number = col_number.replace('CC', '');
                    $(ds_call_id).setQueryParameter('col_id', col_number);
                }
            
            };
            
            function open_contract_win(ds_id, record_id) {
                var record = $(ds_id).findById(record_id);
                var param = record.data;
                param['function_code'] = 'CON301';
                param['maintain_type'] = 'UPDATE';
                param['url_title'] = '${l:CON301.CONTRACT_DETAIL}';
                hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, 'con_contract_modify_link', ds_id, '${/parameter/@layout_code}');
            }
            
            function open_project_Window(ds_id, record_id) {
                //
                var record = $(ds_id).findById(record_id);
                var param = {};
                param['company_id'] = record.get('company_id');
                param['project_id'] = record.get('project_id');
                param['function_code'] = 'PRJ502D';
                param['function_usage'] = 'QUERY';
                param['bp_class'] = record.get('bp_class');
                param['maintain_type'] = 'QUERY';
                param['url_title'] = '${l:HLS.PROJECT_MAITAIN}';
                hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, 'car_modify_special_link', ds_id, '${/parameter/@layout_code}');
            }
            
            function open_col_detail_win(ds_id, record_id) {
                var record = $(ds_id).findById(record_id);
                var param = record.data;
                param['function_code'] = 'CON632_PDQ';
                param['function_usage'] = 'QUERY';
                param['maintain_type'] = 'READONLY';
                param['url_title'] = '催收详情';
                param['winid'] = 'col_detail_id';
                hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, '${/parameter/@layout_code}_col_detail_link', ds_id, '${/parameter/@layout_code}');
            }
            
            function view_pdf(attachment_id) {
                Leaf.request({
                    url: '${/request/@context_path}/autocrud/fnd.fnd_atm_attachment/query',
                    para: {
                        attachment_id: attachment_id
                    },
                    success: function(res) {
                        var path = res.result.record.file_path;
                        path = path.substr(path.indexOf('hls_attachment'));
                        var tomcat_source = '${/parameter/@tomcat_source}';
                        var source_path = 'http://' + window.location.host + '/' + tomcat_source + '/' + path;
                        var oWin = window.open(source_path);
                    },
                    scope: this
                });
            }
            
            function upload_file(id, name, query_only) {
                var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
                if (record.get('contract_lease_item_id')) {
                    var url;
                    if (query_only == 'Y' || '${/parameter/@function_usage}' == 'QUERY' || '${/parameter/@maintain_type}' == 'READONLY' || record.get('callback_flag')) {
                        url = $('${/parameter/@layout_code}_cdd_downloadFile_id').getUrl() + '?table_name=CON_CONTRACT_LEASE_ITEM&header_id=' + record.get('contract_lease_item_id');
                    } else {
                        url = $('${/parameter/@layout_code}_cdd_uploadFile_id').getUrl() + '?table_name=CON_CONTRACT_LEASE_ITEM&header_id=' + record.get('contract_lease_item_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}', '请先保存!');
            
                }
            }
            
            
            
            function upload_file_acy(id, name, query_only) {
                var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
                if (record.get('col_attachment_id')) {
                    var url;
                    if (query_only == 'Y' || '${/parameter/@function_usage}' == 'QUERY' || '${/parameter/@maintain_type}' == 'READONLY' || record.get('callback_flag')) {
                        url = $('${/parameter/@layout_code}_cdd_downloadFile_id').getUrl() + '?table_name=COL_COLLECTION_ATTACHMENT&header_id=' + record.get('col_attachment_id');
                    } else {
                        url = $('${/parameter/@layout_code}_cdd_uploadFile_id').getUrl() + '?table_name=COL_COLLECTION_ATTACHMENT&header_id=' + record.get('col_attachment_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}', '请先保存!');
            
                }
            }
            
            function open_bp_modify_win(ds_id, record_id) {
                var record = $(ds_id).findById(record_id);
                var param = record.data;
                param['function_code'] = 'HLS214D';
                param['bp_id'] = record.get('bp_id');
                param['bp_category'] = '${/parameter/@bp_category}';
                param['bp_class'] = '${/parameter/@bp_class}';
                if ('${/parameter/@bp_category}' == 'AGENT') {
                    param['function_code'] = 'HLS228DL';
                }
                param['function_usage'] = 'QUERY';
                if ('${/parameter/@bp_function_usage}' == 'MODIFY') {
                    param['function_usage'] = 'MODIFY';
                }
                param['url_title'] = '${l:HLS212.BP_MASTER_MAINTAIN}';
                hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, 'hls_bp_master_modify_link', null, '${/parameter/@layout_code}');
            }
            
            // function open_bp_modify_win(ds_id, record_id) {
            // var record = $(ds_id).findById(record_id);
            // var param = record.data;
            // param['function_code'] = 'CON501H';
            // param['function_usage'] = 'QUERY';
            // param['url_title'] = '${l:HLS212.BP_MASTER_QUERY}';
            // hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, 'hls_bp_master_modify_link', ds_id);
            // }
            
            //超链接渲染
            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 == 'project_number' && value) {
                    return '<a href="javascript:open_project_Window(\'' + record.ds.id + '\',\'' + record.id + '\')">' + value + '</a>';
                } else if (name == 'contract_number' && value) {
                    return '<a href="javascript:open_contract_win(\'' + record.ds.id + '\',\'' + record.id + '\')">' + value + '</a>';
                } else if (name == 'bp_modify') {
                    return '<a href="javascript:open_bp_modify_win(\'' + record.ds.id + '\',\'' + record.id + '\')">' + config_record.get('prompt') + '</a>';
                } else if (name == 'col_detail' && !record.isNew) {
                    return '<a href="javascript:open_col_detail_win(\'' + record.ds.id + '\',\'' + record.id + '\')">' + config_record.get('prompt') + '</a>';
                } else 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 == 'attachment2') {
                    link_function = 'upload_file_acy';
                    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;
                    }
                }
                return value;
            };
            
            //add by zhuxianfei 20180302 --begin
            var dirty_flag;
            //更新时调用
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_update'] = function(ds, record, name, value, old_value, bp_seq) {
                var con_col_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_col_management_hd');
                if (ds.id == con_col_ds_id) {
                    if (name == 'real_callback_flag' || name == 'car_commission') {
                        dirty_flag = 'Y';
                    }
                }
            };
            
            // //保存submitsuccess调用
            // window['${/parameter/@layout_code}_on_layout_dynamic_submitsuccess'] = function(ds, record, res, bp_seq) {
            // window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
            // dirty_flag = 'N';
            // };
            
            
            //modify by zhuxianfei  提交校验必输提示保存
            
            function zjwfl5110_beforeapproveCheck(agree) {
                //
                if ('${/parameter/@instance_id}') {
                    if ('${/parameter/@check_flag}' == 'Y') {
                        var root_ds = $('${/parameter/@layout_code}_virtual_ds');
                        var records = root_ds.getAll();
                        if (root_ds.validate()) {
                            if (dirty_flag == 'Y') {
                                Leaf.showMessage('提示', '界面数据已更改,请先保存');
                                return false;
                            } else {
                                return true;
                            }
                        } else {
                            return false;
                        }
                    } else {
                        return true;
                    }
                }
            }
            //--end
        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>