From b39a8181ea86084187244df126209a852f236804 Mon Sep 17 00:00:00 2001 From: dyy <18335927079@163.com> Date: Thu, 3 Sep 2020 18:08:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=96=87=E4=BB=B6=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD=EF=BC=88=E5=B8=A6?= =?UTF-8?q?=E6=B5=81=E7=A8=8B=E5=AE=A1=E6=A0=B8=E3=80=81=E5=B8=A6=E6=9D=83?= =?UTF-8?q?=E9=99=90=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/AnnexesController.cs | 1 - .../Controllers/FilesController.cs | 444 +++++++++++ .../Views/Files/FileAuthAddFrom.cshtml | 21 + .../Views/Files/FileAuthAddFrom.js | 62 ++ .../Views/Files/FileAuthFrom.cshtml | 34 + .../Views/Files/FileAuthFrom.js | 91 +++ .../Views/Files/FileAuthIndex.cshtml | 57 ++ .../Views/Files/FileAuthIndex.js | 109 +++ .../Views/Files/FileHistroyIndex.cshtml | 13 + .../Views/Files/FileHistroyIndex.js | 103 +++ .../Views/Files/FolderForm.cshtml | 15 + .../LR_SystemModule/Views/Files/FolderForm.js | 53 ++ .../Views/Files/FolderIndex.cshtml | 36 + .../Views/Files/FolderIndex.css | 7 + .../Views/Files/FolderIndex.js | 93 +++ .../LR_SystemModule/Views/Files/Form.cshtml | 37 + .../Areas/LR_SystemModule/Views/Files/Form.js | 190 +++++ .../LR_SystemModule/Views/Files/Index.cshtml | 73 ++ .../LR_SystemModule/Views/Files/Index.css | 14 + .../LR_SystemModule/Views/Files/Index.js | 716 ++++++++++++++++++ .../Learun.Application.Web.csproj | 19 + .../Views/LR_Content/script/lr-form.js | 124 ++- .../LR_Content/style/lr-iframe-index.css | 36 + .../XmlConfig/ioc.config | 4 + .../Files/FileAuth/FileAuthBLL.cs | 92 +++ .../Files/FileAuth/FileAuthEntity.cs | 106 +++ .../Files/FileAuth/FileAuthIBLL.cs | 51 ++ .../Files/FileAuth/FileAuthService.cs | 215 ++++++ .../Files/FileInfo/FileBInfoEntity.cs | 119 +++ .../Files/FileInfo/FileInfoBLL.cs | 211 ++++++ .../Files/FileInfo/FileInfoIBLL.cs | 105 +++ .../Files/FileInfo/FileInfoService.cs | 683 +++++++++++++++++ .../Files/FileInfo/FilelistEntity.cs | 119 +++ .../Files/FileInfo/WFFileModel.cs | 112 +++ .../Files/Folder/FolderBLL.cs | 197 +++++ .../Files/Folder/FolderEntity.cs | 66 ++ .../Files/Folder/FolderIBLL.cs | 53 ++ .../Files/Folder/FolderService.cs | 357 +++++++++ .../Learun.Application.Base.csproj | 14 + .../LR_Files/FileAuthMap.cs | 21 + .../LR_Files/FileInfoMap.cs | 21 + .../LR_Files/FilelistMap.cs | 21 + .../LR_Files/FolderMap.cs | 28 + ...erMap.cs.110478.1.2020-09-03.15-28-05.2401 | 31 + .../Learun.Application.Mapping.csproj | 4 + .../Learun.Application.WorkFlow.csproj | 1 + .../NodeMethod/WF/WFFileRelease.cs | 21 + 47 files changed, 4986 insertions(+), 14 deletions(-) create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/FilesController.cs create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileAuthAddFrom.cshtml create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileAuthAddFrom.js create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileAuthFrom.cshtml create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileAuthFrom.js create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileAuthIndex.cshtml create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileAuthIndex.js create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileHistroyIndex.cshtml create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileHistroyIndex.js create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FolderForm.cshtml create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FolderForm.js create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FolderIndex.cshtml create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FolderIndex.css create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FolderIndex.js create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/Form.cshtml create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/Form.js create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/Index.cshtml create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/Index.css create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/Index.js create mode 100644 Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileAuth/FileAuthBLL.cs create mode 100644 Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileAuth/FileAuthEntity.cs create mode 100644 Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileAuth/FileAuthIBLL.cs create mode 100644 Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileAuth/FileAuthService.cs create mode 100644 Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileInfo/FileBInfoEntity.cs create mode 100644 Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileInfo/FileInfoBLL.cs create mode 100644 Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileInfo/FileInfoIBLL.cs create mode 100644 Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileInfo/FileInfoService.cs create mode 100644 Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileInfo/FilelistEntity.cs create mode 100644 Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileInfo/WFFileModel.cs create mode 100644 Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/Folder/FolderBLL.cs create mode 100644 Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/Folder/FolderEntity.cs create mode 100644 Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/Folder/FolderIBLL.cs create mode 100644 Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/Folder/FolderService.cs create mode 100644 Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LR_Files/FileAuthMap.cs create mode 100644 Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LR_Files/FileInfoMap.cs create mode 100644 Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LR_Files/FilelistMap.cs create mode 100644 Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LR_Files/FolderMap.cs create mode 100644 Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LR_Files/_sgbak/FolderMap.cs.110478.1.2020-09-03.15-28-05.2401 create mode 100644 Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/NodeMethod/WF/WFFileRelease.cs diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/AnnexesController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/AnnexesController.cs index 0e769c8d7..918e5e506 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/AnnexesController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/AnnexesController.cs @@ -140,7 +140,6 @@ namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers /// 文件id /// [HttpPost] - [ValidateAntiForgeryToken] public void DownAnnexesFile(string fileId) { var data = annexesFileIBLL.GetEntity(fileId); diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/FilesController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/FilesController.cs new file mode 100644 index 000000000..bbbb4ec06 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/FilesController.cs @@ -0,0 +1,444 @@ +using Learun.Application.Base.Files; +using Learun.Application.Base.SystemModule; +using System.Web.Mvc; +using System; +using Learun.Util; +using Learun.Application.WorkFlow; +using System.Collections.Generic; + +namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers +{ + /// + /// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架 + /// Copyright (c) 2013-2018 上海力软信息技术有限公司 + /// 创 建:超级管理员 + /// 日 期:2019-11-28 09:23 + /// 描 述:文件管理 + /// + public class FilesController : MvcControllerBase + { + private FolderIBLL folderIBLL = new FolderBLL(); + private FileInfoIBLL fileInfoIBLL = new FileInfoBLL(); + private FileAuthIBLL fileAuthIBLL = new FileAuthBLL(); + + private CodeRuleIBLL codeRuleIBLL = new CodeRuleBLL(); + + private NWFProcessIBLL nWFProcessIBLL = new NWFProcessBLL(); + + #region 视图功能 + /// + /// 文件管理 + /// + /// + [HttpGet] + public ActionResult Index() + { + return View(); + } + /// + /// 文件发布页面 + /// + /// + [HttpGet] + public ActionResult Form() + { + return View(); + } + + /// + /// 文件夹管理 + /// + /// + [HttpGet] + public ActionResult FolderIndex() { + return View(); + } + + /// + /// 文件夹管理表单 + /// + /// + [HttpGet] + public ActionResult FolderForm() + { + return View(); + } + /// + /// 文件授权 + /// + /// + [HttpGet] + public ActionResult FileAuthIndex() + { + return View(); + } + /// + /// 文件授权 + /// + /// + [HttpGet] + public ActionResult FileAuthFrom() + { + return View(); + } + + /// + /// 文件授权 + /// + /// + [HttpGet] + public ActionResult FileAuthAddFrom() + { + return View(); + } + /// + /// 文件历史 + /// + /// + [HttpGet] + public ActionResult FileHistroyIndex() + { + return View(); + } + #endregion + + + #region 获取数据 + /// + /// 获取文件夹数据 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetFolderList(string keyWord) + { + var data = folderIBLL.GetList(keyWord, null); + return Success(data); + } + + /// + /// 获取文件夹列表(树结构) + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetFolderTree() + { + var data = folderIBLL.GetTree(); + return this.Success(data); + } + /// + /// 获取字典分类列表(树结构) + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetFolderEntity(string keyValue) + { + var data = folderIBLL.GetEntity(keyValue); + return this.Success(data); + } + + [HttpGet] + [AjaxOnly] + public ActionResult GetFileInfoByWF(string processId, string fileInfoId) + { + var fileListEntity = fileInfoIBLL.GetListEntity(processId); + if (fileListEntity != null) { + fileInfoId = fileListEntity.F_FileInfoId; + } + + string ver = "V1.0"; + FileBInfoEntity fileInfoEntity = null; + string code; + if (string.IsNullOrEmpty(fileInfoId)) + { + code = codeRuleIBLL.GetBillCode("FS01"); + } + else + { + fileInfoEntity = fileInfoIBLL.GetEntity(fileInfoId); + code = fileInfoEntity.F_Code; + if (fileListEntity == null) + { + var fileListEntity2 = fileInfoIBLL.GetListEntityByInfoId(fileInfoId); + if (fileListEntity2 != null) + { + string[] verList = fileListEntity2.F_Ver.Split('.'); + var l = verList.Length; + ver = ""; + for (var i = 0; i < l; i++) + { + if (i < l - 1) + { + ver += verList[i] + "."; + } + else + { + ver += (Convert.ToInt32(verList[i]) + 1); + } + } + } + } + else { + ver = fileListEntity.F_Ver; + } + + } + + var jsondata = new { + ver, + code, + fileInfoEntity, + fileListEntity + }; + + return this.Success(jsondata); + } + + + /// + /// 获取我的流程信息列表 + /// + /// 分页参数 + /// 查询条件 + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetWFPageList(string pagination, string keyWord, string wfType) + { + Pagination paginationobj = pagination.ToObject(); + IEnumerable list = new List(); + UserInfo userInfo = LoginUserInfo.Get(); + string strSql = ""; + + + switch (wfType) + { + case "1":// 我的流程 + strSql = nWFProcessIBLL.GetMySql(); + break; + case "2":// 待办流程 + strSql = nWFProcessIBLL.GetMyTaskSql(userInfo); + break; + case "3":// 已办流程 + strSql = nWFProcessIBLL.GetMyFinishTaskSql(); + break; + } + + list = fileInfoIBLL.GetWfPageList(strSql, paginationobj, keyWord, userInfo.userId); + + var jsonData = new + { + rows = list, + paginationobj.total, + paginationobj.page, + paginationobj.records, + }; + return Success(jsonData); + } + + + /// + /// 获取我的流程信息列表 + /// + /// 分页参数 + /// 查询条件 + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetAllPublishPageList(string keyWord, string folderId) + { + var list = fileInfoIBLL.GetAllPublishPageList(keyWord, folderId); + return Success(list); + } + /// + /// 获取正式发布的文件 + /// + /// 文件夹Id + /// 查询条件 + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetPublishList(string keyWord, string folderId) + { + var list = fileInfoIBLL.GetPublishList(keyWord, folderId); + return Success(list); + } + + /// + /// 文件的历史信息 + /// + /// 文件夹Id + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetHistoryList(string fileInfoId) + { + var list = fileInfoIBLL.GetHistoryList(fileInfoId); + return Success(list); + } + + /// + /// 被删除的文件信息 + /// + /// 文件夹Id + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetDeleteList(string fileInfoId) + { + var list = fileInfoIBLL.GetDeleteList(fileInfoId); + return Success(list); + } + #endregion + + #region 提交数据 + [HttpPost] + [AjaxOnly] + public ActionResult SaveFolder(string keyValue,FolderEntity entity) + { + folderIBLL.SaveEntity(keyValue,entity); + return this.Success("保存成功"); + } + [HttpPost] + [AjaxOnly] + public ActionResult DeleteFolder(string keyValue) + { + var res = folderIBLL.DeleteEntity(keyValue); + if (res) + { + return this.Success("删除成功"); + } + else { + return this.Success("不准删除,有文件或子文件夹"); + } + } + + /// + /// 虚拟删除文件 + /// + /// + /// + [HttpPost] + [AjaxOnly] + public ActionResult VDeleteFile(string keyValue) + { + fileInfoIBLL.VDeleteEntity(keyValue); + return this.Success("删除成功"); + } + /// + /// 还原虚拟删除文件 + /// + /// + /// + [HttpPost] + [AjaxOnly] + public ActionResult RecoveryFile(string keyValue) + { + fileInfoIBLL.RecoveryEntity(keyValue); + return this.Success("删除成功"); + } + /// + /// 彻底删除文件 + /// + /// + /// + [HttpPost] + [AjaxOnly] + public ActionResult DeleteFile(string keyValue) + { + fileInfoIBLL.DeleteEntity(keyValue); + return this.Success("删除成功"); + } + + /// + /// 保存数据 + /// + /// 主键 + /// 文件信息 + /// 文件列表信息 + /// + [HttpPost] + [AjaxOnly] + public ActionResult SaveFile(string keyValue, string strInfoEntity, string strListEntity) + { + FileBInfoEntity fileBInfoEntity = strInfoEntity.ToObject(); + FilelistEntity filelistEntity = strListEntity.ToObject(); + if (string.IsNullOrEmpty(fileBInfoEntity.F_Id)) + { + codeRuleIBLL.UseRuleSeed("FS01"); + } + fileInfoIBLL.SaveEntity(keyValue, fileBInfoEntity, filelistEntity); + + return this.Success("保存成功"); + } + + #endregion + + #region 权限管理 + /// + /// 判断文件有没有上传权限 + /// + /// + /// + public ActionResult IsUPLoad(string folderId) { + var res = fileAuthIBLL.IsUPLoad(folderId); + return Success(res); + } + /// + /// 获取我的流程信息列表 + /// + /// 文件信息主键 + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetAuthList(string fileInfoId) + { + var list = fileAuthIBLL.GetList(fileInfoId); + return Success(list); + } + [HttpGet] + [AjaxOnly] + public ActionResult GetAuthEntity(string keyValue) + { + var list = fileAuthIBLL.GetEntity(keyValue); + return Success(list); + } + + /// + /// 删除授权对象 + /// + /// 主键 + /// + [HttpPost] + [AjaxOnly] + public ActionResult DeleteAuth(string keyValue) + { + fileAuthIBLL.DeleteEntity(keyValue); + return this.Success("删除成功"); + } + /// + /// 保存授权信息 + /// + /// 主键 + /// 实体数据 + /// + [HttpPost] + [AjaxOnly] + public ActionResult SaveAuth(string keyValue, FileAuthEntity entity) + { + var res = fileAuthIBLL.SaveEntity(keyValue, entity); + if (res) + { + return this.Success("保存成功"); + } + else { + return this.Success("该角色已经对该文件授权过!"); + } + + } + + #endregion + } +} \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileAuthAddFrom.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileAuthAddFrom.cshtml new file mode 100644 index 000000000..2c31664d4 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileAuthAddFrom.cshtml @@ -0,0 +1,21 @@ + +@{ + ViewBag.Title = "FileAuthAddFrom"; + Layout = "~/Views/Shared/_Form.cshtml"; +} + +
+
+
授权角色*
+
+
+
+
权限类型*
+
+
+
+
到期时间
+ +
+
+@Html.AppendJsFile("/Areas/LR_SystemModule/Views/Files/FileAuthAddFrom.js") \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileAuthAddFrom.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileAuthAddFrom.js new file mode 100644 index 000000000..7e4a6c7dc --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileAuthAddFrom.js @@ -0,0 +1,62 @@ +var fileInfoId = request('fileInfoId'); +var isFolder = request('isFolder'); +var keyValue = request('keyValue'); + +var acceptClick; +var bootstrap = function ($, learun) { + "use strict"; + var auditorName; + var page = { + init: function () { + page.bind(); + page.initData(); + }, + bind: function () { + $('#F_ObjId').lrselect({ + url: top.$.rootUrl + '/LR_OrganizationModule/Role/GetList', + text: 'F_FullName', + value: 'F_RoleId', + select: function (item) { + auditorName = item.F_FullName; + }, + allowSearch: true + }); + // 1 查看 2上传 3 下载 4 删除 5 复原 + $('#F_AuthType').lrselect({ + text: 'name', + value: 'id', + data: [{ id: '1', name: '查看' }, { id: '2', name: '上传' }, { id: '3', name: '下载' }, { id: '4', name: '删除' }, { id: '5', name: '复原' }, { id: '6', name: '彻底删除' }], + type: 'multiple' + }).lrselectSet('1'); + }, + initData: function () { + if (keyValue) { + $.lrSetForm(top.$.rootUrl + '/LR_SystemModule/Files/GetAuthEntity?keyValue=' + keyValue, function (data) {// + if (data.F_Time == "9999-12-31 00:00:00") { + data.F_Time = ''; + } + $('#form').lrSetFormData(data); + }); + } + } + }; + // 保存数据 + acceptClick = function (callBack) { + if (!$('#form').lrValidform()) { + return false; + } + var postData = $('#form').lrGetFormData(keyValue); + postData.F_ObjType = 2; + postData.F_ObjName = auditorName; + postData.F_FileInfoId = fileInfoId; + postData.F_IsFolder = isFolder; + $.lrSaveForm(top.$.rootUrl + '/LR_SystemModule/Files/SaveAuth?keyValue=' + keyValue, postData, function (res) { + // 保存成功后才回调 + if (!!callBack) { + callBack(); + } + }); + }; + + page.init(); +} \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileAuthFrom.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileAuthFrom.cshtml new file mode 100644 index 000000000..c2476c172 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileAuthFrom.cshtml @@ -0,0 +1,34 @@ +@{ + ViewBag.Title = "FileAuthFrom"; + Layout = "~/Views/Shared/_Index.cshtml"; +} + +
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+ +@Html.AppendJsFile("/Areas/LR_SystemModule/Views/Files/FileAuthFrom.js") \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileAuthFrom.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileAuthFrom.js new file mode 100644 index 000000000..e3368f97b --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileAuthFrom.js @@ -0,0 +1,91 @@ +var fileInfoId = request('fileInfoId'); +var isFolder = request('isFolder'); +var refreshGirdData; +var bootstrap = function ($, learun) { + "use strict"; + + var page = { + init: function () { + // 新增 + $('#lr_add').on('click', function () { + learun.layerForm({ + id: 'FolderForm', + title: '添加授权对象', + url: top.$.rootUrl + '/LR_SystemModule/Files/FileAuthAddFrom?fileInfoId=' + fileInfoId + "&isFolder=" + isFolder, + width: 500, + height: 400, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + }); + // 编辑 + $('#lr_edit').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('F_Id'); + if (learun.checkrow(keyValue)) { + learun.layerForm({ + id: 'FileAuthAddFrom', + title: '编辑授权对象', + url: top.$.rootUrl + '/LR_SystemModule/Files/FileAuthAddFrom?keyValue=' + keyValue + '&fileInfoId=' + fileInfoId + "&isFolder=" + isFolder, + width: 500, + height: 400, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + } + }); + // 删除 + $('#lr_delete').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('F_Id'); + if (learun.checkrow(keyValue)) { + learun.layerConfirm('是否确认删除该授权对象!', function (res) { + if (res) { + learun.deleteForm(top.$.rootUrl + '/LR_SystemModule/Files/DeleteAuth', { keyValue: keyValue }, function () { + refreshGirdData(); + }); + } + }); + } + }); + + + + $('#gridtable').jfGrid({ + url: top.$.rootUrl + '/LR_SystemModule/Files/GetAuthList', + headData: [ + { label: '角色名称', name: 'F_ObjName', width: 100, align: 'left' }, + { + label: '到期时间', name: 'F_Time', width: 120, align: 'left', + formatter: function (cellvalue) { + if (cellvalue == '9999-12-31 00:00:00') { + return '永久'; + } else if (cellvalue == 0) { + return learun.formatDate(cellvalue,'yyyy-MM-dd'); + } + } + }, + { + label: '权限类型', name: 'F_AuthType', width: 300, align: 'left', formatter: function (cellvalue) { + cellvalue = cellvalue || ''; + return cellvalue.replace('1', '查看').replace('2', '上传').replace('3', '下载').replace('4', '删除').replace('5', '复原'); + } + } + ], + mainId: 'F_Id' + }); + page.search(); + }, + search: function (param) { + $('#gridtable').jfGridSet('reload', { fileInfoId: fileInfoId}); + } + }; + + + // 保存数据后回调刷新 + refreshGirdData = function () { + $('#gridtable').jfGridSet('reload'); + } + + page.init(); +} \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileAuthIndex.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileAuthIndex.cshtml new file mode 100644 index 000000000..fdd17c983 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileAuthIndex.cshtml @@ -0,0 +1,57 @@ + +@{ + ViewBag.Title = "FileAuthIndex"; + Layout = "~/Views/Shared/_Index.cshtml"; +} + +
+
+
+
+
+
+ +
+
+  查询 +
+
+
+
+ +
+ +
+
+
+
+
+ 主目录 +
+
+
+
+
+
+
+ +@Html.AppendJsFile("/Areas/LR_SystemModule/Views/Files/FileAuthIndex.js") \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileAuthIndex.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileAuthIndex.js new file mode 100644 index 000000000..3a62f315d --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileAuthIndex.js @@ -0,0 +1,109 @@ +var bootstrap = function ($, learun) { + "use strict"; + var folderId = "0"; + var page = { + init: function () { + + // 查询 + $('#btn_Search').on('click', function () { + var keyword = $('#txt_Keyword').val(); + page.search({ keyword: keyword }); + }); + $('#lr_auth').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('F_Id'); + var name = $('#gridtable').jfGridValue('F_Name'); + var type = $('#gridtable').jfGridValue('Type'); + if (learun.checkrow(keyValue)) { + var isFolder = '0'; + if (type == '2') { + isFolder = '1' + } + learun.layerForm({ + id: 'FileAuthFrom', + title: '授权【' + name + '】', + url: top.$.rootUrl + '/LR_SystemModule/Files/FileAuthFrom?fileInfoId=' + keyValue + "&isFolder=" + isFolder, + width: 800, + height: 500, + maxmin: true, + btn: null + }); + } + + }); + $('#lr_main_auth').on('click', function () { + learun.layerForm({ + id: 'FileAuthFrom', + title: '授权主目录', + url: top.$.rootUrl + '/LR_SystemModule/Files/FileAuthFrom?fileInfoId=0&isFolder=1', + width: 800, + height: 500, + maxmin: true, + btn: null, + end: function () { + + } + }); + + }); + + $('#pathList').on('click', '.path-item', function () { + var $this = $(this); + $this.nextAll().remove(); + folderId = $this.attr('data-fileid'); + page.openFolder(); + }); + $('#gridtable').jfGrid({ + url: top.$.rootUrl + '/LR_SystemModule/Files/GetAllPublishPageList', + headData: [ + { + label: '文件名', name: 'F_Name', width: 400, align: 'left', + formatter: function (cellvalue, row) { + return "
" + cellvalue + "
"; + } + }, + { + label: '文件编号', name: 'F_Code', width: 120, align: 'left' + }, + { + label: '文件版本', name: 'F_Ver', width: 60, align: 'center' + }, + { + label: '操作', name: 'F_Id', width: 200, align: 'left', + formatter: function (value, row, op, $cell) { + var $div = $('
'); + if (row.Type == '2') { + var $openFolder = $('打开'); + $openFolder.on('click', function () { + folderId = value; + page.openFolder(); + $('#pathList').append('/ ' + row.F_Name + ''); + }); + $div.append($openFolder); + } + + return $div; + } + } + ], + mainId: 'F_Id' + }); + + page.search(); + }, + openFolder: function () { + page.search(); + }, + search: function (param) { + param = param || {}; + param.folderId = folderId || "0"; + + if (param.folderId == "0") { + $('#pathList [data-fileid="0"]').nextAll().remove(); + } + + $('#gridtable').jfGridSet('reload', param); + } + }; + + page.init(); +} \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileHistroyIndex.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileHistroyIndex.cshtml new file mode 100644 index 000000000..574dc246a --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileHistroyIndex.cshtml @@ -0,0 +1,13 @@ + +@{ + ViewBag.Title = "FileHistroyIndex"; + Layout = "~/Views/Shared/_Index.cshtml"; +} + +
+
+ +
+
+ +@Html.AppendJsFile("/Areas/LR_SystemModule/Views/Files/FileHistroyIndex.js") \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileHistroyIndex.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileHistroyIndex.js new file mode 100644 index 000000000..dd1829f3b --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileHistroyIndex.js @@ -0,0 +1,103 @@ +var fileInfoId = request('fileInfoId'); +var bootstrap = function ($, learun) { + "use strict"; + + //1 查看 2上传 3 下载 4 删除 5 复原 + var btnName = { + '1': '查看', + '2': '上传', + '3': '下载', + '4': '删除', + '5': '复原', + '6': '彻底删除' + } + var page = { + init: function () { + $('#gridtable').jfGrid({ + url: top.$.rootUrl + '/LR_SystemModule/Files/GetHistoryList?fileInfoId=' + fileInfoId, + headData: [ + { + label: '文件名', name: 'F_Name', width: 300, align: 'left', + formatter: function (cellvalue, row) { + return "
" + cellvalue + "
"; + } + }, + { + label: '文件版本', name: 'F_Ver', width: 60, align: 'center' + }, + { + label: '大小', name: 'F_FileSize', width: 100, align: 'center', + formatter: function (cellvalue) { + return page.CountFileSize(cellvalue); + } + }, + { + label: '操作', name: 'F_Id', width: 200, align: 'left', + formatter: function (value, row, op, $cell) { + var $div = $('
'); + var btnlist = row.F_AuthType.split(','); + $.each(btnlist, function (_index, _item) { + if (_item != '6' && _item != '5' && _item != '4' && _item != '2' && $div.find('[data-value="' + _item + '"]').length == 0) { + var $btn = $('' + btnName[_item] + ''); + $btn[0]._row = row; + $btn.on('click', function () { + var $this = $(this); + var btnValue = $this.attr('data-value'); + var btnRow = $this[0]._row; + switch (btnValue) { + case '1':// 查看 + learun.layerForm({ + id: 'PreviewForm', + title: '文件预览', + url: top.$.rootUrl + '/LR_SystemModule/Annexes/PreviewFile?fileId=' + btnRow.F_PFiled, + width: 1080, + height: 850, + btn: null + }); + break; + case '3':// 下载 + learun.download({ url: top.$.rootUrl + '/LR_SystemModule/Annexes/DownAnnexesFile', param: { fileId: btnRow.F_FileId }, method: 'POST' }); + break; + } + }); + $div.append($btn); + } + + }); + + return $div; + } + } + ], + mainId: 'F_Id' + }); + $('#gridtable').jfGridSet('reload'); + }, + CountFileSize: function (Size) { + var m_strSize = ""; + var FactSize = 0; + FactSize = Size; + if (FactSize < 1024.00) + m_strSize = page.ToDecimal(FactSize) + " 字节"; + else if (FactSize >= 1024.00 && FactSize < 1048576) + m_strSize = page.ToDecimal(FactSize / 1024.00) + " KB"; + else if (FactSize >= 1048576 && FactSize < 1073741824) + m_strSize = page.ToDecimal(FactSize / 1024.00 / 1024.00) + " MB"; + else if (FactSize >= 1073741824) + m_strSize = page.ToDecimal(FactSize / 1024.00 / 1024.00 / 1024.00) + " GB"; + return m_strSize; + }, + ToDecimal: function (x) { + var f = parseFloat(x); + if (isNaN(f)) { + return 0; + } + f = Math.round(x * 100) / 100; + return f; + } + + + }; + + page.init(); +} \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FolderForm.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FolderForm.cshtml new file mode 100644 index 000000000..522ebb995 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FolderForm.cshtml @@ -0,0 +1,15 @@ +@{ + ViewBag.Title = "文件夹管理"; + Layout = "~/Views/Shared/_Form.cshtml"; +} +
+
+
上级
+
+
+
+
名称*
+ +
+
+@Html.AppendJsFile("/Areas/LR_SystemModule/Views/Files/FolderForm.js") \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FolderForm.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FolderForm.js new file mode 100644 index 000000000..08f3d0eb4 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FolderForm.js @@ -0,0 +1,53 @@ +var parentId = request('parentId'); +var keyValue = request('keyValue'); + +var acceptClick; +var bootstrap = function ($, learun) { + "use strict"; + + var page = { + init: function () { + page.bind(); + page.initData(); + }, + bind: function () { + // 上级 + $('#F_PId').lrselect({ + url: top.$.rootUrl + '/LR_SystemModule/Files/GetFolderTree', + type: 'tree', + allowSearch: true, + maxHeight: 225 + }).lrselectSet(parentId); + }, + initData: function () { + if (keyValue) { + $.lrSetForm(top.$.rootUrl + '/LR_SystemModule/Files/GetFolderEntity?keyValue=' + keyValue, function (data) {// + $('#form').lrSetFormData(data); + }); + //$('#form').lrSetFormData(selectedRow); + } + } + }; + // 保存数据 + acceptClick = function (callBack) { + if (!$('#form').lrValidform()) { + return false; + } + var postData = $('#form').lrGetFormData(keyValue); + if (postData["F_PId"] == '' || postData["F_PId"] == ' ' || postData["F_PId"] == '-1') { + postData["F_PId"] = '0'; + } + else if (postData["F_PId"] == keyValue) { + learun.alert.error('上级不能是自己本身!'); + return false; + } + $.lrSaveForm(top.$.rootUrl + '/LR_SystemModule/Files/SaveFolder?keyValue=' + keyValue, postData, function (res) { + // 保存成功后才回调 + if (!!callBack) { + callBack(); + } + }); + }; + + page.init(); +} \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FolderIndex.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FolderIndex.cshtml new file mode 100644 index 000000000..2fd5744cf --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FolderIndex.cshtml @@ -0,0 +1,36 @@ +@{ + ViewBag.Title = "文件夹管理"; + Layout = "~/Views/Shared/_Index.cshtml"; +} +@Html.AppendCssFile("/Areas/LR_SystemModule/Views/Files/FolderIndex.css") +
+
+
+
+
+
+ +
+
+  查询 +
+
+
+
+ +
+ +
+
+
+
+
+
+@Html.AppendJsFile("/Areas/LR_SystemModule/Views/Files/FolderIndex.js") + + + diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FolderIndex.css b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FolderIndex.css new file mode 100644 index 000000000..6732e4302 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FolderIndex.css @@ -0,0 +1,7 @@ +.lr-layout { + padding: 0px; +} + +.lr-layout-wrap { + border-radius: 0px; +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FolderIndex.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FolderIndex.js new file mode 100644 index 000000000..ad91c6183 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FolderIndex.js @@ -0,0 +1,93 @@ +var refreshGirdData; // 更新数据 +var selectedRow; +var bootstrap = function ($, learun) { + "use strict"; + var page = { + init: function () { + page.initGrid(); + page.bind(); + }, + bind: function () { + // 查询 + $('#btn_Search').on('click', function () { + var keyword = $('#txt_Keyword').val(); + page.search({ keyword: keyword }); + }); + // 刷新 + $('#lr_refresh').on('click', function () { + location.reload(); + }); + // 新增 + $('#lr_add').on('click', function () { + var f_Id = $('#gridtable').jfGridValue('F_Id'); + learun.layerForm({ + id: 'FolderForm', + title: '添加文件夹', + url: top.$.rootUrl + '/LR_SystemModule/Files/FolderForm?parentId=' + f_Id, + width: 400, + height: 400, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + }); + // 编辑 + $('#lr_edit').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('F_Id'); + if (learun.checkrow(keyValue)) { + learun.layerForm({ + id: 'FolderForm', + title: '编辑文件夹', + url: top.$.rootUrl + '/LR_SystemModule/Files/FolderForm?keyValue=' + keyValue, + width: 400, + height: 400, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + } + }); + // 删除 + $('#lr_delete').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('F_Id'); + if (learun.checkrow(keyValue)) { + learun.layerConfirm('是否确认删除该文件夹!', function (res) { + if (res) { + learun.deleteForm(top.$.rootUrl + '/LR_SystemModule/Files/DeleteFolder', { keyValue: keyValue }, function () { + refreshGirdData(); + }); + } + }); + } + }); + }, + initGrid: function () { + $('#gridtable').jfGrid({ + url: top.$.rootUrl + '/LR_SystemModule/Files/GetFolderList', + headData: [ + { label: '名称', name: 'F_Name', width: 400, align: 'left' }, + { + label: "修改时间", name: "F_Time", width: 120, align: "left" + } + ], + isTree: true, + mainId: 'F_Id', + parentId: 'F_PId', + reloadSelected: true + }); + page.search(); + }, + search: function (param) { + $('#gridtable').jfGridSet('reload', param); + } + }; + + // 保存数据后回调刷新 + refreshGirdData = function () { + $('#gridtable').jfGridSet('reload'); + } + + page.init(); +} + + diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/Form.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/Form.cshtml new file mode 100644 index 000000000..cb527693c --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/Form.cshtml @@ -0,0 +1,37 @@ + +@{ + ViewBag.Title = "Form"; + Layout = "~/Views/Shared/_Form.cshtml"; +} + +
+
+
文件编号*
+ +
+
+
文件版本号*
+ +
+
+
文件名称*
+ +
+
+
所在文件夹*
+
+
+
+
文件关键字
+ +
+
+
原始文件*
+
+
+
+
预览文件*
+
+
+
+@Html.AppendJsFile("/Areas/LR_SystemModule/Views/Files/Form.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/Form.js new file mode 100644 index 000000000..c32ef8c4e --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/Form.js @@ -0,0 +1,190 @@ +// 设置权限 +var setAuthorize; +// 设置表单数据 +var setFormData; +// 验证数据是否填写完整 +var validForm; +// 保存数据 +var save; + +var isUpdate = false; + +var bootstrap = function ($, learun) { + "use strict"; + + var fileInfoId = ''; + + // 设置权限 + setAuthorize = function (data, isLook) { + $('#F_Folder').lrselect({ + url: top.$.rootUrl + '/LR_SystemModule/Files/GetFolderTree', + type: 'tree', + allowSearch: true, + maxHeight: 225, + select: function (item) { + if (item) { + if (item.id == '-1') { + learun.alert.warning("请选择文件夹!"); + } + else { + if (!$('#F_Folder')[0]._setflag) { + if (item.checkstate != 2) { + learun.alert.warning("当前文件夹没有写入权限请重新选择!"); + $('#F_Folder').lrselectSet(""); + } + } else { + var text = $('#F_Folder .lr-select-placeholder').text().replace('【无权限】', ''); + $('#F_Folder .lr-select-placeholder').text(text); + $('#F_Folder')[0]._setflag = false; + } + } + } + } + }); + if (isLook) { + $('input,#F_Folder').attr('readonly', 'readonly'); + $('#F_FileId').lrUploader({ isDown: true, isView: false, isUpload: false }); + $('#F_PFiled').lrUploader({ isDown: false, isView: true, isUpload: false }); + } + else { + for (var i = 0, l = data.length; i < l; i++) { + var field = data[i]; + if (field.isLook != 1) {// 如果没有查看权限就直接移除 + $('#' + field.fieldId).parent().remove(); + } + else { + if (field.isEdit != 1) { + $('#' + field.fieldId).attr('disabled', 'disabled'); + if ($('#' + field.fieldId).hasClass('lrUploader-wrap')) { + $('#' + field.fieldId).css({ 'padding-right': '58px' }); + $('#' + field.fieldId).find('.btn-success').remove(); + } + } + } + } + + $('#F_FileId').lrUploader({ isDown: false, isView: false }); + $('#F_PFiled').lrUploader({ isDown: false, isView: false }); + } + + + + + + }; + // 设置表单数据 + setFormData = function (processId, _fileInfoId, callback, userId) { + if (processId) { + fileInfoId = _fileInfoId; + $.lrSetForm(top.$.rootUrl + '/LR_SystemModule/Files/GetFileInfoByWF?processId=' + processId + "&fileInfoId=" + _fileInfoId, function (data) {// + console.log(data); + $('#F_Code').val(data.code); + if (data.fileInfoEntity != null) { + data.fileInfoEntity.F_Folder = null; + $('#form').lrSetFormData(data.fileInfoEntity); + } + if (data.fileListEntity != null) { + isUpdate = true; + fileInfoId = data.fileListEntity.F_FileInfoId; + $('#F_FileId').lrUploaderSet(data.fileListEntity.F_FileId); + $('#F_PFiled').lrUploaderSet(data.fileListEntity.F_PFiled); + + $('#F_Name').val(data.fileListEntity.F_Name); + if (data.fileListEntity.F_Folder != '' || data.fileListEntity.F_Folder != null) + { + $('#F_Folder')[0]._setflag = true; + $('#F_Folder').lrselectSet(data.fileListEntity.F_Folder); + } + + + + $('#F_KeyWord').val(data.fileListEntity.F_KeyWord); + } + $('#F_Ver').val(data.ver); + setPbtn(); + callback(); + + }); + } + else { + setPbtn(); + callback(); + } + }; + // 验证数据是否填写完整 + validForm = function (code) { + if (!$('#form').lrValidform()) { + return false; + } + if (code == 'create') { + if ($('#F_FileId').find('.lrUploader-input').text() == '') { + learun.alert.error("请上传【原始文件】"); + return false; + } + if ($('#F_PFiled').find('.lrUploader-input').text() == '') { + learun.alert.error("请上传【预览文件】"); + return false; + } + } + + return true; + }; + // 保存调用函数 + save = function (processId, callBack, i) { + var keyValue = ""; + + if (isUpdate) { + keyValue = processId; + } + + var formData = $('#form').lrGetFormData(fileInfoId); + + var infoEntity = { + F_Id: fileInfoId, + F_Code: formData.F_Code, + //F_Name: formData.F_Name, + //F_KeyWord: formData.F_KeyWord, + //F_Folder: formData.F_Folder || '0' + } + + + var listEntity = { + F_Id: processId, + F_FileId: formData.F_FileId, + F_PFiled: formData.F_PFiled, + F_Ver: formData.F_Ver, + + F_Name: formData.F_Name, + F_KeyWord: formData.F_KeyWord, + F_Folder: formData.F_Folder || '0' + } + + if (listEntity.F_Folder == ' ') { + listEntity.F_Folder = '0'; + } + + + var postData = { + strInfoEntity: JSON.stringify(infoEntity), + strListEntity: JSON.stringify(listEntity) + }; + + + $.lrSaveForm(top.$.rootUrl + '/LR_SystemModule/Files/SaveFile?keyValue=' + keyValue, postData, function (res) { + // 保存成功后才回调 + if (!!callBack) { + callBack(res, i); + } + }); + }; + + + // 设置父级窗口的按钮 + function setPbtn() { + $('#release', window.parent.document).text('提交文档审核'); + $('#savedraft', window.parent.document).hide(); + //$('#print', window.parent.document).hide(); + + } + +} \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/Index.cshtml new file mode 100644 index 000000000..4d9cb427a --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/Index.cshtml @@ -0,0 +1,73 @@ + +@{ + ViewBag.Title = "文件管理"; + Layout = "~/Views/Shared/_Index.cshtml"; +} +@Html.AppendCssFile("/Areas/LR_SystemModule/Views/Files/Index.css") + +
+
+
+
+
    +
  • 正式文件
  • +
  • 审核中文件
  • +
  • 回收站
  • +
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+  查询 +
+
+ +
+
+
+
+ 主目录 +
+
+
+ +
+
+
+
+
+ +@Html.AppendJsFile("/Areas/LR_SystemModule/Views/Files/Index.js") + diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/Index.css b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/Index.css new file mode 100644 index 000000000..2fbcd9aa5 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/Index.css @@ -0,0 +1,14 @@ +.lr-layout-body>div { + display:none; +} +.lr-layout-body .active { + display:block; +} +.path-item { + cursor: pointer; +} + + .path-item:hover { + color: #3286ed; + + } \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/Index.js new file mode 100644 index 000000000..6c6568611 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/Index.js @@ -0,0 +1,716 @@ +var refreshGirdData; +var bootstrap = function ($, learun) { + "use strict"; + + var tabType = 'releaseFile'; + var wfType = '1'; + var folderId = "0"; + var folderAuth = ''; + + //1 查看 2上传 3 下载 4 删除 5 复原 + var btnName = { + '1': '查看', + '2': '上传', + '3': '下载', + '4': '删除', + '5': '复原', + '6': '彻底删除' + } + + var page = { + init: function () { + page.initleft(); + page.initGrid(); + page.bind(); + }, + bind: function () { + $('#lr_form_tabs').lrFormTab(function (id) { + wfType = id; + page.search.verifyFile && page.search.verifyFile(); + }); + + // 查询 + $('#btn_Search').on('click', function () { + var keyword = $('#txt_Keyword').val(); + page.search[tabType]({ keyword: keyword }); + }); + // 刷新 + $('#lr_refresh').on('click', function () { + location.reload(); + }); + + + // 文件夹管理 + $('#lr-folder').on('click', function () { + learun.layerForm({ + id: 'FolderIndex', + title: '文件夹管理', + url: top.$.rootUrl + '/LR_SystemModule/Files/FolderIndex', + width: 800, + height: 500, + maxmin: true, + btn: null, + end: function () { + + } + }); + }); + // 文件授权 + $('#lr-fileAuth').on('click', function () { + learun.layerForm({ + id: 'FileAuthIndex', + title: '文件授权', + url: top.$.rootUrl + '/LR_SystemModule/Files/FileAuthIndex', + width: 800, + height: 500, + maxmin: true, + btn: null, + end: function () { + + } + }); + }); + + //上传文件 + $('#lr-uploadify').on('click', function () { + learun.frameTab.open({ F_ModuleId: 'filesuploadify', F_Icon: 'fa magic', F_FullName: '上传文件审核', F_UrlAddress: '/LR_NewWorkFlow/NWFProcess/NWFContainerForm?shcemeCode=lr_files_manager&tabIframeId=filesuploadify&type=create' }); + //if (folderId == "0") {// 获取主目录的权限,有上传权限才允许上传 + // learun.httpAsync('GET', top.$.rootUrl + '/LR_SystemModule/Files/IsUPLoad', { folderId: folderId }, function (res) { + // if (res == true) { + // learun.frameTab.open({ F_ModuleId: 'filesuploadify', F_Icon: 'fa magic', F_FullName: '上传文件审核', F_UrlAddress: '/LR_NewWorkFlow/NWFProcess/NWFContainerForm?shcemeCode=lr_files_manager&tabIframeId=filesuploadify&type=create' }); + // } + // else { + // learun.alert.warning('你没有权限在当前目录下创建文件!'); + // } + // }) + //} + //else if (folderAuth == '2') { + //} + //else { + // learun.alert.warning('你没有权限在当前目录下创建文件!'); + //} + }); + + // + $('#pathList').on('click', '.path-item', function () { + var $this = $(this); + var data = $this[0]._data; + if (data) { + folderAuth = data.F_AuthType; + } + $this.nextAll().remove(); + folderId = $this.attr('data-fileid'); + page.openFolder(); + }); + + }, + initleft: function () { + $('#lr_left_list li').on('click', function () { + var $this = $(this); + $this.parent().find('.active').removeClass('active'); + $this.addClass('active'); + + var v = $this.attr('data-value'); + $('.lr-layout-body>.active').removeClass('active'); + $('#' + v).addClass('active'); + tabType = v; + page.search[v] && page.search[v](); + //console.log(tabType) + //lr-uploadify + + }); + }, + //加载表格 + initGrid: function () { + $('#wfgridtable').jfGrid({ + url: top.$.rootUrl + '/LR_SystemModule/Files/GetWFPageList', + headData: [ + { + label: "任务", name: "F_TaskName", width: 160, align: "left", + formatter: function (cellvalue, row, dfop, $cell) { + if (row.F_EnabledMark == 3) { + if (wfType == '1') { + return '本人发起'; + } + else { + cellvalue; + } + } + + // 草稿 + if (row.F_EnabledMark == 2) { + $cell.on('click', '.create', function () {// 创建 + // 关闭草稿页 + learun.frameTab.closeByParam('tabProcessId', row.F_Id); + + learun.frameTab.open({ F_ModuleId: row.F_Id, F_Icon: 'fa magic', F_FullName: '创建流程-' + row.F_SchemeName, F_UrlAddress: '/LR_NewWorkFlow/NWFProcess/NWFContainerForm?processId=' + row.F_Id + '&tabIframeId=' + row.F_Id + '&type=draftCreate' }); + return false; + }); + $cell.on('click', '.delete', function () {// 删除 + learun.layerConfirm('是否确认删除该草稿?', function (res) { + if (res) { + // 关闭草稿页 + + learun.frameTab.closeByParam('tabProcessId', row.F_Id); + learun.deleteForm(top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/DeleteDraft', { processId: row.F_Id }, function () { + refreshGirdData(); + }); + } + }); + return false; + }); + return '编辑创建删除草稿'; + } + + + + var isaAain = false; + if (wfType == '1') { + if (row.F_IsAgain == 1) { + isaAain = true; + } + else if (row.F_IsFinished == 0) { + // 加入催办和撤销按钮 + $cell.on('click', '.urge', function () {// 催办审核 + learun.layerConfirm('是否确认催办审核?', function (res, _index) { + if (res) { + learun.loading(true, '催办审核...'); + var postData = { + processId: row.F_Id, + }; + learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/UrgeFlow', postData, function (data) { + learun.loading(false); + }); + top.layer.close(_index); + } + }); + return false; + }); + $cell.on('click', '.revoke', function () {// 删除 + learun.layerConfirm('是否确认撤销流程?', function (res, _index) { + if (res) { + + learun.loading(true, '撤销流程...'); + var postData = { + processId: row.F_Id, + }; + learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/RevokeFlow', postData, function (data) { + learun.loading(false); + refreshGirdData(); + }); + top.layer.close(_index); + } + }); + return false; + }); + + + var _btnHtml = '催办审核'; + if (row.F_IsStart == 0) { + _btnHtml += '撤销流程'; + } + return _btnHtml; + } + else { + return '本人发起'; + } + } + if (row.F_TaskType == 3) { + return "【加签】" + cellvalue; + } + else if (row.F_TaskType == 5 && wfType == '2') { + isaAain = true; + } + else if (row.F_TaskType == 5) { + return '重新发起'; + } + + if (isaAain) { + $cell.on('click', '.AgainCreate', function () { + var title = ""; + if (row.F_SchemeName != row.F_Title && row.F_Title) { + title = row.F_SchemeName + "(" + row.F_Title + ")"; + } + else { + title = row.F_SchemeName; + } + learun.frameTab.open({ F_ModuleId: row.F_Id, F_Icon: 'fa magic', F_FullName: '重新发起-' + title, F_UrlAddress: '/LR_NewWorkFlow/NWFProcess/NWFContainerForm?processId=' + row.F_Id + '&tabIframeId=' + row.F_Id + '&type=againCreate' }); + return false; + }); + return '重新发起'; + } + + + if (wfType == '3' && row.F_TaskType == 1 && row.F_IsFinished == 0) {// 已完成任务,添加一个撤销按钮 + cellvalue = '撤销审核' + cellvalue; + + $cell.on('click', '.revoke2', function () {// 删除 + learun.layerConfirm('是否确认撤销审核?', function (res, _index) { + if (res) { + + learun.loading(true, '撤销审核...'); + var postData = { + processId: row.F_Id, + taskId: row.F_TaskId, + }; + learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/RevokeAudit', postData, function (data) { + learun.loading(false); + refreshGirdData(); + }); + top.layer.close(_index); + } + }); + return false; + }); + } + + return cellvalue; + } + }, + { + label: "文件名", name: "FileName", width: 120, align: "left", + }, + { + label: "文件编号", name: "FileCode", width: 120, align: "left", + }, + { + label: "文件版本", name: "FileVer", width: 60, align: "center", + }, + { + label: "等级", name: "F_Level", width: 60, align: "center", + formatter: function (cellvalue) { + switch (cellvalue) { + case 0: + return '普通'; + break; + case 1: + return '重要'; + break; + case 2: + return '紧急'; + break; + default: + return '普通'; + break; + } + } + }, + { + label: "状态", name: "F_EnabledMark", width: 70, align: "center", + formatter: function (cellvalue, row) { + if (row.F_TaskType == 4) { + if (row.F_IsUrge == "1" && wfType == '2') { + return "催办加急"; + } + return "运行中"; + } + if (row.F_IsFinished == 0) { + if (cellvalue == 1) { + if (row.F_IsUrge == "1" && wfType == '2') { + return "催办加急"; + } + return "运行中"; + } else if (cellvalue == 2) { + return "草稿"; + } else { + return "作废"; + } + } + else { + return "结束"; + } + + } + }, + { label: "发起者", name: "F_CreateUserName", width: 70, align: "center" }, + { + label: "时间", name: "F_CreateDate", width: 150, align: "left", + formatter: function (cellvalue) { + return learun.formatDate(cellvalue, 'yyyy-MM-dd hh:mm:ss'); + } + } + ], + mainId: 'F_Id', + isPage: true, + sidx: 'F_CreateDate DESC', + onSelectRow: function (row) { + if (wfType == '2') { + if (row.F_TaskType == 5) { + $('#lr_verify span').text("重新发起"); + } + else if (row.F_TaskType == 3) { + $('#lr_verify span').text("【加签】" + row.F_TaskName); + } + else { + $('#lr_verify span').text(row.F_TaskName); + } + } + }, + dblclick: function () { + if (wfType == '2') { + page.verify(); + } + else { + page.eye(); + } + } + }); + $('#gridTable').jfGrid({ + url: top.$.rootUrl + '/LR_SystemModule/Files/GetPublishList', + headData: [ + { + label: '文件名', name: 'F_Name', width: 400, align: 'left', + formatter: function (cellvalue, row) { + return "
" + cellvalue + "
"; + } + }, + { + label: '文件编号', name: 'F_Code', width: 120, align: 'left' + }, + { + label: '文件版本', name: 'F_Ver', width: 60, align: 'center' + }, + { + label: '大小', name: 'F_FileSize', width: 100, align: 'center', + formatter: function (cellvalue, row) { + if (row.Type == '2') { + return ''; + } + else { + return page.CountFileSize(cellvalue); + } + } + }, + { + label: '操作', name: 'F_Id', width: 200, align: 'left', + formatter: function (value, row, op, $cell) { + var $div = $('
'); + if (row.Type == '2') { + var $openFolder = $('打开'); + $openFolder.on('click', function () { + folderId = value; + folderAuth = row.F_AuthType; + page.openFolder(); + var $span = $('/ ' + row.F_Name + ''); + $span[0]._data = row; + $('#pathList').append($span); + }); + $div.append($openFolder); + + } + else { + var btnlist = row.F_AuthType.split(','); + $.each(btnlist, function (_index, _item) { + if (_item != '6' && _item != '5' && $div.find('[data-value="' + _item + '"]').length == 0) { + var btnClass = 'label-info'; + if (_item == '4') { + btnClass = 'label-warning'; + } + var $btn = $('' + btnName[_item] + ''); + $btn[0]._row = row; + $btn.on('click', function () { + var $this = $(this); + var btnValue = $this.attr('data-value'); + var btnRow = $this[0]._row; + switch (btnValue) { + case '1':// 查看 + learun.layerForm({ + id: 'PreviewForm', + title: '文件预览', + url: top.$.rootUrl + '/LR_SystemModule/Annexes/PreviewFile?fileId=' + btnRow.F_PFiled, + width: 1080, + height: 850, + btn: null + }); + break; + case '2':// 上传 + learun.frameTab.open({ F_ModuleId: btnRow.F_Id, F_Icon: 'fa magic', F_FullName: '上传文件审核', F_UrlAddress: '/LR_NewWorkFlow/NWFProcess/NWFContainerForm?shcemeCode=lr_files_manager&tabIframeId=' + btnRow.F_Id + '&type=create&wfFormParam=' + btnRow.F_Id }); + break; + case '3':// 下载 + learun.download({ url: top.$.rootUrl + '/LR_SystemModule/Annexes/DownAnnexesFile', param: { fileId: btnRow.F_FileId}, method: 'POST' }); + break; + case '4':// 删除 + learun.layerConfirm('是否确认删除该文件!', function (res) { + if (res) { + learun.deleteForm(top.$.rootUrl + '/LR_SystemModule/Files/VDeleteFile', { keyValue: btnRow.F_Id }, function () { + refreshGirdData(); + }); + } + }); + break; + } + }); + $div.append($btn); + } + + }); + + // 查看 + var $hbtn = $('查看历史'); + $hbtn.on('click', function () { + learun.layerForm({ + id: 'FileHistroyIndex', + title: '文件历史【'+row.F_Name+'】', + url: top.$.rootUrl + '/LR_SystemModule/Files/FileHistroyIndex?fileInfoId=' + row.F_Id , + width: 800, + height: 500, + maxmin: true, + btn: null, + end: function () { + + } + }); + }); + $div.append($hbtn); + } + + //console.log(); + + return $div; + } + } + ], + mainId: 'F_Id' + }); + + $('#dgridtable').jfGrid({ + url: top.$.rootUrl + '/LR_SystemModule/Files/GetDeleteList', + headData: [ + { + label: '文件名', name: 'F_Name', width: 400, align: 'left', + formatter: function (cellvalue, row) { + return "
" + cellvalue + "
"; + } + }, + { + label: '文件编号', name: 'F_Code', width: 120, align: 'left' + }, + { + label: '文件版本', name: 'F_Ver', width: 60, align: 'center' + }, + { + label: '大小', name: 'F_FileSize', width: 100, align: 'center', + formatter: function (cellvalue) { + return page.CountFileSize(cellvalue); + } + }, + { + label: '操作', name: 'F_Id', width: 200, align: 'left', + formatter: function (value, row, op, $cell) { + var $div = $('
'); + var btnlist = row.F_AuthType.split(','); + $.each(btnlist, function (_index, _item) { + if (_item != '2' && _item != '4' && $div.find('[data-value="' + _item + '"]').length == 0) { + var btnClass = 'label-info'; + if (_item == '6') { + btnClass = 'label-danger'; + } + else if (_item == '5') { + btnClass = 'label-warning'; + } + var $btn = $('' + btnName[_item] + ''); + $btn[0]._row = row; + $btn.on('click', function () { + var $this = $(this); + var btnValue = $this.attr('data-value'); + var btnRow = $this[0]._row; + switch (btnValue) { + case '1':// 查看 + learun.layerForm({ + id: 'PreviewForm', + title: '文件预览', + url: top.$.rootUrl + '/LR_SystemModule/Annexes/PreviewFile?fileId=' + btnRow.F_PFiled, + width: 1080, + height: 850, + btn: null + }); + break; + case '3':// 下载 + learun.download({ url: top.$.rootUrl + '/LR_SystemModule/Annexes/DownAnnexesFile', param: { fileId: btnRow.F_FileId }, method: 'POST' }); + break; + case '5':// 复原 + learun.layerConfirm('是否确认还原该文件!', function (res) { + if (res) { + learun.postForm(top.$.rootUrl + '/LR_SystemModule/Files/RecoveryFile', { keyValue: btnRow.F_Id }, function () { + refreshGirdData(); + }); + } + }); + break; + case '6':// 彻底删除 + learun.layerConfirm('是否确认彻底删除该文件!', function (res) { + if (res) { + learun.deleteForm(top.$.rootUrl + '/LR_SystemModule/Files/DeleteFile', { keyValue: btnRow.F_Id }, function () { + refreshGirdData(); + }); + } + }); + break; + } + }); + $div.append($btn); + } + + }); + + // 查看 + var $hbtn = $('查看历史'); + $hbtn.on('click', function () { + learun.layerForm({ + id: 'FileHistroyIndex', + title: '文件历史【' + row.F_Name + '】', + url: top.$.rootUrl + '/LR_SystemModule/Files/FileHistroyIndex?fileInfoId=' + row.F_Id, + width: 800, + height: 500, + maxmin: true, + btn: null, + end: function () { + + } + }); + }); + $div.append($hbtn); + return $div; + } + } + ], + mainId: 'F_Id' + }); + + + page.search.releaseFile(); + }, + search: { + verifyFile: function (param) { + param = param || {}; + param.wfType = wfType; + $('#wfgridtable').jfGridSet('reload', param); + }, + releaseFile: function (param) { + param = param || {}; + param.folderId = folderId || "0"; + + if (param.folderId == "0") { + $('#pathList [data-fileid="0"]').nextAll().remove(); + } + + $('#gridTable').jfGridSet('reload', param); + }, + recycledFile: function (param) { + param = param || {}; + $('#dgridtable').jfGridSet('reload', param); + } + }, + search2: { + verifyFile: function () { + $('#wfgridtable').jfGridSet('reload'); + }, + releaseFile: function () { + $('#gridTable').jfGridSet('reload'); + }, + recycledFile: function () { + $('#dgridtable').jfGridSet('reload'); + } + }, + verify: function () { + var processId = $('#wfgridtable').jfGridValue('F_Id'); + var taskId = $('#wfgridtable').jfGridValue('F_TaskId'); + var title = $('#wfgridtable').jfGridValue('F_Title'); + var schemeName = $('#wfgridtable').jfGridValue('F_SchemeName'); + var taskName = $('#wfgridtable').jfGridValue('F_TaskName'); + var taskType = $('#wfgridtable').jfGridValue('F_TaskType'); + + if (schemeName != title && title) { + title = schemeName + "(" + title + ")"; + } + else { + title = schemeName; + } + + //1审批2传阅3加签4子流程5重新创建 + switch (taskType) { + case 1:// 审批 + learun.frameTab.open({ F_ModuleId: taskId, F_Icon: 'fa magic', F_FullName: '审批-' + title + '/' + taskName, F_UrlAddress: '/LR_NewWorkFlow/NWFProcess/NWFContainerForm?tabIframeId=' + taskId + '&type=audit' + "&processId=" + processId + "&taskId=" + taskId }); + break; + case 2:// 传阅 + learun.frameTab.open({ F_ModuleId: taskId, F_Icon: 'fa magic', F_FullName: '查阅-' + title + '/' + taskName, F_UrlAddress: '/LR_NewWorkFlow/NWFProcess/NWFContainerForm?tabIframeId=' + taskId + '&type=refer' + "&processId=" + processId + "&taskId=" + taskId }); + break; + case 3:// 加签 + learun.frameTab.open({ F_ModuleId: taskId, F_Icon: 'fa magic', F_FullName: '加签审核-' + title + '/' + taskName, F_UrlAddress: '/LR_NewWorkFlow/NWFProcess/NWFContainerForm?tabIframeId=' + taskId + '&type=signAudit' + "&processId=" + processId + "&taskId=" + taskId }); + break; + case 4:// 子流程 + learun.frameTab.open({ F_ModuleId: taskId, F_Icon: 'fa magic', F_FullName: '子流程-' + title + '/' + taskName, F_UrlAddress: '/LR_NewWorkFlow/NWFProcess/NWFContainerForm?tabIframeId=' + taskId + '&type=chlid' + "&processId=" + processId + "&taskId=" + taskId }); + break; + case 5:// 重新创建 + learun.frameTab.open({ F_ModuleId: processId, F_Icon: 'fa magic', F_FullName: '重新发起-' + title, F_UrlAddress: '/LR_NewWorkFlow/NWFProcess/NWFContainerForm?processId=' + processId + '&tabIframeId=' + processId + '&type=againCreate' }); + break; + case 6:// 重新创建 + learun.frameTab.open({ F_ModuleId: taskId, F_Icon: 'fa magic', F_FullName: '子流程-' + title + '/' + taskName, F_UrlAddress: '/LR_NewWorkFlow/NWFProcess/NWFContainerForm?tabIframeId=' + taskId + '&type=againChild' + "&processId=" + processId + "&taskId=" + taskId }); + break; + } + }, + eye: function () { + + + var processId = $('#wfgridtable').jfGridValue('F_Id') || ''; + var taskId = $('#wfgridtable').jfGridValue('F_TaskId') || ''; + var title = $('#wfgridtable').jfGridValue('FileName'); + var taskType = $('#wfgridtable').jfGridValue('F_TaskType'); + + + var enabledMark = $('#wfgridtable').jfGridValue('F_EnabledMark'); + if (enabledMark == 2) {// 草稿不允许查看进度 + learun.alert.warning("草稿不能查看进度"); + return; + } + if (learun.checkrow(processId)) { + if (taskType == '4' || taskType == '6') { + learun.frameTab.open({ F_ModuleId: processId + taskId, F_Icon: 'fa magic', F_FullName: '查看流程进度【' + title + '】', F_UrlAddress: '/LR_NewWorkFlow/NWFProcess/NWFContainerForm?tabIframeId=' + processId + taskId + '&type=childlook' + "&processId=" + processId + "&taskId=" + taskId }); + } + else { + learun.frameTab.open({ F_ModuleId: processId + taskId, F_Icon: 'fa magic', F_FullName: '查看流程进度【' + title + '】', F_UrlAddress: '/LR_NewWorkFlow/NWFProcess/NWFContainerForm?tabIframeId=' + processId + taskId + '&type=look' + "&processId=" + processId + "&taskId=" + taskId }); + } + } + }, + + openFolder: function () { + page.search.releaseFile(); + }, + + //计算文件大小函数(保留两位小数),Size为字节大小 + CountFileSize: function (Size) { + var m_strSize = ""; + var FactSize = 0; + FactSize = Size; + if (FactSize < 1024.00) + m_strSize = page.ToDecimal(FactSize) + " 字节"; + else if (FactSize >= 1024.00 && FactSize < 1048576) + m_strSize = page.ToDecimal(FactSize / 1024.00) + " KB"; + else if (FactSize >= 1048576 && FactSize < 1073741824) + m_strSize = page.ToDecimal(FactSize / 1024.00 / 1024.00) + " MB"; + else if (FactSize >= 1073741824) + m_strSize = page.ToDecimal(FactSize / 1024.00 / 1024.00 / 1024.00) + " GB"; + return m_strSize; + }, + //保留两位小数 + //功能:将浮点数四舍五入,取小数点后2位 + ToDecimal: function (x) { + var f = parseFloat(x); + if (isNaN(f)) { + return 0; + } + f = Math.round(x * 100) / 100; + return f; + }, + + + + + }; + + refreshGirdData = function () { + page.search2[tabType](); + }; + + page.init(); +} \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj index 2880219d6..7e3650211 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj @@ -464,6 +464,7 @@ + @@ -1289,6 +1290,16 @@ + + + + + + + + + + @@ -6770,6 +6781,14 @@ + + + + + + + + diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/script/lr-form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/script/lr-form.js index 33ee658e6..7cfffdd8b 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/script/lr-form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/script/lr-form.js @@ -13,6 +13,7 @@ var resdata = {}; $(this).find('input,select,textarea,.lr-select,.lr-formselect,.lrUploader-wrap,.lr-radio,.lr-checkbox,.edui-default').each(function (r) { var id = $(this).attr('id'); + if (!!id) { var type = $(this).attr('type'); switch (type) { @@ -63,24 +64,27 @@ else if ($(this).hasClass('edui-default')) { if ($(this)[0].ue) { resdata[id] = $(this)[0].ue.getContent(null, null, true).replace(/[<>&"]/g, function (c) { return { '<': '<', '>': '>', '&': '&', '"': '"' }[c]; });// - - } } else { var value = $("#" + id).val(); - resdata[id] = $.trim(value); + if (value != undefined && value != 'undefined') { + resdata[id] = $.trim(value); + } } break; } - resdata[id] += ''; - if (resdata[id] == '') { - resdata[id] = ' '; - } - if (resdata[id] == ' ' && !keyValue) { - resdata[id] = ''; + if (resdata[id] != undefined) { + resdata[id] += ''; + if (resdata[id] == '') { + resdata[id] = ' '; + } + if (resdata[id] == ' ' && !keyValue) { + resdata[id] = ''; + } } + } }); return resdata; @@ -206,10 +210,22 @@ ue.ready(function () { var arrEntities = { 'lt': '<', 'gt': '>', 'nbsp': ' ', 'amp': '&', 'quot': '"' }; var str = value.replace(/&(lt|gt|nbsp|amp|quot);/ig, function (all, t) { return arrEntities[t]; }); + str = str.replace(/&(lt|gt|nbsp|amp|quot);/ig, function (all, t) { return arrEntities[t]; }); ue.setContent(str); }); } + /* + $.fn.showEditer = function (content) { + var arrEntities = { 'lt': '<', 'gt': '>', 'nbsp': ' ', 'amp': '&', 'quot': '"' }; + var str = content.replace(/&(lt|gt|nbsp|amp|quot);/ig, function (all, t) { return arrEntities[t]; }); + $(this).html(str); + } + + $('#id').showEditer(); + */ + + /*表单数据操作*/ $.lrSetForm = function (url, callback) { learun.loading(true, '正在获取数据'); @@ -274,7 +290,7 @@ }); }; /*tab页切换*/ - $.fn.lrFormTab = function () { + $.fn.lrFormTab = function (callback) { var $this = $(this); $this.parent().css({ 'padding-top': '44px' }); $this.lrscroll(); @@ -306,6 +322,8 @@ $li.addClass('active'); $content.children('.tab-pane.active').removeClass('active'); $content.children('#' + id).addClass('active'); + + callback && callback(id); } }); } @@ -360,6 +378,7 @@ // 访问数据接口参数 param: { itemCode: '', parentId: '0' }, // 级联下级框 + select: op.select, } op = op || {}; if (!op.code) { @@ -566,13 +585,14 @@ return $(this).lrselect(dfop); }; // 人员下拉框 - $.fn.lrUserSelect = function (type) {//0单选1多选 + $.fn.lrUserSelect = function (type, select) {//0单选1多选 if (type == 0) { $(this).lrformselect({ layerUrl: top.$.rootUrl + '/LR_OrganizationModule/User/SelectOnlyForm', layerUrlW: 400, layerUrlH: 300, - dataUrl: top.$.rootUrl + '/LR_OrganizationModule/User/GetListByUserIds' + dataUrl: top.$.rootUrl + '/LR_OrganizationModule/User/GetListByUserIds', + select: select }); } else { @@ -580,7 +600,8 @@ layerUrl: top.$.rootUrl + '/LR_OrganizationModule/User/SelectForm', layerUrlW: 800, layerUrlH: 520, - dataUrl: top.$.rootUrl + '/LR_OrganizationModule/User/GetListByUserIds' + dataUrl: top.$.rootUrl + '/LR_OrganizationModule/User/GetListByUserIds', + select: select }); } } @@ -694,6 +715,13 @@ } }); } + else if (dfop.data) { + $.each(dfop.data, function (id, item) { + var $point = $(''); + $this.append($point); + }); + $this.find('input').eq(0).trigger('click'); + } else { learun.clientdata.getAllAsync('sourceData', { code: dfop.code, @@ -775,4 +803,74 @@ }); }; + // 获取表单显示数据 + $.fn.lrGetFormShow = function () { + var resdata = []; + $(this).find('.lr-form-item').each(function () { + var $this = $(this); + if ($this.is(':hidden')) { + return; + } + + var point = {}; + point.name = ($this.find('.lr-form-item-title').text() || '').replace('*', ''); + for (var i = 1; i < 13; i++) { + if ($this.hasClass('col-xs-' + i)) { + point.col = i; + } + } + + if ($this.find('.lr-form-item-title').length == 0) { + if ($this.find('.jfgrid-layout').length == 0) { + point.text = $this.html(); + point.type = 'title'; + resdata.push(point); + } + else { + point.type = 'gird'; + point.gridHead = $this.find('.jfgrid-layout').jfGridGet('settingInfo').headData; + point.data = $this.find('.jfgrid-layout').jfGridGet('showData'); + resdata.push(point); + } + } + else { + point.type = 'input'; + var list = $this.find('input,textarea,.lr-select,.edui-default'); + if (list.length > 0) { + resdata.push(point); + list.each(function () { + var type = $(this).attr('type'); + switch (type) { + case "radio": + if ($(this).is(":checked")) { + point.text = $(this).parent().text(); + } + break; + case "checkbox": + if ($(this).is(":checked")) { + point.textList = point.textList || []; + point.textList.push($(this).parent().text()); + } + break; + case "lrselect": + point.text = $(this).find('.lr-select-placeholder').text(); + break; + default: + if ($(this).hasClass('edui-default')) { + if ($(this)[0].ue) { + point.text = $(this)[0].ue.getContent(null, null, true); + } + } + else { + point.text = $(this).val(); + } + break; + } + }); + } + } + }); + return resdata; + } + })(jQuery, top.learun); \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/style/lr-iframe-index.css b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/style/lr-iframe-index.css index 761a83127..3c345928a 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/style/lr-iframe-index.css +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/style/lr-iframe-index.css @@ -129,6 +129,13 @@ body { text-align: right; padding-right: 10px; } +.lr-form-item-100 { + padding: 5px 0px 5px 100px; +} + + .lr-form-item-100 .lr-form-item-title { + width: 100px; + } .lr-form-item-title > font { position: absolute; top: 0; @@ -170,6 +177,35 @@ body { display:none; } +/*选项卡设置*/ +.lr-form-tabs { + position: absolute; + width: 100%; + height: 44px; + top: 0; + left: 0; + padding: 5px 5px 0px 5px; +} + + .lr-form-tabs li { + white-space: nowrap; + display: inline-block !important; + float: initial; + cursor: pointer; + } + + .lr-form-tabs .nav-tabs { + white-space: nowrap; + } + .lr-form-tabs .mCS-minimal-dark.mCSB_scrollTools_horizontal { + top: 32px; + } + +.lr-tab-content, .lr-tab-content > div { + position: relative; + width: 100%; + height: 100%; +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/ioc.config b/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/ioc.config index eb55f4972..ccd14aa9e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/ioc.config +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/ioc.config @@ -31,6 +31,8 @@ + + @@ -55,6 +57,8 @@ + + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileAuth/FileAuthBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileAuth/FileAuthBLL.cs new file mode 100644 index 000000000..937356f2f --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileAuth/FileAuthBLL.cs @@ -0,0 +1,92 @@ +using Learun.Util; +using System.Collections.Generic; + +namespace Learun.Application.Base.Files +{ + /// + /// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架 + /// Copyright (c) 2013-2018 上海力软信息技术有限公司 + /// 创 建:超级管理员 + /// 日 期:2019-11-28 09:23 + /// 描 述:文件权限管理 + /// + public class FileAuthBLL: FileAuthIBLL + { + private FileAuthService fileAuthService = new FileAuthService(); + + + #region 获取数据 + /// + /// 判断当前文件夹有没有上传权限 + /// + /// 文件夹主键 + /// + public bool IsUPLoad(string id) + { + UserInfo userInfo = LoginUserInfo.Get(); + if (userInfo.isSystem) + { + return true; + } + else { + if (string.IsNullOrEmpty(userInfo.roleIds)) + { + return false; + } + else { + var roleid = "," + userInfo.roleIds + ","; + var list = fileAuthService.GetFList(id); + foreach(var item in list) { + if (roleid.IndexOf("," + item.F_ObjId + ",") != -1) { + if (item.F_AuthType.IndexOf("2") != -1) { + return true; + } + } + } + return false; + } + } + } + /// + /// 获取授权信息列表 + /// + /// 文件信息主键 + /// + public IEnumerable GetList(string F_FileInfoId) + { + return fileAuthService.GetList(F_FileInfoId); + } + + /// + /// 实体数据 + /// + /// 主键 + /// + public FileAuthEntity GetEntity(string keyValue) + { + return fileAuthService.GetEntity(keyValue); + } + #endregion + + #region 提交数据 + /// + /// 删除数据 + /// + /// 主键 + public void DeleteEntity(string keyValue) + { + fileAuthService.DeleteEntity(keyValue); + } + + /// + /// 保存数据 + /// + /// 主键 + /// 实体数据 + public bool SaveEntity(string keyValue, FileAuthEntity entity) + { + return fileAuthService.SaveEntity(keyValue, entity); + } + #endregion + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileAuth/FileAuthEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileAuth/FileAuthEntity.cs new file mode 100644 index 000000000..023247826 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileAuth/FileAuthEntity.cs @@ -0,0 +1,106 @@ +using System; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Learun.Application.Base.Files +{ + /// + /// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架 + /// Copyright (c) 2013-2018 上海力软信息技术有限公司 + /// 创 建:超级管理员 + /// 日 期:2019-11-29 14:04 + /// 描 述:w + /// + public class FileAuthEntity + { + #region 实体成员 + /// + /// 主键 + /// + /// + [Column("F_ID")] + public string F_Id { get; set; } + /// + /// 文件信息主键 + /// + /// + [Column("F_FILEINFOID")] + public string F_FileInfoId { get; set; } + /// + /// 对象名称 + /// + /// + [Column("F_OBJNAME")] + public string F_ObjName { get; set; } + /// + /// 对应对象主键 + /// + /// + [Column("F_OBJID")] + public string F_ObjId { get; set; } + /// + /// 对应对象类型2角色 + /// + /// + [Column("F_OBJTYPE")] + public int? F_ObjType { get; set; } + /// + /// 1 查看 2上传 3 下载 4 删除 5 复原 + /// + /// + [Column("F_AUTHTYPE")] + public string F_AuthType { get; set; } + /// + /// 到期日期 + /// + /// + [Column("F_TIME")] + public DateTime? F_Time { get; set; } + + /// + /// 权限来源 上级文件夹或者下级文件 null为自己 + /// + public string F_from { get; set; } + /// + /// 0 自己 1 上级 2 下级 + /// + public int F_Type { get; set; } + /// + /// 0 不是 1是文件夹 + /// + public int F_IsFolder { get; set; } + /// + /// 0 自己 值越大离自己越远 + /// + public int F_Level { get; set; } + + #endregion + + #region 扩展操作 + /// + /// 新增调用 + /// + public void Create() + { + if (this.F_Time == null) + { + this.F_Time = DateTime.MaxValue.AddDays(-1); + } + + this.F_ObjType = 2; + this.F_Id = Guid.NewGuid().ToString(); + } + /// + /// 编辑调用 + /// + /// + public void Modify(string keyValue) + { + if (this.F_Time == null) + { + this.F_Time = DateTime.MaxValue.AddDays(-1); + } + this.F_Id = keyValue; + } + #endregion + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileAuth/FileAuthIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileAuth/FileAuthIBLL.cs new file mode 100644 index 000000000..010bda99f --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileAuth/FileAuthIBLL.cs @@ -0,0 +1,51 @@ +using System.Collections.Generic; + +namespace Learun.Application.Base.Files +{ + /// + /// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架 + /// Copyright (c) 2013-2018 上海力软信息技术有限公司 + /// 创 建:超级管理员 + /// 日 期:2019-11-28 09:23 + /// 描 述:文件权限管理 + /// + public interface FileAuthIBLL + { + + #region 获取数据 + /// + /// 判断当前文件夹有没有上传权限 + /// + /// 文件夹主键 + /// + bool IsUPLoad(string id); + /// + /// 获取授权信息列表 + /// + /// 文件信息主键 + /// + IEnumerable GetList(string F_FileInfoId); + + /// + /// 实体数据 + /// + /// 主键 + /// + FileAuthEntity GetEntity(string keyValue); + #endregion + + #region 提交数据 + /// + /// 删除数据 + /// + /// 主键 + void DeleteEntity(string keyValue); + /// + /// 保存数据 + /// + /// 主键 + /// 实体数据 + bool SaveEntity(string keyValue, FileAuthEntity entity); + #endregion + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileAuth/FileAuthService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileAuth/FileAuthService.cs new file mode 100644 index 000000000..79441d077 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileAuth/FileAuthService.cs @@ -0,0 +1,215 @@ +using Learun.DataBase.Repository; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Learun.Application.Base.Files +{ + /// + /// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架 + /// Copyright (c) 2013-2018 上海力软信息技术有限公司 + /// 创 建:超级管理员 + /// 日 期:2019-11-28 09:23 + /// 描 述:文件权限管理 + /// + public class FileAuthService: RepositoryFactory + { + #region 获取数据 + /// + /// 获取文件夹权限 + /// + /// 文件夹id + /// + public IEnumerable GetFList(string id) + { + var strSql = new StringBuilder(); + + strSql.Append(" select * from lr_base_fileauth t "); + strSql.Append(" where F_Type = 0 AND t.F_FileInfoId = @F_FileInfoId "); + + return this.BaseRepository().FindList(strSql.ToString(), new { F_FileInfoId = id }); + } + /// + /// 获取授权信息列表 + /// + /// 文件信息主键 + /// + public IEnumerable GetList(string F_FileInfoId) + { + var strSql = new StringBuilder(); + + strSql.Append(" select * from lr_base_fileauth t "); + strSql.Append(" where F_Type = 0 AND t.F_FileInfoId = @F_FileInfoId "); + + return this.BaseRepository().FindList(strSql.ToString(), new { F_FileInfoId }); + } + /// + /// 实体数据 + /// + /// 主键 + /// + public FileAuthEntity GetEntity(string keyValue) + { + return this.BaseRepository().FindEntity(keyValue); + } + #endregion + + #region 提交数据 + /// + /// 删除数据 + /// + /// 主键 + public void DeleteEntity(string keyValue) { + var db = this.BaseRepository().BeginTrans(); + try + { + db.ExecuteBySql(" delete from lr_base_fileauth where F_from =@fromId ", new { fromId = keyValue }); + db.Delete(new FileAuthEntity() { F_Id = keyValue }); + db.Commit(); + } + catch (Exception) + { + db.Rollback(); + throw; + } + + + } + + /// + /// 保存数据 + /// + /// 主键 + /// 实体数据 + public bool SaveEntity(string keyValue, FileAuthEntity entity) { + var db = this.BaseRepository().BeginTrans(); + try + { + if (string.IsNullOrEmpty(keyValue)) + { + var entityTmp = db.FindEntity(" select * from lr_base_fileauth where F_ObjId = @objId AND F_FileInfoId = @Id AND F_Type = 0 ", new { objId = entity.F_ObjId, Id = entity.F_FileInfoId }); + if (entityTmp != null) { + db.Rollback(); + return false; + } + entity.Create(); + db.Insert(entity); + } + else + { + entity.Modify(keyValue); + db.Update(entity); + } + + db.ExecuteBySql(" delete from lr_base_fileauth where F_from =@fromId ",new { fromId = entity.F_Id }); + int deep = 1; + if (entity.F_IsFolder == 1)// 文件夹 + { + if (entity.F_FileInfoId != "0") { + var folderEntity = db.FindEntity(entity.F_FileInfoId); + SaveSJEntity(folderEntity.F_PId, entity.F_Id, entity, deep, db); + } + + // 授权子文件夹和文件 + SaveXJEntity(entity.F_FileInfoId, entity.F_Id, entity, deep, db); + } + else + { + var fileEntity = db.FindEntity(entity.F_FileInfoId); + SaveSJEntity(fileEntity.F_Folder, entity.F_Id, entity, deep, db); + } + + db.Commit(); + return true; + } + catch (System.Exception) + { + db.Rollback(); + throw; + } + } + /// + /// 保存上级目录权限设置 + /// + /// + /// + /// + /// + /// + private void SaveSJEntity(string folderId,string fromId, FileAuthEntity fromEntity,int deep, IRepository db) { + if (folderId != "0") { + FileAuthEntity entity = new FileAuthEntity() + { + F_Id = Guid.NewGuid().ToString(), + F_AuthType = "1", + F_FileInfoId = folderId, + F_from = fromId, + F_ObjId = fromEntity.F_ObjId, + F_ObjName = fromEntity.F_ObjName, + F_ObjType = fromEntity.F_ObjType, + F_Time = fromEntity.F_Time, + F_Type = 2, + F_IsFolder = 1, + F_Level = deep + }; + db.Insert(entity); + var folderEntity = db.FindEntity(folderId); + SaveSJEntity(folderEntity.F_PId, fromId, fromEntity,deep + 1, db); + } + } + + /// + /// 保存下级目录权限设置 + /// + /// + /// + /// + /// + /// + private void SaveXJEntity(string folderId, string fromId, FileAuthEntity fromEntity,int deep, IRepository db) + { + // 获取文件 + var fileList = db.FindList(" select * from lr_base_fileinfo where F_IsPublish = 1 AND F_Folder = @folderId ", new { folderId }); + foreach (var item in fileList) { + FileAuthEntity fileAuth = new FileAuthEntity() + { + F_Id = Guid.NewGuid().ToString(), + F_AuthType = fromEntity.F_AuthType, + F_FileInfoId = item.F_Id, + F_from = fromId, + F_ObjId = fromEntity.F_ObjId, + F_ObjName = fromEntity.F_ObjName, + F_ObjType = fromEntity.F_ObjType, + F_Time = fromEntity.F_Time, + F_Type = 1, + F_IsFolder = 0, + F_Level = deep + }; + db.Insert(fileAuth); + } + + // 获取文件夹 + var folderList = db.FindList(" select * from lr_base_folder where F_PId = @folderId ", new { folderId }); + foreach (var item in folderList) { + FileAuthEntity folderAuth = new FileAuthEntity() + { + F_Id = Guid.NewGuid().ToString(), + F_AuthType = fromEntity.F_AuthType, + F_FileInfoId = item.F_Id, + F_from = fromId, + F_ObjId = fromEntity.F_ObjId, + F_ObjName = fromEntity.F_ObjName, + F_ObjType = fromEntity.F_ObjType, + F_Time = fromEntity.F_Time, + F_Type = 1, + F_IsFolder = 1, + F_Level = deep + }; + db.Insert(folderAuth); + SaveXJEntity(item.F_Id, fromId, fromEntity,deep + 1,db); + } + + } + #endregion + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileInfo/FileBInfoEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileInfo/FileBInfoEntity.cs new file mode 100644 index 000000000..2eb541293 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileInfo/FileBInfoEntity.cs @@ -0,0 +1,119 @@ +using System; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Learun.Application.Base.Files +{ + /// + /// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架 + /// Copyright (c) 2013-2018 上海力软信息技术有限公司 + /// 创 建:超级管理员 + /// 日 期:2019-11-29 14:04 + /// 描 述:文件管理 + /// + public class FileBInfoEntity + { + #region 实体成员 + /// + /// 主键 + /// + /// + [Column("F_ID")] + public string F_Id { get; set; } + /// + /// 文件编号 + /// + /// + [Column("F_CODE")] + public string F_Code { get; set; } + /// + /// 文件名称 + /// + /// + [Column("F_NAME")] + public string F_Name { get; set; } + /// + /// 关键字 + /// + /// + [Column("F_KEYWORD")] + public string F_KeyWord { get; set; } + /// + /// 是否发布 0 不是 1 是 + /// + /// + [Column("F_ISPUBLISH")] + public int? F_IsPublish { get; set; } + /// + /// 关联文件夹ID 0顶层文件夹 + /// + /// + [Column("F_FOLDER")] + public string F_Folder { get; set; } + /// + /// 是否删除标记 + /// + /// + [Column("F_DELETEMARK")] + public int? F_DeleteMark { get; set; } + #endregion + + #region 扩展操作 + /// + /// 新增调用 + /// + public void Create() + { + this.F_Id = Guid.NewGuid().ToString(); + this.F_DeleteMark = 0; + this.F_IsPublish = 0; + } + /// + /// 编辑调用 + /// + /// + public void Modify(string keyValue) + { + this.F_Id = keyValue; + } + #endregion + + #region 扩展字段 + /// + /// 文件版本号 + /// + [NotMapped] + public string F_Ver { get; set; } + /// + /// 文件大小 + /// + [NotMapped] + public int F_FileSize { get; set; } + /// + /// 文件类型 + /// + [NotMapped] + public string F_FileType { get; set; } + /// + /// 原始文件对应ID + /// + [NotMapped] + public string F_FileId { get; set; } + /// + /// 预览文件ID + /// + [NotMapped] + public string F_PFiled { get; set; } + /// + /// 权限操作类型 + /// + [NotMapped] + public string F_AuthType { get; set; } + + /// + /// 类型 + /// + [NotMapped] + public string Type { get; set; } + #endregion + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileInfo/FileInfoBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileInfo/FileInfoBLL.cs new file mode 100644 index 000000000..ceb6b6c22 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileInfo/FileInfoBLL.cs @@ -0,0 +1,211 @@ +using Learun.Util; +using System; +using System.Collections.Generic; + +namespace Learun.Application.Base.Files +{ + /// + /// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架 + /// Copyright (c) 2013-2018 上海力软信息技术有限公司 + /// 创 建:超级管理员 + /// 日 期:2019-11-29 14:04 + /// 描 述:文件管理 + /// + public class FileInfoBLL: FileInfoIBLL + { + private FileInfoService fileInfoService = new FileInfoService(); + + #region 获取数据 + + /// + /// 获取表实体数据 + /// + /// 主键 + /// + public FileBInfoEntity GetEntity(string keyValue) + { + try + { + return fileInfoService.GetEntity(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 获取文件列表实体 + /// + /// + /// + public FilelistEntity GetListEntity(string keyValue) + { + try + { + return fileInfoService.GetListEntity(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 获取文件列表实体 + /// + /// + /// + public FilelistEntity GetListEntityByInfoId(string fileInfoId) + { + try + { + return fileInfoService.GetListEntityByInfoId(fileInfoId); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 文件审核列表 + /// + /// 查询语句 + /// 分页参数 + /// 查询关键字 + /// 当前登陆者用户 + /// + public IEnumerable GetWfPageList(string strWfSql, Pagination pagination, string keyword,string userId) + { + return fileInfoService.GetWfPageList(strWfSql, pagination, keyword, userId); + } + + /// + /// 获取正式发布的文件 + /// + /// 查询关键字 + /// 文件夹id + /// + public IEnumerable GetAllPublishPageList(string keyword, string folderId) + { + return fileInfoService.GetAllPublishPageList(keyword, folderId); + } + + /// + /// 获取正式发布的文件 + /// + /// 查询关键字 + /// 文件夹id + /// + public IEnumerable GetPublishList(string keyword, string folderId) { + return fileInfoService.GetPublishList(keyword, folderId); + } + + + /// + /// 获取文件的历史信息 + /// + /// 主键 + /// + public IEnumerable GetHistoryList(string fileInfoId) { + return fileInfoService.GetHistoryList(fileInfoId); + } + + + /// + /// 获取正式发布的文件 + /// + /// 查询关键字 + /// + public IEnumerable GetDeleteList(string keyword) { + return fileInfoService.GetDeleteList(keyword); + } + #endregion + + #region 提交数据 + /// + /// 保存数据 + /// + /// 文件列表主键 + /// 文件主信息 + /// 文件列表信息 + public void SaveEntity(string keyValue, FileBInfoEntity fileBInfoEntity, FilelistEntity filelistEntity) + { + try + { + fileInfoService.SaveEntity(keyValue, fileBInfoEntity, filelistEntity); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + + + } + + + /// + /// 更新文件发布状态 + /// + /// 流程实例主键 + public void UpdateEntity(string processId) + { + fileInfoService.UpdateEntity(processId); + } + + + /// + /// 虚拟删除文件 + /// + /// 主键 + public void VDeleteEntity(string keyValue) + { + fileInfoService.VDeleteEntity(keyValue); + } + /// + /// 还原虚拟删除文件 + /// + /// 主键 + public void RecoveryEntity(string keyValue) { + fileInfoService.RecoveryEntity(keyValue); + } + /// + /// 彻底删除 + /// + /// + public void DeleteEntity(string keyValue) + { + fileInfoService.DeleteEntity(keyValue); + } + #endregion + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileInfo/FileInfoIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileInfo/FileInfoIBLL.cs new file mode 100644 index 000000000..0cbae49f0 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileInfo/FileInfoIBLL.cs @@ -0,0 +1,105 @@ +using Learun.Util; +using System.Collections.Generic; + +namespace Learun.Application.Base.Files +{ + /// + /// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架 + /// Copyright (c) 2013-2018 上海力软信息技术有限公司 + /// 创 建:超级管理员 + /// 日 期:2019-11-29 14:04 + /// 描 述:文件管理 + /// + public interface FileInfoIBLL + { + #region 获取数据 + + /// + /// 获取表实体数据 + /// + /// 主键 + /// + FileBInfoEntity GetEntity(string keyValue); + /// + /// 获取文件列表实体 + /// + /// + /// + FilelistEntity GetListEntity(string keyValue); + + /// + /// 获取文件列表实体 + /// + /// + /// + FilelistEntity GetListEntityByInfoId(string fileInfoId); + /// + /// 文件审核列表 + /// + /// 查询语句 + /// 分页参数 + /// 查询关键字 + /// 当前用户Id + /// + IEnumerable GetWfPageList(string strWfSql, Pagination pagination, string keyword,string userId); + /// + /// 获取正式发布的文件 + /// + /// 查询关键字 + /// 文件夹id + /// + IEnumerable GetAllPublishPageList(string keyword, string folderId); + /// + /// 获取正式发布的文件 + /// + /// 查询关键字 + /// 文件夹id + /// + IEnumerable GetPublishList(string keyword, string folderId); + /// + /// 获取文件的历史信息 + /// + /// 主键 + /// + IEnumerable GetHistoryList(string fileInfoId); + + /// + /// 获取正式发布的文件 + /// + /// 查询关键字 + /// + IEnumerable GetDeleteList(string keyword); + #endregion + + #region 提交数据 + /// + /// 保存数据 + /// + /// 文件列表主键 + /// 文件主信息 + /// 文件列表信息 + void SaveEntity(string keyValue, FileBInfoEntity fileBInfoEntity, FilelistEntity filelistEntity); + /// + /// 更新文件发布状态 + /// + /// 流程实例主键 + void UpdateEntity(string processId); + + /// + /// 虚拟删除文件 + /// + /// 主键 + void VDeleteEntity(string keyValue); + /// + /// 还原虚拟删除文件 + /// + /// 主键 + void RecoveryEntity(string keyValue); + /// + /// 彻底删除 + /// + /// + void DeleteEntity(string keyValue); + #endregion + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileInfo/FileInfoService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileInfo/FileInfoService.cs new file mode 100644 index 000000000..d169af4c3 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileInfo/FileInfoService.cs @@ -0,0 +1,683 @@ +using Learun.DataBase.Repository; +using Learun.Util; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Learun.Application.Base.Files +{ + /// + /// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架 + /// Copyright (c) 2013-2018 上海力软信息技术有限公司 + /// 创 建:超级管理员 + /// 日 期:2019-11-28 09:23 + /// 描 述:文件管理 + /// + public class FileInfoService: RepositoryFactory + { + #region 获取数据 + + /// + /// 获取表实体数据 + /// + /// 主键 + /// + public FileBInfoEntity GetEntity(string keyValue) + { + try + { + return this.BaseRepository().FindEntity(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + /// + /// 获取文件列表实体 + /// + /// + /// + public FilelistEntity GetListEntity(string keyValue) + { + try + { + return this.BaseRepository().FindEntity(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + /// + /// 获取文件列表实体 + /// + /// + /// + public FilelistEntity GetListEntityByInfoId(string fileInfoId) + { + try + { + return this.BaseRepository().FindEntity(" select * from lr_base_filelist where F_FileInfoId = @fileInfoId AND F_IsPublish = 1 ", new { fileInfoId }); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + + /// + /// 文件审核列表 + /// + /// 查询语句 + /// 分页参数 + /// 查询关键字 + /// 当前用户Id + /// + public IEnumerable GetWfPageList(string strWfSql, Pagination pagination, string keyword,string userId) { + var strSql = new StringBuilder(); + strSql.Append("select t.*,l.F_Ver as FileVer,l.F_Name as FileName ,f.F_Code as FileCode from (" + strWfSql + ")t"); + strSql.Append(" LEFT JOIN lr_base_filelist l on l.F_Id = t.F_Id "); + strSql.Append(" LEFT JOIN lr_base_fileinfo f on f.F_Id = l.F_FileInfoId where 1=1 AND t.F_SchemeCode = 'lr_files_manager' "); + + if (!string.IsNullOrEmpty(keyword)) { + keyword = "%" + keyword + "%"; + strSql.Append(" AND f.F_Name like @keyword "); + } + + + return this.BaseRepository().FindList(strSql.ToString(),new { keyword, userId }, pagination); + } + + /// + /// 获取正式发布的文件 + /// + /// 分页参数 + /// 查询关键字 + /// + public IEnumerable GetAllPublishPageList(string keyword, string folderId) + { + List list = new List(); + + if (string.IsNullOrEmpty(keyword)) + { + list.AddRange(GetFolderList(keyword, folderId)); + } + + var strSql = new StringBuilder(); + strSql.Append(" select t.*,t1.F_Ver,t1.F_FileId,t1.F_PFiled,t3.F_FileSize,t3.F_FileType,1 as Type,'1,2,3,4,5,6' as F_AuthType from lr_base_fileinfo t "); + strSql.Append(" LEFT JOIN lr_base_filelist t1 on t1.F_FileInfoId = t.F_Id "); + //strSql.Append(" LEFT JOIN lr_base_fileauth t2 on t2.F_FileInfoId = t.F_Id "); + strSql.Append(" LEFT JOIN LR_Base_AnnexesFile t3 on t3.F_FolderId = t1.F_FileId "); + strSql.Append(" where t.F_DeleteMark = 0 AND t.F_IsPublish = 1 AND t1.F_IsPublish = 1 "); + + + + if (!string.IsNullOrEmpty(keyword)) + { + keyword = "%" + keyword + "%"; + strSql.Append(" AND (t.F_Name like @keyword OR t.F_KeyWord like @keyword ) "); + } + else + { + strSql.Append(" AND t.F_Folder = @folderId "); + } + list.AddRange(this.BaseRepository().FindList(strSql.ToString(), new { keyword, folderId })); + + return list; + } + + + + /// + /// 获取页面显示列表数据 + /// + /// 关键字 + /// 父级id + /// + public IEnumerable GetFolderList(string keyWord, string folderId) + { + var strSql = new StringBuilder(); + strSql.Append("SELECT "); + strSql.Append(@" + t.F_Id, + t.F_PId as F_Folder, + t.F_Name, + 2 as Type, + 'folder' as F_FileType + "); + strSql.Append(" FROM lr_base_folder t "); + strSql.Append(" WHERE 1=1 "); + + if (!string.IsNullOrEmpty(folderId)) + { + strSql.Append(" AND t.F_PId = @folderId "); + } + if (!string.IsNullOrEmpty(keyWord)) + { + keyWord = "%" + keyWord + "%"; + strSql.Append(" AND t.F_Name Like @keyWord "); + } + strSql.Append(" Order by F_Name "); + + return this.BaseRepository().FindList(strSql.ToString(), new { keyWord, folderId }); + } + + + + /// + /// 获取文件夹带权限的 + /// + /// + /// + /// + /// + /// + public IEnumerable GetFolderList2(string keyWord, string folderId, List authList, UserInfo userInfo) + { + var strSql = new StringBuilder(); + strSql.Append("SELECT "); + strSql.Append(@" + t.F_Id, + t.F_PId as F_Folder, + t.F_Name, + 2 as Type, + '2' as F_AuthType, + 'folder' as F_FileType + "); + strSql.Append(" FROM lr_base_folder t "); + strSql.Append(" WHERE 1=1 "); + + if (!string.IsNullOrEmpty(folderId)) + { + strSql.Append(" AND t.F_PId = @folderId "); + } + if (!string.IsNullOrEmpty(keyWord)) + { + keyWord = "%" + keyWord + "%"; + strSql.Append(" AND t.F_Name Like @keyWord "); + } + strSql.Append(" Order by F_Name "); + + var list =this.BaseRepository().FindList(strSql.ToString(), new { keyWord, folderId }); + + if (userInfo.isSystem) + { + return list; + } + else { + List list2 = new List(); + foreach (var item in list) { + item.F_AuthType = "1"; + var roleIdList = userInfo.roleIds.Split(','); + bool flag = false; + foreach (var roleIdItem in roleIdList) { + var authList2 = authList.FindAll(t => t.F_FileInfoId == item.F_Id && t.F_ObjId == roleIdItem); + if (authList2.Count > 0) + { + flag = true; + if (authList2[0].F_Type != 2 && authList2[0].F_AuthType.IndexOf("2") != -1) + { + item.F_AuthType = "2"; + break; + } + } + } + if (flag) { + list2.Add(item); + } + } + return list2; + } + } + /// + /// 获取正式发布的文件 + /// + /// 查询关键字 + /// 文件夹id + /// + public IEnumerable GetPublishList(string keyword, string folderId) + { + UserInfo userInfo = LoginUserInfo.Get(); + List authList = new List(); + List list = new List(); + if (!userInfo.isSystem) + { + string roleIds = userInfo.roleIds; + if (string.IsNullOrEmpty(roleIds)) + { + return new List(); + } + else + { + roleIds = "('" + roleIds.Replace(",", "','") + "')"; + authList = (List)this.BaseRepository().FindList(" select * from lr_base_fileauth where F_ObjId in " + roleIds + " AND F_Time >= @ftime ORDER BY F_Type,F_Level ", new { ftime = DateTime.Now }); + } + } + + + + if (string.IsNullOrEmpty(keyword)) + { + list.AddRange(GetFolderList2(keyword, folderId, authList, userInfo)); + } + + var strSql = new StringBuilder(); + strSql.Append(" select t.*,t1.F_Ver,t1.F_FileId,t1.F_PFiled,t3.F_FileSize,t3.F_FileType,1 as Type,'1,2,3,4,5,6' as F_AuthType from lr_base_fileinfo t "); + strSql.Append(" LEFT JOIN lr_base_filelist t1 on t1.F_FileInfoId = t.F_Id "); + //strSql.Append(" LEFT JOIN lr_base_fileauth t2 on t2.F_FileInfoId = t.F_Id "); + strSql.Append(" LEFT JOIN LR_Base_AnnexesFile t3 on t3.F_FolderId = t1.F_FileId "); + strSql.Append(" where t.F_DeleteMark = 0 AND t.F_IsPublish = 1 AND t1.F_IsPublish = 1 "); + + + + if (!string.IsNullOrEmpty(keyword)) + { + keyword = "%" + keyword + "%"; + strSql.Append(" AND (t.F_Name like @keyword OR t.F_KeyWord like @keyword ) "); + } + else + { + strSql.Append(" AND t.F_Folder = @folderId "); + } + var fileList = this.BaseRepository().FindList(strSql.ToString(), new { keyword, folderId }); + + + + + if (!userInfo.isSystem) + { + foreach (var item in fileList) + { + var roleIdList = userInfo.roleIds.Split(','); + bool flag = false; + item.F_AuthType = ""; + foreach (var roleIdItem in roleIdList) + { + var authList2 = authList.FindAll(t => t.F_FileInfoId == item.F_Id && t.F_ObjId == roleIdItem); + if (authList2.Count > 0) + { + flag = true; + if (item.F_AuthType != "") + { + item.F_AuthType += ","; + } + item.F_AuthType += authList2[0].F_AuthType; + } + } + + if (flag) + { + list.Add(item); + } + } + } + else { + list.AddRange(fileList); + } + return list; + } + + /// + /// 获取文件的历史信息 + /// + /// 主键 + /// + public IEnumerable GetHistoryList(string fileInfoId) + { + List list = new List(); + + + var strSql = new StringBuilder(); + strSql.Append(" select t.*,t1.F_Ver,t1.F_FileId,t1.F_PFiled,t3.F_FileSize,t3.F_FileType,1 as Type,'1,3' as F_AuthType from lr_base_fileinfo t "); + strSql.Append(" LEFT JOIN lr_base_filelist t1 on t1.F_FileInfoId = t.F_Id "); + strSql.Append(" LEFT JOIN LR_Base_AnnexesFile t3 on t3.F_FolderId = t1.F_FileId "); + strSql.Append(" where t.F_IsPublish = 1 AND t.F_Id = @fileInfoId order by t1.F_PublishTime DESC "); + + list.AddRange(this.BaseRepository().FindList(strSql.ToString(), new { fileInfoId})); + + UserInfo userInfo = LoginUserInfo.Get(); + + if (!userInfo.isSystem) + { + string roleIds = userInfo.roleIds; + if (string.IsNullOrEmpty(roleIds)) + { + return list; + } + else + { + roleIds = "('" + roleIds.Replace(",", "','") + "')"; + + var authList = (List)this.BaseRepository().FindList(" select * from lr_base_fileauth where F_ObjId in " + roleIds + " AND F_Time >= @ftime ORDER BY F_Level ", new { ftime = DateTime.Now }); + + + List list2 = new List(); + + foreach (var item in list) + { + var roleIdList = userInfo.roleIds.Split(','); + bool flag = false; + item.F_AuthType = ""; + foreach (var roleIdItem in roleIdList) + { + var authList2 = authList.FindAll(t => t.F_FileInfoId == item.F_Id && t.F_ObjId == roleIdItem); + if (authList2.Count > 0) + { + flag = true; + if (item.F_AuthType != "") + { + item.F_AuthType += ","; + } + item.F_AuthType += authList2[0].F_AuthType; + } + } + + if (flag) + { + list2.Add(item); + } + } + + return list2; + } + } + return list; + } + + + /// + /// 获取正式发布的文件 + /// + /// 查询关键字 + /// + public IEnumerable GetDeleteList(string keyword) + { + List list = new List(); + + var strSql = new StringBuilder(); + strSql.Append(" select t.*,t1.F_Ver,t1.F_FileId,t1.F_PFiled,t3.F_FileSize,t3.F_FileType,1 as Type,'1,2,3,4,5,6' as F_AuthType from lr_base_fileinfo t "); + strSql.Append(" LEFT JOIN lr_base_filelist t1 on t1.F_FileInfoId = t.F_Id "); + strSql.Append(" LEFT JOIN LR_Base_AnnexesFile t3 on t3.F_FolderId = t1.F_FileId "); + strSql.Append(" where t.F_DeleteMark = 1 AND t.F_IsPublish = 1 AND t1.F_IsPublish = 1 "); + + list.AddRange(this.BaseRepository().FindList(strSql.ToString(), new { keyword })); + + if (!string.IsNullOrEmpty(keyword)) + { + keyword = "%" + keyword + "%"; + strSql.Append(" AND t.F_Name like @keyword "); + } + + + UserInfo userInfo = LoginUserInfo.Get(); + + if (!userInfo.isSystem) + { + string postIds = userInfo.postIds; + if (string.IsNullOrEmpty(postIds)) + { + return list; + } + else + { + postIds = "('" + postIds.Replace(",", "','") + "')"; + + var authList = (List)this.BaseRepository().FindList(" select * from lr_base_fileauth where F_ObjId in " + postIds + " AND F_Time <= ftime ", new { ftime = DateTime.Now }); + + + List list2 = new List(); + + foreach (var item in list) + { + var fileList = authList.FindAll(t => t.F_FileInfoId == item.F_Id); + if (fileList.Count > 0) + { + string authType = ""; + foreach (var fileItem in fileList) + { + if (authType != "") + { + authType += ","; + } + authType += fileItem.F_AuthType; + } + item.F_AuthType = authType; + list2.Add(item); + } + } + + return list2; + //strSql.Append(" AND t2.F_ObjId in " + postIds); + } + } + + + + + + + return list; + } + #endregion + + + #region 提交数据 + /// + /// 保存数据 + /// + /// 文件列表主键 + /// 文件主信息 + /// 文件列表信息 + public void SaveEntity(string keyValue, FileBInfoEntity fileBInfoEntity, FilelistEntity filelistEntity) { + var db = this.BaseRepository().BeginTrans(); + + try + { + if (string.IsNullOrEmpty(fileBInfoEntity.F_Id)) + { + fileBInfoEntity.Create(); + db.Insert(fileBInfoEntity); + } + else { + db.Update(fileBInfoEntity); + } + filelistEntity.F_FileInfoId = fileBInfoEntity.F_Id; + if (string.IsNullOrEmpty(keyValue)) + { + filelistEntity.Create(); + + db.Insert(filelistEntity); + } + else { + filelistEntity.Modify(keyValue); + db.Update(filelistEntity); + } + db.Commit(); + } + catch (Exception ex) + { + db.Rollback(); + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + + + } + + /// + /// 更新文件发布状态 + /// + /// + public void UpdateEntity(string processId) { + var fileList = this.BaseRepository().FindEntity(processId); + + var db = this.BaseRepository().BeginTrans(); + try + { + db.ExecuteBySql(" update lr_base_filelist set F_IsPublish = 0 where F_FileInfoId=@id ",new {id = fileList.F_FileInfoId }); + + FilelistEntity filelistEntity = new FilelistEntity() + { + F_Id = fileList.F_Id, + F_IsPublish = 1, + F_PublishTime = DateTime.Now + }; + FileBInfoEntity fileBInfoEntity = new FileBInfoEntity + { + F_Id = fileList.F_FileInfoId, + F_IsPublish = 1, + F_DeleteMark = 0, + F_KeyWord = fileList.F_KeyWord, + F_Name = fileList.F_Name, + F_Folder = fileList.F_Folder + }; + + db.Update(filelistEntity); + db.Update(fileBInfoEntity); + + // 更新权限 + // 删除上从层文件夹继承的权限 + var authList = db.FindList(" select * from lr_base_fileauth t where t.F_FileInfoId = @F_FileInfoId ", new { F_FileInfoId = fileList.F_FileInfoId }); + foreach (var item in authList) { + if (item.F_Type != 0) + { + db.ExecuteBySql(" delete from lr_base_fileauth where F_Id =@id", new { id = item.F_Id }); + } + else { + db.ExecuteBySql(" delete from lr_base_fileauth where F_from =@fromId ", new { fromId = item.F_Id}); + } + } + // 添加 + var authList2 = db.FindList(" select * from lr_base_fileauth t where t.F_FileInfoId = @F_FileInfoId AND F_Type != 2 ", new { F_FileInfoId = fileList.F_Folder }); + foreach (var item in authList2) + { + if (item.F_Type == 0) + { + item.F_from = item.F_Id; + } + FileAuthEntity authEntity = new FileAuthEntity() + { + F_Id = Guid.NewGuid().ToString(), + F_AuthType = item.F_AuthType, + F_FileInfoId = fileList.F_FileInfoId, + F_from = item.F_from, + F_ObjId = item.F_ObjId, + F_ObjName = item.F_ObjName, + F_ObjType = item.F_ObjType, + F_Time = item.F_Time, + F_Type = 1, + F_IsFolder = 0, + F_Level = item.F_Level + 1 + }; + db.Insert(authEntity); + } + + db.Commit(); + } + catch (Exception ex) + { + db.Rollback(); + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 虚拟删除文件 + /// + /// 主键 + public void VDeleteEntity(string keyValue) { + FileBInfoEntity entity = new FileBInfoEntity + { + F_Id = keyValue, + F_DeleteMark = 1 + }; + this.BaseRepository().Update(entity); + } + /// + /// 还原虚拟删除文件 + /// + /// 主键 + public void RecoveryEntity(string keyValue) + { + FileBInfoEntity entity = new FileBInfoEntity + { + F_Id = keyValue, + F_DeleteMark = 0 + }; + this.BaseRepository().Update(entity); + } + /// + /// 彻底删除 + /// + /// + public void DeleteEntity(string keyValue) { + var list = this.BaseRepository().FindList(" select * from lr_base_filelist where F_FileInfoId = @fileInfoId", new { fileInfoId= keyValue }); + var db = this.BaseRepository().BeginTrans(); + try + { + db.Delete(new FileBInfoEntity { F_Id = keyValue }); + + db.ExecuteBySql(" Delete from lr_base_filelist where F_FileInfoId = @f_id ", new { f_id = keyValue }); + foreach (var item in list) { + db.ExecuteBySql(" Delete from lr_nwf_process where F_Id = @f_id ", new { f_id = item.F_Id }); + db.ExecuteBySql(" Delete from lr_nwf_task where F_ProcessId = @f_id ", new { f_id = item.F_Id }); + db.ExecuteBySql(" Delete from lr_nwf_tasklog where F_ProcessId = @f_id ", new { f_id = item.F_Id }); + db.ExecuteBySql(" Delete from lr_nwf_taskmsg where F_ProcessId = @f_id ", new { f_id = item.F_Id }); + } + + db.Commit(); + } + catch (Exception ex) + { + + db.Rollback(); + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + #endregion + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileInfo/FilelistEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileInfo/FilelistEntity.cs new file mode 100644 index 000000000..3dc21aff1 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileInfo/FilelistEntity.cs @@ -0,0 +1,119 @@ +using Learun.Util; +using System; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Learun.Application.Base.Files +{ + /// + /// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架 + /// Copyright (c) 2013-2018 上海力软信息技术有限公司 + /// 创 建:超级管理员 + /// 日 期:2019-11-29 14:04 + /// 描 述:文件管理 + /// + public class FilelistEntity + { + #region 实体成员 + /// + /// 主键 + /// + /// + [Column("F_ID")] + public string F_Id { get; set; } + /// + /// 文件名称 + /// + /// + [Column("F_NAME")] + public string F_Name { get; set; } + /// + /// 关键字 + /// + /// + [Column("F_KEYWORD")] + public string F_KeyWord { get; set; } + /// + /// 文件信息ID + /// + /// + [Column("F_FILEINFOID")] + public string F_FileInfoId { get; set; } + /// + /// 关联文件夹ID 0顶层文件夹 + /// + /// + [Column("F_FOLDER")] + public string F_Folder { get; set; } + /// + /// 原始文件对应ID + /// + /// + [Column("F_FILEID")] + public string F_FileId { get; set; } + /// + /// 预览文件ID + /// + /// + [Column("F_PFILED")] + public string F_PFiled { get; set; } + /// + /// 版本号 + /// + /// + [Column("F_VER")] + public string F_Ver { get; set; } + /// + /// 是否发布 0 不是 1 是 + /// + /// + [Column("F_ISPUBLISH")] + public int? F_IsPublish { get; set; } + /// + /// 发布时间 + /// + /// + [Column("F_PUBLISHTIME")] + public DateTime? F_PublishTime { get; set; } + /// + /// 创建时间 + /// + /// + [Column("F_CREATETIME")] + public DateTime? F_CreateTime { get; set; } + /// + /// 创建人Id + /// + /// + [Column("F_CREATEUSERID")] + public string F_CreateUserId { get; set; } + /// + /// 创建人名称 + /// + /// + [Column("F_CREATEUSERNAME")] + public string F_CreateUserName { get; set; } + #endregion + + #region 扩展操作 + /// + /// 新增调用 + /// + public void Create() + { + UserInfo userInfo = LoginUserInfo.Get(); + this.F_CreateUserId = userInfo.userId; + this.F_CreateUserName = userInfo.realName; + this.F_IsPublish = 0; + this.F_CreateTime = DateTime.Now; + } + /// + /// 编辑调用 + /// + /// + public void Modify(string keyValue) + { + this.F_Id = keyValue; + } + #endregion + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileInfo/WFFileModel.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileInfo/WFFileModel.cs new file mode 100644 index 000000000..2783ce56c --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileInfo/WFFileModel.cs @@ -0,0 +1,112 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Learun.Application.Base.Files +{ + /// + /// + /// + public class WFFileModel + { + /// + /// 时间 + /// + public DateTime F_CreateDate { get; set; } + /// + /// 流程实例主键 + /// + public string F_Id { get; set; } + /// + /// 流程模板主键 + /// + public string F_SchemeId{ get; set; } + /// + /// 流程模板编码 + /// + public string F_SchemeCode{ get; set; } + /// + /// 流程模板名称 + /// + public string F_SchemeName{ get; set; } + /// + /// 自定义标题 + /// + public string F_Title{ get; set; } + /// + /// 重要等级 + /// + public string F_Level{ get; set; } + /// + /// + /// + public string F_EnabledMark{ get; set; } + /// + /// + /// + public string F_IsAgain{ get; set; } + /// + /// + /// + public string F_IsFinished{ get; set; } + /// + /// + /// + public string F_IsChild{ get; set; } + /// + /// + /// + public string F_ParentTaskId{ get; set; } + /// + /// + /// + public string F_ParentProcessId{ get; set; } + /// + /// + /// + public string F_CreateUserId{ get; set; } + /// + /// + /// + public string F_CreateUserName{ get; set; } + /// + /// + /// + public string F_IsStart{ get; set; } + + + /// + /// 任务名称 + /// + public string F_TaskName { get; set; } + /// + /// 任务主键 + /// + public string F_TaskId { get; set; } + /// + /// 任务类型 + /// + public int? F_TaskType { get; set; } + + /// + /// 是否被催办 1 被催办了 + /// + /// + public int? F_IsUrge { get; set; } + + /// + /// 文件名称 + /// + public string FileName { get; set; } + /// + /// 文件编码 + /// + public string FileCode { get; set; } + /// + /// 文件版本 + /// + public string FileVer { get; set; } + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/Folder/FolderBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/Folder/FolderBLL.cs new file mode 100644 index 000000000..35d5345c8 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/Folder/FolderBLL.cs @@ -0,0 +1,197 @@ +using Learun.Util; +using System; +using System.Collections.Generic; + +namespace Learun.Application.Base.Files +{ + /// + /// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架 + /// Copyright (c) 2013-2018 上海力软信息技术有限公司 + /// 创 建:超级管理员 + /// 日 期:2019-11-28 09:23 + /// 描 述:文件夹管理 + /// + public class FolderBLL : FolderIBLL + { + private FolderService folderService = new FolderService(); + + #region 获取数据 + /// + /// 获取页面显示列表数据 + /// + /// 关键字 + /// 父级id + /// + public IEnumerable GetList(string keyWord, string pId) + { + try + { + return folderService.GetList(keyWord, pId); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + /// + /// 获取树形数据 + /// + /// + public List GetTree() { + var list = (List)GetList("",""); + list.Add(new FolderEntity() + { + F_Id = "0", + F_PId = "00000", + F_Name = "主目录" + }); + + UserInfo userInfo = LoginUserInfo.Get(); + if (!userInfo.isSystem) + { + string roleIds = userInfo.roleIds; + if (string.IsNullOrEmpty(roleIds)) + { + return new List(); + } + else + { + roleIds = "('" + roleIds.Replace(",", "','") + "')"; + var authList = (List)folderService.BaseRepository().FindList(" select * from lr_base_fileauth where F_ObjId in " + roleIds + " AND F_Time >= @ftime ORDER BY F_Type,F_Level ", new { ftime = DateTime.Now }); + List list2 = new List(); + foreach (var item in list) + { + item.F_AuthType = "1"; + var roleIdList = userInfo.roleIds.Split(','); + foreach (var roleIdItem in roleIdList) + { + var authList2 = authList.FindAll(t => t.F_FileInfoId == item.F_Id && t.F_ObjId == roleIdItem); + if (authList2.Count > 0) + { + if (authList2[0].F_Type != 2 && authList2[0].F_AuthType.IndexOf("2") != -1) + { + item.F_AuthType = "2"; + break; + } + } + } + } + } + } + + + + List treeList = new List(); + foreach (var item in list) + { + TreeModel node = new TreeModel(); + node.id = item.F_Id; + node.text = item.F_Name; + node.value = item.F_Id; + node.showcheck = false; + node.checkstate = 0; + node.isexpand = true; + node.parentId = item.F_PId; + node.checkstate = 2; //1表示没有权限,2表示有权限 + + if (!userInfo.isSystem) { + if (item.F_AuthType == "2") + { + node.checkstate = 2; + } + else { + node.checkstate = 1; + node.text += "【无权限】"; + } + } + + treeList.Add(node); + } + return treeList.ToTree(); + } + + /// + /// 获取lr_base_folder表实体数据 + /// + /// 主键 + /// + public FolderEntity GetEntity(string keyValue) + { + try + { + return folderService.GetEntity(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + public bool DeleteEntity(string keyValue) + { + try + { + return folderService.DeleteEntity(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + public void SaveEntity(string keyValue, FolderEntity entity) + { + try + { + folderService.SaveEntity(keyValue, entity); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + #endregion + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/Folder/FolderEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/Folder/FolderEntity.cs new file mode 100644 index 000000000..ff7abc724 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/Folder/FolderEntity.cs @@ -0,0 +1,66 @@ +using System; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Learun.Application.Base.Files +{ + /// + /// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架 + /// Copyright (c) 2013-2018 上海力软信息技术有限公司 + /// 创 建:超级管理员 + /// 日 期:2019-11-28 09:23 + /// 描 述:文件夹管理 + /// + public class FolderEntity + { + #region 实体成员 + /// + /// 主键 + /// + [Column("F_ID")] + public string F_Id { get; set; } + /// + /// 父级ID + /// + [Column("F_PID")] + public string F_PId { get; set; } + /// + /// 文件夹名称 + /// + [Column("F_NAME")] + public string F_Name { get; set; } + /// + /// 最后更新时间 + /// + [Column("F_TIME")] + public DateTime? F_Time { get; set; } + #endregion + + #region 扩展操作 + /// + /// 新增调用 + /// + public void Create() + { + this.F_Id = Guid.NewGuid().ToString(); + this.F_Time = DateTime.Now; + } + /// + /// 编辑调用 + /// + /// + public void Modify(string keyValue) + { + this.F_Id = keyValue; + this.F_Time = DateTime.Now; + } + #endregion + #region 扩展字段 + /// + /// + /// + [NotMapped] + public string F_AuthType { get; set; } + + #endregion + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/Folder/FolderIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/Folder/FolderIBLL.cs new file mode 100644 index 000000000..f1d668e43 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/Folder/FolderIBLL.cs @@ -0,0 +1,53 @@ +using Learun.Util; +using System.Collections.Generic; + +namespace Learun.Application.Base.Files +{ + /// + /// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架 + /// Copyright (c) 2013-2018 上海力软信息技术有限公司 + /// 创 建:超级管理员 + /// 日 期:2019-11-28 09:23 + /// 描 述:文件夹管理 + /// + public interface FolderIBLL + { + #region 获取数据 + /// + /// 获取页面显示列表数据 + /// + /// 关键字 + /// 父级id + /// + IEnumerable GetList(string keyWord, string pId); + + /// + /// 获取lr_base_folder表实体数据 + /// + /// 主键 + /// + FolderEntity GetEntity(string keyValue); + /// + /// 获取树形数据 + /// + /// + List GetTree(); + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + bool DeleteEntity(string keyValue); + + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + void SaveEntity(string keyValue, FolderEntity entity); + #endregion + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/Folder/FolderService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/Folder/FolderService.cs new file mode 100644 index 000000000..dd9ba136a --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/Folder/FolderService.cs @@ -0,0 +1,357 @@ +using Learun.DataBase.Repository; +using Learun.Util; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Learun.Application.Base.Files +{ + /// + /// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架 + /// Copyright (c) 2013-2018 上海力软信息技术有限公司 + /// 创 建:超级管理员 + /// 日 期:2019-11-28 09:23 + /// 描 述:文件夹管理 + /// + public class FolderService : RepositoryFactory + { + #region 获取数据 + /// + /// 获取页面显示列表数据 + /// + /// 关键字 + /// 父级id + /// + public IEnumerable GetList(string keyWord,string pId) + { + try + { + var strSql = new StringBuilder(); + strSql.Append("SELECT "); + strSql.Append(@" + t.F_Id, + t.F_PId, + t.F_Name, + t.F_Time + "); + strSql.Append(" FROM lr_base_folder t "); + strSql.Append(" WHERE 1=1 "); + if (!string.IsNullOrEmpty(pId)) { + strSql.Append(" AND t.F_PId = @pId "); + } + + + if (!string.IsNullOrEmpty(keyWord)) + { + keyWord = "%" + keyWord + "%"; + strSql.Append(" AND t.F_Name Like @keyWord "); + } + strSql.Append(" Order by F_Name "); + + return this.BaseRepository().FindList(strSql.ToString(), new { keyWord, pId }); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 获取lr_base_folder表实体数据 + /// + /// 主键 + /// + public FolderEntity GetEntity(string keyValue) + { + try + { + return this.BaseRepository().FindEntity(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// + /// + public bool DeleteEntity(string keyValue) + { + var fileList = (List)this.BaseRepository().FindList(" select * from lr_base_fileinfo where F_IsPublish = 1 AND F_Folder = @folderId ", new { folderId = keyValue }); + if (fileList.Count > 0) + { + return false; + } + var folderList = (List)this.BaseRepository().FindList(" select * from lr_base_folder where F_PId = @folderId ", new { folderId = keyValue }); + if (fileList.Count > 0) + { + return false; + } + + var authList = this.BaseRepository().FindList(" select * from lr_base_fileauth t where t.F_FileInfoId = @F_FileInfoId ", new { F_FileInfoId = keyValue }); + + var db = this.BaseRepository().BeginTrans(); + try + { + foreach (var item in authList) { + db.ExecuteBySql(" delete from lr_base_fileauth where F_from =@fromId ", new { fromId = item.F_Id }); + } + db.Delete(t => t.F_Id == keyValue); + db.Commit(); + return true; + } + catch (Exception ex) + { + db.Rollback(); + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + public void SaveEntity(string keyValue, FolderEntity entity) + { + + var db = this.BaseRepository().BeginTrans(); + try + { + if (!string.IsNullOrEmpty(keyValue)) + { + entity.Modify(keyValue); + + var entityTmp = db.FindEntity("select * from lr_base_folder where F_Id = @keyValue",new { keyValue }); + if (entityTmp.F_PId != entity.F_PId) {// 修改了上级了目录需要调整权限 + if (entityTmp.F_PId != "0") { // 需要删除原先继承过来的权限 + var authList = db.FindList(" select * from lr_base_fileauth t where t.F_FileInfoId = @F_FileInfoId ", new { F_FileInfoId = keyValue }); + foreach (var item in authList) + { + if (item.F_Type == 1)// 来自上级文件夹的需要删除 + { + db.ExecuteBySql(" delete from lr_base_fileauth where F_Id =@id ", new { id = item.F_Id }); + db.ExecuteBySql(" delete from lr_base_fileauth where F_from =@fromId AND F_Level > @deep AND F_Type = 1 ", new { fromId = item.F_from, deep = item.F_Level }); + } + else { + if (item.F_Type == 0) + { + item.F_from = item.F_Id; + } + db.ExecuteBySql(" delete from lr_base_fileauth where F_from =@fromId AND F_Level > @deep AND F_Type = 2 ", new { fromId = item.F_from, deep = item.F_Level }); + } + } + } + + if (entity.F_PId != "0") { // 添加新的权限 + var authList2 = db.FindList(" select * from lr_base_fileauth t where t.F_FileInfoId = @F_FileInfoId AND F_Type != 2 ", new { F_FileInfoId = entity.F_PId }); + foreach (var item in authList2) + { + if (item.F_Type == 0) + { + item.F_from = item.F_Id; + } + FileAuthEntity authEntity = new FileAuthEntity() + { + F_Id = Guid.NewGuid().ToString(), + F_AuthType = "1", + F_FileInfoId = entity.F_Id, + F_from = item.F_from, + F_ObjId = item.F_ObjId, + F_ObjName = item.F_ObjName, + F_ObjType = item.F_ObjType, + F_Time = item.F_Time, + F_Type = 1, + F_IsFolder = 1, + F_Level = item.F_Level + 1 + }; + db.Insert(authEntity); + SaveXJEntity(entity.F_Id, item.F_from, item, authEntity.F_Level + 1, db); + } + + // 将自己的权限赋值给上级目录 + var authList3 = db.FindList(" select * from lr_base_fileauth t where t.F_FileInfoId = @F_FileInfoId AND F_Type != 1 ", new { F_FileInfoId = entity.F_Id }); + foreach (var item in authList3) + { + if (item.F_Type == 0) + { + item.F_from = item.F_Id; + } + SaveSJEntity(entity.F_PId, item.F_from, item, item.F_Level + 1, db); + } + + + } + } + + + db.Update(entity); + } + else + { + entity.Create(); + db.Insert(entity); + + if (entity.F_PId != "0") { + // 继承上级文件夹的权限 + var authList = db.FindList(" select * from lr_base_fileauth t where t.F_FileInfoId = @F_FileInfoId ", new { F_FileInfoId = entity.F_PId }); + foreach(var item in authList) { + if (item.F_Type != 2) { + if (item.F_Type == 0) { + item.F_from = item.F_Id; + } + FileAuthEntity authEntity = new FileAuthEntity() + { + F_Id = Guid.NewGuid().ToString(), + F_AuthType = "1", + F_FileInfoId = entity.F_Id, + F_from = item.F_from, + F_ObjId = item.F_ObjId, + F_ObjName = item.F_ObjName, + F_ObjType = item.F_ObjType, + F_Time = item.F_Time, + F_Type = 1, + F_IsFolder = 1, + F_Level = item.F_Level + 1 + }; + db.Insert(authEntity); + } + } + } + } + + db.Commit(); + } + catch (Exception ex) + { + db.Rollback(); + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + + /// + /// 保存上级目录权限设置 + /// + /// + /// + /// + /// + /// + private void SaveSJEntity(string folderId, string fromId, FileAuthEntity fromEntity, int deep, IRepository db) + { + if (folderId != "0") + { + FileAuthEntity entity = new FileAuthEntity() + { + F_Id = Guid.NewGuid().ToString(), + F_AuthType = "1", + F_FileInfoId = folderId, + F_from = fromId, + F_ObjId = fromEntity.F_ObjId, + F_ObjName = fromEntity.F_ObjName, + F_ObjType = fromEntity.F_ObjType, + F_Time = fromEntity.F_Time, + F_Type = 2, + F_IsFolder = 1, + F_Level = deep + }; + db.Insert(entity); + var folderEntity = db.FindEntity(folderId); + SaveSJEntity(folderEntity.F_PId, fromId, fromEntity, deep + 1, db); + } + } + + /// + /// 保存下级目录权限设置 + /// + /// + /// + /// + /// + /// + private void SaveXJEntity(string folderId, string fromId, FileAuthEntity fromEntity, int deep, IRepository db) + { + // 获取文件 + var fileList = db.FindList(" select * from lr_base_fileinfo where F_IsPublish = 1 AND F_Folder = @folderId ", new { folderId }); + foreach (var item in fileList) + { + FileAuthEntity fileAuth = new FileAuthEntity() + { + F_Id = Guid.NewGuid().ToString(), + F_AuthType = fromEntity.F_AuthType, + F_FileInfoId = item.F_Id, + F_from = fromId, + F_ObjId = fromEntity.F_ObjId, + F_ObjName = fromEntity.F_ObjName, + F_ObjType = fromEntity.F_ObjType, + F_Time = fromEntity.F_Time, + F_Type = 1, + F_IsFolder = 0, + F_Level = deep + }; + db.Insert(fileAuth); + } + + // 获取文件夹 + var folderList = db.FindList(" select * from lr_base_folder where F_PId = @folderId ", new { folderId }); + foreach (var item in folderList) + { + FileAuthEntity folderAuth = new FileAuthEntity() + { + F_Id = Guid.NewGuid().ToString(), + F_AuthType = fromEntity.F_AuthType, + F_FileInfoId = item.F_Id, + F_from = fromId, + F_ObjId = fromEntity.F_ObjId, + F_ObjName = fromEntity.F_ObjName, + F_ObjType = fromEntity.F_ObjType, + F_Time = fromEntity.F_Time, + F_Type = 1, + F_IsFolder = 1, + F_Level = deep + }; + db.Insert(folderAuth); + SaveXJEntity(item.F_Id, fromId, fromEntity, deep + 1, db); + } + + } + + #endregion + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Learun.Application.Base.csproj b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Learun.Application.Base.csproj index f6accb402..896dcff84 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Learun.Application.Base.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Learun.Application.Base.csproj @@ -95,6 +95,20 @@ + + + + + + + + + + + + + + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LR_Files/FileAuthMap.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LR_Files/FileAuthMap.cs new file mode 100644 index 000000000..178a47592 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LR_Files/FileAuthMap.cs @@ -0,0 +1,21 @@ +using Learun.Application.Base.Files; +using System.Data.Entity.ModelConfiguration; + +namespace Learun.Application.Mapping.LR_Files +{ + public class FileAuthMap : EntityTypeConfiguration + { + public FileAuthMap() + { + #region 表、主键 + //表 + this.ToTable("LR_BASE_FILEAUTH"); + //主键 + this.HasKey(t => t.F_Id); + #endregion + + #region 配置关系 + #endregion + } + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LR_Files/FileInfoMap.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LR_Files/FileInfoMap.cs new file mode 100644 index 000000000..8fe89e677 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LR_Files/FileInfoMap.cs @@ -0,0 +1,21 @@ +using Learun.Application.Base.Files; +using System.Data.Entity.ModelConfiguration; + +namespace Learun.Application.Mapping.LR_Files +{ + public class FileBInfoMap : EntityTypeConfiguration + { + public FileBInfoMap() + { + #region 表、主键 + //表 + this.ToTable("LR_BASE_FILEINFO"); + //主键 + this.HasKey(t => t.F_Id); + #endregion + + #region 配置关系 + #endregion + } + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LR_Files/FilelistMap.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LR_Files/FilelistMap.cs new file mode 100644 index 000000000..12eecfeea --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LR_Files/FilelistMap.cs @@ -0,0 +1,21 @@ +using Learun.Application.Base.Files; +using System.Data.Entity.ModelConfiguration; + +namespace Learun.Application.Mapping.LR_Files +{ + public class FilelistMap : EntityTypeConfiguration + { + public FilelistMap() + { + #region 表、主键 + //表 + this.ToTable("LR_BASE_FILELIST"); + //主键 + this.HasKey(t => t.F_Id); + #endregion + + #region 配置关系 + #endregion + } + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LR_Files/FolderMap.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LR_Files/FolderMap.cs new file mode 100644 index 000000000..6b2884a0f --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LR_Files/FolderMap.cs @@ -0,0 +1,28 @@ +using Learun.Application.Base.Files; +using System.Data.Entity.ModelConfiguration; + +namespace Learun.Application.Mapping.LR_Files +{ + /// + /// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架 + /// Copyright (c) 2013-2018 上海力软信息技术有限公司 + /// 创 建:超级管理员 + /// 日 期:2019-11-28 09:28 + /// 描 述:文件夹管理 + /// + public class FolderMap : EntityTypeConfiguration + { + public FolderMap() + { + #region 表、主键 + //表 + this.ToTable("LR_BASE_FOLDER"); + //主键 + this.HasKey(t => t.F_Id); + #endregion + + #region 配置关系 + #endregion + } + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LR_Files/_sgbak/FolderMap.cs.110478.1.2020-09-03.15-28-05.2401 b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LR_Files/_sgbak/FolderMap.cs.110478.1.2020-09-03.15-28-05.2401 new file mode 100644 index 000000000..d284d7bd5 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LR_Files/_sgbak/FolderMap.cs.110478.1.2020-09-03.15-28-05.2401 @@ -0,0 +1,31 @@ +using Learun.Application.Base.Files; +using System.Data.Entity.ModelConfiguration; + +namespace Learun.Application.Mapping.LR_Files +{ + /// + /// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架 + /// Copyright (c) 2013-2018 上海力软信息技术有限公司 + /// 创 建:超级管理员 + /// 日 期:2019-11-28 09:28 + /// 描 述:文件夹管理 + /// + public class FolderMap : EntityTypeConfiguration + { + public FolderMap() + { + #region 表、主键 + //表 + this.ToTable("LR_BASE_FOLDER"); + //主键 + this.HasKey(t => t.F_Id); + #endregion + + #region 配置关系 + #endregion + } + } +} + + + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj index d56cd20d0..931afe278 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj @@ -123,6 +123,10 @@ + + + + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Learun.Application.WorkFlow.csproj b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Learun.Application.WorkFlow.csproj index a6ba0929c..799c1cb6e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Learun.Application.WorkFlow.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Learun.Application.WorkFlow.csproj @@ -114,6 +114,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/NodeMethod/WF/WFFileRelease.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/NodeMethod/WF/WFFileRelease.cs new file mode 100644 index 000000000..fa4ec8db8 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/NodeMethod/WF/WFFileRelease.cs @@ -0,0 +1,21 @@ +using Learun.Application.Base.Files; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace Learun.Application.WorkFlow +{ + public class WFFileRelease: IWorkFlowMethod + { + private FileInfoIBLL fileInfoIBLL = new FileInfoBLL(); + + /// + /// 流程执行 + /// + /// + public void Execute(WfMethodParameter parameter) { + fileInfoIBLL.UpdateEntity(parameter.processId); + } + } +} \ No newline at end of file