<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zhangyu  
    $Date: 2015-6-18 下午17:35:12  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true">
    <a:init-procedure/>
    <a:view>
        <script type="text/javascript"><![CDATA[
        	function bpCreditLineScreen_close(){
        	    $('hls219_bp_grant_credit_line_window').close();
        	}
        	
        	function bpCreditLineScreen_save(){
        	    Leaf.showConfirm('提示','您确定对该商业伙伴增加授信额度？保存后将无法修改！',function(){
        	        $('hls219_bp_credit_dtl_ds').submit();
        	    });
        	}
        	
        	function line_edit_fun(record,name){
        	    if(record.isNew){
        	        if(name == 'line'){
        	            return 'editor_line_tf';
        	        }else if(name == 'description'){
        	            return 'editor_line_tf';
        	        }
        	    }
        	    return '';
        	}
        	function submitsuccess_func(dataSet,res){
        	    $('hls219_bp_credit_dtl_ds').query();
        	}
        	
        	function bpCreditLineScreen_query(){
        	    $('hls219_bp_credit_dtl_ds').query();
        	}
		]]></script>
        <a:dataSets>
            <a:dataSet id="hls219_bp_credit_direction_ds" lookupCode="HLS219_BP_CREDIT_DIRECTION"/>
            <a:dataSet id="hls219_bp_credit_dtl_ds" autoQuery="true" fetchAll="true" queryUrl="${/request/@context_path}/autocrud/hls.HLS219.hls_bp_master_credit_dtl/query?credit_id=${/parameter/@credit_id}" selectable="true" selectionModel="single" submitUrl="${/request/@context_path}/autocrud/hls.HLS219.hls_bp_master_credit_line_save/batch_update">
                <a:fields>
                    <a:field name="credit_id" defaultValue="${/parameter/@credit_id}"/>
                    <a:field name="direction_desc" defaultValue="授信" displayField="code_value_name" options="hls219_bp_credit_direction_ds" required="true" returnField="direction" valueField="code_value"/>
                    <a:field name="line" required="true"/>
                    <a:field name="description" required="true"/>
                </a:fields>
                <a:events>
                    <a:event name="submitsuccess" handler="submitsuccess_func"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="bpCreditLineScreen_close" text="关闭"/>
                <a:gridButton bind="hls219_bp_credit_line_grid" type="add"/>
                <a:gridButton bind="hls219_bp_credit_line_grid" type="clear"/>
                <a:gridButton click="bpCreditLineScreen_save" text="HLS.SAVE"/>
                <a:gridButton click="bpCreditLineScreen_query" text="查询"/>
            </a:screenTopToolbar>
            <a:form/>
            <a:grid id="hls219_bp_credit_line_grid" bindTarget="hls219_bp_credit_dtl_ds" height="310" navBar="true" width="710">
                <a:columns>
                    <a:column name="direction_desc" align="center" prompt="明细项" width="100"/>
                    <a:column name="creation_date" align="center" prompt="明细项发生日期" renderer="Leaf.formatDate" width="150"/>
                    <a:column name="line" align="right" editorFunction="line_edit_fun" prompt="额度" renderer="Leaf.formatMoney" width="100"/>
                    <a:column name="description" align="left" editorFunction="line_edit_fun" prompt="备注" width="280"/>
                </a:columns>
                <a:editors>
                    <a:textField id="editor_line_tf"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>
