Ver a proveniência

增加文件上传管理功能(带流程审核、带权限)

大厂分支
dyy há 4 anos
ascendente
cometimento
b39a8181ea
47 ficheiros alterados com 4986 adições e 14 eliminações
  1. +0
    -1
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/AnnexesController.cs
  2. +444
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/FilesController.cs
  3. +21
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileAuthAddFrom.cshtml
  4. +62
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileAuthAddFrom.js
  5. +34
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileAuthFrom.cshtml
  6. +91
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileAuthFrom.js
  7. +57
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileAuthIndex.cshtml
  8. +109
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileAuthIndex.js
  9. +13
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileHistroyIndex.cshtml
  10. +103
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileHistroyIndex.js
  11. +15
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FolderForm.cshtml
  12. +53
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FolderForm.js
  13. +36
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FolderIndex.cshtml
  14. +7
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FolderIndex.css
  15. +93
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FolderIndex.js
  16. +37
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/Form.cshtml
  17. +190
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/Form.js
  18. +73
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/Index.cshtml
  19. +14
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/Index.css
  20. +716
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/Index.js
  21. +19
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj
  22. +111
    -13
      Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/script/lr-form.js
  23. +36
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/style/lr-iframe-index.css
  24. +4
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/ioc.config
  25. +92
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileAuth/FileAuthBLL.cs
  26. +106
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileAuth/FileAuthEntity.cs
  27. +51
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileAuth/FileAuthIBLL.cs
  28. +215
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileAuth/FileAuthService.cs
  29. +119
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileInfo/FileBInfoEntity.cs
  30. +211
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileInfo/FileInfoBLL.cs
  31. +105
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileInfo/FileInfoIBLL.cs
  32. +683
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileInfo/FileInfoService.cs
  33. +119
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileInfo/FilelistEntity.cs
  34. +112
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileInfo/WFFileModel.cs
  35. +197
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/Folder/FolderBLL.cs
  36. +66
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/Folder/FolderEntity.cs
  37. +53
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/Folder/FolderIBLL.cs
  38. +357
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/Folder/FolderService.cs
  39. +14
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Learun.Application.Base.csproj
  40. +21
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LR_Files/FileAuthMap.cs
  41. +21
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LR_Files/FileInfoMap.cs
  42. +21
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LR_Files/FilelistMap.cs
  43. +28
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LR_Files/FolderMap.cs
  44. +31
    -0
      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
  45. +4
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj
  46. +1
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Learun.Application.WorkFlow.csproj
  47. +21
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/NodeMethod/WF/WFFileRelease.cs

+ 0
- 1
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/AnnexesController.cs Ver ficheiro

@@ -140,7 +140,6 @@ namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers
/// <param name="fileId">文件id</param>
/// <returns></returns>
[HttpPost]
[ValidateAntiForgeryToken]
public void DownAnnexesFile(string fileId)
{
var data = annexesFileIBLL.GetEntity(fileId);


+ 444
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/FilesController.cs Ver ficheiro

@@ -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
{
/// <summary>
/// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架
/// Copyright (c) 2013-2018 上海力软信息技术有限公司
/// 创 建:超级管理员
/// 日 期:2019-11-28 09:23
/// 描 述:文件管理
/// </summary>
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 视图功能
/// <summary>
/// 文件管理
/// </summary>
/// <returns></returns>
[HttpGet]
public ActionResult Index()
{
return View();
}
/// <summary>
/// 文件发布页面
/// </summary>
/// <returns></returns>
[HttpGet]
public ActionResult Form()
{
return View();
}

/// <summary>
/// 文件夹管理
/// </summary>
/// <returns></returns>
[HttpGet]
public ActionResult FolderIndex() {
return View();
}

/// <summary>
/// 文件夹管理表单
/// </summary>
/// <returns></returns>
[HttpGet]
public ActionResult FolderForm()
{
return View();
}
/// <summary>
/// 文件授权
/// </summary>
/// <returns></returns>
[HttpGet]
public ActionResult FileAuthIndex()
{
return View();
}
/// <summary>
/// 文件授权
/// </summary>
/// <returns></returns>
[HttpGet]
public ActionResult FileAuthFrom()
{
return View();
}

/// <summary>
/// 文件授权
/// </summary>
/// <returns></returns>
[HttpGet]
public ActionResult FileAuthAddFrom()
{
return View();
}
/// <summary>
/// 文件历史
/// </summary>
/// <returns></returns>
[HttpGet]
public ActionResult FileHistroyIndex()
{
return View();
}
#endregion


#region 获取数据
/// <summary>
/// 获取文件夹数据
/// </summary>
/// <returns></returns>
[HttpGet]
[AjaxOnly]
public ActionResult GetFolderList(string keyWord)
{
var data = folderIBLL.GetList(keyWord, null);
return Success(data);
}

/// <summary>
/// 获取文件夹列表(树结构)
/// </summary>
/// <returns></returns>
[HttpGet]
[AjaxOnly]
public ActionResult GetFolderTree()
{
var data = folderIBLL.GetTree();
return this.Success(data);
}
/// <summary>
/// 获取字典分类列表(树结构)
/// </summary>
/// <returns></returns>
[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);
}


/// <summary>
/// 获取我的流程信息列表
/// </summary>
/// <param name="pagination">分页参数</param>
/// <param name="keyWord">查询条件</param>
/// <returns></returns>
[HttpGet]
[AjaxOnly]
public ActionResult GetWFPageList(string pagination, string keyWord, string wfType)
{
Pagination paginationobj = pagination.ToObject<Pagination>();
IEnumerable<WFFileModel> list = new List<WFFileModel>();
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);
}


/// <summary>
/// 获取我的流程信息列表
/// </summary>
/// <param name="pagination">分页参数</param>
/// <param name="keyWord">查询条件</param>
/// <returns></returns>
[HttpGet]
[AjaxOnly]
public ActionResult GetAllPublishPageList(string keyWord, string folderId)
{
var list = fileInfoIBLL.GetAllPublishPageList(keyWord, folderId);
return Success(list);
}
/// <summary>
/// 获取正式发布的文件
/// </summary>
/// <param name="folderId">文件夹Id</param>
/// <param name="keyWord">查询条件</param>
/// <returns></returns>
[HttpGet]
[AjaxOnly]
public ActionResult GetPublishList(string keyWord, string folderId)
{
var list = fileInfoIBLL.GetPublishList(keyWord, folderId);
return Success(list);
}

/// <summary>
/// 文件的历史信息
/// </summary>
/// <param name="fileInfoId">文件夹Id</param>
/// <returns></returns>
[HttpGet]
[AjaxOnly]
public ActionResult GetHistoryList(string fileInfoId)
{
var list = fileInfoIBLL.GetHistoryList(fileInfoId);
return Success(list);
}

/// <summary>
/// 被删除的文件信息
/// </summary>
/// <param name="fileInfoId">文件夹Id</param>
/// <returns></returns>
[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("不准删除,有文件或子文件夹");
}
}

/// <summary>
/// 虚拟删除文件
/// </summary>
/// <param name="keyValue"></param>
/// <returns></returns>
[HttpPost]
[AjaxOnly]
public ActionResult VDeleteFile(string keyValue)
{
fileInfoIBLL.VDeleteEntity(keyValue);
return this.Success("删除成功");
}
/// <summary>
/// 还原虚拟删除文件
/// </summary>
/// <param name="keyValue"></param>
/// <returns></returns>
[HttpPost]
[AjaxOnly]
public ActionResult RecoveryFile(string keyValue)
{
fileInfoIBLL.RecoveryEntity(keyValue);
return this.Success("删除成功");
}
/// <summary>
/// 彻底删除文件
/// </summary>
/// <param name="keyValue"></param>
/// <returns></returns>
[HttpPost]
[AjaxOnly]
public ActionResult DeleteFile(string keyValue)
{
fileInfoIBLL.DeleteEntity(keyValue);
return this.Success("删除成功");
}

/// <summary>
/// 保存数据
/// </summary>
/// <param name="keyValue">主键</param>
/// <param name="strInfoEntity">文件信息</param>
/// <param name="strListEntity">文件列表信息</param>
/// <returns></returns>
[HttpPost]
[AjaxOnly]
public ActionResult SaveFile(string keyValue, string strInfoEntity, string strListEntity)
{
FileBInfoEntity fileBInfoEntity = strInfoEntity.ToObject<FileBInfoEntity>();
FilelistEntity filelistEntity = strListEntity.ToObject<FilelistEntity>();
if (string.IsNullOrEmpty(fileBInfoEntity.F_Id))
{
codeRuleIBLL.UseRuleSeed("FS01");
}
fileInfoIBLL.SaveEntity(keyValue, fileBInfoEntity, filelistEntity);
return this.Success("保存成功");
}

#endregion

#region 权限管理
/// <summary>
/// 判断文件有没有上传权限
/// </summary>
/// <param name="folderId"></param>
/// <returns></returns>
public ActionResult IsUPLoad(string folderId) {
var res = fileAuthIBLL.IsUPLoad(folderId);
return Success(res);
}
/// <summary>
/// 获取我的流程信息列表
/// </summary>
/// <param name="fileInfoId">文件信息主键</param>
/// <returns></returns>
[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);
}
/// <summary>
/// 删除授权对象
/// </summary>
/// <param name="keyValue">主键</param>
/// <returns></returns>
[HttpPost]
[AjaxOnly]
public ActionResult DeleteAuth(string keyValue)
{
fileAuthIBLL.DeleteEntity(keyValue);
return this.Success("删除成功");
}
/// <summary>
/// 保存授权信息
/// </summary>
/// <param name="keyValue">主键</param>
/// <param name="entity">实体数据</param>
/// <returns></returns>
[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
}
}

+ 21
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileAuthAddFrom.cshtml Ver ficheiro

@@ -0,0 +1,21 @@

@{
ViewBag.Title = "FileAuthAddFrom";
Layout = "~/Views/Shared/_Form.cshtml";
}

