From 6fa85478cafce3a30e105f6897af64e22444cf8d Mon Sep 17 00:00:00 2001 From: zhangli <1109134334@qq.com> Date: Fri, 18 Feb 2022 10:43:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=BF=E8=88=8D=E5=88=86=E9=85=8D=E7=B3=BB?= =?UTF-8?q?=20=20=E4=B8=93=E4=B8=9A=20=E7=8F=AD=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/AccommodationController.cs | 51 +- .../Views/Accommodation/DormitoryAdd.cshtml | 8 +- .../Views/Accommodation/Form.cshtml | 4 +- .../Views/Accommodation/Form.js | 2 +- .../Views/Accommodation/FormClass.cshtml | 19 + .../Views/Accommodation/FormClass.js | 82 +++ .../Views/Accommodation/FormDept.cshtml | 15 + .../Views/Accommodation/FormDept.js | 56 ++ .../Views/Accommodation/Index.js | 17 +- .../Accommodation/IndexDistribution.cshtml | 92 +++ .../Views/Accommodation/IndexDistribution.js | 580 ++++++++++++++++++ .../Learun.Application.Web.csproj | 7 + .../Accommodation/Acc_DormitoryBuildEntity.cs | 9 +- .../Accommodation/AccommodationBLL.cs | 23 + .../Accommodation/AccommodationIBLL.cs | 1 + .../Accommodation/AccommodationService.cs | 46 +- 16 files changed, 976 insertions(+), 36 deletions(-) create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormClass.cshtml create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormClass.js create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormDept.cshtml create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormDept.js create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexDistribution.cshtml create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexDistribution.js diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/AccommodationController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/AccommodationController.cs index 26194b945..64c1ec87e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/AccommodationController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/AccommodationController.cs @@ -33,15 +33,15 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers { return View(); } - ///// - ///// 表单页 - ///// - ///// - //[HttpGet] - //public ActionResult Form() - //{ - // return View(); - //} + /// + /// 分配宿舍 + /// + /// + [HttpGet] + public ActionResult IndexDistribution() + { + return View(); + } /// /// 带参数的表单页 @@ -143,7 +143,15 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers return View(); } - + /// + /// 分配系 + /// + /// + [HttpGet] + public ActionResult FormDept() + { + return View(); + } /// /// 分配专业和班级 @@ -200,6 +208,15 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers return View(); } + /// + /// 分配专业和班级 + /// + /// + [HttpGet] + public ActionResult FormClass() + { + return View(); + } #endregion @@ -385,6 +402,20 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers return Success("保存成功!"); } + /// + /// 寝室分配系 + /// 主键 + /// + /// + [HttpPost] + [ValidateAntiForgeryToken] + [AjaxOnly] + public ActionResult SaveDeptClass(string keyValue, string strEntity,int type) + { + Acc_DormitoryBuildEntity entity = strEntity.ToObject(); + accommodationIBLL.SaveDeptClass(keyValue, entity, type); + return Success("保存成功!"); + } /// /// 学生宿舍的单元、楼层、房间、床位添加 diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/DormitoryAdd.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/DormitoryAdd.cshtml index c4a23803c..a1028a631 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/DormitoryAdd.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/DormitoryAdd.cshtml @@ -8,19 +8,19 @@
每栋楼单元数量
- +
每单元楼层数量
- +
每楼层房间数量
- +
每房间床位数量
- +
@Html.AppendJsFile("/Areas/LogisticsManagement/Views/Accommodation/DormitoryAdd.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Form.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Form.cshtml index bf8ed99d3..970177fa4 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Form.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Form.cshtml @@ -76,8 +76,8 @@
-
类型
-
+
几人寝*
+
星级
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Form.js index 1ce9bef9a..38b25fdd2 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Form.js @@ -25,7 +25,7 @@ var bootstrap = function ($, learun) { code: 'HasToilet', }) $('#BuildType').lrDataItemSelect({ code: 'BuildType' }); - $('#RoomType').lrDataItemSelect({ code: 'RoomType' }); + //$('#StudentID').lrDataSourceSelect({ code: 'StuInfoBasic', value: 'stuid', text: 'stuname' }); //$('#StudentID').lrDataSourceSelect({ code: 'StuInfoTwo', value: 'stuid', text: 'stuname' }); $('#StudentID').lrselect({ diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormClass.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormClass.cshtml new file mode 100644 index 000000000..ce82c9480 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormClass.cshtml @@ -0,0 +1,19 @@ + +@{ + ViewBag.Title = "FormClass"; + Layout = "~/Views/Shared/_Form.cshtml"; +} + +
+
+
专业*
+
+
+
+
班级*
+
+
+
+@Html.AppendJsFile("/Areas/LogisticsManagement/Views/Accommodation/FormClass.js") + + diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormClass.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormClass.js new file mode 100644 index 000000000..4a3fd0578 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormClass.js @@ -0,0 +1,82 @@ +/* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn) + * Copyright (c) 2013-2018 北京泉江科技有限公司 + * 创建人:超级管理员 + * 日 期:2019-04-26 15:02 + * 描 述:学生宿舍管理 + */ +var acceptClick; +var Dept = request('Dept'); +var keyValue = request('keyValue'); +var bootstrap = function ($, learun) { + "use strict"; + var page = { + init: function () { + $('.lr-form-wrap').lrscroll(); + page.bind(); + page.initData(); + }, + bind: function () { + + $('#Class').lrselect({ + value: "classno", + text: "classname" + }); + + $('#Major').lrselect({ + value: "majorno", + text: "majorname", + url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable', + param: { code: "CdMajorInfo", strWhere: "DeptNo='" + Dept + "'" }, + select: function (item) { + if (item) { + $('#Class').lrselectRefresh({ + url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable', + param: { code: "bjsj", strWhere: "DeptNo='" + item.deptno + "' and majorno='" + item.majorno + "'" } + }); + } + + } + }); + + + $('#Class').on("click", + function () { + //var data1 = $('#Dept').lrselectGet(); + var data2 = $('#Major').lrselectGet(); + if (!data2) { + learun.alert.error('请先选择专业'); + } + }); + }, + initData: function () { + if (!!keyValue) { + $.lrSetForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/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]); + } + } + }); + } + }, + }; + // 保存数据 + acceptClick = function (callBack) { + if (!$('body').lrValidform()) { + return false; + } + var postData = { + strEntity: JSON.stringify($('body').lrGetFormData()) + }; + $.lrSaveForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/SaveDeptClass?type=2&keyValue=' + keyValue, postData, function (res) { + // 保存成功后才回调 + if (!!callBack) { + callBack(); + } + }); + }; + page.init(); +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormDept.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormDept.cshtml new file mode 100644 index 000000000..702e24d59 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormDept.cshtml @@ -0,0 +1,15 @@ + +@{ + ViewBag.Title = "Allocation"; + Layout = "~/Views/Shared/_Form.cshtml"; +} + +
+
+
系部*
+
+
+
+@Html.AppendJsFile("/Areas/LogisticsManagement/Views/Accommodation/FormDept.js") + + diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormDept.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormDept.js new file mode 100644 index 000000000..f945452d6 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormDept.js @@ -0,0 +1,56 @@ +/* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn) + * Copyright (c) 2013-2018 北京泉江科技有限公司 + * 创建人:超级管理员 + * 日 期:2019-04-26 15:02 + * 描 述:学生宿舍管理 + */ +var acceptClick; +var keyValue = request('keyValue'); +var bootstrap = function ($, learun) { + "use strict"; + var page = { + init: function () { + $('.lr-form-wrap').lrscroll(); + page.bind(); + page.initData(); + }, + bind: function () { + $('#Dept').lrselect({ + value: "deptno", + text: "deptname", + url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=CdDeptInfo', + allowSearch:true + }); + }, + initData: function () { + if (!!keyValue) { + $.lrSetForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/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]); + } + } + }); + } + }, + }; + // 保存数据 + acceptClick = function (callBack) { + if (!$('body').lrValidform()) { + return false; + } + var postData = { + strEntity: JSON.stringify($('body').lrGetFormData()) + }; + $.lrSaveForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/SaveDeptClass?type=1&keyValue=' + keyValue, postData, function (res) { + // 保存成功后才回调 + if (!!callBack) { + callBack(); + } + }); + }; + page.init(); +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Index.js index 749e04695..3d4756ee6 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Index.js @@ -56,7 +56,7 @@ var bootstrap = function ($, learun) { $('#UnitId').lrselect({ allowSearch: true }); $('#FloorId').lrselect({ allowSearch: true }); - $('#Sex').lrDataItemSelect({code: 'usersex'}); + $('#Sex').lrDataItemSelect({ code: 'usersex' }); //.lrRadioCheckbox({ // type: 'radio', // code: 'usersex', @@ -384,16 +384,15 @@ var bootstrap = function ($, learun) { { label: "班级", name: "Class", width: 100, align: "left" }, { label: "寝室类型", name: "RoomType", width: 100, align: "left", - formatterAsync: function (callback, value, row, op, $cell) { - learun.clientdata.getAsync('dataItem', { - key: value, - code: 'RoomType', - callback: function (_data) { - callback(_data.text); - } - }); + formatter: function (value, row) { + if (value) { + return value + '人寝'; + } else { + return ''; + } } }, + { label: "入住人数", name: "CheckInStu", width: 100, align: "left" }, { label: "性别", name: "Sex", width: 100, align: "left", formatter: function (callback, value, row, op, $cell) { diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexDistribution.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexDistribution.cshtml new file mode 100644 index 000000000..2b92a19cb --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexDistribution.cshtml @@ -0,0 +1,92 @@ +@{ + ViewBag.Title = "学生宿舍管理"; + Layout = "~/Views/Shared/_Index.cshtml"; +} +
+
+
+
+ 树形列表 + 刷新 +
+
+
+
+
+
+
+ 列表信息 +
+
+
+
+
+
+
+
名称
+ +
+
+
宿舍楼
+
+
+
+
单元
+
+
+
+
楼层
+
+
+ @*
+
类别
+ +
*@ +
+
+
+
+
+
专业
+
+
+
+
班级
+
+
+
+
性别
+
+
+
+
未分配
+
+
+
+
已分配
+
+
+
+
+
+
+ +
+
+
+
+
+ +@Html.AppendJsFile("/Areas/LogisticsManagement/Views/Accommodation/IndexDistribution.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexDistribution.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexDistribution.js new file mode 100644 index 000000000..86bfb5bce --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexDistribution.js @@ -0,0 +1,580 @@ +/* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn) + * Copyright (c) 2013-2018 北京泉江科技有限公司 + * 创建人:超级管理员 + * 日 期:2019-04-26 15:02 + * 描 述:学生宿舍管理 + */ +var refreshGirdData; +var selectedParent = {}; +var bootstrap = function ($, learun) { + "use strict"; + var page = { + init: function () { + page.initTree(); + page.initGird(); + page.search({ ParentID: '' }); + page.bind(); + + }, + bind: function () { + $('#multiple_condition_query').lrMultipleQuery(function (queryJson) { + page.search(queryJson); + }, 420, 400); + //宿舍楼 + $('#ApartmentId').lrselect({ + allowSearch: true, + url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=DormitoryInfo', + param: { strWhere: " BuildType='1' " }, + value: "id", + text: "name", + select: function (item) { + if (!!item) { + //单元 + $('#UnitId').lrselectRefresh({ + allowSearch: true, + url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=DormitoryInfo', + param: { strWhere: " BuildType='2' and ApartmentId='" + item.id + "'" }, + value: "id", + text: "name", + select: function (item) { + if (!!item) { + //楼层 + $('#FloorId').lrselectRefresh({ + allowSearch: true, + url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=DormitoryInfo', + param: { strWhere: " BuildType='3' and UnitId='" + item.id + "'" }, + value: "id", + text: "name" + }); + } + } + }); + } + } + }); + $('#UnitId').lrselect({ allowSearch: true }); + $('#FloorId').lrselect({ allowSearch: true }); + + $('#Sex').lrDataItemSelect({ code: 'usersex' }); + //.lrRadioCheckbox({ + // type: 'radio', + // code: 'usersex', + //}); + + $('#NoDistribution').lrRadioCheckbox({ + type: 'checkbox', + code: 'NoDistribution' + }); + + $('#Distribution').lrRadioCheckbox({ + type: 'checkbox', + code: 'NoDistribution' + }); + + + $('#Class').lrselect({ + value: "classno", + text: "classname" + }); + + $('#Dept').lrselect({ + value: "deptno", + text: "deptname", + url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=CdDeptInfo', + select: function (item) { + if (item) { + $('#Major').lrselectRefresh({ + url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable', + param: { code: "CdMajorInfo", strWhere: "DeptNo='" + item.deptno + "'" } + }); + } + else { + $('#Major').lrselectRefresh({ + url: "", + data: [] + }); + } + $('#Class').lrselectRefresh({ + url: "", + data: [] + }); + } + }); + $('#Major').lrselect({ + value: "majorno", + text: "majorname", + select: function (item) { + if (item) { + $('#Class').lrselectRefresh({ + url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable', + param: { code: "bjsj", strWhere: "DeptNo='" + item.deptno + "' and majorno='" + item.majorno + "'" } + }); + } + + } + }); + + + $('#Major').on("click", + function () { + var data = $('#Dept').lrselectGet(); + if (!data) { + learun.alert.error('请先选择系'); + } + }); + $('#Class').on("click", + function () { + var data1 = $('#Dept').lrselectGet(); + var data2 = $('#Major').lrselectGet(); + if (!data1 || !data2) { + learun.alert.error('请先选择系和专业'); + } + }); + + // 刷新 + $('#lr_refresh').on('click', function () { + location.reload(); + }); + // 新增 + $('#lr_add').on('click', function () { + var url = ""; + if (selectedParent.ID != null) { + url = top.$.rootUrl + '/LogisticsManagement/Accommodation/Form?ParentID=' + selectedParent.ID + '&ParentName=' + selectedParent.Name; + } else { + return learun.alert.warning("请选择上级!"); + //url = top.$.rootUrl + '/LogisticsManagement/Accommodation/Form'; + } + learun.layerForm({ + id: 'form', + title: '新增', + url: url, + width: 900, + height: 550, + 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 false; + } + learun.layerForm({ + id: 'form', + title: '编辑', + url: top.$.rootUrl + '/LogisticsManagement/Accommodation/Form?keyValue=' + keyValue, + width: 900, + height: 550, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + } + }); + // 删除 + $('#lr_delete').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('ID'); + if (learun.checkrow(keyValue)) { + learun.layerConfirm('是否确认删除该项!', function (res) { + if (res) { + learun.deleteForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/DeleteForm', { keyValue: keyValue }, function () { + refreshGirdData(); + }); + } + }); + } + }); + //批量添加宿舍 + $("#lr_dormitoryAdd").on("click", function () { + var keyvalue1 = $("#gridtable").jfGridValue("ID"); + if (selectedParent.ChildType == "2") { + var keyValue = selectedParent.ID; + learun.layerForm({ + id: 'form', + title: '批量添加宿舍', + url: top.$.rootUrl + '/LogisticsManagement/Accommodation/DormitoryAdd?keyValue=' + keyValue, + width: 600, + height: 400, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + + + } + else { + learun.alert.warning("请选择楼"); + + } + + }); + // 打印 + $('#lr_print').on('click', function () { + $('#gridtable').jqprintTable(); + }); + //刷新左侧的树 + $("#tree_refresh").on("click", function () { + page.initTree(); + + }); + //分配系 + $("#lr_Dept").on("click", function () { + var keyValue = $('#gridtable').jfGridValue('ID'); + var BuildType = $('#gridtable').jfGridValue('BuildType'); + var Dept = $('#gridtable').jfGridValue('Dept'); + var arr = BuildType.split(','); + if (arr.some(x => x != '4')) { + return learun.alert.warning("只能选择宿舍进行分配!"); + } + if (keyValue.indexOf(',') > 0) { + var arrDept = Dept.split(','); + for (var i = 0; i < arrDept.length; i++) { + if (arrDept[i].length >= 1) { + learun.alert.warning("选中记录包含已分配的数据!"); + return false; + } + } + } + learun.layerForm({ + id: 'formDept', + title: '分配系部', + url: top.$.rootUrl + '/LogisticsManagement/Accommodation/FormDept?keyValue=' + keyValue, + width: 400, + height: 300, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + }); + + //分配专业和班级 + $("#lr_Class").on("click", function () { + var keyValue = $('#gridtable').jfGridValue('ID'); + var BuildType = $('#gridtable').jfGridValue('BuildType'); + var Dept = $('#gridtable').jfGridValue('Dept'); + var arr = BuildType.split(','); + if (arr.some(x => x != '4')) { + return learun.alert.warning("只能选择宿舍进行分配!"); + } + var arrDept = Dept.split(','); + if (keyValue.indexOf(',') > 0) { + if (arrDept.some(function(value, index) { + return value.length == 0; + })) { + return learun.alert.warning("选中记录包含未分配专业的数据!"); + } + if (arrDept.some(function (value, index) { + return value != arrDept[0]; + })) { + return learun.alert.warning("选中记录包含多种专业的数据,不可批量分配班级!"); + } + } + learun.layerForm({ + id: 'formDept', + title: '分配专业班级', + url: top.$.rootUrl + '/LogisticsManagement/Accommodation/FormClass?keyValue=' + keyValue + '&Dept=' + arrDept[0], + width: 400, + height: 300, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + }); + }, + //初始化左侧树 + initTree: function () { + // 初始化左侧树形数据 + $('#dataTree').lrtree({ + url: top.$.rootUrl + '/LogisticsManagement/Accommodation/GetTree', + nodeClick: function (item) { + selectedParent.ID = item.value; + selectedParent.Name = item.text; + selectedParent.BuildType = item.title; + if (item.parent) { + if (!item.parent.parentId) { + selectedParent.ChildType = "2"; + } else { + selectedParent.ChildType = "0"; + } + } + else { + selectedParent.ChildType = "1"; + } + if (item.text.indexOf("室") > -1) { + selectedParent.ChildType = "5"; + } + page.initGird(); + page.search({ ParentID: item.value }); + } + }); + }, + // 初始化列表 + initGird: function () { + $("#gridtable").empty(); + $("#gridtable")[0].dfop = undefined; + if (selectedParent.BuildType == undefined || selectedParent.BuildType === "3") { + //宿舍数据 + $('#gridtable').jfGrid({ + url: top.$.rootUrl + '/LogisticsManagement/Accommodation/GetPageList', + headData: [ + { label: "名称", name: "Name", width: 100, align: "left" }, + { + label: "宿舍楼", name: "ApartmentName", width: 100, align: "left" + }, + { + label: "单元", name: "UnitName", width: 100, align: "left" + }, + { + label: "楼层", name: "FloorName", width: 100, align: "left" + }, + //{ + // label: "学生", name: "StudentID", width: 100, align: "left", + // formatterAsync: function (callback, value, row, op, $cell) { + + // learun.clientdata.getAsync('custmerData', { + // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'StuInfoBasic', + // key: value, + // keyId: 'stuid', + // callback: function (_data) { + // callback(_data['stuname']); + // } + // }); + // } + //}, + { label: "位置", name: "Address", width: 100, align: "left" }, + { + label: "校区", name: "Campus", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'company', + key: value, + keyId: 'f_companyid', + callback: function (_data) { + callback(_data['f_fullname']); + } + }); + } + }, + { + label: "系", name: "Dept", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo', + key: value, + keyId: 'deptno', + callback: function (_data) { + callback(_data['deptname']); + } + }); + } + }, + { + label: "专业", name: "Major", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo', + key: value, + keyId: 'majorno', + callback: function (_data) { + callback(_data['majorname']); + } + }); + } + }, + { + label: "班级", name: "Class", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'bjsj', + key: value, + keyId: 'classno', + callback: function (_data) { + callback(_data['classname']); + } + }); + } }, + { + label: "寝室类型", name: "RoomType", width: 100, align: "left", + formatter: function (value, row) { + if (value) { + return value + '人寝'; + } else { + return ''; + } + } + }, + { label: "入住人数", name: "CheckInStu", width: 100, align: "left" }, + { + label: "性别", name: "Sex", width: 100, align: "left", + formatter: function (callback, value, row, op, $cell) { + if (value == '0') + return '女'; + else if (value == '1') + return '男'; + else + return ''; + } + }, + { label: "负责人", name: "Functionary", width: 100, align: "left" }, + { label: "负责人电话", name: "Phone", width: 100, align: "left" }, + { label: "备注", name: "Remark", width: 100, align: "left" }, + ], + mainId: 'ID', + isPage: true, + isMultiselect: true, + sidx: 'CheckInStu desc,ApartmentId asc,UnitId asc ,FloorId asc ', + //sord: 'ASC', + isSubGrid: true, // 是否有子表 + subGridExpanded: function (subContentId, rowItem) { + $('#' + subContentId).jfGrid({ + url: top.$.rootUrl + '/LogisticsManagement/Accommodation/GetBedListByRoomId?RoomId=' + rowItem.ID, + headData: [ + { label: "名称", name: "Name", width: 100, align: "left" }, + { + label: "学生", name: "StudentID", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'StuInfoBasic', + key: value, + keyId: 'stuid', + callback: function (_data) { + callback(_data['stuname']); + } + }); + } + }, + ], + mainId: 'ID', + isPage: false, + //sidx: 'DNo', + //sord: 'ASC', + }); + //var param; + //param = param || {}; + //param.ParentID = rowItem.Id; + $('#' + subContentId).jfGridSet('reload'); + }, + subGridHeight: 250, + }); + } else { + //lrAuthorizeJfGridLei + $('#gridtable').jfGrid({ + url: top.$.rootUrl + '/LogisticsManagement/Accommodation/GetPageList', + headData: [ + { label: "名称", name: "Name", width: 100, align: "left" }, + { + label: "宿舍楼", name: "ApartmentName", width: 100, align: "left" + }, + { + label: "单元", name: "UnitName", width: 100, align: "left" + }, + { + label: "楼层", name: "FloorName", width: 100, align: "left" + }, + //{ + // label: "学生", name: "StudentID", width: 100, align: "left", + // formatterAsync: function (callback, value, row, op, $cell) { + + // learun.clientdata.getAsync('custmerData', { + // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'StuInfoBasic', + // key: value, + // keyId: 'stuid', + // callback: function (_data) { + // callback(_data['stuname']); + // } + // }); + // } + //}, + { label: "位置", name: "Address", width: 100, align: "left" }, + { + label: "校区", name: "Campus", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'company', + key: value, + keyId: 'f_companyid', + callback: function (_data) { + callback(_data['f_fullname']); + } + }); + } + }, + //{ + // label: "系", name: "Dept", width: 100, align: "left", + // formatterAsync: function (callback, value, row, op, $cell) { + // learun.clientdata.getAsync('custmerData', { + // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo', + // key: value, + // keyId: 'deptno', + // callback: function (_data) { + // callback(_data['deptname']); + // } + // }); + // } + //}, + //{ + // label: "专业", name: "Major", width: 100, align: "left", + // formatterAsync: function (callback, value, row, op, $cell) { + // learun.clientdata.getAsync('custmerData', { + // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo', + // key: value, + // keyId: 'id', + // callback: function (_data) { + // callback(_data['majorname']); + // } + // }); + // } + //}, + //{ label: "班级", name: "Class", width: 100, align: "left" }, + //{ + // label: "性别", name: "Sex", width: 100, align: "left", + // formatterAsync: function (callback, value, row, op, $cell) { + // learun.clientdata.getAsync('dataItem', { + // key: value, + // code: 'usersex', + // callback: function (_data) { + // callback(_data.text); + // } + // }); + // } + //}, + { label: "负责人", name: "Functionary", width: 100, align: "left" }, + { label: "负责人电话", name: "Phone", width: 100, align: "left" }, + { label: "备注", name: "Remark", width: 100, align: "left" }, + ], + mainId: 'ID', + isPage: true, + //isMultiselect: true + //sidx: 'ApartmentId asc,UnitId asc ,FloorId asc ', + //sord: 'ASC', + }); + } + + //page.search(); + }, + search: function (param) { + //console.log(param); + + param = param || {}; + $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); + } + }; + refreshGirdData = function () { + //page.initTree(); + if (!!selectedParent.ID) { + //var param = { ParentID: selectedParent.ID }; + //$('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); + page.initTree(); + page.search({ ParentID: selectedParent.ID }); + } else { + page.initTree(); + page.search(); + } + }; + 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 27413dd16..b836e691e 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 @@ -1300,6 +1300,8 @@ + + @@ -1307,6 +1309,7 @@ + @@ -7575,6 +7578,10 @@ + + + + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/Acc_DormitoryBuildEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/Acc_DormitoryBuildEntity.cs index f47e4e929..3ea342fb6 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/Acc_DormitoryBuildEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/Acc_DormitoryBuildEntity.cs @@ -168,10 +168,15 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement public int? PlanBedNum { get; set; } /// - /// 寝室类型 + /// 寝室类型(几人寝) /// [Column("ROOMTYPE")] - public string RoomType { get; set; } + public int? RoomType { get; set; } + /// + /// 入住人数 + /// + [Column("CHECKINSTU")] + public int? CheckInStu { get; set; } #endregion #region 扩展字段 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationBLL.cs index 0b81e8815..554950465 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationBLL.cs @@ -608,6 +608,29 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } } + /// + /// 分配系 + /// + /// + /// + public void SaveDeptClass(string keyValue, Acc_DormitoryBuildEntity entity,int type) + { + try + { + accommodationService.SaveDeptClass(keyValue, entity, type); + } + 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.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationIBLL.cs index 83afc60d6..a98a181e2 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationIBLL.cs @@ -80,6 +80,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement /// /// void SaveEntity(string keyValue, Acc_DormitoryBuildEntity entity); + void SaveDeptClass(string keyValue, Acc_DormitoryBuildEntity entity,int type); /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationService.cs index f41cf4b10..36634c097 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationService.cs @@ -51,8 +51,8 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement t.ParentID, t.Remark, t.Starred, - t.HasToilet, -t.ApartmentId,t.UnitId,t.FloorId, + t.HasToilet,t.RoomType, +t.ApartmentId,t.UnitId,t.FloorId,t.CheckInStu, a.name as ApartmentName,b.name as UnitName,c.Name as FloorName "); strSql.Append(" FROM Acc_DormitoryBuild t "); @@ -170,12 +170,6 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName strSql.Append(" AND t.CheckInStu>0 "); } } - - if (!queryParam["SqlParameter"].IsEmpty()) - { - strSql.Append(queryParam["SqlParameter"].ToString()); - } - return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp, pagination).OrderBy(a => a.Name).ThenBy(a => a.Name).ToList(); } catch (Exception ex) @@ -1146,6 +1140,7 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName Major = dormitory.Major, Phone = dormitory.Phone, Price = dormitory.Price, + RoomType = bedNum, UpdateBy = currentUser.realName, UpdateTime = DateTime.Now, Starred = "3", @@ -1584,6 +1579,41 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName } } + public void SaveDeptClass(string keyValue, Acc_DormitoryBuildEntity entity, int type) + { + try + { + if (keyValue.Contains(",")) + { + keyValue = string.Join("','", keyValue.Split(',')); + } + string sql = $"update Acc_DormitoryBuild set "; + if (type == 1) + { + sql += $" Dept='{entity.Dept}' "; + } + else + { + sql += $"Major='{entity.Major}',Class='{entity.Class}'"; + } + + sql += $" where ID in ('{keyValue}')"; + + this.BaseRepository("CollegeMIS").ExecuteBySql(sql); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + #endregion 提交数据 }