main
kgdxpr 2 years ago
parent 127a58e055
commit e8400148a6

@ -2081,8 +2081,8 @@ layui.config({ base: './ayq/modules/' }).define(["layer", 'flow', "laytpl", "ele
_html += '<div class="layui-upload">';
// _html += '<button type="button" class="layui-btn" id="{0}">选择文件</button> '.format(json.tag + json.id);
_html += ' <div class="layui-upload-list" style="max-width: 1000px;margin-left: 5px;"><table class="layui-table">';
_html += '<colgroup><col><col width="100"><col width="150"><col width="100"></colgroup>';
_html += '<thead><tr><th>文件名</th><th>大小</th><th>上传进度</th><th>操作</th></tr></thead>';
_html += '<colgroup><col><col width="100"><col width="150"></colgroup>';
_html += '<thead><tr><th>文件名</th><th>大小</th><th>上传进度</th></tr></thead>';
_html += '<tbody id="list-{0}"></tbody></table></div>'.format(json.id);
// _html += '<button type="button" class="layui-btn" id="listAction-{0}">开始上传</button>'.format(json.id);
_html += '</div>';

@ -240,17 +240,13 @@
'<tr id="upload-' + i + '">' +
'<td>' + res.data[i].fileName + '</td>' +
'<td>' + res.data[i].file_size + '</td>' +
'<td>已上传</td>' +
'<td>' +
'<button class="layui-btn layui-btn-xs layui-btn-danger" onclick=delfiles("' + res.data[i].file_id + '","' + res.data[i].input_id + '")>删除</button>' +
'</td>' +
'<td>已上传</td>' +
'</tr>'
);
} else {
$('#uploader-list-' + res.data[i].input_id).append(
'<div id="' + res.data[i].file_id + '" class="file-iteme">' +
'<div class="handle"><i class="layui-icon layui-icon-delete" onclick=delimgs("' + res.data[i].file_id + '")></i></div>' +
'<div id="' + res.data[i].file_id + '" class="file-iteme">' +
'<img style="width: 100px;height: 100px;" src=/QingLong/Excel/' + res.data[i].file_id + '.' + res.data[i].suffix + '>' +
'</div>'
);

@ -0,0 +1,346 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>Layui</title>
<link rel="stylesheet" href="./layui/css/layui.css" />
<link rel="stylesheet" href="./ayq/modules/formDesigner.css" />
<link rel="stylesheet" href="./ayq/modules/cron.css" />
<link rel="stylesheet" href="./ayq/modules/labelGeneration.css" />
<style>
.mainBox {
width: 98%;
position: absolute;
top: 0px;
left: 0px;
bottom: 50px;
overflow: auto;
padding: 5px;
}
.bottom {
width: 100%;
position: absolute;
bottom: 0px;
left: 0px;
height: 50px;
line-height: 50px;
background-color: #F8F8F8;
border-top: 1px solid #eee;
}
.button-container {
position: absolute;
right: 15px;
}
</style>
</head>
<body>
<div id="testdemo" style="margin: 10px 10px;">
</div>
<script type="text/javascript" src="./layui/layui.js"></script>
<script type="text/javascript" src="./ayq/modules/Sortable/Sortable.js"> </script>
<script type="text/javascript" src="./ayq/modules/iceEditor/iceEditor.js"></script>
<script>
var demojs = [];
//JavaScript代码区域
layui.config(
{ base: './ayq/modules/' }).use(['formDesignerView', 'element', 'form', 'layer', 'upload'], function () {
var layer = layui.layer;
var $ = layui.jquery;
var upload = layui.upload;
var index = layui.index;
var formDesigner = layui.formDesignerView;
var form = layui.form;
var render;
var element = layui.element
var jobId = GetQueryString("job_id");
var bureauId = GetQueryString("bureau_id");
function unique(x) {
let obj = {};
let res = [];
let len = x.length; // 缓存数组长度
for (let i = 0; i < len; i++) {
let item = x[i].select;
if (!obj.hasOwnProperty(item)) { // 使用hasOwnProperty判断属性是否存在
res.push(x[i]);
}
obj[item] = item;
}
return res;
}
$.ajax({
url: "/QingLong/collect/getJob?job_id=" + jobId,
async: false,
type: 'GET',
success: function (res) {
demojs = JSON.parse(res.form_json);
render = formDesigner.render({
elem: '#testdemo',
data: demojs,
viewOrDesign: true
});
var images = render.getImages();
images = unique(images);
for (var i = 0; i < images.length; i++) {
upload.render({
elem: '#' + images[i].select
, url: '/QingLong/collect/uploadFile'
, data: { job_id: jobId, input_id: images[i].select.substring(5), type_id: 2 }
, multiple: true
, before: function (obj) {
layer.msg('图片上传中...', {
icon: 16,
shade: 0.01,
time: 0
})
}
, done: function (res) {
layer.close(layer.msg());//关闭上传提示窗口
//上传完毕
$('#uploader-list-' + res.input_id).append(
'<div id="' + res.file_id + '" class="file-iteme">' +
'<div class="handle"><i class="layui-icon layui-icon-delete" onclick=delimgs("' + res.file_id + '")></i></div>' +
'<img style="width: 100px;height: 100px;" src=/QingLong' + res.url + '>' +
'</div>'
);
}
});
}
var filesData = render.getFiles();
filesData = unique(filesData);
var file_input_id = filesData[0].select.substring(4);
for (var i = 0; i < filesData.length; i++) {
upload.render({
elem: '#' + filesData[i].select
, elemList: $('#list-' + filesData[i].select.substring(4)) //列表元素对象
, url: '/QingLong/collect/uploadFile'
, data: { job_id: jobId, input_id: filesData[i].select.substring(4), type_id: 1 }
, accept: 'file'
, multiple: true
, number: 3
, auto: true
, bindAction: '#listAction-' + filesData[i].select.substring(4)
, choose: function (obj) {
var that = this;
var files = this.files = obj.pushFile(); //将每次选择的文件追加到文件队列
//读取本地文件
obj.preview(function (index, file, result) {
var tr = $(['<tr id="upload-' + index + '">'
, '<td>' + file.name + '</td>'
, '<td>' + (file.size / 1014).toFixed(1) + 'kb</td>'
, '<td><div class="layui-progress" lay-filter="progress-demo-' + index + '"><div class="layui-progress-bar" lay-percent=""></div></div></td>'
, '<td>'
, '<button class="layui-btn layui-btn-xs layui-btn-danger demo-delete">删除</button>'
, '</td>'
, '</tr>'].join(''));
//删除
tr.find('.demo-delete').on('click', function () {
delete files[index]; //删除对应的文件
tr.remove();
// uploadListIns.config.elem.next()[0].value = ''; //清空 input file 值,以免删除后出现同名文件不可选
});
that.elemList.append(tr);
element.render('progress'); //渲染新加的进度条组件
});
}, done: function (res, index, upload) { //成功的回调
var that = this;
var tr = that.elemList.find('tr#upload-' + index)
, tds = tr.children();
tds.eq(3).html(''); //清空操作
delete this.files[index]; //删除文件队列已经上传成功的文件
return;
this.error(index, upload);
}, allDone: function (obj) { //多文件上传完毕后的状态回调
setTimeout(function () {
reloadFiles(file_input_id);
}, 700);
}, error: function (index, upload) { //错误回调
var that = this;
var tr = that.elemList.find('tr#upload-' + index)
, tds = tr.children();
tds.eq(3).find('.demo-reload').removeClass('layui-hide'); //显示重传
}, progress: function (n, elem, e, index) {
element.progress('progress-demo-' + index, n + '%'); //执行进度条。n 即为返回的进度百分比
}
});
}
}, error: function (xhr, status, error) {
layer.msg("获取任务信息异常!", {
icon: 2,
time: 1000
});
}
});
//获取表单数据
$.ajax({
url: "/QingLong/collect/getFormFillJob?job_id=" + jobId + "&bureau_id=" + bureauId,
async: false,
type: 'GET',
dataType: "json",
success: function (res) {
render.setFormData(res);
}
});
window.reloadFiles = function (file_input_id) {
$.ajax({
url: "/QingLong/collect/getJobUploadList?job_id=" + jobId + "&bureau_id=" + bureauId,
async: false,
type: 'GET',
success: function (res) {
$('#list-' + file_input_id).html('');
if (res.data.length > 0) {
for (var i = 0; i < res.data.length; i++) {
if (res.data[i].type_id == 1) {
var tr = $('#list-' + res.data[i].input_id).append(
'<tr id="upload-' + i + '">' +
'<td>' + res.data[i].fileName + '</td>' +
'<td>' + res.data[i].file_size + '</td>' +
'<td>已上传</td>' +
'<td>' +
'<button class="layui-btn layui-btn-xs layui-btn-danger" onclick=delfiles("' + res.data[i].file_id + '","' + res.data[i].input_id + '")>删除</button>' +
'</td>' +
'</tr>'
);
}
}
}
}
});
}
//获取图片和文件数据
$.ajax({
url: "/QingLong/collect/getJobUploadList?job_id=" + jobId + "&bureau_id=" + bureauId,
async: false,
type: 'GET',
success: function (res) {
if (res.data.length > 0) {
for (var i = 0; i < res.data.length; i++) {
if (res.data[i].type_id == 1) {
var tr = $('#list-' + res.data[i].input_id).append(
'<tr id="upload-' + i + '">' +
'<td>' + res.data[i].fileName + '</td>' +
'<td>' + res.data[i].file_size + '</td>' +
'<td>已上传</td>' +
'</tr>'
);
} else {
$('#uploader-list-' + res.data[i].input_id).append(
'<div id="' + res.data[i].file_id + '" class="file-iteme">' +
'<img style="width: 100px;height: 100px;" src=/QingLong/Excel/' + res.data[i].file_id + '.' + res.data[i].suffix + '>' +
'</div>'
);
}
}
}
}
});
window.delimgs = function (file_id) {
$.ajax({
url: '/QingLong/collect/delUploadFile',
type: 'post',
data: {
"job_id": jobId,
"file_id": file_id
},
success: function (result) {
if (result.success) {
layer.msg("成功!", {
icon: 1,
time: 1000
}, function () {
$('#' + file_id).remove();
});
} else {
layer.msg(result.message, {
icon: 2,
time: 2000
});
}
}
});
}
window.delfiles = function (file_id, file_input_id) {
event.preventDefault();
$.ajax({
url: '/QingLong/collect/delUploadFile',
type: 'post',
data: {
"job_id": jobId,
"file_id": file_id
},
success: function (result) {
if (result.success) {
layer.msg("成功!", {
icon: 1,
time: 1000
}, function () {
reloadFiles(file_input_id);
});
} else {
layer.msg(result.message, {
icon: 2,
time: 2000
});
}
}
});
return false;
}
});
function getSubmitData() {
var data = $('#testdemo').form[0].serialize();
console.log(data);
return data;
}
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;
}
</script>
</body>
</html>

