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.

399 lines
16 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>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="../../../component/pear/css/pear.css" />
<link rel="stylesheet" href="../iconfont/iconfont.css" />
<style>
.layui-progress-text {
position: relative;
top: -27px;
line-height: 18px;
font-size: 12px;
color: #5f5f5f;
}
.layui-progress {
position: relative;
height: 11px;
border-radius: 20px;
background-color: #eee;
}
.layui-progress-bar {
position: absolute;
left: 0;
top: 0;
width: 0;
max-width: 100%;
height: 11px;
border-radius: 20px;
text-align: right;
background-color: #16b777;
transition: all .3s;
-webkit-transition: all .3s;
}
</style>
</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>
</div>
</div>
</div>
<div class="layui-card">
<div class="layui-card-body">
<table id="data-table"></table>
<script type="text/html" id="progress-Templet">
{{# if(d.publish_state === 1){ }}
<div class="layui-progress" lay-showpercent="true" style="margin-top: 18px;cursor: pointer;" onclick='progress("{{= d.job_id }}","{{= d.total_count }}","{{= d.finish_count }}")'>
<div class="layui-progress-bar" lay-percent="{{= d.finish_count }} / {{= d.total_count }}"></div>
</div>
{{# } else { }}
{{= d.fill_progress }}
{{# } }}
</script>
<script type="text/html" id="jobName-Templet">
{{d.job_name}}
{{#if (d.jiezhi == true) { }}
<img src="../imgs/yjz.svg" style="max-width: 50px;margin-top: -9px;margin-left: 10px;">
{{# } }}
</script>
</div>
</div>
<script type="text/html" id="table-toolbar">
<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="createTask">
<i class="layui-icon layui-icon-add-1"></i>
新建任务
</button>
</script>
<script type="text/html" id="table-bar">
{{# if(d.publish_state === 0){ }}
<button type="button" class="layui-btn layui-btn-sm" title="发布" lay-event="publish">
<i class="iconfont icon-fabu"></i>
</button>
{{# if(d.is_clone === 0){ }}
<button type="button" class="layui-btn layui-btn-sm" title="修改" lay-event="update">
<i class="iconfont icon-xiugai"></i>
</button>
{{# } }}
{{# } }}
<button type="button" class="layui-btn layui-btn-sm" title="重命名" lay-event="rename">
<i class="iconfont icon-zhongmingming"></i>
</button>
{{# 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>
<button type="button" class="layui-btn layui-btn-sm" title="导出表结构" lay-event="exportStruct">
<i class="iconfont icon-shujiegou"></i>
</button>
{{# } }}
<button type="button" class="layui-btn layui-btn-sm" title="导出原始Excel" lay-event="export">
<i class="iconfont icon-daochu"></i>
</button>
{{# if(d.publish_state === 0){ }}
<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" title="删除" lay-event="del">
<i class="iconfont icon-shanchu"></i>
</button>
{{# } }}
</script>
<script src="../../../component/layui/layui.js"></script>
<script src="../../../component/pear/pear.js"></script>
<script src="../../../component/pear/base64.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;
var element = layui.element;
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',
url: '/QingLong/collect/getJobList',
where: {
job_name: $("#task_name").val()
},
height: 'full-130',
page: {
limit: 15
, layout: ['count', 'prev', 'page', 'next', 'skip']
, prev: "上一页"
, next: "下一页"
},
cols: [[
{ title: '序号', align: 'center', width: "3%", type: 'numbers' },
{ title: '任务名称', align: 'left', templet: '#jobName-Templet' },
{ 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%" },
{ title: '填报进度', align: 'center', width: "10%", templet: '#progress-Templet' },
{ 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' }
]],
skin: 'line',
toolbar: '#table-toolbar',
defaultToolbar: [],
done: function () {
element.render();
}
});
}
table.on('tool(data-table)', function (obj) {
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);
} else if (obj.event === 'postpone') {
window.postpone(obj);
} else if (obj.event === 'del') {
window.del(obj);
} else if (obj.event === 'exportStruct') {
window.exportStruct(obj);
}
});
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
});
}
window.publish = function (obj) {
if (obj.data.is_save === 1) {
layer.open({
type: 2,
title: '发布任务',
shade: 0.1,
area: ['860px', '730px'],
content: './publish.html?job_id=' + obj.data.job_id
});
}
else {
layer.msg('该任务尚未保存,请在修改中进行保存!', {
icon: 3,
time: 3000
});
}
}
window.update = function (obj) {
window.location = "./fields_set.html?job_id=" + obj.data.job_id;
}
window.rename = function (obj) {
layer.open({
type: 2,
title: '重命名',
shade: 0.1,
area: ['450px', '200px'],
content: './rename_task.html?job_id=' + obj.data.job_id + '&job_name=' + Base64.encode(obj.data.job_name)
});
}
window.postpone = function (obj) {
layer.open({
type: 2,
title: '延长截止时间',
shade: 0.1,
area: ['450px', '400px'],
content: './postpone.html?job_id=' + obj.data.job_id
});
}
window.export = function (obj) {
openDownloadDialog("/QingLong/Excel/" + obj.data.upload_excel_filename, obj.data.job_name + ".xlsx");
// window.location = "/QingLong/Excel/" + obj.data.upload_excel_filename;
}
window.exportStruct = function (obj) {
window.location = "/QingLong/collect/exportTableStructExcel?job_id=" + obj.data.job_id;
}
window.copy = function (obj) {
layer.open({
type: 2,
title: '复制任务',
shade: 0.1,
area: ['450px', '200px'],
content: './clone_task.html?job_id=' + obj.data.job_id + '&job_name=' + Base64.encode(obj.data.job_name)
});
}
window.del = function (obj) {
layer.confirm('确定要删除该任务吗?', {
icon: 3,
title: '提示'
}, function (index) {
layer.close(index);
let loading = layer.load();
$.ajax({
url: "/QingLong/collect/delJob",
data: { job_id: obj.data.job_id },
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
});
}
}
});
});
}
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'
});
}
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 () {
window.location = "./upload_excel.html";
}
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);
}
}
});
</script>
</body>
</html>