回显验证等乱七八糟

This commit is contained in:
wans 2021-05-17 17:14:40 +08:00
parent 1a5595e321
commit 8bcaf4a982
13 changed files with 326 additions and 225 deletions

View File

@ -54,7 +54,7 @@ public class ClassPlanController extends DefaultBaseController {
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PutMapping("update/{classPlanId}")
@CheckRequestBodyAnnotation
public SuccessResult update(@PathVariable("classPlanId") String classPlanId, @RequestBody JSONObject obj) {
public SuccessResult update(@PathVariable("classPlanId") String classPlanId, @RequestBody JSONObject obj) throws Exception{
obj.put("classPlanId",classPlanId);
classPlanService.updateJson(obj);
return new SuccessResult();
@ -154,6 +154,19 @@ public class ClassPlanController extends DefaultBaseController {
return new SuccessResult();
}
@ApiOperation(value = "重新提交考试申请", notes = "重新提交考试申请接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "classPlanId", value = "ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PutMapping("update-exam-recommit/{classPlanId}")
public SuccessResult updateExamRecommit(@PathVariable("classPlanId") String classPlanId) {
classPlanService.updateExamRecommit(classPlanId);
return new SuccessResult();
}
@ApiOperation(value = "查询考试申请详情", notes = "查询考试申请详情接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "classPlanId", value = "ID", paramType = "path")

View File

@ -136,10 +136,17 @@ public interface IClassPlanDao {
*/
void deleteClassPlanLessons(Map<String, Object> params);
/**
* 逻辑删除开班计划下所有老师的授课时刻安排
* @param params
*/
void deleteTeacherLessonsTime(Map<String, Object> params);
/**
* 根据机构id统计计划的分类数量
* @param params
* @return
*/
Map<String, Object> countPlanType(Map<String, Object> params);
}

View File

@ -26,21 +26,11 @@ public class LessonsDTO {
private String lessonType;
@ApiModelProperty(name = "teachWay", value = "授课方式1面授")
private String teachWay;
@ApiModelProperty(name = "creator", value = "")
private String creator;
@ApiModelProperty(name = "gmtCreate", value = "")
private String gmtCreate;
@ApiModelProperty(name = "modifier", value = "")
private String modifier;
@ApiModelProperty(name = "gmtModified", value = "")
private String gmtModified;
@ApiModelProperty(name = "isDelete", value = "")
private Integer isDelete;
@ApiModelProperty(name = "projectCatalogName", value = "培训项目")
private String projectCatalogName;
public String getLessonId() {
return lessonId == null ? "" : lessonId.trim();
return lessonId == null ? "" : lessonId;
}
public void setLessonId(String lessonId) {
@ -56,7 +46,7 @@ public class LessonsDTO {
}
public String getProjectCatalogId() {
return projectCatalogId == null ? "" : projectCatalogId.trim();
return projectCatalogId == null ? "" : projectCatalogId;
}
public void setProjectCatalogId(String projectCatalogId) {
@ -64,7 +54,7 @@ public class LessonsDTO {
}
public String getLessonName() {
return lessonName == null ? "" : lessonName.trim();
return lessonName == null ? "" : lessonName;
}
public void setLessonName(String lessonName) {
@ -72,7 +62,7 @@ public class LessonsDTO {
}
public String getLessonType() {
return lessonType == null ? "" : lessonType.trim();
return lessonType == null ? "" : lessonType;
}
public void setLessonType(String lessonType) {
@ -80,53 +70,13 @@ public class LessonsDTO {
}
public String getTeachWay() {
return teachWay == null ? "" : teachWay.trim();
return teachWay == null ? "" : teachWay;
}
public void setTeachWay(String teachWay) {
this.teachWay = teachWay;
}
public String getCreator() {
return creator == null ? "" : creator.trim();
}
public void setCreator(String creator) {
this.creator = creator;
}
public String getGmtCreate() {
return gmtCreate == null ? "" : gmtCreate.trim();
}
public void setGmtCreate(String gmtCreate) {
this.gmtCreate = gmtCreate;
}
public String getModifier() {
return modifier == null ? "" : modifier.trim();
}
public void setModifier(String modifier) {
this.modifier = modifier;
}
public String getGmtModified() {
return gmtModified == null ? "" : gmtModified.trim();
}
public void setGmtModified(String gmtModified) {
this.gmtModified = gmtModified;
}
public Integer getIsDelete() {
return isDelete == null ? 0 : isDelete;
}
public void setIsDelete(Integer isDelete) {
this.isDelete = isDelete;
}
public String getProjectCatalogName() {
return projectCatalogName == null ? "" : projectCatalogName;
}

View File

@ -103,7 +103,7 @@ public interface IClassPlanService {
* @param obj
* @return
*/
void updateJson(JSONObject obj);
void updateJson(JSONObject obj) throws Exception;
/**
* 修改
@ -271,4 +271,10 @@ public interface IClassPlanService {
* @return
*/
Map<String, Object> getSignUserCounts(Map<String, Object> params);
/**
* 重新提交考试申请
* @param classPlanId
*/
void updateExamRecommit(String classPlanId);
}

View File

@ -231,38 +231,111 @@ public class ClassPlanServiceImpl extends DefaultBaseService implements IClassPl
}
@Override
public void updateJson(JSONObject obj) {
public void updateJson(JSONObject obj) throws Exception{
String classPlanId = obj.getString("classPlanId");
ClassPlanVO classPlanVO = new ClassPlanVO();
classPlanVO.setClassPlanId(classPlanId);
classPlanVO.setOrgId(obj.getString("orgId"));
classPlanVO.setPlanNumber(obj.getString("planNumber"));
classPlanVO.setPlanName(obj.getString("planName"));
classPlanVO.setPlanType(obj.getString("planType"));
classPlanVO.setProjectCatalogId(obj.getString("projectCatalogId"));
classPlanVO.setWorkerCatalog(obj.getString("workerCatalog"));
classPlanVO.setPlanPersonNum(Integer.parseInt(obj.getString("planPersonNum")));
classPlanVO.setPlanStartTime(obj.getString("planStartTime"));
classPlanVO.setPlanEndTime(obj.getString("planEndTime"));
classPlanVO.setSignUpStartTime(obj.getString("signUpStartTime"));
classPlanVO.setSignUpEndTime(obj.getString("signUpEndTime"));
classPlanVO.setPlanAddress(obj.getString("planAddress"));
classPlanVO.setChargePerson(obj.getString("chargePerson"));
classPlanVO.setChargePersonTel(obj.getString("chargePersonTel"));
classPlanVO.setReportType("0");
classPlanVO.setReportReason("");
Map<String, Object> params = HashMapUtil.beanToMap(classPlanVO);
setUpdateInfo(params);
classPlanDao.update(params);
// 更新完成后修改审核状态
ExamCheckVO checkVO = new ExamCheckVO();
checkVO.setPlanId(classPlanId);
checkVO.setOrgId(obj.getString("orgId"));
checkVO.setWorkTypeId(obj.getString("workerCatalog"));
checkVO.setCheckStatus(0);
checkVO.setReason("");
examCheckService.updateByClassPlanId(classPlanId,checkVO);
String planStartTime = obj.getString("planStartTime");
String planEndTime = obj.getString("planEndTime");
// 删除历史课程信息
classPlanDao.deleteClassPlanLessons(params);
//保存课程及讲师
// 删除该开班计划下所有讲师授课记录
classPlanDao.deleteTeacherLessonsTime(params);
// 处理开班时间日期转换为list
List<String> dayList = new ArrayList<>();
long daySub = DateUtil.getDaySub(planStartTime, planEndTime);
if(daySub == 0L){
dayList.add(planStartTime);
} else {
for(long i = 0; i <= daySub; i++){
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd");
Date startDate = sd.parse(planStartTime);
String formatDate = sd.format(startDate.getTime() + (i * 24 * 60 * 60 * 1000));
dayList.add(formatDate);
}
}
// 校验每一天课程是否冲突
JSONArray array = obj.getJSONArray("lessonList");
params.clear();
Map<String, Object> query = getHashMap(8);
for(int i = 0; i < array.size(); i++){
JSONObject item = array.getJSONObject(i);
String lessonStartTime = item.getString("lessonStartTime") + ":00";
String lessonEndTime = item.getString("lessonEndTime") + ":00";
// 查询当前教师信息
TeacherDTO teacherDTO = teacher.getById(item.getString("teacherId"));
query.clear();
query.put("teacherIdCard",teacherDTO.getIdCardNumber());
List<TeacherLessonsTimeDTO> tlList = teacher.listTeacherLessonsTime(query);
if(tlList != null && tlList.size() > 0){
for(String tempDate : dayList){
String sDateTime = tempDate + " " + lessonStartTime;
String eDateTime = tempDate + " " + lessonEndTime;
for(TeacherLessonsTimeDTO tlMap : tlList){
String ssDateTime = tlMap.getStartTime();
String eeDateTime = tlMap.getStartEnd();
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if(sd.parse(eDateTime).getTime() < sd.parse(ssDateTime).getTime()
|| sd.parse(sDateTime).getTime() > sd.parse(eeDateTime).getTime()){
//...没有发生冲突
} else {
throw new SaveException(""+teacherDTO.getTeacherName()+"】与其他课程安排时间冲突 "
+ ssDateTime + "" + eeDateTime + "");
}
}
params.put("classPlanId",classPlanId);
params.put("teacherId",teacherDTO.getTeacherId());
params.put("teacherIdCard", teacherDTO.getIdCardNumber());
params.put("orgId",teacherDTO.getOrgId());
params.put("projectCatalogId",obj.getString("projectCatalogId"));
params.put("workerCatalog",obj.getString("workerCatalog"));
params.put("lessonId",item.getString("lessonId"));
params.put("startTime",sDateTime);
params.put("endTime",eDateTime);
teacher.saveTeacherLessonsTime(params);
}
} else {
for(String tempDate : dayList){
String sDateTime = tempDate + " " + lessonStartTime;
String eDateTime = tempDate + " " + lessonEndTime;
params.put("classPlanId",classPlanId);
params.put("teacherId",teacherDTO.getTeacherId());
params.put("teacherIdCard", teacherDTO.getIdCardNumber());
params.put("orgId",teacherDTO.getOrgId());
params.put("projectCatalogId",obj.getString("projectCatalogId"));
params.put("workerCatalog",obj.getString("workerCatalog"));
params.put("lessonId",item.getString("lessonId"));
params.put("startTime",sDateTime);
params.put("endTime",eDateTime);
teacher.saveTeacherLessonsTime(params);
}
}
params.clear();
params.put("classPlanId",classPlanId);
params.put("lessonId",item.getString("lessonId"));
params.put("teacherId",item.getString("teacherId"));
params.put("lessonStart",item.getString("lessonStartTime"));
params.put("lessonEnd",item.getString("lessonEndTime"));
params.put("isDelete",item.getString("teacherId"));
classPlanDao.saveClassPlanLesson(params);
}
@ -422,6 +495,7 @@ public class ClassPlanServiceImpl extends DefaultBaseService implements IClassPl
} else {
// 0待审核 1审核通过 2退回
item.setExamType(examApplyDTO.getCheckStatus() + "");
item.setExamReason(examApplyDTO.getReason());
}
//查询报名人数
if(examCheck.getCheckStatus() == 2){
@ -523,6 +597,13 @@ public class ClassPlanServiceImpl extends DefaultBaseService implements IClassPl
examApplyService.save(examApplyVO);
}
@Override
public void updateExamRecommit(String classPlanId) {
ExamApplyVO examApplyVO = new ExamApplyVO();
examApplyVO.setCheckStatus(0);
examApplyService.updateStatus(classPlanId,examApplyVO);
}
@Override
public ClassPlanReportExamDTO getReportExamDetail(String classPlanId) {
Map<String, Object> queryMap = getHashMap(8);

View File

@ -438,7 +438,9 @@
SELECT
t1.class_plan_id classPlanId,
t1.lesson_id lessonId,
t1.teacher_id teacherId
t1.teacher_id teacherId,
t1.lesson_start lessonStart,
t1.lesson_end lessonEnd
FROM
e_class_plan_lesson t1
WHERE
@ -453,4 +455,11 @@
class_plan_id = #{classPlanId}
</update>
<update id="deleteTeacherLessonsTime" parameterType="map">
UPDATE e_teach_lessons_time SET
is_delete = '1'
WHERE
class_plan_id = #{classPlanId}
</update>
</mapper>

View File

@ -9,11 +9,6 @@
<result column="lesson_name" property="lessonName"/>
<result column="lesson_type" property="lessonType"/>
<result column="teach_way" property="teachWay"/>
<result column="creator" property="creator"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="modifier" property="modifier"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="is_delete" property="isDelete"/>
</resultMap>
<resultMap id="lessonsBO" type="cn.com.tenlion.pojo.bos.lessons.LessonsBO">

View File

@ -82,7 +82,8 @@
where :{
applyInstitutionId: orgId,
applyWorkTypeId : workerCatalog,
applyClassId : reportType == "2" ? classPlanId : ''
applyClassId : reportType == "2" ? classPlanId : '',
applyAuditStates : '2'
},
toolbar: false,
request: {
@ -152,7 +153,7 @@
applyInstitutionId: orgId,
applyWorkTypeId : workerCatalog,
applyClassId : reportType == "2" ? classPlanId : '',
applyAuditStates:$('#applyAuditStates').val(),
applyAuditStates : '2',
},
page: {
curr: currentPage

View File

@ -152,7 +152,6 @@
} else {
$('#totalSignUpUser').text('预计人数');
$('#totalSignUpUserNumber').text('50 人');
$('#class-plan-btn-event').show();
}
}, function (code, data) {
top.dialog.msg(data.msg);

View File

@ -115,16 +115,16 @@
return dom;
}
if(row['reportType'] === '2' && row['examType'] === '2' ){
dom += '<a type="button" class="layui-btn layui-btn-warm layui-btn-xs">考试申请不通过</a>';
dom += '<a type="button" class="layui-btn layui-btn-danger layui-btn-xs">考试申请驳回</a>';
return dom;
}
if(row['reportType'] === '3'){
return '<a type="button" class="layui-btn layui-btn-danger layui-btn-xs" lay-event="unPassEvent">开班不通过</a>';
return '<a type="button" class="layui-btn layui-btn-danger layui-btn-xs">开班不通过</a>';
}
return dom;
}
},
{width:120, title: '操作', fixed: 'left', align:'center',
{width:160, title: '操作', fixed: 'left', align:'center',
templet: function(row) {
var dom = '';
if(row['reportType'] === '0'){
@ -132,23 +132,25 @@
return dom;
}
if(row['reportType'] === '2' && row['examType'] === ''){
dom += '<a type="button" class="layui-btn layui-btn-info layui-btn-xs" lay-event="showEvent">查看详情</a>';
dom += '<a type="button" class="layui-btn layui-btn-warm layui-btn-xs" lay-event="examReportEvent">申请考试</a>';
return dom;
}
if(row['reportType'] === '2' && row['examType'] === '0'){
dom += '<a type="button" class="layui-btn layui-btn-info layui-btn-xs" lay-event="showExamEvent">查看申请</a>';
dom += '<a type="button" class="layui-btn layui-btn-info layui-btn-xs" lay-event="showEvent">查看详情</a>';
return dom;
}
if(row['reportType'] === '2' && row['examType'] === '1'){
dom += '<a type="button" class="layui-btn layui-btn-info layui-btn-xs" lay-event="showExamEvent">查看考试安排</a>';
return dom;
}
if(row['reportType'] === '2' && row['examType'] === '1'){
dom += '<a type="button" class="layui-btn layui-btn-danger layui-btn-xs" lay-event="reExamEvent">再次申请考试</a>';
if(row['reportType'] === '2' && row['examType'] === '2'){
dom += '<a type="button" class="layui-btn layui-btn-info layui-btn-xs" lay-event="showReasonEvent">查看原因</a>';
dom += '<a type="button" class="layui-btn layui-btn-danger layui-btn-xs" lay-event="reExamEvent">重新申考</a>';
return dom;
}
if(row['reportType'] === '3'){
return '<a type="button" class="layui-btn layui-btn-danger layui-btn-xs" lay-event="unPassEvent">重新审核</a>';
return '<a type="button" class="layui-btn layui-btn-danger layui-btn-xs" lay-event="unPassEvent">重新编辑</a>';
}
return dom;
}
@ -283,29 +285,6 @@
});
}
// 删除
function removeData(ids) {
top.dialog.msg(top.dataMessage.delete, {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3,
yes: function (index) {
top.dialog.close(index);
var layIndex;
top.restAjax.delete(top.restAjax.path('api/classplan/remove/{ids}', [ids]), {}, null, function (code, data) {
top.dialog.msg(top.dataMessage.deleteSuccess, {time: 1000});
reloadTable();
}, function (code, data) {
top.dialog.msg(data.msg);
}, function () {
layIndex = top.dialog.msg(top.dataMessage.deleting, {icon: 16, time: 0, shade: 0.3});
}, function () {
top.dialog.close(layIndex);
});
}
});
}
// 事件 - 页面变化
$win.on('resize', function() {
clearTimeout(resizeTimeout);
@ -369,7 +348,7 @@
if(layEvent == 'showEvent') {
layer.open({
type: 2,
title: '查看开班申请',
title: '查看 【' + obj.data.workerCatalogName + '】 开班申请',
closeBtn: 1,
area: ['90%', '90%'],
shadeClose: false,
@ -380,6 +359,21 @@
}
});
}
if(layEvent == 'showReasonEvent') {
var reason = obj.data.examReason == '' ? '未填写原因' : obj.data.examReason;
layer.open({
type: 1,
title: '申请不通过原因',
closeBtn: 1,
offset:'200px',
area: ['300px', '150px'],
shadeClose: false,
content: '<div style="padding: 20px 50px;">'+ reason +'</div>',
end: function () {
reloadTable();
}
});
}
if(layEvent == 'showExamEvent') {
layer.open({
type: 2,
@ -397,10 +391,10 @@
if(layEvent == 'unPassEvent') {
layer.open({
type: 2,
title: false,
closeBtn: 0,
area: ['100%', '100%'],
shadeClose: true,
title: '重新编辑 【' +obj.data.workerCatalogName + '】 开班申请',
closeBtn: 1,
area: ['90%', '90%'],
shadeClose: false,
anim: 2,
content: top.restAjax.path('route/classplan/update.html?classPlanId={classPlanId}', [obj.data.classPlanId]),
end: function () {

View File

@ -19,7 +19,7 @@
<div class="layui-row">
<div class="layui-col-md6">
<div class="layui-form-item">
<label class="layui-form-label"><span style="color: red">*</span></label>
<label class="layui-form-label"><span style="color: red">*</span></label>
<div class="layui-input-block">
<input type="text" id="planNumber" name="planNumber" class="layui-input" value=""
autocomplete="off" placeholder="班次不可重复" lay-verify="required" maxlength="100">
@ -147,12 +147,12 @@
<div class="test-table-reload-btn">
<div class="layui-inline">
<input type="text" id="date-start-{{item.lessonId}}" class="layui-input search-item lessons-date"
style="width: 150px" placeholder="上午" readonly>
style="width: 150px" placeholder="开始时间" readonly>
</div>
<div class="layui-inline">
<input type="text" id="date-end-{{item.lessonId}}" class="layui-input search-item lessons-date"
style="width: 150px" placeholder="下午" readonly>
style="width: 150px" placeholder="结束时间" readonly>
</div>
</div>
</td>
@ -417,7 +417,6 @@
var obj = {};
obj['lessonId'] = $(e).attr('data-lesson-id');
obj['teacherId'] = $('#select-' + obj['lessonId']).val();
obj['teacherId'] = $('#select-' + obj['lessonId']).val();
obj['lessonStartTime'] = $('#date-start-' + obj['lessonId']).val();
obj['lessonEndTime'] = $('#date-end-' + obj['lessonId']).val();
lessonList.push(obj);

View File

@ -12,30 +12,27 @@
<link rel="stylesheet" type="text/css" href="assets/js/vendor/viewer/viewer.min.css">
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
<div class="layui-anim layui-anim-fadein">
<div class="layui-card">
<div class="layui-card-header">
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
<a class="close" href="javascript:void(0);">上级列表</a><span lay-separator="">/</span>
<a href="javascript:void(0);"><cite>查看内容</cite></a>
</span>
</div>
<div class="layui-card-body" style="padding: 15px;">
<form class="layui-form layui-form-pane" lay-filter="dataForm">
<div class="layui-row">
<div class="layui-col-md6">
<div class="layui-form-item">
<label class="layui-form-label">班号</label>
<label class="layui-form-label"><span style="color: red">*</span>班号</label>
<div class="layui-input-block">
<input type="text" id="planNumber" name="planNumber" class="layui-input" value="" readonly="readonly" maxlength="100">
</div>
</div>
</div>
<div class="layui-col-md6">
</div>
<div class="layui-row">
<div class="layui-col-md12">
<div class="layui-form-item">
<label class="layui-form-label">班级名称</label>
<label class="layui-form-label"><span style="color: red">*</span>班级名称</label>
<div class="layui-input-block">
<input type="text" id="planName" name="planName" class="layui-input" value="" readonly="readonly" maxlength="255">
<input type="text" id="planName" name="planName" class="layui-input" value=""
autocomplete="off" placeholder="请输入班级名称" lay-verify="required" maxlength="255">
</div>
</div>
</div>
@ -43,39 +40,27 @@
<div class="layui-row">
<div class="layui-col-md3">
<div class="layui-form-item">
<label class="layui-form-label">培训类型</label>
<label class="layui-form-label"><span style="color: red">*</span>培训类型</label>
<div class="layui-input-block">
<select id="planType" name="planType" readonly="readonly">
<option value="1">初训</option>
<option value="2">复训</option>
<option value="3">换证</option>
</select>
</div>
</div>
</div>
<div class="layui-col-md3">
<div class="layui-form-item">
<label class="layui-form-label">培训项目</label>
<label class="layui-form-label"><span style="color: red">*</span>培训项目</label>
<div class="layui-input-block">
<input type="hidden" id="projectCatalogId" name="projectCatalogId" value="">
<input type="text" id="projectCatalogName" name="projectCatalogName" class="layui-input" value="" style="cursor: pointer;" readonly="readonly">
<input type="text" id="projectCatalogName" name="projectCatalogName" class="layui-input" value="" style="cursor: pointer;" lay-verify="required" placeholder="请选择培训项目" readonly="readonly">
</div>
</div>
</div>
<div class="layui-col-md3">
<div class="layui-form-item">
<label class="layui-form-label">培训工种</label>
<div class="layui-input-block">
<input type="hidden" id="workerCatalog" name="workerCatalog" value="">
<input type="text" id="workerCatalogName" name="workerCatalogName" class="layui-input" value="" style="cursor: pointer;" readonly="readonly">
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md3">
<div class="layui-form-item">
<label class="layui-form-label">开始时间</label>
<label class="layui-form-label"><span style="color: red">*</span>开始时间</label>
<div class="layui-input-block">
<input type="text" id="planStartTime" name="planStartTime" class="layui-input" value="" placeholder="请选择培训开始时间" readonly style="cursor: pointer;" lay-verify="required">
</div>
@ -83,7 +68,7 @@
</div>
<div class="layui-col-md3">
<div class="layui-form-item">
<label class="layui-form-label">结束时间</label>
<label class="layui-form-label"><span style="color: red">*</span>结束时间</label>
<div class="layui-input-block">
<input type="text" id="planEndTime" name="planEndTime" class="layui-input" value="" placeholder="请选择培训结束时间" readonly style="cursor: pointer;" lay-verify="required">
</div>
@ -93,17 +78,19 @@
<div class="layui-row">
<div class="layui-col-md6">
<div class="layui-form-item">
<label class="layui-form-label">负责人</label>
<label class="layui-form-label"><span style="color: red">*</span>负责人</label>
<div class="layui-input-block">
<input type="text" id="chargePerson" name="chargePerson" class="layui-input" value="" readonly="readonly" maxlength="50">
<input type="text" id="chargePerson" name="chargePerson" class="layui-input" value=""
autocomplete="off" placeholder="请输入负责人" lay-verify="required" maxlength="50">
</div>
</div>
</div>
<div class="layui-col-md6">
<div class="layui-form-item">
<label class="layui-form-label">联系方式</label>
<label class="layui-form-label"><span style="color: red">*</span>联系方式</label>
<div class="layui-input-block">
<input type="text" id="chargePersonTel" name="chargePersonTel" class="layui-input" value="" readonly="readonly" maxlength="255">
<input type="text" id="chargePersonTel" name="chargePersonTel" class="layui-input" value=""
autocomplete="off" placeholder="请输入联系方式" lay-verify="required" maxlength="255">
</div>
</div>
@ -112,9 +99,10 @@
<div class="layui-row">
<div class="layui-col-md12">
<div class="layui-form-item">
<label class="layui-form-label">培训地点</label>
<label class="layui-form-label"><span style="color: red">*</span>培训地点</label>
<div class="layui-input-block">
<input type="text" id="planAddress" name="planAddress" class="layui-input" value="" readonly="readonly" maxlength="255">
<input type="text" id="planAddress" name="planAddress" class="layui-input" value=""
autocomplete="off" placeholder="请输入培训地点" lay-verify="required" maxlength="255">
</div>
</div>
</div>
@ -125,7 +113,8 @@
<thead>
<tr>
<th style="width: 50px; text-align: center"><b>确认课程</b></th>
<th style="width: 200px; text-align: center"><b>选择讲师</b></th>
<th style="width: 100px; text-align: center"><b>选择讲师</b></th>
<th style="width: 200px; text-align: center"><b>授课时间</b></th>
<th style="width: 260px; text-align: center"><b>课程名称</b></th>
<th style="width: 100px; text-align: center"><b>课程类型</b></th>
<th style="width: 100px; text-align: center"><b>授课方式</b></th>
@ -146,6 +135,19 @@
{{# } }}
</select>
</td>
<td>
<div class="test-table-reload-btn">
<div class="layui-inline">
<input type="text" id="date-start-{{item.lessonId}}" value="" class="layui-input search-item lessons-date"
style="width: 150px" placeholder="开始时间" readonly>
</div>
<div class="layui-inline">
<input type="text" id="date-end-{{item.lessonId}}" value="" class="layui-input search-item lessons-date"
style="width: 150px" placeholder="结束时间" readonly>
</div>
</div>
</td>
<td style="text-align: center">
{{item.lessonName}}
</td>
@ -195,6 +197,7 @@
// 初始化内容
function initData() {
$('.layui-card').height($win.height());
var loadLayerIndex;
top.restAjax.get(top.restAjax.path('api/classplan/get/{classPlanId}', [classPlanId]), {}, null, function(code, data) {
var dataFormData = {};
@ -266,6 +269,8 @@
$(checkBox).attr('checked', 'checked');
$('#select-' + e.lessonId).val(e.teacherId);
$('#select-' + e.lessonId).attr("disabled","disabled");
$('#date-start-' + e.lessonId).val(e.lessonStart);
$('#date-end-' + e.lessonId).val(e.lessonEnd);
});
form.render();
}

View File

@ -12,40 +12,28 @@
<link rel="stylesheet" type="text/css" href="assets/js/vendor/viewer/viewer.min.css">
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
<div class="layui-anim layui-anim-fadein">
<div class="layui-card">
<div class="layui-card-header">
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
<a class="close" href="javascript:void(0);">上级列表</a><span lay-separator="">/</span>
<a href="javascript:void(0);"><cite>修改计划</cite></a>
</span>
</div>
<div class="layui-card-body" style="padding: 15px;">
<blockquote id="report-reason-block" class="layui-elem-quote" style="border-left: 5px solid #cc0200;display: none;"></blockquote>
<form class="layui-form layui-form-pane" lay-filter="dataForm">
<input type="hidden" id="orgId" name="orgId" value="">
<input type="hidden" id="workerCatalog" name="workerCatalog" value="">
<div class="layui-row">
<div class="layui-col-md6">
<div class="layui-form-item">
<label class="layui-form-label"><span style="color: red">*</span>培训机构</label>
<label class="layui-form-label"><span style="color: red">*</span>班号</label>
<div class="layui-input-block">
<input type="hidden" id="orgId" name="orgId">
<input type="text" id="orgName" name="orgName" class="layui-input" value="" readonly="readonly" maxlength="100">
</div>
</div>
</div>
<div class="layui-col-md6">
<div class="layui-form-item">
<label class="layui-form-label"><span style="color: red">*</span>计划编号</label>
<div class="layui-input-block">
<input type="text" id="planNumber" name="planNumber" class="layui-input" value="" readonly="readonly" maxlength="100">
<input type="text" id="planNumber" name="planNumber" class="layui-input" value=""
autocomplete="off" readonly="readonly" lay-verify="required" maxlength="100">
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md6">
<div class="layui-col-md12">
<div class="layui-form-item">
<label class="layui-form-label"><span style="color: red">*</span>计划名称</label>
<label class="layui-form-label"><span style="color: red">*</span>班级名称</label>
<div class="layui-input-block">
<input type="text" id="planName" name="planName" class="layui-input" value="" placeholder="请输入培训计划名称" lay-verify="required" maxlength="255">
</div>
@ -57,10 +45,9 @@
<div class="layui-form-item">
<label class="layui-form-label"><span style="color: red">*</span>培训类型</label>
<div class="layui-input-block">
<select id="planType" name="planType" lay-verify="required">
<select id="planType" name="planType">
<option value="1">初训</option>
<option value="2">复训</option>
<option value="3">换证</option>
</select>
</div>
</div>
@ -70,58 +57,23 @@
<label class="layui-form-label"><span style="color: red">*</span>培训项目</label>
<div class="layui-input-block">
<input type="hidden" id="projectCatalogId" name="projectCatalogId" value="">
<input type="text" id="projectCatalogName" name="projectCatalogName" class="layui-input" value="" style="cursor: pointer;" placeholder="请选择培训项目" lay-verify="required" readonly="readonly">
<input type="text" id="projectCatalogName" name="projectCatalogName" class="layui-input" value="" style="cursor: pointer;" lay-verify="required" placeholder="请选择培训项目" readonly="readonly">
</div>
</div>
</div>
<div class="layui-col-md3">
<div class="layui-form-item">
<label class="layui-form-label"><span style="color: red">*</span>培训工种</label>
<label class="layui-form-label"><span style="color: red">*</span>开班时间</label>
<div class="layui-input-block">
<input type="hidden" id="workerCatalog" name="workerCatalog" value="">
<input type="text" id="workerCatalogName" name="workerCatalogName" class="layui-input" value="" style="cursor: pointer;" placeholder="请选择培训工种" lay-verify="required" readonly="readonly">
<input type="text" id="planStartTime" name="planStartTime" class="layui-input" value="" placeholder="请选择开班时间" readonly style="cursor: pointer;" lay-verify="required">
</div>
</div>
</div>
<div class="layui-col-md3">
<div class="layui-form-item">
<label class="layui-form-label"><span style="color: red">*</span>计划人数</label>
<label class="layui-form-label"><span style="color: red">*</span>结课时间</label>
<div class="layui-input-block">
<input type="number" id="planPersonNum" name="planPersonNum" class="layui-input" value="0" placeholder="请输入计划人数" lay-verify="checkPlanPersonNum">
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md3">
<div class="layui-form-item">
<label class="layui-form-label"><span style="color: red">*</span>开始时间</label>
<div class="layui-input-block">
<input type="text" id="planStartTime" name="planStartTime" class="layui-input" value="" placeholder="请选择培训开始时间" readonly style="cursor: pointer;" lay-verify="required">
</div>
</div>
</div>
<div class="layui-col-md3">
<div class="layui-form-item">
<label class="layui-form-label"><span style="color: red">*</span>结束时间</label>
<div class="layui-input-block">
<input type="text" id="planEndTime" name="planEndTime" class="layui-input" value="" placeholder="请选择培训结束时间" readonly style="cursor: pointer;" lay-verify="required">
</div>
</div>
</div>
<div class="layui-col-md3">
<div class="layui-form-item">
<label class="layui-form-label"><span style="color: red">*</span>报名时间</label>
<div class="layui-input-block">
<input type="text" id="signUpStartTime" name="signUpStartTime" class="layui-input" value="" placeholder="请选择报名时间开始" readonly style="cursor: pointer;" lay-verify="required">
</div>
</div>
</div>
<div class="layui-col-md3">
<div class="layui-form-item">
<label class="layui-form-label"><span style="color: red">*</span>报名截止</label>
<div class="layui-input-block">
<input type="text" id="signUpEndTime" name="signUpEndTime" class="layui-input" value="" placeholder="请选择报名时间截止" readonly style="cursor: pointer;" lay-verify="required">
<input type="text" id="planEndTime" name="planEndTime" class="layui-input" value="" placeholder="请选择结课时间" readonly style="cursor: pointer;" lay-verify="required">
</div>
</div>
</div>
@ -159,13 +111,14 @@
<div class="layui-col-md12">
<table class="layui-table" id="dataTable" lay-filter="dataTable">
<thead>
<tr>
<th style="width: 50px; text-align: center"><b>确认课程</b></th>
<th style="width: 200px; text-align: center"><b>选择讲师</b></th>
<th style="width: 260px; text-align: center"><b>课程名称</b></th>
<th style="width: 100px; text-align: center"><b>课程类型</b></th>
<th style="width: 100px; text-align: center"><b>授课方式</b></th>
</tr>
<tr>
<th style="width: 50px; text-align: center"><b>确认课程</b></th>
<th style="width: 100px; text-align: center"><b>选择讲师</b></th>
<th style="width: 200px; text-align: center"><b>授课时间</b></th>
<th style="width: 260px; text-align: center"><b>课程名称</b></th>
<th style="width: 100px; text-align: center"><b>课程类型</b></th>
<th style="width: 100px; text-align: center"><b>授课方式</b></th>
</tr>
</thead>
<tbody id="lessonTbodyBox"></tbody>
<script type="text/html" id="lessonTbodyTemplate">
@ -182,6 +135,19 @@
{{# } }}
</select>
</td>
<td>
<div class="test-table-reload-btn">
<div class="layui-inline">
<input type="text" id="date-start-{{item.lessonId}}" class="layui-input search-item lessons-date"
style="width: 150px" placeholder="开始时间" readonly>
</div>
<div class="layui-inline">
<input type="text" id="date-end-{{item.lessonId}}" class="layui-input search-item lessons-date"
style="width: 150px" placeholder="结束时间" readonly>
</div>
</div>
</td>
<td style="text-align: center">
{{item.lessonName}}
</td>
@ -239,6 +205,7 @@
// 初始化内容
function initData() {
$('.layui-card').height($win.height());
var loadLayerIndex;
top.restAjax.get(top.restAjax.path('api/classplan/get/{classPlanId}', [classPlanId]), {}, null, function(code, data) {
var dataFormData = {};
@ -252,7 +219,7 @@
form.val('dataForm', dataFormData);
form.render(null, 'dataForm');
if(dataFormData['reportReason'] != ''){
$('#report-reason-block').text('报备未通过原因:' + dataFormData['reportReason']);
$('#report-reason-block').text('未通过原因:' + dataFormData['reportReason']);
$('#report-reason-block').show();
}
initPlanStartTimeDateTime();
@ -315,25 +282,84 @@
$(checkBox).attr('checked', 'checked');
$('#select-' + e.lessonId).val(e.teacherId);
$('#select-' + e.lessonId).attr("disabled","disabled");
$('#date-start-' + e.lessonId).val(e.lessonStart);
$('#date-start-' + e.lessonId).attr("disabled","disabled");
$('#date-end-' + e.lessonId).val(e.lessonEnd);
$('#date-end-' + e.lessonId).attr("disabled","disabled");
});
form.render();
$.each($('.lessons-date'),function(){
var _this = this;
laydate.render({
format : 'HH:mm',
elem: _this,
type: 'time',
trigger: 'click',
min: '08:00:00',
max: '21:00:00'
});
});
}
form.on('checkbox(lessonCheckBox)',function(data){
var lessonId = $(data.elem).attr('data-lesson-id');
var teacherId = $('#select-' + lessonId).val();
if(data.elem.checked == false){
$('#select-' + lessonId).removeAttr("disabled");
form.render();
return;
}
var dateStartTime = $('#date-start-' + lessonId).val();
var dateEndTime = $('#date-end-' + lessonId).val();
if(teacherId == ''){
data.elem.checked = false;
form.render();
layer.msg('先选择讲师');
return;
}
if(dateStartTime == '' || dateEndTime == ''){
data.elem.checked = false;
$('#date-start-' + lessonId).removeAttr("disabled");
$('#date-end-' + lessonId).removeAttr("disabled");
form.render();
layer.msg('授课时间存在空值');
return;
}
dateStartTime = '1970-12-12 ' + dateStartTime + ':00';
dateEndTime = '1970-12-12 ' + dateEndTime + ':00';
if(verifyDate(dateStartTime,dateEndTime) != -1){
data.elem.checked = false;
$('#date-start-' + lessonId).removeAttr("disabled");
$('#date-end-' + lessonId).removeAttr("disabled");
form.render();
layer.msg('授课起止时间冲突');
return;
}
//校验所有时间是否合法
var checkedList = $('input[name="lessonCheckBox"]:checked');
var checkPass = true;
if((checkedList.length -1) != 0){
$.each(checkedList,function(i,e){
var tempLessonId = $(e).attr('data-lesson-id');
var tempTeacherId = $('#select-' + tempLessonId).val();
var _tempStart = '1970-12-12 ' + $('#date-start-' + tempLessonId).val() + ':00';
var _tempEnd = '1970-12-12 ' + $('#date-end-' + tempLessonId).val() + ':00';
if((verifyDate(dateEndTime, _tempStart) == -1)
|| (verifyDate(dateStartTime, _tempEnd) == 1)){
checkPass = true;
} else if( tempLessonId != lessonId && tempTeacherId == teacherId){
data.elem.checked = false;
layer.msg('课程时间存在冲突');
form.render();
return;
}
});
}
if(data.elem.checked == false){
$('#select-' + lessonId).removeAttr("disabled");
$('#date-start-' + lessonId).removeAttr("disabled");
$('#date-end-' + lessonId).removeAttr("disabled");
form.render();
return;
}
$('#select-' + lessonId).attr("disabled","disabled");
$('#date-start-' + lessonId).attr("disabled","disabled");
$('#date-end-' + lessonId).attr("disabled","disabled");
form.render();
});
@ -425,6 +451,8 @@
var obj = {};
obj['lessonId'] = $(e).attr('data-lesson-id');
obj['teacherId'] = $('#select-' + obj['lessonId']).val();
obj['lessonStartTime'] = $('#date-start-' + obj['lessonId']).val();
obj['lessonEndTime'] = $('#date-end-' + obj['lessonId']).val();
lessonList.push(obj);
});
if(lessonList.length == 0){
@ -442,7 +470,7 @@
shade: 0.3,
yes: function(index) {
top.dialog.close(index);
window.location.reload();
closeBox();
},
btn2: function() {
closeBox();
@ -467,6 +495,20 @@
closeBox();
});
function verifyDate(value1,value2){
var v1 = new Date(Date.parse(value1.replace(/-/g,"/"))).getTime();
var v2 = new Date(Date.parse(value2.replace(/-/g,"/"))).getTime();
if( v1 < v2){
return -1;
}
if( v1 == v2){
return 0;
}
if( v1 > v2){
return 1;
}
}
// 校验
form.verify({
checkPlanPersonNum : function(value){