main
kgdxpr 2 years ago
parent 98afd6b717
commit 9ed01c94b8

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: 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

@ -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>';

@ -118,10 +118,9 @@
} }
, 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="" 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"></i></div>' +
'<img style="width: 100px;height: 100px;" src=/QingLong' + res.url + '>' + '<img style="width: 100px;height: 100px;" src=/QingLong' + res.url + '>' +
@ -133,6 +132,7 @@
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
@ -142,7 +142,7 @@
, 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;
@ -169,11 +169,10 @@
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(''); //清空操作
@ -181,23 +180,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,
@ -206,7 +203,6 @@
} }
}); });
//获取表单数据 //获取表单数据
$.ajax({ $.ajax({
url: "/QingLong/collect/getFormFillJob?job_id=" + jobId, url: "/QingLong/collect/getFormFillJob?job_id=" + jobId,
@ -218,6 +214,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,
@ -227,6 +250,17 @@
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) { 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 { } else {
$('#uploader-list-' + res.data[i].input_id).append( $('#uploader-list-' + res.data[i].input_id).append(
@ -274,68 +308,43 @@
return false; return false;
}); });
//导入数据 window.delfiles = function (file_id, file_input_id) {
$('#importJsonData').on('click', function () { event.preventDefault();
layer.open({
type: 1 $.ajax({
, title: 'JSON模板数据导入' url: '/QingLong/collect/delUploadFile',
, id: 'Lay_layer_importjsoncodeview' type: 'post',
, content: $('.importjsoncodedataview') data: {
, area: ['800px', '640px'] "job_id": jobId,
, shade: false "file_id": file_id
, resize: false },
, success: function (layero, index) { success: function (result) {
} if (result.success) {
, end: function () { layer.msg("成功!", {
$('.importjsoncodeview').css("display", "none") icon: 1,
} time: 1000
}, function () {
reloadFiles(file_input_id);
}); });
} 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")
} }
}); });
}); return false;
$('#import-json-code-data').on('click', function () {
var _value = document.getElementById("import-json-code-view").value;
try {
var json = JSON.parse(_value);
console.log(json);
render.setFormData(json);
layer.closeAll();
layer.msg('导入成功');
} catch (e) {
layer.closeAll();
layer.msg('导入数据格式异常');
} }
});
$('#globalDisable').on('click', function () {
render.globalDisable();
});
$('#globalNoDisable').on('click', function () {
render.globalNoDisable();
});
}); });
function getSubmitData() { function getSubmitData() {
var data = $('#testdemo').form[0].serialize(); var data = $('#testdemo').form[0].serialize();
console.log(data); console.log(data);
@ -351,6 +360,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