<div class="lr-form-wrap" id="form">
<div class="col-xs-12 lr-form-item">
<div class="lr-form-item-title">授权角色<font face="宋体">*</font></div>
<div id="F_ObjId"></div>
</div>
<div class="col-xs-12 lr-form-item">
<div class="lr-form-item-title">权限类型<font face="宋体">*</font></div>
<div id="F_AuthType"></div>
</div>
<div class="col-xs-12 lr-form-item">
<div class="lr-form-item-title">到期时间</div>
<input id="F_Time" type="text" class="form-control lr-input-wdatepicker" onfocus="WdatePicker()" data-dateFmt="yyyy-MM-dd" placeholder="不填为永久" />
</div>
</div>
@Html.AppendJsFile("/Areas/LR_SystemModule/Views/Files/FileAuthAddFrom.js")

+ 62
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileAuthAddFrom.js Ver ficheiro

@@ -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();
}

+ 34
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileAuthFrom.cshtml Ver ficheiro

@@ -0,0 +1,34 @@
@{
ViewBag.Title = "FileAuthFrom";
Layout = "~/Views/Shared/_Index.cshtml";
}
<style>
.lr-layout {
padding: 0px;
}

.lr-layout-wrap {
border-radius: 0px;
}
</style>
<div class="lr-layout">
<div class="lr-layout-center">
<div class="lr-layout-wrap lr-layout-wrap-notitle">
<div class="lr-layout-tool">
<div class="lr-layout-tool-right">
<div class=" btn-group btn-group-sm">
<a id="lr_refresh" class="btn btn-default"><i class="fa fa-refresh"></i></a>
</div>
<div class=" btn-group btn-group-sm">
<a id="lr_add" class="btn btn-default"><i class="fa fa-plus"></i>&nbsp;<span class="lrlg">新增</span></a>
<a id="lr_edit" class="btn btn-default"><i class="fa fa-pencil-square-o"></i>&nbsp;<span class="lrlg">编辑</span></a>
<a id="lr_delete" class="btn btn-default"><i class="fa fa-trash-o"></i>&nbsp;<span class="lrlg">删除</span></a>
</div>
</div>
</div>
<div class="lr-layout-body" id="gridtable"></div>
</div>
</div>
</div>

@Html.AppendJsFile("/Areas/LR_SystemModule/Views/Files/FileAuthFrom.js")

+ 91
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileAuthFrom.js Ver ficheiro

@@ -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 '<span class=\"label label-success\" style=\"cursor: pointer;\">永久</span>';
} 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();
}

+ 57
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileAuthIndex.cshtml Ver ficheiro

@@ -0,0 +1,57 @@

@{
ViewBag.Title = "FileAuthIndex";
Layout = "~/Views/Shared/_Index.cshtml";
}
<style>
.lr-layout {
padding: 0px;
}

.lr-layout-wrap {
border-radius: 0px;
}
.path-item {
cursor: pointer;
}

.path-item:hover {
color: #3286ed;
}
</style>
<div class="lr-layout">
<div class="lr-layout-center">
<div class="lr-layout-wrap lr-layout-wrap-notitle">
<div class="lr-layout-tool">
<div class="lr-layout-tool-left">
<div class="lr-layout-tool-item">
<input id="txt_Keyword" type="text" class="form-control" placeholder="请输入文件名称" />
</div>
<div class="lr-layout-tool-item">
<a id="btn_Search" class="btn btn-primary btn-sm"><i class="fa fa-search"></i>&nbsp;<span class="lrlg">查询</span></a>
</div>
</div>
<div class="lr-layout-tool-right">
<div class=" btn-group btn-group-sm">
<a id="lr_refresh" class="btn btn-default"><i class="fa fa-refresh"></i></a>
</div>
<div class=" btn-group btn-group-sm">
<a id="lr_auth" class="btn btn-default"><i class="fa fa-legal"></i>&nbsp;<span class="lrlg">授权</span></a>
<a id="lr_main_auth" class="btn btn-default"><i class="fa fa-legal"></i>&nbsp;<span class="lrlg">主目录授权</span></a>
</div>
</div>
</div>
<div class="lr-layout-body">
<div class="lr-rblock active " style="padding-top:32px;" id="releaseFile">
<div style="position:absolute;top:0;left:0;height:32px;line-height:31px;color:#666;width:100%;border-bottom:1px solid #ccc;padding-left:8px;" id="pathList">
<span data-fileid="0" class="path-item">主目录</span>
</div>
<div id="gridtable"></div>
</div>
</div>
</div>
</div>
</div>

@Html.AppendJsFile("/Areas/LR_SystemModule/Views/Files/FileAuthIndex.js")

+ 109
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileAuthIndex.js Ver ficheiro

@@ -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 "<div style='cursor:pointer;'><div style='float: left;'><img src='" + top.$.rootUrl + "/Content/images/filetype/" + row.F_FileType + ".png' style='width:30px;height:30px;padding:5px;margin-left:-5px;margin-right:5px;' /></div><div style='float: left;line-height:35px;'>" + cellvalue + "</div></div>";
}
},
{
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 = $('<div></div>');
if (row.Type == '2') {
var $openFolder = $('<span class=\"label label-success\" style=\"cursor: pointer;\">打开</span>');
$openFolder.on('click', function () {
folderId = value;
page.openFolder();
$('#pathList').append('<span data-fileid="' + value + '" class="path-item">/&nbsp;' + row.F_Name + '</span>');
});
$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();
}

+ 13
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileHistroyIndex.cshtml Ver ficheiro

@@ -0,0 +1,13 @@

@{
ViewBag.Title = "FileHistroyIndex";
Layout = "~/Views/Shared/_Index.cshtml";
}

<div class="lr-rblock" style="padding:8px" >
<div id="gridtable" style="border:1px solid #ccc" >

</div>
</div>

@Html.AppendJsFile("/Areas/LR_SystemModule/Views/Files/FileHistroyIndex.js")

+ 103
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FileHistroyIndex.js Ver ficheiro

@@ -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 "<div style='cursor:pointer;'><div style='float: left;'><img src='" + top.$.rootUrl + "/Content/images/filetype/" + row.F_FileType + ".png' style='width:30px;height:30px;padding:5px;margin-left:-5px;margin-right:5px;' /></div><div style='float: left;line-height:35px;'>" + cellvalue + "</div></div>";
}
},
{
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 = $('<div></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 = $('<span class=\"label label-info\" data-value="' + _item + '" style=\"cursor: pointer; margin-right:8px;\">' + btnName[_item] + '</span>');
$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();
}

+ 15
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FolderForm.cshtml Ver ficheiro

@@ -0,0 +1,15 @@
@{
ViewBag.Title = "文件夹管理";
Layout = "~/Views/Shared/_Form.cshtml";
}
<div class="lr-form-wrap" id="form">
<div class="col-xs-12 lr-form-item">
<div class="lr-form-item-title">上级</div>
<div id="F_PId"></div>
</div>
<div class="col-xs-12 lr-form-item">
<div class="lr-form-item-title">名称<font face="宋体">*</font></div>
<input id="F_Name" type="text" class="form-control" placeholder="请输入名称" isvalid="yes" checkexpession="NotNull" />
</div>
</div>
@Html.AppendJsFile("/Areas/LR_SystemModule/Views/Files/FolderForm.js")

+ 53
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FolderForm.js Ver ficheiro

@@ -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"] == '&nbsp;' || 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();
}

+ 36
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FolderIndex.cshtml Ver ficheiro

@@ -0,0 +1,36 @@
@{
ViewBag.Title = "文件夹管理";
Layout = "~/Views/Shared/_Index.cshtml";
}
@Html.AppendCssFile("/Areas/LR_SystemModule/Views/Files/FolderIndex.css")
<div class="lr-layout">
<div class="lr-layout-center">
<div class="lr-layout-wrap lr-layout-wrap-notitle">
<div class="lr-layout-tool">
<div class="lr-layout-tool-left">
<div class="lr-layout-tool-item">
<input id="txt_Keyword" type="text" class="form-control" placeholder="请输入名称" />
</div>
<div class="lr-layout-tool-item">
<a id="btn_Search" class="btn btn-primary btn-sm"><i class="fa fa-search"></i>&nbsp;<span class="lrlg">查询</span></a>
</div>
</div>
<div class="lr-layout-tool-right">
<div class=" btn-group btn-group-sm">
<a id="lr_refresh" class="btn btn-default"><i class="fa fa-refresh"></i></a>
</div>
<div class=" btn-group btn-group-sm">
<a id="lr_add" class="btn btn-default"><i class="fa fa-plus"></i>&nbsp;<span class="lrlg">新增</span></a>
<a id="lr_edit" class="btn btn-default"><i class="fa fa-pencil-square-o"></i>&nbsp;<span class="lrlg">编辑</span></a>
<a id="lr_delete" class="btn btn-default"><i class="fa fa-trash-o"></i>&nbsp;<span class="lrlg">删除</span></a>
</div>
</div>
</div>
<div class="lr-layout-body" id="gridtable"></div>
</div>
</div>
</div>
@Html.AppendJsFile("/Areas/LR_SystemModule/Views/Files/FolderIndex.js")




+ 7
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FolderIndex.css Ver ficheiro

@@ -0,0 +1,7 @@
.lr-layout {
padding: 0px;
}

.lr-layout-wrap {
border-radius: 0px;
}

+ 93
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/FolderIndex.js Ver ficheiro

@@ -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();
}



+ 37
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/Form.cshtml Ver ficheiro

@@ -0,0 +1,37 @@

@{
ViewBag.Title = "Form";
Layout = "~/Views/Shared/_Form.cshtml";
}