@ -67,7 +67,7 @@
<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" lay-showpercent="true" style="margin-top: 18px;cursor: pointer;" onclick='progress("{{= d.job_id }}","{{= d.total_count }}","{{= d.finish_count }}","{{= d.job_type }}")'>
<div class="layui-progress-bar" lay-percent="{{= d.finish_count }} / {{= d.total_count }}"></div>
</div>
{{# } else { }}
@ -142,7 +142,7 @@
var $ = layui.jquery;
var common = layui.common;
var laytpl = layui.laytpl;
var element = layui.element;
var element = layui.element;
tableRender();
@ -209,7 +209,7 @@
}
});
window.progress = function (job_id, total_count, finish_count) {
window.progress = 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 + ' ',
@ -218,7 +218,7 @@
maxmin: false,
move: false,
area: ['100%', '100%'],
content: "./task_view.html?job_id=" + job_id
content: "./task_view.html?job_id=" + job_id + "&job_type=" + job_type
});
}
@ -256,7 +256,7 @@
});
}
window.postpone = function (obj) {
window.postpone = function (obj) {
layer.open({
type: 2,
title: '延长截止时间',

@ -63,9 +63,11 @@
<button type="button" class="layui-btn layui-btn-sm" title="填报" lay-event="view" style="font-size: 12px !important;">
<i class="iconfont icon-chakan"></i> 查看
</button>
{{# if(d.job_type === 2){ }}
<button type="button" class="layui-btn layui-btn-sm" title="填报" lay-event="download" style="font-size: 12px !important;">
<i class="iconfont icon-xiazai"></i> 下载
</button>
{{# } }}
{{# } }}
</script>
@ -83,6 +85,7 @@
var laytpl = layui.laytpl;
var jobId = GetQueryString("job_id");
var jobType = GetQueryString("job_type");
tableRender();
@ -122,7 +125,13 @@
{ title: '操作', align: 'center', width: "15%", toolbar: '#table-bar' }
]],
skin: 'line',
defaultToolbar: []
defaultToolbar: [],
parseData: function (res) { // res 即为原始返回的数据
for (var i = 0; i < res.data.length; i++) {
res.data[i].job_type = parseInt(jobType);
}
return res;
}
});
}
@ -134,14 +143,26 @@
}
});
window.download = function (obj) {
window.location = '/QingLong/collect/getJobBureauFillInfo?job_id=' + obj.data.job_id + '&bureau_id=' + obj.data.bureau_id + '&type_id=1';
}
window.view = function (obj) {
var base64Url = Base64.encode('/QingLong/collect/getJobBureauFillInfo?job_id=' + obj.data.job_id + '&bureau_id=' + obj.data.bureau_id + '&type_id=2');
window.open('../exportPdf.html?url=' + base64Url, '_blank');
if (obj.data.job_type === 1) {
layer.open({
type: 2,
title: '填报',
offset: 'r',
anim: 'slideLeft',
area: ['750px', '100%'],
shade: 0.1,
shadeClose: true,
content: "../form/view_bureau.html?job_id=" + obj.data.job_id + "&bureau_id=" + obj.data.bureau_id
});
} else {
var base64Url = Base64.encode('/QingLong/collect/getJobBureauFillInfo?job_id=' + obj.data.job_id + '&bureau_id=' + obj.data.bureau_id + '&type_id=2');
window.open('../exportPdf.html?url=' + base64Url, '_blank');
}
}
form.on('select(status)', function (data) {

@ -35,13 +35,21 @@
<div class="layui-card">
<div class="layui-card-body">
<table id="data-table"></table>
<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-bar">
<button type="button" class="layui-btn layui-btn-sm" lay-event="report" style="font-size: 12px !important;">
<i class="iconfont icon-tianbao"></i> 填报
</button>
{{# if(d.jiezhi == false){ }}
<button type="button" class="layui-btn layui-btn-sm" lay-event="report" style="font-size: 12px !important;">
<i class="iconfont icon-tianbao"></i> 填报
</button>
{{# } }}
{{# if(d.is_finish === 1){ }}
<button type="button" class="layui-btn layui-btn-sm" lay-event="view" style="font-size: 12px !important;">
<i class="iconfont icon-chakan"></i> 查看
@ -96,7 +104,7 @@
},
cols: [[
{ title: '序号', align: 'center', width: "5%", type: 'numbers' },
{ title: '任务名称', field: 'job_name', align: 'left' },
{ title: '任务名称', align: 'left', templet: '#jobName-Templet' },
{ title: '发布时间', field: 'publish_time', align: 'center', width: "15%" },
{ title: '截止时间', field: 'deadline_time', align: 'center', width: "15%" },
{ title: '填报格式', field: 'job_type_name', align: 'center', width: "15%" },

Loading…
Cancel
Save