@@ -7,6 +7,15 @@ | |||||
<div class="lr-layout-wrap lr-layout-wrap-notitle "> | <div class="lr-layout-wrap lr-layout-wrap-notitle "> | ||||
<div class="lr-layout-tool"> | <div class="lr-layout-tool"> | ||||
<div class="lr-layout-tool-left"> | <div class="lr-layout-tool-left"> | ||||
<div class="lr-layout-tool-item"> | |||||
<div id="datesearch"></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> 查询</a> | |||||
</div> | |||||
</div> | </div> | ||||
<div class="lr-layout-tool-right"> | <div class="lr-layout-tool-right"> | ||||
<div class=" btn-group btn-group-sm"> | <div class=" btn-group btn-group-sm"> | ||||
@@ -7,12 +7,46 @@ | |||||
var refreshGirdData; | var refreshGirdData; | ||||
var bootstrap = function ($, learun) { | var bootstrap = function ($, learun) { | ||||
"use strict"; | "use strict"; | ||||
var startTime; | |||||
var endTime; | |||||
var page = { | var page = { | ||||
init: function () { | init: function () { | ||||
page.initGird(); | page.initGird(); | ||||
page.bind(); | page.bind(); | ||||
}, | }, | ||||
bind: function () { | bind: function () { | ||||
// 时间搜索框 | |||||
$('#datesearch').lrdate({ | |||||
dfdata: [ | |||||
{ name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }, | |||||
{ name: '近7天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'd', -6) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }, | |||||
{ name: '近1个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -1) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }, | |||||
{ name: '近3个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -3) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } } | |||||
], | |||||
// 月 | |||||
mShow: false, | |||||
premShow: false, | |||||
// 季度 | |||||
jShow: false, | |||||
prejShow: false, | |||||
// 年 | |||||
ysShow: false, | |||||
yxShow: false, | |||||
preyShow: false, | |||||
yShow: false, | |||||
// 默认 | |||||
dfvalue: '1', | |||||
selectfn: function (begin, end) { | |||||
startTime = begin; | |||||
endTime = end; | |||||
page.search(); | |||||
} | |||||
}); | |||||
// 查询 | |||||
$('#btn_Search').on('click', function () { | |||||
var keyword = $('#txt_Keyword').val(); | |||||
page.search({ keyword: keyword }); | |||||
}); | |||||
// 刷新 | // 刷新 | ||||
$('#lr_refresh').on('click', function () { | $('#lr_refresh').on('click', function () { | ||||
location.reload(); | location.reload(); | ||||
@@ -82,11 +116,15 @@ var bootstrap = function ($, learun) { | |||||
], | ], | ||||
mainId: 'ID', | mainId: 'ID', | ||||
isPage: true, | isPage: true, | ||||
sidx: 'createtime', | |||||
sord: 'desc' | |||||
}); | }); | ||||
page.search(); | page.search(); | ||||
}, | }, | ||||
search: function (param) { | search: function (param) { | ||||
param = param || {}; | param = param || {}; | ||||
param.StartTime = startTime; | |||||
param.EndTime = endTime; | |||||
$('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); | $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); | ||||
} | } | ||||
}; | }; | ||||
@@ -31,12 +31,23 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||||
var adms = this.BaseRepository().getDbConnection().Database; | var adms = this.BaseRepository().getDbConnection().Database; | ||||
var strSql = new StringBuilder(); | var strSql = new StringBuilder(); | ||||
strSql.Append("SELECT "); | strSql.Append("SELECT "); | ||||
strSql.Append(@" t.* ,u.F_Account,F_RealName "); | |||||
strSql.Append(@" t.* ,u.F_Account,u.F_RealName "); | |||||
strSql.Append($" FROM DutySchedule t left join {adms}.dbo.LR_Base_User u on t.Person=u.F_UserId "); | strSql.Append($" FROM DutySchedule t left join {adms}.dbo.LR_Base_User u on t.Person=u.F_UserId "); | ||||
strSql.Append(" WHERE 1=1 "); | strSql.Append(" WHERE 1=1 "); | ||||
var queryParam = queryJson.ToJObject(); | var queryParam = queryJson.ToJObject(); | ||||
// 虚拟参数 | // 虚拟参数 | ||||
var dp = new DynamicParameters(new { }); | var dp = new DynamicParameters(new { }); | ||||
if (!queryParam["keyword"].IsEmpty()) | |||||
{ | |||||
dp.Add("keyword", "%" + queryParam["keyword"].ToString() + "%", DbType.String); | |||||
strSql.Append(" AND u.F_RealName Like @keyword "); | |||||
} | |||||
if (!queryParam["StartTime"].IsEmpty() && !queryParam["EndTime"].IsEmpty()) | |||||
{ | |||||
dp.Add("startTime", queryParam["StartTime"].ToDate(), DbType.DateTime); | |||||
dp.Add("endTime", queryParam["EndTime"].ToDate(), DbType.DateTime); | |||||
strSql.Append(" AND ( t.StartTime >= @startTime AND t.EndTime <= @endTime ) "); | |||||
} | |||||
return this.BaseRepository("CollegeMIS").FindList<DutyScheduleEntity>(strSql.ToString(), dp, pagination); | return this.BaseRepository("CollegeMIS").FindList<DutyScheduleEntity>(strSql.ToString(), dp, pagination); | ||||
} | } | ||||
catch (Exception ex) | catch (Exception ex) | ||||