<div class="lr-form-wrap" id="form">
<div class="col-xs-6 lr-form-item">
<div class="lr-form-item-title">文件编号<font face="宋体">*</font></div>
<input id="F_Code" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" readonly />
</div>
<div class="col-xs-6 lr-form-item">
<div class="lr-form-item-title">文件版本号<font face="宋体">*</font></div>
<input id="F_Ver" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" />
</div>
<div class="col-xs-12 lr-form-item">
<div class="lr-form-item-title">文件名称<font face="宋体">*</font></div>
<input id="F_Name" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" />
</div>
<div class="col-xs-12 lr-form-item">
<div class="lr-form-item-title">所在文件夹<font face="宋体">*</font></div>
<div id="F_Folder" isvalid="yes" checkexpession="NotNull" ></div>
</div>
<div class="col-xs-12 lr-form-item">
<div class="lr-form-item-title">文件关键字</div>
<input id="F_KeyWord" type="text" class="form-control" />
</div>
<div class="col-xs-12 lr-form-item">
<div class="lr-form-item-title">原始文件<font face="宋体">*</font></div>
<div id="F_FileId"></div>
</div>
<div class="col-xs-12 lr-form-item">
<div class="lr-form-item-title">预览文件<font face="宋体">*</font></div>
<div id="F_PFiled"></div>
</div>
</div>
@Html.AppendJsFile("/Areas/LR_SystemModule/Views/Files/Form.js")

+ 190
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/Form.js Ver ficheiro

@@ -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 == '&nbsp;') {
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();
}
}

+ 73
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/Index.cshtml Ver ficheiro

@@ -0,0 +1,73 @@

@{
ViewBag.Title = "文件管理";
Layout = "~/Views/Shared/_Index.cshtml";
}
@Html.AppendCssFile("/Areas/LR_SystemModule/Views/Files/Index.css")

<div id="lr_layout" class="lr-layout lr-layout-left-center">
<div class="lr-layout-left">
<div class="lr-layout-wrap lr-layout-wrap-notitle" style="padding-top:10px;">
<div class="lr-layout-body">
<ul class="lr-left-list" id="lr_left_list">
<li data-value="releaseFile" class="lrlg active">正式文件</li>
<li data-value="verifyFile" class="lrlg">审核中文件</li>
<li data-value="recycledFile" class="lrlg">回收站</li>
</ul>
</div>
</div>
</div>
<div class="lr-layout-center">
<div class="lr-layout-wrap lr-layout-wrap-notitle">
<div class="lr-layout-tool">
<div class="lr-layout-tool-left">
<div class="lr-layout-tool-item">
<div id="datesearch" class="datetime"></div>
</div>
<div class="lr-layout-tool-item">
<input id="txt_Keyword" type="text" class="form-control" placeholder="请输入要查询关键字" />
</div>
<div class="lr-layout-tool-item">
<a id="btn_Search" class="btn btn-primary btn-sm"><i class="fa fa-search"></i>&nbsp;<span class="lrlg">查询</span></a>
</div>
</div>
<div class="lr-layout-tool-right">
<div class="btn-group btn-group-sm">
<a id="lr_refresh" class="btn btn-default"><i class="fa fa-refresh"></i></a>
</div>
<div class="btn-group btn-group-sm">
<a id="lr-uploadify" class="btn btn-success"><i class="fa fa-upload"></i>&nbsp;<span class="lrlg">创建文件</span></a>
</div>
<div class="btn-group btn-group-sm">
<a id="lr-folder" class="btn btn-default"><i class="fa fa-folder"></i>&nbsp;<span class="lrlg">文件夹管理</span></a>
<a id="lr-fileAuth" class="btn btn-default"><i class="fa fa-legal"></i>&nbsp;<span class="lrlg">文件授权</span></a>
</div>
</div>
</div>
<div class="lr-layout-body">
<div class="lr-rblock active " style="padding-top:32px;" id="releaseFile">
<div style="position:absolute;top:0;left:0;height:32px;line-height:31px;color:#666;width:100%;border-bottom:1px solid #ccc;padding-left:8px;" id="pathList" >
<span data-fileid="0" class="path-item">主目录</span>
</div>
<div id="gridTable" ></div>
</div>
<div class="lr-rblock" id="verifyFile" style="padding:5px;">
<div class="lr-form-tabs" id="lr_form_tabs">
<ul class="nav nav-tabs">
<li class="active"><a data-value="1"><span class="lrlg">我提交的文件</span></a></li>
<li><a data-value="2"><span class="lrlg">需要审核的文件</span></a></li>
<li><a data-value="3"><span class="lrlg">已审核文件</span></a></li>
</ul>
</div>
<div class="lr-tab-content" style="padding-top:8px;">
<div id="wfgridtable" style="border:1px solid #ccc;" ></div>
</div>
</div>
<div class="lr-rblock" id="recycledFile"><div id="dgridtable" ></div></div>
</div>
</div>
</div>
</div>

@Html.AppendJsFile("/Areas/LR_SystemModule/Views/Files/Index.js")


+ 14
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/Index.css Ver ficheiro

@@ -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;
}

+ 716
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/Files/Index.js Ver ficheiro

@@ -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 '<span class="label label-success create" title="编辑创建">编辑创建</span><span class="label label-danger delete" style="margin-left:5px;" title="删除草稿" >删除草稿</span>';
}



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 = '<span class="label label-primary urge" title="催办审核" >催办审核</span>';
if (row.F_IsStart == 0) {
_btnHtml += '<span class="label label-warning revoke" style="margin-left:5px;" title="撤销流程" >撤销流程</span>';
}
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 '<span class="label label-danger AgainCreate" title="重新发起">重新发起</span>';
}


