<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: ZLF  
    $Date: 2014-11-20 下午2:20:47  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true">
    <a:init-procedure>
        <a:model-query model="cont.CON508.lease_get_import_head_id" rootPath="header"/>
        <a:import-excel header_id="${/model/header/record/@header_id}" separator="," status_field="/parameter/@ImportSuccess" template_code="CON_LEASE_IMPORT" user_id="${/session/@user_id}"/>
        <a:model-query defaultWhereClause="header_id=${/model/header/record/@header_id} and TEMPLATE_CODE = &apos;CON_LEASE_IMPORT&apos;" model="csh.CSH511.csh_import_get_status" rootPath="status"/>
    </a:init-procedure>
    <a:view>
        <a:link id="import_link" url="${/request/@context_path}/modules/cont/CON508/con_contract_lease_import.lview"/>
        <a:link id="import_save_data_link" url="${/request/@context_path}/modules/cont/CON508/con_lease_import_save.lsc"/>
        <script type="text/javascript"><![CDATA[
            function loadComplete() {
                if ('${/model/status/record/@status}' == 'NEW') {
                    var param = {};
                    param['batch_id'] = '${/parameter/@batch_id}';
                    param['header_id'] = '${/model/header/record/@header_id}';
                    param['user_id'] = '${/session/@user_id}';
                    Leaf.request({
                        url: $('import_save_data_link').getUrl(),
                        para: param,
                        success: function() {
                            window.location.href = $('import_link').getUrl();
                        },
                        scope: this
                    });

                } else {
                    Ext.get('success_form').setStyle('display', 'none');
                    Ext.get('failure_form').setStyle('visibility', 'visible');
                }
            }
            
            
        ]]></script>
        <a:dataSets>
            <a:dataSet id="error_ds">
                <a:fields>
                    <a:field name="import_field_1" prompt="import_field_1"/>
                    <a:field name="import_field_2" prompt="import_field_2"/>
                    <a:field name="import_field_3" prompt="import_field_3"/>
                    <!-- <a:field name="import_field_4" prompt="import_field_4"/>
                    <a:field name="import_field_5" prompt="import_field_5"/>
                    <a:field name="import_field_6" prompt="import_field_6"/>
                    <a:field name="import_field_7" prompt="import_field_7"/>
                    <a:field name="import_field_8" prompt="import_field_8"/> -->
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:form id="failure_form" height="400" style="visibility:hidden" title="ERROR_MESSAGE" width="980">
                <a:grid bindTarget="error_ds" height="340" navBar="true" width="980">
                    <a:columns>
                        <a:column name="import_field_1"/>
                        <a:column name="import_field_2"/>
                        <a:column name="import_field_3"/>
                        <!-- <a:column name="import_field_4"/>
                        <a:column name="import_field_5"/>
                        <a:column name="import_field_6"/>
                        <a:column name="import_field_7"/>
                        <a:column name="import_field_8"/> -->
                    </a:columns>
                </a:grid>
            </a:form>
        </a:screenBody>
        <script type="text/javascript"><![CDATA[
	  		loadComplete();
	  	]]></script>
    </a:view>
</a:screen>
