Merge branch 'main' of http://10.10.14.176:3000/huanghai/ccDangJianExam
commit
08c284256a
@ -0,0 +1,261 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title></title>
|
||||
<link rel="stylesheet" href="../component/pear/css/pear.css" />
|
||||
</head>
|
||||
|
||||
<body class="pear-container">
|
||||
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<table id="task-table" lay-filter="task-table"></table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="task-toolbar">
|
||||
<button class="layui-btn" lay-event="add">
|
||||
<i class="layui-icon layui-icon-add-1"></i>
|
||||
导出EXCEL
|
||||
</button>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="tableOperate">
|
||||
{{# if(d.is_run === 0){ }}
|
||||
<button class="pear-btn pear-btn-warming pear-btn-sm" lay-event="start" title="启动"><i class="icon pear-icon pear-icon-setting"></i>
|
||||
</button>
|
||||
{{# } }}
|
||||
{{# if(d.is_run > 0){ }}
|
||||
<button class="pear-btn pear-btn-warming pear-btn-sm" lay-event="stop" title="停止"><i class="icon pear-icon pear-icon-stop"></i>
|
||||
</button>
|
||||
{{# } }}
|
||||
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="edit" title="编辑"><i class="layui-icon layui-icon-edit"></i>
|
||||
</button>
|
||||
<button class="pear-btn pear-btn-sm" lay-event="view" title="查看报名情况"><i class="layui-icon layui-icon-form"></i>
|
||||
</button>
|
||||
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="export" title="导出报名情况"><i class="icon pear-icon pear-icon-share
|
||||
"></i>
|
||||
</button>
|
||||
|
||||
|
||||
<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="remove" title="删除"><i class="layui-icon layui-icon-delete"></i>
|
||||
</button>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="taskFill">
|
||||
{{# if(d.fill_count === 0){ }}
|
||||
<span>{{ d.fill_count }}</span>
|
||||
{{# } else { }}
|
||||
<span style="cursor:pointer;" lay-event="taskFillInfo">{{ d.fill_count }}</span>
|
||||
{{# } }}
|
||||
</script>
|
||||
|
||||
<script src="../component/layui/layui.js"></script>
|
||||
<script src="../component/pear/pear.js"></script>
|
||||
|
||||
<script>
|
||||
layui.use(['table', 'form', 'jquery', 'common'], function () {
|
||||
let table = layui.table;
|
||||
let form = layui.form;
|
||||
let $ = layui.jquery;
|
||||
let common = layui.common;
|
||||
|
||||
let cols = [
|
||||
[
|
||||
{ field: '', title: '序号', align: 'center', type: 'numbers', width: "5%" }
|
||||
, { field: 'task_name', title: '任务名称', align: 'center' }
|
||||
, { field: 'create_time', title: '创建时间', align: 'center', width: "10%" }
|
||||
, { field: '', title: '状态', align: 'center', width: "10%", templet: getPublishText }
|
||||
, { field: '', title: '操作', toolbar: '#tableOperate', align: 'center', width: "25%" }
|
||||
]
|
||||
]
|
||||
|
||||
tableRender()
|
||||
|
||||
function tableRender() {
|
||||
table.render({
|
||||
elem: '#task-table',
|
||||
url: '/FengHuang/yp/listTask',
|
||||
page: {
|
||||
limit: 15
|
||||
, layout: ['count', 'prev', 'page', 'next', 'skip']
|
||||
, prev: "上一页"
|
||||
, next: "下一页"
|
||||
},
|
||||
cols: cols,
|
||||
skin: 'line',
|
||||
defaultToolbar: []
|
||||
});
|
||||
}
|
||||
|
||||
table.on('tool(task-table)', function (data) {
|
||||
if (data.event === 'start') {
|
||||
startTask(data.data.task_id);
|
||||
} else if (data.event === 'stop') {
|
||||
stopTask(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 === 'view') {
|
||||
taskView(data.data.task_id);
|
||||
} else {
|
||||
window.location = "/FengHuang/yp/exportExcel?task_id=" + data.data.task_id;
|
||||
}
|
||||
});
|
||||
|
||||
table.on('toolbar(task-table)', function (data) {
|
||||
if (data.event === 'add') {
|
||||
window.taskAdd();
|
||||
}
|
||||
});
|
||||
|
||||
// 新增任务
|
||||
window.taskAdd = function () {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '新增任务',
|
||||
shade: 0.1,
|
||||
area: ['830px', '500px'],
|
||||
content: './taskManageAdd.html'
|
||||
});
|
||||
}
|
||||
|
||||
// 编辑任务
|
||||
window.taskEdit = function (taskId) {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '编辑任务',
|
||||
shade: 0.1,
|
||||
area: ['830px', '500px'],
|
||||
content: './taskManageEdit.html?task_id=' + taskId
|
||||
});
|
||||
}
|
||||
|
||||
// 删除任务
|
||||
window.taskRemove = function (taskId) {
|
||||
layer.confirm('确定要删除该任务?', {
|
||||
icon: 3,
|
||||
title: '提示'
|
||||
}, function (index) {
|
||||
$.ajax({
|
||||
url: "/FengHuang/yp/delTask",
|
||||
data: { "task_id": taskId },
|
||||
type: 'POST',
|
||||
success: function (result) {
|
||||
if (result.success) {
|
||||
layer.msg("删除成功!", {
|
||||
icon: 1,
|
||||
time: 1000
|
||||
}, function () {
|
||||
refresh();
|
||||
});
|
||||
} else {
|
||||
layer.msg(result.msg, {
|
||||
icon: 2,
|
||||
time: 1000
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
// 启动任务
|
||||
window.startTask = function (taskId) {
|
||||
layer.confirm('启动该任务会自动停止其他任务,确定要启动任务吗?', {
|
||||
icon: 3,
|
||||
title: '提示'
|
||||
}, function (index) {
|
||||
$.ajax({
|
||||
url: "/FengHuang/yp/startTask",
|
||||
data: { "task_id": taskId },
|
||||
type: 'post',
|
||||
success: function (result) {
|
||||
if (result.success) {
|
||||
layer.msg("启动成功!", {
|
||||
icon: 1,
|
||||
time: 1500
|
||||
}, function () {
|
||||
refresh();
|
||||
});
|
||||
} else {
|
||||
layer.msg(result.message, {
|
||||
icon: 2,
|
||||
time: 1000
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 停止任务
|
||||
window.stopTask = function (taskId) {
|
||||
layer.confirm('确定要停止任务吗?', {
|
||||
icon: 3,
|
||||
title: '提示'
|
||||
}, function (index) {
|
||||
$.ajax({
|
||||
url: "/FengHuang/yp/stopTask",
|
||||
data: { "task_id": taskId },
|
||||
type: 'post',
|
||||
success: function (result) {
|
||||
if (result.success) {
|
||||
layer.msg("停止成功!", {
|
||||
icon: 1,
|
||||
time: 1500
|
||||
}, function () {
|
||||
refresh();
|
||||
});
|
||||
} else {
|
||||
layer.msg(result.message, {
|
||||
icon: 2,
|
||||
time: 1000
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 查看填报情况
|
||||
window.taskView = function (taskId) {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '查看报名情况',
|
||||
shade: 0.1,
|
||||
shade: false,
|
||||
maxmin: false,
|
||||
move: false,
|
||||
area: ['100%', '100%'],
|
||||
content: './taskView.html?task_id=' + taskId
|
||||
});
|
||||
}
|
||||
|
||||
// 弹出窗口用
|
||||
window.parentTableRender = function () {
|
||||
refresh();
|
||||
}
|
||||
|
||||
window.refresh = function (param) {
|
||||
table.reload('task-table');
|
||||
}
|
||||
|
||||
function getPublishText(data) {
|
||||
if (data.is_run === 0) {
|
||||
return "<span style='color:red;'>已停止</span>";
|
||||
} else {
|
||||
return "<span style='color:green;'>已启动</span>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
Binary file not shown.
Loading…
Reference in new issue