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

447 lines
15 KiB

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>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="页面描述" />
<title>宽城区学区查询信息管理系统</title>
<link href="./component/pear/css/pear.css" rel="stylesheet" />
<link href="./css/settings.css" rel="stylesheet" />
</head>
<body>
<div class="main">
<div class="main-box">
<div class="table-box">
<div class="card table-search">
<div>
<span class="title" id="page_title"
>宽城区学区查询信息管理系统</span
>
</div>
<div class="layout-right" id="dropdown-text">
<a class="layui-icon layui-icon-username" href="javascript:;"></a>
<i class="layui-icon layui-icon-down" style="cursor: pointer"></i>
</div>
</div>
<div class="card table-main">
<div
class="layui-tabs layui-hide-v"
id="stageTabs"
lay-options="{index: 0}"
>
<ul class="layui-tabs-header" style="font-weight: bold">
<li>小学学区</li>
<li>初中学区</li>
</ul>
<div class="layui-tabs-body">
<div class="layui-tabs-item">
<script type="text/html" id="xx_table_toolbar">
<div style="display: flex;align-items:center">
<button class="layui-btn layui-btn-sm" lay-event="xx_add">
<i class="layui-icon layui-icon-add-1"></i>
新增学校
</button>
<button
class="layui-btn layui-btn-primary layui-btn-sm"
lay-event="xx_import"
>
<i class="layui-icon layui-icon-export"></i>
批量导入
</button>
<div class="layui-input-wrap" style="margin-left: 10px;">
<input
type="text"
lay-affix="search"
lay-filter="xx_search"
placeholder="请输入学校名称、派出所、街委"
class="layui-input"
style="width: 280px;"
id="xx_keyword"
/>
</div>
</div>
</script>
<table class="layui-hide" id="xx-table"></table>
<script type="text/html" id="xx_table_bar">
<span
class="woo-tool-span woo-tool-text-span"
data-tool-sort="120"
lay-event="xx_edit"
><a class="woo-theme-color">编辑</a></span
>
<i class="woo-tool-text-delimiter"></i>
<span
class="woo-tool-span woo-tool-text-span"
data-tool-sort="120"
lay-event="xx_remove"
><a class="woo-theme-color-red">删除</a></span
>
</script>
</div>
<div class="layui-tabs-item">
<script type="text/html" id="cz_table_toolbar">
<div style="display: flex;align-items:center">
<button class="layui-btn layui-btn-sm" lay-event="cz_add">
<i class="layui-icon layui-icon-add-1"></i>
新增学校
</button>
<button
class="layui-btn layui-btn-primary layui-btn-sm"
lay-event="cz_import"
>
<i class="layui-icon layui-icon-export"></i>
批量导入
</button>
<div class="layui-input-wrap" style="margin-left: 10px;">
<input
type="text"
lay-affix="search"
lay-filter="cz_search"
placeholder="请输入学校名称、派出所、街委"
class="layui-input"
style="width: 280px;"
id="cz_keyword"
/>
</div>
</div>
</script>
<table class="layui-hide" id="cz-table"></table>
<script type="text/html" id="cz_table_bar">
<span
class="woo-tool-span woo-tool-text-span"
data-tool-sort="120"
lay-event="cz_edit"
><a class="woo-theme-color">编辑</a></span
>
<i class="woo-tool-text-delimiter"></i>
<span
class="woo-tool-span woo-tool-text-span"
data-tool-sort="120"
lay-event="cz_remove"
><a class="woo-theme-color-red">删除</a></span
>
</script>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="./component/layui/layui.js"></script>
<script src="./component/pear/pear.js"></script>
<script src="./js/jquery-3.6.0.min.js"></script>
<script src="./js/jquery.cookie.min.js"></script>
<script>
layui.use(["popup"], function () {
var dropdown = layui.dropdown;
var table = layui.table;
var tabs = layui.tabs;
var form = layui.form;
var popup = layui.popup;
if ($.cookie("person_id") && $.cookie("identity_id")) {
console.log("已登录!");
} else {
$.cookie("person_id", null);
$.cookie("identity_id", null);
window.location.href = "./login.html";
}
dropdown.render({
elem: "#dropdown-text",
data: [
{
title: "修改密码",
id: 100,
},
{
title: "退出登录",
id: 101,
},
],
click: function (obj) {
if (obj.id === 100) {
layer.open({
type: 2,
title: "修改密码",
shade: 0.1,
area: ["650px", "230px"],
content: "./changePwd.html",
});
} else {
popup.success("注销成功", function () {
$.cookie("person_id", null);
$.cookie("identity_id", null);
window.location.href = "./login.html";
});
}
},
});
renderXxTable();
function renderXxTable() {
table.render({
elem: "#xx-table",
id: "xxTable",
url: "/dsideal_yy/ypt/intellioa/schoolDistrict/schoolDistrictBack/list?stage=小学",
request: {
pageName: "page_number", // 页码的参数名称默认page
limitName: "page_size", // 每页数据条数的参数名默认limit
},
cols: [
[
//标题栏
{
title: "序号",
align: "center",
width: "5%",
type: "numbers",
},
{ field: "school_name", title: "学校", width: "30%" },
{ field: "police_station", title: "派出所", width: "20%" },
{ field: "jw", title: "汉字街委", width: "30%" },
{
title: "操作",
toolbar: "#xx_table_bar",
align: "center",
width: "14%",
},
],
],
height: "full-190",
page: {
limit: 15,
layout: ["count", "prev", "page", "next", "skip"],
prev: "上一页",
next: "下一页",
},
skin: "line", // 表格风格
toolbar: "#xx_table_toolbar",
defaultToolbar: [],
parseData: function (res) {
return {
code: "0", // 解析接口状态
msg: res.message, // 解析提示文本
count: res.data.total_row, // 解析数据长度
data: res.data.list, // 解析数据列表
};
},
});
}
renderCzTable();
function renderCzTable() {
table.render({
elem: "#cz-table",
id: "czTable",
url: "/dsideal_yy/ypt/intellioa/schoolDistrict/schoolDistrictBack/list?stage=中学",
request: {
pageName: "page_number", // 页码的参数名称默认page
limitName: "page_size", // 每页数据条数的参数名默认limit
},
cols: [
[
//标题栏
{
title: "序号",
align: "center",
width: "5%",
type: "numbers",
},
{ field: "school_name", title: "学校", width: "30%" },
{ field: "police_station", title: "派出所", width: "20%" },
{ field: "jw", title: "汉字街委", width: "30%" },
{
title: "操作",
toolbar: "#cz_table_bar",
align: "center",
width: "14%",
},
],
],
height: "full-190",
page: {
limit: 15,
layout: ["count", "prev", "page", "next", "skip"],
prev: "上一页",
next: "下一页",
},
skin: "line", // 表格风格
toolbar: "#cz_table_toolbar",
defaultToolbar: [],
parseData: function (res) {
return {
code: "0", // 解析接口状态
msg: res.message, // 解析提示文本
count: res.data.total_row, // 解析数据长度
data: res.data.list, // 解析数据列表
};
},
});
}
table.on("tool(xxTable)", function (obj) {
if (obj.event === "xx_edit") {
console.log(obj);
updateSchool("xx", obj.data.id);
} else if (obj.event === "xx_remove") {
layer.confirm(
"确定要删除该吗?",
{
icon: 3,
title: "提示",
},
function (index) {
layer.close(index);
delSchool("xx", obj.data.id);
}
);
}
});
table.on("tool(czTable)", function (obj) {
if (obj.event === "cz_edit") {
updateSchool("cz", obj.data.id);
} else if (obj.event === "cz_remove") {
layer.confirm(
"确定要删除该吗?",
{
icon: 3,
title: "提示",
},
function (index) {
layer.close(index);
delSchool("cz", obj.data.id);
}
);
}
});
table.on("toolbar(xxTable)", function (obj) {
if (obj.event === "xx_add") {
addSchool("xx");
} else if (obj.event === "xx_import") {
batchImport("xx");
}
});
table.on("toolbar(czTable)", function (obj) {
if (obj.event === "cz_add") {
addSchool("cz");
} else if (obj.event === "cz_import") {
batchImport("cz");
}
});
function addSchool(stage) {
layer.open({
type: 2,
title: "新增",
shade: 0.1,
area: ["650px", "280px"],
content: "./add.html?stage=" + stage,
});
}
function updateSchool(stage, id) {
layer.open({
type: 2,
title: "编辑",
shade: 0.1,
area: ["650px", "280px"],
content: "./update.html?stage=" + stage + "&id=" + id,
});
}
function delSchool(stage, id) {
$.ajax({
url: "/dsideal_yy/ypt/intellioa/schoolDistrict/schoolDistrictBack/delete",
data: { id },
type: "post",
dataType: "json",
success: function (result) {
console.log(result);
if (result.code === 2000) {
layer.msg(
"删除成功!",
{
icon: 1,
time: 1000,
},
function () {
if (stage === "xx") {
table.reload("xxTable");
} else {
table.reload("czTable");
}
}
);
} else {
layer.msg(result.msg, {
icon: 2,
time: 1000,
});
}
},
error: function (xhr, status, error) {
layer.close(loading);
console.log("请求出错:" + error + "," + status);
},
});
}
function batchImport(stage) {
layer.open({
type: 2,
title: "批量导入",
shade: 0.1,
area: ["550px", "240px"],
content: "./import.html?stage=" + stage,
});
}
form.on("input-affix(xx_search)", function (data) {
table.reloadData("xxTable", {
where: {
search_info: $("#xx_keyword").val(),
},
scrollPos: true,
});
return false;
});
form.on("input-affix(cz_search)", function (data) {
table.reloadData("czTable", {
where: {
search_info: $("#cz_keyword").val(),
},
scrollPos: true,
});
return false;
});
tabs.on("afterChange(stageTabs)", function (data) {
if (data.index === 0) {
table.resize("xxTable");
} else if (data.index === 1) {
table.resize("czTable");
}
});
});
</script>
</body>
</html>