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.

368 lines
15 KiB

2 years ago
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="../../../component/pear/css/pear.css" />
2 years ago
<link rel="stylesheet" href="../iconfont/iconfont.css" />
2 years ago
2 years ago
</head>
<body class="pear-container layui-form">
<div class="layui-card" style="margin-bottom: 10px !important;">
<div class="layui-card-body">
<div class="layui-form-item" style="margin: 10px 0 5px 0 !important;">
<div class="layui-form-item layui-inline">
<label class="layui-form-label" style="width: auto;">任务名称:</label>
<div class="layui-input-inline">
<input type="text" id="task_name" lay-affix="clear" lay-filter="clear" placeholder="请输入任务名称"
class="layui-input">
</div>
</div>
<div class="layui-form-item layui-inline">
<button class="pear-btn pear-btn-md pear-btn-primary" lay-submit lay-filter="user-query">
<i class="layui-icon layui-icon-search"></i>
查询
</button>
</div>
2 years ago
2 years ago
</div>
</div>
</div>
<div class="layui-card">
<div class="layui-card-body">
2 years ago
<table id="data-table"></table>
2 years ago
<script type="text/html" id="progress-Templet">
2 years ago
{{# if(d.publish_state === 1){ }}
2 years ago
<div class="layui-progress layui-progress-big" lay-filter="fill_progress" lay-showpercent="true" style="margin-top: 8px;cursor: pointer;" onclick='progress("{{= d.job_id }}","{{= d.total_count }}","{{= d.finish_count }}")'>
2 years ago
<div class="layui-progress-bar" lay-percent="{{= d.fill_progress }}"></div>
</div>
2 years ago
{{# } else { }}
{{= d.fill_progress }}
2 years ago
{{# } }}
</script>
2 years ago
<script type="text/html" id="jobName-Templet">
{{d.job_name}}
{{#if (d.jiezhi == true) { }}
2 years ago
<img src="../imgs/yjz.svg" style="max-width: 50px;margin-top: -9px;margin-left: 10px;">
2 years ago
{{# } }}
</script>
2 years ago
</div>
</div>
<script type="text/html" id="table-toolbar">
2 years ago
<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="createTask">
<i class="layui-icon layui-icon-add-1"></i>
新建任务
</button>
</script>
2 years ago
<script type="text/html" id="table-bar">
2 years ago
{{# if(d.publish_state === 0){ }}
<button type="button" class="layui-btn layui-btn-sm" title="发布" lay-event="publish">
2 years ago
<i class="iconfont icon-fabu"></i>
2 years ago
</button>
2 years ago
{{# if(d.is_clone === 0){ }}
<button type="button" class="layui-btn layui-btn-sm" title="修改" lay-event="update">
2 years ago
<i class="iconfont icon-xiugai"></i>
2 years ago
</button>
{{# } }}
2 years ago
2 years ago
{{# } }}
2 years ago
<button type="button" class="layui-btn layui-btn-sm" title="重命名" lay-event="rename">
<i class="iconfont icon-zhongmingming"></i>
</button>
2 years ago
2 years ago
{{# if(d.publish_state === 1){ }}
<button type="button" class="layui-btn layui-btn-sm" title="延期" lay-event="postpone">
<i class="iconfont icon-delay_completed"></i>
</button>
<button type="button" class="layui-btn layui-btn-sm" title="复制" lay-event="copy">
<i class="iconfont icon-fuzhi"></i>
</button>
2 years ago
<button type="button" class="layui-btn layui-btn-sm" title="导出表结构" lay-event="exportStruct">
2 years ago
<i class="iconfont icon-shujiegou"></i>
2 years ago
</button>
2 years ago
{{# } }}
2 years ago
2 years ago
<button type="button" class="layui-btn layui-btn-sm" title="导出原始Excel" lay-event="export">
<i class="iconfont icon-daochu"></i>
</button>
2 years ago
2 years ago
{{# if(d.publish_state === 0){ }}
2 years ago
<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" title="删除" lay-event="del">
<i class="iconfont icon-shanchu"></i>
</button>
2 years ago
{{# } }}
2 years ago
</script>
2 years ago
<script src="../../../component/layui/layui.js"></script>
<script src="../../../component/pear/pear.js"></script>
<script>
layui.use(['table', 'form', 'jquery', 'common', 'dtree', 'laytpl'], function () {
var table = layui.table;
var form = layui.form;
var $ = layui.jquery;
var common = layui.common;
var laytpl = layui.laytpl;
2 years ago
var element = layui.element;
2 years ago
tableRender();
form.on('submit(user-query)', function () {
tableRender();
return false;
});
form.on('input-affix(clear)', function (data) {
tableRender();
});
function tableRender() {
table.render({
elem: '#data-table',
2 years ago
url: '/QingLong/collect/getJobList',
2 years ago
where: {
2 years ago
job_name: $("#task_name").val()
2 years ago
},
2 years ago
height: 'full-130',
2 years ago
page: {
limit: 15
, layout: ['count', 'prev', 'page', 'next', 'skip']
, prev: "上一页"
, next: "下一页"
},
cols: [[
2 years ago
{ title: '序号', align: 'center', width: "3%", type: 'numbers' },
2 years ago
{ title: '任务名称', align: 'left', templet: '#jobName-Templet' },
2 years ago
{ title: '发布时间', field: 'publish_time', align: 'center', width: "10%" },
{ title: '截止时间', field: 'deadline_time', align: 'center', width: "10%" },
{ title: '填报格式', field: 'job_type_name', align: 'center', width: "10%" },
2 years ago
{ title: '填报进度', align: 'center', width: "10%", templet: '#progress-Templet' },
2 years ago
{ title: '保存状态', field: 'is_save_name', align: 'center', width: "8%" },
{ title: '发布状态', field: 'publish_state_name', align: 'center', width: "8%" },
{ title: '操作', align: 'left', width: "18%", toolbar: '#table-bar' }
2 years ago
]],
skin: 'line',
toolbar: '#table-toolbar',
2 years ago
defaultToolbar: [],
2 years ago
done: function () {
2 years ago
element.render();
}
2 years ago
});
}
table.on('tool(data-table)', function (obj) {
2 years ago
if (obj.event === 'publish') {
window.publish(obj);
} else if (obj.event === 'update') {
window.update(obj);
} else if (obj.event === 'rename') {
window.rename(obj);
} else if (obj.event === 'export') {
window.export(obj);
} else if (obj.event === 'copy') {
window.copy(obj);
2 years ago
} else if (obj.event === 'postpone') {
window.postpone(obj);
2 years ago
} else if (obj.event === 'del') {
window.del(obj);
2 years ago
} else if (obj.event === 'exportStruct') {
2 years ago
window.exportStruct(obj);
2 years ago
}
});
2 years ago
window.progress = function (job_id, total_count, finish_count) {
layer.open({
type: 2,
title: '填报进度( <span style="color: #16BAAA;font-weight: bolder;">已填报 ' + finish_count + '</span> / 应填报 ' + total_count + ' ',
shadeClose: true,
shade: false,
maxmin: false,
move: false,
area: ['100%', '100%'],
content: "./task_view.html?job_id=" + job_id
});
}
2 years ago
window.publish = function (obj) {
2 years ago
if (obj.data.is_save === 1) {
2 years ago
layer.open({
type: 2,
title: '发布任务',
shade: 0.1,
area: ['860px', '730px'],
content: './publish.html?job_id=' + obj.data.job_id
});
}
else {
2 years ago
layer.msg('该任务尚未保存,请在修改中进行保存!', {
2 years ago
icon: 3,
time: 3000
});
}
2 years ago
}
window.update = function (obj) {
2 years ago
window.location = "./fields_set.html?job_id=" + obj.data.job_id;
2 years ago
}
window.rename = function (obj) {
2 years ago
layer.open({
type: 2,
title: '重命名',
shade: 0.1,
area: ['450px', '230px'],
content: './rename_task.html?job_id=' + obj.data.job_id
});
}
2 years ago
2 years ago
window.postpone = function (obj) {
layer.open({
type: 2,
title: '延长截止时间',
shade: 0.1,
area: ['450px', '400px'],
content: './postpone.html?job_id=' + obj.data.job_id
});
2 years ago
}
window.export = function (obj) {
2 years ago
openDownloadDialog("/QingLong/Excel/" + obj.data.upload_excel_filename, obj.data.job_name + ".xlsx");
// window.location = "/QingLong/Excel/" + obj.data.upload_excel_filename;
2 years ago
}
2 years ago
window.exportStruct = function (obj) {
2 years ago
window.location = "/QingLong/collect/exportTableStructExcel?job_id=" + obj.data.job_id;
}
2 years ago
window.copy = function (obj) {
2 years ago
layer.open({
type: 2,
title: '复制任务',
shade: 0.1,
area: ['450px', '230px'],
content: './clone_task.html?job_id=' + obj.data.job_id
});
2 years ago
}
window.del = function (obj) {
2 years ago
layer.confirm('确定要删除该任务吗?', {
2 years ago
icon: 3,
title: '提示'
}, function (index) {
layer.close(index);
let loading = layer.load();
$.ajax({
2 years ago
url: "/QingLong/collect/delJob",
data: { job_id: obj.data.job_id },
2 years ago
type: 'post',
success: function (result) {
layer.close(loading);
if (result.success) {
layer.msg('成功删除!', {
icon: 1,
time: 1000
}, function () {
table.reload('data-table');
});
} else {
layer.msg(result.message, {
icon: 2,
time: 1000
});
}
}
2 years ago
});
2 years ago
});
}
2 years ago
table.on('toolbar(data-table)', function (obj) {
if (obj.event === 'createTask') {
window.createTask();
}
});
window.createTask = function () {
layer.open({
type: 2,
title: '选择填报格式',
shade: 0.1,
area: ['450px', '250px'],
content: './format_select.html'
});
2 years ago
}
2 years ago
window.refresh = function (param) {
table.reload('data-table');
}
function GetQueryString(name, istop) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (typeof (istop) != "undefined") r = top.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
}
window.openExcelCreatePage = function () {
2 years ago
window.location = "./upload_excel.html";
2 years ago
}
2 years ago
function openDownloadDialog(url, saveName) {
if (window.navigator.msSaveBlob) {
try {
//创建XMLHttpRequest对象
var xhr = new XMLHttpRequest();
//配置请求方式、请求地址以及是否同步
xhr.open('POST', url, true);
//设置请求结果类型为blob
xhr.responseType = 'blob';
//请求成功回调函数
xhr.onload = function (e) {
if (this.status == 200) {//请求成功
//获取blob对象
var blob = this.response;
//获取blob对象地址并把值赋给容器
window.navigator.msSaveBlob(blob, saveName);
}
};
xhr.send();
} catch (e) {
console.log(e);
}
} else {
if (typeof url == 'object' && url instanceof Blob) {
url = URL.createObjectURL(url); // 创建blob地址
}
var aLink = document.createElement('a');
aLink.href = url;
aLink.download = saveName || '';
var event;
if (window.MouseEvent) {
event = new MouseEvent('click');
}
else {
event = document.createEvent('MouseEvents');
event.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
}
aLink.dispatchEvent(event);
}
}
2 years ago
});
</script>
</body>
</html>