<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: lpc 9874
    $Date: $
    $Revision: 1.0 $
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" dynamiccreateenabled="true" trace="true">
    <a:init-procedure/>
    <a:view>
        <script type="text/javascript"><![CDATA[
            //加载时调用(grid,table,gridBox)
            window['${/parameter/@layout_code}_on_layout_dynamic_form_query'] = function(ds, qpara, bp_seq) {
                qpara['contract_lease_item_id'] = '${/parameter/@contract_lease_item_id}';
            
            };
            //加载时调用(grid,table,gridBox)
            window['${/parameter/@layout_code}_on_layout_dynamic_grid_query'] = function(ds, qpara, bp_seq) {
                qpara['contract_lease_item_id'] = '${/parameter/@contract_lease_item_id}';
            
            };
            
            //seq
            //新增时调用(grid,table,gridBox)
            window['${/parameter/@bp_seq}${/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 con_lease_record = $(ds_id).getCurrentRecord();
                if (ds.id == '${/parameter/@layout_code}_G_INSURANCE_RECORDS_con_car_insurance_records_ds') {
                    var records = ds.getAll(),
                        power_seq = 0;
                    //设置序号
                    if (records.length) {
                        for (var k = 0;k < records.length;k++) {
                            var record = records[k],
                                seqnum = record.get('seq');
                            if (power_seq <= seqnum) {
                                power_seq = seqnum;
                            }
                        }
                    }
                    var seq_value = power_seq + 1;
                    record.set('seq', seq_value);
                    var unit_id = con_lease_record.get('unit_id');
                    var unit_id_n = con_lease_record.get('unit_id_n');
                    var lease_organization = con_lease_record.get('lease_organization');
                    var lease_organization_n = con_lease_record.get('lease_organization_n');
                    record.set('re_region', unit_id);
                    record.set('re_region_n', unit_id_n);
                    record.getField('re_region').setReadOnly(true);
                    record.set('business_department', lease_organization);
                    record.set('business_department_n', lease_organization_n);
                    record.getField('business_department').setReadOnly(true);
                }
            };
        ]]></script>
    </a:view>
</a:screen>
