<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: ZLF  
    $Date: 2015-1-2 上午10:53:49  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure><![CDATA[
		
	]]></a:init-procedure>
    <a:view>
        <a:link id="branch_node_verify_sql_link" url="${/request/@context_path}/modules/hls/HLS600/hls_branch_verify_sql.lview"/>
        <script type="text/javascript"><![CDATA[
			function branch_node_edit_save() {
			    if($('hls_branch_node_result_ds').validate()) {
			    	$('hls_branch_node_result_ds').submit();
			    }
			}
			
			function branch_node_addHander(ds,record,index) {
			    record.set('node_id','${/parameter/@node_id}');
			}
			
			function verify_sql_window_open(id) {           
                var win = new Leaf.Window({
                    id: 'verify_sql_his_id',
                    params: {
                        record_id: id,
                        ds_name: 'hls_branch_node_result_ds',
                        name: 'verify_sql',
            
                        winId: 'verify_sql_his_id'
                    },
                    url: $('branch_node_verify_sql_link').getUrl(),
                    title: '验证SQL',
                    width: 600,
                    height: 430,
                    draggable: true
                });
            }
			
			function verify_sql_renderer(value, record, name) {
			    if (name == 'verify_sql') {
			        if (!value){
                    	return '<a  href="javascript:verify_sql_window_open(' + record.id + ')">' + '验证SQL' + '</a>';
                    }else{
                        return '<a  href="javascript:verify_sql_window_open(' + record.id + ')">' + '<font color="#FF9900">验证SQL</font>' + '</a>';
                    }
			    }
			}
		]]></script>
        <a:dataSets>
            <a:dataSet id="hls_branch_node_result_ds" autoQuery="true" model="hls.HLS600.hls_document_node_branch" queryUrl="${/request/@context_path}/autocrud/hls.HLS600.hls_document_node_branch/query?node_id=${/parameter/@node_id}" selectable="true">
                <a:fields>
                    <a:field name="jump_node_id"/>
                    <a:field name="jump_id_desc" lovGridHeight="220" lovHeight="400" lovService="hls.HLS600.hls_document_node_for_lov?node_id_not_in=${/parameter/@node_id}" lovWidth="500" required="true">
                        <a:mapping>
                            <a:map from="node_id" to="jump_node_id"/>
                            <a:map from="node_desc" to="jump_id_desc"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="document_category"/>
                    <a:field name="document_category_desc" lovGridHeight="350" lovHeight="500" lovService="hls.HLS600.hls_document_category" lovWidth="500" required="true">
                        <a:mapping>
                            <a:map from="document_category" to="document_category"/>
                            <a:map from="description" to="document_category_desc"/>
                        </a:mapping>
                    </a:field>
                </a:fields>
                <a:events>
                    <a:event name="add" handler="branch_node_addHander"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="branch_node_edit_save" text="保存"/>
            </a:screenTopToolbar>
            <a:form column="4" marginWidth="60" title="节点信息">
                <a:textField name="node_seq" bindTarget="hls600_document_node_result_ds" prompt="节点序号" readOnly="true"/>
                <a:textField name="node_desc" bindTarget="hls600_document_node_result_ds" prompt="节点描述" readOnly="true"/>
                <a:textField name="node_type_desc" bindTarget="hls600_document_node_result_ds" prompt="节点类型" readOnly="true"/>
                <a:textField name="enabled_flag_desc" bindTarget="hls600_document_node_result_ds" prompt="是否启用" readOnly="true"/>
            </a:form>
            <a:grid id="hls_branch_node_result_grid" bindTarget="hls_branch_node_result_ds" marginHeight="200" marginWidth="60" navBar="true">
                <a:toolBar>
                    <a:button type="add"/>
                    <a:button type="delete"/>
                </a:toolBar>
                <a:columns>
                    <a:column name="return_value" align="center" editor="branch_node_grid_tf" prompt="返回值" width="120"/>
                    <a:column name="jump_id_desc" align="center" editor="branch_node_grid_lov" prompt="跳转节点" width="120"/>
                    <a:column name="document_category_desc" align="center" editor="branch_node_grid_lov" prompt="单据类别" width="120"/>
                    <a:column name="verify_sql" align="center" autoAdjust="false" prompt="验证SQL" renderer="verify_sql_renderer" width="120"/>
                </a:columns>
                <a:editors>
                    <a:lov id="branch_node_grid_lov"/>
                    <a:textField id="branch_node_grid_tf"/>
                    <a:textArea id="branch_node_grid_ta"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>
