考核评估-考试管理

This commit is contained in:
xusd 2024-05-06 11:44:42 +08:00
parent e65ed43ee4
commit 863a8b312d
11 changed files with 1050 additions and 0 deletions

View File

@ -96,6 +96,12 @@
<version>3.8.7</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.inspur</groupId>
<artifactId>inspur-examine</artifactId>
<version>3.8.7</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

View File

@ -0,0 +1,105 @@
package com.inspur.web.controller.examine;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.inspur.common.utils.poi.ExcelUtil;
import com.inspur.examine.domain.ExamInfo;
import com.inspur.examine.service.IExamInfoService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.inspur.common.annotation.Log;
import com.inspur.common.core.controller.BaseController;
import com.inspur.common.core.domain.AjaxResult;
import com.inspur.common.enums.BusinessType;
import com.inspur.common.core.page.TableDataInfo;
/**
* 考试信息Controller
*
* @author inspur
* @date 2024-05-06
*/
@RestController
@RequestMapping("/examine/examInfo")
public class ExamInfoController extends BaseController
{
@Autowired
private IExamInfoService examInfoService;
/**
* 查询考试信息列表
*/
@PreAuthorize("@ss.hasPermi('examine:examInfo:list')")
@GetMapping("/list")
public TableDataInfo list(ExamInfo examInfo)
{
startPage();
List<ExamInfo> list = examInfoService.selectExamInfoList(examInfo);
return getDataTable(list);
}
/**
* 导出考试信息列表
*/
@PreAuthorize("@ss.hasPermi('examine:examInfo:export')")
@Log(title = "考试信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ExamInfo examInfo)
{
List<ExamInfo> list = examInfoService.selectExamInfoList(examInfo);
ExcelUtil<ExamInfo> util = new ExcelUtil<ExamInfo>(ExamInfo.class);
util.exportExcel(response, list, "考试信息数据");
}
/**
* 获取考试信息详细信息
*/
@PreAuthorize("@ss.hasPermi('examine:examInfo:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return success(examInfoService.selectExamInfoById(id));
}
/**
* 新增考试信息
*/
@PreAuthorize("@ss.hasPermi('examine:examInfo:add')")
@Log(title = "考试信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ExamInfo examInfo)
{
return toAjax(examInfoService.insertExamInfo(examInfo));
}
/**
* 修改考试信息
*/
@PreAuthorize("@ss.hasPermi('examine:examInfo:edit')")
@Log(title = "考试信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ExamInfo examInfo)
{
return toAjax(examInfoService.updateExamInfo(examInfo));
}
/**
* 删除考试信息
*/
@PreAuthorize("@ss.hasPermi('examine:examInfo:remove')")
@Log(title = "考试信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(examInfoService.deleteExamInfoByIds(ids));
}
}

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.inspur</groupId>
<artifactId>inspur</artifactId>
<version>3.8.7</version>
</parent>
<artifactId>inspur-examine</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.inspur</groupId>
<artifactId>inspur-common</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.0.7</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,109 @@
package com.inspur.examine.domain;
import java.math.BigDecimal;
import com.inspur.common.annotation.Excel;
import com.inspur.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 考试信息对象 exam_info
*
* @author inspur
* @date 2024-05-06
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class ExamInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 考试名称
*/
@Excel(name = "考试名称")
private String examName;
/**
* 考试等级
*/
@Excel(name = "考试等级" ,dictType = "exam_level")
private String examLevel;
/**
* 考试类型
*/
@Excel(name = "考试类型" ,dictType = "exam_type")
private String examType;
/**
* 考试时长
*/
private Integer examDuration;
/**
* 考试时长分钟
*/
@Excel(name = "考试时长")
private String examDurationHaveUnit;
/**
* 考试规则
*/
@Excel(name = "考试规则")
private String examRules;
/**
* 单选题数量
*/
@Excel(name = "单选题数量")
private Integer singleChoice;
/**
* 多选题数量
*/
@Excel(name = "多选题数量")
private Integer multipleChoice;
/**
* 判断题数量
*/
@Excel(name = "判断题数量")
private Integer judge;
/**
* 单选题分数
*/
@Excel(name = "单选题分数")
private BigDecimal singleChoiceScore;
/**
* 多选题分数
*/
@Excel(name = "多选题分数")
private BigDecimal multipleChoiceScore;
/**
* 判断题分数
*/
@Excel(name = "判断题分数")
private BigDecimal judgeScore;
/**
* 总分数
*/
@Excel(name = "总分数")
private BigDecimal totalScore;
/**
* 通过分数
*/
@Excel(name = "通过分数")
private BigDecimal passScore;
}

View File

@ -0,0 +1,61 @@
package com.inspur.examine.mapper;
import java.util.List;
import com.inspur.examine.domain.ExamInfo;
/**
* 考试信息Mapper接口
*
* @author inspur
* @date 2024-05-06
*/
public interface ExamInfoMapper
{
/**
* 查询考试信息
*
* @param id 考试信息主键
* @return 考试信息
*/
public ExamInfo selectExamInfoById(String id);
/**
* 查询考试信息列表
*
* @param examInfo 考试信息
* @return 考试信息集合
*/
public List<ExamInfo> selectExamInfoList(ExamInfo examInfo);
/**
* 新增考试信息
*
* @param examInfo 考试信息
* @return 结果
*/
public int insertExamInfo(ExamInfo examInfo);
/**
* 修改考试信息
*
* @param examInfo 考试信息
* @return 结果
*/
public int updateExamInfo(ExamInfo examInfo);
/**
* 删除考试信息
*
* @param id 考试信息主键
* @return 结果
*/
public int deleteExamInfoById(String id);
/**
* 批量删除考试信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteExamInfoByIds(String[] ids);
}

View File

@ -0,0 +1,61 @@
package com.inspur.examine.service;
import java.util.List;
import com.inspur.examine.domain.ExamInfo;
/**
* 考试信息Service接口
*
* @author inspur
* @date 2024-05-06
*/
public interface IExamInfoService
{
/**
* 查询考试信息
*
* @param id 考试信息主键
* @return 考试信息
*/
public ExamInfo selectExamInfoById(String id);
/**
* 查询考试信息列表
*
* @param examInfo 考试信息
* @return 考试信息集合
*/
public List<ExamInfo> selectExamInfoList(ExamInfo examInfo);
/**
* 新增考试信息
*
* @param examInfo 考试信息
* @return 结果
*/
public int insertExamInfo(ExamInfo examInfo);
/**
* 修改考试信息
*
* @param examInfo 考试信息
* @return 结果
*/
public int updateExamInfo(ExamInfo examInfo);
/**
* 批量删除考试信息
*
* @param ids 需要删除的考试信息主键集合
* @return 结果
*/
public int deleteExamInfoByIds(String[] ids);
/**
* 删除考试信息信息
*
* @param id 考试信息主键
* @return 结果
*/
public int deleteExamInfoById(String id);
}

View File

@ -0,0 +1,106 @@
package com.inspur.examine.service.impl;
import java.util.List;
import java.util.Objects;
import com.inspur.common.utils.DateUtils;
import com.inspur.common.utils.SecurityUtils;
import com.inspur.common.utils.StringUtils;
import com.inspur.common.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.inspur.examine.mapper.ExamInfoMapper;
import com.inspur.examine.domain.ExamInfo;
import com.inspur.examine.service.IExamInfoService;
/**
* 考试信息Service业务层处理
*
* @author inspur
* @date 2024-05-06
*/
@Service
public class ExamInfoServiceImpl implements IExamInfoService {
@Autowired
private ExamInfoMapper examInfoMapper;
/**
* 查询考试信息
*
* @param id 考试信息主键
* @return 考试信息
*/
@Override
public ExamInfo selectExamInfoById(String id) {
return examInfoMapper.selectExamInfoById(id);
}
/**
* 查询考试信息列表
*
* @param examInfo 考试信息
* @return 考试信息
*/
@Override
public List<ExamInfo> selectExamInfoList(ExamInfo examInfo) {
List<ExamInfo> list = examInfoMapper.selectExamInfoList(examInfo);
if (StringUtils.isNotEmpty(list)){
list.forEach(item->{
if (Objects.nonNull(item.getExamDuration())){
item.setExamDurationHaveUnit(item.getExamDuration() + "分钟");
}
});
}
return list;
}
/**
* 新增考试信息
*
* @param examInfo 考试信息
* @return 结果
*/
@Override
public int insertExamInfo(ExamInfo examInfo) {
examInfo.setId(IdUtils.fastSimpleUUID());
examInfo.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
examInfo.setCreateTime(DateUtils.getNowDate());
return examInfoMapper.insertExamInfo(examInfo);
}
/**
* 修改考试信息
*
* @param examInfo 考试信息
* @return 结果
*/
@Override
public int updateExamInfo(ExamInfo examInfo) {
examInfo.setUpdateBy(String.valueOf(SecurityUtils.getUserId()));
examInfo.setUpdateTime(DateUtils.getNowDate());
return examInfoMapper.updateExamInfo(examInfo);
}
/**
* 批量删除考试信息
*
* @param ids 需要删除的考试信息主键
* @return 结果
*/
@Override
public int deleteExamInfoByIds(String[] ids) {
return examInfoMapper.deleteExamInfoByIds(ids);
}
/**
* 删除考试信息信息
*
* @param id 考试信息主键
* @return 结果
*/
@Override
public int deleteExamInfoById(String id) {
return examInfoMapper.deleteExamInfoById(id);
}
}

View File

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.inspur.examine.mapper.ExamInfoMapper">
<resultMap type="com.inspur.examine.domain.ExamInfo" id="ExamInfoResult">
<result property="id" column="id" />
<result property="examName" column="exam_name" />
<result property="examLevel" column="exam_level" />
<result property="examType" column="exam_type" />
<result property="examDuration" column="exam_duration" />
<result property="examRules" column="exam_rules" />
<result property="singleChoice" column="single_choice" />
<result property="multipleChoice" column="multiple_choice" />
<result property="judge" column="judge" />
<result property="singleChoiceScore" column="single_choice_score" />
<result property="multipleChoiceScore" column="multiple_choice_score" />
<result property="judgeScore" column="judge_score" />
<result property="totalScore" column="total_score" />
<result property="passScore" column="pass_score" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectExamInfoVo">
select id, exam_name, exam_level, exam_type, exam_duration, exam_rules, single_choice, multiple_choice, judge, single_choice_score, multiple_choice_score, judge_score, total_score, pass_score, create_by, create_time, update_by, update_time from exam_info
</sql>
<select id="selectExamInfoList" parameterType="com.inspur.examine.domain.ExamInfo" resultMap="ExamInfoResult">
<include refid="selectExamInfoVo"/>
<where>
<if test="examName != null and examName != ''"> and exam_name like concat('%', #{examName}, '%')</if>
<if test="examLevel != null and examLevel != ''"> and exam_level = #{examLevel}</if>
<if test="examType != null and examType != ''"> and exam_type = #{examType}</if>
</where>
</select>
<select id="selectExamInfoById" parameterType="String" resultMap="ExamInfoResult">
<include refid="selectExamInfoVo"/>
where id = #{id}
</select>
<insert id="insertExamInfo" parameterType="com.inspur.examine.domain.ExamInfo">
insert into exam_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="examName != null">exam_name,</if>
<if test="examLevel != null">exam_level,</if>
<if test="examType != null">exam_type,</if>
<if test="examDuration != null">exam_duration,</if>
<if test="examRules != null">exam_rules,</if>
<if test="singleChoice != null">single_choice,</if>
<if test="multipleChoice != null">multiple_choice,</if>
<if test="judge != null">judge,</if>
<if test="singleChoiceScore != null">single_choice_score,</if>
<if test="multipleChoiceScore != null">multiple_choice_score,</if>
<if test="judgeScore != null">judge_score,</if>
<if test="totalScore != null">total_score,</if>
<if test="passScore != null">pass_score,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="examName != null">#{examName},</if>
<if test="examLevel != null">#{examLevel},</if>
<if test="examType != null">#{examType},</if>
<if test="examDuration != null">#{examDuration},</if>
<if test="examRules != null">#{examRules},</if>
<if test="singleChoice != null">#{singleChoice},</if>
<if test="multipleChoice != null">#{multipleChoice},</if>
<if test="judge != null">#{judge},</if>
<if test="singleChoiceScore != null">#{singleChoiceScore},</if>
<if test="multipleChoiceScore != null">#{multipleChoiceScore},</if>
<if test="judgeScore != null">#{judgeScore},</if>
<if test="totalScore != null">#{totalScore},</if>
<if test="passScore != null">#{passScore},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateExamInfo" parameterType="com.inspur.examine.domain.ExamInfo">
update exam_info
<trim prefix="SET" suffixOverrides=",">
<if test="examName != null">exam_name = #{examName},</if>
<if test="examLevel != null">exam_level = #{examLevel},</if>
<if test="examType != null">exam_type = #{examType},</if>
<if test="examDuration != null">exam_duration = #{examDuration},</if>
<if test="examRules != null">exam_rules = #{examRules},</if>
<if test="singleChoice != null">single_choice = #{singleChoice},</if>
<if test="multipleChoice != null">multiple_choice = #{multipleChoice},</if>
<if test="judge != null">judge = #{judge},</if>
<if test="singleChoiceScore != null">single_choice_score = #{singleChoiceScore},</if>
<if test="multipleChoiceScore != null">multiple_choice_score = #{multipleChoiceScore},</if>
<if test="judgeScore != null">judge_score = #{judgeScore},</if>
<if test="totalScore != null">total_score = #{totalScore},</if>
<if test="passScore != null">pass_score = #{passScore},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteExamInfoById" parameterType="String">
delete from exam_info where id = #{id}
</delete>
<delete id="deleteExamInfoByIds" parameterType="String">
delete from exam_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -201,6 +201,7 @@
<module>inspur-knowledgeBase</module>
<module>inspur-operations</module>
<module>inspur-develop</module>
<module>inspur-examine</module>
</modules>
<packaging>pom</packaging>

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询考试信息列表
export function listExamInfo(query) {
return request({
url: '/examine/examInfo/list',
method: 'get',
params: query
})
}
// 查询考试信息详细
export function getExamInfo(id) {
return request({
url: '/examine/examInfo/' + id,
method: 'get'
})
}
// 新增考试信息
export function addExamInfo(data) {
return request({
url: '/examine/examInfo',
method: 'post',
data: data
})
}
// 修改考试信息
export function updateExamInfo(data) {
return request({
url: '/examine/examInfo',
method: 'put',
data: data
})
}
// 删除考试信息
export function delExamInfo(id) {
return request({
url: '/examine/examInfo/' + id,
method: 'delete'
})
}

View File

@ -0,0 +1,397 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="考试名称" prop="examName">
<el-input
v-model="queryParams.examName"
placeholder="请输入考试名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="考试等级" prop="examLevel">
<el-select v-model="queryParams.examLevel" placeholder="请选择考试等级" clearable>
<el-option
v-for="dict in dict.type.exam_level"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="考试类型" prop="examType">
<el-select v-model="queryParams.examType" placeholder="请选择考试类型" clearable>
<el-option
v-for="dict in dict.type.exam_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['examine:examInfo:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['examine:examInfo:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['examine:examInfo:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['examine:examInfo:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="examInfoList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="考试名称" align="center" prop="examName" />
<el-table-column label="考试等级" align="center" prop="examLevel">
<template slot-scope="scope">
<dict-tag :options="dict.type.exam_level" :value="scope.row.examLevel"/>
</template>
</el-table-column>
<el-table-column label="考试类型" align="center" prop="examType">
<template slot-scope="scope">
<dict-tag :options="dict.type.exam_type" :value="scope.row.examType"/>
</template>
</el-table-column>
<el-table-column label="考试规则" align="center" prop="examRules" />
<el-table-column label="考试时长" align="center" prop="examDurationHaveUnit" />
<el-table-column label="单选题数量" align="center" prop="singleChoice" />
<el-table-column label="多选题数量" align="center" prop="multipleChoice" />
<el-table-column label="判断题数量" align="center" prop="judge" />
<el-table-column label="单选题分数" align="center" prop="singleChoiceScore" />
<el-table-column label="多选题分数" align="center" prop="multipleChoiceScore" />
<el-table-column label="判断题分数" align="center" prop="judgeScore" />
<el-table-column label="总分数" align="center" prop="totalScore" />
<el-table-column label="通过分数" align="center" prop="passScore" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['examine:examInfo:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['examine:examInfo:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改考试信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="150px">
<el-form-item label="考试名称" prop="examName">
<el-input v-model="form.examName" placeholder="请输入考试名称" />
</el-form-item>
<el-form-item label="考试等级" prop="examLevel">
<el-select v-model="form.examLevel" placeholder="请选择考试等级">
<el-option
v-for="dict in dict.type.exam_level"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="考试类型" prop="examType">
<el-select v-model="form.examType" placeholder="请选择考试类型">
<el-option
v-for="dict in dict.type.exam_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="考试规则" prop="examRules">
<el-input v-model="form.examRules" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="考试时长(分钟)" prop="examDuration">
<el-input-number v-model="form.examDuration" :min="1"/>
</el-form-item>
<el-form-item label="单选题数量" prop="singleChoice">
<el-input-number @change="changeMark" v-model="form.singleChoice" :min="0" />
</el-form-item>
<el-form-item label="多选题数量" prop="multipleChoice">
<el-input-number @change="changeMark" v-model="form.multipleChoice" :min="0" />
</el-form-item>
<el-form-item label="判断题数量" prop="judge">
<el-input-number @change="changeMark" v-model="form.judge" :min="0" />
</el-form-item>
<el-form-item label="单选题分数" prop="singleChoiceScore">
<el-input-number @change="changeMark" v-model="form.singleChoiceScore" :precision="2" :min="0" :step="0.01"/>
</el-form-item>
<el-form-item label="多选题分数" prop="multipleChoiceScore">
<el-input-number @change="changeMark" v-model="form.multipleChoiceScore" :precision="2" :min="0" :step="0.01"/>
</el-form-item>
<el-form-item label="判断题分数" prop="judgeScore">
<el-input-number @change="changeMark" v-model="form.judgeScore" :precision="2" :min="0" :step="0.01"/>
</el-form-item>
<el-form-item label="总分数" prop="totalScore">
<span>{{form.totalScore}}</span>
</el-form-item>
<el-form-item label="通过分数" prop="passScore">
<el-input-number @change="changeMark" v-model="form.passScore" :precision="2" :min="0.01" />
</el-form-item>
</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>
<script>
import { listExamInfo, getExamInfo, delExamInfo, addExamInfo, updateExamInfo } from "@/api/examine/examInfo";
export default {
name: "ExamInfo",
dicts: ['exam_type', 'exam_level'],
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
examInfoList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
examName: null,
examLevel: null,
examType: null,
},
//
form: {},
//
rules: {
examName: [
{ required: true, message: "考试名称不能为空", trigger: "blur" }
],
examLevel: [
{ required: true, message: "考试等级不能为空", trigger: "change" }
],
examType: [
{ required: true, message: "考试类型不能为空", trigger: "change" }
],
examDuration: [
{ required: true, message: "考试时长不能为空", trigger: "blur" }
],
examRules: [
{ required: true, message: "考试规则不能为空", trigger: "blur" }
],
singleChoice: [
{ required: true, message: "单选题数量不能为空", trigger: "blur" }
],
multipleChoice: [
{ required: true, message: "多选题数量不能为空", trigger: "blur" }
],
judge: [
{ required: true, message: "判断题数量不能为空", trigger: "blur" }
],
singleChoiceScore: [
{ required: true, message: "单选题分数不能为空", trigger: "blur" }
],
multipleChoiceScore: [
{ required: true, message: "多选题分数不能为空", trigger: "blur" }
],
judgeScore: [
{ required: true, message: "判断题分数不能为空", trigger: "blur" }
],
totalScore: [
{ required: true, message: "总分数不能为空", trigger: "blur" }
],
passScore: [
{ required: true, message: "通过分数不能为空", trigger: "blur" }
],
}
};
},
created() {
this.getList();
},
methods: {
//
changeMark(){
this.form.totalScore = (this.form.singleChoice * this.form.singleChoiceScore) + (this.form.multipleChoice * this.form.multipleChoiceScore) + (this.form.judge * this.form.judgeScore);
},
/** 查询考试信息列表 */
getList() {
this.loading = true;
listExamInfo(this.queryParams).then(response => {
this.examInfoList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
examName: null,
examLevel: null,
examType: null,
examDuration: null,
examRules: null,
singleChoice: null,
multipleChoice: null,
judge: null,
singleChoiceScore: null,
multipleChoiceScore: null,
judgeScore: null,
totalScore: null,
passScore: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.form.totalScore = 0;
this.open = true;
this.title = "添加考试信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getExamInfo(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改考试信息";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateExamInfo(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addExamInfo(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除考试信息编号为"' + ids + '"的数据项?').then(function() {
return delExamInfo(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('examine/examInfo/export', {
...this.queryParams
}, `examInfo_${new Date().getTime()}.xlsx`)
}
}
};
</script>