if (wfType == '3' && row.F_TaskType == 1 && row.F_IsFinished == 0) {// 已完成任务,添加一个撤销按钮
cellvalue = '<span class="label label-warning revoke2" style="margin-left:5px;margin-right:5px;" title="撤销审核" >撤销审核</span>' + 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 "<span class=\"label label-danger\">催办加急</span>";
}
return "<span class=\"label label-success\">运行中</span>";
}
if (row.F_IsFinished == 0) {
if (cellvalue == 1) {
if (row.F_IsUrge == "1" && wfType == '2') {
return "<span class=\"label label-danger\">催办加急</span>";
}
return "<span class=\"label label-success\">运行中</span>";
} else if (cellvalue == 2) {
return "<span class=\"label label-primary\">草稿</span>";
} else {
return "<span class=\"label label-danger\">作废</span>";
}
}
else {
return "<span class=\"label label-warning\">结束</span>";
}

}
},
{ 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 "<div style='cursor:pointer;'><div style='float: left;'><img src='" + top.$.rootUrl + "/Content/images/filetype/" + row.F_FileType + ".png' style='width:30px;height:30px;padding:5px;margin-left:-5px;margin-right:5px;' /></div><div style='float: left;line-height:35px;'>" + cellvalue + "</div></div>";
}
},
{
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 = $('<div></div>');
if (row.Type == '2') {
var $openFolder = $('<span class=\"label label-success\" style=\"cursor: pointer;\">打开</span>');
$openFolder.on('click', function () {
folderId = value;
folderAuth = row.F_AuthType;
page.openFolder();
var $span = $('<span data-fileid="' + value + '" class="path-item">/&nbsp;' + row.F_Name + '</span>');
$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 = $('<span class=\"label ' + btnClass +'\" data-value="' + _item + '" style=\"cursor: pointer; margin-right:8px;\">' + btnName[_item] + '</span>');
$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 = $('<span class=\"label label-primary\" style=\"cursor: pointer;\">查看历史</span>');
$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 "<div style='cursor:pointer;'><div style='float: left;'><img src='" + top.$.rootUrl + "/Content/images/filetype/" + row.F_FileType + ".png' style='width:30px;height:30px;padding:5px;margin-left:-5px;margin-right:5px;' /></div><div style='float: left;line-height:35px;'>" + cellvalue + "</div></div>";
}
},
{
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 = $('<div></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 = $('<span class=\"label ' + btnClass +'\" data-value="' + _item + '" style=\"cursor: pointer; margin-right:8px;\">' + btnName[_item] + '</span>');
$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 = $('<span class=\"label label-primary\" style=\"cursor: pointer;\">查看历史</span>');
$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();
}

+ 19
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj Ver ficheiro

@@ -464,6 +464,7 @@
<Compile Include="Areas\LR_SystemModule\Controllers\DbFieldController.cs" />
<Compile Include="Areas\LR_SystemModule\Controllers\ExcelExportController.cs" />
<Compile Include="Areas\LR_SystemModule\Controllers\ExcelImportController.cs" />
<Compile Include="Areas\LR_SystemModule\Controllers\FilesController.cs" />
<Compile Include="Areas\LR_SystemModule\Controllers\ImgController.cs" />
<Compile Include="Areas\LR_SystemModule\Controllers\InterfaceController.cs" />
<Compile Include="Areas\LR_SystemModule\Controllers\LogController.cs" />
@@ -1289,6 +1290,16 @@
<Content Include="Areas\LR_PortalSite\Views\Page\SetContentForm.css" />
<Content Include="Areas\LR_PortalSite\Views\Page\SetContentForm.js" />
<Content Include="Areas\LR_PortalSite\Views\Page\SetNameForm.js" />
<Content Include="Areas\LR_SystemModule\Views\Files\FileAuthAddFrom.js" />
<Content Include="Areas\LR_SystemModule\Views\Files\FileAuthFrom.js" />
<Content Include="Areas\LR_SystemModule\Views\Files\FileAuthIndex.js" />
<Content Include="Areas\LR_SystemModule\Views\Files\FileHistroyIndex.js" />
<Content Include="Areas\LR_SystemModule\Views\Files\FolderForm.js" />
<Content Include="Areas\LR_SystemModule\Views\Files\FolderIndex.css" />
<Content Include="Areas\LR_SystemModule\Views\Files\FolderIndex.js" />
<Content Include="Areas\LR_SystemModule\Views\Files\Form.js" />
<Content Include="Areas\LR_SystemModule\Views\Files\Index.css" />
<Content Include="Areas\LR_SystemModule\Views\Files\Index.js" />
<Content Include="Areas\LR_TaskScheduling\Views\TaskDesign\AddDetailedForm.css" />
<Content Include="Areas\LR_TaskScheduling\Views\TaskDesign\AddDetailedForm.js" />
<Content Include="Areas\LR_TaskScheduling\Views\TaskDesign\Form.css" />
@@ -6770,6 +6781,14 @@
<Content Include="Areas\LR_CodeDemo\Views\StockDemo\Stock.cshtml" />
<Content Include="Areas\LR_CodeDemo\Views\WorkOrder\Form.cshtml" />
<Content Include="Areas\LR_CodeDemo\Views\WorkOrder\Index.cshtml" />
<Content Include="Areas\LR_SystemModule\Views\Files\FileAuthAddFrom.cshtml" />
<Content Include="Areas\LR_SystemModule\Views\Files\FileAuthFrom.cshtml" />
<Content Include="Areas\LR_SystemModule\Views\Files\FileAuthIndex.cshtml" />
<Content Include="Areas\LR_SystemModule\Views\Files\FileHistroyIndex.cshtml" />
<Content Include="Areas\LR_SystemModule\Views\Files\FolderForm.cshtml" />
<Content Include="Areas\LR_SystemModule\Views\Files\FolderIndex.cshtml" />
<Content Include="Areas\LR_SystemModule\Views\Files\Form.cshtml" />
<Content Include="Areas\LR_SystemModule\Views\Files\Index.cshtml" />
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" />
<Content Include="Views\Login\Default-beifen.cshtml" />
<None Include="Properties\PublishProfiles\FolderProfile1.pubxml" />


+ 111
- 13
Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/script/lr-form.js Ver ficheiro

@@ -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 { '<': '&lt;', '>': '&gt;', '&': '&amp;', '"': '&quot;' }[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] = '&nbsp;';
}
if (resdata[id] == '&nbsp;' && !keyValue) {
resdata[id] = '';
if (resdata[id] != undefined) {
resdata[id] += '';
if (resdata[id] == '') {
resdata[id] = '&nbsp;';
}
if (resdata[id] == '&nbsp;' && !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 = $('<label><input name="' + thisId + '" value="' + item[dfop.value] + '"' + '" type="' + dfop.type + '">' + item[dfop.text] + '</label>');
$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);

+ 36
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/style/lr-iframe-index.css Ver ficheiro

@@ -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%;
}



+ 4
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/ioc.config Ver ficheiro

@@ -31,6 +31,8 @@

<!--工作流接口:新的流程接口(新版流程使用)-->
<typeAlias alias="IWorkFlowMethod" type=" Learun.Application.WorkFlow.IWorkFlowMethod, Learun.Application.WorkFlow" />
<typeAlias alias="WFFileRelease" type=" Learun.Application.WorkFlow.WFFileRelease, Learun.Application.WorkFlow" />

</typeAliases>
<containers>
<container name="IOCcontainer">
@@ -55,6 +57,8 @@
<type type="IWorkFlowMethod" mapTo="SW_Ask_StudentMainMethod" name="SW_Ask_StudentMainMethod"></type>
<type type="IWorkFlowMethod" mapTo="Sys_SendFilePartyMethod" name="Sys_SendFilePartyMethod"></type>
<type type="IWorkFlowMethod" mapTo="Ass_ReceiveMethod" name="Ass_ReceiveMethod"></type>
<type type="IWorkFlowMethod" mapTo="WFFileRelease" name="wfFileRelease"></type>

</container>

<container name="TsIOCcontainer">


+ 92
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileAuth/FileAuthBLL.cs Ver ficheiro

@@ -0,0 +1,92 @@
using Learun.Util;
using System.Collections.Generic;

namespace Learun.Application.Base.Files
{
/// <summary>
/// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架
/// Copyright (c) 2013-2018 上海力软信息技术有限公司
/// 创 建:超级管理员
/// 日 期:2019-11-28 09:23
/// 描 述:文件权限管理
/// </summary>
public class FileAuthBLL: FileAuthIBLL
{
private FileAuthService fileAuthService = new FileAuthService();


#region 获取数据
/// <summary>
/// 判断当前文件夹有没有上传权限
/// </summary>
/// <param name="id">文件夹主键</param>
/// <returns></returns>
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;
}
}
}
/// <summary>
/// 获取授权信息列表
/// </summary>
/// <param name="F_FileInfoId">文件信息主键</param>
/// <returns></returns>
public IEnumerable<FileAuthEntity> GetList(string F_FileInfoId)
{
return fileAuthService.GetList(F_FileInfoId);
}

/// <summary>
/// 实体数据
/// </summary>
/// <param name="keyValue">主键</param>
/// <returns></returns>
public FileAuthEntity GetEntity(string keyValue)
{
return fileAuthService.GetEntity(keyValue);
}
#endregion

#region 提交数据
/// <summary>
/// 删除数据
/// </summary>
/// <param name="keyValue">主键</param>
public void DeleteEntity(string keyValue)
{
fileAuthService.DeleteEntity(keyValue);
}

/// <summary>
/// 保存数据
/// </summary>
/// <param name="keyValue">主键</param>
/// <param name="entity">实体数据</param>
public bool SaveEntity(string keyValue, FileAuthEntity entity)
{
return fileAuthService.SaveEntity(keyValue, entity);
}
#endregion
}
}

+ 106
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileAuth/FileAuthEntity.cs Ver ficheiro

@@ -0,0 +1,106 @@
using System;
using System.ComponentModel.DataAnnotations.Schema;

namespace Learun.Application.Base.Files
{
/// <summary>
/// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架
/// Copyright (c) 2013-2018 上海力软信息技术有限公司
/// 创 建:超级管理员
/// 日 期:2019-11-29 14:04
/// 描 述:w
/// </summary>
public class FileAuthEntity
{
#region 实体成员
/// <summary>
/// 主键
/// </summary>
/// <returns></returns>
[Column("F_ID")]
public string F_Id { get; set; }
/// <summary>
/// 文件信息主键
/// </summary>
/// <returns></returns>
[Column("F_FILEINFOID")]
public string F_FileInfoId { get; set; }
/// <summary>
/// 对象名称
/// </summary>
/// <returns></returns>
[Column("F_OBJNAME")]
public string F_ObjName { get; set; }
/// <summary>
/// 对应对象主键
/// </summary>
/// <returns></returns>
[Column("F_OBJID")]
public string F_ObjId { get; set; }
/// <summary>
/// 对应对象类型2角色
/// </summary>
/// <returns></returns>
[Column("F_OBJTYPE")]
public int? F_ObjType { get; set; }
/// <summary>
/// 1 查看 2上传 3 下载 4 删除 5 复原
/// </summary>
/// <returns></returns>
[Column("F_AUTHTYPE")]
public string F_AuthType { get; set; }
/// <summary>
/// 到期日期
/// </summary>
/// <returns></returns>
[Column("F_TIME")]
public DateTime? F_Time { get; set; }

/// <summary>
/// 权限来源 上级文件夹或者下级文件 null为自己
/// </summary>
public string F_from { get; set; }
/// <summary>
/// 0 自己 1 上级 2 下级
/// </summary>
public int F_Type { get; set; }
/// <summary>
/// 0 不是 1是文件夹
/// </summary>
public int F_IsFolder { get; set; }
/// <summary>
/// 0 自己 值越大离自己越远
/// </summary>
public int F_Level { get; set; }
#endregion

#region 扩展操作
/// <summary>
/// 新增调用
/// </summary>
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();
}
/// <summary>
/// 编辑调用
/// </summary>
/// <param name="keyValue"></param>
public void Modify(string keyValue)
{
if (this.F_Time == null)
{
this.F_Time = DateTime.MaxValue.AddDays(-1);
}
this.F_Id = keyValue;
}
#endregion
}
}

+ 51
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileAuth/FileAuthIBLL.cs Ver ficheiro

@@ -0,0 +1,51 @@
using System.Collections.Generic;

namespace Learun.Application.Base.Files
{
/// <summary>
/// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架
/// Copyright (c) 2013-2018 上海力软信息技术有限公司
/// 创 建:超级管理员
/// 日 期:2019-11-28 09:23
/// 描 述:文件权限管理
/// </summary>
public interface FileAuthIBLL
{

#region 获取数据
/// <summary>
/// 判断当前文件夹有没有上传权限
/// </summary>
/// <param name="id">文件夹主键</param>
/// <returns></returns>
bool IsUPLoad(string id);
/// <summary>
/// 获取授权信息列表
/// </summary>
/// <param name="F_FileInfoId">文件信息主键</param>
/// <returns></returns>
IEnumerable<FileAuthEntity> GetList(string F_FileInfoId);

/// <summary>
/// 实体数据
/// </summary>
/// <param name="keyValue">主键</param>
/// <returns></returns>
FileAuthEntity GetEntity(string keyValue);
#endregion

#region 提交数据
/// <summary>
/// 删除数据
/// </summary>
/// <param name="keyValue">主键</param>
void DeleteEntity(string keyValue);
/// <summary>
/// 保存数据
/// </summary>
/// <param name="keyValue">主键</param>
/// <param name="entity">实体数据</param>
bool SaveEntity(string keyValue, FileAuthEntity entity);
#endregion
}
}

+ 215
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileAuth/FileAuthService.cs Ver ficheiro

@@ -0,0 +1,215 @@
using Learun.DataBase.Repository;
using System;
using System.Collections.Generic;
using System.Text;

