<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: niujiaqing1265 $
    $Date: 2010/11/16 07:12:44 $
    $Revision: 1.1 $
    $Purpose: 功能分配页面
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure><![CDATA[
    ]]></a:init-procedure>
    <a:view>
        <script type="text/javascript"><![CDATA[
        
            function closeAssignPage(){
                $('sys_function_service_assign_window').close();
            }
            
            function serviceLovFunction(record){
                return record.isNew?'sys_function_service_grid_lv':'';
            }
            
            
            function saveAssignPage(){
                var records = $('sys_function_service').getAll();
                for(var i = 0;i<records.length;i++){
                    var record = records[i];
                    if(record.dirty){
                        record.set('function_id', '${/parameter/@function_id}');
                    }
                }
                $('sys_function_service').submit();
            }
            
            function sys_8010_child1_grid_add(){
                $('sys_function_service_grid').showEditorByRecord($('sys_function_service').create());
            }
            function sys_8010_child1_grid_clear(){
                $('sys_function_service_grid').clear();
            }
            function sys_8010_child1_grid_remove(){
                $('sys_function_service_grid').remove();
            }
            function sys_8010_child1_grid_submit() {
                var result_ds = $('sys_function_service');
                if (result_ds.validate()) {
                    result_ds.submit();
                }
            }
        
        ]]></script>
        <a:dataSets>
            <a:dataSet id="sys_function" loadData="true" model="sys.SYS8010.sys_function">
                <a:fields>
                    <a:field name="function_code" readOnly="true"/>
                    <a:field name="function_name" readOnly="true"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="sys_function_service" autoCount="false" autoQuery="true" fetchAll="true" model="sys.SYS8010.sys_function_service" queryDataSet="sys_function" selectable="true">
                <a:fields>
                    <a:field name="service_name" lovGridHeight="330" lovHeight="460" lovService="sys.sys_service" lovWidth="450" required="true" title="PAGE_SELECT">
                        <a:mapping>
                            <a:map from="service_id" to="service_id"/>
                            <a:map from="service_name" to="service_name"/>
                            <a:map from="title" to="title"/>
                        </a:mapping>
                    </a:field>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:gridButton click="closeAssignPage" text="HLS.CLOSE"/>
                <a:gridButton click="sys_8010_child1_grid_add" text="HLS.NEW"/>
                <a:gridButton click="sys_8010_child1_grid_remove" text="HLS.REMOVE"/>
                <a:gridButton click="sys_8010_child1_grid_clear" text="HLS.CLEAR"/>
                <a:gridButton click="saveAssignPage" text="HLS.SAVE"/>
            </a:screenTopToolbar>
            <a:form column="2" title=" ">
                <a:textField name="function_code" bindTarget="sys_function"/>
                <a:textField name="function_name" bindTarget="sys_function"/>
            </a:form>
            <a:grid id="sys_function_service_grid" bindTarget="sys_function_service" height="300" width="650">
                <a:columns>
                    <a:column name="service_name" editorFunction="serviceLovFunction" width="350"/>
                    <a:column name="title" width="250"/>
                </a:columns>
                <a:editors>
                    <a:lov id="sys_function_service_grid_lv"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>