黄海 2 years ago
commit b954aafccb

@ -9,11 +9,12 @@
</head> </head>
<body class="pear-container layui-form"> <body class="pear-container layui-form">
<h1 class="title" style="text-align: center;margin-top: 10px;" id="title"></h1> <!-- <h1 class="title" style="text-align: center;margin-top: 10px;" id="title"></h1> -->
<div class="layui-card" <div class="layui-card"
style="width: 700px;position: absolute;top: 50%;left: 50%;transform: translate(-50%, -50%);-webkit-transform: translate(-50%, -50%);-moz-transform: translate(-50%, -50%); "> style="width: 700px;position: absolute;top: 50%;left: 50%;transform: translate(-50%, -50%);-webkit-transform: translate(-50%, -50%);-moz-transform: translate(-50%, -50%); ">
<div class="layui-card-header">报名申请表</div> <h1 class="title" style="text-align: center;margin: 15px 0 10px 0;" id="title"></h1>
<div class="layui-card-body"> <div class="layui-card-body">
<div style="margin: 5px 0 25px 0"> <div style="margin: 5px 0 25px 0">
<label class="layui-form-label" style="width: 85px;"> <label class="layui-form-label" style="width: 85px;">

@ -113,37 +113,48 @@
var bxids = ""; var bxids = "";
var limits = ""; var limits = "";
var flag = true;
Object.keys(data.field).forEach((key) => { Object.keys(data.field).forEach((key) => {
if (key === "taskName") { if (key === "taskName") {
taskName = data.field[key]; taskName = data.field[key];
} else { } else {
bxids += key + "," bxids += key + ","
if (data.field[key] == 0) {
layer.msg("人数限制必须大于0", {
icon: 2,
time: 2000
});
flag = false;
}
limits += data.field[key] + "," limits += data.field[key] + ","
} }
}); });
$.ajax({ if (flag) {
url: "/FengHuang/yp/addTask", $.ajax({
data: { "task_name": taskName, "bx_ids": bxids.substr(0, bxids.length - 1), "limits": limits.substr(0, limits.length - 1) }, url: "/FengHuang/yp/addTask",
type: 'POST', data: { "task_name": taskName, "bx_ids": bxids.substr(0, bxids.length - 1), "limits": limits.substr(0, limits.length - 1) },
success: function (result) { type: 'POST',
if (result.success) { success: function (result) {
layer.msg("成功!", { if (result.success) {
icon: 1, layer.msg("成功!", {
time: 1500 icon: 1,
}, function () { time: 1500
parent.layer.close(parent.layer.getFrameIndex(window.name)); }, function () {
parent.parentTableRender(); parent.layer.close(parent.layer.getFrameIndex(window.name));
}); parent.parentTableRender();
} else { });
layer.msg(result.message, { } else {
icon: 2, layer.msg(result.message, {
time: 1000 icon: 2,
}); time: 1000
});
}
} }
} });
}); }
return false; return false;
}); });

@ -63,7 +63,7 @@
, { field: 'task_name', title: '任务名称', align: 'center' } , { field: 'task_name', title: '任务名称', align: 'center' }
, { field: 'create_time', title: '创建时间', align: 'center', width: "10%" } , { field: 'create_time', title: '创建时间', align: 'center', width: "10%" }
, { field: '', title: '状态', align: 'center', width: "10%", templet: getPublishText } , { field: '', title: '状态', align: 'center', width: "10%", templet: getPublishText }
, { field: '', title: '操作', toolbar: '#tableOperate', align: 'center', width: "15%" } , { field: '', title: '操作', toolbar: '#tableOperate', align: 'center', width: "25%" }
] ]
] ]