namespace Learun.Application.Base.Files
{
/// <summary>
/// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架
/// Copyright (c) 2013-2018 上海力软信息技术有限公司
/// 创 建:超级管理员
/// 日 期:2019-11-28 09:23
/// 描 述:文件权限管理
/// </summary>
public class FileAuthService: RepositoryFactory
{
#region 获取数据
/// <summary>
/// 获取文件夹权限
/// </summary>
/// <param name="id">文件夹id</param>
/// <returns></returns>
public IEnumerable<FileAuthEntity> 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<FileAuthEntity>(strSql.ToString(), new { F_FileInfoId = id });
}
/// <summary>
/// 获取授权信息列表
/// </summary>
/// <param name="F_FileInfoId">文件信息主键</param>
/// <returns></returns>
public IEnumerable<FileAuthEntity> 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<FileAuthEntity>(strSql.ToString(), new { F_FileInfoId });
}
/// <summary>
/// 实体数据
/// </summary>
/// <param name="keyValue">主键</param>
/// <returns></returns>
public FileAuthEntity GetEntity(string keyValue)
{
return this.BaseRepository().FindEntity<FileAuthEntity>(keyValue);
}
#endregion

#region 提交数据
/// <summary>
/// 删除数据
/// </summary>
/// <param name="keyValue">主键</param>
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<FileAuthEntity>(new FileAuthEntity() { F_Id = keyValue });
db.Commit();
}
catch (Exception)
{
db.Rollback();
throw;
}

}
/// <summary>
/// 保存数据
/// </summary>
/// <param name="keyValue">主键</param>
/// <param name="entity">实体数据</param>
public bool SaveEntity(string keyValue, FileAuthEntity entity) {
var db = this.BaseRepository().BeginTrans();
try
{
if (string.IsNullOrEmpty(keyValue))
{
var entityTmp = db.FindEntity<FileAuthEntity>(" 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<FolderEntity>(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<FileBInfoEntity>(entity.F_FileInfoId);
SaveSJEntity(fileEntity.F_Folder, entity.F_Id, entity, deep, db);
}

db.Commit();
return true;
}
catch (System.Exception)
{
db.Rollback();
throw;
}
}
/// <summary>
/// 保存上级目录权限设置
/// </summary>
/// <param name="folderId"></param>
/// <param name="fromId"></param>
/// <param name="fromEntity"></param>
/// <param name="deep"></param>
/// <param name="db"></param>
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<FolderEntity>(folderId);
SaveSJEntity(folderEntity.F_PId, fromId, fromEntity,deep + 1, db);
}
}

/// <summary>
/// 保存下级目录权限设置
/// </summary>
/// <param name="folderId"></param>
/// <param name="fromId"></param>
/// <param name="fromEntity"></param>
/// <param name="deep"></param>
/// <param name="db"></param>
private void SaveXJEntity(string folderId, string fromId, FileAuthEntity fromEntity,int deep, IRepository db)
{
// 获取文件
var fileList = db.FindList<FileBInfoEntity>(" 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<FolderEntity>(" 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
}
}

+ 119
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileInfo/FileBInfoEntity.cs Ver ficheiro

@@ -0,0 +1,119 @@
using System;
using System.ComponentModel.DataAnnotations.Schema;

namespace Learun.Application.Base.Files
{
/// <summary>
/// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架
/// Copyright (c) 2013-2018 上海力软信息技术有限公司
/// 创 建:超级管理员
/// 日 期:2019-11-29 14:04
/// 描 述:文件管理
/// </summary>
public class FileBInfoEntity
{
#region 实体成员
/// <summary>
/// 主键
/// </summary>
/// <returns></returns>
[Column("F_ID")]
public string F_Id { get; set; }
/// <summary>
/// 文件编号
/// </summary>
/// <returns></returns>
[Column("F_CODE")]
public string F_Code { get; set; }
/// <summary>
/// 文件名称
/// </summary>
/// <returns></returns>
[Column("F_NAME")]
public string F_Name { get; set; }
/// <summary>
/// 关键字
/// </summary>
/// <returns></returns>
[Column("F_KEYWORD")]
public string F_KeyWord { get; set; }
/// <summary>
/// 是否发布 0 不是 1 是
/// </summary>
/// <returns></returns>
[Column("F_ISPUBLISH")]
public int? F_IsPublish { get; set; }
/// <summary>
/// 关联文件夹ID 0顶层文件夹
/// </summary>
/// <returns></returns>
[Column("F_FOLDER")]
public string F_Folder { get; set; }
/// <summary>
/// 是否删除标记
/// </summary>
/// <returns></returns>
[Column("F_DELETEMARK")]
public int? F_DeleteMark { get; set; }
#endregion

#region 扩展操作
/// <summary>
/// 新增调用
/// </summary>
public void Create()
{
this.F_Id = Guid.NewGuid().ToString();
this.F_DeleteMark = 0;
this.F_IsPublish = 0;
}
/// <summary>
/// 编辑调用
/// </summary>
/// <param name="keyValue"></param>
public void Modify(string keyValue)
{
this.F_Id = keyValue;
}
#endregion

#region 扩展字段
/// <summary>
/// 文件版本号
/// </summary>
[NotMapped]
public string F_Ver { get; set; }
/// <summary>
/// 文件大小
/// </summary>
[NotMapped]
public int F_FileSize { get; set; }
/// <summary>
/// 文件类型
/// </summary>
[NotMapped]
public string F_FileType { get; set; }
/// <summary>
/// 原始文件对应ID
/// </summary>
[NotMapped]
public string F_FileId { get; set; }
/// <summary>
/// 预览文件ID
/// </summary>
[NotMapped]
public string F_PFiled { get; set; }
/// <summary>
/// 权限操作类型
/// </summary>
[NotMapped]
public string F_AuthType { get; set; }

/// <summary>
/// 类型
/// </summary>
[NotMapped]
public string Type { get; set; }
#endregion
}
}

+ 211
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileInfo/FileInfoBLL.cs Ver ficheiro

@@ -0,0 +1,211 @@
using Learun.Util;
using System;
using System.Collections.Generic;

namespace Learun.Application.Base.Files
{
/// <summary>
/// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架
/// Copyright (c) 2013-2018 上海力软信息技术有限公司
/// 创 建:超级管理员
/// 日 期:2019-11-29 14:04
/// 描 述:文件管理
/// </summary>
public class FileInfoBLL: FileInfoIBLL
{
private FileInfoService fileInfoService = new FileInfoService();

#region 获取数据

/// <summary>
/// 获取表实体数据
/// </summary>
/// <param name="keyValue">主键</param>
/// <returns></returns>
public FileBInfoEntity GetEntity(string keyValue)
{
try
{
return fileInfoService.GetEntity(keyValue);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowBusinessException(ex);
}
}
}

/// <summary>
/// 获取文件列表实体
/// </summary>
/// <param name="keyValue"></param>
/// <returns></returns>
public FilelistEntity GetListEntity(string keyValue)
{
try
{
return fileInfoService.GetListEntity(keyValue);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowBusinessException(ex);
}
}
}

/// <summary>
/// 获取文件列表实体
/// </summary>
/// <param name="fileInfoId"></param>
/// <returns></returns>
public FilelistEntity GetListEntityByInfoId(string fileInfoId)
{
try
{
return fileInfoService.GetListEntityByInfoId(fileInfoId);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}

/// <summary>
/// 文件审核列表
/// </summary>
/// <param name="strWfSql">查询语句</param>
/// <param name="pagination">分页参数</param>
/// <param name="keyword">查询关键字</param>
/// <param name="userId">当前登陆者用户</param>
/// <returns></returns>
public IEnumerable<WFFileModel> GetWfPageList(string strWfSql, Pagination pagination, string keyword,string userId)
{
return fileInfoService.GetWfPageList(strWfSql, pagination, keyword, userId);
}

/// <summary>
/// 获取正式发布的文件
/// </summary>
/// <param name="keyword">查询关键字</param>
/// <param name="folderId">文件夹id</param>
/// <returns></returns>
public IEnumerable<FileBInfoEntity> GetAllPublishPageList(string keyword, string folderId)
{
return fileInfoService.GetAllPublishPageList(keyword, folderId);
}

/// <summary>
/// 获取正式发布的文件
/// </summary>
/// <param name="keyword">查询关键字</param>
/// <param name="folderId">文件夹id</param>
/// <returns></returns>
public IEnumerable<FileBInfoEntity> GetPublishList(string keyword, string folderId) {
return fileInfoService.GetPublishList(keyword, folderId);
}


/// <summary>
/// 获取文件的历史信息
/// </summary>
/// <param name="fileInfoId">主键</param>
/// <returns></returns>
public IEnumerable<FileBInfoEntity> GetHistoryList(string fileInfoId) {
return fileInfoService.GetHistoryList(fileInfoId);
}


/// <summary>
/// 获取正式发布的文件
/// </summary>
/// <param name="keyword">查询关键字</param>
/// <returns></returns>
public IEnumerable<FileBInfoEntity> GetDeleteList(string keyword) {
return fileInfoService.GetDeleteList(keyword);
}
#endregion

#region 提交数据
/// <summary>
/// 保存数据
/// </summary>
/// <param name="keyValue">文件列表主键</param>
/// <param name="fileBInfoEntity">文件主信息</param>
/// <param name="filelistEntity">文件列表信息</param>
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);
}
}


}


/// <summary>
/// 更新文件发布状态
/// </summary>
/// <param name="processId">流程实例主键</param>
public void UpdateEntity(string processId)
{
fileInfoService.UpdateEntity(processId);
}


/// <summary>
/// 虚拟删除文件
/// </summary>
/// <param name="keyValue">主键</param>
public void VDeleteEntity(string keyValue)
{
fileInfoService.VDeleteEntity(keyValue);
}
/// <summary>
/// 还原虚拟删除文件
/// </summary>
/// <param name="keyValue">主键</param>
public void RecoveryEntity(string keyValue) {
fileInfoService.RecoveryEntity(keyValue);
}
/// <summary>
/// 彻底删除
/// </summary>
/// <param name="keyValue"></param>
public void DeleteEntity(string keyValue)
{
fileInfoService.DeleteEntity(keyValue);
}
#endregion
}
}

+ 105
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileInfo/FileInfoIBLL.cs Ver ficheiro

@@ -0,0 +1,105 @@
using Learun.Util;
using System.Collections.Generic;

