修改考场分配页面

This commit is contained in:
cuibaocheng 2021-05-15 20:06:50 +08:00
parent 4e649f5c1a
commit cd946a1b02
2 changed files with 153 additions and 85 deletions

View File

@ -150,68 +150,73 @@
var dataForm = {}; var dataForm = {};
var stationArray; var stationArray;
var classPlanArray; var classPlanArray;
var dataLength = 0;
var planLength = 0;
// 初始化开班计划 // 初始化开班计划
function initDistributionClassPlans() { function initDistributionClassPlans() {
classPlanArray = new Array(); classPlanArray = new Array();
top.restAjax.get(top.restAjax.path('api/classplan/list?classPlanIdListIds={classPlanIds}', [ planId ]), {}, null, function (code, data, args) { $.ajax({
planLength = data.length; url:'api/classplan/list?classPlanIdListIds=' + planId,
for (var i = 0; i < data.length; i++) { async:false,
var planData = {index: i, data: data[i]}; type:'get',
top.restAjax.get(top.restAjax.path('api/applystudents/list-by-classid/{planId}', [ data[i].classPlanId ]), {}, planData, function (code, userData, args) { dataType:'json',
var user = args.data; success: function (data) {
user.applyCount = userData.length; for (var i = 0; i < data.length; i++) {
classPlanArray.push(user); $.ajax({
if (args.index == planLength - 1) { url: 'api/applystudents/list-by-classid/' + data[i].classPlanId,
laytpl(document.getElementById('distributionClassPlansBoxTemplate').innerHTML).render(classPlanArray, function (html) { async: false,
console.log(classPlanArray); type: 'get',
document.getElementById('distributionClassPlansBox').innerHTML = html; dataType: 'json',
}); success: function (userData) {
form.render('checkbox', 'distributionClassPlansBox'); data[i].applyCount = userData.length;
} classPlanArray.push( data[i]);
}, function (code, data) { }
top.dialog.msg(data.msg); });
}
laytpl(document.getElementById('distributionClassPlansBoxTemplate').innerHTML).render(classPlanArray, function (html) {
console.log(classPlanArray);
document.getElementById('distributionClassPlansBox').innerHTML = html;
}); });
form.render('checkbox', 'distributionClassPlansBox');
} }
}, function (code, data) {
top.dialog.msg(data.msg);
}); });
} }
// 初始化考场 // 初始化考场
function initDistributionFields() { function initDistributionFields() {
stationArray = new Array(); stationArray = new Array();
top.restAjax.get(top.restAjax.path('api/institution/list?institutionType=考点信息', []), {}, null, function(code, data, args) { $.ajax({
dataLength = data.length; url:'api/institution/list?institutionType=考点信息',
for(var i = 0 ; i < data.length ; i++) { async:false,
var institutionData = {index:i, data:data[i]}; type:'get',
top.restAjax.get(top.restAjax.path('api/organization/list?organizationType={organizationType}', [data[i].institutionId]), {}, institutionData, function(code, orgData, args) { dataType:'json',
// 回显 , 选中 success: function (data) {
for(var a = 0 ; a < orgData.length; a++) { for (var i = 0; i < data.length; i++) {
console.log(dataForm); $.ajax({
for(var j = 0 ; j < dataForm.distributionFieldList.length; j++) { url: 'api/organization/list?organizationType=' + data[i].institutionId,
if(orgData[a].organizationId == dataForm.distributionFieldList[j].fieldId) { async: false,
orgData[a].checked = 'checked="checked"'; type: 'get',
dataType: 'json',
success: function (orgData) {
// 回显 , 选中
for (var a = 0; a < orgData.length; a++) {
console.log(dataForm);
for (var j = 0; j < dataForm.distributionFieldList.length; j++) {
if (orgData[a].organizationId == dataForm.distributionFieldList[j].fieldId) {
orgData[a].checked = 'checked="checked"';
}
}
} }
var stationData = {stationName: data[i].institutionName, fieldArray: orgData};
stationArray.push(stationData);
} }
} });
var stationData = {stationName:args.data.institutionName, fieldArray:orgData}; }
stationArray.push(stationData); laytpl(document.getElementById('distributionFieldsBoxTemplate').innerHTML).render(stationArray, function (html) {
if(args.index == dataLength - 1) { console.log(stationArray);
laytpl(document.getElementById('distributionFieldsBoxTemplate').innerHTML).render(stationArray, function(html) { document.getElementById('distributionFieldsBox').innerHTML = html;
console.log(stationArray);
document.getElementById('distributionFieldsBox').innerHTML = html;
});
form.render('checkbox', 'distributionFieldsBox');
}
}, function(code, data) {
top.dialog.msg(data.msg);
}); });
form.render('checkbox', 'distributionFieldsBox');
} }
}, function(code, data) {
top.dialog.msg(data.msg);
}); });
} }

View File

