ins_item_insurance_modify.lview 7.04 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
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author:   
    $Date: 2014-8-4 下午01:58:31  
    $Revision: 1.0  
    $Purpose: 商业伙伴查询
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" dynamiccreateenabled="true" trace="true">
    <a:init-procedure>
        <a:model-query model="ins.INS501.ins_check_insurance_date" rootPath="header"/>
    </a:init-procedure>
    <a:view>
        <a:link id="ins_check_date_link_id" model="ins.INS501.ins_check_insurance_date" modelaction="update"/>
        <a:link id="cla_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
        <a:link id="insurance_check_save" url="${/request/@context_path}/modules/ins/INS300/ins_check_save_data.lsc"/>
        <a:link id="insurance_claim_matain" url="${/request/@context_path}/modules/ins/INS301/ins_item_insurance_claim_records.lview"/>
        <script type="text/javascript"><![CDATA[
            function lock_current_window() {
                Leaf.Masker.mask(Ext.getBody(), '${l:HLS.EXECUTING}');
            }
            
            function unlock_current_window() {
                Leaf.Masker.unmask(Ext.getBody());
            }
            
            function open_records_modify_win(ds_id, record_id) {
            
                var record = $(ds_id).findById(record_id);
                var param = record.data;
            
                param['function_code'] = 'INS301';
                param['function_usage'] = 'MODIFY';
                param['url_title'] = '理赔记录';
                param['layout_code'] = 'INS301';
                param['winid'] = 'INS301_window';
             /*    var win = new Leaf.Window({
                    params: param,
                    id: 'INS301_window',
                    url: $('insurance_claim_matain').getUrl(),
                    title: param['url_title'] + '( INS301)',
                    fullScreen: true
                });
              win.on('close', function() {
                            if (ds_id) {
                                $(ds_id).query();
                            }
                        }); */
                 hls_doc_get_layout_code('cla_layout_code_link_id', param, 'insurance_claim_matain', ds_id);
            
            }
            //新增时调用(grid,table,gridBox)
            window['${/parameter/@layout_code}_on_layout_dynamic_grid_add'] = function(ds, record, config_records, bp_seq) {
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract_lease_item');
                var param = $(ds_id).getAt(0).data;
                record.set('contract_id', param['contract_id']);
                record.set('first_beneficiary', param['company_id_n']);//第一受益人为出租人
            
            };
            
            //更新时调用
            window['${/parameter/@layout_code}_on_layout_dynamic_update'] = function(ds, record, name, value, old_value, bp_seq) {
            //
              var insurance_auto_fee =record.get('insurance_auto_fee')=='undefined'?0:record.get('insurance_auto_fee'); 
              if(name == 'compulsory_rebate_rate'){
                  record.set('compulsory_rebate',insurance_auto_fee*value/100);
              }
              if(name == 'combustion_rebate_rate'){
                  record.set('combustion_rebate',insurance_auto_fee*value/100);
              }if(name == 'valid_from' && value){
                 record.set('insurance_year',value.getFullYear());
              }
               };
            
            window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function() {
                
                $('${/parameter/@winid}').close();
 
            };
            

            
            function query() {
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'ins_insurance_policy');
                $(ds_id).query();
            }
            
            
            window['${/parameter/@layout_code}_user_button2_layout_dynamic_click'] = function() {
               
                window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
                var batch_id = ${/model/header/record/@batch_id};
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'ins_insurance_policy');
                var records = $(ds_id).getAll();
                var param = new Object();
                var datas = [];
                var data = {};
                if (records.length == 0) {
                    return;
                }
            
                for (var i = 0;i < records.length;i++) {
                    data = records[i].data;
                    data['batch_id'] = batch_id;
                    data['_status'] = 'insert';
                    datas.push(data);
                }
            
                param['details'] = datas;
                param['batch_id'] = batch_id;
                
                Leaf.request({
                    url: $('insurance_check_save').getUrl(),
                    para: param,
                    success: function(res) {
                        $(ds_id).submit();
                        Leaf.SideBar.show({
                            msg: '操作成功',
                            duration: 2000
                        });
            
                        setTimeout('query()', 500);
                         window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                        // query();
                    },
            
                    failure: function() {
                       window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                    },
                    error: function() {
                        window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                    },
                    scope: this
                });
            };
            
            window['${/parameter/@layout_code}_dynamic_link_renderer'] = function(value, record, name, config_record) {
                if (name == 'policy_link') {
                    return '<a href="javascript:open_records_modify_win(\'' + record.ds.id + '\',\'' + record.id + '\')">' + '理赔记录' + '</a>';
                }
                return '';
            };
            
            
            window['${/parameter/@layout_code}_on_layout_dynamic_grid_query'] = function(ds, qpara, bp_seq) {
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'ins_insurance_policy');
            
                if (ds == $(ds_id)) {
                    aut_authority_list_validate_query(ds, qpara);
            
                }
            };
        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_authority_list_validate.lview?document_category=INSURANCE&amp;function_code=INS300&amp;custom_code=INS300"/>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>