@@ -10,6 +10,9 @@ | |||
<div class="lr-layout-tool-item"> | |||
<div id="datesearch"></div> | |||
</div> | |||
<div class="lr-layout-tool-item"> | |||
<div id="weeks"></div> | |||
</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> | |||
@@ -17,36 +17,51 @@ var bootstrap = function ($, learun) { | |||
}, | |||
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: '3', | |||
selectfn: function (begin, end) { | |||
startTime = begin; | |||
endTime = end; | |||
//page.search(); | |||
} | |||
}); | |||
$('#weeks').lrselect({ | |||
data: [{ text: "3周", value: "3" }, { text: "4周", value: "4" }], | |||
text: "text", | |||
value: "value", | |||
}) | |||
var monthdata = [] | |||
for (var i = 1; i <= 12; i++) { | |||
monthdata.push({ text: i+"月", value: i }) | |||
} | |||
$('#datesearch').lrselect({ | |||
data: monthdata, | |||
text: "text", | |||
value: "value", | |||
}) | |||
//$('#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: '3', | |||
// selectfn: function (begin, end) { | |||
// startTime = begin; | |||
// endTime = end; | |||
// //page.search(); | |||
// } | |||
//}); | |||
// 查询 | |||
$('#btn_Search').on('click', function () { | |||
var keyword = $('#txt_Keyword').val(); | |||
page.search({ keyword: keyword }); | |||
var month = $('#datesearch').lrselectGet(); | |||
var weeks = $('#weeks').lrselectGet(); | |||
page.search({ month: month, weeks: weeks }); | |||
}); | |||
// 刷新 | |||
$('#lr_refresh').on('click', function () { | |||
@@ -122,8 +137,8 @@ var bootstrap = function ($, learun) { | |||
}, | |||
search: function (param) { | |||
param = param || {}; | |||
param.StartTime = startTime; | |||
param.EndTime = endTime; | |||
//param.StartTime = startTime; | |||
//param.EndTime = endTime; | |||
$('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); | |||
} | |||
}; | |||
@@ -21,6 +21,7 @@ namespace Learun.Application.WebApi.Modules | |||
{ | |||
Get["/scheme"] = GetScheme; | |||
Get["/data"] = GetData; | |||
Get["/folderkey"] = GetFolderkey; | |||
Post["/save"] = Save; | |||
Post["/delete"] = DeleteForm; | |||
@@ -75,7 +76,20 @@ namespace Learun.Application.WebApi.Modules | |||
return Success(dic); | |||
} | |||
private Response GetFolderkey(dynamic _) | |||
{ | |||
List<FolderKeyReq> req = this.GetReqData<List<FolderKeyReq>>();// 获取模板请求数据 | |||
Dictionary<string, string> dic = new Dictionary<string, string>(); | |||
foreach (var item in req) | |||
{ | |||
if (!string.IsNullOrEmpty(item.processIdName)) | |||
{ | |||
var data = formSchemeIBLL.GetFolderKey(item.schemeInfoId, item.processIdName, item.keyValue);// | |||
dic = data; | |||
} | |||
} | |||
return Success(dic); | |||
} | |||
/// <summary> | |||
/// 保存表单数据 | |||
@@ -137,7 +151,33 @@ namespace Learun.Application.WebApi.Modules | |||
/// </summary> | |||
public string formData { get; set; } | |||
} | |||
private class FolderKeyReq | |||
{ | |||
/// <summary> | |||
/// 表单请求Id | |||
/// </summary> | |||
public string id { get; set; } | |||
/// <summary> | |||
/// 当前自定义表单版本号 | |||
/// </summary> | |||
public string ver { get; set; } | |||
/// <summary> | |||
/// 流程模板id | |||
/// </summary> | |||
public string schemeInfoId { get; set; } | |||
/// <summary> | |||
/// 关联字段名称 | |||
/// </summary> | |||
public string processIdName { get; set; } | |||
/// <summary> | |||
/// 数据主键值 | |||
/// </summary> | |||
public string keyValue { get; set; } | |||
/// <summary> | |||
/// 表单数据 | |||
/// </summary> | |||
public string formData { get; set; } | |||
} | |||
#endregion | |||
} | |||
@@ -551,7 +551,98 @@ namespace Learun.Application.Form | |||
} | |||
} | |||
} | |||
public Dictionary<string, string> GetFolderKey(string schemeInfoId, string processIdName, string keyValue) | |||
{ | |||
Dictionary<string, DataTable> res = new Dictionary<string, DataTable>(); | |||
try | |||
{ | |||
FormSchemeInfoEntity formSchemeInfoEntity = GetSchemeInfoEntity(schemeInfoId); | |||
FormSchemeEntity formSchemeEntity = GetSchemeEntity(formSchemeInfoEntity.F_SchemeId); | |||
FormSchemeModel formSchemeModel = formSchemeEntity.F_Scheme.ToObject<FormSchemeModel>(); | |||
// 确定主从表之间的关系 | |||
List<TreeModelEx<FormTableModel>> TableTree = new List<TreeModelEx<FormTableModel>>();// 从表 | |||
foreach (var table in formSchemeModel.dbTable) | |||
{ | |||
TreeModelEx<FormTableModel> treeone = new TreeModelEx<FormTableModel>(); | |||
treeone.data = table; | |||
treeone.id = table.name; | |||
treeone.parentId = table.relationName; | |||
if (string.IsNullOrEmpty(table.relationName)) | |||
{ | |||
treeone.parentId = "0"; | |||
} | |||
TableTree.Add(treeone); | |||
} | |||
TableTree = TableTree.ToTree(); | |||
bool hasupload = false; | |||
// 确定表与组件之间的关系 | |||
Dictionary<string, List<FormCompontModel>> tableComponts = new Dictionary<string, List<FormCompontModel>>(); | |||
foreach (var tab in formSchemeModel.data) | |||
{ | |||
foreach (var compont in tab.componts) | |||
{ | |||
if (!string.IsNullOrEmpty(compont.table)) | |||
{ | |||
if (!tableComponts.ContainsKey(compont.table)) | |||
{ | |||
tableComponts[compont.table] = new List<FormCompontModel>(); | |||
} | |||
if (compont.type == "upload") | |||
{ | |||
hasupload = true; | |||
tableComponts[compont.table].Add(compont); | |||
} | |||
if (compont.type == "guid") | |||
{ | |||
tableComponts[compont.table].Add(compont); | |||
} | |||
} | |||
} | |||
} | |||
Dictionary<string, string> uploadfieldkeyvalue = new Dictionary<string, string>(); | |||
if (!hasupload) | |||
{ | |||
return uploadfieldkeyvalue; | |||
} | |||
GetInstanceTableData(TableTree, tableComponts, formSchemeModel.dbId, keyValue, processIdName, null, res); | |||
foreach (var itemCompont in tableComponts) | |||
{ | |||
foreach (FormCompontModel formitem in itemCompont.Value) | |||
{ | |||
if (formitem.type == "upload") | |||
{ | |||
foreach (var resitem in res) | |||
{ | |||
if (resitem.Value.Rows.Count > 0) | |||
{ | |||
if (resitem.Value.Rows[0][formitem.field] != null) | |||
uploadfieldkeyvalue.Add(formitem.id, resitem.Value.Rows[0][formitem.field].ToString()); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
return uploadfieldkeyvalue; | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 保存自定义表单数据 | |||
/// </summary> | |||
@@ -136,6 +136,8 @@ namespace Learun.Application.Form | |||
/// <param name="schemeInfoId">表单模板主键</param> | |||
/// <param name="keyValue">数据主键值</param> | |||
void DeleteInstanceForm(string schemeInfoId, string keyValue); | |||
Dictionary<string, string> GetFolderKey(string itemSchemeInfoId, string itemProcessIdName, string itemKeyValue); | |||
#endregion | |||
} | |||
} |
@@ -2220,14 +2220,16 @@ group by AcademicYearNo,Semester,DeptNo,MajorNo,LessonNo,TeachClassNo,EmpNo,Les | |||
try | |||
{ | |||
var strSql = new StringBuilder(); | |||
var queryParam = queryJson.ToJObject(); | |||
strSql.Append("select a.*,b.jobrank as zhiwu,b.F_DepartmentId as dept,b.feestandard,b.Weekcourses,ta.actcourses as monthactcourses,ta.actcourses-(b.Weekcourses*4) as zhesuan_monthactcourses, "); | |||
int month = queryParam["month"] == null ? DateTime.Now.Month : queryParam["month"].ToInt() ; | |||
string starttime = DateTime.Now.Year.ToString()+"-" + month + "-1 00:00:00"; | |||
string endtime = DateTime.Now.Year.ToString() + "-" + month + "-"+ DateTime.DaysInMonth(DateTime.Now.Year, month) +" 23:59:59"; | |||
strSql.Append("select a.*,b.jobrank as zhiwu,b.F_DepartmentId as dept,b.feestandard,b.Weekcourses,ta.actcourses as monthactcourses,ta.actcourses-(b.Weekcourses*"+ (queryParam["weeks"]==null?4: queryParam["weeks"]) + ") as zhesuan_monthactcourses, "); | |||
strSql.Append("case when b.jobrank in('5','6') then (ta.actcourses-4*b.Weekcourses)*b.feestandard "); | |||
strSql.Append("when b.jobrank in(1,2,3,4) then (case when ta.actcourses<=(4*b.weekcourses)/2 then ta.actcourses*b.feestandard else 4*b.weekcourses*b.feestandard/2 end) end as actfeestandard "); | |||
strSql.Append("when b.jobrank in(1,2,3,4) then (case when ta.actcourses<=(" + (queryParam["weeks"]==null ? 4 : queryParam["weeks"]) + "*b.weekcourses)/2 then ta.actcourses*b.feestandard else " + (queryParam["weeks"] == null ? 4 : queryParam["weeks"]) + "*b.weekcourses*b.feestandard/2 end) end as actfeestandard "); | |||
strSql.Append("from "); | |||
strSql.Append("(select count(*) as courses,a.empno,a.empname from ArrangeLessonTerm a where lessondate between '"+ queryParam["StartTime"] + "' and '" + queryParam["EndTime"] + "' group by a.empno,a.empname ) a "); | |||
strSql.Append("left join (select count(*) as actcourses,empno from Teach_attendance where clocktime between '" + queryParam["StartTime"] + "' and '" + queryParam["EndTime"] + "' group by empno) ta on ta.empno=a.empno "); | |||
strSql.Append("(select count(*) as courses,a.empno,a.empname from ArrangeLessonTerm a where lessondate between '"+ starttime + "' and '" + endtime + "' group by a.empno,a.empname ) a "); | |||
strSql.Append("left join (select count(*) as actcourses,empno from Teach_attendance where clocktime between '" + starttime + "' and '" + endtime + "' group by empno) ta on ta.empno=a.empno "); | |||
strSql.Append("left join empinfo b on a.empno=b.empno "); | |||
return this.BaseRepository("CollegeMIS").FindList<LessonStatictisEntity>(strSql.ToString(), pagination); | |||
} | |||