Index


@{
Layout = null;
}

<!DOCTYPE html>

<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Index</title>
<script src="~/Content/jquery-3.1.1.js"></script>
<script src="~/Content/page.js"></script>
<script src="~/Content/jquery.form.js"></script>
<style>
li {
width: 100px;
float: left;
border: 1px solid;
list-style-type: none;
height: 60px;
}

ul {
width: 850px;
}
</style>
</head>
<body>
<div>
<p>
<form id="form0">
从<input type="date" name="startDate" />到
<input type="date" name="endDate" />
<input type="text" name="Name" />
<input type="button" value="查询" onclick="search()" />
<input type="button" value="新增" onclick="location.href='/Users/Add'" />
<input type="file" name="file" />
<input type="button" value="导入" onclick="addExecl()" />
</form>
</p>
<ul>
<li>卡号</li>
<li>类型</li>
<li>密码</li>
<li>期限</li>
<li>姓名</li>
<li>性别</li>
<li>时间</li>
<li>操作</li>
</ul>
<ul id="list">

</ul>
</div>
<div style="clear:both">
<input type="button" value="首页" onclick="FirstPage()" />&nbsp;
<input type="button" value="上一页" onclick="PrivePage()" />&nbsp;
<input type="button" value="下一页" onclick="NextPage()" />&nbsp;
<input type="button" value="尾页" onclick="LastPage()" />&nbsp;
</div>
</body>
</html>
<script>
show();
function show() {
$.ajax({
url: "/Users/Query?startDate=" + $("[name=startDate]").val() + "&endDate=" + $("[name=endDate]").val() + "&pageIndex=" + pageIndex + "&Name=" + $("[name=Name]").val(),
type: "post",
dataType:"json",
success: function (d) {
console.log(d);
$("#list").html("");
pageIndex = d.PageIndex;
pageCount = d.PageCount;
for (var i = 0; i < d.Data.length; i++) {
var li = '<li>' + d.Data[i].VIPNum + '</li>'
+ '<li>' + d.Data[i].TId + '</li>'
+ '<li>' + d.Data[i].Pwd + '</li>'
+ '<li>' + d.Data[i].Qx + '</li>'
+ '<li>' + d.Data[i].Name + '</li>'
+ '<li>' + d.Data[i].Sex + '</li>'
+ '<li>' + d.Data[i].CreateDate + '</li>'
+ '<li><a href="javascript:void(0)" onclick="upd(' + d.Data[i].Id + ')">更新</a>&nbsp;<a href="javascript:void(0)" onclick="del(' + d.Data[i].Id + ')">删除</a></li>'
$("#list").append(li);
}
}
})
}
function addExecl() {
var formData = new FormData($("#form0")[0]);
$.ajax({
url: "/Users/Execl",
type: "post",
contentType: false,
processData: false,
cache: false,
data: formData,
success: function (d) {
console.log(d);
if (d > 0)
show();
}
})
}
</script>

posted @ 2018-11-22 18:27  嘻嘻哈哈嘿嘿呀  阅读(161)  评论(0编辑  收藏  举报