namespace Learun.Application.Base.Files
{
/// <summary>
/// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架
/// Copyright (c) 2013-2018 上海力软信息技术有限公司
/// 创 建:超级管理员
/// 日 期:2019-11-29 14:04
/// 描 述:文件管理
/// </summary>
public interface FileInfoIBLL
{
#region 获取数据

/// <summary>
/// 获取表实体数据
/// </summary>
/// <param name="keyValue">主键</param>
/// <returns></returns>
FileBInfoEntity GetEntity(string keyValue);
/// <summary>
/// 获取文件列表实体
/// </summary>
/// <param name="keyValue"></param>
/// <returns></returns>
FilelistEntity GetListEntity(string keyValue);

/// <summary>
/// 获取文件列表实体
/// </summary>
/// <param name="fileInfoId"></param>
/// <returns></returns>
FilelistEntity GetListEntityByInfoId(string fileInfoId);
/// <summary>
/// 文件审核列表
/// </summary>
/// <param name="strWfSql">查询语句</param>
/// <param name="pagination">分页参数</param>
/// <param name="keyword">查询关键字</param>
/// <param name="userId">当前用户Id</param>
/// <returns></returns>
IEnumerable<WFFileModel> GetWfPageList(string strWfSql, Pagination pagination, string keyword,string userId);
/// <summary>
/// 获取正式发布的文件
/// </summary>
/// <param name="keyword">查询关键字</param>
/// <param name="folderId">文件夹id</param>
/// <returns></returns>
IEnumerable<FileBInfoEntity> GetAllPublishPageList(string keyword, string folderId);
/// <summary>
/// 获取正式发布的文件
/// </summary>
/// <param name="keyword">查询关键字</param>
/// <param name="folderId">文件夹id</param>
/// <returns></returns>
IEnumerable<FileBInfoEntity> GetPublishList(string keyword, string folderId);
/// <summary>
/// 获取文件的历史信息
/// </summary>
/// <param name="fileInfoId">主键</param>
/// <returns></returns>
IEnumerable<FileBInfoEntity> GetHistoryList(string fileInfoId);

/// <summary>
/// 获取正式发布的文件
/// </summary>
/// <param name="keyword">查询关键字</param>
/// <returns></returns>
IEnumerable<FileBInfoEntity> GetDeleteList(string keyword);
#endregion

#region 提交数据
/// <summary>
/// 保存数据
/// </summary>
/// <param name="keyValue">文件列表主键</param>
/// <param name="fileBInfoEntity">文件主信息</param>
/// <param name="filelistEntity">文件列表信息</param>
void SaveEntity(string keyValue, FileBInfoEntity fileBInfoEntity, FilelistEntity filelistEntity);
/// <summary>
/// 更新文件发布状态
/// </summary>
/// <param name="processId">流程实例主键</param>
void UpdateEntity(string processId);

/// <summary>
/// 虚拟删除文件
/// </summary>
/// <param name="keyValue">主键</param>
void VDeleteEntity(string keyValue);
/// <summary>
/// 还原虚拟删除文件
/// </summary>
/// <param name="keyValue">主键</param>
void RecoveryEntity(string keyValue);
/// <summary>
/// 彻底删除
/// </summary>
/// <param name="keyValue"></param>
void DeleteEntity(string keyValue);
#endregion
}
}

+ 683
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileInfo/FileInfoService.cs Ver ficheiro

@@ -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
{
/// <summary>
/// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架
/// Copyright (c) 2013-2018 上海力软信息技术有限公司
/// 创 建:超级管理员
/// 日 期:2019-11-28 09:23
/// 描 述:文件管理
/// </summary>
public class FileInfoService: RepositoryFactory
{
#region 获取数据

/// <summary>
/// 获取表实体数据
/// </summary>
/// <param name="keyValue">主键</param>
/// <returns></returns>
public FileBInfoEntity GetEntity(string keyValue)
{
try
{
return this.BaseRepository().FindEntity<FileBInfoEntity>(keyValue);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}
/// <summary>
/// 获取文件列表实体
/// </summary>
/// <param name="keyValue"></param>
/// <returns></returns>
public FilelistEntity GetListEntity(string keyValue)
{
try
{
return this.BaseRepository().FindEntity<FilelistEntity>(keyValue);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}
/// <summary>
/// 获取文件列表实体
/// </summary>
/// <param name="fileInfoId"></param>
/// <returns></returns>
public FilelistEntity GetListEntityByInfoId(string fileInfoId)
{
try
{
return this.BaseRepository().FindEntity<FilelistEntity>(" 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);
}
}
}


/// <summary>
/// 文件审核列表
/// </summary>
/// <param name="strWfSql">查询语句</param>
/// <param name="pagination">分页参数</param>
/// <param name="keyword">查询关键字</param>
/// <param name="userId">当前用户Id</param>
/// <returns></returns>
public IEnumerable<WFFileModel> 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<WFFileModel>(strSql.ToString(),new { keyword, userId }, pagination);
}

/// <summary>
/// 获取正式发布的文件
/// </summary>
/// <param name="folderId">分页参数</param>
/// <param name="keyword">查询关键字</param>
/// <returns></returns>
public IEnumerable<FileBInfoEntity> GetAllPublishPageList(string keyword, string folderId)
{
List<FileBInfoEntity> list = new List<FileBInfoEntity>();

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<FileBInfoEntity>(strSql.ToString(), new { keyword, folderId }));

return list;
}



/// <summary>
/// 获取页面显示列表数据
/// </summary>
/// <param name="keyWord">关键字</param>
/// <param name="folderId">父级id</param>
/// <returns></returns>
public IEnumerable<FileBInfoEntity> 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<FileBInfoEntity>(strSql.ToString(), new { keyWord, folderId });
}



/// <summary>
/// 获取文件夹带权限的
/// </summary>
/// <param name="keyWord"></param>
/// <param name="folderId"></param>
/// <param name="authList"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public IEnumerable<FileBInfoEntity> GetFolderList2(string keyWord, string folderId, List<FileAuthEntity> 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<FileBInfoEntity>(strSql.ToString(), new { keyWord, folderId });

if (userInfo.isSystem)
{
return list;
}
else {
List<FileBInfoEntity> list2 = new List<FileBInfoEntity>();
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;
}
}
/// <summary>
/// 获取正式发布的文件
/// </summary>
/// <param name="keyword">查询关键字</param>
/// <param name="folderId">文件夹id</param>
/// <returns></returns>
public IEnumerable<FileBInfoEntity> GetPublishList(string keyword, string folderId)
{
UserInfo userInfo = LoginUserInfo.Get();
List<FileAuthEntity> authList = new List<FileAuthEntity>();
List<FileBInfoEntity> list = new List<FileBInfoEntity>();
if (!userInfo.isSystem)
{
string roleIds = userInfo.roleIds;
if (string.IsNullOrEmpty(roleIds))
{
return new List<FileBInfoEntity>();
}
else
{
roleIds = "('" + roleIds.Replace(",", "','") + "')";
authList = (List<FileAuthEntity>)this.BaseRepository().FindList<FileAuthEntity>(" 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<FileBInfoEntity>(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;
}

/// <summary>
/// 获取文件的历史信息
/// </summary>
/// <param name="fileInfoId">主键</param>
/// <returns></returns>
public IEnumerable<FileBInfoEntity> GetHistoryList(string fileInfoId)
{
List<FileBInfoEntity> list = new List<FileBInfoEntity>();


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<FileBInfoEntity>(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<FileAuthEntity>)this.BaseRepository().FindList<FileAuthEntity>(" select * from lr_base_fileauth where F_ObjId in " + roleIds + " AND F_Time >= @ftime ORDER BY F_Level ", new { ftime = DateTime.Now });


List<FileBInfoEntity> list2 = new List<FileBInfoEntity>();

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;
}


/// <summary>
/// 获取正式发布的文件
/// </summary>
/// <param name="keyword">查询关键字</param>
/// <returns></returns>
public IEnumerable<FileBInfoEntity> GetDeleteList(string keyword)
{
List<FileBInfoEntity> list = new List<FileBInfoEntity>();

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<FileBInfoEntity>(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<FileAuthEntity>)this.BaseRepository().FindList<FileAuthEntity>(" select * from lr_base_fileauth where F_ObjId in " + postIds + " AND F_Time <= ftime ", new { ftime = DateTime.Now });


List<FileBInfoEntity> list2 = new List<FileBInfoEntity>();

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 提交数据
/// <summary>
/// 保存数据
/// </summary>
/// <param name="keyValue">文件列表主键</param>
/// <param name="fileBInfoEntity">文件主信息</param>
/// <param name="filelistEntity">文件列表信息</param>
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);
}
}


}

/// <summary>
/// 更新文件发布状态
/// </summary>
/// <param name="processId"></param>
public void UpdateEntity(string processId) {
var fileList = this.BaseRepository().FindEntity<FilelistEntity>(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<FileAuthEntity>(" 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<FileAuthEntity>(" 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);
}
}
}

