<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gaoyang  
    $Date: 2014-7-8 下午01:31:34  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true">
    <a:init-procedure/>
    <a:view>
        <a:link id="tab_copy_save_id" model="hls.HLS030N.hls_doc_layout_tab_copy" modelaction="update"/>
        <script type="text/javascript"><![CDATA[
            function set_layout_code(ds, record, name, value, oldvalue){
                if(name=='from_layout_code'){
                    tab_code_lov=record.getField('from_tab_code');
                    layout_code=value;
                    record.set('from_tab_code','');
                    record.set('to_tab_code','');
                    record.set('to_tab_code_desc','');
                    record.set('from_tab_code_desc');
                    tab_code_lov.setLovPara('layout_code',layout_code);
                    tab_code_lov.setLovPara('enable_flag','Y');
                }
            }
            
            function copyscreen_close(){
                $('hls_doc_layout_tab_copy_id').close();
            }
            
            function copy_tab(){
                if($('tab_copy_ds').validate()){
                    record=$('tab_copy_ds').getAt(0);
                    record.set('to_layout_code','${/parameter/@layout_code}');
                var saveData = [];
                saveData.push(record.data);
                Leaf.request({
                    url: $('tab_copy_save_id').getUrl(),
                    para: {
                        from_layout_code:record.get('from_layout_code'),
                        from_tab_code:record.get('from_tab_code'),
                        to_layout_code:'${/parameter/@layout_code}',
                        to_tab_code:record.get('to_tab_code'),
                        to_tab_code_desc:record.get('to_tab_code_desc'),
                        tab_only_flag:record.get('tab_only_flag'),
                        parent_tab_code:record.get('parent_tab_code')
                    },
                    success: function(res) {
                        Leaf.SideBar.show({
                            msg: '${l:HLS.SUBMIT_SUCCESS}',
                            duration: 2000
                        });
                        $('hls_doc_layout_tab_copy_id').close();
                        $('${/parameter/@tab_ds_id}').query();
                    },
                    scope: this
                });
                }
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="tab_copy_ds" autoCreate="true">
                <a:fields>
                    <a:field name="from_layout_code" autoComplete="true" lovGridHeight="310" lovHeight="470" lovLabelWidth="100" lovService="hls.HLS030N.hls_doc_layout_for_lov_n" lovWidth="550" required="true" title="页面布局代码">
                        <a:mapping>
                            <a:map from="layout_code" to="from_layout_code"/>
                            <a:map from="description" to="layout_code_desc"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="to_tab_code" required="true"/>
                    <a:field name="to_tab_code_desc" required="true"/>
                    <a:field name="from_tab_code_desc" readOnly="true"/>
                    <a:field name="from_tab_code" autoComplete="true" lovGridHeight="300" lovHeight="450" lovService="hls.HLS030.hls_doc_layout_tab_lov" lovWidth="500" required="true" title="HLS030.HLS_DOC_LAYOUT_TAB.TAB_CODE">
                        <a:mapping>
                            <a:map from="tab_code" to="from_tab_code"/>
                            <a:map from="tab_code" to="to_tab_code"/>
                            <a:map from="tab_desc" to="to_tab_code_desc"/>
                            <a:map from="tab_desc" to="from_tab_code_desc"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="tab_only_flag" checkedValue="Y" defaultValue="N" uncheckedValue="N"/>
                </a:fields>
                <a:events>
                    <a:event name="update" handler="set_layout_code"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:gridButton click="copyscreen_close" text="HLS.CLOSE"/>
                <a:gridButton click="copy_tab" text="HLS.CONFIRM"/>
            </a:screenTopToolbar>
            <a:form>
                <a:hBox labelWidth="90">
                    <a:lov name="from_layout_code" bindTarget="tab_copy_ds" prompt="源布局代码"/>
                    <a:lov name="from_tab_code" bindTarget="tab_copy_ds" prompt="源组件"/>
                    <a:textField name="from_tab_code_desc" bindTarget="tab_copy_ds" prompt="源组件描述"/>
                </a:hBox>
                <a:hBox labelWidth="90">
                    <a:textField name="to_tab_code" bindTarget="tab_copy_ds" prompt="目标组件"/>
                    <a:textField name="to_tab_code_desc" bindTarget="tab_copy_ds" prompt="目标组件描述"/>
                    <a:textField name="parent_tab_code" bindTarget="tab_copy_ds" prompt="目标上级组件"/>
                </a:hBox>
                <a:hBox labelWidth="90">
                    <a:checkBox name="tab_only_flag" bindTarget="tab_copy_ds" prompt="仅复制组件"/>
                </a:hBox>
            </a:form>
        </a:screenBody>
    </a:view>
</a:screen>
