整理代码来自论坛:http://bbs.wex5.com/forum.php?mod=viewthread&tid=105114
UI2/system/components/juetsp/attachment目录下的attachmentSimple.js文件进行修改,找到deleteFile 这个方法 然后修改成如下代码
deleteFile:function(storeFileName,ownerID){ if(typeof storeFileName === "object"){ var $object = storeFileName; storeFileName = $object.storeFileName.get(); ownerID = this.getOwnerID($object); } this.removeItemByStoreID(storeFileName,ownerID); var url = this.actionUrl + '?storeFileName=' + storeFileName + '&ownerID=' + ownerID + '&operateType=delete'; url = require.toUrl(url); $.ajax({ url:url, cache:false, async:false }); },
修改后保存,然后运行wex5目录下的tools/dist/dist.bat进行资源合并
修改完成JS文件后 再修改JAVA文件
打开baas/justep目录下的SimpleFileStore.java文件
找到doGet 修改为如下代码:
private static void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { getDocStoreDir(request); String operateType = request.getParameter("operateType"); if("copy".equals(operateType)){ copyFile(request,response); }else if("delete".equals(operateType)){ deleteFile(request,response); }else{ getFile(request,response); } } //然后增加一个deleteFile方法,复制粘贴如下代码: private static void deleteFile(HttpServletRequest request, HttpServletResponse response) throws IOException { String ownerID = request.getParameter("ownerID"); String storeFileName = request.getParameter("storeFileName"); File file = new File(docStorePath + File.separator +ownerID + File.separator + storeFileName); file.delete(); }
修改完成后保存。
保存之后,一定要进行模型编译,重启Tomcat.
案例下载:点击demo下载
评一波