From 89f54d57049d7a37a5a0e5f0cc4b2f7d8871c500 Mon Sep 17 00:00:00 2001 From: ndbs Date: Fri, 3 Nov 2023 08:56:54 +0800 Subject: [PATCH 1/2] =?UTF-8?q?app2.0=E6=B5=81=E7=A8=8B=E8=BF=90=E8=BD=AC?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modules/FormApi.cs | 44 ++++++++- .../Scheme/FormSchemeBLL.cs | 93 ++++++++++++++++++- .../Scheme/FormSchemeIBLL.cs | 2 + 3 files changed, 136 insertions(+), 3 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/FormApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/FormApi.cs index a574ac806..9b4635784 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/FormApi.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/FormApi.cs @@ -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 req = this.GetReqData>();// 获取模板请求数据 + Dictionary dic = new Dictionary(); + 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); + } /// /// 保存表单数据 @@ -137,7 +151,33 @@ namespace Learun.Application.WebApi.Modules /// public string formData { get; set; } } - + private class FolderKeyReq + { + /// + /// 表单请求Id + /// + public string id { get; set; } + /// + /// 当前自定义表单版本号 + /// + public string ver { get; set; } + /// + /// 流程模板id + /// + public string schemeInfoId { get; set; } + /// + /// 关联字段名称 + /// + public string processIdName { get; set; } + /// + /// 数据主键值 + /// + public string keyValue { get; set; } + /// + /// 表单数据 + /// + public string formData { get; set; } + } #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Form/Scheme/FormSchemeBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Form/Scheme/FormSchemeBLL.cs index 1948b9075..e839a8fa2 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Form/Scheme/FormSchemeBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Form/Scheme/FormSchemeBLL.cs @@ -551,7 +551,98 @@ namespace Learun.Application.Form } } } - + + public Dictionary GetFolderKey(string schemeInfoId, string processIdName, string keyValue) + { + Dictionary res = new Dictionary(); + + try + { + FormSchemeInfoEntity formSchemeInfoEntity = GetSchemeInfoEntity(schemeInfoId); + FormSchemeEntity formSchemeEntity = GetSchemeEntity(formSchemeInfoEntity.F_SchemeId); + FormSchemeModel formSchemeModel = formSchemeEntity.F_Scheme.ToObject(); + + // 确定主从表之间的关系 + List> TableTree = new List>();// 从表 + foreach (var table in formSchemeModel.dbTable) + { + TreeModelEx treeone = new TreeModelEx(); + 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> tableComponts = new Dictionary>(); + 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(); + } + if (compont.type == "upload") + { + hasupload = true; + tableComponts[compont.table].Add(compont); + } + if (compont.type == "guid") + { + tableComponts[compont.table].Add(compont); + } + + } + } + } + Dictionary uploadfieldkeyvalue = new Dictionary(); + + 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); + } + } + } + /// /// 保存自定义表单数据 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Form/Scheme/FormSchemeIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Form/Scheme/FormSchemeIBLL.cs index 571d48c9d..a474315d2 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Form/Scheme/FormSchemeIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Form/Scheme/FormSchemeIBLL.cs @@ -136,6 +136,8 @@ namespace Learun.Application.Form /// 表单模板主键 /// 数据主键值 void DeleteInstanceForm(string schemeInfoId, string keyValue); + + Dictionary GetFolderKey(string itemSchemeInfoId, string itemProcessIdName, string itemKeyValue); #endregion } } From 7aba536c09f2fec91d9f6e3101eca13b15e41de5 Mon Sep 17 00:00:00 2001 From: hwh2023 <598694955@qq.com> Date: Fri, 3 Nov 2023 18:17:34 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=AF=BE=E6=97=B6=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ArrangeLessonTerm/coursestatictis.cshtml | 3 + .../ArrangeLessonTerm/coursestatictis.js | 75 +++++++++++-------- .../ArrangeLessonTermService.cs | 12 +-- 3 files changed, 55 insertions(+), 35 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTerm/coursestatictis.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTerm/coursestatictis.cshtml index 7ae17aae2..8de67efeb 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTerm/coursestatictis.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTerm/coursestatictis.cshtml @@ -10,6 +10,9 @@
+
+
+
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTerm/coursestatictis.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTerm/coursestatictis.js index b7ac7336d..5c2118645 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTerm/coursestatictis.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTerm/coursestatictis.js @@ -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) }); } }; diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs index 12ba481ed..ce44a540e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs @@ -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(strSql.ToString(), pagination); }