From 1b67b236d6c15c2ba770d3ee1a26c97bff4554bd Mon Sep 17 00:00:00 2001 From: july Date: Wed, 15 Feb 2023 09:09:38 +0000 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=20'temp.txt'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- temp.txt | 235 ------------------------------------------------------- 1 file changed, 235 deletions(-) delete mode 100644 temp.txt diff --git a/temp.txt b/temp.txt deleted file mode 100644 index 2988f33..0000000 --- a/temp.txt +++ /dev/null @@ -1,235 +0,0 @@ -function getUrl() { - let url = window.location.pathname; - let index = url.indexOf("/", 1); - return (url.substring(0, index)); -} - -//第几页 -let indexPage -// 总共有多少页 -let pageTotal -//这页有多少条 -let sizePage -//总共有多少条 -let recordTotal - -function showTable(data) { - let pageCapacity = 0; - $(data.beanList).each(function () { - pageCapacity++; - let html = ""; - if (pageCapacity % 2 != 0) { - html += ""; - } else { - html += ""; - } - html += "" + this.personnelName + ""; - html += "" + this.personnelAge + ""; - html += "" + this.personnelGender + ""; - html += "" + this.personnelTelephone + ""; - html += "" + this.personnelEmail + ""; - html += "" + this.personnelBirthday + ""; - html += "" + this.personnelEntrydate + ""; - html += "" + this.position.positionName + ""; - html += "" + this.state.stateName + ""; - html += "" + "详情  " + - "修改  " + - "删除 " + ""; - html += ""; - html += ""; - $(html).appendTo($("#taCustomers")); - }); -} - -//显示页码 -function showPage(data) { - let beginPage = eval("data.beginPage"); - let endPage = eval("data.endPage"); - let pageIndex = eval("data.pageIndex"); - //第几页 - indexPage = pageIndex; - // 总共有多少页 - pageTotal = eval("data.totalPage") == 0 ? 1 : eval("data.totalPage"); - //总共有多少条 - recordTotal = eval("data.totalRecord"); - //这页有多少条 - sizePage = recordTotal != 0 ? (eval("data.pageSize")) : 0; - - let pageInfo = "本页显示" + (indexPage != pageTotal ? sizePage : (recordTotal % sizePage == 0 ? 10 : recordTotal % sizePage)) + "条数据" + "/共" + recordTotal + "条数据,当前第" + indexPage + "页/共" + pageTotal + "页"; - $("#spanId").html(pageInfo); - let html; - if (pageIndex > beginPage) { - html = "
  • " - $(html).appendTo($("#page")); - } - let index; - for (index = beginPage; index <= endPage; index++) { - if (index === pageIndex) { - html = "
  • " + index + "
  • " - } else { - html = "
  • " + index + "" - } - $(html).appendTo($("#page")); - } - if (pageIndex < endPage) { - html = "
  • "; - $(html).appendTo($("#page")); - } -} - -function deleteData(personnelId) { - $.get(getUrl() + "/Boss/deletePersonnel.do", - {personnelId: personnelId}, - function (data) { - if (confirm("确认删除" + personnelId)) { - if (data.code == 200) { - alert("删除成功"); - recordTotal = recordTotal - 1; - let pageInfo = "本页显示" + (indexPage != pageTotal ? sizePage - 1 : (recordTotal % sizePage)) + "条数据" + "/共" + recordTotal + "条数据,当前第" + indexPage + "页/共" + pageTotal + "页"; - $("#spanId").html(pageInfo); - $("#" + "personnelId" + personnelId).remove(); - } else { - alert(data.msg); - } - } - }, - "json" - ); -} - -function getQueryVariable(variable) { - let query = window.location.search.substring(1); - let vars = query.split("&"); - for (let i = 0; i < vars.length; i++) { - let pair = vars[i].split("="); - if (pair[0] == variable) { - return pair[1]; - } - } - return (false); -} - -function showData(pageIndex = 1) { - $("#pageIndex").val(pageIndex); - $.get(getUrl() + "/Boss/getAllPersonnel.do", $("#fmCustomers").serialize(), - function (data) { - $("#taCustomers").children(":gt(0)").remove(); - $("#page").children().remove() - showTable(data.data); - showPage(data.data); - }, - "json" - ); -} - -function showPositions(data) { - if (data.code == 200) { - let html = ''; - $(data.data).each(function () { - let html = ""; - $(html).appendTo($("#roleId")); - /*$(html).appendTo($("#roleId1"));*/ - $("#addButton").click(function () { - $(html).appendTo($("#roleId1")); - }); - $("#updateInfo").click(function () { - alert("hello"); - $(html).appendTo($("#roleId1")); - }); - }); - } else { - alert(data.msg); - } -} - -function showStates(data) { - if (data.code == 200) { - $(data.data).each(function () { - let html = ""; - $(html).appendTo($("#status")); - //$(html).appendTo($("#status1")); - $("#addButton").click(function () { - $(html).appendTo($("#status1")) - }); - $("#updateInfo").click(function () { - alert("hello"); - $(html).appendTo($("#status1")); - }); - }); - } else { - alert(data.msg); - } -} - -function showPosition() { - $.get(getUrl() + "/getPositions.do", - function (data) { - showPositions(data); - }, - "json" - ); -} - -function showState() { - $.get(getUrl() + "/getAllStates.do", - function (data) { - showStates(data); - }, - "json" - ); -} - -//修改 -function edit(personnelId) { - $('#myform')[0].reset(); - let but = " " + - ""; - $("#modalFooter").html(but); - $.get(getUrl() + "/Boss/selectPersonnelById.do", - {personnelId: personnelId}, - function (data) { - if (data.code == 200) { - $("#account").val(data.data.personnelName); - $("#realName").val(data.data.personnelAccount); - $("#test1").val(data.data.personnelBirthday); - $("#age").val(data.data.personnelAge); - $("input:radio[value=" + data.data.personnelGender + "]").attr("checked", "checked"); - $("#email").val(data.data.personnelEmail); - $("#mobile").val(data.data.personnelTelephone); - $("#identity").val(data.data.personnelIdcard); - $("#roleId option[value=" + data.data.position.positionId + "]").prop("selected", true); - $("#status option[value=" + data.data.state.stateId + "]").prop("selected", true); - $("#test2").val(data.data.personnelEntrydate); - } else { - alert(data.msg); - } - }, "json" - ); - $('#addUserModal').modal('show'); -} - -//提交数据 -function modify(personnelId) { - $.get(getUrl() + "/Boss/modifyPersonnelInfo.do", $("#myform").serialize() + "&personnelId=" + personnelId, function (data) { - if (confirm("确认修改信息吗?")) { - if (data.code == 200) { - alert("修改成功"); - showData(personnelId); - } else { - alert("修改失败"); - } - } - }, "json"); -} - -function addperson() { - $.get(getUrl() + "/Boss/addPersonnel.do", $("#myform").serialize(), - function (data) { - if (data.code == 200) { - showData(indexPage); - alert("添加成功"); - } else { - alert("添加失败"); - } - }, "json"); -} \ No newline at end of file