@@ -117,13 +117,11 @@ namespace Learun.Application.Web.Areas.LR_OAModule.Controllers | |||
/// <summary> | |||
/// 所有文件(夹)列表 | |||
/// </summary> | |||
/// <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); | |||
var data = fileInfoBLL.GetAllList(folderId, keyword); | |||
return JsonResult(data); | |||
} | |||
/// <summary> | |||
@@ -131,10 +129,9 @@ namespace Learun.Application.Web.Areas.LR_OAModule.Controllers | |||
/// </summary> | |||
/// <returns>返回列表Json</returns> | |||
[HttpGet] | |||
public ActionResult GetDocumentListJson() | |||
public ActionResult GetDocumentListJson(string keyword) | |||
{ | |||
string userId = LoginUserInfo.Get().userId; | |||
var data = fileInfoBLL.GetDocumentList(userId); | |||
var data = fileInfoBLL.GetDocumentList(keyword); | |||
return JsonResult(data); | |||
} | |||
/// <summary> | |||
@@ -142,10 +139,9 @@ namespace Learun.Application.Web.Areas.LR_OAModule.Controllers | |||
/// </summary> | |||
/// <returns>返回列表Json</returns> | |||
[HttpGet] | |||
public ActionResult GetImageListJson() | |||
public ActionResult GetImageListJson(string keyword) | |||
{ | |||
string userId = LoginUserInfo.Get().userId; | |||
var data = fileInfoBLL.GetImageList(userId); | |||
var data = fileInfoBLL.GetImageList(keyword); | |||
return JsonResult(data); | |||
} | |||
/// <summary> | |||
@@ -153,10 +149,9 @@ namespace Learun.Application.Web.Areas.LR_OAModule.Controllers | |||
/// </summary> | |||
/// <returns>返回列表Json</returns> | |||
[HttpGet] | |||
public ActionResult GetRecycledListJson() | |||
public ActionResult GetRecycledListJson(string keyword) | |||
{ | |||
string userId = LoginUserInfo.Get().userId; | |||
var data = fileInfoBLL.GetRecycledList(userId); | |||
var data = fileInfoBLL.GetRecycledList(keyword); | |||
return JsonResult(data); | |||
} | |||
/// <summary> | |||
@@ -164,10 +159,9 @@ namespace Learun.Application.Web.Areas.LR_OAModule.Controllers | |||
/// </summary> | |||
/// <returns>返回列表Json</returns> | |||
[HttpGet] | |||
public ActionResult GetMyShareListJson() | |||
public ActionResult GetMyShareListJson(string keyword) | |||
{ | |||
string userId = LoginUserInfo.Get().userId; | |||
var data = fileInfoBLL.GetMyShareList(userId); | |||
var data = fileInfoBLL.GetMyShareList(keyword); | |||
return JsonResult(data); | |||
} | |||
/// <summary> | |||
@@ -175,10 +169,9 @@ namespace Learun.Application.Web.Areas.LR_OAModule.Controllers | |||
/// </summary> | |||
/// <returns>返回列表Json</returns> | |||
[HttpGet] | |||
public ActionResult GetOthersShareListJson() | |||
public ActionResult GetOthersShareListJson(string keyword) | |||
{ | |||
string userId = LoginUserInfo.Get().userId; | |||
var data = fileInfoBLL.GetOthersShareList(userId); | |||
var data = fileInfoBLL.GetOthersShareList(keyword); | |||
return JsonResult(data); | |||
} | |||
/// <summary> | |||
@@ -7,6 +7,8 @@ | |||
*/ | |||
var refreshGirdData; | |||
var keyword; | |||
var folderId; | |||
var bootstrap = function ($, learun) { | |||
"use strict"; | |||
@@ -22,8 +24,12 @@ var bootstrap = function ($, learun) { | |||
bind: function () { | |||
// 查询 | |||
$('#btn_Search').on('click', function () { | |||
var keyword = $('#txt_Keyword').val(); | |||
page.search({ keyword: keyword }); | |||
keyword = $('#txt_Keyword').val(); | |||
$.lrSetForm(top.$.rootUrl + _url + '?keyword=' + keyword, function (data) {// | |||
$('#gridTable').jfGridSet('refreshdata', data); | |||
}); | |||
//page.search(); | |||
}); | |||
// 刷新 | |||
$('#lr_refresh').on('click', function () { | |||
@@ -33,17 +39,18 @@ var bootstrap = function ($, learun) { | |||
$(".crumb-path span").click(function () { | |||
var value = $(this).attr('data-folderId'); | |||
var folderId = $(".crumb-path span:last").attr('data-folderId'); | |||
var where = '&keyword=' + keyword; | |||
//console.log(value); | |||
if (value == "back") { | |||
if (folderId == 0) { | |||
$(".crumb-path .back").hide(); | |||
} | |||
$.lrSetForm(top.$.rootUrl + _url + '?folderId=' + folderId, function (data) {// | |||
$.lrSetForm(top.$.rootUrl + _url + '?folderId=' + folderId + where, function (data) {// | |||
$('#gridTable').jfGridSet('refreshdata', data); | |||
}); | |||
$(".crumb-path span:last").remove(); | |||
} else { | |||
$.lrSetForm(top.$.rootUrl + _url + '?folderId=0', function (data) {// | |||
$.lrSetForm(top.$.rootUrl + _url + '?folderId=0' + where, function (data) {// | |||
$('#gridTable').jfGridSet('refreshdata', data); | |||
}); | |||
$(".crumb-path .back").hide(); | |||
@@ -268,7 +275,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"; | |||
@@ -336,7 +343,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', | |||
@@ -392,6 +399,8 @@ var bootstrap = function ($, learun) { | |||
}, | |||
search: function (param) { | |||
param = param || {}; | |||
param.keyword = keyword; | |||
param.folderId = folderId; | |||
$('#gridTable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); | |||
}, | |||
//初始化页面 | |||
@@ -21,9 +21,9 @@ namespace Learun.Application.OA.File.FileInfo | |||
/// <param name="folderId">文件夹Id</param> | |||
/// <param name="userId">用户Id</param> | |||
/// <returns></returns> | |||
public IEnumerable<FileInfoEntity> GetList(string folderId, string userId) | |||
public IEnumerable<FileInfoEntity> GetAllList(string folderId, string keyword) | |||
{ | |||
return service.GetList(folderId, userId); | |||
return service.GetAllList(folderId, keyword); | |||
} | |||
public IEnumerable<FileInfoEntity> GetList(string userId) | |||
{ | |||
@@ -38,45 +38,45 @@ namespace Learun.Application.OA.File.FileInfo | |||
/// </summary> | |||
/// <param name="userId">用户Id</param> | |||
/// <returns></returns> | |||
public IEnumerable<FileInfoEntity> GetDocumentList(string userId) | |||
public IEnumerable<FileInfoEntity> GetDocumentList(string keyword) | |||
{ | |||
return service.GetDocumentList(userId); | |||
return service.GetDocumentList(keyword); | |||
} | |||
/// <summary> | |||
/// 图片列表 | |||
/// </summary> | |||
/// <param name="userId">用户Id</param> | |||
/// <returns></returns> | |||
public IEnumerable<FileInfoEntity> GetImageList(string userId) | |||
public IEnumerable<FileInfoEntity> GetImageList(string keyword) | |||
{ | |||
return service.GetImageList(userId); | |||
return service.GetImageList(keyword); | |||
} | |||
/// <summary> | |||
/// 回收站文件(夹)列表 | |||
/// </summary> | |||
/// <param name="userId">用户Id</param> | |||
/// <returns></returns> | |||
public IEnumerable<FileInfoEntity> GetRecycledList(string userId) | |||
public IEnumerable<FileInfoEntity> GetRecycledList(string keyword) | |||
{ | |||
return service.GetRecycledList(userId); | |||
return service.GetRecycledList(keyword); | |||
} | |||
/// <summary> | |||
/// 我的文件(夹)共享列表 | |||
/// </summary> | |||
/// <param name="userId">用户Id</param> | |||
/// <returns></returns> | |||
public IEnumerable<FileInfoEntity> GetMyShareList(string userId) | |||
public IEnumerable<FileInfoEntity> GetMyShareList(string keyword) | |||
{ | |||
return service.GetMyShareList(userId); | |||
return service.GetMyShareList(keyword); | |||
} | |||
/// <summary> | |||
/// 他人文件(夹)共享列表 | |||
/// </summary> | |||
/// <param name="userId">用户Id</param> | |||
/// <returns></returns> | |||
public IEnumerable<FileInfoEntity> GetOthersShareList(string userId) | |||
public IEnumerable<FileInfoEntity> GetOthersShareList(string keyword) | |||
{ | |||
return service.GetOthersShareList(userId); | |||
return service.GetOthersShareList(keyword); | |||
} | |||
/// <summary> | |||
/// 文件信息实体 | |||
@@ -12,13 +12,14 @@ namespace Learun.Application.OA.File.FileInfo | |||
public interface FileInfoIBLL | |||
{ | |||
#region 获取数据 | |||
/// <summary> | |||
/// 所有文件(夹)列表 | |||
/// </summary> | |||
/// <param name="folderId">文件夹Id</param> | |||
/// <param name="userId">用户Id</param> | |||
/// <returns></returns> | |||
IEnumerable<FileInfoEntity> GetList(string folderId, string userId); | |||
IEnumerable<FileInfoEntity> GetAllList(string folderId, string keyword); | |||
IEnumerable<FileInfoEntity> GetList(string userId); | |||
IEnumerable<FileInfoEntity> GetList(); | |||
@@ -27,31 +28,31 @@ namespace Learun.Application.OA.File.FileInfo | |||
/// </summary> | |||
/// <param name="userId">用户Id</param> | |||
/// <returns></returns> | |||
IEnumerable<FileInfoEntity> GetDocumentList(string userId); | |||
IEnumerable<FileInfoEntity> GetDocumentList(string keyword); | |||
/// <summary> | |||
/// 图片列表 | |||
/// </summary> | |||
/// <param name="userId">用户Id</param> | |||
/// <returns></returns> | |||
IEnumerable<FileInfoEntity> GetImageList(string userId); | |||
IEnumerable<FileInfoEntity> GetImageList(string keyword); | |||
/// <summary> | |||
/// 回收站文件(夹)列表 | |||
/// </summary> | |||
/// <param name="userId">用户Id</param> | |||
/// <returns></returns> | |||
IEnumerable<FileInfoEntity> GetRecycledList(string userId); | |||
IEnumerable<FileInfoEntity> GetRecycledList(string keyword); | |||
/// <summary> | |||
/// 我的文件(夹)共享列表 | |||
/// </summary> | |||
/// <param name="userId">用户Id</param> | |||
/// <returns></returns> | |||
IEnumerable<FileInfoEntity> GetMyShareList(string userId); | |||
IEnumerable<FileInfoEntity> GetMyShareList(string keyword); | |||
/// <summary> | |||
/// 他人文件(夹)共享列表 | |||
/// </summary> | |||
/// <param name="userId">用户Id</param> | |||
/// <returns></returns> | |||
IEnumerable<FileInfoEntity> GetOthersShareList(string userId); | |||
IEnumerable<FileInfoEntity> GetOthersShareList(string keyword); | |||
/// <summary> | |||
/// 文件信息实体 | |||
/// </summary> | |||
@@ -1,4 +1,5 @@ | |||
using Learun.DataBase.Repository; | |||
using Learun.Util; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Data.Common; | |||
@@ -30,23 +31,26 @@ namespace Learun.Application.OA.File.FileInfo | |||
/// <summary> | |||
/// 所有文件(夹)列表 | |||
/// </summary> | |||
/// <param name="folderId">文件夹Id</param> | |||
/// <param name="userId">用户Id</param> | |||
/// <returns></returns> | |||
public IEnumerable<FileInfoEntity> GetList(string folderId, string userId) | |||
public IEnumerable<FileInfoEntity> GetAllList(string folderId,string keyword) | |||
{ | |||
var strSql = new StringBuilder(); | |||
string folderCondition = ""; | |||
string fileCondition = ""; | |||
if (!string.IsNullOrEmpty(folderId)) | |||
{ | |||
folderCondition = " AND F_ParentId = @folderId"; | |||
fileCondition=" AND F_FolderId = @folderId"; | |||
folderCondition = $" AND F_ParentId = '{folderId}'"; | |||
fileCondition = $" AND F_FolderId = '{folderId}'"; | |||
} | |||
else | |||
{ | |||
fileCondition = " AND F_FolderId = '0'"; | |||
} | |||
if (!string.IsNullOrEmpty(keyword)) | |||
{ | |||
folderCondition = $" AND F_FolderName like '%{keyword}%'"; | |||
fileCondition = $" AND F_FileName like '%{keyword}%'"; | |||
} | |||
strSql.Append(@"SELECT * | |||
FROM ( SELECT F_FolderId AS F_FileId , | |||
F_ParentId AS F_FolderId , | |||
@@ -69,17 +73,17 @@ 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 }); | |||
var userId = LoginUserInfo.Get().userId; | |||
return this.BaseRepository().FindList<FileInfoEntity>(strSql.ToString(), new { userId = userId }); | |||
} | |||
/// <summary> | |||
/// 文档列表 | |||
/// </summary> | |||
/// <param name="userId">用户Id</param> | |||
/// <returns></returns> | |||
public IEnumerable<FileInfoEntity> GetDocumentList(string userId) | |||
public IEnumerable<FileInfoEntity> GetDocumentList(string keyword) | |||
{ | |||
var strSql = new StringBuilder(); | |||
strSql.Append(@"SELECT F_FileId , | |||
@@ -95,15 +99,20 @@ namespace Learun.Application.OA.File.FileInfo | |||
AND F_FileType IN ( 'log', 'txt', 'pdf', 'doc', 'docx', 'ppt', 'pptx', | |||
'xls', 'xlsx' ) | |||
AND F_CreateUserId = @userId"); | |||
if (!string.IsNullOrEmpty(keyword)) | |||
{ | |||
strSql.Append($" and F_FileName like '%{keyword}%'"); | |||
} | |||
strSql.Append(" ORDER BY F_ModifyDate ASC"); | |||
var userId = LoginUserInfo.Get().userId; | |||
return this.BaseRepository().FindList<FileInfoEntity>(strSql.ToString(), new { userId = userId }); | |||
} | |||
/// <summary> | |||
/// 图片列表 | |||
/// </summary> | |||
/// <param name="userId">用户Id</param> | |||
/// <returns></returns> | |||
public IEnumerable<FileInfoEntity> GetImageList(string userId) | |||
public IEnumerable<FileInfoEntity> GetImageList(string keyword) | |||
{ | |||
var strSql = new StringBuilder(); | |||
strSql.Append(@"SELECT F_FileId , | |||
@@ -118,79 +127,101 @@ namespace Learun.Application.OA.File.FileInfo | |||
WHERE F_DeleteMark = 0 | |||
AND F_FileType IN ( 'ico', 'gif', 'jpeg', 'jpg', 'png', 'psd' ) | |||
AND F_CreateUserId = @userId"); | |||
if (!string.IsNullOrEmpty(keyword)) | |||
{ | |||
strSql.Append($" and F_FileName like '%{keyword}%'"); | |||
} | |||
var userId = LoginUserInfo.Get().userId; | |||
strSql.Append(" ORDER BY F_ModifyDate ASC"); | |||
return this.BaseRepository().FindList<FileInfoEntity>(strSql.ToString(), new { userId = userId }); | |||
} | |||
/// <summary> | |||
/// 回收站文件(夹)列表 | |||
/// </summary> | |||
/// <param name="userId">用户Id</param> | |||
/// <returns></returns> | |||
public IEnumerable<FileInfoEntity> GetRecycledList(string userId) | |||
public IEnumerable<FileInfoEntity> GetRecycledList(string keyword) | |||
{ | |||
var strSql = new StringBuilder(); | |||
strSql.Append(@"SELECT * | |||
FROM ( SELECT F_FolderId AS F_FileId , | |||
FROM ( "); | |||
var folderSql = @"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 | |||
FROM LR_OA_FileFolder where F_DeleteMark = 1 | |||
UNION | |||
SELECT F_FileId , | |||
FROM LR_OA_FileFolder where F_DeleteMark = 1"; | |||
var fileinfoSql = @"SELECT F_FileId , | |||
F_FolderId , | |||
F_FileName , | |||
F_FileSize , | |||
F_FileType , | |||
F_CreateUserId, | |||
F_ModifyDate | |||
FROM LR_OA_FileInfo where F_DeleteMark = 1 | |||
) t WHERE F_CreateUserId = @userId"); | |||
FROM LR_OA_FileInfo where F_DeleteMark = 1"; | |||
if (!string.IsNullOrEmpty(keyword)) | |||
{ | |||
folderSql = folderSql + $" and F_FolderName like '%{keyword}%'"; | |||
fileinfoSql = fileinfoSql + $" and F_FileName like '%{keyword}%'"; | |||
} | |||
strSql.Append(folderSql + "UNION "); | |||
strSql.Append(fileinfoSql); | |||
strSql.Append(") t WHERE F_CreateUserId = @userId"); | |||
var userId = LoginUserInfo.Get().userId; | |||
strSql.Append(" ORDER BY F_ModifyDate DESC"); | |||
return this.BaseRepository().FindList<FileInfoEntity>(strSql.ToString(), new { userId = userId }); | |||
} | |||
/// <summary> | |||
/// 我的文件(夹)共享列表 | |||
/// </summary> | |||
/// <param name="userId">用户Id</param> | |||
/// <returns></returns> | |||
public IEnumerable<FileInfoEntity> GetMyShareList(string userId) | |||
public IEnumerable<FileInfoEntity> GetMyShareList(string keyword) | |||
{ | |||
var strSql = new StringBuilder(); | |||
strSql.Append(@"SELECT * | |||
FROM ( SELECT F_FolderId AS F_FileId , | |||
FROM ( "); | |||
var folderSql = @"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 | |||
FROM LR_OA_FileFolder WHERE F_DeleteMark = 0 AND F_IsShare = 1 | |||
UNION | |||
SELECT F_FileId , | |||
FROM LR_OA_FileFolder WHERE F_DeleteMark = 0 AND F_IsShare = 1"; | |||
var fileinfoSql = @"SELECT F_FileId , | |||
F_FolderId , | |||
F_FileName , | |||
F_FileSize , | |||
F_FileType , | |||
F_CreateUserId, | |||
F_ModifyDate | |||
FROM LR_OA_FileInfo WHERE F_DeleteMark = 0 AND F_IsShare = 1 | |||
) t WHERE F_CreateUserId = @userId"); | |||
FROM LR_OA_FileInfo WHERE F_DeleteMark = 0 AND F_IsShare = 1"; | |||
if (!string.IsNullOrEmpty(keyword)) | |||
{ | |||
folderSql = folderSql + $" and F_FolderName like '%{keyword}%'"; | |||
fileinfoSql = fileinfoSql + $" and F_FileName like '%{keyword}%'"; | |||
} | |||
strSql.Append(folderSql + "UNION "); | |||
strSql.Append(fileinfoSql); | |||
strSql.Append(") t WHERE F_CreateUserId = @userId"); | |||
var userId = LoginUserInfo.Get().userId; | |||
strSql.Append(" ORDER BY F_ModifyDate DESC"); | |||
return this.BaseRepository().FindList<FileInfoEntity>(strSql.ToString(), new { userId = userId }); | |||
} | |||
/// <summary> | |||
/// 他人文件(夹)共享列表 | |||
/// </summary> | |||
/// <param name="userId">用户Id</param> | |||
/// <returns></returns> | |||
public IEnumerable<FileInfoEntity> GetOthersShareList(string userId) | |||
public IEnumerable<FileInfoEntity> GetOthersShareList(string keyword) | |||
{ | |||
var strSql = new StringBuilder(); | |||
strSql.Append(@"SELECT * | |||
FROM ( SELECT F_FolderId AS F_FileId , | |||
FROM ( "); | |||
var folderSql = @"SELECT F_FolderId AS F_FileId , | |||
F_ParentId AS F_FolderId , | |||
F_FolderName AS F_FileName , | |||
'' AS F_FileSize , | |||
@@ -198,9 +229,8 @@ namespace Learun.Application.OA.File.FileInfo | |||
F_CreateUserId, | |||
F_CreateUserName, | |||
F_ShareTime AS F_ModifyDate | |||
FROM LR_OA_FileFolder WHERE F_DeleteMark = 0 AND F_IsShare = 1 | |||
UNION | |||
SELECT F_FileId , | |||
FROM LR_OA_FileFolder WHERE F_DeleteMark = 0 AND F_IsShare = 1"; | |||
var fileinfoSql = @" SELECT F_FileId , | |||
F_FolderId , | |||
F_FileName , | |||
F_FileSize , | |||
@@ -208,9 +238,18 @@ namespace Learun.Application.OA.File.FileInfo | |||
F_CreateUserId, | |||
F_CreateUserName, | |||
F_ShareTime AS F_ModifyDate | |||
FROM LR_OA_FileInfo WHERE F_DeleteMark = 0 AND F_IsShare = 1 | |||
) t WHERE F_CreateUserId != @userId"); | |||
FROM LR_OA_FileInfo WHERE F_DeleteMark = 0 AND F_IsShare = 1"; | |||
if (!string.IsNullOrEmpty(keyword)) | |||
{ | |||
folderSql = folderSql + $" and F_FolderName like '%{keyword}%'"; | |||
fileinfoSql = fileinfoSql + $" and F_FileName like '%{keyword}%'"; | |||
} | |||
strSql.Append(folderSql + "UNION "); | |||
strSql.Append(fileinfoSql); | |||
strSql.Append(") t WHERE F_CreateUserId != @userId"); | |||
strSql.Append(" ORDER BY F_ModifyDate DESC"); | |||
var userId = LoginUserInfo.Get().userId; | |||
return this.BaseRepository().FindList<FileInfoEntity>(strSql.ToString(), new { userId = userId }); | |||
} | |||
/// <summary> | |||