<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: lara  
    $Date: 2019-1-1 下午3:48:04  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true"  xmlns:p="uncertain.proc">
    <a:init-procedure>
        <p:echo></p:echo>
        <a:model-query model="basic.hls_fnd_attribute_sequence" rootPath="header"/>
        <a:import-excel header_id="${/model/header/record/@header_id}" separator="," status_field="/parameter/@ImportSuccess" template_code="HLCM_SBO_REPLACE" user_id="${/session/@user_id}"/>
<!--        <a:import-excel header_id="" separator="," status_field="/parameter/@ImportSuccess" template_code="HLCM_SBO_REPLACE" user_id="${/session/@user_id}"/>-->
        <a:model-query defaultWhereClause="header_id=${/model/header/record/@header_id} and TEMPLATE_CODE = &apos;HLCM_SBO_REPLACE&apos;" model="basic.hls_fnd_attribute_status" rootPath="status"/>
    </a:init-procedure>
    <a:view>
        <a:link id="hls_sbo_save_data_link" model="hls.HLS301.hls_sbo_import" modelaction="execute"/>
        <a:link id="hls_journal_query_link" url="${/request/@context_path}/modules/hls/HLS301/hls_journal_query.lview"/>
        <script><![CDATA[

        function success() {

            Leaf.showInfoMessage('${l:HLS.PROMPT}', '导入成功', function callback() {
                window.location.href =$('hls_journal_query_link').getUrl();
            });

        }
            function loadComplete() {
                if ('${/model/status/record/@status}' == 'NEW') {
                    Leaf.Masker.mask(Ext.get(document.documentElement), '正在更新数据。。。');
                    var param = {};
                    param['header_id'] = '${/model/header/record/@header_id}';
                    param['user_id'] = '${/session/@user_id}';
                    Leaf.request({
                        url: $('hls_sbo_save_data_link').getUrl(),
                        para: param,
                        success: function() {
                            Leaf.Masker.unmask(Ext.get(document.documentElement));
                            // Leaf.SideBar.show({
                            //     msg: '导入成功!',
                            //     duration: 2000
                            // });
                            success();
                          //  window.location.href = $('hls_journal_query_link').getUrl();
                        },
                        error: function() {
                        },
                        failure: function() {},
                        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: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:columns>
                </a:grid>
            </a:form>
        </a:screenBody>
        <script><![CDATA[
	  		loadComplete();
	  	]]></script>
    </a:view>
</a:screen>
