|
@@ -38,8 +38,10 @@ var bootstrap = function ($, learun) { |
|
|
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) { |
|
|
var html = ''; |
|
|
|
|
|
|
|
|
$('#content').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>'; |
|
@@ -52,46 +54,39 @@ 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).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); |
|
|
|
|
|
// }); |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
$('#' + data[i].ID).lrselect({ |
|
|
|
|
|
value: "stuid", |
|
|
|
|
|
text: "stuname", |
|
|
|
|
|
url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable', |
|
|
|
|
|
param: { code: "StuInfoBasic", strWhere: "ClassNo='" + Class + "'" }, |
|
|
|
|
|
select: function (item) { |
|
|
|
|
|
// console.log(item); |
|
|
|
|
|
var stuid = ''; |
|
|
|
|
|
if (item) { |
|
|
|
|
|
stuid = item.stuid; |
|
|
|
|
|
|
|
|
// } |
|
|
|
|
|
//}); |
|
|
|
|
|
$('#' + data[i].ID).lrselectSet(data[i].StudentID); |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
var id = $(this).attr('id'); |
|
|
|
|
|
//console.log('id', id); |
|
|
|
|
|
//console.log('item',item); |
|
|
|
|
|
arr.forEach(item => { |
|
|
|
|
|
if (item.ID == id) { |
|
|
|
|
|
//如果存在删除 |
|
|
|
|
|
removeByValue(arr, 'ID', id); |
|
|
|
|
|
|
|
|
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); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
arr.push({ ID: id, StudentID: stuid }); |
|
|
} |
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
$('#' + data[i].ID).lrselectSet(data[i].StudentID); |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
//arr.push({ ID: data[i].ID, StudentID: data[i].StudentID }); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
@@ -99,13 +94,19 @@ var bootstrap = function ($, learun) { |
|
|
}; |
|
|
}; |
|
|
// 保存数据 |
|
|
// 保存数据 |
|
|
acceptClick = function (callBack) { |
|
|
acceptClick = function (callBack) { |
|
|
if (!$('body').lrValidform()) { |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
//if (!$('body').lrValidform()) { |
|
|
|
|
|
// return false; |
|
|
|
|
|
//} |
|
|
|
|
|
//var postData = { |
|
|
|
|
|
// strEntity: JSON.stringify($('body').lrGetFormData()) |
|
|
|
|
|
//}; |
|
|
|
|
|
//console.log('arr',arr); |
|
|
|
|
|
|
|
|
var postData = { |
|
|
var postData = { |
|
|
strEntity: JSON.stringify($('body').lrGetFormData()) |
|
|
|
|
|
|
|
|
list: arr |
|
|
}; |
|
|
}; |
|
|
$.lrSaveForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/SaveDeptClass?type=2&keyValue=' + keyValue, postData, function (res) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$.lrSaveForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/SaveRoom?RoomId=' + keyValue, postData, function (res) { |
|
|
// 保存成功后才回调 |
|
|
// 保存成功后才回调 |
|
|
if (!!callBack) { |
|
|
if (!!callBack) { |
|
|
callBack(); |
|
|
callBack(); |
|
@@ -113,4 +114,16 @@ 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); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |