@@ -83,6 +83,15 @@ namespace Learun.Application.Web.Areas.LR_OAModule.Controllers | |||||
{ | { | ||||
return View(); | return View(); | ||||
} | } | ||||
/// <summary> | |||||
/// 云盘文件统计 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
[HttpGet] | |||||
public ActionResult FileStatistic() | |||||
{ | |||||
return View(); | |||||
} | |||||
#endregion | #endregion | ||||
#region 获取数据 | #region 获取数据 | ||||
@@ -204,6 +213,42 @@ namespace Learun.Application.Web.Areas.LR_OAModule.Controllers | |||||
var data = fileInfoBLL.GetEntity(keyValue); | var data = fileInfoBLL.GetEntity(keyValue); | ||||
return JsonResult(data); | return JsonResult(data); | ||||
} | } | ||||
/// <summary> | |||||
/// 获取云盘文件统计数据 | |||||
/// </summary> | |||||
/// <param name="queryJson"></param> | |||||
/// <returns></returns> | |||||
public ActionResult GetFileStatisitcData(string queryJson) | |||||
{ | |||||
var data = fileInfoBLL.GetListByJson(queryJson); | |||||
var dataGroup = data.Where(x => x.F_CreateDate.HasValue).GroupBy(x => x.F_CreateDate.Value.Month).Select(x => new TempClass() | |||||
{ | |||||
month=x.Key, | |||||
count = x.Select(y=>y.F_FileId).Count() | |||||
}); | |||||
var xAxis = new List<string>(); | |||||
var seriesData = new List<int>(); | |||||
for (int i = 0; i < 12; i++) | |||||
{ | |||||
xAxis.Add(string.Format("{0}月", i + 1)); | |||||
var aa = dataGroup.FirstOrDefault(x => x.month == (i + 1)); | |||||
seriesData.Add(aa == null ? 0 : aa.count); | |||||
} | |||||
var jsonData = new | |||||
{ | |||||
seriesData = seriesData, | |||||
xAxis = xAxis | |||||
}; | |||||
return Success(jsonData); | |||||
} | |||||
public class TempClass { | |||||
public int month { get; set; } | |||||
public int count { get; set; } | |||||
} | |||||
#endregion | #endregion | ||||
#region 提交数据 | #region 提交数据 | ||||
@@ -0,0 +1,37 @@ | |||||
| |||||
@{ | |||||
ViewBag.Title = "流程使用报表"; | |||||
Layout = "~/Views/Shared/_ReportTemplate.cshtml"; | |||||
} | |||||
<div class="lr-layout ui-report"> | |||||
<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="year" type="text" class="form-control lr-input-wdatepicker" onfocus="WdatePicker({ dateFmt:'yyyy',onpicked: function () { $('#year').trigger('change'); } })" 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" learun-authorize="yes"> | |||||
<a id="lr-replace" class="btn btn-default"><i class="fa fa-refresh"></i> <span class="lrlt">刷新</span></a> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
<div class="lr-layout-grid" style="overflow:auto;"> | |||||
<div class="grid-title"> | |||||
<div style="overflow: hidden; padding-bottom: 20px; text-align: center; margin-left: auto; margin-right: auto;"> | |||||
<div id="main" style="width: 650px; height: 350px;border: 1px solid #ccc;"> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
<script src="~/Content/echarts/echarts.js"></script> | |||||
@Html.AppendJsFile("/Areas/LR_OAModule/Views/ResourceFile/FileStatistic.js") |
@@ -0,0 +1,79 @@ | |||||
var bootstrap = function ($, learun) { | |||||
"use strict"; | |||||
var year = ""; | |||||
var page = { | |||||
init: function () { | |||||
page.bind(); | |||||
page.initChart(); | |||||
}, | |||||
bind: function () { | |||||
//当前年 | |||||
var now = learun.formatDate(new Date(), 'yyyy'); | |||||
$('#year').val(now); | |||||
year = now; | |||||
// 刷新 | |||||
$('#lr-replace').on('click', function () { | |||||
location.reload(); | |||||
}); | |||||
//查询 | |||||
$('#btn_Search').on('click', function () { | |||||
year = $('#year').val(); | |||||
page.search(); | |||||
}); | |||||
}, | |||||
initChart: function () { | |||||
var myChart1 = echarts.init(document.getElementById('main')); | |||||
var queryJson = { year: year }; | |||||
learun.httpAsyncPost(top.$.rootUrl + "/LR_OAModule/ResourceFile/GetFileStatisitcData", { queryJson: JSON.stringify(queryJson) }, function (res) { | |||||
if (res.code == 200) { | |||||
var option1 = { | |||||
title: { | |||||
text: year + '年云盘文件统计图', | |||||
x: 'center' | |||||
}, | |||||
legend: { | |||||
orient: 'vertical', | |||||
left: 'left', | |||||
data: ['数量'] | |||||
}, | |||||
tooltip: { | |||||
trigger: 'axis' | |||||
}, | |||||
grid: { | |||||
left: '5%', | |||||
right: '3%', | |||||
bottom: '3%', | |||||
containLabel: true | |||||
}, | |||||
xAxis: { | |||||
type: 'category', | |||||
data: res.data.xAxis | |||||
}, | |||||
yAxis: { | |||||
type: 'value', | |||||
name: '文件数/个' | |||||
}, | |||||
series: [ | |||||
{ | |||||
name: '数量', | |||||
type: 'bar', | |||||
data: res.data.seriesData | |||||
} | |||||
] | |||||
}; | |||||
myChart1.setOption(option1); | |||||
} | |||||
}); | |||||
}, | |||||
search: function (param) { | |||||
param = param || {}; | |||||
param.year = year; | |||||
page.initChart(); | |||||
} | |||||
}; | |||||
page.init(); | |||||
} | |||||
@@ -1490,6 +1490,7 @@ | |||||
<Content Include="Areas\LR_OAModule\Views\Notice\IndexRecycle.js" /> | <Content Include="Areas\LR_OAModule\Views\Notice\IndexRecycle.js" /> | ||||
<Content Include="Areas\LR_OAModule\Views\Notice\IndexFlow.js" /> | <Content Include="Areas\LR_OAModule\Views\Notice\IndexFlow.js" /> | ||||
<Content Include="Areas\LR_OAModule\Views\ResourceFile\BcIndex.js" /> | <Content Include="Areas\LR_OAModule\Views\ResourceFile\BcIndex.js" /> | ||||
<Content Include="Areas\LR_OAModule\Views\ResourceFile\FileStatistic.js" /> | |||||
<Content Include="Areas\LR_OAModule\Views\Signet\Index.js" /> | <Content Include="Areas\LR_OAModule\Views\Signet\Index.js" /> | ||||
<Content Include="Areas\LR_PortalSite\Views\Article\Form.css" /> | <Content Include="Areas\LR_PortalSite\Views\Article\Form.css" /> | ||||
<Content Include="Areas\LR_PortalSite\Views\Article\Form.js" /> | <Content Include="Areas\LR_PortalSite\Views\Article\Form.js" /> | ||||
@@ -7628,6 +7629,7 @@ | |||||
<Content Include="Areas\EducationalAdministration\Views\TextBookOut\Form.cshtml" /> | <Content Include="Areas\EducationalAdministration\Views\TextBookOut\Form.cshtml" /> | ||||
<Content Include="Areas\EducationalAdministration\Views\TextBookOut\FormView.cshtml" /> | <Content Include="Areas\EducationalAdministration\Views\TextBookOut\FormView.cshtml" /> | ||||
<Content Include="Areas\EducationalAdministration\Views\TextBookOut\FormDelete.cshtml" /> | <Content Include="Areas\EducationalAdministration\Views\TextBookOut\FormDelete.cshtml" /> | ||||
<Content Include="Areas\LR_OAModule\Views\ResourceFile\FileStatistic.cshtml" /> | |||||
<None Include="Properties\PublishProfiles\CustomProfile.pubxml" /> | <None Include="Properties\PublishProfiles\CustomProfile.pubxml" /> | ||||
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" /> | <None Include="Properties\PublishProfiles\FolderProfile.pubxml" /> | ||||
<Content Include="Views\Login\Default-beifen.cshtml" /> | <Content Include="Views\Login\Default-beifen.cshtml" /> | ||||
@@ -33,6 +33,10 @@ namespace Learun.Application.OA.File.FileInfo | |||||
{ | { | ||||
return service.GetList(); | return service.GetList(); | ||||
} | } | ||||
public IEnumerable<FileInfoEntity> GetListByJson(string queryJson) | |||||
{ | |||||
return service.GetListByJson(queryJson); | |||||
} | |||||
/// <summary> | /// <summary> | ||||
/// 文档列表 | /// 文档列表 | ||||
/// </summary> | /// </summary> | ||||
@@ -22,6 +22,7 @@ namespace Learun.Application.OA.File.FileInfo | |||||
IEnumerable<FileInfoEntity> GetList(string userId); | IEnumerable<FileInfoEntity> GetList(string userId); | ||||
IEnumerable<FileInfoEntity> GetList(); | IEnumerable<FileInfoEntity> GetList(); | ||||
IEnumerable<FileInfoEntity> GetListByJson(string queryJson); | |||||
/// <summary> | /// <summary> | ||||
/// 文档列表 | /// 文档列表 | ||||
/// </summary> | /// </summary> | ||||
@@ -1,4 +1,5 @@ | |||||
using Learun.DataBase.Repository; | using Learun.DataBase.Repository; | ||||
using Learun.Util; | |||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Data.Common; | using System.Data.Common; | ||||
@@ -24,7 +25,25 @@ namespace Learun.Application.OA.File.FileInfo | |||||
public IEnumerable<FileInfoEntity> GetList() | public IEnumerable<FileInfoEntity> GetList() | ||||
{ | { | ||||
string sql = "select * from LR_OA_FileInfo where F_DeleteMark = 0"; | string sql = "select * from LR_OA_FileInfo where F_DeleteMark = 0"; | ||||
return this.BaseRepository().FindList<FileInfoEntity>(); | |||||
return this.BaseRepository().FindList<FileInfoEntity>(sql); | |||||
} | |||||
public IEnumerable<FileInfoEntity> GetListByJson(string queryJson) | |||||
{ | |||||
var dp = new object(); | |||||
var queryParam = queryJson.ToJObject(); | |||||
var strSql = new StringBuilder(); | |||||
strSql.Append("select * from LR_OA_FileInfo where F_DeleteMark = 0 "); | |||||
if (!queryParam["year"].IsEmpty()) | |||||
{ | |||||
dp = new { year = queryParam["year"].ToInt() }; | |||||
strSql.Append(" and DATEPART(yyyy,F_CreateDate) = @year "); | |||||
} | |||||
else | |||||
{ | |||||
dp = new { year = DateTime.Now.Year }; | |||||
strSql.Append(" and DATEPART(yyyy,F_CreateDate) = @year "); | |||||
} | |||||
return this.BaseRepository().FindList<FileInfoEntity>(strSql.ToString(),dp); | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||