From 761f143720b1a709f3d8d257e13341e11b04472d Mon Sep 17 00:00:00 2001 From: zhangli <1109134334@qq.com> Date: Fri, 25 Feb 2022 14:10:34 +0800 Subject: [PATCH 1/6] --- .../Areas/LR_Desktop/Views/EnrollTemplate/Form.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollTemplate/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollTemplate/Form.js index 2ef9c8dd6..bd1f1ef53 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollTemplate/Form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollTemplate/Form.js @@ -44,6 +44,7 @@ var bootstrap = function ($, learun) { } var strEntity = $('body').lrGetFormData(); strEntity.Type = type; + var postData = { strEntity: JSON.stringify(strEntity) }; From a9639a8166ee1c776a8456e58dcadf7f43cd983f Mon Sep 17 00:00:00 2001 From: zhangli <1109134334@qq.com> Date: Sat, 26 Feb 2022 09:40:37 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E6=8B=9B=E7=94=9F=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/EnrollDataController.cs | 147 +++++++++++++++++- .../LR_Desktop/Views/EnrollData/Index.cshtml | 16 +- .../LR_Desktop/Views/EnrollData/Index.js | 45 +++++- .../Views/EnrollData/IndexPersonnel.cshtml | 38 +++++ .../Views/EnrollData/IndexPersonnel.js | 128 +++++++++++++++ .../Learun.Application.Web.csproj | 2 + .../LR_Desktop/EnrollData/EnrollDataEntity.cs | 3 + .../EnrollData/EnrollDataService.cs | 15 +- 8 files changed, 383 insertions(+), 11 deletions(-) create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollData/IndexPersonnel.cshtml create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollData/IndexPersonnel.js diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/EnrollDataController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/EnrollDataController.cs index 3b204427f..26d66566e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/EnrollDataController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/EnrollDataController.cs @@ -3,6 +3,8 @@ using System.Data; using Learun.Application.TwoDevelopment.LR_Desktop; using System.Web.Mvc; using System.Collections.Generic; +using Learun.Application.OA.File.FilePreview; +using Learun.Application.Base.SystemModule; namespace Learun.Application.Web.Areas.LR_Desktop.Controllers { @@ -16,6 +18,8 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers public class EnrollDataController : MvcControllerBase { private EnrollDataIBLL enrollDataIBLL = new EnrollDataBLL(); + private FilePreviewIBLL filePreviewIBLL = new FilePreviewBLL(); + private AnnexesFileIBLL annexesFileIBLL = new AnnexesFileBLL(); #region 视图功能 @@ -26,7 +30,7 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers [HttpGet] public ActionResult Index() { - return View(); + return View(); } /// /// 表单页 @@ -35,8 +39,18 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers [HttpGet] public ActionResult Form() { - return View(); + return View(); } + /// + /// + /// + /// + [HttpGet] + public ActionResult IndexPersonnel() + { + return View(); + } + #endregion #region 获取数据 @@ -71,8 +85,9 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers [AjaxOnly] public ActionResult GetFormData(string keyValue) { - var EnrollDataData = enrollDataIBLL.GetEnrollDataEntity( keyValue ); - var jsonData = new { + var EnrollDataData = enrollDataIBLL.GetEnrollDataEntity(keyValue); + var jsonData = new + { EnrollData = EnrollDataData, }; return Success(jsonData); @@ -105,7 +120,7 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers public ActionResult SaveForm(string keyValue, string strEntity) { EnrollDataEntity entity = strEntity.ToObject(); - enrollDataIBLL.SaveEntity(keyValue,entity); + enrollDataIBLL.SaveEntity(keyValue, entity); if (string.IsNullOrEmpty(keyValue)) { } @@ -113,5 +128,127 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers } #endregion + #region MyRegion + + /// + /// 下载文件 + /// + /// 主键 + /// + [HttpPost] + public void DownloadFile(string folderid) + { + var data = annexesFileIBLL.GetEntityByFolderId(folderid); + string filename = Server.UrlDecode(data.F_FileName);//返回客户端文件名称 + string filepath = data.F_FilePath;//this.Server.MapPath(data.F_FilePath); + if (FileDownHelper.FileExists(filepath)) + { + FileDownHelper.DownLoadold(filepath, filename); + } + } + + /// + /// 文件预览 + /// + /// 文件ID + /// + public void PreviewFile(string folderid) + { + var data = annexesFileIBLL.GetEntityByFolderId(folderid); + if (data == null) + { + return; + } + string filename = Server.UrlDecode(data.F_FileName);//客户端保存的文件名 + string filepath = data.F_FilePath;// DirFileHelper.GetAbsolutePath(data.F_FilePath);//路径 + if (data.F_FileType == "xlsx" || data.F_FileType == "xls") + { + filepath = filepath.Substring(0, filepath.LastIndexOf(".")) + ".pdf";//文件名 + if (!DirFileHelper.IsExistFile(filepath)) + { + filePreviewIBLL.GetExcelData(DirFileHelper.GetAbsolutePath(data.F_FilePath)); + } + } + if (data.F_FileType == "docx" || data.F_FileType == "doc") + { + filepath = filepath.Substring(0, filepath.LastIndexOf(".")) + ".pdf";//文件名 + if (!DirFileHelper.IsExistFile(filepath)) + { + filePreviewIBLL.GetWordData(DirFileHelper.GetAbsolutePath(data.F_FilePath)); + } + } + if (data.F_FileType == "ppt" || data.F_FileType == "pptx") + { + filepath = filepath.Substring(0, filepath.LastIndexOf(".")) + ".pdf";//文件名 + if (!DirFileHelper.IsExistFile(filepath)) + { + filePreviewIBLL.GetPptData(DirFileHelper.GetAbsolutePath(data.F_FilePath)); + } + } + //FileDownHelper.DownLoadold(filepath, filename); + + + + //FileStream files = new FileStream(filepath, FileMode.Open); + //byte[] fileByte = new byte[files.Length]; + //files.Read(fileByte, 0, fileByte.Length); + //files.Close(); + //System.IO.MemoryStream ms = new MemoryStream(fileByte, 0, fileByte.Length); + Response.ClearContent(); + switch (data.F_FileType) + { + case "jpg": + Response.ContentType = "image/jpeg"; + break; + case "gif": + Response.ContentType = "image/gif"; + break; + case "png": + Response.ContentType = "image/png"; + break; + case "bmp": + Response.ContentType = "application/x-bmp"; + break; + case "jpeg": + Response.ContentType = "image/jpeg"; + break; + case "doc": + Response.ContentType = "application/pdf"; + break; + case "docx": + Response.ContentType = "application/pdf"; + break; + case "ppt": + Response.ContentType = "application/x-ppt"; + break; + case "pptx": + Response.ContentType = "application/x-ppt"; + break; + case "xls": + Response.ContentType = "application/pdf"; + break; + case "xlsx": + Response.ContentType = "application/pdf"; + break; + case "pdf": + Response.ContentType = "application/pdf"; + break; + case "txt": + Response.ContentType = "text/plain"; + break; + case "csv": + Response.ContentType = ""; + break; + default: + Response.ContentType = "application/pdf"; + break; + } + Response.Charset = "GB2312"; + Response.WriteFile(filepath); + //Response.BinaryWrite(ms.ToArray()); + } + + #endregion + } } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollData/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollData/Index.cshtml index 242551b7e..77eaffc86 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollData/Index.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollData/Index.cshtml @@ -7,15 +7,27 @@
+
+ +
+
+  查询 +
+ diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollData/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollData/Index.js index 03a94dfd3..9c2bdf769 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollData/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollData/Index.js @@ -13,6 +13,12 @@ var bootstrap = function ($, learun) { 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(); @@ -63,21 +69,56 @@ var bootstrap = function ($, learun) { $('#lr_print').on('click', function () { $('#gridtable').jqprintTable(); }); + + //文件下载 + $('#lr-download').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('Id'); + var Path = $("#gridtable").jfGridValue("Path"); + if (keyValue) { + learun.download({ url: top.$.rootUrl + '/LR_Desktop/EnrollData/DownloadFile', param: { folderid: Path }, method: 'POST' }); + } else { + learun.alert.warning('请选择要下载的文件!'); + } + }); + //文件预览 + $('#lr-preview').on('click', function () { + var keyValue = $("#gridtable").jfGridValue("Id"); + var Path = $("#gridtable").jfGridValue("Path"); + if (keyValue) { + learun.layerForm({ + id: 'PreviewForm', + title: '文件预览', + url: top.$.rootUrl + '/LR_Desktop/EnrollData/PreviewFile?folderid=' + Path, + width: 1080, + height: 850, + btn: null, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + } else { + learun.alert.warning('请选择要预览的文件!'); + } + }); + }, // 初始化列表 initGird: function () { - $('#gridtable').lrAuthorizeJfGrid({ + $('#gridtable').jfGrid({ url: top.$.rootUrl + '/LR_Desktop/EnrollData/GetPageList', headData: [ + { label: "文件名", name: "F_FileName", width: 200, align: "left"}, { label: "上传时间", name: "UploadTime", width: 100, align: "left"}, ], mainId:'Id', - isPage: true + isPage: true, + sidx: 'UploadTime desc', }); page.search(); }, search: function (param) { param = param || {}; + param.Type = 1; $('#gridtable').jfGridSet('reload',{ queryJson: JSON.stringify(param) }); } }; diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollData/IndexPersonnel.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollData/IndexPersonnel.cshtml new file mode 100644 index 000000000..533ee60ca --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollData/IndexPersonnel.cshtml @@ -0,0 +1,38 @@ +@{ + ViewBag.Title = "招生数据"; + Layout = "~/Views/Shared/_Index.cshtml"; +} +
+
+
+
+
+
+ +
+
+  查询 +
+
+
+
+ +
+ + + +
+
+
+
+
+
+@Html.AppendJsFile("/Areas/LR_Desktop/Views/EnrollData/IndexPersonnel.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollData/IndexPersonnel.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollData/IndexPersonnel.js new file mode 100644 index 000000000..cdd61c725 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollData/IndexPersonnel.js @@ -0,0 +1,128 @@ +/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) + * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + * 创建人:超级管理员 + * 日 期:2022-02-24 16:59 + * 描 述:招生数据 + */ +var refreshGirdData; +var bootstrap = function ($, learun) { + "use strict"; + var page = { + init: function () { + page.initGird(); + 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 () { + learun.layerForm({ + id: 'form', + title: '新增', + url: top.$.rootUrl + '/LR_Desktop/EnrollData/Form', + width: 600, + height: 400, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + }); + // 编辑 + $('#lr_edit').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('Id'); + if (learun.checkrow(keyValue)) { + learun.layerForm({ + id: 'form', + title: '编辑', + url: top.$.rootUrl + '/LR_Desktop/EnrollData/Form?keyValue=' + keyValue, + width: 600, + height: 400, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + } + }); + // 删除 + $('#lr_delete').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('Id'); + if (learun.checkrow(keyValue)) { + learun.layerConfirm('是否确认删除该项!', function (res) { + if (res) { + learun.deleteForm(top.$.rootUrl + '/LR_Desktop/EnrollData/DeleteForm', { keyValue: keyValue}, function () { + refreshGirdData(); + }); + } + }); + } + }); + // 打印 + $('#lr_print').on('click', function () { + $('#gridtable').jqprintTable(); + }); + + //文件下载 + $('#lr-download').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('Id'); + var Path = $("#gridtable").jfGridValue("Path"); + if (keyValue) { + learun.download({ url: top.$.rootUrl + '/LR_Desktop/EnrollData/DownloadFile', param: { folderid: Path }, method: 'POST' }); + } else { + learun.alert.warning('请选择要下载的文件!'); + } + }); + //文件预览 + $('#lr-preview').on('click', function () { + var keyValue = $("#gridtable").jfGridValue("Id"); + var Path = $("#gridtable").jfGridValue("Path"); + if (keyValue) { + learun.layerForm({ + id: 'PreviewForm', + title: '文件预览', + url: top.$.rootUrl + '/LR_Desktop/EnrollData/PreviewFile?folderid=' + Path, + width: 1080, + height: 850, + btn: null, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + } else { + learun.alert.warning('请选择要预览的文件!'); + } + }); + + }, + // 初始化列表 + initGird: function () { + $('#gridtable').jfGrid({ + url: top.$.rootUrl + '/LR_Desktop/EnrollData/GetPageList', + headData: [ + { label: "文件名", name: "F_FileName", width: 200, align: "left"}, + { label: "上传时间", name: "UploadTime", width: 100, align: "left"}, + ], + mainId:'Id', + isPage: true, + sidx: 'UploadTime desc', + }); + page.search(); + }, + search: function (param) { + param = param || {}; + param.Type = 2; + $('#gridtable').jfGridSet('reload',{ queryJson: JSON.stringify(param) }); + } + }; + refreshGirdData = function () { + $('#gridtable').jfGridSet('reload'); + }; + page.init(); +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj index 800556f3e..dcf39c9d4 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj @@ -1442,6 +1442,7 @@ + @@ -7957,6 +7958,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/EnrollData/EnrollDataEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/EnrollData/EnrollDataEntity.cs index 2b95074ed..8af07e092 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/EnrollData/EnrollDataEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/EnrollData/EnrollDataEntity.cs @@ -60,6 +60,9 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop } #endregion #region 扩展字段 + [NotMapped] + public string F_FileName { get; set; } + #endregion } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/EnrollData/EnrollDataService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/EnrollData/EnrollDataService.cs index 30b4e44a9..74aaaf79a 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/EnrollData/EnrollDataService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/EnrollData/EnrollDataService.cs @@ -29,17 +29,28 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop { try { + var basedbname = BaseRepository().getDbConnection().Database; var strSql = new StringBuilder(); strSql.Append("SELECT "); strSql.Append(@" - t.Id, - t.UploadTime + t.*,f.F_FileName "); strSql.Append(" FROM EnrollData t "); + strSql.Append(" left join "+ basedbname + ".dbo.LR_Base_AnnexesFile f on t.[Path]=f.f_folderid "); strSql.Append(" WHERE 1=1 "); var queryParam = queryJson.ToJObject(); // 虚拟参数 var dp = new DynamicParameters(new { }); + if (!queryParam["Type"].IsEmpty()) + { + dp.Add("Type", queryParam["Type"].ToString(), DbType.String); + strSql.Append(" AND t.Type = @Type "); + } + if (!queryParam["keyword"].IsEmpty()) + { + dp.Add("keyword", queryParam["keyword"].ToString(), DbType.String); + strSql.Append(" AND f.F_FileName like @keyword "); + } return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(),dp, pagination); } catch (Exception ex) From a6c5eea7dab6aead973e417aa5c864d283461e21 Mon Sep 17 00:00:00 2001 From: zhangli <1109134334@qq.com> Date: Sat, 26 Feb 2022 16:11:53 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E4=BA=BA=E4=BA=8B=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/EnrollDataController.cs | 3 ++- .../Views/EnrollTemplate/Index.cshtml | 3 ++- .../LR_Desktop/Views/EnrollTemplate/Index.js | 23 +++++++++++++++++- .../EnrollTemplate/IndexPersonnel.cshtml | 1 + .../Views/EnrollTemplate/IndexPersonnel.js | 21 ++++++++++++++++ .../XmlConfig/system.config | 24 ++++++++++--------- .../XmlConfig/database.config | 15 ++++++------ .../XmlConfig/system.config | 2 +- .../EnrollData/EnrollDataService.cs | 8 +++---- .../EnrollTemplate/EnrollTemplateEntity.cs | 3 +++ .../EnrollTemplate/EnrollTemplateService.cs | 4 +++- 11 files changed, 79 insertions(+), 28 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/EnrollDataController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/EnrollDataController.cs index 26d66566e..384eb428f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/EnrollDataController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/EnrollDataController.cs @@ -160,7 +160,8 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers return; } string filename = Server.UrlDecode(data.F_FileName);//客户端保存的文件名 - string filepath = data.F_FilePath;// DirFileHelper.GetAbsolutePath(data.F_FilePath);//路径 + data.F_FilePath ="/"+ data.F_FilePath.Substring(data.F_FilePath.IndexOf("Resource")); + string filepath = DirFileHelper.GetAbsolutePath(data.F_FilePath);//路径 if (data.F_FileType == "xlsx" || data.F_FileType == "xls") { filepath = filepath.Substring(0, filepath.LastIndexOf(".")) + ".pdf";//文件名 diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollTemplate/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollTemplate/Index.cshtml index 65b0ab11f..eeeb52375 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollTemplate/Index.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollTemplate/Index.cshtml @@ -20,7 +20,8 @@
- + +  预览
 新增 diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollTemplate/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollTemplate/Index.js index 5d2010519..d3ce19bca 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollTemplate/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollTemplate/Index.js @@ -66,13 +66,34 @@ var bootstrap = function ($, learun) { $('#lr_print').on('click', function () { $('#gridtable').jqprintTable(); }); + //文件预览 + $('#lr-preview').on('click', function () { + var keyValue = $("#gridtable").jfGridValue("Id"); + var Path = $("#gridtable").jfGridValue("Path"); + if (keyValue) { + learun.layerForm({ + id: 'PreviewForm', + title: '文件预览', + url: top.$.rootUrl + '/LR_Desktop/EnrollData/PreviewFile?folderid=' + Path, + width: 1080, + height: 850, + btn: null, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + } else { + learun.alert.warning('请选择要预览的文件!'); + } + }); }, // 初始化列表 initGird: function () { - $('#gridtable').lrAuthorizeJfGrid({ + $('#gridtable').jfGrid({ url: top.$.rootUrl + '/LR_Desktop/EnrollTemplate/GetPageList', headData: [ { label: "模板名称", name: "Name", width: 200, align: "left" }, + { label: "文件名称", name: "F_FileName", width: 200, align: "left" }, //{ label: "模板上传", name: "Path", width: 100, align: "left"}, { label: "是否启用", name: "Enabled", width: 100, align: "left", diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollTemplate/IndexPersonnel.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollTemplate/IndexPersonnel.cshtml index b772cd1e6..e30859e7e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollTemplate/IndexPersonnel.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollTemplate/IndexPersonnel.cshtml @@ -21,6 +21,7 @@
 新增 diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollTemplate/IndexPersonnel.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollTemplate/IndexPersonnel.js index dbca47504..6cc623a2e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollTemplate/IndexPersonnel.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollTemplate/IndexPersonnel.js @@ -66,6 +66,26 @@ var bootstrap = function ($, learun) { $('#lr_print').on('click', function () { $('#gridtable').jqprintTable(); }); + //文件预览 + $('#lr-preview').on('click', function () { + var keyValue = $("#gridtable").jfGridValue("Id"); + var Path = $("#gridtable").jfGridValue("Path"); + if (keyValue) { + learun.layerForm({ + id: 'PreviewForm', + title: '文件预览', + url: top.$.rootUrl + '/LR_Desktop/EnrollData/PreviewFile?folderid=' + Path, + width: 1080, + height: 850, + btn: null, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + } else { + learun.alert.warning('请选择要预览的文件!'); + } + }); }, // 初始化列表 initGird: function () { @@ -73,6 +93,7 @@ var bootstrap = function ($, learun) { url: top.$.rootUrl + '/LR_Desktop/EnrollTemplate/GetPageList', headData: [ { label: "模板名称", name: "Name", width: 200, align: "left" }, + { label: "文件名称", name: "F_FileName", width: 200, align: "left" }, //{ label: "模板上传", name: "Path", width: 100, align: "left"}, { label: "是否启用", name: "Enabled", width: 100, align: "left", diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/system.config b/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/system.config index 26f5ee6ee..83bd00b85 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/system.config +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/system.config @@ -65,7 +65,7 @@ - + @@ -77,11 +77,11 @@ - + - + @@ -143,16 +143,16 @@ - + - + - - + + @@ -160,7 +160,7 @@ - + @@ -172,7 +172,9 @@ - - - + + + + + \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/XmlConfig/database.config b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/XmlConfig/database.config index e9996a0ab..a26a6fe62 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/XmlConfig/database.config +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/XmlConfig/database.config @@ -1,11 +1,5 @@  - - - - + + + + + + \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/XmlConfig/system.config b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/XmlConfig/system.config index 0fac6f538..78b31073c 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/XmlConfig/system.config +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/XmlConfig/system.config @@ -65,7 +65,7 @@ - + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/EnrollData/EnrollDataService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/EnrollData/EnrollDataService.cs index 74aaaf79a..2e647bad6 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/EnrollData/EnrollDataService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/EnrollData/EnrollDataService.cs @@ -36,7 +36,7 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop t.*,f.F_FileName "); strSql.Append(" FROM EnrollData t "); - strSql.Append(" left join "+ basedbname + ".dbo.LR_Base_AnnexesFile f on t.[Path]=f.f_folderid "); + strSql.Append(" left join " + basedbname + ".dbo.LR_Base_AnnexesFile f on t.[Path]=f.f_folderid "); strSql.Append(" WHERE 1=1 "); var queryParam = queryJson.ToJObject(); // 虚拟参数 @@ -48,10 +48,10 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop } if (!queryParam["keyword"].IsEmpty()) { - dp.Add("keyword", queryParam["keyword"].ToString(), DbType.String); + dp.Add("keyword", "%" + queryParam["keyword"].ToString() + "%", DbType.String); strSql.Append(" AND f.F_FileName like @keyword "); } - return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(),dp, pagination); + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp, pagination); } catch (Exception ex) { @@ -102,7 +102,7 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop { try { - this.BaseRepository("CollegeMIS").Delete(t=>t.Id == keyValue); + this.BaseRepository("CollegeMIS").Delete(t => t.Id == keyValue); } catch (Exception ex) { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/EnrollTemplate/EnrollTemplateEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/EnrollTemplate/EnrollTemplateEntity.cs index a07e50879..40bfa64e7 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/EnrollTemplate/EnrollTemplateEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/EnrollTemplate/EnrollTemplateEntity.cs @@ -83,6 +83,9 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop } #endregion #region 扩展字段 + [NotMapped] + public string F_FileName { get; set; } + #endregion } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/EnrollTemplate/EnrollTemplateService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/EnrollTemplate/EnrollTemplateService.cs index c49cbd92e..87c251085 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/EnrollTemplate/EnrollTemplateService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/EnrollTemplate/EnrollTemplateService.cs @@ -29,15 +29,17 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop { try { + var basedbname = BaseRepository().getDbConnection().Database; var strSql = new StringBuilder(); strSql.Append("SELECT "); strSql.Append(@" t.Id, t.Name, t.Path, - t.Enabled + t.Enabled,f.F_FileName "); strSql.Append(" FROM EnrollTemplate t "); + strSql.Append(" left join " + basedbname + ".dbo.LR_Base_AnnexesFile f on t.[Path]=f.f_folderid "); strSql.Append(" WHERE 1=1 "); var queryParam = queryJson.ToJObject(); // 虚拟参数 From 3f9e0efdf8ff47d58f9ac5ed94c9b660dadaec30 Mon Sep 17 00:00:00 2001 From: zhangli <1109134334@qq.com> Date: Mon, 28 Feb 2022 15:22:34 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E6=8B=9B=E7=94=9F=E6=96=87=E4=BB=B6api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modules/EnrollTemplateApi.cs | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/EnrollTemplateApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/EnrollTemplateApi.cs index fdc2f5ff5..5ae051b9a 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/EnrollTemplateApi.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/EnrollTemplateApi.cs @@ -37,23 +37,33 @@ namespace Learun.Application.WebApi.Modules return SuccessString(folderId); } + /// + /// 上传人事文件 + /// + /// + /// public Response UploadPersonnel(dynamic _) { var files = (List)this.Context.Request.Files; var folderId = Upload(2, files); return SuccessString(folderId); } - + /// + /// 上传 + /// + /// + /// + /// private string Upload(int type,List files) { - var folderId = Guid.NewGuid().ToString(); //this.GetReqData(); + var folderId = Guid.NewGuid().ToString(); string filePath = Config.GetValue("AnnexesFile"); string uploadDate = DateTime.Now.ToString("yyyyMMdd"); string FileEextension = Path.GetExtension(files[0].Name); string fileGuid = Guid.NewGuid().ToString(); - string virtualPath = string.Format("{0}/{1}/{2}/{3}{4}", filePath, "PersonnelData", uploadDate, fileGuid, FileEextension); + string virtualPath = string.Format("{0}/{1}/{2}/{3}{4}", filePath, "EnrollData", uploadDate, fileGuid, FileEextension); //创建文件夹 string path = Path.GetDirectoryName(virtualPath); @@ -99,6 +109,11 @@ namespace Learun.Application.WebApi.Modules public Response DownEnrollTemplate(dynamic _) { var enrollTemplate = enrollTemplateIBLL.GetEnabledEntity(1); + if (enrollTemplate == null) + { + return Fail("无可用模板!"); + } + var data = annexesFileIBLL.GetEntity(enrollTemplate.Path); string filepath = data.F_FilePath; if (FileDownHelper.FileExists(filepath)) @@ -115,6 +130,11 @@ namespace Learun.Application.WebApi.Modules public Response DownPersonnelTemplate(dynamic _) { var enrollTemplate = enrollTemplateIBLL.GetEnabledEntity(2); + if (enrollTemplate == null) + { + return Fail("无可用模板!"); + } + var data = annexesFileIBLL.GetEntity(enrollTemplate.Path); string filepath = data.F_FilePath; if (FileDownHelper.FileExists(filepath)) From 9a0d557df9b882366b9e458f8adb95e6e56ec04e Mon Sep 17 00:00:00 2001 From: zhangli <1109134334@qq.com> Date: Tue, 1 Mar 2022 09:25:57 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E6=8B=9B=E7=94=9F=E6=96=87=E4=BB=B6api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Learun.Application.WebApi/Modules/EnrollTemplateApi.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/EnrollTemplateApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/EnrollTemplateApi.cs index 5ae051b9a..80c53ca9e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/EnrollTemplateApi.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/EnrollTemplateApi.cs @@ -18,7 +18,9 @@ namespace Learun.Application.WebApi.Modules //下载人事模板 Get["/downpersonneltemplate"] = DownPersonnelTemplate; + //上传招生文件 Post["/uploadenroll"] = UploadEnroll; + //上传人事文件 Post["/uploadpersonnel"] = UploadPersonnel; } private AnnexesFileIBLL annexesFileIBLL = new AnnexesFileBLL(); @@ -87,12 +89,11 @@ namespace Learun.Application.WebApi.Modules fileAnnexesEntity.F_FileSize = files[0].Value.Length.ToString(); fileAnnexesEntity.F_FileExtensions = FileEextension; fileAnnexesEntity.F_FileType = FileEextension.Replace(".", ""); - //fileAnnexesEntity.F_CreateUserId = userInfo.userId; - //fileAnnexesEntity.F_CreateUserName = userInfo.realName; annexesFileIBLL.SaveEntity(folderId, fileAnnexesEntity); - enrollData.Create(); + enrollData.Id = Guid.NewGuid().ToString(); + enrollData.UploadTime = DateTime.Now; enrollData.Type = type; enrollData.Path = folderId; enrollDataIBLL.SaveEntity("",enrollData); From 7b32786b90d19d76c85530a15cf06fb643eef129 Mon Sep 17 00:00:00 2001 From: zhangli <1109134334@qq.com> Date: Tue, 1 Mar 2022 10:15:48 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E6=8B=9B=E7=94=9F/=E4=BA=BA=E4=BA=8B?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E6=B7=BB=E5=8A=A0=E5=A4=87=E6=B3=A8=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LR_Desktop/Views/EnrollTemplate/Form.cshtml | 13 +++++++++---- .../Areas/LR_Desktop/Views/EnrollTemplate/Index.js | 1 + .../Views/EnrollTemplate/IndexPersonnel.js | 1 + .../EnrollTemplate/EnrollTemplateEntity.cs | 7 +++++++ .../EnrollTemplate/EnrollTemplateService.cs | 2 +- 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollTemplate/Form.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollTemplate/Form.cshtml index bb441cdba..cb1d4981a 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollTemplate/Form.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollTemplate/Form.cshtml @@ -3,17 +3,22 @@ Layout = "~/Views/Shared/_Form.cshtml"; }
-
+
模板名称*
-
+
模板上传
-
+
-
+
是否启用
+
+
备注
+ +
+
@Html.AppendJsFile("/Areas/LR_Desktop/Views/EnrollTemplate/Form.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollTemplate/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollTemplate/Index.js index d3ce19bca..0767dcee8 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollTemplate/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollTemplate/Index.js @@ -101,6 +101,7 @@ var bootstrap = function ($, learun) { return cellvalue == 1 ? "" : ""; } }, + { label: "备注", name: "Remark", width: 200, align: "left" }, ], mainId: 'Id', isPage: true diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollTemplate/IndexPersonnel.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollTemplate/IndexPersonnel.js index 6cc623a2e..db3e212c1 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollTemplate/IndexPersonnel.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/EnrollTemplate/IndexPersonnel.js @@ -101,6 +101,7 @@ var bootstrap = function ($, learun) { return cellvalue == 1 ? "" : ""; } }, + { label: "备注", name: "Remark", width: 200, align: "left" }, ], mainId: 'Id', isPage: true diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/EnrollTemplate/EnrollTemplateEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/EnrollTemplate/EnrollTemplateEntity.cs index 40bfa64e7..54bffac85 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/EnrollTemplate/EnrollTemplateEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/EnrollTemplate/EnrollTemplateEntity.cs @@ -39,6 +39,13 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop ///
[Column("ENABLED")] public int? Enabled { get; set; } + + /// + /// 备注 + /// + [Column("REMARK")] + public string Remark { get; set; } + /// /// 上传时间 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/EnrollTemplate/EnrollTemplateService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/EnrollTemplate/EnrollTemplateService.cs index 87c251085..50dc1b302 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/EnrollTemplate/EnrollTemplateService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/EnrollTemplate/EnrollTemplateService.cs @@ -35,7 +35,7 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop strSql.Append(@" t.Id, t.Name, - t.Path, + t.Path,t.Remark, t.Enabled,f.F_FileName "); strSql.Append(" FROM EnrollTemplate t ");