Commit 075b388e authored by 李家智's avatar 李家智
Browse files

filesytem

parent fea41b40
...@@ -278,9 +278,10 @@ public class UserConsoleController { ...@@ -278,9 +278,10 @@ public class UserConsoleController {
} }
@GetMapping(MODEL + "/excel/export.json") @PostMapping(MODEL + "/excel/export.json")
@Function("user.export") @Function("user.export")
public JsonResult export(HttpServletResponse response,UserQuery condtion) { @ResponseBody
public JsonResult<String> export(HttpServletResponse response,UserQuery condtion) {
String excelTemplate ="excelTemplates/admin/user/user_collection_template.xls"; String excelTemplate ="excelTemplates/admin/user/user_collection_template.xls";
PageQuery<CoreUser> page = condtion.getPageQuery(); PageQuery<CoreUser> page = condtion.getPageQuery();
//取出全部符合条件的 //取出全部符合条件的
...@@ -297,6 +298,7 @@ public class UserConsoleController { ...@@ -297,6 +298,7 @@ public class UserConsoleController {
Context context = new Context(); Context context = new Context();
context.putVar("users", users); context.putVar("users", users);
JxlsHelper.getInstance().processTemplate(is, os, context); JxlsHelper.getInstance().processTemplate(is, os, context);
//下载参考FileSystemContorller
return JsonResult.success(item.getId()); return JsonResult.success(item.getId());
} catch (IOException e) { } catch (IOException e) {
throw new PlatformException(e.getMessage()); throw new PlatformException(e.getMessage());
......
...@@ -126,8 +126,8 @@ layui.define([ 'form', 'laydate', 'table','userApi' ], function(exports) { ...@@ -126,8 +126,8 @@ layui.define([ 'form', 'laydate', 'table','userApi' ], function(exports) {
}, },
exportUsers:function(){ exportUsers:function(){
Common.openConfirm("确认要导出这些用户?",function(){ Common.openConfirm("确认要导出这些用户?",function(){
userApi.exportUsers($("#searchForm"),function(){ userApi.exportUsers($("#searchForm"),function(fileId){
Common.info("导出成功") Lib.download(fileId);
}) })
}) })
......
...@@ -30,8 +30,8 @@ layui.define([], function(exports) { ...@@ -30,8 +30,8 @@ layui.define([], function(exports) {
}, },
exportUsers:function(form,callback){ exportUsers:function(form,callback){
var formPara = form.serializeJson(); var formPara = form.serializeJson();
Common.post("/admin/user/excel/export.json", formPara, function() { Common.post("/admin/user/excel/export.json", formPara, function(fileId) {
callback(); callback(fileId);
}) })
} }
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
<layui:accessButton function="user.role" action="userRole">操作角色</layui:accessButton> <layui:accessButton function="user.role" action="userRole">操作角色</layui:accessButton>
<layui:accessButton function="user.role" action="userRole">流程角色</layui:accessButton> <layui:accessButton function="user.role" action="userRole">流程角色</layui:accessButton>
<layui:accessButton function="user.password" action="changePassword">修改密码</layui:accessButton> <layui:accessButton function="user.password" action="changePassword">修改密码</layui:accessButton>
<layui:accessButton function="user.export" action="export">导出</layui:accessButton> <layui:accessButton function="user.export" action="exportUsers">导出Excel</layui:accessButton>
<layui:accessButton function="user.import" action="import">导入</layui:accessButton> <layui:accessButton function="user.import" action="importUsers">导入</layui:accessButton>
</div> </div>
<table id="userTable" lay-filter="userTable"></table> <table id="userTable" lay-filter="userTable"></table>
......
...@@ -6,6 +6,7 @@ import javax.servlet.http.HttpServletResponse; ...@@ -6,6 +6,7 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
...@@ -17,6 +18,7 @@ import com.ibeetl.admin.core.file.FileService; ...@@ -17,6 +18,7 @@ import com.ibeetl.admin.core.file.FileService;
public class FileSystemContorller { public class FileSystemContorller {
private final Log log = LogFactory.getLog(this.getClass()); private final Log log = LogFactory.getLog(this.getClass());
private static final String MODEL = "/core/file"; private static final String MODEL = "/core/file";
@Autowired
FileService fileService; FileService fileService;
@GetMapping(MODEL + "/get.do") @GetMapping(MODEL + "/get.do")
public ModelAndView index(HttpServletResponse response,String id) throws IOException { public ModelAndView index(HttpServletResponse response,String id) throws IOException {
......
...@@ -228,6 +228,10 @@ var Lib = { ...@@ -228,6 +228,10 @@ var Lib = {
+ "</option>"); + "</option>");
} }
}, },
download:function(fileId){
window.location.href = Common.ctxPath+"/core/file/get.do?id="+fileId
},
/* 搜索 */ /* 搜索 */
doSearchForm : function(form, tableIns, page) { doSearchForm : function(form, tableIns, page) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment