<?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="normal_node_verify_sql_link" url="${/request/@context_path}/modules/hls/HLS600/hls_branch_verify_sql.lview"/>
        <script type="text/javascript"><![CDATA[
			function normal_node_edit_save() {
			    if($('hls_normal_node_result_ds').validate()) {
			    	$('hls_normal_node_result_ds').submit();
			    }
			}
			
			function normal_node_addHandler(ds,record,index) {
			    record.set('node_id','${/parameter/@node_id}');
			}
			
			function normal_verify_sql_renderer(value, record, name) {
			    if (name == 'approve_sql') {
			        if (!value){
                    	return '<a  href="javascript:approve_sql_window_open(' + record.id + ')">' + '验证SQL' + '</a>';
                    }else{
                        return '<a  href="javascript:approve_sql_window_open(' + record.id + ')">' + '<font color="#FF9900">验证通过SQL</font>' + '</a>';
                    }
			    } else if(name == 'unapprove_sql') {
			        if (!value){
                    	return '<a  href="javascript:unapprove_sql_window_open(' + record.id + ')">' + '验证SQL' + '</a>';
                    }else{
                        return '<a  href="javascript:unapprove_sql_window_open(' + record.id + ')">' + '<font color="#FF9900">验证不通过SQL</font>' + '</a>';
                    }
			    }
			}
			
			function approve_sql_window_open(id) {           
                var win = new Leaf.Window({
                    id: 'approve_sql_his_id',
                    params: {
                        record_id: id,
                        ds_name: 'hls_normal_node_result_ds',
                        name: 'approve_sql',
            
                        winId: 'approve_sql_his_id'
                    },
                    url: $('normal_node_verify_sql_link').getUrl(),
                    title: '验证通过SQL',
                    width: 600,
                    height: 430,
                    draggable: true
                });
            }
            
            function unapprove_sql_window_open(id) {           
                var win = new Leaf.Window({
                    id: 'unapprove_sql_his_id',
                    params: {
                        record_id: id,
                        ds_name: 'hls_normal_node_result_ds',
                        name: 'unapprove_sql',
            
                        winId: 'unapprove_sql_his_id'
                    },
                    url: $('normal_node_verify_sql_link').getUrl(),
                    title: '验证不通过SQL',
                    width: 600,
                    height: 430,
                    draggable: true
                });
            }
            
            
		]]></script>
        <a:dataSets>
            <a:dataSet id="function_type_ds" lookupCode="HLS_NODE_FUNCTION_TYPE"/>
            <a:dataSet id="hls_normal_node_result_ds" autoQuery="true" model="hls.HLS600.hls_document_function" queryUrl="${/request/@context_path}/autocrud/hls.HLS600.hls_document_function/query?node_id=${/parameter/@node_id}" selectable="true">
                <a:fields>
                    <a:field name="function_code"/>
                    <a:field name="function_name" lovHeight="500" lovService="hls.HLS600.sys_function_vl" lovWidth="500" required="true">
                        <a:mapping>
                            <a:map from="function_code" to="function_code"/>
                            <a:map from="function_name" to="function_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="document_category"/>
                    <a:field name="document_category_desc" 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:field name="function_type"/>
                    <a:field name="function_type_desc" displayField="code_value_name" options="function_type_ds" returnField="function_type" valueField="code_value"/>
                    <a:field name="enabled_flag" checkedValue="Y" uncheckedValue="N"/>
                    <a:field name="approve_sql"/>
                    <a:field name="unapprove_sql"/>
                </a:fields>
                <a:events>
                    <a:event name="add" handler="normal_node_addHandler"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="normal_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_normal_node_result_grid" bindTarget="hls_normal_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="sequence_num" align="center" editor="normal_node_grid_nf" prompt="序列号" width="120"/>
                    <a:column name="function_name" align="center" editor="normal_node_grid_lov" prompt="功能" width="120"/>
                    <a:column name="document_category_desc" align="center" editor="normal_node_grid_lov" prompt="单据类别" width="120"/>
                    <a:column name="description" editor="normal_node_grid_tf" prompt="描述" width="120"/>
                    <a:column name="function_type_desc" editor="normal_node_grid_cb" prompt="流程是否必需" width="120"/>
                    <a:column name="approve_sql" align="center" autoAdjust="false" prompt="验证通过SQL" renderer="normal_verify_sql_renderer" width="120"/>
                    <a:column name="unapprove_sql" align="center" autoAdjust="false" prompt="验证不通过SQL" renderer="normal_verify_sql_renderer" width="120"/>
                    <a:column name="enabled_flag" editor="normal_node_grid_checkb" prompt="启用标志" width="200"/>
                </a:columns>
                <a:editors>
                    <a:numberField id="normal_node_grid_nf"/>
                    <a:lov id="normal_node_grid_lov"/>
                    <a:textField id="normal_node_grid_tf"/>
                    <a:textArea id="normal_node_grid_ta"/>
                    <a:comboBox id="normal_node_grid_cb"/>
                    <a:checkBox id="normal_node_grid_checkb"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>
