From bc054ef8791de84dc1438c9a7268285978355c05 Mon Sep 17 00:00:00 2001
From: zhangli <1109134334@qq.com>
Date: Fri, 18 Feb 2022 14:28:33 +0800
Subject: [PATCH] =?UTF-8?q?=E5=88=86=E9=85=8D=E5=AE=BF=E8=88=8D=E3=80=90?=
=?UTF-8?q?=E6=9C=AA=E5=AE=8C=E6=88=90=E3=80=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Controllers/AccommodationController.cs | 11 +-
.../Views/Accommodation/FormRoom.js | 120 +++++++++---------
.../Views/Accommodation/IndexDistribution.js | 54 ++++++--
.../Learun.Application.Web.csproj | 2 +
4 files changed, 113 insertions(+), 74 deletions(-)
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 64c1ec87e..c191c64f6 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
@@ -217,7 +217,16 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers
{
return View();
}
-
+ ///
+ /// 分配宿舍
+ ///
+ ///
+ [HttpGet]
+ public ActionResult FormRoom()
+ {
+ return View();
+ }
+
#endregion
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormRoom.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormRoom.js
index 692230d71..028955da9 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormRoom.js
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormRoom.js
@@ -7,7 +7,6 @@
var acceptClick;
var Class = request('Class');
var keyValue = request('keyValue');
-var Sex = request('Sex');
var arr = [];
var bootstrap = function ($, learun) {
"use strict";
@@ -18,21 +17,29 @@ var bootstrap = function ($, learun) {
page.initData();
},
bind: function () {
-
+ //$('.Student').lrselect({
+ // value: "stuid",
+ // text: "stuname",
+ // url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable',
+ // param: { code: "StuInfoBasic", strWhere: "ClassNo='" + Class + "'" },
+ // select: function (item) {
+ // if (item) {
+ // console.log(item);
+ // $.each(arr,
+ // function(index, value) {
+ // console.log('arr_index',value);
+ // console.log('arr_index',value);
+ // });
+ // }
+
+ // }
+ //});
},
initData: function () {
if (!!keyValue) {
$.lrSetForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/GetBedListByRoomId?RoomId=' + keyValue, function (data) {
- $('#content').html('');
- var strWhere = " ClassNo='" + Class + "'";
- if (Sex == '0') {
- strWhere += " and GenderNo=0";
- }
- else if (Sex == '1') {
- strWhere += " and GenderNo=1";
- }
+ var html = '';
for (var i = 0; i < data.length; i++) {
- var html = '';
html += '
';
- $('#content').append(html);
-
- $('#' + data[i].ID).lrselect({
- value: "stuid",
- text: "stuname",
- url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable',
- param: { code: "StuInfoBasic", strWhere: strWhere },
- select: function (item) {
- // console.log(item);
- var stuid = '';
- if (item) {
- stuid = item.stuid;
- }
- var id = $(this).attr('id');
- //console.log('id', id);
- //console.log('item',item);
- arr.forEach(item => {
- if (item.ID == id) {
- //如果存在删除
- removeByValue(arr, 'ID', id);
+ //$('#' + data[i].ID).lrselectRefresh({
+ // value: "stuid",
+ // text: "stuname",
+ // url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable',
+ // param: { code: "StuInfoBasic", strWhere: "ClassNo='" + Class + "'" },
+ // select: function (item) {
+ // if (item) {
+ // console.log(item);
+ // $.each(arr,
+ // function (index, value) {
+ // console.log('arr_index', value);
+ // console.log('arr_index', value);
+ // });
+ // }
- }
- });
- arr.push({ ID: id, StudentID: stuid });
- }
- });
+ // }
+ //});
$('#' + data[i].ID).lrselectSet(data[i].StudentID);
- //arr.push({ ID: data[i].ID, StudentID: data[i].StudentID });
+ arr.push({ ID: data[i].ID, StudentID: data[i].StudentID });
}
-
-
+ $('#content').html(html);
+ $('.Student').lrselect({
+ value: "stuid",
+ text: "stuname",
+ url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable',
+ param: { code: "StuInfoBasic", strWhere: "ClassNo='" + Class + "'" },
+ select: function (item) {
+ if (item) {
+ console.log(item);
+ $.each(arr,
+ function (index, value) {
+ console.log('arr_index', value);
+ console.log('arr_index', value);
+ });
+ }
+
+ }
+ });
});
}
@@ -85,19 +99,13 @@ var bootstrap = function ($, learun) {
};
// 保存数据
acceptClick = function (callBack) {
- //if (!$('body').lrValidform()) {
- // return false;
- //}
- //var postData = {
- // strEntity: JSON.stringify($('body').lrGetFormData())
- //};
- //console.log('arr',arr);
-
+ if (!$('body').lrValidform()) {
+ return false;
+ }
var postData = {
- list: arr
+ strEntity: JSON.stringify($('body').lrGetFormData())
};
-
- $.lrSaveForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/SaveRoom?RoomId=' + keyValue, postData, function (res) {
+ $.lrSaveForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/SaveDeptClass?type=2&keyValue=' + keyValue, postData, function (res) {
// 保存成功后才回调
if (!!callBack) {
callBack();
@@ -105,16 +113,4 @@ var bootstrap = function ($, learun) {
});
};
page.init();
- //删除数组元素
- function removeByValue(arr, attr, value) {
- var index = 0;
- for (var i in arr) {
- if (arr[i][attr] == value) {
- index = i;
- break;
- }
- }
- arr.splice(index, 1);
- }
-
}
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
index 86bfb5bce..430a002e6 100644
--- 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
@@ -62,10 +62,10 @@ var bootstrap = function ($, learun) {
//});
$('#NoDistribution').lrRadioCheckbox({
- type: 'checkbox',
+ type: 'checkbox',
code: 'NoDistribution'
});
-
+
$('#Distribution').lrRadioCheckbox({
type: 'checkbox',
code: 'NoDistribution'
@@ -260,13 +260,14 @@ var bootstrap = function ($, learun) {
if (arr.some(x => x != '4')) {
return learun.alert.warning("只能选择宿舍进行分配!");
}
- var arrDept = Dept.split(',');
+ var arrDept = Dept.split(',');
+ if (arrDept.some(function (value, index) {
+ return value.length === 0;
+ })) {
+ return learun.alert.warning("选中记录包含未分配系的数据!");
+ }
+
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];
})) {
@@ -274,7 +275,7 @@ var bootstrap = function ($, learun) {
}
}
learun.layerForm({
- id: 'formDept',
+ id: 'formClass',
title: '分配专业班级',
url: top.$.rootUrl + '/LogisticsManagement/Accommodation/FormClass?keyValue=' + keyValue + '&Dept=' + arrDept[0],
width: 400,
@@ -284,6 +285,36 @@ var bootstrap = function ($, learun) {
}
});
});
+
+
+ //分配宿舍
+ $("#lr_Bed").on("click", function () {
+ var keyValue = $('#gridtable').jfGridValue('ID');
+ var BuildType = $('#gridtable').jfGridValue('BuildType');
+ var Name = $('#gridtable').jfGridValue('Name');
+ var Class = $('#gridtable').jfGridValue('Class');
+ var arr = BuildType.split(',');
+ if (arr.some(x => x != '4')) {
+ return learun.alert.warning("只能选择宿舍进行分配!");
+ }
+ if (keyValue.indexOf(',') != -1) {
+ return learun.alert.warning("只能选择一条记录进行分配!");
+ }
+ if (Class.length == 0) {
+ return learun.alert.warning("请先分配班级!");
+ }
+ learun.layerForm({
+ id: 'formRoom',
+ title: '分配宿舍--' + Name,
+ url: top.$.rootUrl + '/LogisticsManagement/Accommodation/FormRoom?keyValue=' + keyValue + '&Class=' + Class,
+ width: 600,
+ height: 400,
+ callBack: function (id) {
+ return top[id].acceptClick(refreshGirdData);
+ }
+ });
+ });
+
},
//初始化左侧树
initTree: function () {
@@ -396,7 +427,8 @@ var bootstrap = function ($, learun) {
callback(_data['classname']);
}
});
- } },
+ }
+ },
{
label: "寝室类型", name: "RoomType", width: 100, align: "left",
formatter: function (value, row) {
@@ -559,7 +591,7 @@ var bootstrap = function ($, learun) {
},
search: function (param) {
//console.log(param);
-
+
param = param || {};
$('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
}
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 b836e691e..30f9f4240 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,7 @@
+
@@ -7582,6 +7583,7 @@
+