修复流程表单中文件上传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(); $(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('.uploadify-progress').remove();
$("#" + file.id).find('.data').html(' 恭喜您,上传成功!'); $("#" + file.id).find('.data').html(' 恭喜您,上传成功!');
$("#" + file.id).prepend('<a class="succeed" title="成功"><i class="fa fa-check-circle"></i></a>'); $("#" + 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 + "-button").prepend('<i style="opacity: 0.6;" class="fa fa-cloud-upload"></i>&nbsp;');
$('#' + control_field + '-queue').attr('type','upload');
$('#' + control_field + '-queue').hide(); $('#' + control_field + '-queue').hide();
} }
} }
//获取表单数据 //获取表单数据
$.fn.frmGetData = function () { $.fn.frmGetData = function () {
var reVal = ""; var checkboxValue = {}; 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'); var id = $(this).attr('id');
if (id != undefined) if (id != undefined)
{ {
@@ -1423,6 +1428,16 @@ $.fn.frmGetData = function () {
var type = $(this).attr('type'); var type = $(this).attr('type');
switch (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": case "checkbox":
var datavalue = $("#" + id).attr('data-value'); var datavalue = $("#" + id).attr('data-value');
var value = $("#" + id).val(); var value = $("#" + id).val();
@@ -1508,6 +1523,12 @@ $.fn.frmSetData = function (data) {
case "selectTree": case "selectTree":
id.ComboBoxTreeSetValue(value); id.ComboBoxTreeSetValue(value);
break; 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: default:
id.val(value); id.val(value);
break; break;

View File

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