diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Controllers/ResourceFileController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Controllers/ResourceFileController.cs index 41d34382f..ebb8ca876 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Controllers/ResourceFileController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Controllers/ResourceFileController.cs @@ -130,13 +130,27 @@ namespace Learun.Application.Web.Areas.LR_OAModule.Controllers /// 文件夹Id /// 返回列表Json [HttpGet] - public ActionResult GetListJson(string folderId) + public ActionResult GetListJson(string folderId,string keyword) { string userId = LoginUserInfo.Get().userId; var data = fileInfoBLL.GetList(folderId, userId); return JsonResult(data); } /// + /// 获取页面显示列表数据 + /// + /// 分页参数 + /// 查询参数 + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetPageList(string folderId, string queryJson) + { + string userId = LoginUserInfo.Get().userId; + var data = fileInfoBLL.GetList(folderId, userId, queryJson); + return JsonResult(data); + } + /// /// 文档列表 /// /// 返回列表Json diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/ResourceFile/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/ResourceFile/Index.js index 07317e713..eb7460999 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/ResourceFile/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/ResourceFile/Index.js @@ -268,7 +268,7 @@ var bootstrap = function ($, learun) { $this.addClass('active'); var data_value = $this.context.dataset.value; - + switch (data_value) { case "allFile": _url = "/LR_OAModule/ResourceFile/GetListJson"; @@ -279,6 +279,8 @@ var bootstrap = function ($, learun) { $("#lr-delete").show(); $("#lr-share").show(); $("#lr-more").show(); + $("#txt_Keyword").show(); + $("#btn_Search").show(); break; case "allDocument": _url = "/LR_OAModule/ResourceFile/GetDocumentListJson"; @@ -286,6 +288,9 @@ var bootstrap = function ($, learun) { $("#lr-download").show(); $("#lr-delete").show(); $("#lr-share").show(); + $("#txt_Keyword").val(''); + $("#txt_Keyword").hide(); + $("#btn_Search").hide(); break; case "allImage": _url = "/LR_OAModule/ResourceFile/GetImageListJson"; @@ -293,6 +298,9 @@ var bootstrap = function ($, learun) { $("#lr-download").show(); $("#lr-delete").show(); $("#lr-share").show(); + $("#txt_Keyword").val(''); + $("#txt_Keyword").hide(); + $("#btn_Search").hide(); break; case "recycledFile": _url = "/LR_OAModule/ResourceFile/GetRecycledListJson"; @@ -300,17 +308,26 @@ var bootstrap = function ($, learun) { $("#lr-restoreFile").show(); $("#lr-thoroughDelete").show(); $("#lr-emptyRecycled").show(); + $("#txt_Keyword").val(''); + $("#txt_Keyword").hide(); + $("#btn_Search").hide(); break; case "myShare": _url = "/LR_OAModule/ResourceFile/GetMyShareListJson"; $(".crumb-path").find('[data-folderid=allfile]').html('我的共享'); $("#lr-cancelshare").show(); + $("#txt_Keyword").val(''); + $("#txt_Keyword").hide(); + $("#btn_Search").hide(); break; case "othersShare": _url = "/LR_OAModule/ResourceFile/GetOthersShareListJson"; $(".crumb-path").find('[data-folderid=allfile]').html('他人共享'); //$gridTable.setGridParam().showCol("CreateUserName"); $("#lr-download").show(); + $("#txt_Keyword").val(''); + $("#txt_Keyword").hide(); + $("#btn_Search").hide(); break; default: break; @@ -330,7 +347,7 @@ var bootstrap = function ($, learun) { initGrid: function () { var $gridTable = $("#gridTable"); $('#gridTable').jfGrid({ - url: top.$.rootUrl + '/LR_OAModule/ResourceFile/GetListJson', + url: top.$.rootUrl + '/LR_OAModule/ResourceFile/GetPageList', headData: [ { label: '文件名', name: 'F_FileName', width: 520, align: 'left', @@ -338,7 +355,7 @@ var bootstrap = function ($, learun) { if (options.length != 0) { return "
" + options.F_FileName + "
"; } - } + } }, { label: '大小', name: 'F_FileSize', index: 'F_FileSize', width: 100, align: 'center', diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/File/FileInfo/FileInfoBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/File/FileInfo/FileInfoBLL.cs index 1f199ff9b..3f02718ef 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/File/FileInfo/FileInfoBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/File/FileInfo/FileInfoBLL.cs @@ -25,6 +25,16 @@ namespace Learun.Application.OA.File.FileInfo { return service.GetList(folderId, userId); } + /// + /// 所有文件(夹)列表 + /// + /// 文件夹Id + /// 用户Id + /// + public IEnumerable GetList(string folderId, string userId, string queryJson) + { + return service.GetList(folderId, userId, queryJson); + } public IEnumerable GetList(string userId) { return service.GetList(userId); diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/File/FileInfo/FileInfoIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/File/FileInfo/FileInfoIBLL.cs index df2d8f347..c2bc96b66 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/File/FileInfo/FileInfoIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/File/FileInfo/FileInfoIBLL.cs @@ -19,6 +19,7 @@ namespace Learun.Application.OA.File.FileInfo /// 用户Id /// IEnumerable GetList(string folderId, string userId); + IEnumerable GetList(string folderId, string userId, string queryJson); IEnumerable GetList(string userId); IEnumerable GetList(); diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/File/FileInfo/FileInfoService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/File/FileInfo/FileInfoService.cs index f038d9021..3f0a1f832 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/File/FileInfo/FileInfoService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/File/FileInfo/FileInfoService.cs @@ -1,7 +1,9 @@ -using Learun.DataBase.Repository; +using Dapper; +using Learun.DataBase.Repository; using Learun.Util; using System; using System.Collections.Generic; +using System.Data; using System.Data.Common; using System.Text; namespace Learun.Application.OA.File.FileInfo @@ -43,7 +45,7 @@ namespace Learun.Application.OA.File.FileInfo dp = new { year = DateTime.Now.Year }; strSql.Append(" and DATEPART(yyyy,F_CreateDate) = @year "); } - return this.BaseRepository().FindList(strSql.ToString(),dp); + return this.BaseRepository().FindList(strSql.ToString(), dp); } /// @@ -60,7 +62,7 @@ namespace Learun.Application.OA.File.FileInfo if (!string.IsNullOrEmpty(folderId)) { folderCondition = " AND F_ParentId = @folderId"; - fileCondition=" AND F_FolderId = @folderId"; + fileCondition = " AND F_FolderId = @folderId"; } else { @@ -88,12 +90,68 @@ namespace Learun.Application.OA.File.FileInfo F_IsShare FROM LR_OA_FileInfo where F_DeleteMark = 0 "); strSql.Append(fileCondition); - strSql.Append(") t WHERE F_CreateUserId = @userId"); - + strSql.Append(") t WHERE F_CreateUserId = @userId"); + strSql.Append(" ORDER BY CASE WHEN F_FileType = 'folder' THEN 1 ELSE 2 END, F_ModifyDate ASC"); return this.BaseRepository().FindList(strSql.ToString(), new { userId = userId, folderId = folderId }); } /// + /// 所有文件(夹)列表 + /// + /// 文件夹Id + /// 用户Id + /// + public IEnumerable GetList(string folderId, string userId, string queryJson) + { + + var strSql = new StringBuilder(); + string folderCondition = ""; + string fileCondition = ""; + if (!string.IsNullOrEmpty(folderId)) + { + folderCondition = " AND F_ParentId = @folderId"; + fileCondition = " AND F_FolderId = @folderId"; + } + else + { + fileCondition = " AND F_FolderId = '0'"; + } + strSql.Append(@"SELECT * + FROM ( SELECT F_FolderId AS F_FileId , + F_ParentId AS F_FolderId , + F_FolderName AS F_FileName , + '' AS F_FileSize , + 'folder' AS F_FileType , + F_CreateUserId, + F_ModifyDate, + F_IsShare + FROM LR_OA_FileFolder where F_DeleteMark = 0"); + strSql.Append(folderCondition); + strSql.Append(" UNION "); + strSql.Append(@"SELECT F_FileId , + F_FolderId , + F_FileName , + F_FileSize , + F_FileType , + F_CreateUserId, + F_ModifyDate, + F_IsShare + FROM LR_OA_FileInfo where F_DeleteMark = 0 "); + strSql.Append(fileCondition); + strSql.Append(") t WHERE F_CreateUserId = @userId"); + var queryParam = queryJson.ToJObject(); + // 虚拟参数 + var dp = new DynamicParameters(new { }); + if (!queryParam["keyword"].IsEmpty()) + { + string keyword = "%" + queryParam["keyword"].ToString() + "%"; + strSql.Append(" AND F_FileName like '" + keyword + "' "); + } + strSql.Append(" ORDER BY CASE WHEN F_FileType = 'folder' THEN 1 ELSE 2 END, F_ModifyDate ASC"); + + return this.BaseRepository().FindList(strSql.ToString(), new { userId = userId, folderId = folderId }); + } + /// /// 文档列表 /// /// 用户Id