培训计划回显编辑方法完善
This commit is contained in:
parent
5b3577125d
commit
92901b788e
@ -44,6 +44,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/{classPlanId}")
|
||||
@CheckRequestBodyAnnotation
|
||||
public SuccessResult update(@PathVariable("classPlanId") String classPlanId, @RequestBody JSONObject obj) {
|
||||
obj.put("classPlanId",classPlanId);
|
||||
classPlanService.updateJson(obj);
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除", notes = "删除接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "ids", value = "ID列表,用下划线分隔", paramType = "path", example = "1_2_3")
|
||||
@ -55,18 +68,6 @@ 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/{classPlanId}")
|
||||
@CheckRequestBodyAnnotation
|
||||
public SuccessResult update(@PathVariable("classPlanId") String classPlanId, @RequestBody ClassPlanVO classPlanVO) {
|
||||
classPlanService.update(classPlanId, classPlanVO);
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "详情", notes = "详情接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "classPlanId", value = "ID", paramType = "path")
|
||||
|
@ -122,4 +122,17 @@ public interface IClassPlanDao {
|
||||
* @param params
|
||||
*/
|
||||
void saveClassPlanLesson(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 查询计划下课程选择信息
|
||||
* @param classPlanId
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> listClassPlanLessons(String classPlanId);
|
||||
|
||||
/**
|
||||
* 逻辑删除计划下所有课程
|
||||
* @param params
|
||||
*/
|
||||
void deleteClassPlanLessons(Map<String, Object> params);
|
||||
}
|
@ -5,6 +5,10 @@ import ink.wgink.annotation.CheckNumberAnnotation;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @ClassName: ClassPlanDTO
|
||||
@ -59,6 +63,11 @@ public class ClassPlanDTO {
|
||||
private String reportType;
|
||||
@ApiModelProperty(name = "reportReason", value = "报备审核原因")
|
||||
private String reportReason;
|
||||
@ApiModelProperty(name = "orgName", value = "机构名称")
|
||||
private String orgName;
|
||||
@ApiModelProperty(name = "classPlanLessons", value = "计划下课程列表")
|
||||
private List<Map<String,Object>> classPlanLessons;
|
||||
|
||||
|
||||
public String getPlanNumber() {
|
||||
return planNumber == null ? "" : planNumber.trim();
|
||||
@ -211,4 +220,23 @@ public class ClassPlanDTO {
|
||||
public void setWorkerCatalogName(String workerCatalogName) {
|
||||
this.workerCatalogName = workerCatalogName;
|
||||
}
|
||||
|
||||
public String getOrgName() {
|
||||
return orgName == null ? "" : orgName;
|
||||
}
|
||||
|
||||
public void setOrgName(String orgName) {
|
||||
this.orgName = orgName;
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getClassPlanLessons() {
|
||||
if (classPlanLessons == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return classPlanLessons;
|
||||
}
|
||||
|
||||
public void setClassPlanLessons(List<Map<String, Object>> classPlanLessons) {
|
||||
this.classPlanLessons = classPlanLessons;
|
||||
}
|
||||
}
|
||||
|
@ -88,6 +88,14 @@ public interface IClassPlanService {
|
||||
*/
|
||||
void update(String classPlanId, ClassPlanVO classPlanVO);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
void updateJson(JSONObject obj);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
@ -198,4 +206,5 @@ public interface IClassPlanService {
|
||||
* @param classPlanVO
|
||||
*/
|
||||
void updateReportType(String classPlanId, ClassPlanVO classPlanVO);
|
||||
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
package cn.com.tenlion.service.classplan.impl;
|
||||
|
||||
import cn.com.tenlion.dao.classplan.IClassPlanDao;
|
||||
import cn.com.tenlion.institutionmanagement.pojo.dtos.institution.InstitutionDTO;
|
||||
import cn.com.tenlion.institutionmanagement.service.institution.IInstitutionService;
|
||||
import cn.com.tenlion.pojo.bos.classplan.ClassPlanBO;
|
||||
import cn.com.tenlion.pojo.dtos.classplan.ClassPlanDTO;
|
||||
import cn.com.tenlion.pojo.dtos.worktype.WorkTypeDTO;
|
||||
@ -47,6 +49,8 @@ public class ClassPlanServiceImpl extends DefaultBaseService implements IClassPl
|
||||
private IDataService dataService;
|
||||
@Autowired
|
||||
private IWorkTypeService workTypeService;
|
||||
@Autowired
|
||||
private IInstitutionService iInstitutionService;
|
||||
|
||||
@Override
|
||||
public void save(ClassPlanVO classPlanVO) {
|
||||
@ -115,6 +119,44 @@ public class ClassPlanServiceImpl extends DefaultBaseService implements IClassPl
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateJson(JSONObject obj) {
|
||||
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);
|
||||
classPlanDao.deleteClassPlanLessons(params);
|
||||
//保存课程及讲师
|
||||
JSONArray array = obj.getJSONArray("lessonList");
|
||||
params.clear();
|
||||
for(int i = 0; i < array.size(); i++){
|
||||
JSONObject item = array.getJSONObject(i);
|
||||
params.put("classPlanId",classPlanId);
|
||||
params.put("lessonId",item.getString("lessonId"));
|
||||
params.put("teacherId",item.getString("teacherId"));
|
||||
params.put("isDelete",item.getString("teacherId"));
|
||||
classPlanDao.saveClassPlanLesson(params);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(List<String> ids) {
|
||||
remove(null, ids);
|
||||
@ -179,7 +221,20 @@ public class ClassPlanServiceImpl extends DefaultBaseService implements IClassPl
|
||||
public ClassPlanDTO get(String classPlanId) {
|
||||
Map<String, Object> params = super.getHashMap(2);
|
||||
params.put("classPlanId", classPlanId);
|
||||
return get(params);
|
||||
ClassPlanDTO dto = get(params);
|
||||
// 查询机构名称
|
||||
InstitutionDTO institutionDTO = iInstitutionService.get(dto.getOrgId());
|
||||
dto.setOrgName(institutionDTO.getInstitutionName());
|
||||
// 查询培训项目
|
||||
DataDTO dataDTO = dataService.get(dto.getProjectCatalogId());
|
||||
dto.setProjectCatalogName(dataDTO.getDataName());
|
||||
// 查询工种类型
|
||||
WorkTypeDTO workTypeDTO = workTypeService.get(dto.getWorkerCatalog());
|
||||
dto.setWorkerCatalogName(workTypeDTO.getWorkTypeName());
|
||||
// 查询当前计划下所有课程和讲师绑定信息
|
||||
List<Map<String, Object>> classPlanLessons = classPlanDao.listClassPlanLessons(classPlanId);
|
||||
dto.setClassPlanLessons(classPlanLessons);
|
||||
return dto;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -405,4 +405,23 @@
|
||||
(#{classPlanId},#{lessonId},#{teacherId},0)
|
||||
</insert>
|
||||
|
||||
<select id="listClassPlanLessons" parameterType="string" resultType="map">
|
||||
SELECT
|
||||
t1.class_plan_id classPlanId,
|
||||
t1.lesson_id lessonId,
|
||||
t1.teacher_id teacherId
|
||||
FROM
|
||||
e_class_plan_lesson t1
|
||||
WHERE
|
||||
t1.is_delete = '0'
|
||||
AND t1.class_plan_id = #{classPlanId}
|
||||
</select>
|
||||
|
||||
<update id="deleteClassPlanLessons" parameterType="map">
|
||||
UPDATE e_class_plan_lesson SET
|
||||
is_delete = '1'
|
||||
WHERE
|
||||
class_plan_id = #{classPlanId}
|
||||
</update>
|
||||
|
||||
</mapper>
|
@ -330,6 +330,14 @@
|
||||
} else if(checkDatas.length > 1) {
|
||||
top.dialog.msg(top.dataMessage.table.selectOneEdit);
|
||||
} else {
|
||||
if(checkDatas[0].reportType == '1'){
|
||||
layer.msg('报备待审状态下无法修改');
|
||||
return;
|
||||
}
|
||||
if(checkDatas[0].reportType == '2'){
|
||||
layer.msg('报备通过后无法修改');
|
||||
return;
|
||||
}
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: false,
|
||||
|
@ -396,6 +396,10 @@
|
||||
obj['teacherId'] = $('#select-' + obj['lessonId']).val();
|
||||
lessonList.push(obj);
|
||||
});
|
||||
if(lessonList.length == 0){
|
||||
layer.msg('请至少选择一节课程');
|
||||
return;
|
||||
}
|
||||
formData.field['lessonList'] = lessonList;
|
||||
top.dialog.confirm(top.dataMessage.commit, function(index) {
|
||||
top.dialog.close(index);
|
||||
|
@ -17,93 +17,196 @@
|
||||
<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>
|
||||
<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-form-item">
|
||||
<label class="layui-form-label">培训计划编号</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="planNumber" name="planNumber" class="layui-input" value="" placeholder="请输入培训计划编号" maxlength="100">
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">培训机构</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>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">培训计划名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="planName" name="planName" class="layui-input" value="" placeholder="请输入培训计划名称" maxlength="255">
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-md6">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">计划编号</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="planNumber" name="planNumber" class="layui-input" value="" placeholder="请输入培训计划编号" maxlength="100">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">计划名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="planName" name="planName" class="layui-input" value="" placeholder="请输入培训计划名称" maxlength="255">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">培训类型1初训2复训3换证</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="planType" name="planType" class="layui-input" value="1" placeholder="请输入培训类型1初训2复训3换证" maxlength="255">
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-md3">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">培训类型</label>
|
||||
<div class="layui-input-block">
|
||||
<select id="planType" name="planType">
|
||||
<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>
|
||||
<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="请选择培训项目" 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;" 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="number" id="planPersonNum" name="planPersonNum" class="layui-input" value="0" placeholder="请输入计划人数" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">培训项目</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="projectCatalogId" name="projectCatalogId" class="layui-input" value="" placeholder="请输入培训项目" maxlength="36">
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-md3">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">开始时间</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">结束时间</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">报名时间</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">报名截止</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">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">培训工种</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="workerCatalog" name="workerCatalog" class="layui-input" value="" placeholder="请输入培训工种" maxlength="36">
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-md6">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">负责人</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="chargePerson" name="chargePerson" class="layui-input" value="" placeholder="请输入负责人" maxlength="50">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">联系方式</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="chargePersonTel" name="chargePersonTel" class="layui-input" value="" placeholder="请输入联系方式" maxlength="255">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">计划人数</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" id="planPersonNum" name="planPersonNum" class="layui-input" value="0" placeholder="请输入计划人数" lay-verify="required">
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">培训地点</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="planAddress" name="planAddress" class="layui-input" value="" placeholder="请输入培训地点" maxlength="255">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">培训开始时间</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="planStartTime" name="planStartTime" class="layui-input" value="" placeholder="请选择培训开始时间" lay-verify="required" readonly style="cursor: pointer;">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">培训结束时间</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="planEndTime" name="planEndTime" class="layui-input" value="" placeholder="请选择培训结束时间" lay-verify="required" readonly style="cursor: pointer;">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">报名时间开始</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="signUpStartTime" name="signUpStartTime" class="layui-input" value="" placeholder="请选择报名时间开始" lay-verify="required" readonly style="cursor: pointer;">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">报名时间截止</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="signUpEndTime" name="signUpEndTime" class="layui-input" value="" placeholder="请选择报名时间截止" lay-verify="required" readonly style="cursor: pointer;">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">培训地点</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="planAddress" name="planAddress" class="layui-input" value="" placeholder="请输入培训地点" maxlength="255">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">负责人</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="chargePerson" name="chargePerson" class="layui-input" value="" placeholder="请输入负责人" maxlength="50">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">联系方式</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="chargePersonTel" name="chargePersonTel" class="layui-input" value="" placeholder="请输入联系方式" maxlength="255">
|
||||
<div class="layui-row">
|
||||
<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>
|
||||
</thead>
|
||||
<tbody id="lessonTbodyBox"></tbody>
|
||||
<script type="text/html" id="lessonTbodyTemplate">
|
||||
{{# for(var i = 0, item; item = d.lesson[i++];) { }}
|
||||
<tr id="lesson-{{item.lessonId}}" data-lesson-id="{{item.lessonId}}">
|
||||
<td style="text-align: center">
|
||||
<input data-lesson-id="{{item.lessonId}}" type="checkbox" name="lessonCheckBox" lay-skin="primary" lay-filter="lessonCheckBox">
|
||||
</td>
|
||||
<td style="text-align: center">
|
||||
<select id="select-{{item.lessonId}}">
|
||||
<option value="">请选择</option>
|
||||
{{# for(var j = 0, teacher; teacher = d.teacher[j++];) { }}
|
||||
<option value="{{teacher.teacherId}}">{{teacher.teacherName}}</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</td>
|
||||
<td style="text-align: center">
|
||||
{{item.lessonName}}
|
||||
</td>
|
||||
<td style="text-align: center">
|
||||
{{# if(item.lessonType == '1'){ }}
|
||||
必修
|
||||
{{# } }}
|
||||
{{# if(item.lessonType == '2'){ }}
|
||||
选修
|
||||
{{# } }}
|
||||
</td>
|
||||
<td style="text-align: center">
|
||||
{{# if(item.teachWay == '1'){ }}
|
||||
面授
|
||||
{{# } }}
|
||||
</td>
|
||||
</tr>
|
||||
{{# } }}
|
||||
</script>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-layout-admin">
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-footer" style="left: 0;">
|
||||
<button type="button" class="layui-btn" lay-submit lay-filter="submitForm">提交编辑</button>
|
||||
<div class="layui-footer" style="left: 0;z-index: 10">
|
||||
<button type="button" class="layui-btn" lay-submit lay-filter="submitForm">提交新增</button>
|
||||
<button type="button" class="layui-btn layui-btn-primary close">返回上级</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -121,111 +224,20 @@
|
||||
base: 'assets/layuiadmin/' //静态资源所在路径
|
||||
}).extend({
|
||||
index: 'lib/index' //主入口模块
|
||||
}).use(['index', 'form', 'laydate', 'laytpl'], function(){
|
||||
}).use(['index', 'table', 'form', 'laydate', 'laytpl'], function(){
|
||||
var $ = layui.$;
|
||||
var $win = $(window);
|
||||
var table = layui.table;
|
||||
var form = layui.form;
|
||||
var admin = layui.admin;
|
||||
var laytpl = layui.laytpl;
|
||||
var laydate = layui.laydate;
|
||||
var classPlanId = top.restAjax.params(window.location.href).classPlanId;
|
||||
|
||||
var wangEditor = window.wangEditor;
|
||||
var wangEditorObj = {};
|
||||
var viewerObj = {};
|
||||
|
||||
function closeBox() {
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||
}
|
||||
|
||||
function refreshDownloadTemplet(fileName, file) {
|
||||
var dataRander = {};
|
||||
dataRander[fileName] = file;
|
||||
|
||||
laytpl(document.getElementById(fileName +'FileDownload').innerHTML).render(dataRander, function(html) {
|
||||
document.getElementById(fileName +'FileBox').innerHTML = html;
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化文件列表
|
||||
function initFileList(fileName, ids, callback) {
|
||||
var dataForm = {};
|
||||
dataForm[fileName] = ids;
|
||||
form.val('dataForm', dataForm);
|
||||
|
||||
if(!ids) {
|
||||
refreshDownloadTemplet(fileName, []);
|
||||
if(callback) {
|
||||
callback(fileName, []);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
top.restAjax.get(top.restAjax.path('api/file/list', []), {
|
||||
ids: ids
|
||||
}, null, function(code, data) {
|
||||
refreshDownloadTemplet(fileName, data);
|
||||
if(callback) {
|
||||
callback(fileName, data);
|
||||
}
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化视频
|
||||
function initVideo(fileName, data) {
|
||||
for(var i = 0, item; item = data[i++];) {
|
||||
var player = new ckplayer({
|
||||
container: '#'+ fileName + i,
|
||||
variable: 'player',
|
||||
flashplayer: false,
|
||||
video: {
|
||||
file: 'route/file/download/true/'+ item.fileId,
|
||||
type: 'video/mp4'
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化培训开始时间时间戳
|
||||
function initPlanStartTimeDateTime() {
|
||||
laydate.render({
|
||||
elem: '#planStartTime',
|
||||
type: 'datetime',
|
||||
value: new Date(),
|
||||
trigger: 'click'
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化培训结束时间时间戳
|
||||
function initPlanEndTimeDateTime() {
|
||||
laydate.render({
|
||||
elem: '#planEndTime',
|
||||
type: 'datetime',
|
||||
value: new Date(),
|
||||
trigger: 'click'
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化报名时间开始时间戳
|
||||
function initSignUpStartTimeDateTime() {
|
||||
laydate.render({
|
||||
elem: '#signUpStartTime',
|
||||
type: 'datetime',
|
||||
value: new Date(),
|
||||
trigger: 'click'
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化报名时间截止时间戳
|
||||
function initSignUpEndTimeDateTime() {
|
||||
laydate.render({
|
||||
elem: '#signUpEndTime',
|
||||
type: 'datetime',
|
||||
value: new Date(),
|
||||
trigger: 'click'
|
||||
});
|
||||
}
|
||||
|
||||
var teacherList = [];
|
||||
var classPlanLessons = [];
|
||||
var classPlanId = top.restAjax.params(window.location.href).classPlanId;
|
||||
|
||||
// 初始化内容
|
||||
function initData() {
|
||||
@ -235,12 +247,19 @@
|
||||
for(var i in data) {
|
||||
dataFormData[i] = data[i] +'';
|
||||
}
|
||||
dataFormData['planStartTime'] = dataFormData['planStartTime'].substring(0,10);
|
||||
dataFormData['planEndTime'] = dataFormData['planEndTime'].substring(0,10);
|
||||
dataFormData['signUpStartTime'] = dataFormData['signUpStartTime'].substring(0,10);
|
||||
dataFormData['signUpEndTime'] = dataFormData['signUpEndTime'].substring(0,10);
|
||||
form.val('dataForm', dataFormData);
|
||||
form.render(null, 'dataForm');
|
||||
initPlanStartTimeDateTime();
|
||||
initPlanEndTimeDateTime();
|
||||
initSignUpStartTimeDateTime();
|
||||
initSignUpEndTimeDateTime();
|
||||
//初始化课程列表
|
||||
initTeacherList(data.orgId);
|
||||
classPlanLessons = data.classPlanLessons;
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
@ -250,14 +269,172 @@
|
||||
});
|
||||
}
|
||||
initData();
|
||||
|
||||
|
||||
//查询讲师列表
|
||||
function initTeacherList(orgId){
|
||||
top.restAjax.get(top.restAjax.path('api/teacher/list',[]), {orgId : orgId}, null, function(code,data){
|
||||
teacherList = data;
|
||||
initLessonsList();
|
||||
},function(code,data){
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
//查询课程列表
|
||||
function initLessonsList(){
|
||||
var dataObj = {};
|
||||
var projectCatalogId = $('#projectCatalogId').val();
|
||||
if(projectCatalogId == ''){
|
||||
dataObj['lesson'] = [];
|
||||
dataObj['teacher'] = [];
|
||||
laytpl(document.getElementById('lessonTbodyTemplate').innerHTML).render(dataObj, function(html) {
|
||||
document.getElementById('lessonTbodyBox').innerHTML = html;
|
||||
});
|
||||
form.render();
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/lessons/list',[]), {projectCatalogId : projectCatalogId}, null, function(code,data){
|
||||
dataObj['lesson'] = data;
|
||||
dataObj['teacher'] = teacherList;
|
||||
laytpl(document.getElementById('lessonTbodyTemplate').innerHTML).render(dataObj, function(html) {
|
||||
document.getElementById('lessonTbodyBox').innerHTML = html;
|
||||
});
|
||||
form.render();
|
||||
reloadLessonsList();
|
||||
},function(code,data){
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
function reloadLessonsList(){
|
||||
if(typeof (classPlanLessons) != 'undefined' && classPlanLessons.length > 0)
|
||||
$.each(classPlanLessons,function(i,e){
|
||||
var checkBox = $('#lesson-' + e.lessonId).find('input[name="lessonCheckBox"]').get(0);
|
||||
$(checkBox).attr('checked', 'checked');
|
||||
$('#select-' + e.lessonId).val(e.teacherId);
|
||||
$('#select-' + e.lessonId).attr("disabled","disabled");
|
||||
});
|
||||
form.render();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
if(teacherId == ''){
|
||||
data.elem.checked = false;
|
||||
form.render();
|
||||
layer.msg('先选择讲师');
|
||||
return;
|
||||
}
|
||||
$('#select-' + lessonId).attr("disabled","disabled");
|
||||
form.render();
|
||||
});
|
||||
|
||||
$(document).on('click', '#projectCatalogName', function() {
|
||||
var dataUrl = 'api/data/listztree';
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '选择培训项目',
|
||||
closeBtn: 1,
|
||||
area: ['200px', '400px'],
|
||||
shadeClose: false,
|
||||
anim: 2,
|
||||
content: top.restAjax.path('route/classplan/select-tree.html?parentId={parentId}&dataUrl={dataUrl}',
|
||||
['9c57f832-0606-48eb-94bb-9b3f90ca0cb2',dataUrl]),
|
||||
end: function() {
|
||||
var obj = {};
|
||||
obj['projectCatalogId'] = top.dialog.dialogTreeData.selectedNodes['id'];
|
||||
obj['projectCatalogName'] = top.dialog.dialogTreeData.selectedNodes['name'];
|
||||
form.val('dataForm',obj);
|
||||
form.render(null, 'dataForm');
|
||||
top.dialog.dialogTreeData.selectedNodes = {};
|
||||
initLessonsList();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '#workerCatalogName', function() {
|
||||
var dataUrl = 'api/worktype/listztree';
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '选择工种',
|
||||
closeBtn: 1,
|
||||
area: ['200px', '400px'],
|
||||
shadeClose: false,
|
||||
anim: 2,
|
||||
content: top.restAjax.path('route/classplan/select-tree.html?parentId={parentId}&dataUrl={dataUrl}', ['0',dataUrl]),
|
||||
end: function() {
|
||||
var obj = {};
|
||||
obj['workerCatalog'] = top.dialog.dialogTreeData.selectedNodes['id'];
|
||||
obj['workerCatalogName'] = top.dialog.dialogTreeData.selectedNodes['name'];
|
||||
form.val('dataForm',obj);
|
||||
form.render(null, 'dataForm');
|
||||
top.dialog.dialogTreeData.selectedNodes = {};
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// 初始化培训开始时间时间戳
|
||||
function initPlanStartTimeDateTime() {
|
||||
laydate.render({
|
||||
elem: '#planStartTime',
|
||||
type: 'date',
|
||||
trigger: 'click'
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化培训结束时间时间戳
|
||||
function initPlanEndTimeDateTime() {
|
||||
laydate.render({
|
||||
elem: '#planEndTime',
|
||||
type: 'date',
|
||||
trigger: 'click'
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化报名时间开始时间戳
|
||||
function initSignUpStartTimeDateTime() {
|
||||
laydate.render({
|
||||
elem: '#signUpStartTime',
|
||||
type: 'date',
|
||||
trigger: 'click'
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化报名时间截止时间戳
|
||||
function initSignUpEndTimeDateTime() {
|
||||
laydate.render({
|
||||
elem: '#signUpEndTime',
|
||||
type: 'date',
|
||||
trigger: 'click'
|
||||
});
|
||||
}
|
||||
|
||||
// 提交表单
|
||||
form.on('submit(submitForm)', function(formData) {
|
||||
var checkedList = $('input[name="lessonCheckBox"]:checked');
|
||||
var lessonList = [];
|
||||
$.each(checkedList, function(i,e){
|
||||
var obj = {};
|
||||
obj['lessonId'] = $(e).attr('data-lesson-id');
|
||||
obj['teacherId'] = $('#select-' + obj['lessonId']).val();
|
||||
lessonList.push(obj);
|
||||
});
|
||||
if(lessonList.length == 0){
|
||||
layer.msg('请至少选择一节课程');
|
||||
return;
|
||||
}
|
||||
formData.field['lessonList'] = lessonList;
|
||||
top.dialog.confirm(top.dataMessage.commit, function(index) {
|
||||
top.dialog.close(index);
|
||||
var loadLayerIndex;
|
||||
top.restAjax.put(top.restAjax.path('api/classplan/update/{classPlanId}', [classPlanId]), formData.field, null, function(code, data) {
|
||||
var layerIndex = top.dialog.msg(top.dataMessage.updateSuccess, {
|
||||
var layerIndex = top.dialog.msg(top.dataMessage.commitSuccess, {
|
||||
time: 0,
|
||||
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||
shade: 0.3,
|
||||
@ -280,6 +457,10 @@
|
||||
return false;
|
||||
});
|
||||
|
||||
function closeBox() {
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||
}
|
||||
|
||||
$('.close').on('click', function() {
|
||||
closeBox();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user