<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zhangyu  
    $Date: 2015-12-28 下午13:04:55  
    $Revision: 1.0  
    $Purpose: 资金平衡计划项目分类（三级）
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true">
    <a:init-procedure/>
    <a:view>
        <a:link id="sdic3010_third_class_link" url="${/request/@context_path}/modules/sdic/SDIC1010/sdic_fin_plan_item_template.lview"/>
        <a:link id="sdic3010_third_class_aut_detail_link" url="${/request/@context_path}/modules/sdic/sdic_fin_plan_class_aut.lview"/>
        <a:link id="sdic3010_forth_class_edit_link" url="${/request/@context_path}/modules/sdic/SDIC3010/sdic_fin_plan_forth_class_define.lview"/>
        <script type="text/javascript"><![CDATA[
        	function sdic3010_third_quit(){
        	    $('${/parameter/@win_id}').close();
        	}
        	
        	function sdic3010_third_rpt_tmp(){
        	    var records=$('sdic3010_third_class_result_ds').getSelected();
        	    var record=records[0];
        	    var item_code=record.get('third_class_code');
        	    var item_description=record.get('third_class_name');
        	    new Leaf.Window({
                    id: 'sdic3010_third_class_winid',
                    url: $('sdic3010_third_class_link').getUrl(),
                    params: {
                        item_code: item_code,
                        item_description: item_description,
                        win_id: 'sdic3010_third_class_winid'
                    },
                    title: '报表模板项目维护',
                    fullScreen: true
                });
        	}
        	
        	function third_class_render(value,record,name){
        	    var third_class_id = record.get('third_class_id');
        	    if (record.isNew) {
                    return '';
                } else {
                    return '<a href="javascript:forth_class_edit(' + third_class_id + ');">' + '编辑四级分类' + '</a>';
                }
        	}
        	
        	function forth_class_edit(third_class_id){
        	    new Leaf.Window({
                    id: 'sdic3010_forth_class_edit_winid',
                    url: $('sdic3010_forth_class_edit_link').getUrl(),
                    params: {
                        third_class_id: third_class_id,
                        win_id: 'sdic3010_forth_class_edit_winid'
                    },
                    title: '四级分类维护',
                    fullScreen: true
                });
        	}
        	
        	function third_aut_detail_render(value,record,name){
        	    var third_class_id = record.get('third_class_id');
        	    if (record.isNew) {
                    return '';
                } else {
                    return '<a href="javascript:third_class_aut_detail(' + third_class_id + ');">' + '分配用户权限' + '</a>';
                }
        	}
        	
        	function third_class_aut_detail(third_class_id){
        	    var records=$('sdic3010_third_class_result_ds').getSelected();
        	    var record=records[0];
        	    var item_code=record.get('third_class_code');
        	    var item_description=record.get('third_class_name');
        	    new Leaf.Window({
                    id: 'sdic3010_third_class_aut_detail_winid',
                    url: $('sdic3010_third_class_aut_detail_link').getUrl(),
                    params: {
                        class_id: third_class_id,
                        class_type:'THIRD',
                        item_code: item_code,
                        item_description: item_description,
                        win_id: 'sdic3010_third_class_aut_detail_winid'
                    },
                    title: '用户权限分配',
                    hight:500,
                    width:900
                });
        	}
        	
        	function thirdsubmitsuccess(ds,res){
        	    ds.query();
        	}
		]]></script>
        <a:dataSets>
            <a:dataSet id="sdic3010_third_class_query_ds" autoCreate="true">
                <a:fields>
                    <a:field name="second_class_id" defaultValue="${/parameter/@second_class_id}"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="sdic3010_third_class_result_ds" autoPageSize="true" autoQuery="true" model="sdic.SDIC3010.sdic_fin_plan_third_class" queryDataSet="sdic3010_third_class_query_ds" selectable="true" selectionModel="single">
                <a:fields>
                    <a:field name="second_class_id" defaultValue="${/parameter/@second_class_id}"/>
                    <a:field name="enabled_flag" checkedValue="Y" defaultValue="Y" uncheckedValue="N"/>
                    <a:field name="third_class_code" required="true"/>
                    <a:field name="third_class_name" required="true"/>
                </a:fields>
                <a:events>
                    <a:event name="submitsuccess" handler="thirdsubmitsuccess"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="sdic3010_third_quit" text="退出"/>
                <a:gridButton click="sdic3010_third_rpt_tmp" text="分配至报表模板"/>
            </a:screenTopToolbar>
            <a:form/>
            <a:grid id="sdic3010_third_class_grid_id" bindTarget="sdic3010_third_class_result_ds" marginHeight="200" marginWidth="100" navBar="true">
                <a:toolBar>
                    <a:button type="add"/>
                    <a:button type="save"/>
                    <a:button type="delete"/>
                </a:toolBar>
                <a:columns>
                    <a:column name="third_class_code" align="center" editor="third_editor_tf" prompt="三级分类代码" width="100"/>
                    <a:column name="third_class_name" editor="third_editor_tf" prompt="三级分类名称" width="350"/>
                    <a:column name="order_seq" align="center" editor="third_editor_tf" prompt="序号" width="80"/>
                    <a:column name="enabled_flag" editor="third_editor_cb" prompt="启用" width="80"/>
                    <a:column name="aut_detail" align="center" prompt="分配用户权限" renderer="third_aut_detail_render" width="120"/>
                    <a:column name="third_class_id" align="center" prompt="编辑三级分类" renderer="third_class_render" width="120"/>
                </a:columns>
                <a:editors>
                    <a:textField id="third_editor_tf"/>
                    <a:checkBox id="third_editor_cb"/>
                </a:editors>
                <a:editors/>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>
