From ae0b8b527810cda77365d7033dd86503cc8d2a45 Mon Sep 17 00:00:00 2001 From: ndbs Date: Thu, 14 Sep 2023 12:26:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=9B=E7=94=9F=E6=9D=A5=E6=BA=90=E8=AE=A1?= =?UTF-8?q?=E5=88=92,=E6=8B=9B=E7=94=9F=E6=9D=A5=E6=BA=90=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=9B=9E=E6=98=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EnrollmentMajorPlanSourceController.cs | 21 +- .../EnrollmentMajorPlanSource/Form.cshtml | 14 +- .../Views/EnrollmentMajorPlanSource/Form.js | 13 +- .../SourceIndex.cshtml | 39 ++++ .../EnrollmentMajorPlanSource/SourceIndex.js | 210 ++++++++++++++++++ .../Learun.Application.Web.csproj | 2 + .../EnrollmentMajorPlanSourceService.cs | 53 ++++- 7 files changed, 327 insertions(+), 25 deletions(-) create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AdmissionsPlatform/Views/EnrollmentMajorPlanSource/SourceIndex.cshtml create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AdmissionsPlatform/Views/EnrollmentMajorPlanSource/SourceIndex.js diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AdmissionsPlatform/Controllers/EnrollmentMajorPlanSourceController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AdmissionsPlatform/Controllers/EnrollmentMajorPlanSourceController.cs index 9791be16f..9ab83decc 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AdmissionsPlatform/Controllers/EnrollmentMajorPlanSourceController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AdmissionsPlatform/Controllers/EnrollmentMajorPlanSourceController.cs @@ -25,7 +25,7 @@ namespace Learun.Application.Web.Areas.AdmissionsPlatform.Controllers [HttpGet] public ActionResult Index() { - return View(); + return View(); } /// /// 表单页 @@ -34,7 +34,12 @@ namespace Learun.Application.Web.Areas.AdmissionsPlatform.Controllers [HttpGet] public ActionResult Form() { - return View(); + return View(); + } + + public ActionResult SourceIndex() + { + return View(); } #endregion @@ -47,7 +52,7 @@ namespace Learun.Application.Web.Areas.AdmissionsPlatform.Controllers /// [HttpGet] [AjaxOnly] - public ActionResult GetList( string queryJson ) + public ActionResult GetList(string queryJson) { var data = enrollmentMajorPlanSourceIBLL.GetList(queryJson); return Success(data); @@ -82,8 +87,12 @@ namespace Learun.Application.Web.Areas.AdmissionsPlatform.Controllers [AjaxOnly] public ActionResult GetFormData(string keyValue) { - var data = enrollmentMajorPlanSourceIBLL.GetEntity(keyValue); - return Success(data); + var EnrollmentMajorPlanSourceData = enrollmentMajorPlanSourceIBLL.GetEntity(keyValue); + var jsonData = new + { + EnrollmentMajorPlanSource = EnrollmentMajorPlanSourceData, + }; + return Success(jsonData); } #endregion @@ -110,7 +119,7 @@ namespace Learun.Application.Web.Areas.AdmissionsPlatform.Controllers [HttpPost] [ValidateAntiForgeryToken] [AjaxOnly] - public ActionResult SaveForm(string keyValue,EnrollmentMajorPlanSourceEntity entity) + public ActionResult SaveForm(string keyValue, EnrollmentMajorPlanSourceEntity entity) { enrollmentMajorPlanSourceIBLL.SaveEntity(keyValue, entity); return Success("保存成功!"); diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AdmissionsPlatform/Views/EnrollmentMajorPlanSource/Form.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AdmissionsPlatform/Views/EnrollmentMajorPlanSource/Form.cshtml index 65b97d65b..07bed2e30 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AdmissionsPlatform/Views/EnrollmentMajorPlanSource/Form.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AdmissionsPlatform/Views/EnrollmentMajorPlanSource/Form.cshtml @@ -3,31 +3,31 @@ Layout = "~/Views/Shared/_Form.cshtml"; }
-
+
专业计划*
-
+
*
-
+
*
-
+
*
-
+
已录人数*
-
+
人数*
-
+
备注*
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AdmissionsPlatform/Views/EnrollmentMajorPlanSource/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AdmissionsPlatform/Views/EnrollmentMajorPlanSource/Form.js index 15916683e..bf0efc5bb 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AdmissionsPlatform/Views/EnrollmentMajorPlanSource/Form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AdmissionsPlatform/Views/EnrollmentMajorPlanSource/Form.js @@ -117,8 +117,17 @@ var bootstrap = function ($, learun) { }); }, initData: function () { - if (!!selectedRow) { - $('#form').lrSetFormData(selectedRow); + if (!!keyValue) { + $.lrSetForm(top.$.rootUrl + '/AdmissionsPlatform/EnrollmentMajorPlanSource/GetFormData?keyValue=' + keyValue, function (data) { + for (var id in data) { + if (!!data[id].length && data[id].length > 0) { + $('#' + id).jfGridSet('refreshdata', data[id]); + } + else { + $('[data-table="' + id + '"]').lrSetFormData(data[id]); + } + } + }); } } }; diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AdmissionsPlatform/Views/EnrollmentMajorPlanSource/SourceIndex.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AdmissionsPlatform/Views/EnrollmentMajorPlanSource/SourceIndex.cshtml new file mode 100644 index 000000000..65eb09d1c --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AdmissionsPlatform/Views/EnrollmentMajorPlanSource/SourceIndex.cshtml @@ -0,0 +1,39 @@ +@{ + ViewBag.Title = "EnrollmentMajorPlan"; + Layout = "~/Views/Shared/_Index.cshtml"; +} +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+@Html.AppendJsFile("/Areas/AdmissionsPlatform/Views/EnrollmentMajorPlanSource/SourceIndex.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AdmissionsPlatform/Views/EnrollmentMajorPlanSource/SourceIndex.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AdmissionsPlatform/Views/EnrollmentMajorPlanSource/SourceIndex.js new file mode 100644 index 000000000..6b0f7f1e2 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AdmissionsPlatform/Views/EnrollmentMajorPlanSource/SourceIndex.js @@ -0,0 +1,210 @@ +/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) + * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + * 创建人:超级管理员 + * 日 期:2023-09-11 14:55 + * 描 述:EnrollmentMajorPlan + */ +var refreshGirdData; +var bootstrap = function ($, learun) { + "use strict"; + var page = { + init: function () { + page.initGird(); + page.bind(); + }, + bind: function () { + $('#multiple_condition_query').lrMultipleQuery(function (queryJson) { + page.search(queryJson); + }, 220, 400); + $('#ProvinceNo').lrDataSourceSelect({ + code: 'DIC_PROVINCE', value: 'pcode', text: 'pname', + select: function (item) { + if (!!item) { + $('#CityNo').lrselectRefresh({ + url: "/DIC_CITY/GetListByProvinceCode", + param: { ProvinceCode: item.pcode }, + value: 'CCODE', + text: 'CNAME' + }); + $('#RegionNo').lrselectRefresh({ + url: "", + data: [] + }); + } + } + }); + $('#CityNo').lrselect({ + select: function (item) { + if (!!item) { + $('#AreaNo').lrselectRefresh({ + url: top.$.rootUrl + "/DIC_AREA/GetAreasListByCityCode", + param: { cityCode: item.CCODE }, + value: 'ACODE', + text: 'ANAME' + }); + } + } + }); + $('#AreaNo').lrselect(); + // 刷新 + $('#lr_refresh').on('click', function () { + location.reload(); + }); + // 新增 + $('#lr_add').on('click', function () { + learun.layerForm({ + id: 'form', + title: '新增', + url: top.$.rootUrl + '/AdmissionsPlatform/EnrollmentMajorPlan/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)) { + if (keyValue.indexOf(',') != -1) { + learun.alert.warning("只能选择一条记录进行编辑!"); + return; + } + var CheckMark = $('#gridtable').jfGridValue('CheckMark'); + if (CheckMark == true) { + learun.alert.warning("当前项目已审核不能编辑!"); + return; + } + learun.layerForm({ + id: 'form', + title: '编辑', + url: top.$.rootUrl + '/AdmissionsPlatform/EnrollmentMajorPlan/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)) { + var CheckMark = $('#gridtable').jfGridValue('CheckMark'); + if (CheckMark == true) { + learun.alert.warning("选中项已审核不能删除!"); + return; + } + learun.layerConfirm('是否确认删除该项!', function (res) { + if (res) { + learun.deleteForm(top.$.rootUrl + '/AdmissionsPlatform/EnrollmentMajorPlan/DeleteForm', { keyValue: keyValue }, function () { + refreshGirdData(); + }); + } + }); + } + }); + //启用 + $('#lr_check').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('ID'); + if (learun.checkrow(keyValue)) { + var CheckMark = $('#gridtable').jfGridValue('CheckMark'); + if (CheckMark.indexOf('1') != -1) { + learun.alert.warning("选中记录中包含已审核项目!"); + return; + } + learun.layerConfirm('是否审核选中项!', function (res) { + if (res) { + learun.postForm(top.$.rootUrl + '/AdmissionsPlatform/EnrollmentMajorPlan/EnableDisable', { keyValue: keyValue, status: "1" }, function () { + refreshGirdData(); + }); + } + }); + } + }); + //禁用 + $('#lr_uncheck').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('ID'); + if (learun.checkrow(keyValue)) { + var CheckMark = $('#gridtable').jfGridValue('CheckMark'); + if (CheckMark.indexOf('0') != -1) { + learun.alert.warning("选中记录中包含未审核项目!"); + return; + } + learun.layerConfirm('是否去审核选中项!', function (res) { + if (res) { + learun.postForm(top.$.rootUrl + '/AdmissionsPlatform/EnrollmentMajorPlan/EnableDisable', { keyValue: keyValue, status: "0" }, function () { + refreshGirdData(); + }); + } + }); + } + }); + // 打印 + $('#lr_print').on('click', function () { + $('#gridtable').jqprintTable(); + }); + }, + // 初始化列表 + initGird: function () { + $('#gridtable').jfGrid({ + url: top.$.rootUrl + '/AdmissionsPlatform/EnrollmentMajorPlanSource/GetList', + headData: [ + { + label: '省', name: 'ProvinceNo', width: 200, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'DIC_PROVINCE', + key: value, + keyId: 'pcode', + callback: function (_data) { + callback(_data['pname']); + } + }); + } + }, + { + label: '市', name: 'CityNo', width: 200, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'DIC_CITY', + key: value, + keyId: 'ccode', + callback: function (_data) { + callback(_data['cname']); + } + }); + } + }, + { + label: '县', name: 'AreaNo', width: 200, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'DIC_AREA', + key: value, + keyId: 'acode', + callback: function (_data) { + callback(_data['aname']); + } + }); + } + }, + + { label: '人数', name: 'Num', width: 200, align: "left" }, + ], + mainId: 'ID', + }); + page.search(); + }, + search: function (param) { + param = param || {}; + $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); + } + }; + refreshGirdData = function () { + $('#gridtable').jfGridSet('reload'); + }; + page.init(); +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj index c7325d994..f841b27ad 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj @@ -906,6 +906,7 @@ + @@ -8301,6 +8302,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AdmissionsPlatform/EnrollmentMajorPlanSource/EnrollmentMajorPlanSourceService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AdmissionsPlatform/EnrollmentMajorPlanSource/EnrollmentMajorPlanSourceService.cs index e27c75adb..551e2f361 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AdmissionsPlatform/EnrollmentMajorPlanSource/EnrollmentMajorPlanSourceService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AdmissionsPlatform/EnrollmentMajorPlanSource/EnrollmentMajorPlanSourceService.cs @@ -40,16 +40,30 @@ namespace Learun.Application.TwoDevelopment.AdmissionsPlatform { try { - //参考写法 - //var queryParam = queryJson.ToJObject(); - // 虚拟参数 - //var dp = new DynamicParameters(new { }); - //dp.Add("startTime", queryParam["StartTime"].ToDate(), DbType.DateTime); var strSql = new StringBuilder(); - strSql.Append("SELECT "); - strSql.Append(fieldSql); - strSql.Append(" FROM EnrollmentMajorPlanSource t "); - return this.BaseRepository("CollegeMIS").FindList(strSql.ToString()); + strSql.Append(@" select ProvinceNo,CityNo,AreaNo,sum(num) as num +from EnrollmentMajorPlanSource t"); + strSql.Append(" WHERE 1=1 "); + var queryParam = queryJson.ToJObject(); + var dp = new DynamicParameters(new { }); + // 虚拟参数 + if (!queryParam["ProvinceNo"].IsEmpty()) + { + dp.Add("ProvinceNo", queryParam["ProvinceNo"].ToString(), DbType.String); + strSql.Append(" AND t.ProvinceNo = @ProvinceNo "); + } + if (!queryParam["CityNo"].IsEmpty()) + { + dp.Add("CityNo", queryParam["CityNo"].ToString(), DbType.String); + strSql.Append(" AND t.CityNo = @CityNo "); + } + if (!queryParam["AreaNo"].IsEmpty()) + { + dp.Add("AreaNo", queryParam["AreaNo"].ToString(), DbType.String); + strSql.Append(" AND t.AreaNo = @AreaNo "); + } + strSql.Append(" Group by ProvinceNo,CityNo,AreaNo "); + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp); } catch (Exception ex) { @@ -78,7 +92,26 @@ namespace Learun.Application.TwoDevelopment.AdmissionsPlatform strSql.Append("SELECT "); strSql.Append(fieldSql); strSql.Append(" FROM EnrollmentMajorPlanSource t "); - return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), pagination); + strSql.Append(" WHERE 1=1 "); + var queryParam = queryJson.ToJObject(); + var dp = new DynamicParameters(new { }); + // 虚拟参数 + if (!queryParam["ProvinceNo"].IsEmpty()) + { + dp.Add("ProvinceNo", queryParam["ProvinceNo"].ToString(), DbType.String); + strSql.Append(" AND t.ProvinceNo = @ProvinceNo "); + } + if (!queryParam["CityNo"].IsEmpty()) + { + dp.Add("CityNo", queryParam["CityNo"].ToString(), DbType.String); + strSql.Append(" AND t.CityNo = @CityNo "); + } + if (!queryParam["AreaNo"].IsEmpty()) + { + dp.Add("AreaNo", queryParam["AreaNo"].ToString(), DbType.String); + strSql.Append(" AND t.AreaNo = @AreaNo "); + } + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp, pagination); } catch (Exception ex) {