修改考场分配页面

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,
async:false,
type:'get',
dataType:'json',
success: function (data) {
for (var i = 0; i < data.length; i++) { for (var i = 0; i < data.length; i++) {
var planData = {index: i, data: data[i]}; $.ajax({
top.restAjax.get(top.restAjax.path('api/applystudents/list-by-classid/{planId}', [ data[i].classPlanId ]), {}, planData, function (code, userData, args) { url: 'api/applystudents/list-by-classid/' + data[i].classPlanId,
var user = args.data; async: false,
user.applyCount = userData.length; type: 'get',
classPlanArray.push(user); dataType: 'json',
if (args.index == planLength - 1) { success: function (userData) {
data[i].applyCount = userData.length;
classPlanArray.push( data[i]);
}
});
}
laytpl(document.getElementById('distributionClassPlansBoxTemplate').innerHTML).render(classPlanArray, function (html) { laytpl(document.getElementById('distributionClassPlansBoxTemplate').innerHTML).render(classPlanArray, function (html) {
console.log(classPlanArray); console.log(classPlanArray);
document.getElementById('distributionClassPlansBox').innerHTML = html; document.getElementById('distributionClassPlansBox').innerHTML = html;
}); });
form.render('checkbox', 'distributionClassPlansBox'); form.render('checkbox', 'distributionClassPlansBox');
} }
}, function (code, data) {
top.dialog.msg(data.msg);
});
}
}, 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 i = 0; i < data.length; i++) {
$.ajax({
url: 'api/organization/list?organizationType=' + data[i].institutionId,
async: false,
type: 'get',
dataType: 'json',
success: function (orgData) {
// 回显 , 选中 // 回显 , 选中
for(var a = 0 ; a < orgData.length; a++) { for (var a = 0; a < orgData.length; a++) {
console.log(dataForm); console.log(dataForm);
for(var j = 0 ; j < dataForm.distributionFieldList.length; j++) { for (var j = 0; j < dataForm.distributionFieldList.length; j++) {
if(orgData[a].organizationId == dataForm.distributionFieldList[j].fieldId) { if (orgData[a].organizationId == dataForm.distributionFieldList[j].fieldId) {
orgData[a].checked = 'checked="checked"'; orgData[a].checked = 'checked="checked"';
} }
} }
} }
var stationData = {stationName:args.data.institutionName, fieldArray:orgData}; var stationData = {stationName: data[i].institutionName, fieldArray: orgData};
stationArray.push(stationData); stationArray.push(stationData);
if(args.index == dataLength - 1) { }
laytpl(document.getElementById('distributionFieldsBoxTemplate').innerHTML).render(stationArray, function(html) { });
}
laytpl(document.getElementById('distributionFieldsBoxTemplate').innerHTML).render(stationArray, function (html) {
console.log(stationArray); console.log(stationArray);
document.getElementById('distributionFieldsBox').innerHTML = html; document.getElementById('distributionFieldsBox').innerHTML = html;
}); });
form.render('checkbox', 'distributionFieldsBox'); form.render('checkbox', 'distributionFieldsBox');
} }
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
}, 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,
async:false,
type:'get',
dataType:'json',
success: function (data) {
for (var i = 0; i < data.length; i++) { for (var i = 0; i < data.length; i++) {
var planData = {index: i, data: data[i]}; $.ajax({
top.restAjax.get(top.restAjax.path('api/applystudents/list-by-classid/{planId}', [ data[i].classPlanId ]), {}, planData, function (code, userData, args) { url: 'api/applystudents/list-by-classid/' + data[i].classPlanId,
var user = args.data; async: false,
user.applyCount = userData.length; type: 'get',
classPlanArray.push(user); dataType: 'json',
if (args.index == planLength - 1) { success: function (userData) {
data[i].applyCount = userData.length;
classPlanArray.push( data[i]);
}
});
}
laytpl(document.getElementById('distributionClassPlansBoxTemplate').innerHTML).render(classPlanArray, function (html) { laytpl(document.getElementById('distributionClassPlansBoxTemplate').innerHTML).render(classPlanArray, function (html) {
console.log(classPlanArray); console.log(classPlanArray);
document.getElementById('distributionClassPlansBox').innerHTML = html; document.getElementById('distributionClassPlansBox').innerHTML = html;
}); });
form.render('checkbox', 'distributionClassPlansBox'); form.render('checkbox', 'distributionClassPlansBox');
} }
}, function (code, data) {
top.dialog.msg(data.msg);
});
}
}, 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) {
for (var i = 0; i < data.length; i++) {
$.ajax({
url: 'api/organization/list?organizationType=' + data[i].institutionId,
async: false,
type: 'get',
dataType: 'json',
success: function (orgData) {
var stationData = {stationName: data[i].institutionName, fieldArray: orgData};
stationArray.push(stationData); stationArray.push(stationData);
if(args.index == dataLength - 1) { }
laytpl(document.getElementById('distributionFieldsBoxTemplate').innerHTML).render(stationArray, function(html) { });
}
laytpl(document.getElementById('distributionFieldsBoxTemplate').innerHTML).render(stationArray, function (html) {
console.log(stationArray); console.log(stationArray);
document.getElementById('distributionFieldsBox').innerHTML = html; document.getElementById('distributionFieldsBox').innerHTML = html;
}); });
form.render('checkbox', 'distributionFieldsBox'); form.render('checkbox', 'distributionFieldsBox');
} }
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
}, 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({