You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

164 lines
6.7 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>数据导入</title>
<link href="../../Scripts/easyUI/themes/icon.css" rel="stylesheet" type="text/css" />
<link href="../../Scripts/easyUI/themes/default/easyui.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/easyUI/jquery-1.8.0.min.js" type="text/javascript"></script>
<script src="../../Scripts/easyUI/jquery.easyui.min.js" type="text/javascript"></script>
<script src="../../Scripts/EasyUIUtility.js" type="text/javascript"></script>
<link href="../../Scripts/SyntaxHighlighter/Styles/shCoreDefault.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/SyntaxHighlighter/shCore.js" type="text/javascript"></script>
<script src="../../Scripts/SyntaxHighlighter/shBrushCSharp.js" type="text/javascript"></script>
<script src="../../Scripts/QueryString.js" type="text/javascript"></script>
<link href="../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
<script src="../../Comm/JScript.js" type="text/javascript"></script>
<script type="text/javascript" src="../../Scripts/config.js"></script>
<script type="text/javascript" src="../../Comm/Gener.js"></script>
<script type="text/javascript">
var ensName;
$(function () {
ensName = GetQueryString("EnsName");
var mapData = new Entity("BP.Sys.MapData");
mapData.No = ensName;
mapData.RetrieveFromDBSources();
if (mapData != null) {
$("#title").html(mapData.Name + "信息导入");
}
});
//数据导入.
function Imp_Done() {
var impWay = GetRadioValue("RB_ImpType");
var fileValue = $("#File_Upload").val();
//必须要选择文件
if (fileValue == "") {
$.messager.alert("提示", "没有选择要导入信息的Execl表。");
return;
}
//扩展名
var index = fileValue.lastIndexOf('.');
var fileExt = fileValue.substring(index);
if (fileExt.toLowerCase() != ".xls" && fileExt.toLowerCase() != ".xlsx") {
$.messager.alert("提示", "所选不是excel文件请重新选择。");
return;
}
//页面按钮失效
//$("#File_Upload").attr("disabled",true);
$("#Button1").attr("disabled", true);
$("input[name='RB_ImpType']").attr("disabled", "disabled");
//URL 路径
var doMethod = "ImpData_Done";
var httpHandlerName = "BP.WF.HttpHandler.WF_Comm_Sys";
var url = dynamicHandler + "?DoType=HttpHandler&DoMethod=" + doMethod + "&HttpHandlerName=" + httpHandlerName + "&ImpWay=" + impWay + "&EnsName=" + ensName;
//提交数据
$("#cc").form("submit", {
type: 'POST',
dataType: 'html',
url: url,
onSubmit: function (param) {
//return false; //这里可以做表单的验证如果验证失败就return false 来终止表单提交
},
success: function (data) {
$("#Button1").attr("disabled", false);
$("input[name='RB_ImpType']").attr("disabled", false);
if (data.indexOf("err@") != -1 && data.indexOf("errInfo=") == -1) {
alert(data);
$("#result").html('');
$("#result").append("<span style='color:red'>导入失败</span><br/>");
$("#result").append(data);
return;
}
$("#result").html('');
$("#result").append("<span>导入成功</span><br/>")
var datas = data.split("@Split");
var waringInfo = datas[0].replace("errInfo=", "");
var count = datas[1].replace("count=", "");
var successInfo = datas[2].replace("successInfo=", "");
var changeCount = datas[3].replace("changeCount=", "");
$("#result").append("成功导入条数&nbsp;&nbsp;&nbsp;" + count + "<br/>");
if (impWay != 0)
$("#result").append("成功更新条数&nbsp;&nbsp;&nbsp;" + changeCount + "<br/>");
$("#result").append("成功导入数据<br/>");
$("#result").append(successInfo);
$("#result").append("<span style='color:red'>警告</span><br/>");
$("#result").append(waringInfo);
}
});
}
function downloadFile() {
var ensName = GetQueryString("EnsName");
var downloadUrl = "../../../DataUser/TempleteOfImp/" + ensName + ".xls";
var a = document.getElementById("downFileID");
a.href = downloadUrl;
a.download = ensName + ".xls";
a.click();
}
</script>
</head>
<body>
<form id="cc" name="cc" action="" enctype="multipart/form-data" method="post">
<table style=" width:100%">
<caption id="title">设备信息导入 </caption>
<tr>
<td valign="top">
<fieldset>
<legend> 从本机导入 </legend>
<ul>
<li>从本机导入请您选择本机的一个Excel文件 点击导入按钮完成导入。</li>
<li> 请选择文件: <input type="file" id="File_Upload" name="File_Upload" /></li>
<li>导入的方式:
<ul>
<li><input id="Import_0" type="radio" name="RB_ImpType" value="0" checked="true" /><label for="Import_0">清空方式导入.</label></li>
<li><input id="Import_1" type="radio" name="RB_ImpType" value="1" /><label for="Import_1">更新方式导入.</label></li>
<li><input id="Import_2" type="radio" name="RB_ImpType" value="2" /><label for="Import_2">追加方式导入.</label></li>
</ul>
<br />
</li>
</ul>
<div style=" text-align:center; padding:5px;">
<input type="button" id="Button1" value="执行导入" onclick="Imp_Done();" />
</div>
</fieldset>
<fieldset>
<legend>说明</legend>
<ul>
<li>
<a href="#"onclick="downloadFile()">
<img style="width: 16px; height: 16px;" src="../../../WF/Img/redo.png" border="0"/>
下载导入模板
</a></li>
<li>该模版存在:D:\ccflow\CCFlow\DataUser\TempleteOfImp\下面.</li>
<li>比如: :D:\ccflow\CCFlow\DataUser\TempleteOfImp\BP.Demo.Students.xls</li>
</ul>
</fieldset>
<fieldset>
<legend>导入结果</legend>
<div id="result"></div>
</fieldset>
</td>
</tr>
</table>
<a id="downFileID" href="#" style="display:none"></a>
</form>
</body>
</html>