@@ -130,13 +130,27 @@ namespace Learun.Application.Web.Areas.LR_OAModule.Controllers | |||||
/// <param name="folderId">文件夹Id</param> | /// <param name="folderId">文件夹Id</param> | ||||
/// <returns>返回列表Json</returns> | /// <returns>返回列表Json</returns> | ||||
[HttpGet] | [HttpGet] | ||||
public ActionResult GetListJson(string folderId) | |||||
public ActionResult GetListJson(string folderId,string keyword) | |||||
{ | { | ||||
string userId = LoginUserInfo.Get().userId; | string userId = LoginUserInfo.Get().userId; | ||||
var data = fileInfoBLL.GetList(folderId, userId); | var data = fileInfoBLL.GetList(folderId, userId); | ||||
return JsonResult(data); | return JsonResult(data); | ||||
} | } | ||||
/// <summary> | /// <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> | /// </summary> | ||||
/// <returns>返回列表Json</returns> | /// <returns>返回列表Json</returns> | ||||
@@ -268,7 +268,7 @@ var bootstrap = function ($, learun) { | |||||
$this.addClass('active'); | $this.addClass('active'); | ||||
var data_value = $this.context.dataset.value; | var data_value = $this.context.dataset.value; | ||||
switch (data_value) { | switch (data_value) { | ||||
case "allFile": | case "allFile": | ||||
_url = "/LR_OAModule/ResourceFile/GetListJson"; | _url = "/LR_OAModule/ResourceFile/GetListJson"; | ||||
@@ -279,6 +279,8 @@ var bootstrap = function ($, learun) { | |||||
$("#lr-delete").show(); | $("#lr-delete").show(); | ||||
$("#lr-share").show(); | $("#lr-share").show(); | ||||
$("#lr-more").show(); | $("#lr-more").show(); | ||||
$("#txt_Keyword").show(); | |||||
$("#btn_Search").show(); | |||||
break; | break; | ||||
case "allDocument": | case "allDocument": | ||||
_url = "/LR_OAModule/ResourceFile/GetDocumentListJson"; | _url = "/LR_OAModule/ResourceFile/GetDocumentListJson"; | ||||
@@ -286,6 +288,9 @@ var bootstrap = function ($, learun) { | |||||
$("#lr-download").show(); | $("#lr-download").show(); | ||||
$("#lr-delete").show(); | $("#lr-delete").show(); | ||||
$("#lr-share").show(); | $("#lr-share").show(); | ||||
$("#txt_Keyword").val(''); | |||||
$("#txt_Keyword").hide(); | |||||
$("#btn_Search").hide(); | |||||
break; | break; | ||||
case "allImage": | case "allImage": | ||||
_url = "/LR_OAModule/ResourceFile/GetImageListJson"; | _url = "/LR_OAModule/ResourceFile/GetImageListJson"; | ||||
@@ -293,6 +298,9 @@ var bootstrap = function ($, learun) { | |||||
$("#lr-download").show(); | $("#lr-download").show(); | ||||
$("#lr-delete").show(); | $("#lr-delete").show(); | ||||
$("#lr-share").show(); | $("#lr-share").show(); | ||||
$("#txt_Keyword").val(''); | |||||
$("#txt_Keyword").hide(); | |||||
$("#btn_Search").hide(); | |||||
break; | break; | ||||
case "recycledFile": | case "recycledFile": | ||||
_url = "/LR_OAModule/ResourceFile/GetRecycledListJson"; | _url = "/LR_OAModule/ResourceFile/GetRecycledListJson"; | ||||
@@ -300,17 +308,26 @@ var bootstrap = function ($, learun) { | |||||
$("#lr-restoreFile").show(); | $("#lr-restoreFile").show(); | ||||
$("#lr-thoroughDelete").show(); | $("#lr-thoroughDelete").show(); | ||||
$("#lr-emptyRecycled").show(); | $("#lr-emptyRecycled").show(); | ||||
$("#txt_Keyword").val(''); | |||||
$("#txt_Keyword").hide(); | |||||
$("#btn_Search").hide(); | |||||
break; | break; | ||||
case "myShare": | case "myShare": | ||||
_url = "/LR_OAModule/ResourceFile/GetMyShareListJson"; | _url = "/LR_OAModule/ResourceFile/GetMyShareListJson"; | ||||
$(".crumb-path").find('[data-folderid=allfile]').html('我的共享'); | $(".crumb-path").find('[data-folderid=allfile]').html('我的共享'); | ||||
$("#lr-cancelshare").show(); | $("#lr-cancelshare").show(); | ||||
$("#txt_Keyword").val(''); | |||||
$("#txt_Keyword").hide(); | |||||
$("#btn_Search").hide(); | |||||
break; | break; | ||||
case "othersShare": | case "othersShare": | ||||
_url = "/LR_OAModule/ResourceFile/GetOthersShareListJson"; | _url = "/LR_OAModule/ResourceFile/GetOthersShareListJson"; | ||||
$(".crumb-path").find('[data-folderid=allfile]').html('他人共享'); | $(".crumb-path").find('[data-folderid=allfile]').html('他人共享'); | ||||
//$gridTable.setGridParam().showCol("CreateUserName"); | //$gridTable.setGridParam().showCol("CreateUserName"); | ||||
$("#lr-download").show(); | $("#lr-download").show(); | ||||
$("#txt_Keyword").val(''); | |||||
$("#txt_Keyword").hide(); | |||||
$("#btn_Search").hide(); | |||||
break; | break; | ||||
default: | default: | ||||
break; | break; | ||||
@@ -330,7 +347,7 @@ var bootstrap = function ($, learun) { | |||||
initGrid: function () { | initGrid: function () { | ||||
var $gridTable = $("#gridTable"); | var $gridTable = $("#gridTable"); | ||||
$('#gridTable').jfGrid({ | $('#gridTable').jfGrid({ | ||||
url: top.$.rootUrl + '/LR_OAModule/ResourceFile/GetListJson', | |||||
url: top.$.rootUrl + '/LR_OAModule/ResourceFile/GetPageList', | |||||
headData: [ | headData: [ | ||||
{ | { | ||||
label: '文件名', name: 'F_FileName', width: 520, align: 'left', | label: '文件名', name: 'F_FileName', width: 520, align: 'left', | ||||
@@ -338,7 +355,7 @@ var bootstrap = function ($, learun) { | |||||
if (options.length != 0) { | 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>"; | 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', | 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); | 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) | public IEnumerable<FileInfoEntity> GetList(string userId) | ||||
{ | { | ||||
return service.GetList(userId); | return service.GetList(userId); | ||||
@@ -19,6 +19,7 @@ namespace Learun.Application.OA.File.FileInfo | |||||
/// <param name="userId">用户Id</param> | /// <param name="userId">用户Id</param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
IEnumerable<FileInfoEntity> GetList(string folderId, string userId); | IEnumerable<FileInfoEntity> GetList(string folderId, string userId); | ||||
IEnumerable<FileInfoEntity> GetList(string folderId, string userId, string queryJson); | |||||
IEnumerable<FileInfoEntity> GetList(string userId); | IEnumerable<FileInfoEntity> GetList(string userId); | ||||
IEnumerable<FileInfoEntity> GetList(); | IEnumerable<FileInfoEntity> GetList(); | ||||
@@ -1,7 +1,9 @@ | |||||
using Learun.DataBase.Repository; | |||||
using Dapper; | |||||
using Learun.DataBase.Repository; | |||||
using Learun.Util; | using Learun.Util; | ||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Data; | |||||
using System.Data.Common; | using System.Data.Common; | ||||
using System.Text; | using System.Text; | ||||
namespace Learun.Application.OA.File.FileInfo | namespace Learun.Application.OA.File.FileInfo | ||||
@@ -43,7 +45,7 @@ namespace Learun.Application.OA.File.FileInfo | |||||
dp = new { year = DateTime.Now.Year }; | dp = new { year = DateTime.Now.Year }; | ||||
strSql.Append(" and DATEPART(yyyy,F_CreateDate) = @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> | /// <summary> | ||||
@@ -60,7 +62,7 @@ namespace Learun.Application.OA.File.FileInfo | |||||
if (!string.IsNullOrEmpty(folderId)) | if (!string.IsNullOrEmpty(folderId)) | ||||
{ | { | ||||
folderCondition = " AND F_ParentId = @folderId"; | folderCondition = " AND F_ParentId = @folderId"; | ||||
fileCondition=" AND F_FolderId = @folderId"; | |||||
fileCondition = " AND F_FolderId = @folderId"; | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
@@ -88,12 +90,68 @@ namespace Learun.Application.OA.File.FileInfo | |||||
F_IsShare | F_IsShare | ||||
FROM LR_OA_FileInfo where F_DeleteMark = 0 "); | FROM LR_OA_FileInfo where F_DeleteMark = 0 "); | ||||
strSql.Append(fileCondition); | 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"); | 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 }); | return this.BaseRepository().FindList<FileInfoEntity>(strSql.ToString(), new { userId = userId, folderId = folderId }); | ||||
} | } | ||||
/// <summary> | /// <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> | /// </summary> | ||||
/// <param name="userId">用户Id</param> | /// <param name="userId">用户Id</param> | ||||