@@ -130,13 +130,27 @@ namespace Learun.Application.Web.Areas.LR_OAModule.Controllers | |||
/// <param name="folderId">文件夹Id</param> | |||
/// <returns>返回列表Json</returns> | |||
[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); | |||
} | |||
/// <summary> | |||
/// 获取页面显示列表数据 | |||
/// </summary> | |||
/// <param name="pagination">分页参数</param> | |||
/// <param name="queryJson">查询参数</param> | |||
/// <returns></returns> | |||
[HttpGet] | |||
[AjaxOnly] | |||
public ActionResult GetPageList(string folderId, string queryJson) | |||
{ | |||
string userId = LoginUserInfo.Get().userId; | |||
var data = fileInfoBLL.GetList(folderId, userId, queryJson); | |||
return JsonResult(data); | |||
} | |||
/// <summary> | |||
/// 文档列表 | |||
/// </summary> | |||
/// <returns>返回列表Json</returns> | |||
@@ -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 "<div style='cursor:pointer;'><div style='float: left;'><img src='" + top.$.rootUrl + "/Content/images/filetype/" + options.F_FileType + ".png' style='width:30px;height:30px;padding:5px;margin-left:-5px;margin-right:5px;' /></div><div style='float: left;line-height:35px;'>" + options.F_FileName + "</div></div>"; | |||
} | |||
} | |||
} | |||
}, | |||
{ | |||
label: '大小', name: 'F_FileSize', index: 'F_FileSize', width: 100, align: 'center', | |||
@@ -25,6 +25,16 @@ namespace Learun.Application.OA.File.FileInfo | |||
{ | |||
return service.GetList(folderId, userId); | |||
} | |||
/// <summary> | |||
/// 所有文件(夹)列表 | |||
/// </summary> | |||
/// <param name="folderId">文件夹Id</param> | |||
/// <param name="userId">用户Id</param> | |||
/// <returns></returns> | |||
public IEnumerable<FileInfoEntity> GetList(string folderId, string userId, string queryJson) | |||
{ | |||
return service.GetList(folderId, userId, queryJson); | |||
} | |||
public IEnumerable<FileInfoEntity> GetList(string userId) | |||
{ | |||
return service.GetList(userId); | |||
@@ -19,6 +19,7 @@ namespace Learun.Application.OA.File.FileInfo | |||
/// <param name="userId">用户Id</param> | |||
/// <returns></returns> | |||
IEnumerable<FileInfoEntity> GetList(string folderId, string userId); | |||
IEnumerable<FileInfoEntity> GetList(string folderId, string userId, string queryJson); | |||
IEnumerable<FileInfoEntity> GetList(string userId); | |||
IEnumerable<FileInfoEntity> GetList(); | |||
@@ -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<FileInfoEntity>(strSql.ToString(),dp); | |||
return this.BaseRepository().FindList<FileInfoEntity>(strSql.ToString(), dp); | |||
} | |||
/// <summary> | |||
@@ -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<FileInfoEntity>(strSql.ToString(), new { userId = userId, folderId = folderId }); | |||
} | |||
/// <summary> | |||
/// 所有文件(夹)列表 | |||
/// </summary> | |||
/// <param name="folderId">文件夹Id</param> | |||
/// <param name="userId">用户Id</param> | |||
/// <returns></returns> | |||
public IEnumerable<FileInfoEntity> 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<FileInfoEntity>(strSql.ToString(), new { userId = userId, folderId = folderId }); | |||
} | |||
/// <summary> | |||
/// 文档列表 | |||
/// </summary> | |||
/// <param name="userId">用户Id</param> | |||