@@ -217,7 +217,16 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers | |||||
{ | { | ||||
return View(); | return View(); | ||||
} | } | ||||
/// <summary> | |||||
/// 分配宿舍 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
[HttpGet] | |||||
public ActionResult FormRoom() | |||||
{ | |||||
return View(); | |||||
} | |||||
#endregion | #endregion | ||||
@@ -7,7 +7,6 @@ | |||||
var acceptClick; | var acceptClick; | ||||
var Class = request('Class'); | var Class = request('Class'); | ||||
var keyValue = request('keyValue'); | var keyValue = request('keyValue'); | ||||
var Sex = request('Sex'); | |||||
var arr = []; | var arr = []; | ||||
var bootstrap = function ($, learun) { | var bootstrap = function ($, learun) { | ||||
"use strict"; | "use strict"; | ||||
@@ -18,21 +17,29 @@ var bootstrap = function ($, learun) { | |||||
page.initData(); | page.initData(); | ||||
}, | }, | ||||
bind: function () { | 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 () { | initData: function () { | ||||
if (!!keyValue) { | if (!!keyValue) { | ||||
$.lrSetForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/GetBedListByRoomId?RoomId=' + keyValue, function (data) { | $.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++) { | for (var i = 0; i < data.length; i++) { | ||||
var html = ''; | |||||
html += '<div class="col-xs-12 lr-form-item div12">'; | html += '<div class="col-xs-12 lr-form-item div12">'; | ||||
html += '<div class="col-xs-6 lr-form-item">'; | html += '<div class="col-xs-6 lr-form-item">'; | ||||
html += '<div class="lr-form-item-title">床位</div>'; | html += '<div class="lr-form-item-title">床位</div>'; | ||||
@@ -45,39 +52,46 @@ var bootstrap = function ($, learun) { | |||||
html += '<div class="Student" id="' + data[i].ID + '"></div>'; | html += '<div class="Student" id="' + data[i].ID + '"></div>'; | ||||
html += '</div>'; | html += '</div>'; | ||||
html += '</div>'; | html += '</div>'; | ||||
$('#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); | $('#' + 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) { | 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 = { | 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) { | if (!!callBack) { | ||||
callBack(); | callBack(); | ||||
@@ -105,16 +113,4 @@ var bootstrap = function ($, learun) { | |||||
}); | }); | ||||
}; | }; | ||||
page.init(); | 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); | |||||
} | |||||
} | } |
@@ -62,10 +62,10 @@ var bootstrap = function ($, learun) { | |||||
//}); | //}); | ||||
$('#NoDistribution').lrRadioCheckbox({ | $('#NoDistribution').lrRadioCheckbox({ | ||||
type: 'checkbox', | |||||
type: 'checkbox', | |||||
code: 'NoDistribution' | code: 'NoDistribution' | ||||
}); | }); | ||||
$('#Distribution').lrRadioCheckbox({ | $('#Distribution').lrRadioCheckbox({ | ||||
type: 'checkbox', | type: 'checkbox', | ||||
code: 'NoDistribution' | code: 'NoDistribution' | ||||
@@ -260,13 +260,14 @@ var bootstrap = function ($, learun) { | |||||
if (arr.some(x => x != '4')) { | if (arr.some(x => x != '4')) { | ||||
return learun.alert.warning("只能选择宿舍进行分配!"); | 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 (keyValue.indexOf(',') > 0) { | ||||
if (arrDept.some(function(value, index) { | |||||
return value.length == 0; | |||||
})) { | |||||
return learun.alert.warning("选中记录包含未分配专业的数据!"); | |||||
} | |||||
if (arrDept.some(function (value, index) { | if (arrDept.some(function (value, index) { | ||||
return value != arrDept[0]; | return value != arrDept[0]; | ||||
})) { | })) { | ||||
@@ -274,7 +275,7 @@ var bootstrap = function ($, learun) { | |||||
} | } | ||||
} | } | ||||
learun.layerForm({ | learun.layerForm({ | ||||
id: 'formDept', | |||||
id: 'formClass', | |||||
title: '分配专业班级', | title: '分配专业班级', | ||||
url: top.$.rootUrl + '/LogisticsManagement/Accommodation/FormClass?keyValue=' + keyValue + '&Dept=' + arrDept[0], | url: top.$.rootUrl + '/LogisticsManagement/Accommodation/FormClass?keyValue=' + keyValue + '&Dept=' + arrDept[0], | ||||
width: 400, | 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 () { | initTree: function () { | ||||
@@ -396,7 +427,8 @@ var bootstrap = function ($, learun) { | |||||
callback(_data['classname']); | callback(_data['classname']); | ||||
} | } | ||||
}); | }); | ||||
} }, | |||||
} | |||||
}, | |||||
{ | { | ||||
label: "寝室类型", name: "RoomType", width: 100, align: "left", | label: "寝室类型", name: "RoomType", width: 100, align: "left", | ||||
formatter: function (value, row) { | formatter: function (value, row) { | ||||
@@ -559,7 +591,7 @@ var bootstrap = function ($, learun) { | |||||
}, | }, | ||||
search: function (param) { | search: function (param) { | ||||
//console.log(param); | //console.log(param); | ||||
param = param || {}; | param = param || {}; | ||||
$('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); | $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); | ||||
} | } | ||||
@@ -1300,6 +1300,7 @@ | |||||
<Content Include="Areas\EducationalAdministration\Views\TeachPlan\Index.js" /> | <Content Include="Areas\EducationalAdministration\Views\TeachPlan\Index.js" /> | ||||
<Content Include="Areas\EducationalAdministration\Views\TeachSwitch\Form.js" /> | <Content Include="Areas\EducationalAdministration\Views\TeachSwitch\Form.js" /> | ||||
<Content Include="Areas\EducationalAdministration\Views\TeachSwitch\Index.js" /> | <Content Include="Areas\EducationalAdministration\Views\TeachSwitch\Index.js" /> | ||||
<Content Include="Areas\LogisticsManagement\Views\Accommodation\FormRoom.js" /> | |||||
<Content Include="Areas\LogisticsManagement\Views\Accommodation\FormClass.js" /> | <Content Include="Areas\LogisticsManagement\Views\Accommodation\FormClass.js" /> | ||||
<Content Include="Areas\LogisticsManagement\Views\Accommodation\FormDept.js" /> | <Content Include="Areas\LogisticsManagement\Views\Accommodation\FormDept.js" /> | ||||
<Content Include="Areas\LogisticsManagement\Views\Accommodation\FormClassify.js" /> | <Content Include="Areas\LogisticsManagement\Views\Accommodation\FormClassify.js" /> | ||||
@@ -7582,6 +7583,7 @@ | |||||
<Content Include="Areas\LogisticsManagement\Views\Accommodation\IndexDistribution.cshtml" /> | <Content Include="Areas\LogisticsManagement\Views\Accommodation\IndexDistribution.cshtml" /> | ||||
<Content Include="Areas\LogisticsManagement\Views\Accommodation\FormDept.cshtml" /> | <Content Include="Areas\LogisticsManagement\Views\Accommodation\FormDept.cshtml" /> | ||||
<Content Include="Areas\LogisticsManagement\Views\Accommodation\FormClass.cshtml" /> | <Content Include="Areas\LogisticsManagement\Views\Accommodation\FormClass.cshtml" /> | ||||
<Content Include="Areas\LogisticsManagement\Views\Accommodation\FormRoom.cshtml" /> | |||||
<None Include="Properties\PublishProfiles\CustomProfile.pubxml" /> | <None Include="Properties\PublishProfiles\CustomProfile.pubxml" /> | ||||
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" /> | <None Include="Properties\PublishProfiles\FolderProfile.pubxml" /> | ||||
<Content Include="Views\Login\Default-beifen.cshtml" /> | <Content Include="Views\Login\Default-beifen.cshtml" /> | ||||