87 lines
3.6 KiB
Plaintext
87 lines
3.6 KiB
Plaintext
@{
|
|
ViewBag.Title = "用友客商编码导入";
|
|
Layout = "~/Views/Shared/_InfoLayout.cshtml";
|
|
}
|
|
|
|
@section JS{
|
|
<script>
|
|
function uploadYYClientCode() {
|
|
if ($("#openFile").val() === "" || $("#openFile").val() == null || $("#openFile").val() === "undefined") {
|
|
showmiddlemessage("请选择要导入的文件!");
|
|
return false;
|
|
}
|
|
main.confirm("确认导入?注:如名称相同,则上传数据会覆盖原本数据", function () {
|
|
var formData = new FormData($('form')[0]);
|
|
$.ajax({
|
|
url: '/trade/UploadYonYouClientCodeMain', //server script to process data
|
|
data: { importWay: $("#ImportWay:checked").val() },
|
|
type: 'POST',
|
|
xhr: function () { // custom xhr
|
|
myXhr = $.ajaxSettings.xhr();
|
|
if (myXhr.upload) { // check if upload property exists
|
|
myXhr.upload.addEventListener('progress', progressHandlingFunction, false); // for handling the progress of the upload
|
|
}
|
|
return myXhr;
|
|
},
|
|
//Ajax事件
|
|
//beforeSend: beforeSendHandler,
|
|
success: function (data) {
|
|
try {
|
|
//parent.layer.closeAll();
|
|
//parent.changeunderlying();
|
|
(window.opener || window.parent).main.alert(data.msg);
|
|
main.parentReload('reloadDic');
|
|
closeuploadWindow();
|
|
|
|
} catch (e) {
|
|
|
|
} finally {
|
|
|
|
}
|
|
},
|
|
error: function (data) {
|
|
showmiddlemessage("导入失败:{0}".template(data.msg));
|
|
},
|
|
// Form数据
|
|
data: formData,
|
|
//Options to tell JQuery not to process data or worry about content-type
|
|
cache: false,
|
|
contentType: false,
|
|
processData: false
|
|
});
|
|
});
|
|
}
|
|
|
|
function progressHandlingFunction(e) {
|
|
if (e.lengthComputable) {
|
|
$('progress').attr({ value: e.loaded, max: e.total });
|
|
}
|
|
}
|
|
|
|
function closeuploadWindow() {
|
|
this.layer.closeMe();
|
|
}
|
|
|
|
function exportModel() {
|
|
window.open("../App_Docs/导入模板/用友客商编码导入模板.xlsx");
|
|
}
|
|
</script>
|
|
}
|
|
|
|
@using (Html.BeginForm("UploadYonYouClientCodeMain", "trade", FormMethod.Post, new { id = "YYClientCodeUploadForm" }))
|
|
{
|
|
<div class="well" style="margin:0px auto;margin-top:10px;">
|
|
<fieldset>
|
|
<legend>用友客商导入</legend>
|
|
|
|
<input type="file" id="openFile" name="file" accept=".xlsx, .csv" />
|
|
</fieldset>
|
|
</div>
|
|
<div style="margin:0px auto;padding:10px;">
|
|
@Html.MyRadioButton(new List<SelectListItem>() { new SelectListItem() { Text = "全量更新", Value = "Full" }, new SelectListItem() { Text = "增量更新", Value = "Add" } }, "更新方式", "ImportWay", "Add")
|
|
<p>注:全量更新删除所有客商记录再导入,增量更新相同客商则覆盖</p>
|
|
@MyControls.Btn("导入用友客商", "uploadYYClientCode()")
|
|
@MyControls.Btn("下载导入模板", "exportModel()")
|
|
@MyControls.Btn("关闭", "closeuploadWindow()")
|
|
</div>
|
|
} |