<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: lpc 9874
    $Date: $
    $Revision: 1.0 $
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure>
        <a:model-query model="hls.HLS303.hls_bp_agent_import_batch_id" rootPath="batch_id"/>
    </a:init-procedure>
    <a:view>
        <script type="text/javascript"><![CDATA[
        	function saveClick(){
        		if (document.getElementById('importFile').value){
        			var fileName = document.getElementById('importFile').value;
        			var fileType = fileName.substr(fileName.lastIndexOf("."));
        			if (fileType != '.xls' && fileType != '.xlsx' && fileType != '.xlsm') {
                        document.getElementById('importForm').submit();
                    } else {
                        doSubmit();
                    }
        		}
        	}
        	
        	
        	var _input_window;
        	
        	function doSubmit() {

                _input_window = new $L.Window({
                    title: '${l:HLS.IMPORT}',
                    width: 1050,
                    height: 500
                });
                new Ext.Template('<iframe id ="_input_window" name="_input_window" border="0" frameborder="0" height="100%"  width="100%"  style="border:none;padding:0px;margin:0px;"></iframe>').insertFirst(_input_window.body.dom, {}, true);
                var form = document.getElementById('importForm');
                var url = '${/request/@context_path}/modules/hls/HLS303/bp_agent_import_trans_upload.lview?batch_id=${/model/batch_id/record/@batch_id}&bp_id=${/parameter/@bp_id}&winid=${/parameter/@winid}&_csrf=${/session/@_csrf.token}';
                form.action = url;
                form.submit();
                // $('${/parameter/@winid}').close();
                _input_window.on('close', function() {
                    $('${/parameter/@winid}').close();
                });
            }
    	]]></script>
        <a:dataSets>
            <a:dataSet id="label_ds" autoCreate="true">
                <a:fields>
                    <a:field name="label2" defaultValue="1、  严格按照导入模板整理数据，检查必输事项是否缺少数据。"/>
                    <a:field name="label3" defaultValue="2、  关闭Excel文件后，方可进行产品主数据导入。"/>
                    <a:field name="label4" defaultValue="3、  本导入程序只支持Office Excel。"/>
                    <a:field name="label5" defaultValue="仔细阅读上述事项，并检查确认无误。"/>
                    <a:field name="label6" defaultValue="导入完毕后，请在系统内核实数据是否导入成功。"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:fieldSet style="margin-left:10px;margin-top:10px;" title="导入注意事项" width="400">
            <a:label name="label2" bindTarget="label_ds" style="margin-left:10px;" width="380"/>
            <a:label name="label3" bindTarget="label_ds" style="margin-left:10px;" width="380"/>
            <a:label name="label4" bindTarget="label_ds" style="margin-left:10px;" width="380"/>
            <a:label name="label5" bindTarget="label_ds" style="color:#055A78;font-weight:bold;margin-left:10px;" width="380"/>
            <a:label name="label6" bindTarget="label_ds" style="color:#055A78;font-weight:bold;margin-left:10px;" width="380"/>
        </a:fieldSet>
        <a:fieldSet style="margin-left:10px;margin-top:10px;" title="导入文件" width="400">
            <form name="upload" id="importForm" action="bp_agent_import_trans_upload.lview?batch_id=${/model/batch_id/record/@batch_id}&amp;bp_id=${/parameter/@bp_id}&amp;winid=${/parameter/@winid}" enctype="multipart/form-data" method="post" target="_input_window">
                <label style="margin-left:10px;margin-top:10px;"><![CDATA[请选择文件:]]></label>
                <input name="CONTENT" id="importFile" style="margin-bottom:4px;width:160px;height:22px;" type="file"/>
                <input onclick="saveClick()" style="margin-left:50px;margin-top:10px;width:60px;" type="button" value="导入"/>
            </form>
        </a:fieldSet>
    </a:view>
</a:screen>