/// <summary>
/// 虚拟删除文件
/// </summary>
/// <param name="keyValue">主键</param>
public void VDeleteEntity(string keyValue) {
FileBInfoEntity entity = new FileBInfoEntity
{
F_Id = keyValue,
F_DeleteMark = 1
};
this.BaseRepository().Update(entity);
}
/// <summary>
/// 还原虚拟删除文件
/// </summary>
/// <param name="keyValue">主键</param>
public void RecoveryEntity(string keyValue)
{
FileBInfoEntity entity = new FileBInfoEntity
{
F_Id = keyValue,
F_DeleteMark = 0
};
this.BaseRepository().Update(entity);
}
/// <summary>
/// 彻底删除
/// </summary>
/// <param name="keyValue"></param>
public void DeleteEntity(string keyValue) {
var list = this.BaseRepository().FindList<FilelistEntity>(" select * from lr_base_filelist where F_FileInfoId = @fileInfoId", new { fileInfoId= keyValue });
var db = this.BaseRepository().BeginTrans();
try
{
db.Delete<FileBInfoEntity>(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
}
}

+ 119
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileInfo/FilelistEntity.cs Ver ficheiro

@@ -0,0 +1,119 @@
using Learun.Util;
using System;
using System.ComponentModel.DataAnnotations.Schema;

namespace Learun.Application.Base.Files
{
/// <summary>
/// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架
/// Copyright (c) 2013-2018 上海力软信息技术有限公司
/// 创 建:超级管理员
/// 日 期:2019-11-29 14:04
/// 描 述:文件管理
/// </summary>
public class FilelistEntity
{
#region 实体成员
/// <summary>
/// 主键
/// </summary>
/// <returns></returns>
[Column("F_ID")]
public string F_Id { get; set; }
/// <summary>
/// 文件名称
/// </summary>
/// <returns></returns>
[Column("F_NAME")]
public string F_Name { get; set; }
/// <summary>
/// 关键字
/// </summary>
/// <returns></returns>
[Column("F_KEYWORD")]
public string F_KeyWord { get; set; }
/// <summary>
/// 文件信息ID
/// </summary>
/// <returns></returns>
[Column("F_FILEINFOID")]
public string F_FileInfoId { get; set; }
/// <summary>
/// 关联文件夹ID 0顶层文件夹
/// </summary>
/// <returns></returns>
[Column("F_FOLDER")]
public string F_Folder { get; set; }
/// <summary>
/// 原始文件对应ID
/// </summary>
/// <returns></returns>
[Column("F_FILEID")]
public string F_FileId { get; set; }
/// <summary>
/// 预览文件ID
/// </summary>
/// <returns></returns>
[Column("F_PFILED")]
public string F_PFiled { get; set; }
/// <summary>
/// 版本号
/// </summary>
/// <returns></returns>
[Column("F_VER")]
public string F_Ver { get; set; }
/// <summary>
/// 是否发布 0 不是 1 是
/// </summary>
/// <returns></returns>
[Column("F_ISPUBLISH")]
public int? F_IsPublish { get; set; }
/// <summary>
/// 发布时间
/// </summary>
/// <returns></returns>
[Column("F_PUBLISHTIME")]
public DateTime? F_PublishTime { get; set; }
/// <summary>
/// 创建时间
/// </summary>
/// <returns></returns>
[Column("F_CREATETIME")]
public DateTime? F_CreateTime { get; set; }
/// <summary>
/// 创建人Id
/// </summary>
/// <returns></returns>
[Column("F_CREATEUSERID")]
public string F_CreateUserId { get; set; }
/// <summary>
/// 创建人名称
/// </summary>
/// <returns></returns>
[Column("F_CREATEUSERNAME")]
public string F_CreateUserName { get; set; }
#endregion

#region 扩展操作
/// <summary>
/// 新增调用
/// </summary>
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;
}
/// <summary>
/// 编辑调用
/// </summary>
/// <param name="keyValue"></param>
public void Modify(string keyValue)
{
this.F_Id = keyValue;
}
#endregion
}
}

+ 112
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/FileInfo/WFFileModel.cs Ver ficheiro

@@ -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
{
/// <summary>
///
/// </summary>
public class WFFileModel
{
/// <summary>
/// 时间
/// </summary>
public DateTime F_CreateDate { get; set; }
/// <summary>
/// 流程实例主键
/// </summary>
public string F_Id { get; set; }
/// <summary>
/// 流程模板主键
/// </summary>
public string F_SchemeId{ get; set; }
/// <summary>
/// 流程模板编码
/// </summary>
public string F_SchemeCode{ get; set; }
/// <summary>
/// 流程模板名称
/// </summary>
public string F_SchemeName{ get; set; }
/// <summary>
/// 自定义标题
/// </summary>
public string F_Title{ get; set; }
/// <summary>
/// 重要等级
/// </summary>
public string F_Level{ get; set; }
/// <summary>
///
/// </summary>
public string F_EnabledMark{ get; set; }
/// <summary>
///
/// </summary>
public string F_IsAgain{ get; set; }
/// <summary>
///
/// </summary>
public string F_IsFinished{ get; set; }
/// <summary>
///
/// </summary>
public string F_IsChild{ get; set; }
/// <summary>
///
/// </summary>
public string F_ParentTaskId{ get; set; }
/// <summary>
///
/// </summary>
public string F_ParentProcessId{ get; set; }
/// <summary>
///
/// </summary>
public string F_CreateUserId{ get; set; }
/// <summary>
///
/// </summary>
public string F_CreateUserName{ get; set; }
/// <summary>
///
/// </summary>
public string F_IsStart{ get; set; }


/// <summary>
/// 任务名称
/// </summary>
public string F_TaskName { get; set; }
/// <summary>
/// 任务主键
/// </summary>
public string F_TaskId { get; set; }
/// <summary>
/// 任务类型
/// </summary>
public int? F_TaskType { get; set; }

/// <summary>
/// 是否被催办 1 被催办了
/// </summary>
/// <returns></returns>
public int? F_IsUrge { get; set; }

/// <summary>
/// 文件名称
/// </summary>
public string FileName { get; set; }
/// <summary>
/// 文件编码
/// </summary>
public string FileCode { get; set; }
/// <summary>
/// 文件版本
/// </summary>
public string FileVer { get; set; }
}
}

+ 197
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/Folder/FolderBLL.cs Ver ficheiro

@@ -0,0 +1,197 @@
using Learun.Util;
using System;
using System.Collections.Generic;

namespace Learun.Application.Base.Files
{
/// <summary>
/// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架
/// Copyright (c) 2013-2018 上海力软信息技术有限公司
/// 创 建:超级管理员
/// 日 期:2019-11-28 09:23
/// 描 述:文件夹管理
/// </summary>
public class FolderBLL : FolderIBLL
{
private FolderService folderService = new FolderService();

#region 获取数据
/// <summary>
/// 获取页面显示列表数据
/// </summary>
/// <param name="keyWord">关键字</param>
/// <param name="pId">父级id</param>
/// <returns></returns>
public IEnumerable<FolderEntity> GetList(string keyWord, string pId)
{
try
{
return folderService.GetList(keyWord, pId);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowBusinessException(ex);
}
}
}
/// <summary>
/// 获取树形数据
/// </summary>
/// <returns></returns>
public List<TreeModel> GetTree() {
var list = (List<FolderEntity>)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<TreeModel>();
}
else
{
roleIds = "('" + roleIds.Replace(",", "','") + "')";
var authList = (List<FileAuthEntity>)folderService.BaseRepository().FindList<FileAuthEntity>(" 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<FolderEntity> list2 = new List<FolderEntity>();
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<TreeModel> treeList = new List<TreeModel>();
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();
}

/// <summary>
/// 获取lr_base_folder表实体数据
/// </summary>
/// <param name="keyValue">主键</param>
/// <returns></returns>
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 提交数据

/// <summary>
/// 删除实体数据
/// </summary>
/// <param name="keyValue">主键</param>
public bool DeleteEntity(string keyValue)
{
try
{
return folderService.DeleteEntity(keyValue);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowBusinessException(ex);
}
}
}

/// <summary>
/// 保存实体数据(新增、修改)
/// </summary>
/// <param name="keyValue">主键</param>
/// <param name="entity">实体</param>
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
}
}

+ 66
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/Folder/FolderEntity.cs Ver ficheiro

@@ -0,0 +1,66 @@
using System;
using System.ComponentModel.DataAnnotations.Schema;

namespace Learun.Application.Base.Files
{
/// <summary>
/// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架
/// Copyright (c) 2013-2018 上海力软信息技术有限公司
/// 创 建:超级管理员
/// 日 期:2019-11-28 09:23
/// 描 述:文件夹管理
/// </summary>
public class FolderEntity
{
#region 实体成员
/// <summary>
/// 主键
/// </summary>
[Column("F_ID")]
public string F_Id { get; set; }
/// <summary>
/// 父级ID
/// </summary>
[Column("F_PID")]
public string F_PId { get; set; }
/// <summary>
/// 文件夹名称
/// </summary>
[Column("F_NAME")]
public string F_Name { get; set; }
/// <summary>
/// 最后更新时间
/// </summary>
[Column("F_TIME")]
public DateTime? F_Time { get; set; }
#endregion

#region 扩展操作
/// <summary>
/// 新增调用
/// </summary>
public void Create()
{
this.F_Id = Guid.NewGuid().ToString();
this.F_Time = DateTime.Now;
}
/// <summary>
/// 编辑调用
/// </summary>
/// <param name="keyValue"></param>
public void Modify(string keyValue)
{
this.F_Id = keyValue;
this.F_Time = DateTime.Now;
}
#endregion
#region 扩展字段
/// <summary>
///
/// </summary>
[NotMapped]
public string F_AuthType { get; set; }

#endregion
}
}

+ 53
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/Folder/FolderIBLL.cs Ver ficheiro

@@ -0,0 +1,53 @@
using Learun.Util;
using System.Collections.Generic;

namespace Learun.Application.Base.Files
{
/// <summary>
/// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架
/// Copyright (c) 2013-2018 上海力软信息技术有限公司
/// 创 建:超级管理员
/// 日 期:2019-11-28 09:23
/// 描 述:文件夹管理
/// </summary>
public interface FolderIBLL
{
#region 获取数据
/// <summary>
/// 获取页面显示列表数据
/// </summary>
/// <param name="keyWord">关键字</param>
/// <param name="pId">父级id</param>
/// <returns></returns>
IEnumerable<FolderEntity> GetList(string keyWord, string pId);

/// <summary>
/// 获取lr_base_folder表实体数据
/// </summary>
/// <param name="keyValue">主键</param>
/// <returns></returns>
FolderEntity GetEntity(string keyValue);
/// <summary>
/// 获取树形数据
/// </summary>
/// <returns></returns>
List<TreeModel> GetTree();
#endregion

#region 提交数据

/// <summary>
/// 删除实体数据
/// </summary>
/// <param name="keyValue">主键</param>
bool DeleteEntity(string keyValue);

/// <summary>
/// 保存实体数据(新增、修改)
/// </summary>
/// <param name="keyValue">主键</param>
/// <param name="entity">实体</param>
void SaveEntity(string keyValue, FolderEntity entity);
#endregion
}
}