@ -7,28 +7,22 @@
<link rel="stylesheet" href="../../component/pear/css/pear.css" /> <link rel="stylesheet" href="../../component/pear/css/pear.css" />
</head> </head>
<body class="pear-container"> <body class="layui-form">
<div class="layui-card"> <div class="layui-card">
<div class="layui-card-body"> <div class="layui-card-body">
<div class="layui-inline" style="margin: 5px 0 5px 0"> <div class="layui-inline" style="margin: 5px 0 5px 0">
<label class="layui-form-label" style="width: 75px;">班型:</label> <label class="layui-form-label" style="width: 55px;">班型:</label>
<div class="layui-input-inline" id="SelectView"></div> <div class="layui-input-inline" id="typeSelectView" style="margin-right: 8px;">
<script id="SelectScript" type="text/html"> </div>
<select name="typeSelect"> <script id="typeSelectScript" type="text/html">
{{# layui.each(d.data, function(index, item){ }} <select name="typeSelect" id="bxSelect" lay-filter="selctOnchange">
<option value="{{item.type_id}}">{{item.type_name}}</option> {{# layui.each(d, function(index, item){ }}
{{# }); }} <option value="{{item.bx_id}}">{{item.bx_name}}</option>
</select> {{# }); }}
</select>
</script> </script>
</div> </div>
<div class="layui-inline" style="margin-left: 15px">
<button class="layui-btn" lay-submit lay-filter="task-query">
<i class="layui-icon layui-icon-search"></i>
查询
</button>
</div>
</div> </div>
</div> </div>
<div class="layui-card"> <div class="layui-card">
@ -40,35 +34,38 @@
<script type="text/html" id="tableOperate"> <script type="text/html" id="tableOperate">
<button class="pear-btn pear-btn-warming pear-btn-sm" lay-event="publish" title="查看户口本照片"><i class="icon pear-icon pear-icon-picture"></i> <button class="pear-btn pear-btn-warming pear-btn-sm" lay-event="view" title="查看户口本照片"><i class="icon pear-icon pear-icon-picture"></i>
</button> </button>
</script> </script>
<script src="../../component/layui/layui.js"></script> <script src="../../component/layui/layui.js"></script>
<script src="../../component/pear/pear.js"></script> <script src="../../component/pear/pear.js"></script>
<script> <script>
layui.use(['table', 'form', 'jquery', 'common'], function () { layui.use(['table', 'laytpl', 'form', 'jquery', 'common'], function () {
let table = layui.table; let table = layui.table;
let form = layui.form; let form = layui.form;
let laytpl = layui.laytpl
let $ = layui.jquery; let $ = layui.jquery;
let common = layui.common; let common = layui.common;
let taskId = GetQueryString("task_id");
let cols = [ let cols = [
[ [
{ field: '', title: '序号', align: 'center', type: 'numbers', width: "5%" } { field: '', title: '序号', align: 'center', type: 'numbers', width: "5%" }
, { field: 'name', title: '姓名', align: 'center' } , { field: 'name', title: '姓名', align: 'center', width: "8%" }
, { field: 'xb', title: '性别', align: 'center' } , { field: 'xb', title: '性别', align: 'center', width: "5%" }
, { field: 'sfzh', title: '身份证号', align: 'center', width: "10%" } , { field: 'sfzh', title: '身份证号', align: 'center', width: "15%" }
, { field: 'bx_name', title: '报名学段', align: 'center', width: "10%" } , { field: 'bx_name', title: '报名学段', align: 'center', width: "8%" }
, { field: 'address', title: '家庭住址', align: 'center', width: "10%" } , { field: 'address', title: '家庭住址', align: 'center', width: "11%" }
, { field: 'father_name', title: '父亲姓名', align: 'center', width: "10%" } , { field: 'father_name', title: '父亲姓名', align: 'center', width: "8%" }
, { field: 'mother_name', title: '母亲姓名', align: 'center', width: "10%" } , { field: 'mother_name', title: '母亲姓名', align: 'center', width: "8%" }
, { field: 'tel', title: '联系电话', align: 'center', width: "10%" } , { field: 'tel', title: '联系电话', align: 'center', width: "10%" }
, { field: 'create_time', title: '报名日期', align: 'center', width: "10%" }
, { field: '', title: '查看户口本照片', toolbar: '#tableOperate', align: 'center', width: "10%" } , { field: '', title: '查看户口本照片', toolbar: '#tableOperate', align: 'center', width: "10%" }
] ]
] ]
@ -76,7 +73,8 @@
$.ajax({ $.ajax({
type: "GET", type: "GET",
dataType: "json", dataType: "json",
url: "/Mars/getFormTypeList", async: false,
url: "/FengHuang/yp/getTaskLimit?task_id=" + taskId,
success: function (data) { success: function (data) {
var typeSelectTpl = typeSelectScript.innerHTML, var typeSelectTpl = typeSelectScript.innerHTML,
typeSelectView = document.getElementById('typeSelectView'); typeSelectView = document.getElementById('typeSelectView');
@ -87,13 +85,12 @@
} }
}); });
tableRender() tableRender()
function tableRender() { function tableRender() {
table.render({ table.render({
elem: '#task-table', elem: '#task-table',
url: '/FengHuang/yp/getTaskInfo?task_id=17&bx_id=3&page=1&limit=10', url: '/FengHuang/yp/getTaskInfo?task_id=' + taskId + '&bx_id=' + $("#bxSelect").val() + '&page=1&limit=10',
where: { where: {
keyword: $("#templateName").val() keyword: $("#templateName").val()
}, },
@ -109,147 +106,27 @@
}); });
} }
table.on('tool(task-table)', function (data) { form.on('select(selctOnchange)', function (data) {
if (data.event === 'publish') {
taskPublish(data.data.task_id);
} else if (data.event === 'edit') {
taskEdit(data.data.task_id);
}
else if (data.event === 'remove') {
taskRemove(data.data.task_id);
} else if (data.event === 'taskFillInfo') {
if (data.data.fill_count > 0) {
taskFillInfo(data.data.task_id, data.data.module_id);
}
}
});
table.on('toolbar(task-table)', function (data) {
if (data.event === 'add') {
window.taskAdd();
}
});
form.on('submit(task-query)', function (data) {
tableRender(); tableRender();
}); });
form.on('submit(task-reset)', function (data) { table.on('tool(task-table)', function (data) {
$("#templateName").val(""); if (data.event === 'view') {
window.open('/FengHuang/' + data.data.pic);
}
}); });
// 新增任务
window.taskAdd = function () {
layer.open({
type: 2,
title: '新增任务',
shade: 0.1,
area: ['850px', '781px'],
content: './taskManageAdd.html'
});
}
// 编辑任务
window.taskEdit = function (taskId) {
layer.open({
type: 2,
title: '新增任务',
shade: 0.1,
area: ['850px', '721px'],
content: './taskManageEdit.html?task_id=' + taskId
});
}
// 删除任务
window.taskRemove = function (taskId) {
layer.confirm('确定要删除该任务?', {
icon: 3,
title: '提示'
}, function (index) {
$.ajax({
url: "/Mars/delTask",
data: { "task_id": taskId },
type: 'POST',
success: function (result) {
if (result.success) {
layer.msg(result.message, {
icon: 1,
time: 1000
}, function () {
refresh();
});
} else {
layer.msg(result.msg, {
icon: 2,
time: 1000
});
}
}
})
});
}
// 发布任务 function GetQueryString(name, istop) {
window.taskPublish = function (taskId) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
layer.confirm('确定要发布任务?', { var r = window.location.search.substr(1).match(reg);
icon: 3, if (typeof (istop) != "undefined") r = top.location.search.substr(1).match(reg);
title: '提示'
}, function (index) {
$.ajax({
url: "/Mars/publishTask",
data: { "task_id": taskId },
type: 'post',
success: function (result) {
if (result.success) {
layer.msg(result.message, {
icon: 1,
time: 1500
}, function () {
refresh();
});
} else {
layer.msg(result.message, {
icon: 2,
time: 1000
});
}
}
});
});
}
// 查看填报情况 if (r != null) return unescape(r[2]);
window.taskFillInfo = function (taskId, moduleId) { return null;
layer.open({
type: 2,
title: '查看填报情况',
shade: 0.1,
shade: false,
maxmin: false,
move: false,
area: ['100%', '100%'],
content: './taskFillInfo.html?task_id=' + taskId + '&module_id=' + moduleId
});
} }
// 弹出窗口用
window.parentTableRender = function () {
refresh();
}
window.refresh = function (param) {
table.reload('task-table');
}
function getPublishText(data) {
if (data.is_publish === 1) {
return "<span style='color:green;'>已发布</span>";
} else {
return "<span style='color:red;'>未发布</span>";
}
}
}) })
</script> </script>
</body> </body>

Loading…
Cancel
Save