prj_project_create_entrance.lview 8.6 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
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zhangxing5129  
    $Date: 2014-10-11 下午01:03:24  
    $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_project_create_link" url="${/request/@context_path}/modules/prj/PRJ500N/prj_project_create_create_tree_n.lview"/>
        <a:link id="con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
        <a:link id="prj520_prj_save_from_credit" model="prj.PRJ520.create_prj_from_credit_line" modelaction="execute"/>
        <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_project');
                var record = $(ds_id).getCurrentRecord();
                var credit_line_id = record.get('credit_line_id');
                var document_type = record.get('document_type');
                var business_type = record.get('business_type'); 
                if ($(ds_id).validate()) {
                    Leaf.Masker.mask(Ext.getBody(), '${l:HLS.EXECUTING}');
                    Leaf.request({
                    url: $('prj520_prj_save_from_credit').getUrl(),
                    para: {
                        credit_line_id:credit_line_id,
                        document_type:document_type,
                        document_category:'PROJECT',
                        business_type:business_type
                    },
                    success: function(res) {
                        Leaf.Masker.unmask(Ext.getBody());
            			record.set('project_id',res.result.project_id);
            			record.set('wf_function_code','${/parameter/@function_code}');
	                    record.set('function_code', 'PRJ520D');
	                    record.set('function_usage', 'CREATE');
	                    record.set('default_value_dsid', ds_id);
	                    record.data['url_title'] = '合同创建';
	                    record.set('cond_para2',record.get('bp_tenant_type'));
	                    record.set('cond_para3',record.get('bp_vender_type'));
	                    var param = record.data;
	                    hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, 'prj_project_create_link');
                    },
                    failure: function() {
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    error: function() {
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    scope: this
                });
                }
            };
            
            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_project');
                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', '');
                }
            }
            function prj500n_init_load(record,name,value){
                if(value){
                    record.set(name,value);
                }
            }
            
		
			 Leaf.onReady(function() {
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
                var head_record = $(ds_id).getAt(0);
                var default_record = $('hls_document_type_ds').find('document_type', '${/model/hls_default_parameter_path/record/@project_type}');
                if (default_record) {
                    head_record.set('document_type', '${/model/hls_default_parameter_path/record/@project_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'));
                }
            
            	
                prj500n_init_load(head_record,'unit_id', '${/model/hls_default_parameter_path/record/@unit_id}');
                prj500n_init_load(head_record,'unit_id_n', '${/model/hls_default_parameter_path/record/@unit_name}');
                prj500n_init_load(head_record,'company_id', '${/model/hls_default_parameter_path/record/@company_id}');
                prj500n_init_load(head_record,'company_id_n', '${/model/hls_default_parameter_path/record/@company_short_name}');
                prj500n_init_load(head_record,'division', '${/model/hls_default_parameter_path/record/@division}');
                prj500n_init_load(head_record,'division_n', '${/model/hls_default_parameter_path/record/@division_desc}');
                /* prj500n_init_load(head_record,'employee_id', '${/model/hls_default_parameter_path/record/@employee_id}');
                prj500n_init_load(head_record,'employee_id_n', '${/model/hls_default_parameter_path/record/@employee_name}'); */
                prj500n_init_load(head_record,'sale_assistant_id', '${/model/hls_default_parameter_path/record/@employee_id}');
                prj500n_init_load(head_record,'sale_assistant_id_n', '${/model/hls_default_parameter_path/record/@employee_name}');
                prj500n_init_load(head_record,'employee_id_of_manager', '${/model/hls_default_parameter_path/record/@employee_id_of_manager}');
                prj500n_init_load(head_record,'employee_id_of_manager_n', '${/model/hls_default_parameter_path/record/@employee_id_of_manager_n}');
                prj500n_init_load(head_record,'lease_channel', '${/model/hls_default_parameter_path/record/@lease_channel}');
                prj500n_init_load(head_record,'lease_channel_n', '${/model/hls_default_parameter_path/record/@lease_channel_desc}');
                prj500n_init_load(head_record,'lease_organization', '${/model/hls_default_parameter_path/record/@lease_organization}');
                prj500n_init_load(head_record,'lease_organization_n', '${/model/hls_default_parameter_path/record/@lease_organization_name}');
                prj500n_init_load(head_record,'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>