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.

589 lines
25 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;
}
.layui-card-body .layui-form {
margin-top: 1px !important;
}
</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="fill-progress">
{{# if(d.publish_state === 1){ }}
{{# if(d.total_count > 0){ }}
<span style="cursor: pointer;background-color: #16BAAA;padding: 5px 10px;border-radius: 8px;color: #FFFFFF;font-weight: bolder;" onclick='fill_progress("{{= d.target_type_id }}","{{= d.job_id }}","{{= d.total_count }}","{{= d.finish_count }}","{{= d.job_type }}")'>{{= d.finish_count }} / {{= d.total_count }}</span>
{{# } else { }}
-
{{# } }}
{{# } else { }}
-
{{# } }}
</script>
<script type="text/html" id="forward-progress">
{{# if(d.publish_state === 1){ }}
{{# if(d.forward_count > 0){ }}
<span style="cursor: pointer;background-color: #16BAAA;padding: 5px 10px;border-radius: 8px;color: #FFFFFF;font-weight: bolder;" onclick='forward_progress_xiaji("{{= d.job_id }}","{{= d.forward_count }}","{{= d.forward_finish_count }}","{{= d.job_type }}")'>{{= d.forward_finish_count }} / {{= d.forward_count }}</span>
{{# } else { }}
-
{{# } }}
{{# } else { }}
-
{{# } }}
</script>
<script type="text/html" id="targetType">
{{#if (d.target_type_id == 1) { }}
单位
{{# } else { }}
人员
{{# } }}
</script>
<script type="text/html" id="jobName-Templet">
{{#if (d.job_type == 1) { }}
<img src="../imgs/form.png" title="表单" style="max-width: 16px;margin-top: -4px;">
{{# } else { }}
<img src="../imgs/excel.png" title="EXCEL模板" style="max-width: 16px;margin-top: -4px;">
{{# } }}
{{d.job_name}}
{{#if (d.jiezhi == true) { }}
<img src="../imgs/yjz.svg" style="max-width: 50px;margin-top: -9px;margin-left: 1px;">
{{# } }}
</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="publishNextLevel">
<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="导出汇总表" lay-event="exportHz">
<i class="iconfont icon-cz-hzb"></i>
</button>
{{# } }}
{{# if(d.job_type === 2){ }}
<button type="button" class="layui-btn layui-btn-sm" title="导出原始Excel" lay-event="export">
<i class="iconfont icon-daochu"></i>
</button>
{{# } else { }}
<button type="button" class="layui-btn layui-btn-sm" title="预览" lay-event="preview">
<i class="layui-icon layui-icon-eye"></i>
</button>
{{# } }}
<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', '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;
var publishNextLevel = false;
$.ajax({
url: "/QingLong/collect/canPublishNextLevel",
async: false,
type: 'GET',
success: function (res) {
if (res.success) {
publishNextLevel = res.flag;
} else {
layer.msg("获取数据异常!", {
icon: 2,
time: 1000
});
}
}, error: function (xhr, status, error) {
layer.msg("获取数据异常!", {
icon: 2,
time: 1000
});
}
});
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(),
self_or_next: 2
},
height: 'full-136',
page: {
limit: 12
, layout: ['count', 'prev', 'page', 'next', 'skip']
, prev: "上一页"
, next: "下一页"
},
cols: [[
{ title: '序号', unresize: true, align: 'center', width: "3%", type: 'numbers' },
{ title: '任务名称', unresize: true, align: 'left', templet: '#jobName-Templet' },
{ title: '发布日期', unresize: true, field: 'publish_time', align: 'center', width: "6%" },
{ title: '截止日期', unresize: true, field: 'deadline_time', align: 'center', width: "6%" },
{ title: '填报进度', unresize: true, align: 'center', width: "6%", templet: '#fill-progress' },
{ title: '转发进度', unresize: true, align: 'center', width: "6%", templet: '#forward-progress' },
{ title: '发布对象', unresize: true, align: 'center', width: "8%", templet: '#targetType' },
{ title: '保存状态', unresize: true, field: 'is_save_name', align: 'center', width: "6%" },
{ title: '发布状态', unresize: true, field: 'publish_state_name', align: 'center', width: "6%" },
{ title: '操作', unresize: true, align: 'left', width: "25%", toolbar: '#table-bar' }
]],
skin: 'line',
toolbar: '#table-toolbar',
defaultToolbar: []
// , parseData: function (res) {
// var array = res.data;
// for (var i = 0; i < array.length; i++) {
// if (publishNextLevel) {
// res.data[i].nl = 1;
// } else {
// res.data[i].nl = 0;
// }
// }
// return res;
// }
});
}
table.on('tool(data-table)', function (obj) {
if (obj.event === 'publishNextLevel') {
window.publishNextLevel(obj);
} else if (obj.event === 'publishCurrentOrg') {
window.publishCurrentOrg(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);
} else if (obj.event === 'exportHz') {
window.exportHz(obj);
} else if (obj.event === 'preview') {
window.preview(obj);
}
});
window.fill_progress = function (target_type_id, job_id, total_count, finish_count, job_type) {
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 + "&job_type=" + job_type + "&target_type_id=" + target_type_id
});
// if (target_type_id == 1) {
// 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 + "&job_type=" + job_type
// });
// } else {
// var id = "9001"
// parent.layui.admin.closeTab(id);
// parent.layui.admin.addTab(id, "填报进度", "/QingLong/view/tb/org/task_view_bp.html?job_id=" + job_id + "&job_type=" + job_type);
// }
}
window.forward_progress_xiaji = function (job_id, total_count, finish_count, job_type) {
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_forward.html?job_id=" + job_id + "&job_type=" + job_type
});
// var id = "9001"
// parent.layui.admin.closeTab(id);
// parent.layui.admin.addTab(id, "转发进度", "/QingLong/view/tb/org/task_view_forward.html?job_id=" + job_id + "&job_type=" + job_type);
}
window.publishNextLevel = function (obj) {
if (obj.data.is_save === 1) {
$.ajax({
url: "/QingLong/collect/getCurrentPersonPublishRole",
async: false,
type: 'GET',
success: function (res) {
if (res.success) {
if (res.publish_role_id == 255) {
layer.open({
type: 2,
title: '发布任务',
offset: 'r',
anim: 'slideLeft',
area: ['860px', '100%'],
shade: 0.1,
content: './publish.html?job_id=' + obj.data.job_id
});
} else if (res.publish_role_id == 268) {
layer.open({
type: 2,
title: '发布任务',
offset: 'r',
anim: 'slideLeft',
area: ['860px', '100%'],
shade: 0.1,
content: '../dis/publish.html?job_id=' + obj.data.job_id
});
}
} else {
layer.msg("获取身份异常!", {
icon: 2,
time: 1000
});
}
}, error: function (xhr, status, error) {
layer.msg("获取数据异常!", {
icon: 2,
time: 1000
});
}
});
}
else {
layer.msg('该任务尚未保存,请在修改中进行保存!', {
icon: 3,
time: 3000
});
}
}
window.publishCurrentOrg = function (obj) {
if (obj.data.is_save === 1) {
layer.open({
type: 2,
title: '发布任务',
offset: 'r',
anim: 'slideLeft',
area: ['1000px', '100%'],
shade: 0.1,
content: '../dis/publish_person_bdw.html?job_id=' + obj.data.job_id
});
}
else {
layer.msg('该任务尚未保存,请在修改中进行保存!', {
icon: 3,
time: 3000
});
}
}
window.update = function (obj) {
if (obj.data.job_type == 1) {
window.location = "../form/designer.html?job_id=" + obj.data.job_id;
} else {
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.preview = function (obj) {
window.localStorage.setItem('form_json', obj.data.form_json);
layer.open({
type: 2,
title: '预览',
offset: 'r',
anim: 'slideLeft',
area: ['1000px', '100%'],
shade: 0.1,
shadeClose: true,
content: "../form/preview.html"
});
}
window.export = function (obj) {
openDownloadDialog("/QingLong/Excel/" + obj.data.upload_excel_filename, obj.data.job_name + ".xlsx");
}
window.exportHz = function (obj) {
window.location = "/QingLong/collect/getSummaryExcel?job_id=" + obj.data.job_id;
}
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 () {
window.localStorage.setItem('self_or_next', 2);
layer.open({
type: 2,
title: '新建任务',
shade: 0.1,
area: ['450px', '300px'],
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";
}
window.openFormCreatePage = function () {
window.location = "../form/designer.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>