<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gaoyang  
    $Date: 2013-3-4 下午01:56:01  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true">
    <a:view>
        <a:link id="sys_service_welcome_link" url="${/request/@context_path}/welcome.lview"/>
		<a:link id="pageLink_role_assign" url="${/request/@context_path}/modules/hls/HLS106/sys_get_user_role_assign.lview"/>
        <script type="text/javascript"><![CDATA[
        	function hls_106_query(){
        	    $('fnd_bp_type_define_result_ds').query();
        	}
        	function hls_106_reset(){
        	    $('fnd_bp_type_define_query_ds').reset();
        	}
        	function hls_106_next(){
                 history.go(1);
            }
            function hls_106_back(){
                history.go(-1);
            }
            function hls_106_quit(){
                location.href = $('sys_service_welcome_link').getUrl();
                parent.shMenu('show');
            }
            function hls_106_add(){
                 $('fnd_bp_type_define_grid_ds').showEditorByRecord($('fnd_bp_type_define_result_ds').create());
            }
            function hls_106_clear(){
                 $('fnd_bp_type_define_grid_ds').remove();
            }
            function hls_106_submit(){
                var result_ds = $('fnd_bp_type_define_result_ds');
                if (result_ds.validate()) {
                    result_ds.submit();
                }
            }
            function do_bp_type(record,name){
                 if(record.isNew){
                    return 'grid_textField_id';
                }
                return '';
            }
			function render_userDs_grid(value, record, name){
                var bptype = record.get('bp_type');
                 if(name=='assign_role')
                    {
                     return '<a href="javascript:winOpen_assign_role(\''+bptype+'\')">分配用户</a>';
                    }
                     return ''; 
            }
              
            function winOpen_assign_role(bptype){
                new Leaf.Window({
                    id:'sys_get_user_role_assign', 
                    url:$('pageLink_role_assign').getUrl(),
                    params:{
                    	bp_type:bptype
                    },
                    title:'分配用户', 
                    height:500,
                    width:830
                });
            }
		]]></script>
        <a:dataSets>
            <a:dataSet id="fnd_bp_type_define_query_ds" autoCreate="true">
                <a:fields>
                    <a:field name="bp_category" lovGridHeight="350" lovHeight="500" lovService="hls.HLS106.fnd_hls_bp_category_for_lov?display_flag=Y" lovWidth="500" prompt="HLS_BP_TYPE.BP_CATEGORY" title="HLS_BP_CATEGORY">
                        <a:mapping>
                            <a:map from="bp_category" to="bp_category"/>
                            <a:map from="bp_category_desc" to="bp_category_desc"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="bp_category_desc" prompt="HLS_BP_TYPE.BP_CATEGORY_DESC" readOnly="true"/>
                    <a:field name="bp_type" prompt="HLS_BP_TYPE.BP_TYPE"/>
                    <a:field name="description" prompt="HLS_BP_TYPE.DESCRIPTION"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="fnd_bp_type_define_result_ds" autoQuery="true" model="hls.HLS106.fnd_hls_bp_type" queryDataSet="fnd_bp_type_define_query_ds" selectable="true" submitUrl="${/request/@context_path}/autocrud/hls.HLS106.fnd_hls_bp_type/batch_update">
                <a:fields>
                    <a:field name="bp_category" lovGridHeight="350" lovHeight="500" lovService="hls.HLS106.fnd_hls_bp_category_for_lov" lovWidth="500" prompt="HLS_BP_TYPE.BP_CATEGORY" required="true" title="HLS_BP_CATEGORY">
                        <a:mapping>
                            <a:map from="bp_category" to="bp_category"/>
                            <a:map from="bp_category_desc" to="bp_category_desc"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="bp_category_desc" prompt="HLS_BP_TYPE.BP_CATEGORY_DESC"/>
                    <a:field name="bp_type" prompt="HLS_BP_TYPE.BP_TYPE" required="true"/>
                    <a:field name="description" prompt="HLS_BP_TYPE.DESCRIPTION" required="true"/>
                    <a:field name="auto_coding" checkedValue="Y" defaultValue="Y" uncheckedValue="N"/>
                    <a:field name="enabled_flag" checkedValue="Y" defaultValue="Y" uncheckedValue="N"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="hls_106_back" text="HLS.BACK"/>
                <a:gridButton click="hls_106_next" text="HLS.FORWARD"/>
                <a:gridButton click="hls_106_quit" text="HLS.EXIT"/>
                <a:gridButton click="hls_106_add" text="HLS.NEW"/>
                <a:gridButton click="hls_106_clear" text="HLS.CLEAR"/>
                <a:gridButton click="hls_106_submit" text="HLS.SAVE"/>
                <a:gridButton click="hls_106_query" text="HLS.QUERY"/>
                <a:gridButton click="hls_106_reset" text="HLS.RESET"/>
            </a:screenTopToolbar>
            <a:form column="4" title="HLS.QUERY_TITLE">
                <a:lov name="bp_category" bindTarget="fnd_bp_type_define_query_ds">
                    <a:events>
                        <a:event name="enterdown" handler="hls_106_query"/>
                    </a:events>
                </a:lov>
                <a:textField name="bp_category_desc" bindTarget="fnd_bp_type_define_query_ds">
                    <a:events>
                        <a:event name="enterdown" handler="hls_106_query"/>
                    </a:events>
                </a:textField>
                <a:textField name="bp_type" bindTarget="fnd_bp_type_define_query_ds">
                    <a:events>
                        <a:event name="enterdown" handler="hls_106_query"/>
                    </a:events>
                </a:textField>
                <a:textField name="description" bindTarget="fnd_bp_type_define_query_ds">
                    <a:events>
                        <a:event name="enterdown" handler="hls_106_query"/>
                    </a:events>
                </a:textField>
            </a:form>
            <a:grid id="fnd_bp_type_define_grid_ds" bindTarget="fnd_bp_type_define_result_ds" marginHeight="180" marginWidth="30" navBar="true">
                <a:columns>
                    <a:column name="bp_type" align="center" editorFunction="do_bp_type" prompt="HLS_BP_TYPE.BP_TYPE" sortable="true" width="200"/>
                    <a:column name="description" align="center" editor="grid_textField_id" prompt="HLS_BP_TYPE.DESCRIPTION" sortable="true" width="250"/>
                    <a:column name="bp_category" align="center" editor="grid_lov_id" prompt="HLS_BP_TYPE.BP_CATEGORY" sortable="true" width="200"/>
                    <a:column name="bp_category_desc" align="center" prompt="HLS_BP_TYPE.BP_CATEGORY_DESC" sortable="true" width="250"/>
                    <a:column name="auto_coding" align="center" editor="grid_checkBox_id" prompt="HLS_BP_TYPE.CODING_RULE" sortable="true"/>
                    <a:column name="enabled_flag" align="center" editor="grid_checkBox_id" prompt="HAP_ENABLED_FLAG" sortable="true"/>
					<a:column name="assign_role" align="center" prompt="分配用户" renderer="render_userDs_grid" sortable="true" width="70"/>
                </a:columns>
                <a:editors>
                    <a:textField id="grid_textField_id"/>
                    <a:lov id="grid_lov_id"/>
                    <a:checkBox id="grid_checkBox_id"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>
