lease_chance_create_project.lview 6.17 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
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: DJ  
    $Date: 2013-2-26 下午2:37:49  
    $Revision: 1.0  
    $Purpose: projectNoScreen
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true">
    <a:init-procedure>
        <a:model-query model="lch.LCH502.lch_ref_document_type" rootPath="ref_document_record"/>
    </a:init-procedure>
    <a:view>
        <a:link id="bmLink_chanceMaintain_createToProject" model="lch.LCH501.lch_lease_chance_create_to_project" modelaction="execute"/>
        <a:link id="bmLink_chanceMaintain_updateProjectNumber" model="prj.PRJ501.prj_project_number" modelaction="update"/>
        <script type="text/javascript"><![CDATA[
        
        function chanceCreateProject_close()
        {
            $('lease_chance_create_project').close();
        }
        
        function unmask_chanceCreateProject()
        {
            if(Leaf.CmpManager.get('lease_chance_create_project'))
            {
                Leaf.Masker.unmask($('lease_chance_create_project').wrap);
            }
        }
        
        function mask_chanceCreateProject()
        {
            if(Leaf.CmpManager.get('lease_chance_create_project'))
            {
                Leaf.Masker.mask($('lease_chance_create_project').wrap,'${l:HLS.SAVING}');
            }
        }
        
        function chanceCreateProject_updateProjectNumber()
        {
            mask_chanceCreateProject();
            var record=$('chanceCreateProjectDs').getAt(0);
            
            Leaf.request({
                url: $('bmLink_chanceMaintain_updateProjectNumber').getUrl(),
                para: {
                	project_id:record.get('project_id'),
                	project_no:record.get('project_no')
                },
                success: function(res) {
                    var record=$('chanceCreateProjectDs').getAt(0);
                    record.set('project_no',res['result']['project_no']);
                    Leaf.showMessage('${l:HLS.PROMPT}','${l:PRJ501.SAVE_SUCCESS_PROJECT_CODE}'+record.get('project_no'));
                    unmask_chanceCreateProject();
                    chanceCreateProject_close();
                },
                failure: function() {
                    unmask_chanceCreateProject();
                },
                error: function() {
                    unmask_chanceCreateProject();
                },
                scope: this
            });
        }
        
        function chanceCreateProject_save()
        {
            mask_chanceCreateProject();
            var record=$('chanceCreateProjectDs').getAt(0);
            Leaf.request({
                url: $('bmLink_chanceMaintain_createToProject').getUrl(),
                para: {
                	lease_chance_id:'${/parameter/@lease_chance_id}',
                	project_no:record.get('project_no'),
                	project_name:record.get('project_name'),
                	document_type:record.get('document_type'),
                	business_type:record.get('business_type'),
                	document_category:record.get('document_category')
                },
                success: function(res) {
                    var record=$('chanceCreateProjectDs').getAt(0);
                    
                    record.set('project_no',res['result']['project_no']);
                    record.set('project_id',res['result']['project_id']);
                    
                    if('${/model/ref_document_record/record/@code_update_flag}'=='Y')
		            {
            			record.getField('project_no').setReadOnly(false);
            			record.getField('project_no').setRequired(true);
            			record.getField('project_name').setReadOnly(true);
            			$('button_createProject').setVisible(false);
            			$('button_updateProjectNumber').setVisible(true);
            			unmask_chanceCreateProject();
		            }
		            else
		            {
		                Leaf.showMessage('${l:HLS.PROMPT}','${l:PRJ501.SAVE_SUCCESS_PROJECT_CODE}'+record.get('project_no'));
		                unmask_chanceCreateProject();
		                chanceCreateProject_close();
		            }
                },
                failure: function() {
                    unmask_chanceCreateProject();
                },
                error: function() {
                    unmask_chanceCreateProject();
                },
                scope: this
            });
        }
        
        ]]></script>
        <a:dataSets>
            <a:dataSet id="chanceCreateProjectDs" autoCreate="true" model="prj.PRJ501.prj_project">
                <a:fields>
                    <a:field name=""/>
                    <a:field name="document_type" defaultValue="${/model/ref_document_record/record/@document_type}"/>
                    <a:field name="business_type" defaultValue="${/model/ref_document_record/record/@business_type}"/>
                    <a:field name="document_category" defaultValue="${/model/ref_document_record/record/@document_category}"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:form column="2" title=" ">
                <a:textField name="project_no" bindTarget="chanceCreateProjectDs" maxLength="30"/>
                <a:textField name="project_name" bindTarget="chanceCreateProjectDs"/>
            </a:form>
            <a:hBox>
                <a:button id="button_createProject" click="chanceCreateProject_save" text="创建项目"/>
                <a:button click="chanceCreateProject_close" text="HLS.CLOSE"/>
                <a:button id="button_updateProjectNumber" click="chanceCreateProject_updateProjectNumber" hidden="true" text="修改项目编号"/>
            </a:hBox>
            <script type="text/javascript"><![CDATA[
	        (function ()
	        {
	            var record=$('chanceCreateProjectDs').getAt(0);
	            var field=record.getField('project_no');
	            if('${/model/ref_document_record/record/@code_auto_flag}'=='Y')
	            {
	                field.setReadOnly(true);
	            }
	            else
	            {
	                field.setRequired(true);
	            }
	        })();
	        
	        ]]></script>
        </a:screenBody>
    </a:view>
</a:screen>