<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: wangwei  
    $Date: 2015-5-21 下午1:37:08  
    $Revision: 1.0  
    $Purpose: 文件模板集定义 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:view>
        <a:link id="hls_doc_file_templet_set_ln_link" url="${/request/@context_path}/modules/hls/HLS812/hls_doc_file_templet_set_ln.lview"/>
        <script type="text/javascript"><![CDATA[
            function hls812_add() {
                var ds = $('hls_doc_file_temp_hd_ds');
                var record = ds.create(ds.currentIndex);
                $('hls_doc_file_temp_hd_ds_id').showEditorByRecord(record);
            
            }
            
            function hls812_delete() {
                var ds = $('hls_doc_file_temp_hd_ds');
                var records = ds.getSelected();
                if (records.length != 0) {
                    Leaf.showConfirm('${l:HLS.PROMPT}', '${l:HLS030.CONFIRM_DELETE}', function() {
                        ds.remove(records);
                    });
                }
            
            }
            
            function hls812_save() {
                var ds = $('hls_doc_file_temp_hd_ds');
                if (ds.validate()) {
                    ds.submit();
                }
            
            }
            
            
            function hls812_query() {
                $('hls_doc_file_temp_hd_ds').query();
            }
            
            
            function editor_check(record, name) {
                if (record.isNew) {
                    if (name == 'templet_set_code') {
                        return 'textFied_ed_up';
                    }
                }
                return '';
            }
            
            function assign_line_window(value, record, name) {
                if (!record.isNew) {
                      return '<a href="javascript:edit_line_assign(' + record.get('templet_set_id')+',\''+record.get('usage_code')+ '\')">编辑</a>';
                   } else {
                    return '';
                }
            }
            
              function edit_line_assign(templet_set_id,usage_code) {
                new Leaf.Window({
                    id: 'hls_doc_file_templet_set_ln_link_winid',
                    url: $('hls_doc_file_templet_set_ln_link').getUrl(),
                    params: {
                        templet_set_id: templet_set_id,
                        usage_code:usage_code,
                        winid: 'hls_doc_file_templet_set_ln_link_winid'
                    },
                    title: '文件模板集定义',
                    height: 550,
                    width: 800
                });
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="enable_flag_ds" lookupCode="ENABLED_STATUS"/>
            <a:dataSet id="hls_doc_file_usage_ds" lookupCode="HLS_DOC_FILE_USAGE"/>
            <a:dataSet id="for_query_ds" autoCreate="true">
                <a:fields>
                    <a:field name="templet_set_code"/>
                    <a:field name="templet_set_name"/>
                    <a:field name="usage_code"/>
                    <a:field name="usage_code_des" displayField="code_value_name" options="hls_doc_file_usage_ds" returnField="usage_code" valueField="code_value"/>
                    <a:field name="enabled_flag"/>
                    <a:field name="enabled_flag_des" displayField="code_value_name" options="enable_flag_ds" returnField="enabled_flag" valueField="code_value"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="hls_doc_file_temp_hd_ds" autoQuery="true" model="hls.HLS812.hls_doc_file_templet_set_hd" queryDataSet="for_query_ds" selectable="true">
                <a:fields>
                    <a:field name="templet_set_code" required="true"/>
                    <a:field name="templet_set_name" required="true"/>
                    <a:field name="usage_code" required="true"/>
                    <a:field name="usage_code_des" displayField="code_value_name" options="hls_doc_file_usage_ds" required="true" returnField="usage_code" valueField="code_value"/>
                    <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="hls812_query" text="HLS.QUERY"/>
                <a:gridButton click="hls812_add" text="新增"/>
                <a:gridButton click="hls812_save" text="HLS.SAVE"/>
            </a:screenTopToolbar>
            <a:form column="4" marginWidth="200" title="查询条件">
                <a:textField name="templet_set_code" bindTarget="for_query_ds" prompt="模板集代码"/>
                <a:textField name="templet_set_name" bindTarget="for_query_ds" prompt="模板集名称"/>
                <a:comboBox name="usage_code_des" bindTarget="for_query_ds" prompt="模板用途"/>
                <a:comboBox name="enabled_flag_des" bindTarget="for_query_ds" prompt="启用"/>
            </a:form>
            <a:grid id="hls_doc_file_temp_hd_ds_id" bindTarget="hls_doc_file_temp_hd_ds" marginHeight="200" marginWidth="200" navBar="true">
                <a:columns>
                    <a:column name="templet_set_code" editorFunction="editor_check" prompt="模板集代码" width="150"/>
                    <a:column name="templet_set_name" editor="textFied_ed" prompt="模板集名称" width="150"/>
                    <a:column name="usage_code_des" editor="combobox_ed" prompt="模板集用途" width="100"/>
                    <a:column name="note" editor="textArea_ed" prompt="说明" width="250"/>
                    <a:column name="assin_line" align="center" prompt="编辑" renderer="assign_line_window" width="100"/>
                    <a:column name="enabled_flag" editor="checkbox_ed" prompt="启用" width="50"/>
                </a:columns>
                <a:editors>
                    <a:textField id="textFied_ed"/>
                    <a:textField id="textFied_ed_up" typeCase="upper"/>
                    <a:comboBox id="combobox_ed"/>
                    <a:checkBox id="checkbox_ed"/>
                    <a:textArea id="textArea_ed" height="60"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>
