prj_chance_create_entrance.lview 6.7 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
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zhangxing5129  
    $Date: 2014-8-26 上午10:24:00  
    $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 defaultWhereClause="t1.role_id=${/session/@role_id} and t1.company_id=${/session/@company_id}" fetchAll="true" model="hls.HLS109.hls_default_parameter" rootPath="hls_default_parameter_path"/>
    </a:init-procedure>
    <a:view>
        <a:link id="prj_chance_create_link" url="${/request/@context_path}/modules/prj/PRJ400N/prj_chance_create.lview"/>
        <a:link id="con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
        <script type="text/javascript"><![CDATA[
            //确定
            window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function() {
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_chance');
                var record = $(ds_id).getCurrentRecord();
                if ($(ds_id).validate()) {
                    record.set('function_code', 'PRJ400D');
                    record.set('function_usage', 'CREATE');
                    record.set('document_category', 'CHANCE');
                    record.set('default_value_dsid', ds_id);
                    record.data['url_title'] = '${l:PRJ400.PRJ_CHANCE_CREATE_ENTRANCE.CREATE_CHANCE}';
                    var param = record.data;
                    hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, 'prj_chance_create_link');
                }
            };
            
            window['${/parameter/@layout_code}_on_layout_dynamic_update'] = function(ds, record, name, value, oldvalue) {
                if (value != oldvalue) {
                    if (name == 'document_type') {
                        var default_record = $('hls_document_type_ds').find('document_type', record.get('document_type'));
                        if (default_record) {
                            record.set('business_type', default_record.get('business_type'));
                            record.set('business_type_n', default_record.get('business_type_desc'));
                        }
                    } else if (name == 'lease_organization') {
                        $('employee_id_of_manager_n_ds').setQueryParameter('lease_organization', record.get('lease_organization'));
                        $('employee_id_of_manager_n_ds').query();
                    }
                }
            };
            
            function on_employee_id_of_manager_n_ds_load(ds) {
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_chance');
                var record = $(ds_id).getCurrentRecord();
                var totalCount = ds.totalCount;
                if (totalCount == 1) {
                    record.set('employee_id_of_manager_n', ds.getAt(0).get('mgr_employee_name'));
                    record.set('employee_id_of_manager', ds.getAt(0).get('mgr_employee_id'));
                } else {
                    record.set('employee_id_of_manager_n', '');
                    record.set('employee_id_of_manager', '');
                }
            }
            
            
            Leaf.onReady(function() {
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_chance');
                var head_record = $(ds_id).getAt(0);
                var default_record = $('hls_document_type_ds').find('document_type', '${/model/hls_default_parameter_path/record/@lease_chance_type}');
                if (default_record) {
                    head_record.set('document_type', '${/model/hls_default_parameter_path/record/@lease_chance_type}');
                    head_record.set('document_type_n', default_record.get('document_type_desc'));
                    head_record.set('business_type', default_record.get('business_type'));
                    head_record.set('business_type_n', default_record.get('business_type_desc'));
                }
            
                // head_record.set('unit_id', '${/model/hls_default_parameter_path/record/@unit_id}');
                // head_record.set('unit_id_n', '${/model/hls_default_parameter_path/record/@unit_name}');
                // head_record.set('company_id', '${/model/hls_default_parameter_path/record/@company_id}');
                // head_record.set('company_id_n', '${/model/hls_default_parameter_path/record/@company_short_name}');
                // head_record.set('division', '${/model/hls_default_parameter_path/record/@division}');
                // head_record.set('division_n', '${/model/hls_default_parameter_path/record/@division_desc}');
                // head_record.set('employee_id', '${/model/hls_default_parameter_path/record/@employee_id}');
                // head_record.set('employee_id_n', '${/model/hls_default_parameter_path/record/@employee_name}');
                // head_record.set('employee_id_of_manager', '${/model/hls_default_parameter_path/record/@employee_id_of_manager}');
                // head_record.set('employee_id_of_manager_n', '${/model/hls_default_parameter_path/record/@employee_id_of_manager_n}');
                // head_record.set('lease_channel', '${/model/hls_default_parameter_path/record/@lease_channel}');
                // head_record.set('lease_channel_n', '${/model/hls_default_parameter_path/record/@lease_channel_desc}');
                // head_record.set('lease_organization', '${/model/hls_default_parameter_path/record/@lease_organization}');
                // head_record.set('lease_organization_n', '${/model/hls_default_parameter_path/record/@lease_organization_name}');
                 head_record.set('owner_user_id', '${/session/@user_id}');
                // $('employee_id_of_manager_n_ds').setQueryParameter('lease_organization', '${/model/hls_default_parameter_path/record/@lease_organization}');
                // $('employee_id_of_manager_n_ds').query();
            
            });
        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
        <a:dataSets>
            <a:dataSet id="hls_document_type_ds" fetchAll="true" loadData="true" model="basic.hls_document_type_v_lov"/>
            <a:dataSet id="employee_id_of_manager_n_ds" queryUrl="${/request/@context_path}/autocrud/basic.exp_org_unit_manager_lov/query">
                <a:events>
                    <a:event name="load" handler="on_employee_id_of_manager_n_ds_load"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
    </a:view>
</a:screen>