|
文件上传成功,但弹出框不关闭,并且右下角的提示窗口不弹出
jsp代码如下
<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>录入</title>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<script type="text/javascript">
$(function(){
//查看模式情况下,删除和上传附件功能禁止使用
if(location.href.indexOf("load=detail")!=-1){
$(".jeecgDetail").hide();
}
});
function uploadFile(data){
$("#gongke_instance_id").val(data.obj.id);
if($(".uploadify-queue-item").length>0){
upload();
}else{
frameElement.api.opener.reloadTable();
frameElement.api.close();
}
}
function close(){
frameElement.api.close();
}
</script>
<!-- 弹出页面窗口大小控制 -->
<style type="text/css">
#formobj {
height: 65%;
min-height: 300px;
overflow-y: auto;
overflow-x: auto;
min-width: 600px;
}
</style>
</head>
<body>
<t:formvalid formid="formobj" dialog="true" usePlugin="password" layout="table" callback="@Override uploadFile" action="gongdanLuruController.do?gongdanStart">
<table cellpadding="0" cellspacing="1" class="formtable" style="width: 780px;">
<tr>
<td align="right"><label class="Validform_label">现象描述: </label></td>
<td class="value" colspan="3"><textarea cols="120" datatype="*" maxlength="200" name="gongke_description" rows="10" ignore="ignore"></textarea></td>
</tr>
<tr>
<td align="right"><label class="Validform_label">附件: </label></td>
<td class="value"><input type="hidden" value="${gongkeInstancePage.id}" id="gongke_instance_id" name="gongke_instance_id" />
<table>
<c:forEach items="${gongkeInstancePage.gongkeInstanceFilesEntity}" var="gongkeInstanceFilesEntity">
<tr style="height: 34px;">
<td>${gongkeInstanceFilesEntity.attachmenttitle}</td>
<td><a href="commonController.do?viewFile&fileid=${gongkeInstanceFilesEntity.id}&subclassname=org.jeecgframework.web.activiti.entity.workflow.GongkeInstanceFilesEntity" title="下载">下载</a></td>
</tr>
</c:forEach>
</table>
</td>
<td align="right"><label class="Validform_label">流向: </label></td>
<td class="value"></td>
</tr>
<tr>
<td></td>
<td colspan="3" class="value"><script type="text/javascript">
$.dialog.setting.zIndex =1990;
function del(url,obj){
$.dialog.confirm("确认删除该条记录?", function(){
$.ajax({
async : false,
cache : false,
type : 'POST',
url : url,// 请求的action路径
error : function() {// 请求失败处理函数
},
success : function(data) {
var d = $.parseJSON(data);
if (d.success) {
var msg = d.msg;
tip(msg);
$(obj).closest("tr").hide("slow");
}
}
});
}, function(){
});
}
</script>
<div class="form" id="filediv"></div>
<div class="form jeecgDetail">
<t:upload name="fiels" id="file_upload" extend="*.doc;*.docx;*.txt;*.ppt;*.xls;*.xlsx;*.html;*.htm;*.pdf;" buttonText="添加文件" formData="gongke_instance_id" uploader="gongdanLuruController.do?saveFiles">
</t:upload>
</div>
</td>
</tr>
</table>
</t:formvalid>
</body>
java代码如下,省略了部分不重要的代码,上传文件保存,gongdanStart和saveFiles两个函数都是执行完成的,打印信息测试过, 并且数据库中数据也是保存正确的,就是不关闭当前上传文件的窗口和不弹出右下角的提示框,代码和TFinanceController这个例子几乎是差不多:
@RequestMapping(params = "gongdanStart", method = RequestMethod.POST)
@ResponseBody
public AjaxJson gongdanStart(GongkeInstanceEntity gongkeInstance, String processDefinitionId, String flow, String exclusiveGateway, HttpServletRequest req) {
AjaxJson j = new AjaxJson();
.......
gongkeInstance.setFaultynum(req.getParameter("guzhanghaoma"));
gongkeInstance.setStartTime(new Date());
gongkeInstance.setContent(jsonArray.toString());
gongkeInstanceService.save(gongkeInstance);
message = "流程已启动,流程ID:" + processInstance.getId();
return j;
}
/**
* 保存文件
*
* @param ids
* @return
* @throws Exception
*/
@RequestMapping(params = "saveFiles", method = RequestMethod.POST)
@ResponseBody
public AjaxJson saveFiles(HttpServletRequest request, HttpServletResponse response, GongkeInstanceFilesEntity gongkeInstanceFilesEntity) {
AjaxJson j = new AjaxJson();
j.setMsg("录入失败");
Map<String, Object> attributes = new HashMap<String, Object>();
String fileKey = oConvertUtils.getString(request.getParameter("fileKey"));// 文件ID
String gongke_instance_id = oConvertUtils.getString(request.getParameter("gongke_instance_id"));
if (StringUtil.isNotEmpty(gongke_instance_id)) {
if (StringUtil.isNotEmpty(fileKey)) {
gongkeInstanceFilesEntity.setId(fileKey);
gongkeInstanceFilesEntity = systemService.getEntity(GongkeInstanceFilesEntity.class, fileKey);
}
GongkeInstanceEntity gongkeInstanceEntity = systemService.getEntity(GongkeInstanceEntity.class, gongke_instance_id);
gongkeInstanceFilesEntity.setGongkeInstanceEntity(gongkeInstanceEntity);
UploadFile uploadFile = new UploadFile(request, gongkeInstanceFilesEntity);
uploadFile.setCusPath("files");
uploadFile.setSwfpath("swfpath");
uploadFile.setByteField(null);//不存二进制内容
gongkeInstanceFilesEntity = systemService.uploadFile(uploadFile);
attributes.put("fileKey", gongkeInstanceFilesEntity.getId());
j.setMsg("录入成功");
j.setAttributes(attributes);
}
return j;
}
|
|