+ 357
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Files/Folder/FolderService.cs Ver ficheiro

@@ -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
{
/// <summary>
/// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架
/// Copyright (c) 2013-2018 上海力软信息技术有限公司
/// 创 建:超级管理员
/// 日 期:2019-11-28 09:23
/// 描 述:文件夹管理
/// </summary>
public class FolderService : RepositoryFactory
{
#region 获取数据
/// <summary>
/// 获取页面显示列表数据
/// </summary>
/// <param name="keyWord">关键字</param>
/// <param name="pId">父级id</param>
/// <returns></returns>
public IEnumerable<FolderEntity> 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<FolderEntity>(strSql.ToString(), new { keyWord, pId });
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}

/// <summary>
/// 获取lr_base_folder表实体数据
/// </summary>
/// <param name="keyValue">主键</param>
/// <returns></returns>
public FolderEntity GetEntity(string keyValue)
{
try
{
return this.BaseRepository().FindEntity<FolderEntity>(keyValue);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}

#endregion

#region 提交数据

/// <summary>
/// 删除实体数据
/// </summary>
/// <param name="keyValue"></param>
/// <returns></returns>
public bool DeleteEntity(string keyValue)
{
var fileList = (List<FileBInfoEntity>)this.BaseRepository().FindList<FileBInfoEntity>(" 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<FolderEntity>)this.BaseRepository().FindList<FolderEntity>(" select * from lr_base_folder where F_PId = @folderId ", new { folderId = keyValue });
if (fileList.Count > 0)
{
return false;
}

var authList = this.BaseRepository().FindList<FileAuthEntity>(" 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<FolderEntity>(t => t.F_Id == keyValue);
db.Commit();
return true;
}
catch (Exception ex)
{
db.Rollback();
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}

/// <summary>
/// 保存实体数据(新增、修改)
/// </summary>
/// <param name="keyValue">主键</param>
/// <param name="entity">实体</param>
public void SaveEntity(string keyValue, FolderEntity entity)
{
var db = this.BaseRepository().BeginTrans();
try
{
if (!string.IsNullOrEmpty(keyValue))
{
entity.Modify(keyValue);

var entityTmp = db.FindEntity<FolderEntity>("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<FileAuthEntity>(" 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<FileAuthEntity>(" 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<FileAuthEntity>(" 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<FileAuthEntity>(" 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);
}
}
}


/// <summary>
/// 保存上级目录权限设置
/// </summary>
/// <param name="folderId"></param>
/// <param name="fromId"></param>
/// <param name="fromEntity"></param>
/// <param name="deep"></param>
/// <param name="db"></param>
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<FolderEntity>(folderId);
SaveSJEntity(folderEntity.F_PId, fromId, fromEntity, deep + 1, db);
}
}

/// <summary>
/// 保存下级目录权限设置
/// </summary>
/// <param name="folderId"></param>
/// <param name="fromId"></param>
/// <param name="fromEntity"></param>
/// <param name="deep"></param>
/// <param name="db"></param>
private void SaveXJEntity(string folderId, string fromId, FileAuthEntity fromEntity, int deep, IRepository db)
{
// 获取文件
var fileList = db.FindList<FileBInfoEntity>(" 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<FolderEntity>(" 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
}
}

+ 14
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/Learun.Application.Base.csproj Ver ficheiro

@@ -95,6 +95,20 @@
<Compile Include="CodeSchemaModule\CodeSchemaIBLL.cs" />
<Compile Include="CodeSchemaModule\CodeSchemaService.cs" />
<Compile Include="CodeSchemaModule\LR_Base_CodeSchemaEntity.cs" />
<Compile Include="Files\FileAuth\FileAuthBLL.cs" />
<Compile Include="Files\FileAuth\FileAuthEntity.cs" />
<Compile Include="Files\FileAuth\FileAuthIBLL.cs" />
<Compile Include="Files\FileAuth\FileAuthService.cs" />
<Compile Include="Files\FileInfo\FileBInfoEntity.cs" />
<Compile Include="Files\FileInfo\FileInfoBLL.cs" />
<Compile Include="Files\FileInfo\FileInfoIBLL.cs" />
<Compile Include="Files\FileInfo\FileInfoService.cs" />
<Compile Include="Files\FileInfo\FilelistEntity.cs" />
<Compile Include="Files\FileInfo\WFFileModel.cs" />
<Compile Include="Files\Folder\FolderBLL.cs" />
<Compile Include="Files\Folder\FolderEntity.cs" />
<Compile Include="Files\Folder\FolderIBLL.cs" />
<Compile Include="Files\Folder\FolderService.cs" />
<Compile Include="SystemModule\CodeRule\CodeRuleBLL.cs" />
<Compile Include="SystemModule\CodeRule\CodeRuleEntity.cs" />
<Compile Include="SystemModule\CodeRule\CodeRuleFormatModel.cs" />


+ 21
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LR_Files/FileAuthMap.cs Ver ficheiro

@@ -0,0 +1,21 @@
using Learun.Application.Base.Files;
using System.Data.Entity.ModelConfiguration;

namespace Learun.Application.Mapping.LR_Files
{
public class FileAuthMap : EntityTypeConfiguration<FileAuthEntity>
{
public FileAuthMap()
{
#region 表、主键
//表
this.ToTable("LR_BASE_FILEAUTH");
//主键
this.HasKey(t => t.F_Id);
#endregion

#region 配置关系
#endregion
}
}
}

+ 21
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LR_Files/FileInfoMap.cs Ver ficheiro

@@ -0,0 +1,21 @@
using Learun.Application.Base.Files;
using System.Data.Entity.ModelConfiguration;

namespace Learun.Application.Mapping.LR_Files
{
public class FileBInfoMap : EntityTypeConfiguration<FileBInfoEntity>
{
public FileBInfoMap()
{
#region 表、主键
//表
this.ToTable("LR_BASE_FILEINFO");
//主键
this.HasKey(t => t.F_Id);
#endregion

#region 配置关系
#endregion
}
}
}

+ 21
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LR_Files/FilelistMap.cs Ver ficheiro

@@ -0,0 +1,21 @@
using Learun.Application.Base.Files;
using System.Data.Entity.ModelConfiguration;

namespace Learun.Application.Mapping.LR_Files
{
public class FilelistMap : EntityTypeConfiguration<FilelistEntity>
{
public FilelistMap()
{
#region 表、主键
//表
this.ToTable("LR_BASE_FILELIST");
//主键
this.HasKey(t => t.F_Id);
#endregion

#region 配置关系
#endregion
}
}
}

+ 28
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LR_Files/FolderMap.cs Ver ficheiro

@@ -0,0 +1,28 @@
using Learun.Application.Base.Files;
using System.Data.Entity.ModelConfiguration;

namespace Learun.Application.Mapping.LR_Files
{
/// <summary>
/// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架
/// Copyright (c) 2013-2018 上海力软信息技术有限公司
/// 创 建:超级管理员
/// 日 期:2019-11-28 09:28
/// 描 述:文件夹管理
/// </summary>
public class FolderMap : EntityTypeConfiguration<FolderEntity>
{
public FolderMap()
{
#region 表、主键
//表
this.ToTable("LR_BASE_FOLDER");
//主键
this.HasKey(t => t.F_Id);
#endregion

#region 配置关系
#endregion
}
}
}

+ 31
- 0
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 Ver ficheiro

@@ -0,0 +1,31 @@
using Learun.Application.Base.Files;
using System.Data.Entity.ModelConfiguration;

namespace Learun.Application.Mapping.LR_Files
{
/// <summary>
/// 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架
/// Copyright (c) 2013-2018 上海力软信息技术有限公司
/// 创 建:超级管理员
/// 日 期:2019-11-28 09:28
/// 描 述:文件夹管理
/// </summary>
public class FolderMap : EntityTypeConfiguration<FolderEntity>
{
public FolderMap()
{
#region 表、主键
//表
this.ToTable("LR_BASE_FOLDER");
//主键
this.HasKey(t => t.F_Id);
#endregion

#region 配置关系
#endregion
}
}
}




+ 4
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj Ver ficheiro

@@ -123,6 +123,10 @@
<Compile Include="LR_Extention\TaskScheduling\TSProcessMap.cs" />
<Compile Include="LR_Extention\TaskScheduling\TSSchemeInfoMap.cs" />
<Compile Include="LR_Extention\TaskScheduling\TSSchemeMap.cs" />
<Compile Include="LR_Files\FileAuthMap.cs" />
<Compile Include="LR_Files\FileInfoMap.cs" />
<Compile Include="LR_Files\FilelistMap.cs" />
<Compile Include="LR_Files\FolderMap.cs" />
<Compile Include="LR_Form\FormRelationMap.cs" />
<Compile Include="LR_Form\FormSchemeInfoMap.cs" />
<Compile Include="LR_Form\FormSchemeMap.cs" />


+ 1
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Learun.Application.WorkFlow.csproj Ver ficheiro

@@ -114,6 +114,7 @@
<Compile Include="NodeMethod\INodeMethod.cs" />
<Compile Include="NodeMethod\NodeMethod.cs" />
<Compile Include="NodeMethod\WfMethodParameter.cs" />
<Compile Include="NodeMethod\WF\WFFileRelease.cs" />
<Compile Include="Node\WfForm.cs" />
<Compile Include="Node\WfTransportType.cs" />
<Compile Include="Process\NWFProcessBLL.cs" />


+ 21
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/NodeMethod/WF/WFFileRelease.cs Ver ficheiro

@@ -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();

/// <summary>
/// 流程执行
/// </summary>
/// <param name="parameter"></param>
public void Execute(WfMethodParameter parameter) {
fileInfoIBLL.UpdateEntity(parameter.processId);
}
}
}

Carregando…
Cancelar
Guardar