sys_condition_code_lov.lview 3.76 KB
Newer Older
Spencer Chang's avatar
Spencer Chang committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: peter soong $
    $Date: 2014-07-10 11:08:02 $
    $Revision: 1.0 $
    $Purpose: (动态列查询所用的lov)
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true">
    <a:init-procedure>
        <a:model-query fetchAll="true" model="sys.SYS210.get_lov_sql" rootPath="conditions_sql"/>
    </a:init-procedure>
    <a:view package="leaf.ui.std" template="default">
        <div/>
        <script type="text/javascript"><![CDATA[
            function _query() {
                $('sys_value_lov_result_ds').query();
            }
            
            function _onRowselect(grid, record, row) {
                $('${/parameter/@lovid}').commit(record);
            }
            
            function _onKeyDown(grid, e) {
                if (e.getKey() == 13) {
                    var record = $('sys_value_lov_result_ds').getCurrentRecord();
                    $('${/parameter/@lovid}').commit(record);
                }
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="sys_value_lov_query_ds" autoCreate="true" model="sys.SYS210.sys_mapping_conditions_sql_lov_query">
                <a:fields>
                    <a:field name="condition_table" defaultValue="${/parameter/@condition_table}"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="sys_value_lov_result_ds" autoQuery="true" model="sys.SYS210.sys_mapping_conditions_sql_lov_query" queryDataSet="sys_value_lov_query_ds"/>
        </a:dataSets>
        <a:screenBody>
            <a:form column="2" title="HAP_QUERY_TITLE">
                <a:textField name="code" bindTarget="sys_value_lov_query_ds" prompt="代码">
                    <a:events>
                        <a:event name="enterdown" handler="_query"/>
                    </a:events>
                </a:textField>
                <a:textField name="description" bindTarget="sys_value_lov_query_ds" prompt="GLD_SET_OF_BOOKS.PERIOD_SET_NAME">
                    <a:events>
                        <a:event name="enterdown" handler="_query"/>
                    </a:events>
                </a:textField>
            </a:form>
            <a:hBox>
                <a:button click="_query" text="HAP_QUERY"/>
            </a:hBox>
            <a:grid bindTarget="sys_value_lov_result_ds" height="300" navBar="true" width="480">
                <a:columns>
                    <!-- <a:column name="id" prompt="ID" width="50"/> -->
                    <a:column name="code" prompt="代码" width="150"/>
                    <a:column name="description" prompt="GLD_SET_OF_BOOKS.PERIOD_SET_NAME" width="280"/>
                </a:columns>
                <a:events>
                    <a:event name="dblclick" handler="_onRowselect"/>
                    <a:event name="keydown" handler="_onKeyDown"/>
                </a:events>
            </a:grid>
        </a:screenBody>
        <script type="text/javascript"><![CDATA[
            function init(){
                var queryRecord = $('sys_value_lov_query_ds').getCurrentRecord();
                var lovStatement = "${/model/conditions_sql/record/@lov_statement}";
                queryRecord.set('lov_statement',lovStatement);
                var parent_record = $('lease_times_Ds').getCurrentRecord();
                if (parent_record) {
                    for (var rec_name in parent_record.data) {
                        var rec_value = parent_record.get(rec_name);
                        if (!Ext.isEmpty(rec_value)) {
                            queryRecord.set(rec_name,rec_value);
                        }
                    }
                } 
                $('sys_value_lov_result_ds').query(); 
            }
            init();
            
           
        ]]></script>
    </a:view>
</a:screen>