黄海 2 years ago
commit 7646c9a4db

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

@ -258,9 +258,9 @@
opacity : 0.5; opacity : 0.5;
width : 100px; width : 100px;
text-align : right; text-align : right;
height : 18px; /* height : 18px; */
margin-bottom : -18px; margin-bottom : -25px;
display : none; /* display : none; */
} }
.uploader-list .handle i { .uploader-list .handle i {
@ -753,27 +753,3 @@ body .cool-black .layui-layer-btn a {
text-align: center; text-align: center;
display: none; display: none;
} }
.uploader-list .handle {
position: relative;
background-color: black;
color: white;
filter: alpha(Opacity=80);
-moz-opacity: 0.5;
opacity: 0.5;
width: 100px;
text-align: right;
height: 18px;
margin-bottom: -18px;
display: none;
}
.uploader-list .handle i {
margin-right: 5px;
}
.uploader-list .handle i:hover {
cursor: pointer;
}
.uploader-list .file-iteme {
margin: 12px 0 0 15px;
padding: 1px;
float: left;
}

@ -2084,7 +2084,7 @@ layui.config({ base: './ayq/modules/' }).define(["layer", 'flow', "laytpl", "ele
_html += '<colgroup><col><col width="100"><col width="150"><col width="100"></colgroup>'; _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 += '<thead><tr><th>文件名</th><th>大小</th><th>上传进度</th><th>操作</th></tr></thead>';
_html += '<tbody id="list-{0}"></tbody></table></div>'.format(json.id); _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 += '<button type="button" class="layui-btn" id="listAction-{0}">开始上传</button>'.format(json.id);
_html += '</div>'; _html += '</div>';
_html += '</blockquote>'; _html += '</blockquote>';
_html += '</div>'; _html += '</div>';
@ -2152,7 +2152,7 @@ layui.config({ base: './ayq/modules/' }).define(["layer", 'flow', "laytpl", "ele
_html += '<colgroup><col><col width="150"><col width="260"><col width="150"></colgroup>'; _html += '<colgroup><col><col width="150"><col width="260"><col width="150"></colgroup>';
_html += '<thead><tr><th>文件名</th><th>大小</th><th>上传进度</th><th>操作</th></tr></thead>'; _html += '<thead><tr><th>文件名</th><th>大小</th><th>上传进度</th><th>操作</th></tr></thead>';
_html += '<tbody id="list-{0}"></tbody></table></div>'.format(json.id); _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 += '<button type="button" class="layui-btn" id="listAction-{0}">开始上传</button>'.format(json.id);
_html += '</div>'; _html += '</div>';
_html += '</blockquote>'; _html += '</blockquote>';
_html += '</div>'; _html += '</div>';

@ -107,7 +107,7 @@
upload.render({ upload.render({
elem: '#' + images[i].select elem: '#' + images[i].select
, url: '/QingLong/collect/uploadFile' , url: '/QingLong/collect/uploadFile'
, data: { job_id: jobId, input_id: images[i].select.substring(5) } , data: { job_id: jobId, input_id: images[i].select.substring(5), type_id: 2 }
, multiple: true , multiple: true
, before: function (obj) { , before: function (obj) {
layer.msg('图片上传中...', { layer.msg('图片上传中...', {
@ -118,11 +118,12 @@
} }
, done: function (res) { , done: function (res) {
layer.close(layer.msg());//关闭上传提示窗口 layer.close(layer.msg());//关闭上传提示窗口
console.log(res);
//上传完毕 //上传完毕
$('#uploader-list-' + images[i].select.substring(5)).append( $('#uploader-list-' + res.input_id).append(
'<div id="" class="file-iteme">' + '<div id="' + res.file_id + '" class="file-iteme">' +
'<div class="handle"><i class="layui-icon layui-icon-delete"></i></div>' + '<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 + '>' + '<img style="width: 100px;height: 100px;" src=/QingLong' + res.url + '>' +
'</div>' '</div>'
); );
@ -132,16 +133,17 @@
var filesData = render.getFiles(); var filesData = render.getFiles();
filesData = unique(filesData); filesData = unique(filesData);
var file_input_id = filesData[0].select.substring(4);
for (var i = 0; i < filesData.length; i++) { for (var i = 0; i < filesData.length; i++) {
upload.render({ upload.render({
elem: '#' + filesData[i].select elem: '#' + filesData[i].select
, elemList: $('#list-' + filesData[i].select.substring(4)) //列表元素对象 , elemList: $('#list-' + filesData[i].select.substring(4)) //列表元素对象
, url: '/QingLong/collect/uploadFile' , url: '/QingLong/collect/uploadFile'
, data: { job_id: jobId, input_id: filesData[i].select.substring(4) } , data: { job_id: jobId, input_id: filesData[i].select.substring(4), type_id: 1 }
, accept: 'file' , accept: 'file'
, multiple: true , multiple: true
, number: 3 , number: 3
, auto: false , auto: true
, bindAction: '#listAction-' + filesData[i].select.substring(4) , bindAction: '#listAction-' + filesData[i].select.substring(4)
, choose: function (obj) { , choose: function (obj) {
var that = this; var that = this;
@ -162,17 +164,16 @@
tr.find('.demo-delete').on('click', function () { tr.find('.demo-delete').on('click', function () {
delete files[index]; //删除对应的文件 delete files[index]; //删除对应的文件
tr.remove(); tr.remove();
uploadListIns.config.elem.next()[0].value = ''; //清空 input file 值,以免删除后出现同名文件不可选 // uploadListIns.config.elem.next()[0].value = ''; //清空 input file 值,以免删除后出现同名文件不可选
}); });
that.elemList.append(tr); that.elemList.append(tr);
element.render('progress'); //渲染新加的进度条组件 element.render('progress'); //渲染新加的进度条组件
}); });
} }, done: function (res, index, upload) { //成功的回调
, done: function (res, index, upload) { //成功的回调
console.log(res); console.log(res);
var that = this; var that = this;
//if(res.code == 0){ //上传成功
var tr = that.elemList.find('tr#upload-' + index) var tr = that.elemList.find('tr#upload-' + index)
, tds = tr.children(); , tds = tr.children();
tds.eq(3).html(''); //清空操作 tds.eq(3).html(''); //清空操作
@ -180,23 +181,21 @@
return; return;
//} //}
this.error(index, upload); this.error(index, upload);
} }, allDone: function (obj) { //多文件上传完毕后的状态回调
, allDone: function (obj) { //多文件上传完毕后的状态回调 setTimeout(function () {
console.log(obj) reloadFiles(file_input_id);
} }, 700);
, error: function (index, upload) { //错误回调
}, error: function (index, upload) { //错误回调
var that = this; var that = this;
var tr = that.elemList.find('tr#upload-' + index) var tr = that.elemList.find('tr#upload-' + index)
, tds = tr.children(); , tds = tr.children();
tds.eq(3).find('.demo-reload').removeClass('layui-hide'); //显示重传 tds.eq(3).find('.demo-reload').removeClass('layui-hide'); //显示重传
} }, progress: function (n, elem, e, index) {
, progress: function (n, elem, e, index) {
element.progress('progress-demo-' + index, n + '%'); //执行进度条。n 即为返回的进度百分比 element.progress('progress-demo-' + index, n + '%'); //执行进度条。n 即为返回的进度百分比
} }
}); });
} }
}, error: function (xhr, status, error) { }, error: function (xhr, status, error) {
layer.msg("获取任务信息异常!", { layer.msg("获取任务信息异常!", {
icon: 2, icon: 2,
@ -205,7 +204,6 @@
} }
}); });
//获取表单数据 //获取表单数据
$.ajax({ $.ajax({
url: "/QingLong/collect/getFormFillJob?job_id=" + jobId, url: "/QingLong/collect/getFormFillJob?job_id=" + jobId,
@ -217,6 +215,33 @@
} }
}); });
window.reloadFiles = function (file_input_id) {
$.ajax({
url: "/QingLong/collect/getJobUploadList?job_id=" + jobId,
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({ $.ajax({
url: "/QingLong/collect/getJobUploadList?job_id=" + jobId, url: "/QingLong/collect/getJobUploadList?job_id=" + jobId,
@ -225,13 +250,27 @@
success: function (res) { success: function (res) {
if (res.data.length > 0) { if (res.data.length > 0) {
for (var i = 0; i < res.data.length; i++) { 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>'
);
} else {
$('#uploader-list-' + res.data[i].input_id).append( $('#uploader-list-' + res.data[i].input_id).append(
'<div id="" class="file-iteme">' + '<div id="' + res.data[i].file_id + '" class="file-iteme">' +
'<div class="handle"><i class="layui-icon layui-icon-delete"></i></div>' + '<div class="handle"><i class="layui-icon layui-icon-delete" onclick=delimgs("' + res.data[i].file_id + '")></i></div>' +
'<img style="width: 100px;height: 100px;" src=/QingLong/Excel/' + res.data[i].file_id + '.' + res.data[i].suffix + '>' + '<img style="width: 100px;height: 100px;" src=/QingLong/Excel/' + res.data[i].file_id + '.' + res.data[i].suffix + '>' +
'</div>' '</div>'
); );
console.log(res.data[i]); }
} }
} }
@ -269,68 +308,70 @@
return false; return false;
}); });
//导入数据 window.delimgs = function (file_id) {
$('#importJsonData').on('click', function () {
layer.open({ $.ajax({
type: 1 url: '/QingLong/collect/delUploadFile',
, title: 'JSON模板数据导入' type: 'post',
, id: 'Lay_layer_importjsoncodeview' data: {
, content: $('.importjsoncodedataview') "job_id": jobId,
, area: ['800px', '640px'] "file_id": file_id
, shade: false },
, resize: false success: function (result) {
, success: function (layero, index) { if (result.success) {
} layer.msg("成功!", {
, end: function () { icon: 1,
$('.importjsoncodeview').css("display", "none") time: 1000
} }, function () {
$('#' + file_id).remove();
}); });
} else {
layer.msg(result.message, {
icon: 2,
time: 2000
}); });
}
//导入数据
$('#getFormData').on('click', function () {
var _value = render.getFormData();
$('#get-form-data').val(JSON.stringify(_value, null, 4));
layer.open({
type: 1
, title: 'JSON模板数据导入'
, id: 'Lay_layer_importjsoncodeview'
, content: $('.getFormData')
, area: ['800px', '640px']
, shade: false
, resize: false
, success: function (layero, index) {
}
, end: function () {
$('.getFormData').css("display", "none")
} }
}); });
}); }
$('#import-json-code-data').on('click', function () { window.delfiles = function (file_id, file_input_id) {
var _value = document.getElementById("import-json-code-view").value; event.preventDefault();
try {
var json = JSON.parse(_value);
console.log(json);
render.setFormData(json);
layer.closeAll();
layer.msg('导入成功');
} catch (e) {
layer.closeAll(); $.ajax({
layer.msg('导入数据格式异常'); 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 {
$('#globalDisable').on('click', function () { layer.msg(result.message, {
render.globalDisable(); icon: 2,
time: 2000
}); });
$('#globalNoDisable').on('click', function () { }
render.globalNoDisable(); }
}); });
return false;
}
}); });
function getSubmitData() { function getSubmitData() {
var data = $('#testdemo').form[0].serialize(); var data = $('#testdemo').form[0].serialize();
console.log(data); console.log(data);
@ -346,6 +387,8 @@
return null; return null;
} }
</script> </script>
</body> </body>

@ -125,7 +125,6 @@
anim: 'slideLeft', anim: 'slideLeft',
area: ['750px', '100%'], area: ['750px', '100%'],
shade: 0.1, shade: 0.1,
shadeClose: true,
content: "../form/report.html?job_id=" + obj.data.job_id content: "../form/report.html?job_id=" + obj.data.job_id
}); });
} else { } else {

Loading…
Cancel
Save