<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: LR
    $Date: 2013-8-21 上午11:22:03
    $Revision: 1.0
    $Purpose:
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true">
    <a:init-procedure><![CDATA[
    ]]></a:init-procedure>
    <a:view>
        <a:link id="hls220_tplt_group_define_link" url="${/request/@context_path}/modules/hls/HLS220/prj_cdd_item_tplt_group_define.lview"/>
        <script type="text/javascript"><![CDATA[
            function sys201_update_condition_table_back() {
                $('hls220_prj_cdd_item_templet_window').close();
            }

            function sys201_update_condition_table_save() {
                $('sys201_update_condition_table_ds').submit();
            }

            function sys201_condition_table_field_ds_update(ds, record, name, value, oldvalue) {
                if (name == 'line_field') {
                    if (value == 'N') {
                        record.set('show_description', 'N');
                    }
                }
            }

            function sys201_condition_table_field_grid_editorFunction(record, name) {
                if (record.get('line_field') == 'Y') {
                    return 'sys201_condition_table_field_grid_ck';
                }
                return '';
            }

            function hls220_tplt_group_define(){
                var templet_head_id='${/parameter/@templet_head_id}';
                if(templet_head_id){
                    new Leaf.Window({
                        id:'hls220_tplt_group_define_win',
                        url:$('hls220_tplt_group_define_link').getUrl(),
                        params:{
                            winid:'hls220_tplt_group_define_win',
                            templet_head_id:templet_head_id
                        },
                        fullScreen:true
                    });
                }
            }

            function con202_clause_templet_functionTreeGrid_editor(record, name) {
               // if (record.isNew) {
                    return 'con202_clause_templet_grid_cb';
               // }

            }
        ]]></script>
        <style><![CDATA[
        	td[dataindex=enabled_flag],td[dataindex=chance_tab_group],td[dataindex=project_tab_group],td[dataindex=contract_tab_group]{
        	    border-right-color:#A9A9A9
        	}
        	td[dataindex=sign_tab_group],td[dataindex=incept_tab_group],td[dataindex=lender_tab_group]{
        	    border-right-color:#A9A9A9
        	}
        ]]></style>
        <a:dataSets>
            <a:dataSet id="yes_no_ds" lookupCode="YES_NO"/>
            <a:dataSet id="archive_type_code" lookupCode="ARCHIVE_TYPE"/>
            <a:dataSet id="con202_clause_templet_tmplet_class_ds" lookupCode="CON202_TEMPLET_CLASS"/>
            <a:dataSet id="hls220_templet_head_ds">
                <a:fields>
                    <a:field name="templet_code" readOnly="true"/>
                    <a:field name="templet_name" readOnly="true"/>
                    <a:field name="templet_head_id" defaultValue="${/parameter/@templet_head_id}"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="hls220_templet_line_ds" autoPageSize="true" autoQuery="true" model="hls.HLS220.prj_cdd_item_templet" queryDataSet="hls220_templet_head_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="is_archive"/>
                    <a:field name="archive_type"/>
                    <a:field name="is_archive_desc" displayField="code_value_name" options="yes_no_ds"  returnField="is_archive" valueField="code_value"/>
                    <a:field name="archive_type_desc" displayField="code_value_name" options="archive_type_code"  returnField="archive_type" valueField="code_value"/>
                    <a:field name="templet_head_id" defaultValue="${/parameter/@templet_head_id}"/>
                    <a:field name="description" prompt="HLS220.DESCRIPTION" required="true"/>
                    <a:field name="enabled_flag" checkedValue="Y" defaultValue="Y" prompt="HLS.ENABLED_FLAG" uncheckedValue="N"/>
                    <a:field name="chance_required_flag" checkedValue="Y" defaultValue="N" prompt="HLS220.CHANCE_REQUIRED_FLAG" uncheckedValue="N"/>
                    <a:field name="chance_display_flag" checkedValue="Y" defaultValue="N" prompt="HLS220.CHANCE_DISPLAY_FLAG" uncheckedValue="N"/>
                    <a:field name="project_required_flag" checkedValue="Y" defaultValue="N" prompt="HLS220.PROJECT_REQUIRED_FLAG" uncheckedValue="N"/>
                    <a:field name="project_display_flag" checkedValue="Y" defaultValue="N" prompt="HLS220.PROJECT_DISPLAY_FLAG" uncheckedValue="N"/>
                    <a:field name="contract_required_flag" checkedValue="Y" defaultValue="N" prompt="HLS220.CONTRACT_REQUIRED_FLAG" uncheckedValue="N"/>
                    <a:field name="contract_display_flag" checkedValue="Y" defaultValue="N" prompt="HLS220.CONTRACT_DISPLAY_FLAG" uncheckedValue="N"/>
                    <a:field name="sign_required_flag" checkedValue="Y" defaultValue="N" prompt="HLS220.SIGN_REQUIRED_FLAG" uncheckedValue="N"/>
                    <a:field name="sign_display_flag" checkedValue="Y" defaultValue="N" prompt="HLS220.SIGN_DISPLAY_FLAG" uncheckedValue="N"/>
                    <a:field name="incept_required_flag" checkedValue="Y" defaultValue="N" prompt="HLS220.INCEPT_REQUIRED_FLAG" uncheckedValue="N"/>
                    <a:field name="incept_display_flag" checkedValue="Y" defaultValue="N" prompt="HLS220.INCEPT_DISPLAY_FLAG" uncheckedValue="N"/>
                    <a:field name="lender_required_flag" checkedValue="Y" defaultValue="N" prompt="HLS220.LENDER_REQUIRED_FLAG" uncheckedValue="N"/>
                    <a:field name="lender_display_flag" checkedValue="Y" defaultValue="N" prompt="HLS220.LENDER_DISPLAY_FLAG" uncheckedValue="N"/>
                    <a:field name="chance_tab_group" prompt="HLS220.TAB_GROUP"/>
                    <a:field name="project_tab_group" prompt="HLS220.TAB_GROUP"/>
                    <a:field name="sign_tab_group" prompt="HLS220.TAB_GROUP"/>
                    <a:field name="contract_tab_group" prompt="HLS220.TAB_GROUP"/>
                    <a:field name="incept_tab_group" prompt="HLS220.TAB_GROUP"/>
                    <a:field name="lender_tab_group" prompt="HLS220.TAB_GROUP"/>
                    <a:field name="templet_class"/>
                    <a:field name="templet_class_name" displayField="code_value_name" options="con202_clause_templet_tmplet_class_ds" returnField="templet_class" valueField="code_value"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:gridButton click="sys201_update_condition_table_back" text="HLS.CLOSE" width="80"/>
                <a:gridButton bind="hls220_templet_line_grid" type="add" width="80"/>
                <a:gridButton bind="hls220_templet_line_grid" type="delete" width="80"/>
                <a:gridButton bind="hls220_templet_line_grid" type="save" width="80"/>
                <a:gridButton click="hls220_tplt_group_define" text="分组定义" 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_grid" bindTarget="hls220_templet_line_ds" marginHeight="160" marginWidth="35" navBar="true">
                <a:columns>
                    <a:column name="cdd_class" editor="hls220_templet_line_grid_tf" prompt="文档分类" width="100"/>
                    <a:column name="cdd_item" editor="hls220_templet_line_grid_code_tf" width="120"/>
                    <a:column name="description" editor="hls220_templet_line_grid_tf" width="150"/>
                    <!-- <a:column name="templet_class_name" editorFunction="con202_clause_templet_functionTreeGrid_editor" prompt="模板分类" width="120"/>-->
                    <a:column name="app_code" editor="hls220_templet_line_grid_tf" prompt="APP编码" width="350"/>
                    <a:column name="order_seq" editor="hls220_templet_line_grid_nf" prompt="HLS.ORDER_SEQ" width="60"/>
                    <!-- <a:column name="required_flag" editor="hls220_templet_line_grid_ck" prompt="关键字段" width="60"/> -->
                    <!-- <a:column name="chance_required_flag" editor="hls220_templet_line_grid_ck" width="60"/> -->
                    <!-- <a:column name="chance_display_flag" editor="hls220_templet_line_grid_ck" width="60"/> -->
                    <!-- <a:column name="chance_tab_group" editor="hls220_templet_line_grid_tf" width="40"/> -->
                    <!-- <a:column name="project_required_flag" editor="hls220_templet_line_grid_ck" width="60"/> -->
                    <!-- <a:column name="project_display_flag" editor="hls220_templet_line_grid_ck" width="60"/> -->
                    <!-- <a:column name="project_tab_group" editor="hls220_templet_line_grid_tf" width="40"/> -->
                    <!-- <a:column name="contract_required_flag" editor="hls220_templet_line_grid_ck" width="60"/>
                    <a:column name="contract_display_flag" editor="hls220_templet_line_grid_ck" width="60"/> -->
                    <!-- <a:column name="sign_required_flag" editor="hls220_templet_line_grid_ck" width="60"/> -->
                    <!-- <a:column name="sign_display_flag" editor="hls220_templet_line_grid_ck" width="60"/> -->
                    <!-- <a:column name="sign_tab_group" editor="hls220_templet_line_grid_tf" width="40"/> -->
                    <!-- <a:column name="incept_required_flag" editor="hls220_templet_line_grid_ck" width="60"/> -->
                    <!-- <a:column name="incept_display_flag" editor="hls220_templet_line_grid_ck" width="60"/> -->
                    <!-- <a:column name="incept_tab_group" editor="hls220_templet_line_grid_tf" width="40"/> -->
                    <a:column name="lender_required_flag" editor="hls220_templet_line_grid_ck" width="60"/>
                    <a:column name="enabled_flag" editor="hls220_templet_line_grid_ck" width="40"/>
                    <a:column name="is_archive_desc" editor="con202_clause_templet_grid_cb" prompt="电子档案传输对象" width="120"/>
                    <a:column name="archive_type_desc" editor="con202_clause_templet_grid_cb" prompt="附件类型" width="120"/>
                    <!-- <a:column name="lender_display_flag" editor="hls220_templet_line_grid_ck" width="60"/> -->
                    <!-- <a:column name="lender_tab_group" editor="hls220_templet_line_grid_tf" width="40"/> -->
                </a:columns>
                <a:editors>
                    <a:checkBox id="hls220_templet_line_grid_ck"/>
                    <a:numberField id="hls220_templet_line_grid_nf" allowDecimals="false" allowNegative="false"/>
                    <a:textField id="hls220_templet_line_grid_tf"/>
                    <a:textField id="hls220_templet_line_grid_code_tf" typeCase="upper"/>
                    <a:comboBox id="con202_clause_templet_grid_cb"/>
                </a:editors>
            </a:grid>
            <script type="text/javascript"><![CDATA[
                Leaf.onReady(function() {
                    var record = $('hls220_templet_head_ds').getAt(0);
                    var head_record = $('hls220_templet_result_ds').findById('${/parameter/@record_id}');
                    record.set('templet_code', head_record.get('templet_code'));
                    record.set('templet_name', head_record.get('templet_name'));
                });
            ]]></script>
        </a:screenBody>
    </a:view>
</a:screen>