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 += '<thead><tr><th>文件名</th><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 += '<button type="button" class="layui-btn" id="listAction-{0}">开始上传</button>'.format(json.id);
_html += '</div>';
_html += '</blockquote>';
_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 += '<thead><tr><th>文件名</th><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 += '<button type="button" class="layui-btn" id="listAction-{0}">开始上传</button>'.format(json.id);
_html += '</div>';
_html += '</blockquote>';
_html += '</div>';

@ -117,11 +117,10 @@
})
}
, done: function (res) {
layer.close(layer.msg());//关闭上传提示窗口
console.log(res)
layer.close(layer.msg());//关闭上传提示窗口
//上传完毕
$('#uploader-list-' + images[i].select.substring(5)).append(
$('#uploader-list-' + res.input_id).append(
'<div id="" class="file-iteme">' +
'<div class="handle"><i class="layui-icon layui-icon-delete"></i></div>' +
'<img style="width: 100px;height: 100px;" src=/QingLong' + res.url + '>' +
@ -133,6 +132,7 @@
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
@ -142,7 +142,7 @@
, accept: 'file'
, multiple: true
, number: 3
, auto: false
, auto: true
, bindAction: '#listAction-' + filesData[i].select.substring(4)
, choose: function (obj) {
var that = this;
@ -169,11 +169,10 @@
that.elemList.append(tr);
element.render('progress'); //渲染新加的进度条组件
});
}
, done: function (res, index, upload) { //成功的回调
}, done: function (res, index, upload) { //成功的回调
console.log(res);
var that = this;
//if(res.code == 0){ //上传成功
var tr = that.elemList.find('tr#upload-' + index)
, tds = tr.children();
tds.eq(3).html(''); //清空操作
@ -181,23 +180,21 @@
return;
//}
this.error(index, upload);
}
, allDone: function (obj) { //多文件上传完毕后的状态回调
console.log(obj)
}
, error: function (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) {
}, progress: function (n, elem, e, index) {
element.progress('progress-demo-' + index, n + '%'); //执行进度条。n 即为返回的进度百分比
}
});
}
}, error: function (xhr, status, error) {
layer.msg("获取任务信息异常!", {
icon: 2,
@ -206,7 +203,6 @@
}
});
//获取表单数据
$.ajax({
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({
url: "/QingLong/collect/getJobUploadList?job_id=" + jobId,
@ -227,6 +250,17 @@
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>'
);
} else {
$('#uploader-list-' + res.data[i].input_id).append(
@ -274,66 +308,41 @@
return false;
});
//导入数据
$('#importJsonData').on('click', function () {
layer.open({
type: 1
, title: 'JSON模板数据导入'
, id: 'Lay_layer_importjsoncodeview'
, content: $('.importjsoncodedataview')
, area: ['800px', '640px']
, shade: false
, resize: false
, success: function (layero, index) {
}
, end: function () {
$('.importjsoncodeview').css("display", "none")
}
});
});
window.delfiles = function (file_id, file_input_id) {
event.preventDefault();
//导入数据
$('#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")
$.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;
}
});
$('#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() {
@ -351,6 +360,8 @@
return null;
}
</script>
</body>

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

Loading…
Cancel
Save