<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: Peter Soong  
    $Date: 2014-07-08 17:20:42 
    $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="sys210_update_condition_table_field_link" url="${/request/@context_path}/modules/sys/SYS210/sys_dimensions_detail.lview"/>
        <script type="text/javascript"><![CDATA[
            function sys210_update() {
                var ds = $('sys210_update_condition_table_entry_ds');
                if (ds.validate()) {
                    var record=ds.getAt(0);
                    var condition_table = record.get('condition_table'),
                    condition_usage_type = record.get('condition_usage_type'),
                    structure=record.get('structure');
                    /* var url = $('sys210_update_condition_table_field_link').getUrl() + '?condition_table=' + condition_table + '&condition_usage_type=' + condition_usage_type;
                    Leaf.go(url); */
                    new Leaf.Window({
	                    id: 'sys_dimensions_detail_id',
	                    url: $('sys210_update_condition_table_field_link').getUrl(),
	                    params: {
	                        condition_table: condition_table,
	                        condition_usage_type:condition_usage_type
	                    },
	                    title: '维护条件值',
	                    fullScreen:true
	                });
                }
            }
            
            
            function sys210_update_condition_table_update(ds, record, name, value, oldvalue) {
                if (name == 'condition_usage_type') {
                    if (!Leaf.isEmpty(value)) {
                        record.getField('condition_table').setLovService('sys.SYS200.sys_condition_table');
                        record.getField('condition_table').setLovPara('condition_usage_type', value);
                    } else {
                        record.getField('condition_table').setLovService('');
                    }
                    record.set('condition_table', '');
                    record.set('description', '');
                }
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="sys210_update_condition_table_entry_ds" autoCreate="true" model="sys.SYS200.sys_condition_table">
                <a:fields>
                    <a:field name="condition_usage_type_desc" readOnly="true" required="true"/>
                    <a:field name="condition_usage_type" autoComplete="true" autoCompleteField="condition_usage_type" lovGridHeight="320" lovHeight="460" lovService="sys.SYS200.sys_condition_usage_type" lovWidth="550" required="true" title="用途类别选择">
                        <a:mapping>
                            <a:map from="condition_usage_type" to="condition_usage_type"/>
                            <a:map from="description" to="condition_usage_type_desc"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="condition_table" autoComplete="true" autoCompleteField="condition_table" lovGridHeight="320" lovHeight="460" lovWidth="550" required="true" title="条件表选择">
                        <a:mapping>
                            <a:map from="condition_table" to="condition_table"/>
                            <a:map from="description" to="description"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="description" readOnly="true"/>
                </a:fields>
                <a:events>
                    <a:event name="update" handler="sys210_update_condition_table_update"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:gridButton click="sys210_update" text="CONFIRM" width="80"/>
            </a:screenTopToolbar>
            <a:form title="SYS200.UPDATE_CONDITION_TABLE">
                <a:hBox labelSeparator=" " labelWidth="100">
                    <a:lov name="condition_usage_type" bindTarget="sys210_update_condition_table_entry_ds" prompt="SYS200.SYS_CONDITION_USAGE_TYPE.CONDITION_USAGE_TYPE"/>
                    <a:textField name="condition_usage_type_desc" bindTarget="sys210_update_condition_table_entry_ds" prompt="SYS200.SYS_CONDITION_USAGE_TYPE.DESCRIPTION"/>
                </a:hBox>
                <a:hBox labelSeparator=" " labelWidth="100">
                    <a:lov name="condition_table" bindTarget="sys210_update_condition_table_entry_ds" prompt="SYS200.SYS_CONDITION_TABLE.CONDITION_TABLE"/>
                    <a:textField name="description" bindTarget="sys210_update_condition_table_entry_ds" prompt="SYS200.SYS_CONDITION_TABLE.DESCRIPTION">
                        <a:events>
                            <a:event name="enterdown" handler="sys210_update"/>
                        </a:events>
                    </a:textField>
                </a:hBox>
            </a:form>
        </a:screenBody>
    </a:view>
</a:screen>