@@ -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(); | |||
} | |||
/// <summary> | |||
/// 表单页 | |||
@@ -35,8 +39,18 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers | |||
[HttpGet] | |||
public ActionResult Form() | |||
{ | |||
return View(); | |||
return View(); | |||
} | |||
/// <summary> | |||
/// | |||
/// <summary> | |||
/// <returns></returns> | |||
[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<EnrollDataEntity>(); | |||
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 | |||
/// <summary> | |||
/// 下载文件 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <returns></returns> | |||
[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); | |||
} | |||
} | |||
/// <summary> | |||
/// 文件预览 | |||
/// </summary> | |||
/// <param name="fileId">文件ID</param> | |||
/// <returns></returns> | |||
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 | |||
} | |||
} |
@@ -7,15 +7,27 @@ | |||
<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> <span class="lrlt">查询</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-download" class="btn btn-default"><i class="fa fa-download"></i> <span class="lrlt">下载</span></a> | |||
<a id="lr-preview" class="btn btn-default"><i class="fa fa-eye"></i> <span class="lrlt">预览</span></a> | |||
</div> | |||
<div class=" btn-group btn-group-sm" learun-authorize="yes"> | |||
<a id="lr_add" class="btn btn-default"><i class="fa fa-plus"></i> 新增</a> | |||
@*<a id="lr_add" class="btn btn-default"><i class="fa fa-plus"></i> 新增</a> | |||
<a id="lr_edit" class="btn btn-default"><i class="fa fa-pencil-square-o"></i> 编辑</a> | |||
<a id="lr_delete" class="btn btn-default"><i class="fa fa-trash-o"></i> 删除</a> | |||
<a id="lr_delete" class="btn btn-default"><i class="fa fa-trash-o"></i> 删除</a>*@ | |||
<a id="lr_print" class="btn btn-default"><i class="fa fa-print"></i> 打印</a> | |||
</div> | |||
</div> | |||
@@ -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) }); | |||
} | |||
}; | |||
@@ -0,0 +1,38 @@ | |||
@{ | |||
ViewBag.Title = "招生数据"; | |||
Layout = "~/Views/Shared/_Index.cshtml"; | |||
} | |||
<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> <span class="lrlt">查询</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-download" class="btn btn-default"><i class="fa fa-download"></i> <span class="lrlt">下载</span></a> | |||
<a id="lr-preview" class="btn btn-default"><i class="fa fa-eye"></i> <span class="lrlt">预览</span></a> | |||
</div> | |||
<div class=" btn-group btn-group-sm" learun-authorize="yes"> | |||
@*<a id="lr_add" class="btn btn-default"><i class="fa fa-plus"></i> 新增</a> | |||
<a id="lr_edit" class="btn btn-default"><i class="fa fa-pencil-square-o"></i> 编辑</a> | |||
<a id="lr_delete" class="btn btn-default"><i class="fa fa-trash-o"></i> 删除</a>*@ | |||
<a id="lr_print" class="btn btn-default"><i class="fa fa-print"></i> 打印</a> | |||
</div> | |||
</div> | |||
</div> | |||
<div class="lr-layout-body" id="gridtable"></div> | |||
</div> | |||
</div> | |||
</div> | |||
@Html.AppendJsFile("/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(); | |||
} |
@@ -1442,6 +1442,7 @@ | |||
<Content Include="Areas\LR_Desktop\Views\DTSetting\App\AppIndex.js" /> | |||
<Content Include="Areas\LR_Desktop\Views\DTSetting\PC\PcIndex.css" /> | |||
<Content Include="Areas\LR_Desktop\Views\DTSetting\PC\PcIndex.js" /> | |||
<Content Include="Areas\LR_Desktop\Views\EnrollData\IndexPersonnel.js" /> | |||
<Content Include="Areas\LR_Desktop\Views\EnrollTemplate\IndexPersonnel.js" /> | |||
<Content Include="Areas\LR_Desktop\Views\FormulaChild\Form.js" /> | |||
<Content Include="Areas\LR_Desktop\Views\FormulaChild\Index.js" /> | |||
@@ -7957,6 +7958,7 @@ | |||
<Content Include="Areas\PersonnelManagement\Views\TimeTable\PrintSchedule.cshtml" /> | |||
<Content Include="Areas\LogisticsManagement\Views\Accommodation\IndexImport.cshtml" /> | |||
<Content Include="Areas\LR_Desktop\Views\EnrollTemplate\IndexPersonnel.cshtml" /> | |||
<Content Include="Areas\LR_Desktop\Views\EnrollData\IndexPersonnel.cshtml" /> | |||
<None Include="Properties\PublishProfiles\CustomProfile.pubxml" /> | |||
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" /> | |||
<Content Include="Views\Login\Default-beifen.cshtml" /> | |||
@@ -60,6 +60,9 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop | |||
} | |||
#endregion | |||
#region 扩展字段 | |||
[NotMapped] | |||
public string F_FileName { get; set; } | |||
#endregion | |||
} | |||
} | |||
@@ -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<EnrollDataEntity>(strSql.ToString(),dp, pagination); | |||
} | |||
catch (Exception ex) | |||