<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zhuxianfei
    $Date: 2018-07-12 下午2:20:47
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true">
    <a:init-procedure>
        <a:model-delete model="cont.CON706.modify_interface"/>
        <a:model-query model="cont.CON706.document_get_import_head_id" rootPath="header"/>
        <a:import-excel header_id="${/model/header/record/@header_id}" separator=","
                        status_field="/parameter/@ImportSuccess" template_code="CON_ET_DOC_IMPORT"
                        user_id="${/session/@user_id}"/>
        <a:model-query
                defaultWhereClause="header_id=${/model/header/record/@header_id} and TEMPLATE_CODE = &apos;CON_ET_DOC_IMPORT&apos;"
                model="cont.CON706.con_import_get_status" rootPath="status"/>
    </a:init-procedure>
    <a:view>
        <a:link id="import_link" url="${/request/@context_path}/modules/cont/CON706/con706_et_document_import.lview"/>
        <a:link id="import_save_data_link"
                url="${/request/@context_path}/modules/cont/CON706/con_document_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}';
                param['return_flag'] = '0';
                Leaf.Masker.mask(Ext.getBody(), '${l:HLS.EXECUTING}');

                Leaf.request({
                    url: $('import_save_data_link').getUrl(),
                    para: param,
                    success: function (res) {

                        window.location.href = $('import_link').getUrl();
                    },
                    failure: function (res) {

                        Leaf.Masker.unmask(Ext.getBody());
                        window.location.href = $('import_link').getUrl();

                    },
                    error: function (res) {
                        Leaf.Masker.unmask(Ext.getBody());
                        window.location.href = $('import_link').getUrl();

                    },
                    sync: true,
                    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:columns>
                </a:grid> --><![CDATA[


                ]]>
            </a:form>
        </a:screenBody>
        <script type="text/javascript"><![CDATA[
        loadComplete();
        ]]></script>
    </a:view>
</a:screen>
