<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zhangxing5129  
    $Date: 2014-6-10 下午04:42:10  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:view>
        <script type="text/javascript"><![CDATA[
            function hls220_multi_item_back() {
                $('${/parameter/@winid}').close();
            }
            
            function hls220_multi_item_confirm() {
                var tab_group_ds = $('prj_cdd_item_tplt_tab_group_ds');
                var selected_record = $('hls220_templet_line_multi_ds').getSelected();
                if (!Ext.isEmpty(selected_record.length)) {
                    for (var i = 0;i < selected_record.length;i++) {
                        var new_record = new Leaf.Record({
                            'cdd_item': selected_record[i].get('cdd_item'),
                            'cdd_item_desc': selected_record[i].get('description'),
                            'templet_header_id':'${/parameter/@templet_head_id}',
                            'enabled_flag': selected_record[i].get('enabled_flag')
                        });
                        tab_group_ds.add(new_record);
                    }
                    Leaf.SideBar.show({
                        msg: '操作成功',
                        duration: 3000
                    });
                    $('${/parameter/@winid}').close();
            
                } else {
                    Leaf.showMessage('${l:HLS.PROMPT}', '请至少选择一条记录！');
                }
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="hls220_templet_head_multi_ds" autoCreate="true">
                <a:fields>
                    <a:field name="templet_head_id" defaultValue="${/parameter/@templet_head_id}"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="hls220_templet_line_multi_ds" autoQuery="true" fetchAll="true" model="hls.HLS220.prj_cdd_item_templet_for_lov" queryDataSet="hls220_templet_head_multi_ds" selectable="true">
                <a:fields>
                    <a:field name="cdd_class"/>
                    <a:field name="required_flag" checkedValue="Y" defaultValue="Y" uncheckedValue="N"/>
                    <a:field name="cdd_item" prompt="HLS220.CDD_ITEM" required="true"/>
                    <a:field name="order_seq"/>
                    <a:field name="description" prompt="HLS220.DESCRIPTION" required="true"/>
                    <a:field name="enabled_flag" checkedValue="Y" defaultValue="Y" prompt="HLS.ENABLED_FLAG" readOnly="true" uncheckedValue="N"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:gridButton click="hls220_multi_item_back" text="HLS.CLOSE" width="80"/>
                <a:gridButton click="hls220_multi_item_confirm" text="HLS.CONFIRM" width="80"/>
            </a:screenTopToolbar>
            <a:hBox labelSeparator=" " labelWidth="100">
                <a:textField name="templet_code" bindTarget="hls220_templet_head_ds" prompt="HLS.TEMPLET_CODE"/>
                <a:textField name="templet_name" bindTarget="hls220_templet_head_ds" prompt="HLS.TEMPLET_NAME"/>
            </a:hBox>
            <a:grid id="hls220_templet_line_multi_grid" bindTarget="hls220_templet_line_multi_ds" height="400" navBar="true" width="600">
                <a:columns>
                    <a:column name="cdd_class" prompt="文档分类" width="100"/>
                    <a:column name="cdd_item" width="150"/>
                    <a:column name="description" width="150"/>
                    <a:column name="enabled_flag" editor="multi_item_cb"/>
                </a:columns>
                <a:editors>
                    <a:checkBox id="multi_item_cb"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>
