<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: wangwei  
    $Date: 2016-12-15 上午9:58:26  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure><![CDATA[
    ]]></a:init-procedure>
    <a:view>
        <script type="text/javascript"><![CDATA[
        
        function get_template_type(ds,record,index){
            var hd_record=$('visit_type_syscode_ds').getSelected()[0];
            record.set('template_type',hd_record.get('template_type'));
        }
        
        function loadFunction(ds){
            var record=ds.getCurrentRecord();
            $('con_coll_patter_template_ds').setQueryParameter('template_type', record.get('template_type'));
                $('con_coll_patter_template_ds').query();
        }

   
        function indexChangeFunction(ds, record){
               $('con_coll_patter_template_ds').setQueryParameter('template_type', record.get('template_type'));
                $('con_coll_patter_template_ds').query();
        }
       ]]></script>
        <a:dataSets>
            <a:dataSet id="visit_type_syscode_ds" autoQuery="true" fetchAll="true" model="cont.CON625.visit_and_collection_syscode" selectable="true" selectionModel="single">
                <a:events>
                    <a:event name="indexchange" handler="indexChangeFunction"/>
                    <a:event name="load" handler="loadFunction"/>
                </a:events>
            </a:dataSet>
            <a:dataSet id="con_coll_patter_template_ds" fetchAll="true" model="cont.CON625.con_coll_patter_template" selectable="true" selectionModel="single">
                <a:fields>
                    <a:field name="enabled_flag" checkedValue="Y" defaultValue="Y" uncheckedValue="N"/>
                    <a:field name="patter" required="true"/>
                    <a:field name="seq_number" required="true"/>
                </a:fields>
                <a:events>
                    <a:event name="add" handler="get_template_type"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:hBox>
                <a:grid id="visit_type_syscode_grid_id" bindTarget="visit_type_syscode_ds" marginHeight="100" navBar="true" width="300">
                    <a:columns>
                        <a:column name="template_type_desc" prompt="话术类型" width="250"/>
                    </a:columns>
                </a:grid>
                <a:grid bindTarget="con_coll_patter_template_ds" marginHeight="100" marginWidth="400" navBar="true">
                    <a:toolBar>
                        <a:button type="add"/>
                        <a:button type="delete"/>
                        <a:button type="save"/>
                    </a:toolBar>
                    <a:columns>
                        <a:column name="seq_number" editor="numberField_e" prompt="排序" width="120"/>
                        <a:column name="patter" editor="textField_e" prompt="话术" width="600"/>
                        <a:column name="enabled_flag" align="center" editor="checkBox_e" prompt="启用" width="120"/>
                    </a:columns>
                    <a:editors>
                        <a:numberField id="numberField_e"/>
                        <a:textField id="textField_e"/>
                        <a:checkBox id="checkBox_e"/>
                    </a:editors>
                </a:grid>
            </a:hBox>
        </a:screenBody>
    </a:view>
</a:screen>