parent
e3b0ec98d7
commit
66e227fe31
@ -0,0 +1,35 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>添加任务</title>
|
||||
<link rel="stylesheet" href="https://cdn.staticfile.org/layui/2.5.7/css/layui.min.css">
|
||||
<script src="https://cdn.staticfile.org/jquery/3.6.0/jquery.min.js"></script>
|
||||
<script src="https://cdn.staticfile.org/layui/2.5.7/layui.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<form class="layui-form" action="">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">任务名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="taskName" required lay-verify="required" placeholder="请输入任务名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="addTask">提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<script>
|
||||
//监听提交
|
||||
form.on('submit(addTask)', function(data){
|
||||
layer.alert(JSON.stringify(data.field), {
|
||||
title: '任务信息'
|
||||
});
|
||||
return false;
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,241 @@
|
||||
<!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="pear-btn pear-btn-primary pear-btn-md" lay-event="add">
|
||||
<i class="layui-icon layui-icon-add-1"></i>
|
||||
新增
|
||||
</button>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="tableOperate">
|
||||
{{# if(d.is_publish === 0){ }}
|
||||
<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-warming pear-btn-sm" lay-event="publish" title="发布"><i class="icon pear-icon pear-icon-share"></i>
|
||||
</button>
|
||||
{{# } }}
|
||||
{{# if(d.fill_count > 0){ }}
|
||||
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="taskFillInfo" title="查看填报情况"><i class="layui-icon layui-icon-form"></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: 'module_name', title: '所用模板名称', align: 'center' }
|
||||
, { field: 'create_time', title: '创建时间', align: 'center', width: "10%" }
|
||||
, { field: 'end_date', title: '结束时间', align: 'center', width: "10%" }
|
||||
, { field: 'all_count', title: '应填报数', align: 'center', width: "10%" }
|
||||
, { field: 'fill_count', title: '已填报数', align: 'center', width: "10%" }
|
||||
// , { field: '', title: '已填报数', align: 'center', width: "10%", templet: '#taskFill' }
|
||||
, { field: '', title: '发布状态', align: 'center', width: "10%", templet: getPublishText }
|
||||
, { field: '', title: '操作', toolbar: '#tableOperate', align: 'center', width: "15%" }
|
||||
]
|
||||
]
|
||||
|
||||
tableRender()
|
||||
|
||||
function tableRender() {
|
||||
table.render({
|
||||
elem: '#task-table',
|
||||
url: '/Mars/listTask',
|
||||
where: {
|
||||
keyword: $("#templateName").val()
|
||||
},
|
||||
page: {
|
||||
limit: 15
|
||||
, layout: ['count', 'prev', 'page', 'next', 'skip']
|
||||
, prev: "上一页"
|
||||
, next: "下一页"
|
||||
},
|
||||
cols: cols,
|
||||
skin: 'line',
|
||||
toolbar: '#task-toolbar',
|
||||
defaultToolbar: []
|
||||
});
|
||||
}
|
||||
|
||||
table.on('tool(task-table)', 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();
|
||||
});
|
||||
|
||||
form.on('submit(task-reset)', function (data) {
|
||||
$("#templateName").val("");
|
||||
});
|
||||
|
||||
// 新增任务
|
||||
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
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
// 发布任务
|
||||
window.taskPublish = function (taskId) {
|
||||
layer.confirm('确定要发布任务?', {
|
||||
icon: 3,
|
||||
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
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 查看填报情况
|
||||
window.taskFillInfo = function (taskId, moduleId) {
|
||||
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>
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
Reference in new issue