Commit ed27c9a0 authored by zhangjianqian's avatar zhangjianqian

Merge remote-tracking branch 'origin/master'

parents 9b0abed6 16064447
package com.zehong.web.controller.contractTrain;
import java.util.List;
import com.zehong.system.domain.vo.BatchTopicVo;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -79,6 +81,16 @@ public class TContractorTrainCourseTopicController extends BaseController
return toAjax(tContractorTrainCourseTopicService.insertTContractorTrainCourseTopic(tContractorTrainCourseTopic));
}
/**
* 题库批量导入试题
* @param batchTopicVo 试题实体
* @return AjaxResult
*/
@PostMapping("/bachAddTopic")
public AjaxResult bachAddTopic(@RequestBody BatchTopicVo batchTopicVo){
return toAjax(tContractorTrainCourseTopicService.bachAddTopic(batchTopicVo));
}
/**
* 修改承包商及访客培训题库
*/
......
......@@ -4,6 +4,7 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -81,6 +82,10 @@ public class TContractorTrainResultController extends BaseController
@GetMapping("/examination")
public AjaxResult examination( TContractorTrainResult tContractorTrainResult){
String n="["+tContractorTrainResult.getAnswers()+']';
//字符串转换成二维数组
Integer[][] integers = JSON.parseObject(n, Integer[][].class);
tContractorTrainResult.setIntegers(integers);
//结束时间
tContractorTrainResult.setTestEndTime(new Date());
Map<String, Object> examination = tContractorTrainResultService.examination(tContractorTrainResult);
......
......@@ -41,7 +41,6 @@ public class TTrainCourseBankController extends BaseController
public TableDataInfo list(TTrainCourseBank tTrainCourseBank)
{
startPage();
System.out.println(tTrainCourseBank);
List<TTrainCourseBank> list = tTrainCourseBankService.selectTTrainCourseBankList(tTrainCourseBank);
return getDataTable(list);
}
......
......@@ -7,7 +7,7 @@ import com.zehong.common.core.domain.BaseEntity;
/**
* 承包商及访客培训对象 t_contractor_train_course
*
*
* @author zehong
* @date 2022-12-27
*/
......@@ -50,102 +50,140 @@ public class TContractorTrainCourse extends BaseEntity
@Excel(name = "是否删除(0正常,1删除)")
private String isDel;
public void setContractorCourseId(Long contractorCourseId)
/** 多选题分数*/
private Integer multipleChoiceScore;
/**单选题分数*/
private Integer singleChoiceScore;
/**判断题分数*/
private Integer judgmentScore;
public static long getSerialVersionUID() {
return serialVersionUID;
}
public Integer getMultipleChoiceScore() {
return multipleChoiceScore;
}
public void setMultipleChoiceScore(Integer multipleChoiceScore) {
this.multipleChoiceScore = multipleChoiceScore;
}
public Integer getSingleChoiceScore() {
return singleChoiceScore;
}
public void setSingleChoiceScore(Integer singleChoiceScore) {
this.singleChoiceScore = singleChoiceScore;
}
public Integer getJudgmentScore() {
return judgmentScore;
}
public void setJudgmentScore(Integer judgmentScore) {
this.judgmentScore = judgmentScore;
}
public void setContractorCourseId(Long contractorCourseId)
{
this.contractorCourseId = contractorCourseId;
}
public Long getContractorCourseId()
public Long getContractorCourseId()
{
return contractorCourseId;
}
public void setCourseName(String courseName)
public void setCourseName(String courseName)
{
this.courseName = courseName;
}
public String getCourseName()
public String getCourseName()
{
return courseName;
}
public void setCourseConent(String courseConent)
public void setCourseConent(String courseConent)
{
this.courseConent = courseConent;
}
public String getCourseConent()
public String getCourseConent()
{
return courseConent;
}
public void setEnclosure(String enclosure)
public void setEnclosure(String enclosure)
{
this.enclosure = enclosure;
}
public String getEnclosure()
public String getEnclosure()
{
return enclosure;
}
public void setVideo(String video)
public void setVideo(String video)
{
this.video = video;
}
public String getVideo()
public String getVideo()
{
return video;
}
public void setQualifiedNum(Integer qualifiedNum)
public void setQualifiedNum(Integer qualifiedNum)
{
this.qualifiedNum = qualifiedNum;
}
public Integer getQualifiedNum()
public Integer getQualifiedNum()
{
return qualifiedNum;
}
public void setTopicNum(Integer topicNum)
public void setTopicNum(Integer topicNum)
{
this.topicNum = topicNum;
}
public Integer getTopicNum()
public Integer getTopicNum()
{
return topicNum;
}
public void setCreateUser(String createUser)
public void setCreateUser(String createUser)
{
this.createUser = createUser;
}
public String getCreateUser()
public String getCreateUser()
{
return createUser;
}
public void setIsDel(String isDel)
public void setIsDel(String isDel)
{
this.isDel = isDel;
}
public String getIsDel()
public String getIsDel()
{
return isDel;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("contractorCourseId", getContractorCourseId())
.append("courseName", getCourseName())
.append("courseConent", getCourseConent())
.append("enclosure", getEnclosure())
.append("video", getVideo())
.append("qualifiedNum", getQualifiedNum())
.append("topicNum", getTopicNum())
.append("createTime", getCreateTime())
.append("createUser", getCreateUser())
.append("isDel", getIsDel())
.append("remark", getRemark())
.toString();
return "TContractorTrainCourse{" +
"contractorCourseId=" + contractorCourseId +
", courseName='" + courseName + '\'' +
", courseConent='" + courseConent + '\'' +
", enclosure='" + enclosure + '\'' +
", video='" + video + '\'' +
", qualifiedNum=" + qualifiedNum +
", topicNum=" + topicNum +
", createUser='" + createUser + '\'' +
", isDel='" + isDel + '\'' +
", multipleChoiceScore=" + multipleChoiceScore +
", singleChoiceScore=" + singleChoiceScore +
", judgmentScore=" + judgmentScore +
'}';
}
}
......@@ -7,7 +7,7 @@ import com.zehong.common.core.domain.BaseEntity;
/**
* 承包商及访客培训题库对象 t_contractor_train_course_topic
*
*
* @author zehong
* @date 2022-12-27
*/
......@@ -32,78 +32,92 @@ public class TContractorTrainCourseTopic extends BaseEntity
/** 答案 */
@Excel(name = "答案")
private Integer answer;
private String answer;
/** 是否删除(0正常,1删除) */
@Excel(name = "是否删除(0正常,1删除)")
private String isDel;
public void setTopicId(Long topicId)
/**题目类型*/
private Integer topicType;
public static long getSerialVersionUID() {
return serialVersionUID;
}
public void setAnswer(String answer) {
this.answer = answer;
}
public Integer getTopicType() {
return topicType;
}
public void setTopicType(Integer topicType) {
this.topicType = topicType;
}
public void setTopicId(Long topicId)
{
this.topicId = topicId;
}
public Long getTopicId()
public Long getTopicId()
{
return topicId;
}
public void setContractorCourseId(Long contractorCourseId)
public void setContractorCourseId(Long contractorCourseId)
{
this.contractorCourseId = contractorCourseId;
}
public Long getContractorCourseId()
public Long getContractorCourseId()
{
return contractorCourseId;
}
public void setTopicTitle(String topicTitle)
public void setTopicTitle(String topicTitle)
{
this.topicTitle = topicTitle;
}
public String getTopicTitle()
public String getTopicTitle()
{
return topicTitle;
}
public void setTopicOption(String topicOption)
public void setTopicOption(String topicOption)
{
this.topicOption = topicOption;
}
public String getTopicOption()
public String getTopicOption()
{
return topicOption;
}
public void setAnswer(Integer answer)
{
this.answer = answer;
}
public Integer getAnswer()
{
public String getAnswer() {
return answer;
}
public void setIsDel(String isDel)
public void setIsDel(String isDel)
{
this.isDel = isDel;
}
public String getIsDel()
public String getIsDel()
{
return isDel;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("topicId", getTopicId())
.append("contractorCourseId", getContractorCourseId())
.append("topicTitle", getTopicTitle())
.append("topicOption", getTopicOption())
.append("answer", getAnswer())
.append("createTime", getCreateTime())
.append("isDel", getIsDel())
.append("remark", getRemark())
.toString();
return "TContractorTrainCourseTopic{" +
"topicId=" + topicId +
", contractorCourseId=" + contractorCourseId +
", topicTitle='" + topicTitle + '\'' +
", topicOption='" + topicOption + '\'' +
", answer='" + answer + '\'' +
", isDel='" + isDel + '\'' +
", topicType=" + topicType +
'}';
}
}
......@@ -55,8 +55,20 @@ public class TContractorTrainResult extends BaseEntity
/** 是否删除(0正常,1删除) */
private String isDel;
/** 答案*/
private String answers;
/** 转换成二维数组答案*/
private Integer[][] integers;
public Integer[][] getIntegers() {
return integers;
}
public void setIntegers(Integer[][] integers) {
this.integers = integers;
}
public static long getSerialVersionUID() {
return serialVersionUID;
}
......
......@@ -7,7 +7,7 @@ import com.zehong.common.core.domain.BaseEntity;
/**
* 承包商及访客培训考试结果详情对象 t_contractor_train_result_detail
*
*
* @author wu
* @date 2022-12-30
*/
......@@ -32,11 +32,11 @@ public class TContractorTrainResultDetail extends BaseEntity
/** 答案 */
@Excel(name = "答案")
private Integer answer;
private String answer;
/** 所选答案 */
@Excel(name = "所选答案")
private Integer answerChoice;
private String answerChoice;
/** 答题结果:0 对,1 错 */
@Excel(name = "答题结果:0 对,1 错")
......@@ -46,75 +46,78 @@ public class TContractorTrainResultDetail extends BaseEntity
@Excel(name = "是否删除(0正常,1删除)")
private String isDel;
public void setDetailId(Long detailId)
public void setDetailId(Long detailId)
{
this.detailId = detailId;
}
public Long getDetailId()
public Long getDetailId()
{
return detailId;
}
public void setResultId(Long resultId)
public void setResultId(Long resultId)
{
this.resultId = resultId;
}
public Long getResultId()
public Long getResultId()
{
return resultId;
}
public void setTopicTitle(String topicTitle)
public void setTopicTitle(String topicTitle)
{
this.topicTitle = topicTitle;
}
public String getTopicTitle()
public String getTopicTitle()
{
return topicTitle;
}
public void setTopicOption(String topicOption)
public void setTopicOption(String topicOption)
{
this.topicOption = topicOption;
}
public String getTopicOption()
public String getTopicOption()
{
return topicOption;
}
public void setAnswer(Integer answer)
{
this.answer = answer;
}
public Integer getAnswer()
{
public String getAnswer() {
return answer;
}
public void setAnswerChoice(Integer answerChoice)
{
this.answerChoice = answerChoice;
public void setAnswer(String answer) {
this.answer = answer;
}
public Integer getAnswerChoice()
{
public static long getSerialVersionUID() {
return serialVersionUID;
}
public String getAnswerChoice() {
return answerChoice;
}
public void setResult(String result)
public void setAnswerChoice(String answerChoice) {
this.answerChoice = answerChoice;
}
public void setResult(String result)
{
this.result = result;
}
public String getResult()
public String getResult()
{
return result;
}
public void setIsDel(String isDel)
public void setIsDel(String isDel)
{
this.isDel = isDel;
}
public String getIsDel()
public String getIsDel()
{
return isDel;
}
......
package com.zehong.system.domain;
import java.util.Arrays;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
......@@ -17,6 +18,8 @@ public class TStaff extends BaseEntity
{
private static final long serialVersionUID = 1L;
/**系统用户id*/
private Integer userId;
/** 员工id */
private Integer staffId;
......@@ -49,6 +52,9 @@ public class TStaff extends BaseEntity
/** 岗位id */
@Excel(name = "岗位id")
private Integer postId;
/** 角色组 */
private Long[] roleIds;
/** 角色id */
@Excel(name = "角色id")
......@@ -83,6 +89,22 @@ public class TStaff extends BaseEntity
@Excel(name = "删除标志", readConverterExp = "0=正常,1删除")
private String isDel;
public Long[] getRoleIds() {
return roleIds;
}
public void setRoleIds(Long[] roleIds) {
this.roleIds = roleIds;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public static long getSerialVersionUID() {
return serialVersionUID;
}
......@@ -246,7 +268,8 @@ public class TStaff extends BaseEntity
@Override
public String toString() {
return "TStaff{" +
"staffId=" + staffId +
"userId=" + userId +
", staffId=" + staffId +
", userName='" + userName + '\'' +
", password='" + password + '\'' +
", staffName='" + staffName + '\'' +
......@@ -255,6 +278,7 @@ public class TStaff extends BaseEntity
", deptId=" + deptId +
", phonenumber='" + phonenumber + '\'' +
", postId=" + postId +
", roleIds=" + Arrays.toString(roleIds) +
", roleId=" + roleId +
", positionalTitles='" + positionalTitles + '\'' +
", profession='" + profession + '\'' +
......
......@@ -12,7 +12,7 @@ import java.util.Date;
/**
* 员工信息管理对象 t_staff
*
*
* @author zehong
* @date 2022-06-17
*/
......
package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.TContractorTrainCourse;
import com.zehong.system.domain.TContractorTrainCourseTopic;
import com.zehong.system.domain.TTrainCourse;
import com.zehong.system.domain.TTrainCourseTopic;
/**
* 承包商及访客培训题库Mapper接口
*
*
* @author zehong
* @date 2022-12-27
*/
public interface TContractorTrainCourseTopicMapper
public interface TContractorTrainCourseTopicMapper
{
/**
* 查询承包商及访客培训题库
*
*
* @param topicId 承包商及访客培训题库ID
* @return 承包商及访客培训题库
*/
......@@ -21,7 +25,7 @@ public interface TContractorTrainCourseTopicMapper
/**
* 查询承包商及访客培训题库列表
*
*
* @param tContractorTrainCourseTopic 承包商及访客培训题库
* @return 承包商及访客培训题库集合
*/
......@@ -29,7 +33,7 @@ public interface TContractorTrainCourseTopicMapper
/**
* 新增承包商及访客培训题库
*
*
* @param tContractorTrainCourseTopic 承包商及访客培训题库
* @return 结果
*/
......@@ -37,7 +41,7 @@ public interface TContractorTrainCourseTopicMapper
/**
* 修改承包商及访客培训题库
*
*
* @param tContractorTrainCourseTopic 承包商及访客培训题库
* @return 结果
*/
......@@ -45,7 +49,7 @@ public interface TContractorTrainCourseTopicMapper
/**
* 删除承包商及访客培训题库
*
*
* @param topicId 承包商及访客培训题库ID
* @return 结果
*/
......@@ -53,9 +57,29 @@ public interface TContractorTrainCourseTopicMapper
/**
* 批量删除承包商及访客培训题库
*
*
* @param topicIds 需要删除的数据ID
* @return 结果
*/
public int deleteTContractorTrainCourseTopicByIds(Long[] topicIds);
/**
* 批量新增试题
* @param topics
*/
void batchInsertTTrainCourseTopic(List<TContractorTrainCourseTopic> topics);
/**
* 更新试题数量
* @param courseId
* @return
*/
TContractorTrainCourse selectTTrainCourseById(Long courseId);
/**
* 更新试题数量
* @param course
* @return
*/
int updateTTrainCourse(TContractorTrainCourse course);
}
......@@ -2,18 +2,19 @@ package com.zehong.system.service;
import java.util.List;
import com.zehong.system.domain.TContractorTrainCourseTopic;
import com.zehong.system.domain.vo.BatchTopicVo;
/**
* 承包商及访客培训题库Service接口
*
*
* @author zehong
* @date 2022-12-27
*/
public interface ITContractorTrainCourseTopicService
public interface ITContractorTrainCourseTopicService
{
/**
* 查询承包商及访客培训题库
*
*
* @param topicId 承包商及访客培训题库ID
* @return 承包商及访客培训题库
*/
......@@ -21,7 +22,7 @@ public interface ITContractorTrainCourseTopicService
/**
* 查询承包商及访客培训题库列表
*
*
* @param tContractorTrainCourseTopic 承包商及访客培训题库
* @return 承包商及访客培训题库集合
*/
......@@ -29,7 +30,7 @@ public interface ITContractorTrainCourseTopicService
/**
* 新增承包商及访客培训题库
*
*
* @param tContractorTrainCourseTopic 承包商及访客培训题库
* @return 结果
*/
......@@ -37,7 +38,7 @@ public interface ITContractorTrainCourseTopicService
/**
* 修改承包商及访客培训题库
*
*
* @param tContractorTrainCourseTopic 承包商及访客培训题库
* @return 结果
*/
......@@ -45,7 +46,7 @@ public interface ITContractorTrainCourseTopicService
/**
* 批量删除承包商及访客培训题库
*
*
* @param topicIds 需要删除的承包商及访客培训题库ID
* @return 结果
*/
......@@ -53,9 +54,16 @@ public interface ITContractorTrainCourseTopicService
/**
* 删除承包商及访客培训题库信息
*
*
* @param topicId 承包商及访客培训题库ID
* @return 结果
*/
public int deleteTContractorTrainCourseTopicById(Long topicId);
/**
* 题库批量导入试题
* @param batchTopicVo
* @return
*/
int bachAddTopic(BatchTopicVo batchTopicVo);
}
package com.zehong.system.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.zehong.common.utils.DateUtils;
import com.zehong.system.domain.TContractorTrainCourse;
import com.zehong.system.domain.TContractorTrainCourseTopic;
import com.zehong.common.utils.StringUtils;
import com.zehong.system.domain.*;
import com.zehong.system.domain.vo.BatchTopicVo;
import com.zehong.system.mapper.TBankSubjectMapper;
import com.zehong.system.mapper.TContractorTrainCourseMapper;
import com.zehong.system.mapper.TContractorTrainCourseTopicMapper;
import com.zehong.system.service.ITContractorTrainCourseTopicService;
......@@ -11,25 +14,30 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
/**
* 承包商及访客培训题库Service业务层处理
*
*
* @author zehong
* @date 2022-12-27
*/
@Service
public class TContractorTrainCourseTopicServiceImpl implements ITContractorTrainCourseTopicService
public class TContractorTrainCourseTopicServiceImpl implements ITContractorTrainCourseTopicService
{
@Autowired
private TContractorTrainCourseTopicMapper tContractorTrainCourseTopicMapper;
@Resource
private TContractorTrainCourseMapper tContractorTrainCourseMapper;
@Resource
private TBankSubjectMapper tBankSubjectMapper;
/**
* 查询承包商及访客培训题库
*
*
* @param topicId 承包商及访客培训题库ID
* @return 承包商及访客培训题库
*/
......@@ -41,7 +49,7 @@ public class TContractorTrainCourseTopicServiceImpl implements ITContractorTrain
/**
* 查询承包商及访客培训题库列表
*
*
* @param tContractorTrainCourseTopic 承包商及访客培训题库
* @return 承包商及访客培训题库
*/
......@@ -53,7 +61,7 @@ public class TContractorTrainCourseTopicServiceImpl implements ITContractorTrain
/**
* 新增承包商及访客培训题库
*
*
* @param tContractorTrainCourseTopic 承包商及访客培训题库
* @return 结果
*/
......@@ -72,7 +80,7 @@ public class TContractorTrainCourseTopicServiceImpl implements ITContractorTrain
/**
* 修改承包商及访客培训题库
*
*
* @param tContractorTrainCourseTopic 承包商及访客培训题库
* @return 结果
*/
......@@ -84,7 +92,7 @@ public class TContractorTrainCourseTopicServiceImpl implements ITContractorTrain
/**
* 批量删除承包商及访客培训题库
*
*
* @param topicIds 需要删除的承包商及访客培训题库ID
* @return 结果
*/
......@@ -106,7 +114,7 @@ public class TContractorTrainCourseTopicServiceImpl implements ITContractorTrain
/**
* 删除承包商及访客培训题库信息
*
*
* @param topicId 承包商及访客培训题库ID
* @return 结果
*/
......@@ -115,4 +123,44 @@ public class TContractorTrainCourseTopicServiceImpl implements ITContractorTrain
{
return tContractorTrainCourseTopicMapper.deleteTContractorTrainCourseTopicById(topicId);
}
/**
* 题库批量导入试题
* @param batchTopicVo
* @return
*/
@Override
public int bachAddTopic(BatchTopicVo batchTopicVo) {
if(CollectionUtil.isEmpty(batchTopicVo.getTopicInfos()) || StringUtils.isEmpty(String.valueOf(batchTopicVo.getCourseId()))){
return 0;
}
List<TContractorTrainCourseTopic> topics = new ArrayList<>();
int count = 0;
for(BatchTopicVo.TopicInfos topic : batchTopicVo.getTopicInfos()){
//获取题库试题
TBankSubject tBankSubject = new TBankSubject();
tBankSubject.setBankId(topic.getBankId());
List<TBankSubject> bankSubjects = tBankSubjectMapper.selectTBankSubjectList(tBankSubject);
//获取随机试题
Collections.shuffle(bankSubjects);
for(int i = 0;i<topic.getQuan();i++){
TContractorTrainCourseTopic courseTopic = new TContractorTrainCourseTopic();
courseTopic.setContractorCourseId(batchTopicVo.getCourseId());
courseTopic.setTopicTitle(bankSubjects.get(i).getTopicTitle());
courseTopic.setTopicOption(bankSubjects.get(i).getTopicOption());
courseTopic.setAnswer(String.valueOf(bankSubjects.get(i).getAnswer()));
courseTopic.setCreateTime(new Date());
courseTopic.setTopicType(bankSubjects.get(i).getTopicType());
topics.add(courseTopic);
}
count += topic.getQuan();
}
//批量新增试题
tContractorTrainCourseTopicMapper.batchInsertTTrainCourseTopic(topics);
//更新试题数量
TContractorTrainCourse course = tContractorTrainCourseTopicMapper.selectTTrainCourseById(batchTopicVo.getCourseId());
course.setTopicNum(course.getTopicNum() + count);
tContractorTrainCourseTopicMapper.updateTTrainCourse(course);
return 1;
}
}
......@@ -5,6 +5,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.alibaba.fastjson.JSON;
import com.zehong.common.utils.DateUtils;
import com.zehong.system.domain.*;
import com.zehong.system.mapper.*;
......@@ -112,21 +113,43 @@ public class TContractorTrainResultServiceImpl implements ITContractorTrainResul
@Override
public Map<String,Object> examination(TContractorTrainResult tContractorTrainResult) {
TContractorTrainCourseTopic tContractorTrainCourseTopic=new TContractorTrainCourseTopic();
String answers = tContractorTrainResult.getAnswers();
//交卷答题
String[] split = answers.split(",");
TContractorTrainCourse tContractorTrainCourse=new TContractorTrainCourse();
//查询考试题和答案
List<TContractorTrainCourseTopic> tContractorTrainCourseTopics = tContractorTrainCourseTopicMapper.selectTContractorTrainCourseTopicList(tContractorTrainCourseTopic);
//正确答案数量
//查询需要正确几道题算通过
TContractorTrainCourse itContractorTrainCourse = tContractorTrainCourseMapper.getITContractorTrainCourse(tContractorTrainCourse);
//已获得分数
int num = 0;
for(Integer i=0;i<split.length;i++){
if(Integer.parseInt(split[i])==tContractorTrainCourseTopics.get(i).getAnswer()){
num++;
/**
* 大循环 共有多少答案 此循环最后只算出 得了多少分
*/
for (int i=0;i<tContractorTrainResult.getIntegers().length;i++){
/*题目答案*/
String answer = tContractorTrainCourseTopics.get(i).getAnswer();
//答案转换成数组
Integer[] integers = JSON.parseObject(answer, Integer[].class);
/**判断所选答案是否与正确答案长度相等*/
if (integers.length==tContractorTrainResult.getIntegers()[i].length){
boolean adopt=true;
for (int n=0;n<integers.length;n++){
if (integers[n]!=tContractorTrainResult.getIntegers()[i][n]){
adopt=false;
break;
}
}
if (adopt){
/** 1单选 2多选 3判断*/
if (tContractorTrainCourseTopics.get(i).getTopicType()==1){
num=num+itContractorTrainCourse.getSingleChoiceScore();
}else if (tContractorTrainCourseTopics.get(i).getTopicType()==2){
num=num+itContractorTrainCourse.getMultipleChoiceScore();
}else if (tContractorTrainCourseTopics.get(i).getTopicType()==3){
num=num+itContractorTrainCourse.getJudgmentScore();
}
}
}
}
TContractorTrainCourse tContractorTrainCourse=new TContractorTrainCourse();
//查询需要正确几道题算通过
TContractorTrainCourse itContractorTrainCourse = tContractorTrainCourseMapper.getITContractorTrainCourse(tContractorTrainCourse);
//判断答题是否合格
if(num>=itContractorTrainCourse.getQualifiedNum()){
tContractorTrainResult.setIsQualified("0");
......@@ -139,7 +162,7 @@ public class TContractorTrainResultServiceImpl implements ITContractorTrainResul
//承包商及访客培训考试结果 添加方法
tContractorTrainResultMapper.insertTContractorTrainResult(tContractorTrainResult);
/**添加承包商及访客培训考试结果详情*/
for (int n=0;n<split.length;n++){
for (int n=0;n<tContractorTrainResult.getIntegers().length;n++){
TContractorTrainResultDetail tContractorTrainResultDetail=new TContractorTrainResultDetail();
//设置结果管理id
tContractorTrainResultDetail.setResult(String.valueOf(tContractorTrainResult.getResultId()));
......@@ -150,13 +173,13 @@ public class TContractorTrainResultServiceImpl implements ITContractorTrainResul
//答案
tContractorTrainResultDetail.setAnswer(tContractorTrainCourseTopics.get(n).getAnswer());
//所选答案
tContractorTrainResultDetail.setAnswerChoice(Integer.valueOf(split[n]));
tContractorTrainResultDetail.setAnswerChoice(tContractorTrainResult.getAnswers());
//答案结果
if (Integer.valueOf(split[n])==tContractorTrainCourseTopics.get(n).getAnswer()){
tContractorTrainResultDetail.setResult("0");
}else {
tContractorTrainResultDetail.setResult("1");
}
// if (Integer.valueOf(split[n])==tContractorTrainCourseTopics.get(n).getAnswer()){
// tContractorTrainResultDetail.setResult("0");
// }else {
// tContractorTrainResultDetail.setResult("1");
// }
tContractorTrainResultDetail.setCreateTime(new Date());
tContractorTrainResultDetail.setResultId(tContractorTrainResult.getResultId());
tContractorTrainResultDetailMapper.insertTContractorTrainResultDetail(tContractorTrainResultDetail);
......
......@@ -161,12 +161,12 @@ public class TEntranceGuardPersonInfoServiceImpl implements ITEntranceGuardPerso
return;
}
if("0".equals(tEntranceGuardPersonInfo.getActionType())){
crc="入";
crc="入";
}else if("1".equals(tEntranceGuardPersonInfo.getActionType())){
crc="出";
crc="出";
}
contents[i+2]=tEntranceGuardPersonInfo.getPersonName()+" "+crc+" "+DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,tEntranceGuardPersonInfo.getActionTime());
contents[i+2]=tEntranceGuardPersonInfo.getPersonName()+""+crc+""+DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,tEntranceGuardPersonInfo.getActionTime());
i++;
}
contents[5]=" "+DateUtils.getDate();//展示当日日期
......
package com.zehong.system.service.impl;
import java.util.ArrayList;
import java.util.List;
import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.utils.DateUtils;
import com.zehong.common.utils.StringUtils;
import com.zehong.system.domain.SysUserRole;
import com.zehong.system.domain.TStaff;
import com.zehong.system.domain.form.TStaffForm;
import com.zehong.system.domain.vo.TStaffVo;
import com.zehong.system.mapper.SysUserRoleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TStaffMapper;
......@@ -12,19 +18,23 @@ import com.zehong.system.service.ITStaffService;
/**
* 员工信息管理Service业务层处理
*
*
* @author zehong
* @date 2022-06-17
*/
@Service
public class TStaffServiceImpl implements ITStaffService
public class TStaffServiceImpl implements ITStaffService
{
@Autowired
private TStaffMapper tStaffMapper;
@Autowired
private SysUserRoleMapper userRoleMapper;
/**
* 查询员工信息管理
*
*
* @param staffId 员工信息管理ID
* @return 员工信息管理
*/
......@@ -36,7 +46,7 @@ public class TStaffServiceImpl implements ITStaffService
/**
* 查询员工信息管理列表
*
*
* @param tStaff 员工信息管理
* @return 员工信息管理
*/
......@@ -48,7 +58,7 @@ public class TStaffServiceImpl implements ITStaffService
/**
* 新增员工信息管理
*
*
* @param tStaff 员工信息管理
* @return 结果
*/
......@@ -58,25 +68,32 @@ public class TStaffServiceImpl implements ITStaffService
String staffCode = tStaffMapper.getStaffCode();
tStaff.setStaffCode(staffCode);
tStaff.setCreateTime(DateUtils.getNowDate());
return tStaffMapper.insertTStaff(tStaff);
tStaffMapper.insertTStaff(tStaff);
// 新增用户与角色管理
insertUserRole(tStaff);
return tStaff.getStaffId();
}
/**
* 修改员工信息管理
*
*
* @param tStaff 员工信息管理
* @return 结果
*/
@Override
public int updateTStaff(TStaff tStaff)
{
// 删除用户与角色关联
userRoleMapper.deleteUserRoleByUserId(Long.valueOf(tStaff.getStaffId()));
// 新增用户与角色管理
insertUserRole(tStaff);
tStaff.setUpdateTime(DateUtils.getNowDate());
return tStaffMapper.updateTStaff(tStaff);
}
/**
* 批量删除员工信息管理
*
*
* @param staffIds 需要删除的员工信息管理ID
* @return 结果
*/
......@@ -88,7 +105,7 @@ public class TStaffServiceImpl implements ITStaffService
/**
* 删除员工信息管理信息
*
*
* @param staffId 员工信息管理ID
* @return 结果
*/
......@@ -97,4 +114,30 @@ public class TStaffServiceImpl implements ITStaffService
{
return tStaffMapper.deleteTStaffById(staffId);
}
/**
* 新增用户角色信息
*
* @param user 用户对象
*/
public void insertUserRole(TStaff user)
{
Long[] roles = user.getRoleIds();
if (StringUtils.isNotNull(roles))
{
// 新增用户与角色管理
List<SysUserRole> list = new ArrayList<SysUserRole>();
for (Long roleId : roles)
{
SysUserRole ur = new SysUserRole();
ur.setUserId(Long.valueOf(user.getStaffId()));
ur.setRoleId(roleId);
list.add(ur);
}
if (list.size() > 0)
{
userRoleMapper.batchUserRole(list);
}
}
}
}
......@@ -67,7 +67,11 @@ public class TTrainCourseServiceImpl implements ITTrainCourseService
return 0;
}
List<String> userIds = tTrainPlanMapper.selectAlluserByplanId(course.getCourseType());
tTrainCourseMapper.insertUserCourse(courseId,userIds,course.getPersonnelType());
//异常数据
if(userIds==null||userIds.size()==0){
return 0;
}
tTrainCourseMapper.insertUserCourse(courseId,userIds,course.getPersonnelType());
course.setStatus(1);
course.setReleaseTime(new Date());
return tTrainCourseMapper.updateTTrainCourse(course);
......@@ -205,7 +209,6 @@ public class TTrainCourseServiceImpl implements ITTrainCourseService
@Override
@Transactional(rollbackFor = Exception.class)
public Map<String,Object> examination (Long userCourseId,Integer[][] answers){
//查询用户课程信息
TTrainUserCourse userCourse = tTrainUserCourseMapper.selectTTrainUserCourseById(userCourseId);
TTrainCourseTopic topic = new TTrainCourseTopic();
......@@ -226,7 +229,6 @@ public class TTrainCourseServiceImpl implements ITTrainCourseService
Integer qualifiedNum = c.getQualifiedNum();
//已获得分数
int num = 0;
/**
* 大循环 共有多少答案 此循环最后只算出 得了多少分
*/
......@@ -235,10 +237,8 @@ public class TTrainCourseServiceImpl implements ITTrainCourseService
int PassedNot =0;
/*题目答案*/
String answer = list.get(i).getAnswer();
System.out.println("答案:"+answer);
//答案转换成数组
Integer[] integers = JSON.parseObject(answer, Integer[].class);
/**判断所选答案是否与正确答案长度相等*/
if (integers.length==answers[i].length){
boolean adopt=true;
......@@ -251,13 +251,10 @@ public class TTrainCourseServiceImpl implements ITTrainCourseService
if (adopt){
/** 1单选 2多选 3判断*/
if (list.get(i).getTopicType()==1){
System.out.println(num);
num=num+singleChoiceScore;
}else if (list.get(i).getTopicType()==2){
System.out.println(num);
num=num+multipleChoiceScore;
}else if (list.get(i).getTopicType()==3){
System.out.println(num);
num=num+judgmentScore;
}
}
......@@ -273,12 +270,12 @@ public class TTrainCourseServiceImpl implements ITTrainCourseService
}
for(Integer i=0;i<answers.length;i++){
// for(Integer i=0;i<answers.length;i++){
// String demosub = list.get(i).getAnswer().substring(1,list.get(i).getAnswer().length()-1);
// if(Integer.parseInt(answers[i])==demosub){
// num++;
// }
}
// }
/**已获得分数*/
userCourse.setExaminationResult(num);
/**生成日期*/
......
......@@ -16,10 +16,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createUser" column="create_user" />
<result property="isDel" column="is_del" />
<result property="remark" column="remark" />
<result property="singleChoiceScore" column="single_choice_score" />
<result property="multipleChoiceScore" column="multiple_choice_score" />
<result property="judgmentScore" column="judgment_score" />
</resultMap>
<sql id="selectTContractorTrainCourseVo">
select contractor_course_id, course_name, course_conent, enclosure, video, qualified_num, topic_num, create_time, create_user, is_del, remark from t_contractor_train_course
select single_choice_score,multiple_choice_score,judgment_score,contractor_course_id, course_name, course_conent, enclosure, video, qualified_num, topic_num, create_time, create_user, is_del, remark from t_contractor_train_course
</sql>
<select id="selectTContractorTrainCourseList" parameterType="TContractorTrainCourse" resultMap="TContractorTrainCourseResult">
......@@ -54,6 +57,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createUser != null">create_user,</if>
<if test="isDel != null">is_del,</if>
<if test="remark != null">remark,</if>
<if test="singleChoiceScore != null">single_choice_score,</if>
<if test="multipleChoiceScore != null">multiple_choice_score,</if>
<if test="judgmentScore != null">judgment_score,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="courseName != null">#{courseName},</if>
......@@ -66,6 +72,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createUser != null">#{createUser},</if>
<if test="isDel != null">#{isDel},</if>
<if test="remark != null">#{remark},</if>
<if test="singleChoiceScore != null">#{singleChoiceScore},</if>
<if test="multipleChoiceScore != null">#{multipleChoiceScore},</if>
<if test="judgmentScore != null">#{judgmentScore},</if>
</trim>
</insert>
......@@ -82,6 +91,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createUser != null">create_user = #{createUser},</if>
<if test="isDel != null">is_del = #{isDel},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="singleChoiceScore != null">single_choice_score = #{singleChoiceScore},</if>
<if test="multipleChoiceScore != null">multiple_choice_score = #{multipleChoiceScore},</if>
<if test="judgmentScore != null">judgment_score = #{judgmentScore},</if>
</trim>
where contractor_course_id = #{contractorCourseId}
</update>
......
......@@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zehong.system.mapper.TContractorTrainCourseTopicMapper">
<resultMap type="TContractorTrainCourseTopic" id="TContractorTrainCourseTopicResult">
<result property="topicId" column="topic_id" />
<result property="contractorCourseId" column="contractor_course_id" />
......@@ -13,15 +13,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time" />
<result property="isDel" column="is_del" />
<result property="remark" column="remark" />
<result property="topicType" column="topic_type" />
</resultMap>
<resultMap type="TContractorTrainCourse" id="TContractorTrainCourseResult">
<result property="contractor_course_id" column="contractorCourseId" />
</resultMap>
<sql id="selectTContractorTrainCourseTopicVo">
select topic_id, contractor_course_id, topic_title, topic_option, answer, create_time, is_del, remark from t_contractor_train_course_topic
select topic_id, contractor_course_id, topic_title, topic_option, answer, create_time, is_del, remark,topic_type from t_contractor_train_course_topic
</sql>
<select id="selectTContractorTrainCourseTopicList" parameterType="TContractorTrainCourseTopic" resultMap="TContractorTrainCourseTopicResult">
<include refid="selectTContractorTrainCourseTopicVo"/>
<where>
<where>
<if test="contractorCourseId != null "> and contractor_course_id = #{contractorCourseId}</if>
<if test="topicTitle != null and topicTitle != ''"> and topic_title = #{topicTitle}</if>
<if test="topicOption != null and topicOption != ''"> and topic_option = #{topicOption}</if>
......@@ -29,12 +36,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isDel != null and isDel != ''"> and is_del = #{isDel}</if>
</where>
</select>
<select id="selectTContractorTrainCourseTopicById" parameterType="Long" resultMap="TContractorTrainCourseTopicResult">
<include refid="selectTContractorTrainCourseTopicVo"/>
where topic_id = #{topicId}
</select>
<insert id="insertTContractorTrainCourseTopic" parameterType="TContractorTrainCourseTopic" useGeneratedKeys="true" keyProperty="topicId">
insert into t_contractor_train_course_topic
<trim prefix="(" suffix=")" suffixOverrides=",">
......@@ -45,6 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time,</if>
<if test="isDel != null">is_del,</if>
<if test="remark != null">remark,</if>
<if test="topicType != null">topic_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="contractorCourseId != null">#{contractorCourseId},</if>
......@@ -54,6 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">#{createTime},</if>
<if test="isDel != null">#{isDel},</if>
<if test="remark != null">#{remark},</if>
<if test="topicType != null">#{topicType},</if>
</trim>
</insert>
......@@ -67,6 +76,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time = #{createTime},</if>
<if test="isDel != null">is_del = #{isDel},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="topicType != null">topic_type = #{topicType},</if>
</trim>
where topic_id = #{topicId}
</update>
......@@ -76,9 +86,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteTContractorTrainCourseTopicByIds" parameterType="String">
delete from t_contractor_train_course_topic where topic_id in
delete from t_contractor_train_course_topic where topic_id in
<foreach item="topicId" collection="array" open="(" separator="," close=")">
#{topicId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
<insert id="batchInsertTTrainCourseTopic" parameterType="java.util.List">
insert into t_contractor_train_course_topic(contractor_course_id,topic_title,topic_option,answer,create_time,topic_type) values
<foreach collection="list" item="topic" index="index" separator="," >
(#{topic.contractorCourseId},#{topic.topicTitle},#{topic.topicOption},#{topic.answer},#{topic.createTime},#{topic.topicType})
</foreach>
</insert>
<select id="selectTTrainCourseById" resultType="com.zehong.system.domain.TContractorTrainCourse">
select topic_num topicNum from t_contractor_train_course
where contractor_course_id = #{courseId}
</select>
<update id="updateTTrainCourse" parameterType="TContractorTrainCourse">
update t_contractor_train_course set topic_num=#{topicNum}
where contractor_course_id = #{contractorCourseId}
</update>
</mapper>
......@@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zehong.system.mapper.TContractorTrainResultDetailMapper">
<resultMap type="TContractorTrainResultDetail" id="TContractorTrainResultDetailResult">
<result property="detailId" column="detail_id" />
<result property="resultId" column="result_id" />
......@@ -23,7 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectTContractorTrainResultDetailList" parameterType="TContractorTrainResultDetail" resultMap="TContractorTrainResultDetailResult">
<include refid="selectTContractorTrainResultDetailVo"/>
<where>
<where>
<if test="resultId != null "> and result_id = #{resultId}</if>
<if test="topicTitle != null and topicTitle != ''"> and topic_title = #{topicTitle}</if>
<if test="topicOption != null and topicOption != ''"> and topic_option = #{topicOption}</if>
......@@ -33,12 +33,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isDel != null and isDel != ''"> and is_del = #{isDel}</if>
</where>
</select>
<select id="selectTContractorTrainResultDetailById" parameterType="Long" resultMap="TContractorTrainResultDetailResult">
<include refid="selectTContractorTrainResultDetailVo"/>
where detail_id = #{detailId}
</select>
<insert id="insertTContractorTrainResultDetail" parameterType="TContractorTrainResultDetail" useGeneratedKeys="true" keyProperty="detailId">
insert into t_contractor_train_result_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
......@@ -47,7 +47,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="topicOption != null">topic_option,</if>
<if test="answer != null">answer,</if>
<if test="answerChoice != null">answer_choice,</if>
<if test="result != null">result,</if>
<if test="createTime != null">create_time,</if>
<if test="isDel != null">is_del,</if>
<if test="remark != null">remark,</if>
......@@ -58,7 +57,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="topicOption != null">#{topicOption},</if>
<if test="answer != null">#{answer},</if>
<if test="answerChoice != null">#{answerChoice},</if>
<if test="result != null">#{result},</if>
<if test="createTime != null">#{createTime},</if>
<if test="isDel != null">#{isDel},</if>
<if test="remark != null">#{remark},</if>
......@@ -86,9 +84,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteTContractorTrainResultDetailByIds" parameterType="String">
delete from t_contractor_train_result_detail where detail_id in
delete from t_contractor_train_result_detail where detail_id in
<foreach item="detailId" collection="array" open="(" separator="," close=")">
#{detailId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
</mapper>
......@@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zehong.system.mapper.TContractorTrainResultMapper">
<resultMap type="TContractorTrainResult" id="TContractorTrainResultResult">
<result property="resultId" column="result_id" />
<result property="beyondUnit" column="beyond_unit" />
......@@ -25,7 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectTContractorTrainResultList" parameterType="TContractorTrainResult" resultMap="TContractorTrainResultResult">
<include refid="selectTContractorTrainResultVo"/>
<where>
<where>
<if test="beyondUnit != null and beyondUnit != ''"> and beyond_unit = #{beyondUnit}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="sex != null and sex != ''"> and sex = #{sex}</if>
......@@ -34,13 +34,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="score != null and score != ''"> and score = #{score}</if>
<if test="isQualified != null and isQualified != ''"> and is_qualified = #{isQualified}</if>
</where>
order by result_id desc
</select>
<select id="selectTContractorTrainResultById" parameterType="Long" resultMap="TContractorTrainResultResult">
<include refid="selectTContractorTrainResultVo"/>
where result_id = #{resultId}
</select>
<insert id="insertTContractorTrainResult" parameterType="TContractorTrainResult" useGeneratedKeys="true" keyProperty="resultId">
insert into t_contractor_train_result
<trim prefix="(" suffix=")" suffixOverrides=",">
......@@ -94,9 +95,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteTContractorTrainResultByIds" parameterType="String">
delete from t_contractor_train_result where result_id in
delete from t_contractor_train_result where result_id in
<foreach item="resultId" collection="array" open="(" separator="," close=")">
#{resultId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
</mapper>
......@@ -71,7 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where t.user_id = #{staffId}
</select>
<insert id="insertTStaff" parameterType="TStaff">
<insert id="insertTStaff" parameterType="TStaff" useGeneratedKeys = "true" keyProperty = "staffId">
insert into sys_user
<trim prefix="(" suffix=")" suffixOverrides=",">
user_staff,
......
/*
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-12-27 16:04:04
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2023-01-31 16:22:00
* @FilePath: /danger-manage-web/src/api/contractTrain/contractTrain.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import request from '@/utils/request'
// 查询承包商及访客培训列表
......@@ -9,6 +17,7 @@ export function listCourse(query) {
})
}
// 查询承包商及访客培训详细
export function getCourse(contractorCourseId) {
return request({
......
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-23 11:02:24
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-12-28 09:57:47
* @LastEditTime: 2023-01-29 14:53:07
* @FilePath: /danger-manage-web/src/api/educationPlanExam/trainingProgram.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
......@@ -186,3 +186,10 @@ export function bachAddTopic(data) {
})
}
export function bachAddTopicGuest(data) {
return request({
url: '/contractTrainTopic/bachAddTopic',
method: 'post',
data: data
})
}
......@@ -2,6 +2,7 @@
<div class="upload-file">
<el-upload
:action="uploadFileUrl"
:disabled="disabled"
:before-upload="handleBeforeUpload"
:file-list="fileArr"
:limit="1"
......@@ -16,11 +17,11 @@
:show-file-list="true"
:headers="headers"
class="upload-file-uploader"
:class="{ hide: fileArr.length>0 ||addShow }"
:class="{ hide: fileArr.length > 0 || addShow }"
ref="upload"
>
<!-- 上传按钮 -->
<el-button plain type="primary">选取文件</el-button>
<el-button :disabled="disabled" plain type="primary">选取文件</el-button>
<!--<i class="el-icon-plus"></i>-->
<!-- 上传提示 -->
<div class="el-upload__tip" slot="tip" v-if="showTip">
......@@ -33,14 +34,14 @@
</template>
的文件,且不超过一个
</div>
</el-upload>
<el-image v-show="false"
id="img"
ref="previewImg"
:src="dialogImageUrl"
:preview-src-list="bigImageArr"
:z-index="9999999"
<el-image
v-show="false"
id="img"
ref="previewImg"
:src="dialogImageUrl"
:preview-src-list="bigImageArr"
:z-index="9999999"
></el-image>
<!-- <el-dialog
:center="true"
......@@ -66,199 +67,201 @@
</template>
<script>
import { getToken } from "@/utils/auth";
import { getToken } from "@/utils/auth";
export default {
props: {
// 值
value: [String, Object, Array],
listType: {
type: String,
defaule: "text",
},
// 大小限制(MB)
fileSize: {
type: Number,
default: 50,
},
fileArr: {
type: Array,
default: [],
},
// 文件类型, 例如['png', 'jpg', 'jpeg']
fileType: {
type: Array,
default: () => ["doc", "xls", "ppt", "txt", "pdf"],
},
// 是否显示提示
isShowTip: {
type: Boolean,
default: true,
},
export default {
props: {
// 值
value: [String, Object, Array],
listType: {
type: String,
defaule: "text",
},
data() {
return {
uploadFileUrl: process.env.VUE_APP_BASE_API + "/common/upload", // 上传的图片服务器地址
headers: {
Authorization: "Bearer " + getToken(),
},
fileList: [],
modal: false,
dialogVisible: false,
dialogImageUrl: "",
addShow: true,
};
// 大小限制(MB)
fileSize: {
type: Number,
default: 50,
},
computed: {
// 是否显示提示
showTip() {
return this.isShowTip && (this.fileType || this.fileSize);
},
// 列表
list() {
let temp = 1;
if (this.value) {
// 首先将值转为数组
const list = Array.isArray(this.value) ? this.value : [this.value];
// 然后将数组转为对象数组
return list.map((item) => {
if (typeof item === "string") {
item = { name: item, url: item };
}
item.uid = item.uid || new Date().getTime() + temp++;
return item;
});
} else {
this.fileList = [];
return [];
}
},
bigImageArr() {
return [this.dialogImageUrl]
fileArr: {
type: Array,
default: [],
},
// 文件类型, 例如['png', 'jpg', 'jpeg']
fileType: {
type: Array,
default: () => ["doc", "xls", "ppt", "txt", "pdf"],
},
// 是否显示提示
isShowTip: {
type: Boolean,
default: true,
},
disabled: {
type: Boolean,
default:false,
},
},
data() {
return {
uploadFileUrl: process.env.VUE_APP_BASE_API + "/common/upload", // 上传的图片服务器地址
headers: {
Authorization: "Bearer " + getToken(),
},
fileList: [],
modal: false,
dialogVisible: false,
dialogImageUrl: "",
addShow: true,
};
},
computed: {
// 是否显示提示
showTip() {
return this.isShowTip && (this.fileType || this.fileSize);
},
methods: {
// 上传前校检格式和大小
handleBeforeUpload(file) {
// 校检文件类型
if (this.fileType) {
let fileExtension = "";
if (file.name.lastIndexOf(".") > -1) {
fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1);
}
const isTypeOk = this.fileType.some((type) => {
if (file.type.indexOf(type) > -1) return true;
if (fileExtension && fileExtension.indexOf(type) > -1) return true;
return false;
});
if (!isTypeOk) {
this.$message.error(
`文件格式不正确, 请上传${this.fileType.join("/")}格式文件!`
);
return false;
// 列表
list() {
let temp = 1;
if (this.value) {
// 首先将值转为数组
const list = Array.isArray(this.value) ? this.value : [this.value];
// 然后将数组转为对象数组
return list.map((item) => {
if (typeof item === "string") {
item = { name: item, url: item };
}
item.uid = item.uid || new Date().getTime() + temp++;
return item;
});
} else {
this.fileList = [];
return [];
}
},
bigImageArr() {
return [this.dialogImageUrl];
},
},
methods: {
// 上传前校检格式和大小
handleBeforeUpload(file) {
// 校检文件类型
if (this.fileType) {
let fileExtension = "";
if (file.name.lastIndexOf(".") > -1) {
fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1);
}
// 校检文件大小
if (this.fileSize) {
const isLt = file.size / 1024 / 1024 < this.fileSize;
if (!isLt) {
this.$message.error(`上传文件大小不能超过 ${this.fileSize} MB!`);
return false;
}
const isTypeOk = this.fileType.some((type) => {
if (file.type.indexOf(type) > -1) return true;
if (fileExtension && fileExtension.indexOf(type) > -1) return true;
return false;
});
if (!isTypeOk) {
this.$message.error(
`文件格式不正确, 请上传${this.fileType.join("/")}格式文件!`
);
return false;
}
return true;
},
// 文件个数超出
handleExceed() {
this.$message.error(`只允许上传单个文件`);
},
// 上传失败
handleUploadError(err) {
this.$message.error("上传失败, 请重试");
},
// 上传成功回调
handleUploadSuccess(res, file) {
this.$message.success("上传成功");
this.$emit("resFun", res);
},
// 文件列表移除文件
handleRemove(file, fileList) {
console.log("列表移除", file, fileList);
this.addShow = fileList.length > 0 ? true : false;
this.$emit("remove", file);
},
// 删除文件
handleDelete(index) {
this.fileList.splice(index, 1);
this.$emit("input", "");
// let that = this,
// param;
// param = file.response ? file.response.fileName.replace(/\\/g, "%")
// : file.response.url.replace(/\\/g, "%").slice(9);
// $.ajax({
// type: "GET",
// url: process.env.VUE_APP_BASE_API + "/common/deleteFile",
// data: {savePath: param},
// dataType: "json",
// success: function(data){
// if (data) that.$message.success("删除成功");
// else return false;
// }
// });
},
handleFileClick(file, fileList) {
this.dialogImageUrl = file.response ? file.response.url : file.url;
// this.dialogImageUrl =if(this.fileArr) this.fileArr[0].url;
// this.dialogVisible = true;
this.$refs.previewImg.showViewer = false;
console.log(file);
// console.log(file.response.url)
},
// 获取文件名称
getFileName(name) {
if (name.lastIndexOf("/") > -1) {
return name.slice(name.lastIndexOf("/") + 1).toLowerCase();
} else {
return "";
}
// 校检文件大小
if (this.fileSize) {
const isLt = file.size / 1024 / 1024 < this.fileSize;
if (!isLt) {
this.$message.error(`上传文件大小不能超过 ${this.fileSize} MB!`);
return false;
}
},
// 当改变列表改变时
fileChange(file, fileList) {
this.addShow = fileList.length > 0 ? true : false;
},
}
return true;
},
// 文件个数超出
handleExceed() {
this.$message.error(`只允许上传单个文件`);
},
// 上传失败
handleUploadError(err) {
this.$message.error("上传失败, 请重试");
},
// 上传成功回调
handleUploadSuccess(res, file) {
this.$message.success("上传成功");
this.$emit("resFun", res);
},
created() {
console.log(this.fileArr);
// this.fileList = this.list;
this.addShow = this.fileArr.length > 0 ? true : false;
// 文件列表移除文件
handleRemove(file, fileList) {
console.log("列表移除", file, fileList);
this.addShow = fileList.length > 0 ? true : false;
this.$emit("remove", file);
},
// 删除文件
handleDelete(index) {
this.fileList.splice(index, 1);
this.$emit("input", "");
// let that = this,
// param;
// param = file.response ? file.response.fileName.replace(/\\/g, "%")
// : file.response.url.replace(/\\/g, "%").slice(9);
// $.ajax({
// type: "GET",
// url: process.env.VUE_APP_BASE_API + "/common/deleteFile",
// data: {savePath: param},
// dataType: "json",
// success: function(data){
// if (data) that.$message.success("删除成功");
// else return false;
// }
// });
},
handleFileClick(file, fileList) {
this.dialogImageUrl = file.response ? file.response.url : file.url;
// this.dialogImageUrl =if(this.fileArr) this.fileArr[0].url;
// this.dialogVisible = true;
this.$refs.previewImg.showViewer = false;
};
console.log(file);
// console.log(file.response.url)
},
// 获取文件名称
getFileName(name) {
if (name.lastIndexOf("/") > -1) {
return name.slice(name.lastIndexOf("/") + 1).toLowerCase();
} else {
return "";
}
},
// 当改变列表改变时
fileChange(file, fileList) {
this.addShow = fileList.length > 0 ? true : false;
},
},
created() {
console.log(this.fileArr);
// this.fileList = this.list;
this.addShow = this.fileArr.length > 0 ? true : false;
},
};
</script>
<style scoped lang="scss">
img {
width: 100%;
}
.upload-file-uploader {
margin-bottom: 5px;
}
.upload-file-list .el-upload-list__item {
border: 1px solid #e4e7ed;
line-height: 2;
margin-bottom: 10px;
position: relative;
}
.upload-file-list .ele-upload-list__item-content {
display: flex;
justify-content: space-between;
align-items: center;
color: inherit;
}
.ele-upload-list__item-content-action .el-link {
margin-right: 10px;
}
img {
width: 100%;
}
.upload-file-uploader {
margin-bottom: 5px;
}
.upload-file-list .el-upload-list__item {
border: 1px solid #e4e7ed;
line-height: 2;
margin-bottom: 10px;
position: relative;
}
.upload-file-list .ele-upload-list__item-content {
display: flex;
justify-content: space-between;
align-items: center;
color: inherit;
}
.ele-upload-list__item-content-action .el-link {
margin-right: 10px;
}
</style>
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-12-19 15:23:58
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-12-21 16:56:26
* @LastEditTime: 2023-02-01 17:24:30
* @FilePath: /danger-manage-web/src/views/educationPlanExam/textPaper/components/Lesson-table.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -16,7 +16,10 @@
@select-all="all"
ref="multipleTable"
>
<el-table-column type="selection"></el-table-column>
<el-table-column
v-if='!disabled'
type="selection"
></el-table-column>
<el-table-column label="姓名" align="center" prop="staffName">
</el-table-column>
<el-table-column
......@@ -55,10 +58,14 @@ export default {
selectNameList: {
type: Array,
},
disabled: {
type: Boolean,
},
},
created() {
// this.listStaff();
},
data() {
return {
queryParams: {
......@@ -71,6 +78,9 @@ export default {
nameList: [],
loading: false,
};
},
mounted() {
},
methods: {
listStaff() {
......@@ -109,6 +119,11 @@ export default {
}
this.$emit("selectAll", this.nameList, allSelect);
},
selectable(row, rowIndex) {
if (!this.disabled) {
return true;
}
},
// 切换选项
toggleSelection(staffId, SeclctFlag = false) {
const item = this.nameList.find((item) => {
......
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-12-19 17:39:55
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2023-01-13 15:37:54
* @LastEditTime: 2023-02-02 10:56:52
* @FilePath: /danger-manage-web/src/views/educationPlanExam/textPaper/components/ChangePapel.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -36,13 +36,14 @@
>
</el-input>
<div>
<el-button @click="searchTable" size="mini">搜索</el-button>
<el-button @click="searchTable" size="mini">搜索</el-button>
</div>
</div>
<div class="left-middle-table">
<ChangPapelTable
ref="table"
:selectNameList.sync="selectNameList"
:disabled="disabled"
@selectOne="selectOne"
@selectAll="selectAll"
/>
......@@ -60,7 +61,7 @@
:key="item.staffId"
>
<div>{{ item.staffName }}</div>
<div class="close" @click="deleteName(item.staffId)">x</div>
<div class="close" @click="deleteName(item.staffId)">x</div>
</div>
</div>
<div class="bottom-text">已选择{{selectNameList.length}}</div>
......@@ -83,6 +84,9 @@ export default {
type: String,
default: null,
},
disabled:{
type:Boolean,
}
},
data() {
return {
......@@ -143,6 +147,7 @@ export default {
this.$refs.table.listStaff();
},
deleteName(staffId) {
if(this.disabled) return;
const index = this.selectNameList.findIndex((item) => {
return item.staffId == staffId;
});
......
......@@ -7,7 +7,7 @@
// [114.07708709377842, 38.248960473114614],
// ],
// colorNum: 1,
// fxlb: "风险区域",
// fxlb: "重大风险区域",
// bsjh: "",
// wxy: "锅炉操作",
// fxd: "锅炉点火",
......@@ -145,7 +145,7 @@ export const dangerArr = [
[114.08164030994841, 38.25079994477491],
],
data: {
fxlb: "较风险"
fxlb: "较风险"
},
colorNum: 2,
},
......@@ -160,7 +160,7 @@ export const dangerArr = [
[114.08037480953207, 38.249932590119556],
],
data: {
fxlb: "风险",
fxlb: "重大风险",
src: [jzyh, jzdhz, dxzd, dxxl, dxbz, bxdfdmj],
},
colorNum: 1,
......@@ -174,7 +174,7 @@ export const dangerArr = [
[114.08098376391818, 38.24951885572243],
],
data: {
fxlb: "风险"
fxlb: "重大风险"
},
colorNum: 1,
},
......@@ -201,7 +201,7 @@ export const dangerArr = [
[114.08000932886821, 38.25149427805925],
],
data: {
fxlb: "较风险"
fxlb: "较风险"
},
colorNum: 2,
},
......@@ -215,7 +215,7 @@ export const dangerArr = [
[114.07992247747968, 38.2490596822873],
],
data: {
fxlb: "风险"
fxlb: "重大风险"
},
},
{
......@@ -240,7 +240,7 @@ export const dangerArr = [
[114.07896214915758, 38.2485657203445],
],
data: {
fxlb: "风险"
fxlb: "重大风险"
},
colorNum: 1,
},
......@@ -253,7 +253,7 @@ export const dangerArr = [
[114.07968503158452, 38.249621022521914],
],
data: {
fxlb: "较风险"
fxlb: "较风险"
},
colorNum: 2,
},
......@@ -266,7 +266,7 @@ export const dangerArr = [
[114.07932854865001, 38.25049906057526],
],
data: {
fxlb: "风险"
fxlb: "重大风险"
},
colorNum: 1,
},
......@@ -279,7 +279,7 @@ export const dangerArr = [
[114.07929156270377, 38.24989004286162],
],
data: {
fxlb: "风险"
fxlb: "重大风险"
},
colorNum: 1,
},
......@@ -293,7 +293,7 @@ export const dangerArr = [
[114.07818775308438, 38.24904718615451],
],
data: {
fxlb: "风险"
fxlb: "重大风险"
},
},
{
......@@ -308,7 +308,7 @@ export const dangerArr = [
[114.07822516569071, 38.24873709204756],
],
data: {
fxlb: "风险"
fxlb: "重大风险"
},
},
{
......@@ -320,7 +320,7 @@ export const dangerArr = [
[114.0778791617466, 38.24978811628299],
],
data: {
fxlb: "较风险"
fxlb: "较风险"
},
colorNum: 2,
},
......@@ -334,7 +334,7 @@ export const dangerArr = [
[114.07811902680491, 38.25084109067064],
],
data: {
fxlb: "风险"
fxlb: "重大风险"
},
},
{
......@@ -346,7 +346,7 @@ export const dangerArr = [
[114.07816939918499, 38.250464604821424],
],
data: {
fxlb: "风险"
fxlb: "重大风险"
},
colorNum: 1,
},
......@@ -362,7 +362,7 @@ export const dangerArr = [
[114.07655032796976, 38.24855692071795],
],
data: {
fxlb: "较风险"
fxlb: "较风险"
},
},
{
......@@ -375,7 +375,7 @@ export const dangerArr = [
[114.07645852296761, 38.249258052783055],
],
data: {
fxlb: "风险"
fxlb: "重大风险"
},
},
{
......@@ -387,7 +387,7 @@ export const dangerArr = [
[114.07673177371679, 38.24999869046041],
],
data: {
fxlb: "风险"
fxlb: "重大风险"
},
colorNum: 1,
},
......@@ -400,7 +400,7 @@ export const dangerArr = [
[114.07638572203807, 38.250006593486276],
],
data: {
fxlb: "风险"
fxlb: "重大风险"
},
colorNum: 1,
},
......@@ -413,7 +413,7 @@ export const dangerArr = [
[114.0763611632972, 38.2506105391965],
],
data: {
fxlb: "风险"
fxlb: "重大风险"
},
colorNum: 1,
},
......@@ -440,7 +440,7 @@ export const dangerArr = [
[114.07610863025666, 38.249559594773935],
],
data: {
fxlb: "较风险"
fxlb: "较风险"
},
},
{
......@@ -452,7 +452,7 @@ export const dangerArr = [
[114.07629629633044, 38.249994075703896],
],
data: {
fxlb: "风险"
fxlb: "重大风险"
},
colorNum: 1,
},
......@@ -479,7 +479,7 @@ export const dangerArr = [
[114.07614690640786, 38.250982027231906],
],
data: {
fxlb: "风险"
fxlb: "重大风险"
},
colorNum: 1,
},
......@@ -492,7 +492,7 @@ export const dangerArr = [
[114.07506815524074, 38.24935807751058],
],
data: {
fxlb: "风险"
fxlb: "重大风险"
},
colorNum: 1,
},
......@@ -505,7 +505,7 @@ export const dangerArr = [
[114.07575424777615, 38.25022009521355],
],
data: {
fxlb: "风险"
fxlb: "重大风险"
},
colorNum: 1,
},
......@@ -518,7 +518,7 @@ export const dangerArr = [
[114.07569321404614, 38.25050557141559],
],
data: {
fxlb: "风险"
fxlb: "重大风险"
},
colorNum: 1,
},
......@@ -531,7 +531,7 @@ export const dangerArr = [
[114.07533109169464, 38.25112532353275],
],
data: {
fxlb: "风险"
fxlb: "重大风险"
},
colorNum: 1,
},
......@@ -544,7 +544,7 @@ export const dangerArr = [
[114.07506400522227, 38.2498509809399],
],
data: {
fxlb: "较风险"
fxlb: "较风险"
},
colorNum: 2,
},
......@@ -557,7 +557,7 @@ export const dangerArr = [
[114.07507104315593, 38.249669088954406],
],
data: {
fxlb: "风险"
fxlb: "重大风险"
},
colorNum: 1,
},
......@@ -571,7 +571,7 @@ export const dangerArr = [
[114.07329016901807, 38.24975956466659],
],
data: {
fxlb: "风险"
fxlb: "重大风险"
},
},
{
......@@ -583,7 +583,7 @@ export const dangerArr = [
[114.07449942174725, 38.25005976641145],
],
data: {
fxlb: "风险"
fxlb: "重大风险"
},
colorNum: 1,
},
......@@ -596,7 +596,7 @@ export const dangerArr = [
[114.07409377782558, 38.25057015884229],
],
data: {
fxlb: "风险"
fxlb: "重大风险"
},
colorNum: 1,
},
......
<!--
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2023-02-01 09:37:02
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2023-02-01 09:59:55
* @FilePath: /danger-manage-web/src/views/dangerScale/profile/tiops.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="danger-tips">
<!-- <div>管道压力</div> -->
<div class="hasColorBox" :style="{ color: dangerColor['1'] }">
<div :style="{ backgroundColor: dangerColor['1'] }"></div>
<span>重大风险</span>
</div>
<div class="hasColorBox" :style="{ color: dangerColor[`2`] }">
<div :style="{ backgroundColor: dangerColor[`2`] }"></div>
<span>较大风险</span>
</div>
<div class="hasColorBox" :style="{ color: dangerColor[`3`] }">
<div :style="{ backgroundColor: dangerColor[`3`] }"></div>
<span>一般风险</span>
</div>
<div class="hasColorBox" :style="{ color: dangerColor[`4`] }">
<div :style="{ backgroundColor: dangerColor[`4`] }"></div>
<span>低风险</span>
</div>
</div>
</template>
<script>
export default {
name: "",
data() {
return {
dangerColor: {
1: "red",
2: "orange",
3: "yellow",
4: "blue",
},
};
},
methods: {},
};
</script>
<style lang="scss" scoped>
.danger-tips {
position: absolute;
color: #fff;
left: 10px;
top: 10px;
padding: 1px;
padding-left:10px;
width: 150px;
// background: rgba(6, 29, 51, 0.2);
.hasColorBox {
// border: 1px solid #053b6a;
padding: 2px 5px;
margin-bottom: 5px;
position:relative;
& > div {
display: inline-block;
width: 50px;
height: 20px;
margin-right: 10px;
}
& > span {
position:absolute;
display: inline-block;
width: 100px;
}
}
}
</style>
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-06-16 15:03:40
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-10-22 10:39:48
* @LastEditTime: 2023-02-01 09:48:47
* @FilePath: /danger-manage-web/src/views/bigwindow/index.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -20,13 +20,14 @@
>
</div> -->
<div id="mapbox"></div>
<DangerTips />
</div>
</template>
<script>
import CreateCesium, { DEVICE_PIC_TYPE } from "@/utils/cesium/cesiumClass.js";
import { dangerArr } from "@/utils/cesium/dangerArr.js";
import DangerTips from "./DangerTips.vue";
import Video from "@/components/bigWindow/video";
import Null from "@/components/bigWindow/Null";
import Danger from "@/components/bigWindow/Danger";
......@@ -42,6 +43,7 @@ export default {
name: "profile",
components: {
Editor,
DangerTips,
},
data() {
return {
......@@ -249,6 +251,7 @@ export default {
<style lang="scss" scoped>
.big-window {
width: 100%;
position:relative;
// height: calc(100vh - 84px);
height: calc(100vh - 50px);
#mapbox {
......
......@@ -11,9 +11,15 @@
size="mini"
@input="topicTypeChange"
>
<el-radio-button :label="1">单选</el-radio-button>
<el-radio-button :label="2">多选</el-radio-button>
<el-radio-button :label="3">判断</el-radio-button>
<el-radio-button :disabled="checkLock" :label="1"
>单选</el-radio-button
>
<el-radio-button :disabled="checkLock" :label="2"
>多选</el-radio-button
>
<el-radio-button :disabled="checkLock" :label="3"
>判断</el-radio-button
>
</el-radio-group>
</div>
......@@ -29,7 +35,7 @@
:rules="{
required: true,
message: '必须输入题目内容',
trigger: 'blur',
trigger: ['blur', 'change'],
}"
>
<el-input
......@@ -38,6 +44,7 @@
resize="none"
rows="4"
v-model="form.topicTitle"
:disabled="checkLock"
>
</el-input>
</el-form-item>
......@@ -55,7 +62,7 @@
:rules="{
required: true,
message: '选项内容不能为空不能为空',
trigger: 'change',
trigger: ['blur', 'change'],
}"
>
<div class="add-select flex">
......@@ -65,6 +72,7 @@
style="flex: 1; margin-right: 10px"
rows="2"
v-model="question.value"
:disabled="checkLock"
></el-input>
<div class="flex algin-items">
<div
......@@ -79,8 +87,9 @@
<el-button
size="mini"
type="danger"
v-if="index > 0"
v-if="index > 0 && form.topicType != 3"
@click.prevent="removeDomain(question)"
:disabled="checkLock"
>删除</el-button
>
</div>
......@@ -111,7 +120,11 @@
设为正确答案
</div> -->
<div style="padding-left: 30px" v-if="form.topicType != 3">
<el-button size="mini" type="primary" @click.prevent="add(addValue)"
<el-button
size="mini"
:disabled="checkLock"
type="primary"
@click.prevent="add(addValue)"
>新增选项</el-button
>
</div>
......@@ -146,6 +159,10 @@ export default {
topicId: {
type: Number,
},
// 如果是查看,就禁止修改
checkLock: {
type: Boolean,
},
},
components: {},
data() {
......@@ -171,7 +188,7 @@ export default {
console.log(res.data);
const data = res.data;
this.form = {
topicType :data.topicType,
topicType: data.topicType,
topicTitle: data.topicTitle,
questions: JSON.parse(data.topicOption),
};
......@@ -232,6 +249,7 @@ export default {
}
},
rightAnswerClick(index) {
if (this.checkLock) return;
if (this.form.topicType === 2) {
const ind = this.answerNum.indexOf(index);
if (ind < 0) {
......@@ -250,6 +268,8 @@ export default {
},
// 删除选项
removeDomain(question) {
if (this.checkLock) return;
const index = this.form.questions.indexOf(question);
console.log(index);
// 如果是正确答案,就让正确答案清空
......@@ -276,11 +296,10 @@ export default {
// 新增选项
add(addValue) {
this.form.questions.push({ value: addValue });
console.log();
},
save(num = 2) {
return new Promise((resove) => {
if (this.answerNum.length<=0) {
if (this.answerNum.length <= 0) {
this.$message({
message: "警告,请设置一个正确答案",
type: "warning",
......@@ -293,8 +312,8 @@ export default {
data.topicTitle = this.form.topicTitle;
data.topicOption = JSON.stringify(this.form.questions);
data.answer = JSON.stringify(this.answerNum);
data.topicType=this.form.topicType;
console.log(data)
data.topicType = this.form.topicType;
console.log(data);
this.addQuestion(data).then((res) => {
if (res.code == 200) {
// 把修改的这个归位,变成正常添加
......@@ -324,7 +343,7 @@ export default {
});
},
reset() {
const topicType = this.form.topicType
const topicType = this.form.topicType;
this.form = {
topicType,
topicTitle: "",
......
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-12-27 09:30:19
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-12-28 10:29:18
* @LastEditTime: 2023-02-01 16:15:10
* @FilePath: /danger-manage-web/src/views/educationPlanExam/textPaper/components/ChangeQuestion.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -193,7 +193,8 @@ export default {
this.loading = false;
});
},
saveAndNext() {
save(num=2) {
const topicInfos = this.list
.filter((item) => item.checked)
.map((item) => {
......@@ -202,18 +203,20 @@ export default {
quan: item.changeNum,
};
});
console.log(this.courseId, topicInfos);
const data = { courseId: this.courseId, topicInfos };
console.log(data);
bachAddTopic(data).then((res) => {
console.log(res);
if (res.code == 200) {
this.$parent.$parent.componentsNumChange(2);
this.$parent.$parent.componentsNumChange(num);
this.$parent.$parent.$parent.getList();
}
});
},
saveAndNext(){
this.save(3)
},
resetClick() {},
search() {
this.getList();
......
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-22 10:38:49
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2023-01-13 15:59:47
* @LastEditTime: 2023-02-01 16:16:44
* @FilePath: /danger-manage-web/src/views/lessonsProgram/components/addLesson.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -24,6 +24,7 @@
:is="currentComponent"
:courseId.sync="courseId"
:topicId.sync="topicId"
:checkLock="checkLock"
ref="current"
></component>
</transition>
......@@ -32,27 +33,31 @@
<QuestionList/> -->
</div>
<div slot="footer" class="dialog-footer">
<div slot="footer" class="dialog-footer" v-if="!checkLock">
<el-button
type="primary"
v-if="this.componentsNum == 2"
v-if="this.componentsNum == 2 && !checkLock"
@click="componentsNumChange(4)"
>从题库选择</el-button
>
<el-button
type="primary"
v-if="this.componentsNum == 1 || this.componentsNum == 3"
@click="save"
>保存</el-button
v-if="this.componentsNum == 4 ||this.componentsNum==3"
@click="componentsNumChange(2)"
>返回题目列表</el-button
>
<el-button
type="primary"
v-if="this.componentsNum == 4"
@click="componentsNumChange(2)"
>返回题目列表</el-button
v-if="
this.componentsNum == 1 ||
this.componentsNum == 3 ||
this.componentsNum == 4
"
@click="save"
>保存</el-button
>
<el-button type="primary" @click="saveAndNext">{{
<el-button type="primary" @click="saveAndNext" v-if="!checkLock">{{
saveNextText
}}</el-button>
<el-button
......@@ -63,6 +68,16 @@
>
<el-button @click="dialogCancel">取消</el-button>
</div>
<div slot="footer" class="dialog-footer" v-else>
<el-button
type="primary"
v-if="this.componentsNum == 3 && checkLock"
@click="componentsNumChange(2)"
>返回题目列表</el-button
>
<el-button type="primary" @click="dialogCancel">{{ "确认" }}</el-button>
<el-button @click="dialogCancel">取消</el-button>
</div>
</el-dialog>
</template>
......@@ -72,7 +87,6 @@ import AddQuestion from "./AddQuestion";
import QuestionList from "./QuestionList";
import ChangeQuestion from "./ChangeQuestion";
export default {
name: "AnswerLesson",
props: {
......@@ -87,6 +101,9 @@ export default {
courseId: {
type: Number,
},
checkLock: {
type: Boolean,
},
},
// components: {
// Lesson,
......@@ -116,14 +133,14 @@ export default {
this.currentComponent = QuestionList;
this.title = "题目列表";
} else if(num===3) {
} else if (num === 3) {
this.currentComponent = AddQuestion;
if (this.topicId) {
this.title = "修改题目";
} else {
this.title = "新增题目";
}
}else if (num == 4) {
} else if (num == 4) {
this.currentComponent = ChangeQuestion;
this.title = "从题库选题";
}
......@@ -167,6 +184,8 @@ export default {
this.topicId = null;
}
this.$emit("update:visible", false);
// 关闭的时候归位
this.$emit("update:checkLock", false);
},
// 把ID改变了
changeCourseId(courseId) {
......
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-22 10:59:44
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2023-01-04 17:47:53
* @LastEditTime: 2023-02-01 15:21:15
* @FilePath: /danger-manage-web/src/views/lessonsProgram/components/Lession.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -17,34 +17,33 @@
>
<div class="top flex">
<el-form-item label="课程标题" prop="courseName">
<el-input style="width: 400px" v-model="form.courseName"></el-input>
<el-input style="width: 400px" v-model="form.courseName" :disabled="checkLock"></el-input>
</el-form-item>
<!--<el-form-item label="培训计划" prop="courseType">-->
<!--<el-select-->
<!--v-model="form.courseType"-->
<!--placeholder="请选择培训计划"-->
<!--clearable-->
<!--size="small"-->
<!--&gt;-->
<!--<el-option-->
<!--v-for="course in courseOptions"-->
<!--:key="course.planId"-->
<!--:label="course.planName"-->
<!--:value="course.planId"-->
<!--/>-->
<!--</el-select>-->
<!--<el-select-->
<!--v-model="form.courseType"-->
<!--placeholder="请选择培训计划"-->
<!--clearable-->
<!--size="small"-->
<!--&gt;-->
<!--<el-option-->
<!--v-for="course in courseOptions"-->
<!--:key="course.planId"-->
<!--:label="course.planName"-->
<!--:value="course.planId"-->
<!--/>-->
<!--</el-select>-->
<!--</el-form-item>-->
</div>
<div class="flex">
<el-form-item label="培训计划" prop="courseType">
<el-select
v-model="form.courseType"
placeholder="请选择培训计划"
clearable
size="small"
:disabled="checkLock"
>
<el-option
v-for="course in courseOptions"
......@@ -54,8 +53,18 @@
/>
</el-select>
</el-form-item>
<el-form-item label="培训时长" prop="duration" style="margin-left: 55px">
<el-input style="width: 220px" placeholder="分钟" type="number" v-model="form.duration"></el-input>
<el-form-item
label="培训时长"
prop="duration"
style="margin-left: 55px"
>
<el-input
style="width: 220px"
placeholder="分钟"
type="number"
v-model="form.duration"
:disabled="checkLock"
></el-input>
</el-form-item>
</div>
<div class="flex">
......@@ -67,6 +76,7 @@
type="datetime"
placeholder="选择日期时间"
default-time="00:00:00"
:disabled="checkLock"
/>
</el-form-item>
<el-form-item label="结束时间" prop="testEndTime">
......@@ -76,12 +86,13 @@
type="datetime"
placeholder="选择日期时间"
default-time="00:00:00"
:disabled="checkLock"
/>
</el-form-item>
</div>
<!-- </div> -->
<el-form-item label="课程内容" prop="courseConent">
<Editor v-model="form.courseConent" :min-height="192" />
<Editor v-model="form.courseConent" :min-height="192" :readOnly="checkLock"/>
<el-input
v-show="false"
disabled
......@@ -90,7 +101,7 @@
</el-form-item>
<div class="flex">
<el-form-item label="视频上传" v-if="!readOnly" prop="video">
<el-form-item label="视频上传" v-if="!readOnly" prop="video">
<FileUpload
listType="picture"
@resFun="getFileInfoVideo"
......@@ -98,6 +109,7 @@
:fileArr="fileListVideo"
:fileSize="500"
:fileType="['mp4']"
:disabled="checkLock"
/>
<el-input v-show="false" disabled v-model="form.video"></el-input>
</el-form-item>
......@@ -108,6 +120,7 @@
@remove="listRemoveFile"
:fileArr="fileListFile"
:fileType="fileType"
:disabled="checkLock"
/>
<el-input v-show="false" disabled v-model="form.enclosure"></el-input>
</el-form-item>
......@@ -133,6 +146,9 @@ export default {
courseId: {
type: Number,
},
checkLock:{
type:Boolean,
}
},
components: {
Editor,
......@@ -204,8 +220,16 @@ export default {
getLessonById(this.courseId).then((res) => {
if (res.code == 200) {
const data = res.data;
const { courseName, courseType, courseConent, video, enclosure,duration,testStartTime,testEndTime } =
data;
const {
courseName,
courseType,
courseConent,
video,
enclosure,
duration,
testStartTime,
testEndTime,
} = data;
this.form = {
courseName,
courseType,
......@@ -214,21 +238,22 @@ export default {
enclosure,
duration,
testStartTime,
testEndTime
testEndTime,
};
this.fileListVideo = [
console.log('video',video)
this.fileListVideo = video? [
{
name: courseName + "视频",
url: uploadfile,
},
];
]:[];
this.fileListFile = [
{
name: courseName + "附件",
url: uploadfile,
},
];
console.log("--",this.fileListFile);
console.log("--", this.fileListFile);
}
});
},
......@@ -280,14 +305,18 @@ export default {
message: "保存课程成功",
type: "success",
});
// 隐藏dia
this.$parent.$parent.dialogCancel()
} else if (num == 3) {
this.$message({
message: "保存课程成功,请开始录入题目",
type: "success",
});
// 跳转动态路由,并且把ID改变添加用
this.$parent.$parent.componentsNumChange(num);
this.$parent.$parent.changeCourseId(courseId);
}
this.$parent.$parent.componentsNumChange(num);
this.$parent.$parent.changeCourseId(courseId);
this.$parent.$parent.$parent.getList();
return true;
......@@ -307,7 +336,7 @@ export default {
.form-wrapper {
padding-top: 22px;
width: 100%;
height: 650px;
height: 680px;
overflow: hidden;
// padding-bottom: 10px;
margin-bottom: 20px;
......
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-22 17:56:05
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2023-01-13 16:26:33
* @LastEditTime: 2023-02-02 10:05:15
* @FilePath: /danger-manage-web/src/views/lessonsProgram/components/QuestionList.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -71,12 +71,21 @@
<div class="right">
<div>
<el-button
v-if="!checkLock"
@click="edit(item.topicId)"
icon="el-icon-edit"
type="text"
>修改</el-button
>
<el-button
v-if="checkLock"
@click="edit(item.topicId)"
icon="el-icon-edit"
type="text"
>查看</el-button
>
<el-button
v-if="!checkLock"
@click="deleteLesson(item.topicId)"
icon="el-icon-delete"
type="text"
......@@ -98,6 +107,7 @@
v-model="bottomFrom.singleChoiceScore"
style="width: 50px"
size="mini"
:disabled="checkLock"
></el-input>
</div>
<div></div>
......@@ -109,6 +119,7 @@
v-model="bottomFrom.multipleChoiceScore"
style="width: 50px"
size="mini"
:disabled="checkLock"
></el-input>
</div>
<div></div>
......@@ -121,6 +132,7 @@
v-model="bottomFrom.judgmentScore"
style="width: 50px"
size="mini"
:disabled="checkLock"
></el-input>
</div>
<div></div>
......@@ -133,6 +145,7 @@
v-model="bottomFrom.qualifiedNum"
style="width: 60px"
size="mini"
:disabled="checkLock"
></el-input>
</div>
<div>为合格</div>
......@@ -144,6 +157,7 @@
icon="el-icon-check"
size="mini"
type="success"
:disabled="checkLock"
>保存</el-button
>
</div>
......@@ -164,6 +178,9 @@ export default {
courseId: {
type: Number,
},
checkLock: {
type: Boolean,
},
},
components: {},
data() {
......@@ -293,10 +310,10 @@ export default {
// 如果有一个没写,就不允许保存
if (
!(
this.bottomFrom.singleChoiceScore > 0 &&
this.bottomFrom.multipleChoiceScore > 0 &&
this.bottomFrom.judgmentScore > 0 &&
this.fobottomFromrm.qualifiedNum > 0
this.bottomFrom.singleChoiceScore >= 0 &&
this.bottomFrom.multipleChoiceScore >= 0 &&
this.bottomFrom.judgmentScore >= 0 &&
this.bottomFrom.qualifiedNum >= 0
)
) {
this.$message({
......
......@@ -131,11 +131,13 @@
prop="topicNum"
width="180"
>
<template v-slot="{ row: { topicNum, courseId } }">
<div @click="checkQuestion(courseId)" class="timuNum">
<div v-if="topicNum > 0">{{ `已录入${topicNum}题` }}</div>
<div v-else>未录入</div>
</div>
<template v-slot="{ row: { topicNum, courseId, status } }">
<span @click="checkQuestion(courseId, status)" class="timuNum">
<span v-if="topicNum > 0">
{{ status == 0 ? `已录入${topicNum}题` : "查看" }}
</span>
<span v-else>未录入</span>
</span>
</template>
</el-table-column>
<el-table-column
......@@ -153,6 +155,14 @@
@click="changeLesson(courseId)"
>修改</el-button
>
<el-button
v-if="status == 1"
size="mini"
type="text"
icon="el-icon-edit"
@click="checkLesson(courseId)"
>详情</el-button
>
<el-button
size="mini"
type="text"
......@@ -165,7 +175,7 @@
size="mini"
type="text"
icon="el-icon-delete"
@click="issueLesson(courseId)"
@click="issueDilog(courseId)"
>发布</el-button
>
</template>
......@@ -183,18 +193,68 @@
ref="Dia"
:componentsNum.sync="componentsNum"
:courseId.sync="courseId"
:checkLock.sync="checkLock"
:visible.sync="dilogFlag"
/>
<el-dialog title="发布详情" :visible.sync="issueVisible" width="60%">
<div class="detail flex">
<div class="detail-item">
单选题<span>{{ bottomFrom.singleChoiceScore }}</span
>/,<span>{{ danxs }}</span
>题,计<span class="textC">{{
danxs * bottomFrom.singleChoiceScore
}}</span
>
</div>
<div class="detail-item">
多选题<span>{{ bottomFrom.multipleChoiceScore }}</span
>/,<span>{{ duoxs }}</span> 题,计<span class="textC">{{
duoxs * bottomFrom.multipleChoiceScore
}}</span
>
</div>
<div class="detail-item">
判断提<span>{{ bottomFrom.judgmentScore }}</span
>/题,共<span>{{ pds }}</span> 题,计<span class="textC">{{
pds * bottomFrom.judgmentScore
}}</span
>
</div>
<div class="detail-item">
合格分数为<span class="textC">{{ bottomFrom.qualifiedNum }}</span
>
</div>
<div class="detail-item">
一共<span>{{ danxs + duoxs + pds }}</span
>道题,总共计<span class="textC">{{
danxs * bottomFrom.singleChoiceScore +
duoxs * bottomFrom.multipleChoiceScore +
pds * bottomFrom.judgmentScore
}}</span
>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="issueVisible = false"> </el-button>
<el-button type="primary" @click="issueLesson(issueCourseId)"
>确认发布</el-button
>
</span>
</el-dialog>
</div>
</template>
<script>
import {
getQuestion,
getLessons,
getLessonById,
issue,
deleteLesson,
} from "@/api/educationPlanExam/lessonsProgram.js";
// 获取培训计划
import { getPlanList } from "@/api/educationPlanExam/trainingProgram";
import { mapGetters, mapMutations } from "vuex";
......@@ -222,18 +282,39 @@ export default {
courseName: null,
releaseTime: "",
},
// 表单参数
form: {},
// 表单校验
dilogFlag: false,
// 发布弹框
issueVisible: false,
bottomFrom: {
singleChoiceScore: 0,
multipleChoiceScore: 0,
judgmentScore: 0,
qualifiedNum: 0,
},
issueCourseId: null,
questionList: [],
componentsNum: 1,
// 点击的id,如果是新增为空
courseId: null,
// false为编辑,true为查看,查看不允许编辑的时候
checkLock: false,
};
},
computed: {
...mapGetters(["courseOptions"]),
danxs() {
return this.questionList.filter((item) => item.topicType === 1).length;
},
duoxs() {
return this.questionList.filter((item) => item.topicType === 2).length;
},
pds() {
return this.questionList.filter((item) => item.topicType === 3).length;
},
},
created() {
this.getPlanList();
......@@ -275,21 +356,34 @@ export default {
},
/** 新增按钮操作 */
handleAdd() {
this.checkLock = false;
this.$refs.Dia.title = "新增培训课程";
this.componentsNum = 1;
this.courseId = null;
this.dilogFlag = true;
},
changeLesson(courseId) {
this.checkLock = false;
this.$refs.Dia.title = "修改培训课程";
this.componentsNum = 1;
this.courseId = courseId;
this.dilogFlag = true;
},
checkLesson(courseId) {
this.checkLock = true;
this.$refs.Dia.title = "查看培训课程";
this.componentsNum = 1;
this.courseId = courseId;
this.dilogFlag = true;
},
// 直接查看考题
checkQuestion(courseId) {
checkQuestion(courseId, status) {
// 要查看考题的id
if (status == 1) {
this.checkLock = true;
}
this.courseId = courseId;
console.log(this.courseId);
// 2代表列表组件
......@@ -331,9 +425,39 @@ export default {
})
.catch(() => {});
},
// 发布弹框
issueDilog(courseId) {
getQuestion({courseId})
.then((res) => {
this.questionList = res.rows.map((item) => {
return {
topicType: item.topicType,
topicId: item.topicId,
topicTitle: item.topicTitle,
};
});
})
.then((res) => {
return getLessonById(courseId);
})
.then((res) => {
this.bottomFrom = {
singleChoiceScore: res.data.singleChoiceScore,
multipleChoiceScore: res.data.multipleChoiceScore,
judgmentScore: res.data.judgmentScore,
qualifiedNum: res.data.qualifiedNum,
};
})
.then((res) => {
this.issueVisible = true;
this.issueCourseId = courseId;
});
//
},
// 发布
issueLesson(courseId) {
this.$confirm("请确定发布", {
this.$confirm("确定要发布吗", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
......@@ -343,14 +467,14 @@ export default {
return getLessonById(courseId);
})
.then((res) => {
if (
res.data.singleChoiceScore > 0 &&
res.data.multipleChoiceScore > 0 &&
res.data.judgmentScore > 0 &&
res.data.qualifiedNum > 0
) {
return true;
}
// if (
// res.data.singleChoiceScore >= 0 &&
// res.data.multipleChoiceScore >= 0 &&
// res.data.judgmentScore >= 0 &&
// res.data.qualifiedNum >= 0
// ) {
return true;
// }
})
.then((res) => {
if (res) {
......@@ -370,6 +494,7 @@ export default {
type: "success",
});
this.getList();
this.issueVisible = false;
}
})
.catch(() => {});
......@@ -469,4 +594,17 @@ export default {
::v-deep .el-dialog {
margin-top: 15vh !important;
}
.detail {
// position: absolute;
// bottom: -20px;
// left: 10px;
.textC {
font-weight: 800;
font-size: 18px;
}
.detail-item {
margin-right: 20px;
color: red;
}
}
</style>
......@@ -81,7 +81,7 @@
<el-button
size="mini"
type="danger"
v-if="index > 0"
v-if="index > 0 && form.topicType != 3"
@click.prevent="removeDomain(question)"
>删除</el-button
>
......
......@@ -11,9 +11,15 @@
size="mini"
@input="topicTypeChange"
>
<el-radio-button :label="1">单选</el-radio-button>
<el-radio-button :label="2">多选</el-radio-button>
<el-radio-button :label="3">判断</el-radio-button>
<el-radio-button :disabled="checkLock" :label="1"
>单选</el-radio-button
>
<el-radio-button :disabled="checkLock" :label="2"
>多选</el-radio-button
>
<el-radio-button :disabled="checkLock" :label="3"
>判断</el-radio-button
>
</el-radio-group>
</div>
<div class="right">{{ courseName }}</div>
......@@ -28,7 +34,7 @@
:rules="{
required: true,
message: '必须输入题目内容',
trigger: 'blur',
trigger: ['blur', 'change'],
}"
>
<el-input
......@@ -37,6 +43,7 @@
resize="none"
rows="4"
v-model="form.topicTitle"
:disabled="checkLock"
>
</el-input>
</el-form-item>
......@@ -54,7 +61,7 @@
:rules="{
required: true,
message: '第一项不能为空不能为空',
trigger: 'blur',
trigger: ['blur', 'change'],
}"
>
<div class="add-select flex">
......@@ -64,6 +71,7 @@
style="flex: 1; margin-right: 10px"
rows="2"
v-model="question.value"
:disabled="checkLock"
></el-input>
<div class="flex algin-items">
<div
......@@ -76,8 +84,9 @@
<el-button
size="mini"
type="danger"
v-if="index > 0"
v-if="index > 0 && form.topicType != 3"
@click.prevent="removeDomain(question)"
:disabled="checkLock"
>删除</el-button
>
</div>
......@@ -108,7 +117,11 @@
设为正确答案
</div> -->
<div style="padding-left: 30px">
<el-button size="mini" type="primary" @click.prevent="add(addValue)"
<el-button
size="mini"
type="primary"
@click.prevent="add(addValue)"
:disabled="checkLock"
>新增选项</el-button
>
</div>
......@@ -143,6 +156,9 @@ export default {
topicId: {
type: Number,
},
checkLock: {
type: Boolean,
},
},
components: {},
data() {
......@@ -229,6 +245,7 @@ export default {
}
},
rightAnswerClick(index) {
if (this.checkLock) return;
if (this.form.topicType === 2) {
const ind = this.answerNum.indexOf(index);
if (ind < 0) {
......@@ -247,6 +264,7 @@ export default {
},
// 删除选项
removeDomain(question) {
if (this.checkLock) return;
const index = this.form.questions.indexOf(question);
console.log(index);
// 如果是正确答案,就让正确答案清空
......@@ -333,9 +351,9 @@ export default {
reset() {
this.form = {
topicTitle: "",
questions: [{ value: "" }, { value: "" }, { value: "" }],
questions: [{ value: "" }, { value: "" }],
};
this.answerNum = null;
this.answerNum = [];
this.addValue = "";
},
},
......
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-12-27 09:30:19
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-12-28 10:29:18
* @LastEditTime: 2023-02-01 18:02:14
* @FilePath: /danger-manage-web/src/views/educationPlanExam/textPaper/components/ChangeQuestion.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -193,7 +193,7 @@ export default {
this.loading = false;
});
},
saveAndNext() {
save(num = 2) {
const topicInfos = this.list
.filter((item) => item.checked)
.map((item) => {
......@@ -202,18 +202,20 @@ export default {
quan: item.changeNum,
};
});
console.log(this.courseId, topicInfos);
const data = { courseId: this.courseId, topicInfos };
console.log(data);
bachAddTopic(data).then((res) => {
console.log(res);
if (res.code == 200) {
this.$parent.$parent.componentsNumChange(2);
this.$parent.$parent.componentsNumChange(num);
this.$parent.$parent.$parent.getList();
}
});
},
saveAndNext() {
this.save(3);
},
resetClick() {},
search() {
this.getList();
......
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-22 10:38:49
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-12-28 10:31:06
* @LastEditTime: 2023-02-01 17:34:25
* @FilePath: /danger-manage-web/src/views/lessonsProgram/components/addLesson.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -24,6 +24,7 @@
:is="currentComponent"
:courseId.sync="courseId"
:topicId.sync="topicId"
:checkLock="checkLock"
ref="current"
></component>
</transition>
......@@ -32,7 +33,7 @@
<QuestionList/> -->
</div>
<div slot="footer" class="dialog-footer">
<!-- <div slot="footer" class="dialog-footer">
<el-button
type="primary"
v-if="this.componentsNum == 2"
......@@ -62,6 +63,51 @@
>{{ "确认" }}</el-button
>
<el-button @click="dialogCancel">取消</el-button>
</div> -->
<div slot="footer" class="dialog-footer" v-if="!checkLock">
<el-button
type="primary"
v-if="this.componentsNum == 2 && !checkLock"
@click="componentsNumChange(4)"
>从题库选择</el-button
>
<el-button
type="primary"
v-if="this.componentsNum == 4 || this.componentsNum == 3"
@click="componentsNumChange(2)"
>返回题目列表</el-button
>
<el-button
type="primary"
v-if="
this.componentsNum == 1 ||
this.componentsNum == 3 ||
this.componentsNum == 4
"
@click="save"
>保存</el-button
>
<el-button type="primary" @click="saveAndNext" v-if="!checkLock">{{
saveNextText
}}</el-button>
<el-button
v-if="this.componentsNum == 2"
type="primary"
@click="dialogCancel"
>{{ "确认" }}</el-button
>
<el-button @click="dialogCancel">取消</el-button>
</div>
<div slot="footer" class="dialog-footer" v-else>
<el-button
type="primary"
v-if="this.componentsNum == 3 && checkLock"
@click="componentsNumChange(2)"
>返回题目列表</el-button
>
<el-button type="primary" @click="dialogCancel">{{ "确认" }}</el-button>
<el-button @click="dialogCancel">取消</el-button>
</div>
</el-dialog>
</template>
......@@ -86,6 +132,9 @@ export default {
courseId: {
type: Number,
},
checkLock: {
type: Boolean,
},
},
// components: {
// Lesson,
......@@ -137,11 +186,9 @@ export default {
text = "保存并录入题目";
} else if (this.componentsNum == 2) {
text = "录入考题";
} else if (this.componentsNum == 3) {
} else {
text = "保存并录入下一题";
} else {
text = "确定选择";
}
}
return text;
},
},
......@@ -168,6 +215,7 @@ export default {
this.topicId = null;
}
this.$emit("update:visible", false);
this.$emit("update:checkLock", false);
},
// 把ID改变了
changeCourseId(courseId) {
......
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-22 10:59:44
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-12-26 16:31:34
* @LastEditTime: 2023-02-01 16:58:26
* @FilePath: /danger-manage-web/src/views/lessonsProgram/components/Lession.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -16,7 +16,11 @@
:rules="rules"
>
<el-form-item label="考试标题" prop="courseName">
<el-input style="width: 700px" v-model="form.courseName"></el-input>
<el-input
:disabled="checkLock"
style="width: 700px"
v-model="form.courseName"
></el-input>
</el-form-item>
<div class="top flex">
<el-form-item label="开始时间" prop="testStartTime">
......@@ -27,6 +31,7 @@
type="datetime"
placeholder="选择日期时间"
default-time="00:00:00"
:disabled="checkLock"
/>
</el-form-item>
<el-form-item label="结束时间" prop="testEndTime">
......@@ -36,6 +41,7 @@
type="datetime"
placeholder="选择日期时间"
default-time="00:00:00"
:disabled="checkLock"
/>
</el-form-item>
</div>
......@@ -43,6 +49,7 @@
<ChangePapel
ref="changePaple"
:jsonSelectNameList="jsonSelectNameList"
:disabled="checkLock"
@getPeopleList="getPeopleList"
/>
</el-form-item>
......@@ -70,6 +77,9 @@ export default {
courseId: {
type: Number,
},
checkLock: {
type: Boolean,
},
},
components: {
// Editor,
......@@ -196,14 +206,17 @@ export default {
message: "保存课程成功",
type: "success",
});
this.$parent.$parent.dialogCancel();
} else if (num == 3) {
this.$message({
message: "保存课程成功,请开始录入题目",
type: "success",
});
this.$parent.$parent.componentsNumChange(num);
this.$parent.$parent.changeCourseId(courseId);
}
this.$parent.$parent.componentsNumChange(num);
this.$parent.$parent.changeCourseId(courseId);
// this.$parent.$parent.componentsNumChange(num);
// this.$parent.$parent.changeCourseId(courseId);
this.$parent.$parent.$parent.getList();
return true;
......
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-22 17:56:05
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2023-01-13 16:26:00
* @LastEditTime: 2023-02-01 17:45:09
* @FilePath: /danger-manage-web/src/views/lessonsProgram/components/QuestionList.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -34,13 +34,15 @@
>
</div>
<div class="detail-item">
判断提<span>{{ bottomFrom.judgmentScore }}</span>/题,共<span>{{ pds }}</span> 题,计<span
class="textC"
>{{ pds * bottomFrom.judgmentScore }}</span
判断提<span>{{ bottomFrom.judgmentScore }}</span
>/题,共<span>{{ pds }}</span> 题,计<span class="textC">{{
pds * bottomFrom.judgmentScore
}}</span
>
</div>
<div class="detail-item">
一共<span>{{ danxs + duoxs + pds }}</span>道题,总共计<span class="textC">{{
一共<span>{{ danxs + duoxs + pds }}</span
>道题,总共计<span class="textC">{{
danxs * bottomFrom.singleChoiceScore +
duoxs * bottomFrom.multipleChoiceScore +
pds * bottomFrom.judgmentScore
......@@ -70,12 +72,21 @@
<div class="right">
<div>
<el-button
v-if="!checkLock"
@click="edit(item.topicId)"
icon="el-icon-edit"
type="text"
>修改</el-button
>
<el-button
v-if="checkLock"
@click="edit(item.topicId)"
icon="el-icon-edit"
type="text"
>查看</el-button
>
<el-button
v-if="!checkLock"
@click="deleteLesson(item.topicId)"
icon="el-icon-delete"
type="text"
......@@ -106,6 +117,7 @@
v-model="bottomFrom.singleChoiceScore"
style="width: 50px"
size="mini"
:disabled="checkLock"
></el-input>
</div>
<div></div>
......@@ -117,6 +129,7 @@
v-model="bottomFrom.multipleChoiceScore"
style="width: 50px"
size="mini"
:disabled="checkLock"
></el-input>
</div>
<div></div>
......@@ -129,6 +142,7 @@
v-model="bottomFrom.judgmentScore"
style="width: 50px"
size="mini"
:disabled="checkLock"
></el-input>
</div>
<div></div>
......@@ -141,6 +155,7 @@
v-model="bottomFrom.qualifiedNum"
style="width: 60px"
size="mini"
:disabled="checkLock"
></el-input>
</div>
<div>为合格</div>
......@@ -151,6 +166,7 @@
icon="el-icon-check"
size="mini"
type="success"
:disabled="checkLock"
>保存</el-button
>
</div>
......@@ -171,6 +187,9 @@ export default {
courseId: {
type: Number,
},
checkLock: {
type: Boolean,
},
},
components: {},
data() {
......@@ -297,10 +316,10 @@ export default {
// }
if (
!(
this.bottomFrom.singleChoiceScore > 0 &&
this.bottomFrom.multipleChoiceScore > 0 &&
this.bottomFrom.judgmentScore > 0 &&
this.bottomFrom.qualifiedNum > 0
this.bottomFrom.singleChoiceScore >= 0 &&
this.bottomFrom.multipleChoiceScore >= 0 &&
this.bottomFrom.judgmentScore >= 0 &&
this.bottomFrom.qualifiedNum >= 0
)
) {
this.$message({
......
......@@ -82,15 +82,17 @@
prop="topicNum"
width="180"
>
<template v-slot="{ row: { topicNum, courseId } }">
<div class="timuNum">
<div v-if="topicNum > 0">{{ `已录入${topicNum}题` }}</div>
<div v-else>未录入</div>
</div>
<template v-slot="{ row: { topicNum, courseId, status } }">
<span class="timuNum" @click="checkQuestion(courseId, status)">
<span v-if="topicNum > 0">
{{ status == 0 ? `已录入${topicNum}题` : "查看" }}
</span>
<span v-else>未录入</span>
</span>
</template>
</el-table-column>
<el-table-column
label="答对几题算合格"
label="合格分数"
align="center"
prop="qualifiedNum"
:formatter="formatter"
......@@ -102,17 +104,15 @@
>
<template v-slot="{ row: { status, courseId, qualifiedNum } }">
<!-- <div>{{status}}</div> -->
<el-button
:disabled="status == 1"
<!-- <el-button
v-if="status == 0"
size="mini"
type="text"
icon="el-icon-edit"
@click="checkQuestion(courseId)"
>录入考题</el-button
>
> -->
<el-button
:disabled="status == 1"
v-if="status == 0"
size="mini"
type="text"
......@@ -120,6 +120,14 @@
@click="changeLesson(courseId)"
>编辑</el-button
>
<el-button
v-if="status == 1"
size="mini"
type="text"
icon="el-icon-edit"
@click="checkLesson(courseId)"
>详情</el-button
>
<el-button
size="mini"
type="text"
......@@ -128,13 +136,12 @@
>删除</el-button
>
<el-button
:disabled="status == 1"
v-if="status == 0"
size="mini"
type="text"
icon="el-icon-delete"
@click="issueLesson(courseId, qualifiedNum)"
>发布考试</el-button
@click="issueDilog(courseId)"
>发布</el-button
>
</template>
</el-table-column>
......@@ -151,16 +158,62 @@
ref="Dia"
:componentsNum.sync="componentsNum"
:courseId.sync="courseId"
:checkLock.sync="checkLock"
:visible.sync="dilogFlag"
/>
<el-dialog title="提示" :visible.sync="issue" width="30%">
<div>123</div>
<el-dialog title="发布详情" :visible.sync="issueVisible" width="60%">
<div class="detail flex">
<div class="detail-item">
单选题<span>{{ bottomFrom.singleChoiceScore }}</span
>/,<span>{{ danxs }}</span
>题,计<span class="textC">{{
danxs * bottomFrom.singleChoiceScore
}}</span
>
</div>
<div class="detail-item">
多选题<span>{{ bottomFrom.multipleChoiceScore }}</span
>/,<span>{{ duoxs }}</span> 题,计<span class="textC">{{
duoxs * bottomFrom.multipleChoiceScore
}}</span
>
</div>
<div class="detail-item">
判断提<span>{{ bottomFrom.judgmentScore }}</span
>/题,共<span>{{ pds }}</span> 题,计<span class="textC">{{
pds * bottomFrom.judgmentScore
}}</span
>
</div>
<div class="detail-item">
合格分数为<span class="textC">{{ bottomFrom.qualifiedNum }}</span
>
</div>
<div class="detail-item">
一共<span>{{ danxs + duoxs + pds }}</span
>道题,总共计<span class="textC">{{
danxs * bottomFrom.singleChoiceScore +
duoxs * bottomFrom.multipleChoiceScore +
pds * bottomFrom.judgmentScore
}}</span
>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="issueVisible = false"> </el-button>
<el-button type="primary" @click="issueLesson(issueCourseId)"
>确认发布</el-button
>
</span>
</el-dialog>
</div>
</template>
<script>
import {
getQuestion,
getLessons,
getLessonById,
issue,
......@@ -200,14 +253,36 @@ export default {
// 表单校验
dilogFlag: false,
// 发布
issueVisible: false,
bottomFrom: {
singleChoiceScore: 0,
multipleChoiceScore: 0,
judgmentScore: 0,
qualifiedNum: 0,
},
issueCourseId: null,
questionList: [],
componentsNum: 1,
// 点击的id,如果是新增为空
courseId: null,
issue: false,
// false为编辑,true为查看,查看不允许编辑的时候
checkLock: false,
};
},
computed: {
...mapGetters(["courseOptions"]),
danxs() {
return this.questionList.filter((item) => item.topicType === 1).length;
},
duoxs() {
return this.questionList.filter((item) => item.topicType === 2).length;
},
pds() {
return this.questionList.filter((item) => item.topicType === 3).length;
},
},
created() {
// this.getPlanList();
......@@ -257,12 +332,22 @@ export default {
},
/** 新增按钮操作 */
handleAdd() {
this.checkLock = false;
this.$refs.Dia.title = "新增考试试卷";
this.componentsNum = 1;
this.courseId = null;
this.dilogFlag = true;
},
changeLesson(courseId) {
this.checkLock = false;
this.$refs.Dia.title = "修改考试试卷";
this.componentsNum = 1;
this.courseId = courseId;
this.dilogFlag = true;
},
checkLesson(courseId) {
this.checkLock = true;
this.$refs.Dia.title = "修改考试试卷";
this.componentsNum = 1;
this.courseId = courseId;
......@@ -270,8 +355,12 @@ export default {
},
// 直接查看考题
checkQuestion(courseId) {
checkQuestion(courseId, status) {
// 要查看考题的id
if (status == 1) {
this.checkLock = true;
}
this.courseId = courseId;
console.log(this.courseId);
// 2代表列表组件
......@@ -315,8 +404,39 @@ export default {
.catch(() => {});
},
// 发布
issueLesson(courseId, qualifiedNum) {
this.$confirm("请确定发布", {
issueDilog(courseId) {
getQuestion({courseId})
.then((res) => {
console.log(res)
this.questionList = res.rows.map((item) => {
return {
topicType: item.topicType,
topicId: item.topicId,
topicTitle: item.topicTitle,
};
});
})
.then((res) => {
return getLessonById(courseId);
})
.then((res) => {
this.bottomFrom = {
singleChoiceScore: res.data.singleChoiceScore ||0,
multipleChoiceScore: res.data.multipleChoiceScore||0,
judgmentScore: res.data.judgmentScore||0,
qualifiedNum: res.data.qualifiedNum||0,
};
})
.then((res) => {
this.issueVisible = true;
this.issueCourseId = courseId;
});
//
},
issueLesson(courseId) {
this.$confirm("确定要发布吗", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
......@@ -326,14 +446,14 @@ export default {
return getLessonById(courseId);
})
.then((res) => {
if (
res.data.singleChoiceScore > 0 &&
res.data.multipleChoiceScore > 0 &&
res.data.judgmentScore > 0 &&
res.data.qualifiedNum > 0
) {
return true;
}
// if (
// res.data.singleChoiceScore > 0 &&
// res.data.multipleChoiceScore > 0 &&
// res.data.judgmentScore > 0 &&
// res.data.qualifiedNum > 0
// ) {
return true;
// }
})
.then((res) => {
if (res) {
......@@ -355,6 +475,7 @@ export default {
type: "success",
});
this.getList();
this.issueVisible = false;
}
})
.catch(() => {});
......@@ -373,7 +494,7 @@ export default {
}
.timuNum {
color: #1d84ff;
// cursor: pointer;
cursor: pointer;
}
::v-deep .el-select {
width: 100%;
......@@ -381,4 +502,17 @@ export default {
::v-deep .el-dialog {
margin-top: 15vh !important;
}
.detail {
// position: absolute;
// bottom: -20px;
// left: 10px;
.textC {
font-weight: 800;
font-size: 18px;
}
.detail-item {
margin-right: 20px;
color: red;
}
}
</style>
<!--
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-12-27 09:30:19
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2023-01-29 14:52:33
* @FilePath: /danger-manage-web/src/views/educationPlanExam/textPaper/components/ChangeQuestion.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="table-wrapper">
<el-form :model="queryParams" ref="queryForm" :inline="true">
<el-form-item label="所属单位" prop="deptId" ref="treeItem">
<Treeselect
class="tree"
v-model="queryParams.deptId"
:options="deptOptions"
:show-count="true"
placeholder="请选择归属部门"
style="width: 200px"
/>
</el-form-item>
<el-form-item label="题库名称" prop="bankName">
<el-input
v-model="queryParams.bankName"
placeholder="考试时间"
clearable
size="small"
/>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="search"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetClick"
>重置</el-button
>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="list" height="435" ref="multipleTable">
<!-- <el-table-column type="selection"></el-table-column> -->
<el-table-column label="" align="center" prop="profession">
<template v-slot="{ row }">
<!-- <div> -->
<el-checkbox
:disabled="row.numberQuestions == 0"
v-model="row.checked"
></el-checkbox>
<!-- </div> -->
</template>
</el-table-column>
<el-table-column label="题库名称" align="center" prop="bankName">
</el-table-column>
<el-table-column label="所属单位" align="center" prop="courseType">
<template v-slot="scope">
<div>
{{ selectList(deptOptions, scope.row.deptId) || "-" }}
</div>
</template>
</el-table-column>
<el-table-column
label="包含题目数量"
align="center"
prop="numberQuestions"
:formatter="formatter"
>
</el-table-column>
<el-table-column label="选取题目数量" align="center" prop="profession">
<template v-slot="{ row }">
<div>
<!-- <el-input
:disabled="!row.checked|| row.numberQuestions==0 "
v-model="row.changeNum"
size="mini"
style="width: 100px"
></el-input> -->
<el-input-number
v-model="row.changeNum"
:disabled="!row.checked || row.numberQuestions == 0"
size="mini"
:min="1"
:max="+row.numberQuestions ? +row.numberQuestions : 1000000"
label="描述文字"
></el-input-number>
</div>
</template>
</el-table-column>
</el-table>
<!-- <div> -->
<el-pagination
:layout="'prev, pager, next'"
v-show="total > 0"
:total="total"
:current-page="queryParams.pageNum"
:page-sizes="[queryParams.pageSize]"
@current-change="currentChangeClick"
/>
</div>
</template>
<script>
import { listBank, delBank } from "@/api/educationPlanExam/questionBank";
import { bachAddTopicGuest } from "@/api/educationPlanExam/lessonsProgram.js";
// 部门列表
import { treeselect } from "@/api/system/dept";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "",
components: {
Treeselect,
},
props: {
courseId: {
type: Number,
},
},
data() {
return {
queryParams: {
deptId: null,
courseName: "",
pageNum: 1,
pageSize: 10,
},
list: [
{
checked: false,
},
],
total: 20,
loading: false,
// 题库id
deptId: null,
// 归属部门列表
deptOptions: [],
};
},
created() {
this.getList();
this.getTreeselect();
},
methods: {
getTreeselect() {
treeselect().then((response) => {
this.deptOptions = response.data;
// console.log("123", this.deptOptions);
// console.log(this.selectList(this.deptOptions, 175));
});
},
// 递归查值的方法
selectList(list, id) {
for (let i = 0; i < list.length; i++) {
let item = list[i];
if (item.id == id) {
return item.label;
} else {
if (Array.isArray(item.children)) {
let a = this.selectList(item.children, id);
if (a) {
return a;
}
}
}
}
},
getList() {
this.loading = true;
listBank(this.queryParams)
.then((res) => {
console.log(res);
this.list = res.rows.map((item, index) => {
return {
bankNum:
index +
1 +
(this.queryParams.pageNum - 1) * this.queryParams.pageSize,
checked: false,
changeNum: 0,
...item,
};
});
this.total = res.total;
})
.finally(() => {
this.loading = false;
});
},
saveAndNext() {
const topicInfos = this.list
.filter((item) => item.checked)
.map((item) => {
return {
bankId: item.bankId,
quan: item.changeNum,
};
});
console.log(this.courseId, topicInfos);
const data = { courseId: this.courseId, topicInfos };
console.log(data);
bachAddTopicGuest(data).then((res) => {
console.log(res);
if (res.code == 200) {
// this.$parent.$parent.componentsNumChange(2);
this.$parent.$parent.getContractTopicList(this.courseId);
this.$parent.$parent.dialogVisible2=false;
}
});
},
resetClick() {},
search() {
this.getList();
},
currentChangeClick() {},
formatter(row, column, cellValue, index) {
// console.log(row, column, cellValue, index);
if (!cellValue) return "-";
else return cellValue;
},
},
};
</script>
<style lang="scss" scoped>
.table-wrapper {
padding-top: 22px;
width: 100%;
height: 550px;
overflow: hidden;
// padding-bottom: 10px;
margin-bottom: 20px;
}
</style>
<template>
<div class="form-wrapper">
<div style="width: 100%;height:100%;">
<el-form :model="contractTrainForm" :rules="rules" ref="contractTrainForm" label-width="100px" class="demo-ruleForm">
<el-form-item label="培训名称" prop="courseName">
<el-input v-model="contractTrainForm.courseName"></el-input>
</el-form-item>
<el-form-item label="培训内容" prop="courseConent">
<el-input type="textarea" v-model="contractTrainForm.courseConent" rows="5"></el-input>
</el-form-item>
<div class="flex">
<el-form-item label="视频上传" v-if="!readOnly" prop="video">
<FileUpload
listType="picture"
@resFun="getFileInfoVideo"
@remove="listRemoveVideo"
:fileArr="fileListVideo"
:fileSize="500"
:fileType="['mp4']"
/>
<el-input v-show="false" disabled v-model="contractTrainForm.video"></el-input>
</el-form-item>
<el-form-item label="附件上传" v-if="!readOnly" prop="enclosure">
<FileUpload
listType="picture"
@resFun="getFileInfoFile"
@remove="listRemoveFile"
:fileArr="fileListFile"
/>
<el-input v-show="false" disabled v-model="contractTrainForm.enclosure"></el-input>
</el-form-item>
</div>
</el-form>
<div class="form-wrapper">
<div style="width: 100%; height: 100%">
<el-form
:model="contractTrainForm"
:rules="rules"
ref="contractTrainForm"
label-width="100px"
class="demo-ruleForm"
>
<el-form-item label="培训名称" prop="courseName">
<el-input v-model="contractTrainForm.courseName"></el-input>
</el-form-item>
<el-form-item label="培训内容" prop="courseConent">
<el-input
type="textarea"
v-model="contractTrainForm.courseConent"
rows="5"
></el-input>
</el-form-item>
<div class="flex">
<el-form-item label="视频上传" v-if="!readOnly" prop="video">
<FileUpload
listType="picture"
@resFun="getFileInfoVideo"
@remove="listRemoveVideo"
:fileArr="fileListVideo"
:fileSize="500"
:fileType="['mp4']"
/>
<el-input
v-show="false"
disabled
v-model="contractTrainForm.video"
></el-input>
</el-form-item>
<el-form-item label="附件上传" v-if="!readOnly" prop="enclosure">
<FileUpload
listType="picture"
@resFun="getFileInfoFile"
@remove="listRemoveFile"
:fileArr="fileListFile"
/>
<el-input
v-show="false"
disabled
v-model="contractTrainForm.enclosure"
></el-input>
</el-form-item>
</div>
<visitorQuestion ref="visitorQuestion"></visitorQuestion>
</el-form>
</div>
<visitorQuestion ref="visitorQuestion"></visitorQuestion>
</div>
</template>
<script>
import FileUpload from "@/components/FileUpload";
import uploadfile from "@/assets/uploadfile.png";
import visitorQuestion from "@/views/educationPlanExam/visitorProgram/visitorQuestion";
import {listCourse} from "@/api/contractTrain/contractTrain";
export default {
data() {
return {
contractTrainForm: {
courseName: '',
courseConent: '',
video: "",
enclosure: "",
},
fileListVideo: [],
fileListFile: [],
readOnly: false,
rules: {
name: [
{ required: true, message: '请输入培训名称', trigger: 'blur' }
],
region: [
{ required: true, message: '请输入培训内容', trigger: 'change' }
],
video: [
{ required: true, trigger: "blue", message: "视频不能为空" }
],
enclosure: [
{ required: true, trigger: "blur", message: "附件不能为空" },
],
import FileUpload from "@/components/FileUpload";
import uploadfile from "@/assets/uploadfile.png";
import visitorQuestion from "@/views/educationPlanExam/visitorProgram/visitorQuestion";
import { listCourse } from "@/api/contractTrain/contractTrain";
export default {
data() {
return {
contractTrainForm: {
courseName: "",
courseConent: "",
video: "",
enclosure: "",
},
fileListVideo: [],
fileListFile: [],
readOnly: false,
rules: {
name: [{ required: true, message: "请输入培训名称", trigger: "blur" }],
region: [
{ required: true, message: "请输入培训内容", trigger: "change" },
],
video: [{ required: true, trigger: "blue", message: "视频不能为空" }],
enclosure: [
{ required: true, trigger: "blur", message: "附件不能为空" },
],
},
};
},
components: {
FileUpload,
visitorQuestion,
},
created() {
this.getContractTrainList();
},
methods: {
getContractTrainList() {
listCourse().then((res) => {
this.contractTrainForm = res.rows[0];
console.log("this.contractTrainForm", this.contractTrainForm);
if (this.contractTrainForm.video) {
this.fileListVideo = [
{
name: this.contractTrainForm.courseName + "视频",
url: uploadfile,
},
];
}
if (this.contractTrainForm.enclosure) {
this.fileListFile = [
{
name: this.contractTrainForm.courseName + "附件",
url: uploadfile,
},
];
}
// this.$refs.visitorQuestion.rightNum =
// this.contractTrainForm.qualifiedNum;
this.$refs.visitorQuestion.bottomFrom = {
judgmentScore: this.contractTrainForm.judgmentScore || 0,
multipleChoiceScore: this.contractTrainForm.multipleChoiceScore || 0,
qualifiedNum: this.contractTrainForm.qualifiedNum || 0,
singleChoiceScore: this.contractTrainForm.singleChoiceScore || 0,
};
this.$refs.visitorQuestion.getContractTopicList(
this.contractTrainForm.contractorCourseId
);
});
},
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
alert("submit!");
} else {
console.log("error submit!!");
return false;
}
});
},
getFileInfoVideo(res) {
this.contractTrainForm.video = res.url;
this.fileListVideo = [
{
name: res.fileName,
url: uploadfile,
},
};
];
},
components: {
FileUpload,
visitorQuestion,
listRemoveVideo(e) {
this.fileListVideo = [];
this.contractTrainForm.video = "";
// this.form.videoName = null;
},
created() {
this.getContractTrainList();
getFileInfoFile(res) {
this.contractTrainForm.enclosure = res.url;
this.fileListFile = [
{
name: res.fileName,
url: uploadfile,
},
];
},
methods: {
getContractTrainList(){
listCourse().then(res =>{
this.contractTrainForm = res.rows[0];
if(this.contractTrainForm.video){
this.fileListVideo = [
{
name: this.contractTrainForm.courseName + "视频",
url: uploadfile,
},
];
}
if(this.contractTrainForm.enclosure){
this.fileListFile = [
{
name: this.contractTrainForm.courseName + "附件",
url: uploadfile,
},
];
}
this.$refs.visitorQuestion.rightNum = this.contractTrainForm.qualifiedNum;
this.$refs.visitorQuestion.getContractTopicList(this.contractTrainForm.contractorCourseId)
})
},
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
alert('submit!');
} else {
console.log('error submit!!');
return false;
}
});
},
getFileInfoVideo(res) {
this.contractTrainForm.video = res.url;
this.fileListVideo = [
{
name: res.fileName,
url: uploadfile,
},
];
},
listRemoveVideo(e) {
this.fileListVideo = [];
this.contractTrainForm.video = "";
// this.form.videoName = null;
},
getFileInfoFile(res) {
this.contractTrainForm.enclosure = res.url;
this.fileListFile = [
{
name: res.fileName,
url: uploadfile,
},
];
},
listRemoveFile(e) {
this.fileListFild = [];
this.contractTrainForm.enclosure = "";
// this.form.fileName = null;
},
}
}
listRemoveFile(e) {
this.fileListFild = [];
this.contractTrainForm.enclosure = "";
// this.form.fileName = null;
},
},
};
</script>
<style lang="scss" scoped>
.form-wrapper {
......@@ -148,7 +174,7 @@
height: 100%;
margin-bottom: 20px;
}
.flex{
.flex {
width: 100%;
justify-content: space-around;
padding: 20px 30px;
......
<template>
<div ref="myBody" class="add-question flex">
<div class="text flex">
<div class="left">
目前录入题目是第<span>{{ questionNextNum }}</span
>道题
</div>
<div ref="myBody" class="add-question flex">
<div class="text flex">
<div class="left">
目前录入题目是第<span>{{ questionNextNum }}</span
>道题
</div>
<div>
<el-radio-group
v-model="form.topicType"
size="mini"
@input="topicTypeChange"
>
<el-radio-button :label="1">单选</el-radio-button>
<el-radio-button :label="2">多选</el-radio-button>
<el-radio-button :label="3">判断</el-radio-button>
</el-radio-group>
</div>
<el-form class="form flex" ref="form" :model="form" label-width="auto">
<!-- <div class="top flex"> -->
<div>
<el-form-item
label="题目"
prop="topicTitle"
:rules="{
required: true,
message: '必须输入题目内容',
trigger: 'blur',
}"
</div>
<el-form class="form flex" ref="form" :model="form" label-width="auto">
<!-- <div class="top flex"> -->
<div>
<el-form-item
label="题目"
prop="topicTitle"
:rules="{
required: true,
message: '必须输入题目内容',
trigger: 'blur',
}"
>
<el-input
type="textarea"
placeholder="多行输入"
resize="none"
rows="4"
v-model="form.topicTitle"
>
</el-input>
</el-form-item>
</div>
<div class="bottom">
<!-- <el-form-item label="选项1" prop="title">
<el-input v-model="form.title" placeholder="请输入"></el-input>
</el-form-item> -->
<el-form-item
v-for="(question, index) in form.questions"
:label="'选项' + (index + 1)"
:key="question.key"
:prop="'questions.' + index + '.value'"
:rules="{
required: true,
message: '第一项不能为空不能为空',
trigger: 'blur',
}"
>
<div class="add-select flex">
<el-input
type="textarea"
placeholder="多行输入"
style="flex: 1; margin-right: 10px"
rows="2"
v-model="question.value"
></el-input>
<div class="flex algin-items">
<el-button
@click="rightAnswerClick(index)"
class="right"
:class="{
active: answerNum.indexOf(index) >= 0,
}"
icon="el-icon-check"
>
设为答案
</el-button>
<el-button
size="mini"
type="danger"
v-if="index > 0 && form.topicType != 3"
@click.prevent="removeDomain(question)"
plain
icon="el-icon-delete"
>删除</el-button
>
</div>
</div>
</el-form-item>
<!-- <el-form-item
class="noAttr"
:label="`选项${form.questions.length + 1}`"
prop=""
>
<div class="add-select flex">
<el-input
type="textarea"
placeholder="多行输入"
resize="none"
rows="4"
v-model="form.topicTitle"
rows="2"
v-model="addValue"
style="flex: 1; margin-right: 10px"
>
</el-input>
</el-form-item>
</div>
<div class="bottom">
<!-- <el-form-item label="选项1" prop="title">
<el-input v-model="form.title" placeholder="请输入"></el-input>
</el-form-item> -->
<el-form-item
v-for="(question, index) in form.questions"
:label="'选项' + (index + 1)"
:key="question.key"
:prop="'questions.' + index + '.value'"
:rules="
index === 0
? {
required: true,
message: '第一项不能为空不能为空',
trigger: 'blur',
}
: {}
"
>
<div class="add-select flex">
<el-input
type="textarea"
placeholder="多行输入"
style="flex: 1; margin-right: 10px"
rows="2"
v-model="question.value"
></el-input>
<div class="flex algin-items">
<el-button
@click="rightAnswerClick(index)"
class="right"
:class="{ active: answerNum === index }"
icon="el-icon-check"
>
设为答案
</el-button>
<el-button
size="mini"
type="danger"
v-if="index > 0"
@click.prevent="removeDomain(question)"
plain
icon="el-icon-delete"
>删除</el-button
>
</div>
</div>
</el-form-item>
<el-form-item
class="noAttr"
:label="`选项${form.questions.length + 1}`"
prop=""
>
<div class="add-select flex">
<el-input
type="textarea"
placeholder="多行输入"
resize="none"
rows="2"
v-model="addValue"
style="flex: 1; margin-right: 10px"
<div class="flex algin-items">
<el-button
@click="rightAnswerClick(form.questions.length)"
class="right"
:class="{ active: answerNum === form.questions.length }"
icon="el-icon-check"
>
</el-input>
<div class="flex algin-items">
<el-button
@click="rightAnswerClick(form.questions.length)"
class="right"
:class="{ active: answerNum === form.questions.length }"
icon="el-icon-check"
>
设为答案
</el-button>
设为答案
</el-button>
<el-button
size="mini"
class="right1"
@click.prevent="add(addValue)"
icon="el-icon-plus"
>新增</el-button
>
</div>
<el-button
size="mini"
class="right1"
@click.prevent="add(addValue)"
icon="el-icon-plus"
>新增</el-button
>
</div>
</el-form-item>
</div>
</el-form-item> -->
<div style="padding-left: 55px" v-if="form.topicType != 3">
<el-button
size="mini"
style="background: #0bab0c; color: #fff; border: 1px solid #0bab0c"
@click.prevent="add(addValue)"
>新增选项</el-button
>
</div>
</el-form>
</div>
</template>
</div>
</el-form>
</div>
</template>
<script>
export default {
name: "AnswerLesson",
data() {
return {
form: {
topicTitle: "",
questions: [{ value: "" }, { value: "" }, { value: "" }],
},
answerNum: null,
addValue: "",
// 录入的是第几道题
questionNextNum: 1,
courseName: "",
};
},
created() {
export default {
name: "AnswerLesson",
data() {
return {
form: {
topicType: 1,
topicTitle: "",
questions: [{ value: "" }, { value: "" }],
},
answerNum: [],
addValue: "",
// 录入的是第几道题
questionNextNum: 1,
courseName: "",
};
},
created() {},
methods: {
topicTypeChange(num) {
if (num == 1) {
this.answerNum = [];
} else if (num == 2) {
this.answerNum = [];
// this.form.questions=[{ value: "" }, { value: "" }];
} else {
this.answerNum = [];
const form = {
topicType: 3,
topicTitle: this.form.topicTitle,
questions: [{ value: "对" }, { value: "错" }],
};
this.form = form;
}
},
methods: {
//设置正确答案
rightAnswerClick(index) {
this.answerNum = index;
},
// 删除选项
removeDomain(question) {
const index = this.form.questions.indexOf(question);
// 如果是正确答案,就让正确答案清空
if (this.answerNum === index) {
this.answerNum = null;
}
if (index >= 0) {
this.form.questions.splice(index, 1);
//设置正确答案
// rightAnswerClick(index) {
// this.answerNum = index;
// },
rightAnswerClick(index) {
if (this.form.topicType === 2) {
const ind = this.answerNum.indexOf(index);
if (ind < 0) {
this.answerNum.push(index);
} else {
this.answerNum.splice(ind, 1);
}
},
// 新增选项
add(addValue) {
this.form.questions.push({ value: addValue });
},
reset() {
this.form = {
topicTitle: "",
questions: [{ value: "" }, { value: "" }, { value: "" }],
};
this.answerNum = null;
this.addValue = "";
},
this.answerNum = this.answerNum.sort((a, b) => {
return a - b;
});
console.log(this.answerNum);
} else {
// 判断跟单选模式差不多
this.answerNum = [index];
}
},
};
</script>
// 删除选项
// removeDomain(question) {
// const index = this.form.questions.indexOf(question);
// // 如果是正确答案,就让正确答案清空
// if (this.answerNum === index) {
// this.answerNum = null;
// }
// if (index >= 0) {
// this.form.questions.splice(index, 1);
// }
// },
removeDomain(question) {
const index = this.form.questions.indexOf(question);
console.log(index);
// 如果是正确答案,就让正确答案清空
const ind = this.answerNum.indexOf(index);
if (ind >= 0) {
this.answerNum.splice(ind, 1);
}
// 如果是最后一位呗删除,那不用管,如果不是最后一位置,这一位删除之后,则这一位后面的所有数字都要-1;
if (index != this.form.questions.length - 1) {
this.answerNum = this.answerNum.map((item, i) => {
if (item >= index) {
return item - 1;
} else {
return item;
}
});
}
if (index >= 0) {
this.form.questions.splice(index, 1);
}
console.log(this.answerNum);
// console.log(this.form.questions)
},
// 新增选项
add(addValue) {
this.form.questions.push({ value: addValue });
},
reset() {
this.form = {
topicTitle: "",
questions: [{ value: "" }, { value: "" }],
};
this.answerNum = null;
this.addValue = "";
},
},
};
</script>
<style lang="scss" scoped>
.add-question {
width: 100%;
height: 250px;
// overflow: hidden;
.add-question {
width: 100%;
height: 250px;
// overflow: hidden;
flex-direction: column;
padding-bottom: 7px;
margin-bottom: 20px;
border-bottom: 1px solid #bbbbbb;
justify-content: space-between;
.form {
flex: 1;
flex-direction: column;
padding-bottom: 7px;
margin-bottom: 20px;
border-bottom: 1px solid #bbbbbb;
justify-content: space-between;
.form {
flex: 1;
flex-direction: column;
height: 100%;
.bottom {
overflow-y: auto;
height: 330px;
box-sizing: border-box;
height: 100%;
.bottom {
overflow-y: auto;
height: 330px;
box-sizing: border-box;
.algin-items {
align-items: center;
width: 200px;
.algin-items {
align-items: center;
width: 200px;
}
.right {
display: inline-block;
width: 133px;
margin-right: 10px;
line-height: initial;
padding: 4px 0;
border: 1px solid #0bab0c;
color: #0bab0c;
font-size: 12px;
text-align: center;
border-radius: 4px;
box-sizing: border-box;
cursor: pointer;
&.active {
background-color: #0bab0c;
color: #ffffff;
}
.right {
display: inline-block;
width: 133px;
margin-right: 10px;
line-height: initial;
padding: 4px 0;
border: 1px solid #0bab0c;
color: #0bab0c;
font-size: 12px;
text-align: center;
border-radius: 4px;
box-sizing: border-box;
cursor: pointer;
&.active {
background-color: #0bab0c;
color: #ffffff;
}
&:hover {
background-color: rgba(11, 171, 12, 0.5);
color: #ffffff;
}
&:hover {
background-color: rgba(11, 171, 12, 0.5);
color: #ffffff;
}
.right1 {
display: inline-block;
margin-right: 10px;
line-height: initial;
width: 90px;
border: 1px solid #0bab0c;
color: #0bab0c;
font-size: 12px;
padding: 4px 0;
text-align: center;
border-radius: 4px;
box-sizing: border-box;
cursor: pointer;
&.active {
background-color: #0bab0c;
color: #ffffff;
}
&:hover {
background-color: rgba(11, 171, 12, 0.5);
color: #ffffff;
}
}
.right1 {
display: inline-block;
margin-right: 10px;
line-height: initial;
width: 90px;
border: 1px solid #0bab0c;
color: #0bab0c;
font-size: 12px;
padding: 4px 0;
text-align: center;
border-radius: 4px;
box-sizing: border-box;
cursor: pointer;
&.active {
background-color: #0bab0c;
color: #ffffff;
}
&:hover {
background-color: rgba(11, 171, 12, 0.5);
color: #ffffff;
}
}
}
.text {
margin-top: 13px;
margin-bottom: 34px;
justify-content: space-between;
height: 28px;
.left {
line-height: 28px;
color: #101010;
font-size: 14px;
}
.right {
width: 411px;
line-height: 28px;
background: #1d84ff;
padding-right: 5px;
color: #fff;
text-align: right;
}
}
.text {
margin-top: 13px;
margin-bottom: 34px;
justify-content: space-between;
height: 28px;
.left {
line-height: 28px;
color: #101010;
font-size: 14px;
}
.right {
width: 411px;
line-height: 28px;
background: #1d84ff;
padding-right: 5px;
color: #fff;
text-align: right;
}
}
</style>
}
</style>
......@@ -2,330 +2,564 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-22 17:56:05
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-09-28 17:54:16
* @LastEditTime: 2023-01-31 14:06:08
* @FilePath: /danger-manage-web/src/views/lessonsProgram/components/QuestionList.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div ref="myBody" class="add-question flex">
<div style="color: #1890ff;">题目管理</div>
<div class="text flex">
<div class="left">
<el-button type="primary" plain @click="enterContractTrainTopic">录入考题</el-button>
目前有<span>{{questionNum}}</span>道题
<span class="warn">温馨提示:发布课程前需要进行考试设置</span>
</div>
<!-- <div class="right">{{courseName}}</div> -->
<div ref="myBody" class="add-question flex">
<div style="color: #1890ff">题目管理</div>
<div class="text flex">
<div class="left">
<el-button type="primary" plain @click="enterContractTrainTopic"
>录入考题</el-button
>
<el-button type="primary" plain @click="changeQuestionClick"
>题库选题</el-button
>
目前有<span>{{ questionNum }}</span
>道题
<span class="warn">温馨提示:发布课程前需要进行考试设置</span>
</div>
<!-- <div class="right">{{courseName}}</div> -->
</div>
<div class="detail flex">
<div class="detail-item">
单选题<span>{{ bottomFrom.singleChoiceScore }}</span
>分/题,共<span>{{ danxs }}</span
>题,计<span class="textC">{{
danxs * bottomFrom.singleChoiceScore
}}</span
>
</div>
<div class="detail-item">
多选题<span>{{ bottomFrom.multipleChoiceScore }}</span
>分/题,共<span>{{ duoxs }}</span> 题,计<span class="textC">{{
duoxs * bottomFrom.multipleChoiceScore
}}</span
>
</div>
<div class="detail-item">
判断提<span>{{ bottomFrom.judgmentScore }}</span
>/题,共<span>{{ pds }}</span> 题,计<span class="textC">{{
pds * bottomFrom.judgmentScore
}}</span
>
</div>
<div class="detail-item">
一共<span>{{ danxs + duoxs + pds }}</span
>道题,总共计<span class="textC">{{
danxs * bottomFrom.singleChoiceScore +
duoxs * bottomFrom.multipleChoiceScore +
pds * bottomFrom.judgmentScore
}}</span
>
</div>
</div>
<!-- 试题列表 -->
<div class="table flex">
<div class="th flex">
<div class="left">序号</div>
<div class="middle">题目名称</div>
<div class="right">操作</div>
</div>
<div class="td-wrapper">
<div
v-for="(item, index) in questionList"
:key="item.topicId"
class="td flex"
>
<div class="left">{{ index + 1 }}</div>
<div class="middle zzz">
{{ item.topicTitle }}
</div>
<div class="right">
<div>
<el-button
@click="editContractTrainTopic(item.topicId,index + 1)"
icon="el-icon-edit"
type="text"
<!-- 试题列表 -->
<div class="table flex">
<div class="th flex">
<div class="left">序号</div>
<div class="type">题目类型</div>
<div class="middle">题目名称</div>
<div class="right">操作</div>
</div>
<div class="td-wrapper">
<div
v-for="(item, index) in questionList"
:key="item.topicId"
class="td flex"
>
<div class="left">{{ index + 1 }}</div>
<div class="type">{{ topicTypeArr[item.topicType] }}</div>
<div class="middle zzz">
{{ item.topicTitle }}
</div>
<div class="right">
<div>
<el-button
@click="editContractTrainTopic(item.topicId, index + 1)"
icon="el-icon-edit"
type="text"
>修改</el-button
>
<el-button
@click="deleteContractTrainTopic(item.topicId)"
icon="el-icon-delete"
type="text"
>
<el-button
@click="deleteContractTrainTopic(item.topicId)"
icon="el-icon-delete"
type="text"
>删除</el-button
>
</div>
>
</div>
</div>
</div>
</div>
</div>
<!-- 底部 -->
<div class="d3">
<div class="rightNum flex">
<div class="left">考试设置</div>
<div class="middle flex">
<div class="left-text">答对题目大于</div>
<div>
<el-input
v-model="rightNum"
style="width: 60px"
size="mini"
></el-input>
</div>
<div>为合格</div>
</div>
<div class="right">
<el-button
@click="saveRightNum"
icon="el-icon-check"
<!-- 底部 -->
<div class="d3">
<!-- <div class="rightNum flex">
<div class="left">考试设置</div>
<div class="middle flex">
<div class="left-text">答对题目大于</div>
<div>
<el-input
v-model="rightNum"
style="width: 60px"
size="mini"
type="success"
>保存</el-button
>
></el-input>
</div>
<div>为合格</div>
</div>
<div slot="footer" class="dialog-footer">
<div class="right">
<el-button
type="primary"
@click="saveContractTrian"
>{{ "确认" }}</el-button
@click="saveRightNum"
icon="el-icon-check"
size="mini"
type="success"
>保存</el-button
>
<el-button>取消</el-button>
</div>
</div>
</div> -->
<div class="rightNum flex">
<div class="left">考试设置</div>
<el-dialog
title="录入题目"
:visible.sync="dialogVisible"
>
<visitorAdd ref="visitorAdd" :key="next"/>
<span slot="footer" class="dialog-footer">
<div slot="footer" class="dialog-footer">
<el-button
type="primary"
@click="save"
>保存</el-button
>
<el-button type="primary" @click="saveAndNext">保存并录入下一题</el-button>
<el-button @click="dialogVisible = false">取消</el-button>
<div class="middle flex">
<div class="left-text">单选一题</div>
<div>
<el-input
v-model="bottomFrom.singleChoiceScore"
style="width: 50px"
size="mini"
></el-input>
</div>
<div></div>
</div>
<div class="middle flex">
<div class="left-text">多选一题</div>
<div>
<el-input
v-model="bottomFrom.multipleChoiceScore"
style="width: 50px"
size="mini"
></el-input>
</div>
</span>
</el-dialog>
<div></div>
</div>
<div class="middle flex">
<div class="left-text">判断一题</div>
<div>
<el-input
v-model="bottomFrom.judgmentScore"
style="width: 50px"
size="mini"
></el-input>
</div>
<div></div>
</div>
<div class="middle flex">
<div class="left-text">总分大于</div>
<div>
<el-input
v-model="bottomFrom.qualifiedNum"
style="width: 60px"
size="mini"
></el-input>
</div>
<div>为合格</div>
</div>
<div class="right">
<el-button
@click="saveRightNum"
icon="el-icon-check"
size="mini"
type="success"
>保存</el-button
>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="saveContractTrian">{{
"确认"
}}</el-button>
<el-button>取消</el-button>
</div>
</div>
</template>
<el-dialog title="录入题目" :visible.sync="dialogVisible">
<visitorAdd ref="visitorAdd" :key="next" />
<span slot="footer" class="dialog-footer">
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="save">保存</el-button>
<el-button type="primary" @click="saveAndNext"
>保存并录入下一题</el-button
>
<el-button @click="dialogVisible = false">取消</el-button>
</div>
</span>
</el-dialog>
<!-- 从题库选择 -->
<el-dialog :visible.sync="dialogVisible2">
<ChangeQuestion ref="current" :courseId="courseId" />
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="currentSave">保存</el-button>
<el-button type="primary" @click="dialogVisible2 = false"
>取消</el-button
>
</div>
</el-dialog>
</div>
</template>
<script>
import visitorAdd from "@/views/educationPlanExam/visitorProgram/visitorAdd";
import {updateCourse} from "@/api/contractTrain/contractTrain";
import { addTopic,listTopic,getTopic,delTopic,updateTopic } from "@/api/contractTrain/contractTrainTopic";
export default {
name: "AnswerLesson",
props: {
visible: {
type: Boolean,
default: false,
import visitorAdd from "@/views/educationPlanExam/visitorProgram/visitorAdd";
import ChangeQuestion from "@/views/educationPlanExam/visitorProgram/ChangeQuestion";
import { updateCourse } from "@/api/contractTrain/contractTrain";
import {
addTopic,
listTopic,
getTopic,
delTopic,
updateTopic,
} from "@/api/contractTrain/contractTrainTopic";
export default {
name: "AnswerLesson",
props: {
visible: {
type: Boolean,
default: false,
},
},
components: {
visitorAdd,
ChangeQuestion,
},
data() {
return {
dialogVisible: false,
dialogVisible2: false,
rightNum: 0,
next: 0,
questionList: [],
questionNum: null,
courseId: "",
topicTypeArr: {
1: "单选题",
2: "多选题",
3: "判断题",
},
bottomFrom: {
singleChoiceScore: 0,
multipleChoiceScore: 0,
judgmentScore: 0,
qualifiedNum: 0,
},
};
},
computed: {
danxs() {
// return 1;
return this.questionList.filter((item) => item.topicType === 1).length;
},
components: {
visitorAdd,
duoxs() {
// return 1;
return this.questionList.filter((item) => item.topicType === 2).length;
},
data() {
return {
dialogVisible: false,
rightNum: 0,
next: 0,
questionList: [],
questionNum: null,
courseId: ""
};
pds() {
// return 1;
return this.questionList.filter((item) => item.topicType === 3).length;
},
methods: {
//获取考题列表
getContractTopicList(contractorCourseId){
this.courseId = contractorCourseId;
listTopic({contractorCourseId:contractorCourseId}).then(res =>{
this.questionList = res.rows.map((item) => {
return {
topicId: item.topicId,
topicTitle: item.topicTitle,
};
},
methods: {
//获取考题列表
getContractTopicList(contractorCourseId) {
this.courseId = contractorCourseId;
listTopic({ contractorCourseId: contractorCourseId }).then((res) => {
console.log(res.rows);
this.questionList = res.rows.map((item) => {
return {
topicType: item.topicType,
topicId: item.topicId,
topicTitle: item.topicTitle,
};
});
this.questionNum = res.total;
});
},
//录入考题
enterContractTrainTopic() {
this.dialogVisible = true;
this.next++;
this.$nextTick(() => {
this.$refs.visitorAdd.questionNextNum = this.questionNum + 1;
});
},
changeQuestionClick() {
this.dialogVisible2 = true;
},
currentSave() {
this.$refs.current.saveAndNext();
},
//保存试题
save(next) {
new Promise((resove) => {
if (
!this.$refs.visitorAdd.answerNum &&
this.$refs.visitorAdd.answerNum !== 0
) {
this.$message({
message: "警告,请设置一个正确答案",
type: "warning",
});
this.questionNum = res.total;
})
},
//录入考题
enterContractTrainTopic(){
this.dialogVisible = true;
this.next++;
this.$nextTick(() => {
this.$refs.visitorAdd.questionNextNum = this.questionNum + 1;
})
},
//保存试题
save(next) {
new Promise((resove) => {
if (!this.$refs.visitorAdd.answerNum && this.$refs.visitorAdd.answerNum !== 0) {
this.$message({
message: "警告,请设置一个正确答案",
type: "warning",
return resove(false);
}
this.$refs.visitorAdd.$refs.form.validate((valid) => {
if (valid) {
const data = {};
data.contractorCourseId = this.courseId;
data.topicTitle = this.$refs.visitorAdd.form.topicTitle;
data.topicOption = JSON.stringify(
this.$refs.visitorAdd.form.questions
);
// data.answer = this.$refs.visitorAdd.answerNum;
data.answer = JSON.stringify(this.$refs.visitorAdd.answerNum);
data.topicType = this.$refs.visitorAdd.form.topicType;
// console.log()
console.log(data);
this.addContractTrainTopic(data).then((res) => {
if (res.code == 200) {
// 把修改的这个归位,变成正常添加
this.$emit("update:topicId", null);
this.$message({
message: "添加题目成功",
type: "success",
});
if (next != 1) {
this.dialogVisible = false;
this.getContractTopicList(this.courseId);
} else {
this.next++;
}
resove(true);
}
});
return resove(false);
}
this.$refs.visitorAdd.$refs.form.validate((valid) => {
if (valid) {
const data = {};
data.contractorCourseId = this.courseId;
data.topicTitle = this.$refs.visitorAdd.form.topicTitle;
data.topicOption = JSON.stringify(this.$refs.visitorAdd.form.questions);
data.answer = this.$refs.visitorAdd.answerNum;
this.addContractTrainTopic(data).then((res) => {
if (res.code == 200) {
// 把修改的这个归位,变成正常添加
this.$emit("update:topicId", null);
this.$message({
message: "添加题目成功",
type: "success",
});
if(next != 1){
this.dialogVisible = false;
this.getContractTopicList(this.courseId)
}else{
this.next++;
}
resove(true);
}
});
}
});
});
},
//保存并录入下一题
saveAndNext() {
this.save(1);
},
//新增试题
addContractTrainTopic(data){
if (this.$refs.visitorAdd.form.topicId) {
return updateTopic({ topicId: this.$refs.visitorAdd.form.topicId, ...data });
} else {
return addTopic({ contractorCourseId: this.courseId, ...data });
}
},
//试题修改
editContractTrainTopic(topicId,index){
this.dialogVisible = true;
getTopic(topicId).then(res =>{
const data = res.data;
this.$refs.visitorAdd.form = {
topicId: data.topicId,
topicTitle: data.topicTitle,
questions: JSON.parse(data.topicOption),
};
this.$refs.visitorAdd.answerNum = data.answer;
})
this.$nextTick(() => {
this.$refs.visitorAdd.questionNextNum = index;
})
},
//试题删除
deleteContractTrainTopic(topicId){
this.$confirm("请确定删除该题", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
});
},
//保存并录入下一题
saveAndNext() {
this.save(1);
},
//新增试题
addContractTrainTopic(data) {
if (this.$refs.visitorAdd.form.topicId) {
return updateTopic({
topicId: this.$refs.visitorAdd.form.topicId,
...data,
});
} else {
return addTopic({ contractorCourseId: this.courseId, ...data });
}
},
//试题修改
editContractTrainTopic(topicId, index) {
this.dialogVisible = true;
getTopic(topicId).then((res) => {
const data = res.data;
this.$refs.visitorAdd.form = {
topicId: data.topicId,
topicTitle: data.topicTitle,
topicType: data.topicType,
questions: JSON.parse(data.topicOption),
};
console.log(data);
this.$refs.visitorAdd.answerNum = data.answer;
});
this.$nextTick(() => {
this.$refs.visitorAdd.questionNextNum = index;
});
},
//试题删除
deleteContractTrainTopic(topicId) {
this.$confirm("请确定删除该题", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
return delTopic(topicId);
}).then((res) => {
if (res.code == 200) {
})
.then((res) => {
if (res.code == 200) {
this.$message({
message: "删除成功",
type: "success",
});
}
return this.getContractTopicList(this.courseId);
})
},
saveRightNum() {
if (this.rightNum > this.questionList.length) {
});
},
saveRightNum() {
// if (this.rightNum > this.questionList.length) {
// this.$message({
// message: "答对题目数应小于等于考试题目总数",
// type: "warning",
// });
// return;
// }
if (
!(
this.bottomFrom.singleChoiceScore >= 0 &&
this.bottomFrom.multipleChoiceScore >= 0 &&
this.bottomFrom.judgmentScore >= 0 &&
this.bottomFrom.qualifiedNum >= 0
)
) {
this.$message({
message: "请将分数填写完整",
type: "warning",
});
return;
}
console.log(this.bottomFrom);
// const bottomFrom = this.bottomFrom.map(item=>{
// return {
// singleChoiceScore:+item.singleChoiceScore,
// multipleChoiceScore:+item.multipleChoiceScore,
// judgmentScore:+item.judgmentScore,
// qualifiedNum:+item.qualifiedNum,
// }
// })
updateCourse({
contractorCourseId: this.courseId,
...this.bottomFrom,
}).then((res) => {
if (res.code == 200) {
this.$message({
message: "答对题目数应小于等于考试题目总数",
type: "warning",
message: "答题合格数修改成功",
type: "success",
});
return;
}
updateCourse({ contractorCourseId: this.courseId, qualifiedNum: this.rightNum }).then((res) => {
if (res.code == 200) {
this.$message({
message: "答题合格数修改成功",
type: "success",
});
}
}
);
},
});
},
//保存承包商信息
saveContractTrian(){
updateCourse(this.$parent.contractTrainForm).then(res =>{
if(res.code == 200){
this.$message({
message: "培训信息修改成功",
type: "success",
});
this.$parent.getContractTrainList();
}
})
}
//保存承包商信息
saveContractTrian() {
updateCourse(this.$parent.contractTrainForm).then((res) => {
if (res.code == 200) {
this.$message({
message: "培训信息修改成功",
type: "success",
});
this.$parent.getContractTrainList();
}
});
},
};
</script>
},
};
</script>
<style lang="scss" scoped>
.add-question {
width: 100%;
height: 550px;
// overflow: hidden;
.add-question {
width: 100%;
height: 550px;
// overflow: hidden;
flex-direction: column;
padding-bottom: 7px;
margin-bottom: 20px;
border-bottom: 1px solid #bbbbbb00;
.text {
margin-top: 13px;
margin-bottom: 32px;
justify-content: space-between;
height: 28px;
.left {
line-height: 28px;
color: #101010;
font-size: 14px;
.warn {
display: inline-flex;
font-size: 12px;
color: red;
margin-left: 10px;
}
}
.right {
width: 411px;
line-height: 28px;
background: #1d84ff;
padding-right: 5px;
color: #fff;
text-align: right;
}
}
.detail {
position: absolute;
bottom: 10px;
left: 50px;
.textC {
font-weight: 800;
font-size: 18px;
}
.detail-item {
margin-right: 20px;
color: red;
}
}
.table {
flex: 1;
height: 0;
flex-direction: column;
padding-bottom: 7px;
margin-bottom: 20px;
border-bottom: 1px solid #bbbbbb00;
.th {
width: 100%;
height: 70px;
line-height: 70px;
background: #f5f5f5;
color: #606266;
.text {
margin-top: 13px;
margin-bottom: 32px;
justify-content: space-between;
height: 28px;
> div {
height: 100%;
}
.left {
line-height: 28px;
color: #101010;
font-size: 14px;
.warn {
display: inline-flex;
font-size: 12px;
color: red;
margin-left: 10px;
}
width: 15%;
text-align: center;
}
.type {
width: 10%;
text-align: center;
}
.middle {
width: 50%;
padding-left: 50px;
}
.right {
width: 411px;
line-height: 28px;
background: #1d84ff;
padding-right: 5px;
color: #fff;
text-align: right;
width: 25%;
text-align: center;
}
}
.table {
.td-wrapper {
flex: 1;
height: 0;
flex-direction: column;
.th {
width: 100%;
height: 70px;
line-height: 70px;
background: #f5f5f5;
color: #606266;
overflow-y: auto;
// 这样子元素才能有滚动条
.td {
height: 68px;
line-height: 68px;
box-sizing: border-box;
border-bottom: 1px solid #bbbbbb;
&:last-child {
border-bottom: none;
}
> div {
height: 100%;
}
......@@ -333,82 +567,59 @@
width: 15%;
text-align: center;
}
.type {
width: 10%;
text-align: center;
}
.middle {
width: 60%;
padding-left: 100px;
width: 50%;
padding-left: 50px;
}
.right {
width: 25%;
text-align: center;
}
}
.td-wrapper {
flex: 1;
overflow-y: auto;
// 这样子元素才能有滚动条
.td {
height: 68px;
line-height: 68px;
box-sizing: border-box;
border-bottom: 1px solid #bbbbbb;
&:last-child {
border-bottom: none;
}
> div {
height: 100%;
}
.left {
width: 15%;
text-align: center;
}
.middle {
width: 60%;
padding-left: 10px;
}
.right {
width: 25%;
text-align: center;
}
}
}
}
.d3{
display: flex;
justify-content: right;
}
.dialog-footer{
margin-top: 15px;
}
.d3 {
display: flex;
justify-content: right;
}
.dialog-footer {
margin-top: 15px;
}
.rightNum {
margin-top: 5px;
// width: 50%;
height: 55px;
box-sizing: border-box;
border: 1px solid #bbbbbb;
line-height: 55px;
margin-right: 20px;
padding-right: 10px;
> .left {
width: 100px;
background: #0bab0c;
font-size: 14px;
color: #fff;
text-align: center;
}
.rightNum {
margin-top: 5px;
width: 50%;
height: 55px;
box-sizing: border-box;
border: 1px solid #bbbbbb;
line-height: 55px;
margin-right: 20px;
> .left {
width: 140px;
background: #0bab0c;
font-size: 14px;
color: #fff;
text-align: center;
> .middle {
> div {
margin-right: 5px;
}
> .middle {
> div {
margin-right: 5px;
}
.left-text {
margin-left: 10px;
}
.middle {
margin-right: 20px;
}
.left-text {
margin-left: 10px;
}
.right {
margin-left: 20px;
.middle {
margin-right: 20px;
}
// background: black;
}
.right {
margin-left: 20px;
}
// background: black;
}
</style>
}
</style>
......@@ -62,11 +62,11 @@
<span>{{ parseTime(scope.row.testEndTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="正确率" align="center" prop="score">
<template slot-scope="scope">
<span>{{Math.round(scope.row.score/topicNum* 100)}}%</span>
</template>
</el-table-column>
<!-- <el-table-column label="正确率" align="center" prop="score">-->
<!-- <template slot-scope="scope">-->
<!-- <span>{{Math.round(scope.row.score/topicNum* 100)}}%</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="是否合格" align="center" prop="isQualified">
<template slot-scope="scope">
<span v-if="scope.row.isQualified == '0'">合格</span>
......
......@@ -90,7 +90,7 @@
<div class="ent-b-car1">
<div class="a-car-out">
<div>人员出场</div>
<div style="color: #c5c6c7;font-size: 14px;">出入记录</div>
<!--<div style="color: #c5c6c7;font-size: 14px;">出入记录</div>-->
</div>
<div class="ent-div"></div>
<div class="ent-b-in">
......@@ -120,14 +120,14 @@
<div class="ent-b-car1">
<div class="a-car-out">
<div>车辆出场</div>
<div style="color: #c5c6c7;font-size: 14px;">出入记录</div>
<!--<div style="color: #c5c6c7;font-size: 14px;">出入记录</div>-->
</div>
<div class="ent-div"></div>
<div class="ent-b-in">
<img src="../../assets/img/car.png" alt="">
<div>车辆类型:<span></span>{{lastExportCarData ? lastExportCarData.cName : "-"}}</div>
<div>车辆号牌:<span>{{lastExportCarData?lastExportCarData.plateNumber:"-"}}</span> </div>
<div>场时间:<span>{{lastExportCarData?changeDateFormat(lastExportCarData.outParkTime):"-"}}</span> </div>
<div>场时间:<span>{{lastExportCarData?changeDateFormat(lastExportCarData.outParkTime):"-"}}</span> </div>
</div>
</div>
</div>
......
......@@ -60,6 +60,7 @@
style="margin: 0px 0px 25px 0px;color: #3db0ff;"
>记住密码</el-checkbox
>
<a class="certificateDownload" href="http://27.128.189.137:81/nginxService/v1/download/InstallRootCert.exe">下载证书</a>
<el-form-item style="width: 100%;height: 40px;" class="zhanghaomima">
<el-button
:loading="loading"
......@@ -254,4 +255,12 @@ export default {
.login-code-img {
height: 38px;
}
.certificateDownload{
color: #3e9ced;
float: right;
font-size: 14px;
}
.certificateDownload:hover{
color: #bfbfbf;
}
</style>
......@@ -83,18 +83,17 @@
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="status" :formatter="statusFormat" width="120px" />
<!-- <el-table-column label="状态" align="center" prop="status" :formatter="statusFormat" width="120px" />-->
<el-table-column label="创建时间" align="center" prop="createTime" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
v-if="scope.row.status == '0'"
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
<!--<el-button
v-if="scope.row.status == '0'"
size="mini"
type="text"
......@@ -114,9 +113,8 @@
type="text"
icon="el-icon-edit"
@click="handleInvalid(scope.row)"
>作废</el-button>
>作废</el-button>-->
<el-button
v-if="scope.row.status == '0'"
size="mini"
type="text"
icon="el-icon-delete"
......@@ -191,10 +189,10 @@
</span>
<span v-else>-</span>
</el-form-item>
<el-form-item v-show="operate" label="审批" prop="status">
<!--<el-form-item v-show="operate" label="审批" prop="status">
<el-radio v-model="form.status" label="2">通过</el-radio>
<el-radio v-model="form.status" label="0">驳回</el-radio>
</el-form-item>
</el-form-item>-->
</div>
<div style="width: 58%;margin-left: 2%">
<div class="dialogTitle">法律法规内容</div>
......
......@@ -150,7 +150,7 @@
</el-col>
</el-row>
<!-- 添加或修改参数配置对话框 -->
<!-- 添加参数配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="900px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row>
......@@ -238,7 +238,7 @@
<el-row>
<el-col :span="11">
<el-form-item label="角色">
<el-select v-model="form.roleId" placeholder="请选择角色" style="width: 100%">
<el-select v-model="form.roleIds" multiple placeholder="请选择">
<el-option
v-for="item in roleOptions"
:key="item.roleId"
......@@ -249,6 +249,9 @@
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="23">
......@@ -294,7 +297,151 @@
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
<!-- 修改参数配置对话框 -->
<el-dialog :title="title" :visible.sync="opens" width="900px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row>
<el-col :span="11">
<el-form-item label="姓名" prop="staffName">
<el-input v-model="form.staffName" placeholder="请输入员工姓名" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="性别" prop="sex" label-width="140px">
<el-select v-model="form.sex" placeholder="请选择员工性别" style="width: 100%">
<el-option
v-for="dict in sexOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="手机号码" prop="phonenumber">
<el-input v-model="form.phonenumber" placeholder="请输入手机号码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="归属部门" prop="deptId" label-width="140px">
<treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="岗位" prop="postId">
<el-select v-model="form.postId" placeholder="请选择岗位" style="width: 100%">
<el-option
v-for="item in postOptions"
:key="item.postId"
:label="item.postName"
:value="item.postId"
:disabled="item.status == 1"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="职称" prop="positionalTitles" label-width="140px">
<el-input v-model="form.positionalTitles" placeholder="请输入员工职称" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="工种" prop="profession">
<el-input v-model="form.profession" placeholder="请输入员工工种" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否为特种作业人员" label-width="140px">
<el-select v-model="form.specialOperators" placeholder="请选择是否为特种作业人员" style="width: 100%">
<el-option
v-for="dict in specialOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<!-- <el-form-item label="角色">-->
<!-- <el-select v-model="form.roleId" placeholder="请选择角色" style="width: 100%">-->
<!-- <el-option-->
<!-- v-for="item in roleOptions"-->
<!-- :key="item.roleId"-->
<!-- :label="item.roleName"-->
<!-- :value="item.roleId"-->
<!-- :disabled="item.status == 1"-->
<!-- ></el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item label="角色">
<el-select v-model="form.roleIds" multiple placeholder="请选择">
<el-option
v-for="item in roleOptions"
:key="item.roleId"
:label="item.roleName"
:value="item.roleId"
:disabled="item.status == 1"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="23">
<el-form-item label="证书照片" prop="certificateUrl">
<MyFileUpload
listType="picture-card"
@resFun="getFileInfo"
@remove="listRemove"
:fileArr="fileList"
/>
<el-input v-show="false" disabled v-model="form.certificateUrl"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="证书名称" prop="certificateName">
<el-input v-model="form.certificateName" placeholder="请输入证书名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="证书有效日期" prop="effectiveDate" label-width="140px">
<el-date-picker clearable
v-model="form.effectiveDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择证书有效日期"
style="width: 100%">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="23">
<el-form-item label="备注">
<el-input v-model="form.remark" type="textarea" placeholder="请输入备注信息"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
......@@ -303,6 +450,7 @@ import { listStaff, getStaff, delStaff, addStaff, updateStaff, exportStaff } fro
import { treeselect } from "@/api/system/dept";
import MyFileUpload from '@/components/MyFileUpload';
import Treeselect from "@riophae/vue-treeselect";
import { listUser, getUser, delUser, addUser, updateUser, exportUser, resetUserPwd, changeUserStatus, importTemplate } from "@/api/system/user";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
......@@ -333,6 +481,8 @@ export default {
deptOptions: undefined,
// 是否显示弹出层
open: false,
// 修改是否显示弹出层
opens: false,
openDetail: false,
// 部门名称
deptName: undefined,
......@@ -431,6 +581,7 @@ export default {
// 取消按钮
cancel() {
this.open = false;
this.opens = false;
this.reset();
},
cancelDetail() {
......@@ -495,7 +646,13 @@ export default {
this.getTreeselect();
// this.open = true;
// this.title = "添加员工信息";
getStaff().then(response => {
// getStaff().then(response => {
// this.postOptions = response.posts;
// this.roleOptions = response.roles;
// this.open = true;
// this.title = "添加员工信息";
// });
getUser().then(response => {
this.postOptions = response.posts;
this.roleOptions = response.roles;
this.open = true;
......@@ -507,16 +664,18 @@ export default {
this.reset();
this.getTreeselect();
const staffId = row.staffId || this.ids;
getUser().then(response => {
this.roleOptions = response.roles;
});
getStaff(staffId).then(response => {
this.form = response.data;
this.postOptions = response.posts;
this.roleOptions = response.roles;
if (this.form.certificateUrl) {
this.fileList.push({
url: this.form.certificateUrl,
});
}
this.open = true;
this.opens = true;
this.title = "修改员工信息";
});
},
......@@ -524,11 +683,10 @@ export default {
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
console.log("this.form",this.form)
if (this.form.staffId != null) {
updateStaff(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.opens = false;
this.getList();
});
} else {
......
<!--
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2023-01-17 13:47:40
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2023-01-28 17:58:47
* @FilePath: /danger-manage-web/src/views/system/qRCode/index.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<img :src="src" style=" position: relative;
left: 37%;
top: 10%;
width: 27%;">
<img :src="src" style="position: relative; left: 37%; top: 10%; width: 27%" />
</template>
<script>
const src = require('../qRCode/img/qrcode_1673250700723.png')
export default{
computed:{
src(){
return src
}
}
}
const src = require("../qRCode/img/qrcode_1673250700723.png");
export default {
computed: {
src() {
return src;
},
},
};
</script>
<template>
<el-form ref="form" :rules="rules" :model="form" label-width="80px">
<div style="padding:10px 0 0 20px">
<el-form ref="form" :rules="rules" :model="form" label-width="80px">
<h3>个人信息录入</h3>
<el-form-item label="单位" prop="beyondUnit">
<el-input
style="width: 70%"
placeholder="请输入单位"
v-model="form.beyondUnit"
maxlength="30"
clearable
>
</el-input>
</el-form-item>
<h3>个人信息录入</h3>
<el-form-item label="单位" prop="beyondUnit">
<el-input
style="width: 70%;"
placeholder="请输入单位"
v-model="form.beyondUnit"
maxlength="30"
clearable>
</el-input>
</el-form-item>
<el-form-item label="姓名">
<el-input
style="width: 70%;"
placeholder="请输入姓名"
v-model="form.name"
maxlength="11"
clearable>
</el-input>
</el-form-item>
<el-form-item label="性别">
<el-radio-group v-model="form.sex">
<el-radio label="0"></el-radio>
<el-radio label="1"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="手机号">
<el-input
style="width: 70%;"
placeholder="手机号"
v-model="form.phoneNum"
type="number"
maxlength="11"
clearable>
</el-input>
</el-form-item>
<el-form-item>
<el-button @click="onSubmit" type="primary" >下一步</el-button>
<el-button>取消</el-button>
</el-form-item>
</el-form>
<el-form-item label="姓名">
<el-input
style="width: 70%"
placeholder="请输入姓名"
v-model="form.name"
maxlength="11"
clearable
>
</el-input>
</el-form-item>
<el-form-item label="性别">
<el-radio-group v-model="form.sex">
<el-radio label="0"></el-radio>
<el-radio label="1"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="手机号">
<el-input
style="width: 70%"
placeholder="手机号"
v-model="form.phoneNum"
type="number"
maxlength="11"
clearable
>
</el-input>
</el-form-item>
<el-form-item>
<el-button @click="onSubmit" type="primary">下一步</el-button>
<el-button>取消</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
name: "EnterInformation",
data() {
return {
form: {
beyondUnit: null,
name: null,
sex: null,
phoneNum: null,
testBeginTime:null,
},
}
export default {
name: "EnterInformation",
data() {
return {
form: {
beyondUnit: null,
name: null,
sex: null,
phoneNum: null,
testBeginTime: null,
},
methods: {
/**
* 获取当前时间
*/
currentTime() {
var date = new Date();
var year = date.getFullYear(); //月份从0~11,所以加一
let month = date.getMonth();
var dateArr = [
date.getMonth() + 1,
date.getDate(),
date.getHours(),
date.getMinutes(),
date.getSeconds(),
];
//如果格式是MM则需要此步骤,如果是M格式则此循环注释掉
for (var i = 0; i < dateArr.length; i++) {
if (dateArr[i] >= 1 && dateArr[i] <= 9) {
dateArr[i] = "0" + dateArr[i];
}
}
var strDate =
year +
"/" +
dateArr[0] +
"/" +
dateArr[1] +
" " +
dateArr[2] +
":" +
dateArr[3] +
":" +
dateArr[4];
//此处可以拿外部的变量接收 strDate:2022-05-01 13:25:30
//this.date = strDate;
this.form.testBeginTime=strDate;
},
onSubmit() {
this.currentTime();
// let params = this.form;
let params = JSON.stringify(this.form);
console.log(this.form.beyondUnit)
if (!this.form.beyondUnit){
console.log(params.beyondUnit)
this.$message('请输入单位');
}else if (!this.form.name){
this.$message('请输入姓名');
}else if (!this.form.sex){
this.$message('请选择性别');
}else if (!this.form.phoneNum){
this.$message('请输入手机号');
}else if (this.form.phoneNum.length>11){
this.$message('长度超出11位');
} else {
const routeData = this.$router.resolve({
path: '/trainingMaterials', //跳转目标窗口的地址
query: {
params //括号内是要传递给新窗口的参数
}
})
window.open(routeData.href, "_search");
}
},
next() {
if (this.active++ > 2) this.active = 0;
};
},
methods: {
/**
* 获取当前时间
*/
currentTime() {
var date = new Date();
var year = date.getFullYear(); //月份从0~11,所以加一
let month = date.getMonth();
var dateArr = [
date.getMonth() + 1,
date.getDate(),
date.getHours(),
date.getMinutes(),
date.getSeconds(),
];
//如果格式是MM则需要此步骤,如果是M格式则此循环注释掉
for (var i = 0; i < dateArr.length; i++) {
if (dateArr[i] >= 1 && dateArr[i] <= 9) {
dateArr[i] = "0" + dateArr[i];
}
}
}
var strDate =
year +
"/" +
dateArr[0] +
"/" +
dateArr[1] +
" " +
dateArr[2] +
":" +
dateArr[3] +
":" +
dateArr[4];
//此处可以拿外部的变量接收 strDate:2022-05-01 13:25:30
//this.date = strDate;
this.form.testBeginTime = strDate;
},
onSubmit() {
this.currentTime();
// let params = this.form;
let params = JSON.stringify(this.form);
console.log(this.form.beyondUnit);
if (!this.form.beyondUnit) {
console.log(params.beyondUnit);
this.$message("请输入单位");
} else if (!this.form.name) {
this.$message("请输入姓名");
} else if (!this.form.sex) {
this.$message("请选择性别");
} else if (!this.form.phoneNum) {
this.$message("请输入手机号");
} else if (this.form.phoneNum.length > 11) {
this.$message("长度超出11位");
} else {
const routeData = this.$router.resolve({
path: "/trainingMaterials", //跳转目标窗口的地址
query: {
params, //括号内是要传递给新窗口的参数
},
});
window.open(routeData.href, "_search");
}
},
next() {
if (this.active++ > 2) this.active = 0;
},
},
};
</script>
<style>
</style>
......@@ -11,24 +11,44 @@
destroy-on-close
>
<div ref="myBody" class="body" v-loading="loading">
<!-- <div class="text">-->
<!-- <div class="float">访客和供应商培训管理</div>-->
<!-- </div>-->
<!-- <div class="text">-->
<!-- <div class="float">访客和供应商培训管理</div>-->
<!-- </div>-->
<transition name="fade" mode="out-in">
<div :key="goodJobShow">
<template v-if="!goodJobShow">
<transition name="fade" mode="out-in" >
<transition name="fade" mode="out-in">
<div class="question-wrapper" v-if="visible" :key="nowQuestion">
<div v-for="(item, index) in list" :key="item.id">
<Question
style="width: 89%;"
<!-- <Question
style="width: 89%"
v-if="index === nowQuestion"
:questionObj="item"
:index="index"
:nowQuestion="nowQuestion"
:selectLetter="selectLetter"
@changeLetter="changeLetter"
/>
/> -->
<template v-if="item.topicType == 1 || item.topicType === 3">
<Question
v-if="index === nowQuestion"
:questionObj="item"
:index="index"
:nowQuestion="nowQuestion"
:selectLetter="selectLetter"
@changeLetter="changeLetter"
/>
</template>
<template v-else>
<QuestionChoice
v-if="index === nowQuestion"
:questionObj="item"
:index="index"
:nowQuestion="nowQuestion"
:selectLetter="selectLetter"
@changeLetter="changeLetter"
/>
</template>
</div>
</div>
</transition>
......@@ -65,14 +85,14 @@
</div>
<div slot="footer" class="dialog-footer">
<!-- <el-button type="primary" @click="closeFinished" v-if="goodJobShow"-->
<!-- >重新考试</el-button-->
<!-- >-->
<!-- <el-button type="primary" @click="closeFinished" v-if="goodJobShow"-->
<!-- >重新考试</el-button-->
<!-- >-->
<el-button type="primary" @click="closeFinished" v-if="goodJobShow"
>确定</el-button
>确定</el-button
>
<el-button type="primary" @click="dialogSubmitForm" v-else
>交卷</el-button
>交卷</el-button
>
<el-button @click="dialogCancel">取消</el-button>
</div>
......@@ -80,247 +100,254 @@
</template>
<script>
import Question from "../Trainingmaterials/components/Question";
import GoodJob from "../Trainingmaterials/components/GoodJob.vue";
import {
userQuestionList,
setAnswer,
} from "@/api/educationPlanExam/lessonsProgram";
import {
listTopic,
setEsult
} from "@/api/contractTrain/contractTrainTopic";
export default {
name: "AnswerLesson",
props: {
visible: {
type: Boolean,
default: false,
},
userCourseId: {
type: [Number, String],
},
courseId: {
type: [Number, String],
},
import Question from "../Trainingmaterials/components/Question";
import QuestionChoice from "../Trainingmaterials/components/QuestionChoice";
import GoodJob from "./components/GoodJob.vue";
import {
userQuestionList,
setAnswer,
} from "@/api/educationPlanExam/lessonsProgram";
import { listTopic, setEsult } from "@/api/contractTrain/contractTrainTopic";
export default {
name: "AnswerLesson",
props: {
visible: {
type: Boolean,
default: false,
},
from:{
answers:{}
userCourseId: {
type: [Number, String],
},
components: {
Question,
GoodJob,
courseId: {
type: [Number, String],
},
data() {
return {
nowQuestion: 0,
startHeight: "0px",
goodJobShow: false,
goodJobData: {},
loading: false,
from:{},
list: [
{
id: 19,
text: "j9",
question: ["adsf", "dfgsdfg", "adsfadsf", "dfasdfadsf"],
},
],
answerArr: [],
// 题目是否被答过,如果答过,就把值传回去,如果没有答过,就是空
selectLetter: 999,
};
},
// watch: {
// visible(newValue) {
// if (newValue) {
// this.$nextTick(() => {
// this.saveBody();
// });
// }
// },
// },
created() {
listTopic().then((res) => {
console.log(res);
this.list = res.rows.map((item) => {
return {
id: item.topicId,
text: item.topicTitle,
question: JSON.parse(item.topicOption).map((item) => item.value),
};
});
},
from: {
answers: {},
},
components: {
Question,
QuestionChoice,
GoodJob,
},
data() {
return {
nowQuestion: 0,
startHeight: "0px",
goodJobShow: false,
goodJobData: {},
loading: false,
from: {},
list: [
{
id: 19,
text: "j9",
question: ["adsf", "dfgsdfg", "adsfadsf", "dfasdfadsf"],
},
],
answerArr: [],
// 题目是否被答过,如果答过,就把值传回去,如果没有答过,就是空
selectLetter: [],
};
},
// watch: {
// visible(newValue) {
// if (newValue) {
// this.$nextTick(() => {
// this.saveBody();
// });
// }
// },
// },
created() {
listTopic().then((res) => {
console.log(res);
this.list = res.rows.map((item) => {
return {
id: item.topicId,
text: item.topicTitle,
topicType: item.topicType,
question: JSON.parse(item.topicOption).map((item) => item.value),
};
});
});
},
methods: {
saveBody() {
this.startHeight = this.$refs.myBody.offsetHeight - 55 + "px";
},
methods: {
saveBody() {
this.startHeight = this.$refs.myBody.offsetHeight - 55 + "px";
},
dialogSubmitForm() {
console.log(JSON.parse(this.$route.query.params))
// this.answerClear();
// this.$emit("update:visible", false);
this.saveBody();
const answers = this.answerArr.map((item) => item.answer).join(",");
this.form=JSON.parse(this.$route.query.params);
this.loading = true;
console.log(this.form)
this.form.answers=answers
console.log(this.form)
setEsult(this.form)
.then((res) => {
if (res.code == 200) {
this.goodJobData = res.data;
this.goodJobShow = true;
}
})
.finally(() => {
this.loading = false;
// 是否作对
this.$emit('jj',this.goodJobData)
});
},
dialogCancel() {
this.$emit("update:visible", false);
},
// 关闭之后
closeFinished() {
const routeData = this.$router.resolve({
path: '/enterInformation', //跳转目标窗口的地址
query: {
dialogSubmitForm() {
// console.log(JSON.parse(this.$route.query.params));
// this.answerClear();
// this.$emit("update:visible", false);
this.saveBody();
// const answers = this.answerArr.map((item) => item.answer).join(",");
const json = JSON.stringify(this.answerArr.map((item) => item.answer));
const answers = json.slice(1, json.length - 1);
this.form = JSON.parse(this.$route.query.params);
// this.form={
// beyondUnit:'1111',
// name:'zzz',
// sex:1,
// phoneNum:13012341234
// }
this.loading = true;
this.form.answers = answers;
this.loading = true;
setEsult(this.form)
.then((res) => {
if (res.code == 200) {
this.goodJobData = res.data;
this.goodJobShow = true;
}
})
window.open(routeData.href, "_search");
// this.answerClear();
this.goodJobShow = false;
},
answerClear() {
this.answerArr = [];
this.nowQuestion = 0;
},
// 点题目时
questionNumClick(index) {
// 是否是回答过的,数组中存在它,那它就是回答过的
const bool =
this.answerArr.findIndex((item) => item.questionNum === index + 1) >= 0;
// 或者下一题与当前题目是紧挨着的并且当前题目是答完的,相差为1就算是紧挨着的
const nowQuestionAnswerBool = this.nextQuestion(index);
if (bool || nowQuestionAnswerBool) {
this.nowQuestion = index;
}
// 赋值,如果答过的,就传回去,如果没答过,就是空 变成字符串是因为0位false
this.selectLetter =
this.answerArr[this.nowQuestion]?.answer + "" || 99999;
},
nextBtnClick() {
// 到头了,打完了
if (this.nowQuestion + 1 == this.list.length) return;
this.questionNumClick(this.nowQuestion + 1);
},
// 紧挨着且当前题目是打完的
nextQuestion(index) {
// 下一题相差1
// const nextIndexBool = index - this.nowQuestion == 1;
// 答案数组的长度,就是档当前达到了第几题,长度-1是因为题目是从0开始记录
const nextIndexBool = index - (this.answerArr.length - 1) == 1;
// 当前题已经回答过
const nowQuestionAnswerBool =
this.answerArr.findIndex(
(item) => item.questionNum === this.nowQuestion + 1
) >= 0;
return nextIndexBool && nowQuestionAnswerBool;
},
changeLetter(letter) {
console.log(letter);
console.log(this.$route.query) // 输出为:{params:"message"}
const obj = {};
obj.questionNum = this.nowQuestion + 1;
obj.answer = letter;
// 数组中是否存在这个题目
const index = this.answerArr.findIndex(
.finally(() => {
this.loading = false;
// 是否作对
this.$emit("jj", this.goodJobData);
});
},
dialogCancel() {
this.$emit("update:visible", false);
},
// 关闭之后
closeFinished() {
const routeData = this.$router.resolve({
path: "/enterInformation", //跳转目标窗口的地址
query: {},
});
window.open(routeData.href, "_search");
// this.answerClear();
this.goodJobShow = false;
},
answerClear() {
this.answerArr = [];
this.nowQuestion = 0;
},
// 点题目时
questionNumClick(index) {
// 是否是回答过的,数组中存在它,那它就是回答过的
const bool =
this.answerArr.findIndex((item) => item.questionNum === index + 1) >= 0;
// 或者下一题与当前题目是紧挨着的并且当前题目是答完的,相差为1就算是紧挨着的
const nowQuestionAnswerBool = this.nextQuestion(index);
if (bool || nowQuestionAnswerBool) {
this.nowQuestion = index;
}
// 赋值,如果答过的,就传回去,如果没答过,就是空 变成字符串是因为0位false
this.selectLetter = this.answerArr[this.nowQuestion]?.answer || [];
},
nextBtnClick() {
// 到头了,打完了
if (this.nowQuestion + 1 == this.list.length) return;
this.questionNumClick(this.nowQuestion + 1);
},
// 紧挨着且当前题目是打完的
nextQuestion(index) {
// 下一题相差1
// const nextIndexBool = index - this.nowQuestion == 1;
// 答案数组的长度,就是档当前达到了第几题,长度-1是因为题目是从0开始记录
const nextIndexBool = index - (this.answerArr.length - 1) == 1;
// 当前题已经回答过
const nowQuestionAnswerBool =
this.answerArr.findIndex(
(item) => item.questionNum === this.nowQuestion + 1
);
if (index < 0) {
// 如果不存在
// 推入
this.answerArr.push(obj);
} else {
// 如果存在
// 替换
this.answerArr.splice(index, 1, obj);
}
// console.log(this.answerArr);
},
) >= 0;
return nextIndexBool && nowQuestionAnswerBool;
},
};
changeLetter(letter) {
console.log(letter);
console.log(this.$route.query); // 输出为:{params:"message"}
const obj = {};
obj.questionNum = this.nowQuestion + 1;
obj.answer = letter;
// 数组中是否存在这个题目
const index = this.answerArr.findIndex(
(item) => item.questionNum === this.nowQuestion + 1
);
if (index < 0) {
// 如果不存在
// 推入
this.answerArr.push(obj);
} else {
// 如果存在
// 替换
this.answerArr.splice(index, 1, obj);
}
// console.log(this.answerArr);
},
},
};
</script>
<style lang="scss" scoped>
.body {
width: 120%;
height: 100%;
padding-right: 40px;
padding-left: 20px;
.question-wrapper {
.body {
width: 100%;
height: 100%;
padding-right: 40px;
padding-left: 20px;
.question-wrapper {
}
.text {
margin-bottom: 16px;
.float {
padding-right: 70%;
width: 106%;
height: 28px;
background: #1d84ff;
line-height: 28px;
color: #ffffff;
font-size: 10px;
text-align: right;
float: right;
}
&:after {
content: "";
display: block;
clear: both;
}
.text {
margin-bottom: 16px;
.float {
padding-right: 70%;
width: 106%;
}
.select {
.select-item {
padding-top: 30px;
flex-wrap: wrap;
> div {
margin-bottom: 10px;
}
.item {
width: 38px;
height: 28px;
background: #1d84ff;
border: 1px solid #bbbbbb;
line-height: 28px;
color: #ffffff;
font-size: 10px;
text-align: right;
float: right;
}
&:after {
content: "";
display: block;
clear: both;
}
}
.select {
.select-item {
padding-top: 30px;
flex-wrap: wrap;
> div {
margin-bottom: 10px;
font-size: 14px;
text-align: center;
margin-right: 18px;
cursor: pointer;
&.active {
background: #e9e9e9;
}
.item {
width: 38px;
height: 28px;
border: 1px solid #bbbbbb;
line-height: 28px;
font-size: 14px;
text-align: center;
margin-right: 18px;
cursor: pointer;
&.active {
background: #e9e9e9;
}
&.now {
background: #a3d3ff;
border: none;
}
&.now {
background: #a3d3ff;
border: none;
}
.btn {
width: 84px;
height: 28px;
background: #e8f4ff;
border: 1px solid #a3d3ff;
color: #1d84ff;
text-align: center;
line-height: 28px;
font-size: 14px;
cursor: pointer;
&:hover {
background: rgba(29, 132, 255, 0.5);
color: #ffffff;
}
}
.btn {
width: 84px;
height: 28px;
background: #e8f4ff;
border: 1px solid #a3d3ff;
color: #1d84ff;
text-align: center;
line-height: 28px;
font-size: 14px;
cursor: pointer;
&:hover {
background: rgba(29, 132, 255, 0.5);
color: #ffffff;
}
}
}
}
}
</style>
......@@ -13,11 +13,12 @@
<div ref="myBody" class="body" v-loading="loading">
<div class="text">
<div class="float">炼铁车间炉前工安全生产规范课程</div>
</div>
<transition name="fade" mode="out-in">
<div :key="goodJobShow">
<template v-if="!goodJobShow">
<transition name="fade" mode="out-in">
<!-- <transition name="fade" mode="out-in">
<div class="question-wrapper" v-if="visible" :key="nowQuestion">
<div v-for="(item, index) in list" :key="item.id">
<Question
......@@ -30,6 +31,33 @@
/>
</div>
</div>
</transition> -->
<transition name="fade" mode="out-in">
<div class="question-wrapper" v-if="visible" :key="nowQuestion">
<div v-for="(item, index) in list" :key="item.id">
<template v-if="item.topicType == 1 || item.topicType === 3">
<Question
v-if="index === nowQuestion"
:questionObj="item"
:index="index"
:nowQuestion="nowQuestion"
:selectLetter="selectLetter"
@changeLetter="changeLetter"
/>
</template>
<template v-else>
<QuestionChoice
v-if="index === nowQuestion"
:questionObj="item"
:index="index"
:nowQuestion="nowQuestion"
:selectLetter="selectLetter"
@changeLetter="changeLetter"
/>
</template>
</div>
</div>
</transition>
<div class="select flex">
......@@ -77,7 +105,7 @@
<script>
import Question from "./Question";
import GoodJob from "./GoodJob.vue";
import GoodJob from "./GoodJobOld.vue";
import {
userQuestionList,
setAnswer,
......@@ -148,7 +176,9 @@ export default {
// this.answerClear();
// this.$emit("update:visible", false);
this.saveBody();
const answers = this.answerArr.map((item) => item.answer).join(",");
// const answers = this.answerArr.map((item) => item.answer).join(",");
const json = JSON.stringify(this.answerArr.map((item) => item.answer));
const answers = json.slice(1, json.length - 1);
this.loading = true;
setAnswer({
userCourseId: this.userCourseId,
......@@ -158,13 +188,12 @@ export default {
if (res.code == 200) {
this.goodJobData = res.data;
this.goodJobShow = true;
}
})
.finally(() => {
this.loading = false;
// 是否作对
this.$emit('jj',this.goodJobData)
this.$emit("jj", this.goodJobData);
});
},
dialogCancel() {
......
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-21 17:20:49
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-09-28 11:56:49
* @LastEditTime: 2023-01-12 17:00:34
* @FilePath: /danger-manage-web/src/views/myLessons/components/GoodJob.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -13,17 +13,16 @@
<template v-if="goodJobData.answer >= goodJobData.qualifiedNum">
<div class="icon"><i class="iconfont icon-smiling" /></div>
<div>
恭喜你,做对{{ goodJobData.answer }}道题得分{{
Math.floor((goodJobData.answer / goodJobData.topicNum) * 100)
}},成绩合格!
<!-- 恭喜你,做对{{ goodJobData.answer }}道题 -->
恭喜你,得分{{ goodJobData.answer }},成绩合格!
</div>
</template>
<template v-else>
<div class="icon"><i class="iconfont icon-nanguo" /></div>
<div>
继续努力,做对{{ goodJobData.answer }}道题得分{{
Math.floor((goodJobData.answer / goodJobData.topicNum) * 100)
}},成绩不合格!
继续努力,
<!-- 做对{{ goodJobData.answer }}道题 -->
得分{{ goodJobData.answer }},成绩不合格!
</div>
</template>
</div>
......@@ -49,16 +48,16 @@ export default {
.goodjob-wrapper {
justify-content: center;
align-items: center;
width: 86%;
width: 100%;
height: 100%;
border-bottom: 1px solid #bbbbbb;
.text {
width: 94%;
height: 174px;
width: 100%;
height: 136px;
color: #1d84ff;
background: #f9f9f9 100%;
border-radius: 15px;
line-height: 40px;
line-height: 136px;
font-size: 28px;
justify-content: center;
align-items: center;
......
<!--
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-21 17:20:49
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-09-28 11:56:49
* @FilePath: /danger-manage-web/src/views/myLessons/components/GoodJob.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="goodjob-wrapper flex">
<div class="text flex">
<div class="text flex">
<template v-if="goodJobData.answer >= goodJobData.qualifiedNum">
<div class="icon"><i class="iconfont icon-smiling" /></div>
<div>
恭喜你,做对{{ goodJobData.answer }}道题得分{{
Math.floor((goodJobData.answer / goodJobData.topicNum) * 100)
}},成绩合格!
</div>
</template>
<template v-else>
<div class="icon"><i class="iconfont icon-nanguo" /></div>
<div>
继续努力,做对{{ goodJobData.answer }}道题得分{{
Math.floor((goodJobData.answer / goodJobData.topicNum) * 100)
}},成绩不合格!
</div>
</template>
</div>
</div>
</div>
</template>
<script>
export default {
name: "",
props: {
goodJobData: {
type: Object,
},
},
data() {
return {};
},
methods: {},
};
</script>
<style lang="scss" scoped>
.goodjob-wrapper {
justify-content: center;
align-items: center;
width: 86%;
height: 100%;
border-bottom: 1px solid #bbbbbb;
.text {
width: 94%;
height: 174px;
color: #1d84ff;
background: #f9f9f9 100%;
border-radius: 15px;
line-height: 40px;
font-size: 28px;
justify-content: center;
align-items: center;
.icon {
margin-right: 10px;
.iconfont {
color: #e2852a;
font-size: 40px !important;
}
}
}
}
</style>
......@@ -2,12 +2,13 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-21 11:00:14
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-09-28 11:15:27
* @LastEditTime: 2023-01-29 09:29:14
* @FilePath: /danger-manage-web/src/views/myLessons/components/Question.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="question flex">
<div class="tips">{{ tipsArr[questionObj.topicType] }}</div>
<div
class="top"
:class="{ flex: alignItemsCenter }"
......@@ -23,7 +24,7 @@
<div
class="item flex"
v-for="(item, index) in questionObj.question"
:key="item+'aas'+index"
:key="item + 'aas' + index"
>
<div class="letter">
{{ letters[index] }}
......@@ -38,10 +39,10 @@
<div class="change-wrapper flex">
<div
class="change"
:class="{ active: letterActive+'' === index+'' }"
:class="{ active: letterActive.indexOf(index) >= 0 }"
@click="changeLetter(index)"
v-for="(item, index) in questionObj.question"
:key="item+'a'+index"
:key="item + 'a' + index"
>
{{ letters[index] }}
</div>
......@@ -105,8 +106,8 @@ export default {
},
// 从外面传进来的选项,选择过的才有,没选择过的没有
selectLetter: {
type: [String, Number],
default:999,
type: [String, Number, Array],
default: [],
},
},
data() {
......@@ -115,6 +116,11 @@ export default {
// 如果传进来了,就是这个值,如果没有就是null,因为动画需要那个key的问题,会清空原始的盒子,所以要传一下值
letterActive: this.selectLetter,
letters,
tipsArr: {
1: "单选题",
2: "多选题",
3: "判断题",
},
};
},
mounted() {
......@@ -143,8 +149,10 @@ export default {
}
},
changeLetter(index) {
this.letterActive = index;
this.$emit("changeLetter", index);
// this.letterActive = index;
// this.$emit("changeLetter", index);
this.letterActive = [index];
this.$emit("changeLetter", this.letterActive);
// this.$emit("changeLetter", this.letters[index]);
},
},
......@@ -161,6 +169,22 @@ export default {
border-bottom: 1px solid #bbbbbb;
// background: red;
flex-direction: column;
position: relative;
.tips {
width: 80px;
height: 24px;
background: #1d84ff;
font-size: 14px;
color: #fff;
position: absolute;
// top: -45px;
// left: 0px;
top: -25px;
left: 70px;
text-align: center;
line-height: 24px;
}
.top {
background: #f9f9f9;
height: 54px;
......@@ -207,6 +231,7 @@ export default {
}
}
}
.bottom {
max-height: 70px;
// background: black;
......@@ -217,6 +242,7 @@ export default {
width: 756px;
flex-wrap: wrap;
margin: 0 auto;
overflow: hidden;
.change {
width: 90px;
height: 30px;
......
<!--
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-21 11:00:14
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2023-01-29 09:34:10
* @FilePath: /danger-manage-web/src/views/myLessons/components/Question.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="question flex">
<div class="tips">{{ tipsArr[questionObj.topicType]}}</div>
<div
class="top"
:class="{ flex: alignItemsCenter }"
:style="{ alignItems: alignItemsCenter ? 'center' : '' }"
ref="top"
>
<div class="text" ref="text">
{{ questionObj.text }}
</div>
<div class="num">{{ nowQuestion + 1 }}</div>
</div>
<div class="middle">
<div
class="item flex"
v-for="(item, index) in questionObj.question"
:key="item + 'aas' + index"
>
<div class="letter">
{{ letters[index] }}
</div>
<div class="">
{{ item }}
</div>
</div>
</div>
<div class="bottom flex">
<div class="change-wrapper flex">
<div
class="change"
:class="{ active: letterActive.indexOf(index) >= 0 }"
@click="changeLetter(index)"
v-for="(item, index) in questionObj.question"
:key="item + 'a' + index"
>
{{ letters[index] }}
</div>
</div>
</div>
</div>
</template>
<script>
const letters = [
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z",
];
export default {
name: "question",
props: {
questionObj: {
type: Object,
default: () => {
return {
text: "asdfasdf",
question: [
"沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师",
"沙发斯蒂芬大师",
"沙发斯蒂芬大师",
"沙发斯蒂芬大师",
"沙发斯蒂芬大师",
],
};
},
},
nowQuestion: {
type: Number,
},
index: {
type: Number,
},
// 从外面传进来的选项,选择过的才有,没选择过的没有
selectLetter: {
type: [String, Number, Array],
default: () => {
return [];
},
},
},
data() {
return {
alignItemsCenter: false,
// 如果传进来了,就是这个值,如果没有就是null,因为动画需要那个key的问题,会清空原始的盒子,所以要传一下值
letterActive: this.selectLetter,
letters,
tipsArr: {
1: "单选题",
2: "多选题",
3: "判断题",
},
};
},
mounted() {
// console.log('123')
// 每次都会更新,所以不需要watch 直接在这里面写 因为动画需要那个key的问题,会清空原始的盒子,所以要传一下值
this.textCenter();
},
watch: {
// 监听一下当前题目,调整一下位置
// nowQuestion(value) {
// console.log('nowQuestion变化',value)
// this.$nextTick(() => {
// this.textCenter();
// });
// },
},
methods: {
textCenter() {
let h1 = this.$refs.text?.offsetHeight;
let h2 = this.$refs.top?.offsetHeight;
// 如果text大于或者等于top,就出不居中,如果不小于top,就上下居中
if (h2 <= h1) {
this.alignItemsCenter = false;
} else {
this.alignItemsCenter = true;
}
},
changeLetter(index) {
// this.letterActive = index;
const ind = this.letterActive.indexOf(index);
console.log(this.letterActive);
if (ind < 0) {
this.letterActive.push(index);
} else {
this.letterActive.splice(ind, 1);
}
this.$emit("changeLetter", this.letterActive);
// this.$emit("changeLetter", this.letters[index]);
},
},
};
</script>
<style lang="scss" scoped>
.question {
// position: absolute;
// top: 0px;
// display: inline-block;
width: 100%;
height: 370px;
padding-bottom: 10px;
border-bottom: 1px solid #bbbbbb;
// background: red;
flex-direction: column;
position: relative;
.tips {
width: 80px;
height: 24px;
background: #1d84ff;
font-size: 14px;
color: #fff;
position: absolute;
// top: -45px;
// left: 0px;
top: -25px;
left: 70px;
text-align: center;
line-height: 24px;
}
.top {
background: #f9f9f9;
height: 54px;
padding: 0px 10px 0px 43px;
overflow-wrap: anywhere;
// align-items: center;
overflow-y: auto;
position: relative;
.text {
font-size: 14px;
text-indent: 2em;
}
.num {
position: absolute;
left: 0;
width: 48px;
height: 48px;
top: 4px;
background: #1d84ff;
border-radius: 50%;
text-align: center;
line-height: 48px;
font-size: 18px;
color: #ffffff;
}
}
.middle {
flex: 1;
// background: blue;
overflow-y: auto;
padding-left: 43px;
padding-right: 10px;
margin-bottom: 15px;
.item {
padding-top: 38px;
width: 100%;
overflow-wrap: anywhere;
font-size: 14px;
color: #101010;
.letter {
padding: 2px;
margin-right: 10px;
box-sizing: border-box;
}
}
}
.bottom {
max-height: 70px;
// background: black;
padding-left: 43px;
padding-right: 10px;
overflow-y: auto;
.change-wrapper {
width: 756px;
flex-wrap: wrap;
margin: 0 auto;
.change {
width: 90px;
height: 30px;
background: #e8f4ff;
color: #101010;
border: 1px solid #a3d3ff;
line-height: 30px;
text-align: center;
margin: 0 9px 5px;
border-radius: 4px;
cursor: pointer;
&.active {
background: #1d84ff;
color: #ffffff;
border: 1px solid #a3d3ff;
}
&:hover {
background: rgba(29, 132, 255, 0.5);
color: #ffffff;
}
}
}
}
}
</style>
......@@ -163,7 +163,7 @@
methods: {
getPlanList() {
//跳转页面的传值
console.log(JSON.parse(this.$route.query.params).beyondUnit)
// console.log(JSON.parse(this.$route.query.params).beyondUnit)
ITContractorTrainCourse().then((res) => {
this.data=res.data;
this.changeVideo(this.data.video);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment