102 lines
4.1 KiB
Plaintext
102 lines
4.1 KiB
Plaintext
@model Client
|
|
|
|
@{
|
|
ViewBag.Title = "管理管理 | 客户导入";
|
|
Layout = "~/Views/Shared/_InfoLayout.cshtml";
|
|
}
|
|
|
|
@section JS{
|
|
<script type="text/javascript">
|
|
function uploadClient(type) {
|
|
if (!checkData()) return false;
|
|
if ($("#openFile").val() === "" || $("#openFile").val() == null || $("#openFile").val() === "undefined") {
|
|
showmiddlemessage("请选择要导入的文件!");
|
|
return false;
|
|
}
|
|
main.confirm("确定导入?", function () {
|
|
var formData = new FormData($('form')[0]);
|
|
$.ajax({
|
|
url: type == 0 ? '/client/UploadClientMain' : (type == 1 ? '/client/UploadClientDutyExcel' : '/client/UploadClientBankcardExcel'), //server script to process data
|
|
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();
|
|
if (data.success) {
|
|
window.parent.reloadclient();
|
|
parent.layer.closeAll();
|
|
} else {
|
|
main.alert(data.msg)
|
|
}
|
|
} catch (e) {
|
|
|
|
} finally {
|
|
$("#openFile").val("");
|
|
}
|
|
},
|
|
error: function (data) {
|
|
$("#openFile").val("");
|
|
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 checkData() {
|
|
var pass = $('#clinetUploadForm').valid();
|
|
return pass;
|
|
}
|
|
|
|
function closeuploadClientWindow() {
|
|
try { window.parent.layer.closeAll(); } catch (e) { }
|
|
try { window.parent.$('#modal-editcalendar .close').click(); } catch (e) { }
|
|
try { window.parent.$('#modal-calendarEditInner .close').click(); } catch (e) { }
|
|
try { if (window.parent.location.href.indexOf("calendarEdit") >= 0) { window.close(); } } catch (e) { }
|
|
}
|
|
</script>
|
|
}
|
|
|
|
@using (Html.BeginForm("clientEdit", "client", FormMethod.Post, new { id = "clinetUploadForm" }))
|
|
{
|
|
<div class="well" style="margin:0px auto;margin-top:10px;">
|
|
<fieldset>
|
|
<legend>客户导入</legend>
|
|
|
|
@if (Model != null)
|
|
{
|
|
<input type="hidden" value="@Model.id" name="id" id="id" />
|
|
}
|
|
<input type="file" id="openFile" name="file" accept=".xlsx, .csv" />
|
|
</fieldset>
|
|
</div>
|
|
<div style="margin:0px auto;padding:10px;">
|
|
@MyControls.Btn("导入客户基本信息", "uploadClient(0)")
|
|
@MyControls.Btn("导入客户人员信息", "uploadClient(1)")
|
|
@if (CurUser.客户管理.导入客户银行卡)
|
|
{
|
|
@MyControls.Btn("导入客户银行账号", "uploadClient(2)")
|
|
}
|
|
@MyControls.Btn("关闭", "closeuploadClientWindow()")
|
|
</div>
|
|
} |