@ -150,62 +150,125 @@
var stationArray; var stationArray;
var classPlanArray; var classPlanArray;
var dataLength = 0;
var planLength = 0;
// 初始化开班计划 // 初始化开班计划
function initDistributionClassPlans() { function initDistributionClassPlans() {
classPlanArray = new Array(); classPlanArray = new Array();
top.restAjax.get(top.restAjax.path('api/classplan/list?classPlanIdListIds={classPlanIds}', [ planId ]), {}, null, function (code, data, args) { $.ajax({
planLength = data.length; url:'api/classplan/list?classPlanIdListIds=' + planId,
for (var i = 0; i < data.length; i++) { async:false,
var planData = {index: i, data: data[i]}; type:'get',
top.restAjax.get(top.restAjax.path('api/applystudents/list-by-classid/{planId}', [ data[i].classPlanId ]), {}, planData, function (code, userData, args) { dataType:'json',
var user = args.data; success: function (data) {
user.applyCount = userData.length; for (var i = 0; i < data.length; i++) {
classPlanArray.push(user); $.ajax({
if (args.index == planLength - 1) { url: 'api/applystudents/list-by-classid/' + data[i].classPlanId,
laytpl(document.getElementById('distributionClassPlansBoxTemplate').innerHTML).render(classPlanArray, function (html) { async: false,
console.log(classPlanArray); type: 'get',
document.getElementById('distributionClassPlansBox').innerHTML = html; dataType: 'json',
}); success: function (userData) {
form.render('checkbox', 'distributionClassPlansBox'); data[i].applyCount = userData.length;
} classPlanArray.push( data[i]);
}, function (code, data) { }
top.dialog.msg(data.msg); });
}
laytpl(document.getElementById('distributionClassPlansBoxTemplate').innerHTML).render(classPlanArray, function (html) {
console.log(classPlanArray);
document.getElementById('distributionClassPlansBox').innerHTML = html;
}); });
form.render('checkbox', 'distributionClassPlansBox');
} }
}, function (code, data) {
top.dialog.msg(data.msg);
}); });
} }
// 初始化考场 // 初始化考场
function initDistributionFields() { function initDistributionFields() {
stationArray = new Array(); stationArray = new Array();
top.restAjax.get(top.restAjax.path('api/institution/list?institutionType=考点信息', []), {}, null, function(code, data, args) { $.ajax({
dataLength = data.length; url:'api/institution/list?institutionType=考点信息',
for(var i = 0 ; i < data.length ; i++) { async:false,
var institutionData = {index:i, data:data[i]}; type:'get',
top.restAjax.get(top.restAjax.path('api/organization/list?organizationType={organizationType}', [data[i].institutionId]), {}, institutionData, function(code, orgData, args) { dataType:'json',
var stationData = {stationName:args.data.institutionName, fieldArray:orgData}; success: function (data) {
stationArray.push(stationData); for (var i = 0; i < data.length; i++) {
if(args.index == dataLength - 1) { $.ajax({
laytpl(document.getElementById('distributionFieldsBoxTemplate').innerHTML).render(stationArray, function(html) { url: 'api/organization/list?organizationType=' + data[i].institutionId,
console.log(stationArray); async: false,
document.getElementById('distributionFieldsBox').innerHTML = html; type: 'get',
}); dataType: 'json',
form.render('checkbox', 'distributionFieldsBox'); success: function (orgData) {
} var stationData = {stationName: data[i].institutionName, fieldArray: orgData};
}, function(code, data) { stationArray.push(stationData);
top.dialog.msg(data.msg); }
});
}
laytpl(document.getElementById('distributionFieldsBoxTemplate').innerHTML).render(stationArray, function (html) {
console.log(stationArray);
document.getElementById('distributionFieldsBox').innerHTML = html;
}); });
form.render('checkbox', 'distributionFieldsBox');
} }
}, function(code, data) {
top.dialog.msg(data.msg);
}); });
} }
// var stationArray;
// var classPlanArray;
// var dataLength = 0;
// var planLength = 0;
//
// // 初始化开班计划
// function initDistributionClassPlans() {
// classPlanArray = new Array();
// top.restAjax.get(top.restAjax.path('api/classplan/list?classPlanIdListIds={classPlanIds}', [ planId ]), {}, null, function (code, data, args) {
// planLength = data.length;
// for (var i = 0; i < data.length; i++) {
// var planData = {index: i, data: data[i]};
// top.restAjax.get(top.restAjax.path('api/applystudents/list-by-classid/{planId}', [ data[i].classPlanId ]), {}, planData, function (code, userData, args) {
// var user = args.data;
// user.applyCount = userData.length;
// classPlanArray.push(user);
// if (args.index == planLength - 1) {
// laytpl(document.getElementById('distributionClassPlansBoxTemplate').innerHTML).render(classPlanArray, function (html) {
// console.log(classPlanArray);
// document.getElementById('distributionClassPlansBox').innerHTML = html;
// });
// form.render('checkbox', 'distributionClassPlansBox');
// }
// }, function (code, data) {
// top.dialog.msg(data.msg);
// });
// }
// }, function (code, data) {
// top.dialog.msg(data.msg);
// });
// }
//
// // 初始化考场
// function initDistributionFields() {
// stationArray = new Array();
// top.restAjax.get(top.restAjax.path('api/institution/list?institutionType=考点信息', []), {}, null, function(code, data, args) {
// dataLength = data.length;
// for(var i = 0 ; i < data.length ; i++) {
// var institutionData = {index:i, data:data[i]};
// top.restAjax.get(top.restAjax.path('api/organization/list?organizationType={organizationType}', [data[i].institutionId]), {}, institutionData, function(code, orgData, args) {
// var stationData = {stationName:args.data.institutionName, fieldArray:orgData};
// stationArray.push(stationData);
// if(args.index == dataLength - 1) {
// laytpl(document.getElementById('distributionFieldsBoxTemplate').innerHTML).render(stationArray, function(html) {
// console.log(stationArray);
// document.getElementById('distributionFieldsBox').innerHTML = html;
// });
// form.render('checkbox', 'distributionFieldsBox');
// }
// }, function(code, data) {
// top.dialog.msg(data.msg);
// });
// }
// }, function(code, data) {
// top.dialog.msg(data.msg);
// });
// }
// 初始化成立日期时间戳 // 初始化成立日期时间戳
function initDistributionAllotTime() { function initDistributionAllotTime() {
laydate.render({ laydate.render({