修复流程表单中文件上传BUG

This commit is contained in:
yubaolee
2017-03-12 22:46:55 +08:00
parent dc9af8b8ea
commit 48d9062258
2 changed files with 24 additions and 2 deletions

View File

@@ -1389,7 +1389,10 @@ $.fn.frmPreview = function (options)
$(this).find('.cancel').find('a').hide();
});
},
onUploadSuccess: function (file) {
onUploadSuccess: function (file, data) {
var response = JSON.parse(data);
$("#" + file.id).attr('filePath', response.Result);
$("#" + file.id).attr('fileName', file.name);
$("#" + file.id).find('.uploadify-progress').remove();
$("#" + file.id).find('.data').html(' 恭喜您,上传成功!');
$("#" + file.id).prepend('<a class="succeed" title="成功"><i class="fa fa-check-circle"></i></a>');
@@ -1409,13 +1412,15 @@ $.fn.frmPreview = function (options)
}
});
$("#" + control_field + "-button").prepend('<i style="opacity: 0.6;" class="fa fa-cloud-upload"></i>&nbsp;');
$('#' + control_field + '-queue').attr('type','upload');
$('#' + control_field + '-queue').hide();
}
}
//获取表单数据
$.fn.frmGetData = function () {
var reVal = ""; var checkboxValue = {};
$(this).find('input,select,textarea,.ui-select').each(function (r) {
var uploadVal = new Array();
$(this).find('input,select,textarea,.ui-select,.uploadify-queue').each(function (r) {
var id = $(this).attr('id');
if (id != undefined)
{
@@ -1423,6 +1428,16 @@ $.fn.frmGetData = function () {
var type = $(this).attr('type');
switch (type) {
case "upload": //文件上传
$(this).find('.uploadify-queue-item').each(function (u) {
uploadVal.push({
fileName: $(this).attr('fileName'),
filePath: $(this).attr('filePath')
});
});
reVal += '"' + filedid + '"' + ':' + JSON.stringify(uploadVal) + ','
break;
case "checkbox":
var datavalue = $("#" + id).attr('data-value');
var value = $("#" + id).val();
@@ -1508,6 +1523,12 @@ $.fn.frmSetData = function (data) {
case "selectTree":
id.ComboBoxTreeSetValue(value);
break;
case "upload":
$.each(data[key], function (e) {
var $this = this;
id.after("<a href='/FlowManage/File/upload/" + $this.filePath + "'>" + $this.fileName + "</a>");
});
break;
default:
id.val(value);
break;

View File

@@ -58,6 +58,7 @@ $.SetForm = function (options) {
} else {
options.success(data);
}
Loading(false);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
dialogMsg(errorThrown, -1);