提交代码

dev_xd
姜玉琦 2024-09-25 01:00:28 +08:00
parent b9a5b6479d
commit 0d67d70ff4
12 changed files with 413 additions and 831 deletions

View File

@ -21,13 +21,19 @@ public class BusExamInfo extends BaseEntity
private Long id;
/** 部门主键 */
@Excel(name = "部门主键")
private Long deptId;
private Long comId;
/** 单位名称 */
@Excel(name = "单位名称")
private String comName;
/** 项目主键 */
@Excel(name = "项目主键")
private Long projectId;
/** 项目名称 */
@Excel(name = "项目名称")
private String projectName;
/** 试卷名称 */
@Excel(name = "试卷名称")
private String examTitle;
@ -84,16 +90,32 @@ public class BusExamInfo extends BaseEntity
{
return id;
}
public void setDeptId(Long deptId)
{
this.deptId = deptId;
public Long getComId() {
return comId;
}
public Long getDeptId()
{
return deptId;
public void setComId(Long comId) {
this.comId = comId;
}
public void setProjectId(Long projectId)
public String getComName() {
return comName;
}
public void setComName(String comName) {
this.comName = comName;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
public void setProjectId(Long projectId)
{
this.projectId = projectId;
}
@ -216,7 +238,7 @@ public class BusExamInfo extends BaseEntity
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("deptId", getDeptId())
.append("comId", getComId())
.append("projectId", getProjectId())
.append("examTitle", getExamTitle())
.append("examType", getExamType())

View File

@ -21,13 +21,19 @@ public class BusExamQuestion extends BaseEntity
private Long id;
/** 单位主键 */
@Excel(name = "单位主键")
private Long deptId;
private Long comId;
/** 单位名称 */
@Excel(name = "单位名称")
private String comName;
/** 项目主键 */
@Excel(name = "项目主键")
private Long projectId;
/** 项目名称 */
@Excel(name = "项目名称")
private String projectName;
/** 工种类型 */
@Excel(name = "工种类型")
private String craftType;
@ -68,16 +74,32 @@ public class BusExamQuestion extends BaseEntity
{
return id;
}
public void setDeptId(Long deptId)
{
this.deptId = deptId;
public Long getComId() {
return comId;
}
public Long getDeptId()
{
return deptId;
public void setComId(Long comId) {
this.comId = comId;
}
public void setProjectId(Long projectId)
public String getComName() {
return comName;
}
public void setComName(String comName) {
this.comName = comName;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
public void setProjectId(Long projectId)
{
this.projectId = projectId;
}
@ -164,7 +186,7 @@ public class BusExamQuestion extends BaseEntity
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("deptId", getDeptId())
.append("comId", getComId())
.append("projectId", getProjectId())
.append("craftType", getCraftType())
.append("craftPost", getCraftPost())

View File

@ -22,17 +22,17 @@ public class BusExamQuestionResult extends BaseEntity
@Excel(name = "问题主键")
private Long questionId;
/** 选项 */
@Excel(name = "选项")
/** 答案选项 */
@Excel(name = "答案选项")
private String opt;
/** 问题选项 */
@Excel(name = "问题选项")
/** 答案描述 */
@Excel(name = "答案描述")
private String result;
/** 是否删除 */
@Excel(name = "是否删除")
private Long isDel;
/** 是否正确 */
@Excel(name = "是否正确")
private Long isOk;
public void setId(Long id)
{
@ -70,14 +70,13 @@ public class BusExamQuestionResult extends BaseEntity
{
return result;
}
public void setIsDel(Long isDel)
{
this.isDel = isDel;
public Long getIsOk() {
return isOk;
}
public Long getIsDel()
{
return isDel;
public void setIsOk(Long isOk) {
this.isOk = isOk;
}
@Override
@ -87,7 +86,7 @@ public class BusExamQuestionResult extends BaseEntity
.append("questionId", getQuestionId())
.append("opt", getOpt())
.append("result", getResult())
.append("isDel", getIsDel())
.append("isOk", getIsOk())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())

View File

@ -6,8 +6,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="BusExamInfo" id="BusExamInfoResult">
<result property="id" column="id" />
<result property="deptId" column="dept_id" />
<result property="comId" column="com_id" />
<result property="comName" column="com_name" />
<result property="projectId" column="project_id" />
<result property="projectName" column="project_name" />
<result property="examTitle" column="exam_title" />
<result property="examType" column="exam_type" />
<result property="craftType" column="craft_type" />
@ -38,32 +40,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectBusExamInfoVo">
select id, dept_id, project_id, exam_title, exam_type, craft_type, craft_post, single_num, multiple_num, estimate_num, full_mark, pass_mark, use_number, is_del, create_by, create_time, update_by, update_time, remark from bus_exam_info
select bei.id, bei.com_id, sd.dept_name as com_name, bei.project_id, pi.project_name, bei.exam_title, bei.exam_type, bei.craft_type, bei.craft_post, bei.single_num, bei.multiple_num, bei.estimate_num, bei.full_mark, bei.pass_mark, bei.use_number, bei.is_del, bei.create_by, bei.create_time, bei.update_by, bei.update_time, bei.remark from bus_exam_info bei
left join pro_project_info pi on pi.id = bei.project_id
left join sys_dept sd on sd.dept_id = pi.com_id
</sql>
<select id="selectBusExamInfoList" parameterType="BusExamInfo" resultMap="BusExamInfoResult">
<include refid="selectBusExamInfoVo"/>
<where>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="projectId != null "> and project_id = #{projectId}</if>
<if test="examTitle != null and examTitle != ''"> and exam_title = #{examTitle}</if>
<if test="examType != null and examType != ''"> and exam_type = #{examType}</if>
<if test="craftType != null and craftType != ''"> and craft_type = #{craftType}</if>
<if test="craftPost != null and craftPost != ''"> and craft_post = #{craftPost}</if>
<if test="singleNum != null and singleNum != ''"> and single_num = #{singleNum}</if>
<if test="multipleNum != null and multipleNum != ''"> and multiple_num = #{multipleNum}</if>
<if test="estimateNum != null and estimateNum != ''"> and estimate_num = #{estimateNum}</if>
<if test="fullMark != null "> and full_mark = #{fullMark}</if>
<if test="passMark != null "> and pass_mark = #{passMark}</if>
<if test="useNumber != null "> and use_number = #{useNumber}</if>
<if test="isDel != null "> and is_del = #{isDel}</if>
<where>
bei.is_del != 2
<if test="comId != null "> and bei.com_id = #{comId}</if>
<if test="projectId != null "> and bei.project_id = #{projectId}</if>
<if test="examTitle != null and examTitle != ''"> and bei.exam_title = #{examTitle}</if>
<if test="examType != null and examType != ''"> and bei.exam_type = #{examType}</if>
<if test="craftType != null and craftType != ''"> and bei.craft_type = #{craftType}</if>
<if test="craftPost != null and craftPost != ''"> and bei.craft_post = #{craftPost}</if>
</where>
order by bei.id desc
</select>
<select id="selectBusExamInfoById" parameterType="Long" resultMap="BusExamInfoBusExamInfoQuesResult">
select a.id, a.dept_id, a.project_id, a.exam_title, a.exam_type, a.craft_type, a.craft_post, a.single_num, a.multiple_num, a.estimate_num, a.full_mark, a.pass_mark, a.use_number, a.is_del, a.create_by, a.create_time, a.update_by, a.update_time, a.remark,
select a.id, a.com_id, sd.dept_name as com_name, a.project_id, pi.project_name, a.exam_title, a.exam_type, a.craft_type, a.craft_post, a.single_num, a.multiple_num, a.estimate_num, a.full_mark, a.pass_mark, a.use_number, a.is_del, a.create_by, a.create_time, a.update_by, a.update_time, a.remark,
b.exam_id as sub_exam_id, b.question_id as sub_question_id, b.marks as sub_marks, b.sort_by as sub_sort_by
from bus_exam_info a
left join pro_project_info pi on pi.id = a.project_id
left join sys_dept sd on sd.dept_id = pi.com_id
left join bus_exam_info_ques b on b.exam_id = a.id
where a.id = #{id}
</select>
@ -71,7 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertBusExamInfo" parameterType="BusExamInfo" useGeneratedKeys="true" keyProperty="id">
insert into bus_exam_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="deptId != null">dept_id,</if>
<if test="comId != null">com_id,</if>
<if test="projectId != null">project_id,</if>
<if test="examTitle != null">exam_title,</if>
<if test="examType != null">exam_type,</if>
@ -91,7 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deptId != null">#{deptId},</if>
<if test="comId != null">#{comId},</if>
<if test="projectId != null">#{projectId},</if>
<if test="examTitle != null">#{examTitle},</if>
<if test="examType != null">#{examType},</if>
@ -115,7 +116,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateBusExamInfo" parameterType="BusExamInfo">
update bus_exam_info
<trim prefix="SET" suffixOverrides=",">
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="comId != null">com_id = #{comId},</if>
<if test="projectId != null">project_id = #{projectId},</if>
<if test="examTitle != null">exam_title = #{examTitle},</if>
<if test="examType != null">exam_type = #{examType},</if>

View File

@ -6,8 +6,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="BusExamQuestion" id="BusExamQuestionResult">
<result property="id" column="id" />
<result property="deptId" column="dept_id" />
<result property="comId" column="com_id" />
<result property="comName" column="com_name" />
<result property="projectId" column="project_id" />
<result property="projectName" column="project_name" />
<result property="craftType" column="craft_type" />
<result property="craftPost" column="craft_post" />
<result property="questionDiff" column="question_diff" />
@ -31,7 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="questionId" column="sub_question_id" />
<result property="opt" column="sub_opt" />
<result property="result" column="sub_result" />
<result property="isDel" column="sub_is_del" />
<result property="isOk" column="sub_is_ok" />
<result property="createBy" column="sub_create_by" />
<result property="createTime" column="sub_create_time" />
<result property="updateBy" column="sub_update_by" />
@ -40,28 +42,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectBusExamQuestionVo">
select id, dept_id, project_id, craft_type, craft_post, question_diff, question_type, question_desc, question_answer, is_del, create_by, create_time, update_by, update_time, remark from bus_exam_question
select beq.id, beq.com_id, sd.dept_name as com_name, beq.project_id, pi.project_name, beq.craft_type, beq.craft_post, beq.question_diff, beq.question_type, beq.question_desc, beq.question_answer, beq.is_del, beq.create_by, beq.create_time, beq.update_by, beq.update_time, beq.remark from bus_exam_question beq
left join pro_project_info pi on pi.id = beq.project_id
left join sys_dept sd on sd.dept_id = pi.com_id
</sql>
<select id="selectBusExamQuestionList" parameterType="BusExamQuestion" resultMap="BusExamQuestionResult">
<include refid="selectBusExamQuestionVo"/>
<where>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="projectId != null "> and project_id = #{projectId}</if>
<if test="craftType != null and craftType != ''"> and craft_type = #{craftType}</if>
<if test="craftPost != null and craftPost != ''"> and craft_post = #{craftPost}</if>
<if test="questionDiff != null "> and question_diff = #{questionDiff}</if>
<if test="questionType != null "> and question_type = #{questionType}</if>
<if test="questionDesc != null and questionDesc != ''"> and question_desc = #{questionDesc}</if>
<if test="questionAnswer != null and questionAnswer != ''"> and question_answer = #{questionAnswer}</if>
<if test="isDel != null "> and is_del = #{isDel}</if>
<where>
and beq.is_del != 2
<if test="comId != null "> and (beq.com_id = #{comId} or beq.com_id is null)</if>
<if test="projectId != null "> and (beq.project_id = #{projectId} or beq.project_id is null)</if>
<if test="activeComId != null "> and (beq.com_id = #{activeComId} or beq.com_id is null)</if>
<if test="activeProjectId != null "> and (beq.project_id = #{activeProjectId} or beq.project_id is null)</if>
<if test="craftType != null and craftType != ''"> and beq.craft_type = #{craftType}</if>
<if test="craftPost != null and craftPost != ''"> and find_in_set(#{craftPost}, beq.craft_post)</if>
<if test="questionDiff != null "> and beq.question_diff = #{questionDiff} </if>
<if test="questionType != null "> and beq.question_type = #{questionType} </if>
<if test="questionDesc != null and questionDesc != ''"> and beq.question_desc = #{questionDesc}</if>
<if test="questionAnswer != null and questionAnswer != ''"> and beq.question_answer = #{questionAnswer}</if>
</where>
order by beq.id desc
</select>
<select id="selectBusExamQuestionById" parameterType="Long" resultMap="BusExamQuestionBusExamQuestionResultResult">
select a.id, a.dept_id, a.project_id, a.craft_type, a.craft_post, a.question_diff, a.question_type, a.question_desc, a.question_answer, a.is_del, a.create_by, a.create_time, a.update_by, a.update_time, a.remark,
b.id as sub_id, b.question_id as sub_question_id, b.opt as sub_opt, b.result as sub_result, b.is_del as sub_is_del, b.create_by as sub_create_by, b.create_time as sub_create_time, b.update_by as sub_update_by, b.update_time as sub_update_time, b.remark as sub_remark
select a.id, a.com_id, sd.dept_name as com_name, a.project_id, pi.project_name, a.craft_type, a.craft_post, a.question_diff, a.question_type, a.question_desc, a.question_answer, a.is_del, a.create_by, a.create_time, a.update_by, a.update_time, a.remark,
b.id as sub_id, b.question_id as sub_question_id, b.opt as sub_opt, b.result as sub_result, b.is_ok as sub_is_ok, b.create_by as sub_create_by, b.create_time as sub_create_time, b.update_by as sub_update_by, b.update_time as sub_update_time, b.remark as sub_remark
from bus_exam_question a
left join pro_project_info pi on pi.id = a.project_id
left join sys_dept sd on sd.dept_id = pi.com_id
left join bus_exam_question_result b on b.question_id = a.id
where a.id = #{id}
</select>
@ -69,7 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertBusExamQuestion" parameterType="BusExamQuestion" useGeneratedKeys="true" keyProperty="id">
insert into bus_exam_question
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="deptId != null">dept_id,</if>
<if test="comId != null">com_id,</if>
<if test="projectId != null">project_id,</if>
<if test="craftType != null">craft_type,</if>
<if test="craftPost != null">craft_post,</if>
@ -85,7 +94,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deptId != null">#{deptId},</if>
<if test="comId != null">#{comId},</if>
<if test="projectId != null">#{projectId},</if>
<if test="craftType != null">#{craftType},</if>
<if test="craftPost != null">#{craftPost},</if>
@ -105,7 +114,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateBusExamQuestion" parameterType="BusExamQuestion">
update bus_exam_question
<trim prefix="SET" suffixOverrides=",">
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="comId != null">com_id = #{comId},</if>
<if test="projectId != null">project_id = #{projectId},</if>
<if test="craftType != null">craft_type = #{craftType},</if>
<if test="craftPost != null">craft_post = #{craftPost},</if>
@ -123,12 +132,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</update>
<delete id="deleteBusExamQuestionById" parameterType="Long">
delete from bus_exam_question where id = #{id}
</delete>
<update id="deleteBusExamQuestionById" parameterType="Long">
update bus_exam_question set is_del=2 where id = #{id}
</update>
<delete id="deleteBusExamQuestionByIds" parameterType="String">
delete from bus_exam_question where id in
update bus_exam_question set is_del=2 where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
@ -146,9 +155,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<insert id="batchBusExamQuestionResult">
insert into bus_exam_question_result( id, question_id, opt, result, is_del, create_by, create_time, update_by, update_time, remark) values
insert into bus_exam_question_result( id, question_id, opt, result, is_ok, create_by, create_time, update_by, update_time) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.id}, #{item.questionId}, #{item.opt}, #{item.result}, #{item.isDel}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.remark})
( #{item.id}, #{item.questionId}, #{item.opt}, #{item.result}, #{item.isOk}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime})
</foreach>
</insert>
</mapper>

View File

@ -9,7 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="questionId" column="question_id" />
<result property="opt" column="opt" />
<result property="result" column="result" />
<result property="isDel" column="is_del" />
<result property="isOk" column="is_ok" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
@ -18,7 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectBusExamQuestionResultVo">
select id, question_id, opt, result, is_del, create_by, create_time, update_by, update_time, remark from bus_exam_question_result
select id, question_id, opt, result, is_ok, create_by, create_time, update_by, update_time, remark from bus_exam_question_result
</sql>
<select id="selectBusExamQuestionResultList" parameterType="BusExamQuestionResult" resultMap="BusExamQuestionResultResult">
@ -27,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="questionId != null "> and question_id = #{questionId}</if>
<if test="opt != null and opt != ''"> and opt = #{opt}</if>
<if test="result != null and result != ''"> and result like concat('%', #{result}, '%')</if>
<if test="isDel != null "> and is_del = #{isDel}</if>
<if test="isOk != null "> and is_ok = #{isOk}</if>
</where>
</select>
@ -42,7 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="questionId != null">question_id,</if>
<if test="opt != null">opt,</if>
<if test="result != null">result,</if>
<if test="isDel != null">is_del,</if>
<if test="isOk != null">is_ok,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
@ -53,7 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="questionId != null">#{questionId},</if>
<if test="opt != null">#{opt},</if>
<if test="result != null">#{result},</if>
<if test="isDel != null">#{isDel},</if>
<if test="isOk != null">#{isOk},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
@ -68,7 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="questionId != null">question_id = #{questionId},</if>
<if test="opt != null">opt = #{opt},</if>
<if test="result != null">result = #{result},</if>
<if test="isDel != null">is_del = #{isDel},</if>
<if test="isOk != null">is_ok = #{isOk},</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>

View File

@ -1,98 +0,0 @@
package com.yanzhu.manage.controller;
import com.yanzhu.common.core.utils.poi.ExcelUtil;
import com.yanzhu.common.core.web.controller.BaseController;
import com.yanzhu.common.core.web.domain.AjaxResult;
import com.yanzhu.common.core.web.page.TableDataInfo;
import com.yanzhu.common.log.annotation.Log;
import com.yanzhu.common.log.enums.BusinessType;
import com.yanzhu.common.security.annotation.RequiresPermissions;
import com.yanzhu.manage.domain.BusExamInfoQues;
import com.yanzhu.manage.service.IBusExamInfoQuesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* Controller
*
* @author JiangYuQi
* @date 2024-08-25
*/
@RestController
@RequestMapping("/busExamInfoQues")
public class BusExamInfoQuesController extends BaseController
{
@Autowired
private IBusExamInfoQuesService busExamInfoQuesService;
/**
*
*/
@RequiresPermissions("manage:busExamInfoQues:list")
@GetMapping("/list")
public TableDataInfo list(BusExamInfoQues busExamInfoQues)
{
startPage();
List<BusExamInfoQues> list = busExamInfoQuesService.selectBusExamInfoQuesList(busExamInfoQues);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("manage:busExamInfoQues:export")
@Log(title = "试卷问题", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BusExamInfoQues busExamInfoQues)
{
List<BusExamInfoQues> list = busExamInfoQuesService.selectBusExamInfoQuesList(busExamInfoQues);
ExcelUtil<BusExamInfoQues> util = new ExcelUtil<BusExamInfoQues>(BusExamInfoQues.class);
util.exportExcel(response, list, "试卷问题数据");
}
/**
*
*/
@RequiresPermissions("manage:busExamInfoQues:query")
@GetMapping(value = "/{examId}")
public AjaxResult getInfo(@PathVariable("examId") Long examId)
{
return success(busExamInfoQuesService.selectBusExamInfoQuesByExamId(examId));
}
/**
*
*/
@RequiresPermissions("manage:busExamInfoQues:add")
@Log(title = "试卷问题", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BusExamInfoQues busExamInfoQues)
{
return toAjax(busExamInfoQuesService.insertBusExamInfoQues(busExamInfoQues));
}
/**
*
*/
@RequiresPermissions("manage:busExamInfoQues:edit")
@Log(title = "试卷问题", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BusExamInfoQues busExamInfoQues)
{
return toAjax(busExamInfoQuesService.updateBusExamInfoQues(busExamInfoQues));
}
/**
*
*/
@RequiresPermissions("manage:busExamInfoQues:remove")
@Log(title = "试卷问题", businessType = BusinessType.DELETE)
@DeleteMapping("/{examIds}")
public AjaxResult remove(@PathVariable Long[] examIds)
{
return toAjax(busExamInfoQuesService.deleteBusExamInfoQuesByExamIds(examIds));
}
}

View File

@ -1,98 +0,0 @@
package com.yanzhu.manage.controller;
import com.yanzhu.common.core.utils.poi.ExcelUtil;
import com.yanzhu.common.core.web.controller.BaseController;
import com.yanzhu.common.core.web.domain.AjaxResult;
import com.yanzhu.common.core.web.page.TableDataInfo;
import com.yanzhu.common.log.annotation.Log;
import com.yanzhu.common.log.enums.BusinessType;
import com.yanzhu.common.security.annotation.RequiresPermissions;
import com.yanzhu.manage.domain.BusExamQuestionResult;
import com.yanzhu.manage.service.IBusExamQuestionResultService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* Controller
*
* @author JiangYuQi
* @date 2024-08-25
*/
@RestController
@RequestMapping("/busExamQuestionResult")
public class BusExamQuestionResultController extends BaseController
{
@Autowired
private IBusExamQuestionResultService busExamQuestionResultService;
/**
*
*/
@RequiresPermissions("manage:busExamQuestionResult:list")
@GetMapping("/list")
public TableDataInfo list(BusExamQuestionResult busExamQuestionResult)
{
startPage();
List<BusExamQuestionResult> list = busExamQuestionResultService.selectBusExamQuestionResultList(busExamQuestionResult);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("manage:busExamQuestionResult:export")
@Log(title = "题库问题", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BusExamQuestionResult busExamQuestionResult)
{
List<BusExamQuestionResult> list = busExamQuestionResultService.selectBusExamQuestionResultList(busExamQuestionResult);
ExcelUtil<BusExamQuestionResult> util = new ExcelUtil<BusExamQuestionResult>(BusExamQuestionResult.class);
util.exportExcel(response, list, "题库问题数据");
}
/**
*
*/
@RequiresPermissions("manage:busExamQuestionResult:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(busExamQuestionResultService.selectBusExamQuestionResultById(id));
}
/**
*
*/
@RequiresPermissions("manage:busExamQuestionResult:add")
@Log(title = "题库问题", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BusExamQuestionResult busExamQuestionResult)
{
return toAjax(busExamQuestionResultService.insertBusExamQuestionResult(busExamQuestionResult));
}
/**
*
*/
@RequiresPermissions("manage:busExamQuestionResult:edit")
@Log(title = "题库问题", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BusExamQuestionResult busExamQuestionResult)
{
return toAjax(busExamQuestionResultService.updateBusExamQuestionResult(busExamQuestionResult));
}
/**
*
*/
@RequiresPermissions("manage:busExamQuestionResult:remove")
@Log(title = "题库问题", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(busExamQuestionResultService.deleteBusExamQuestionResultByIds(ids));
}
}

View File

@ -1,8 +1,13 @@
package com.yanzhu.manage.service.impl;
import java.util.List;
import com.yanzhu.common.core.constant.CacheConstants;
import com.yanzhu.common.core.utils.DateUtils;
import com.yanzhu.common.core.utils.StringUtils;
import com.yanzhu.common.redis.service.RedisService;
import com.yanzhu.common.security.utils.SecurityUtils;
import com.yanzhu.manage.domain.ProProjectInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
@ -21,6 +26,9 @@ import com.yanzhu.manage.service.IBusExamQuestionService;
@Service
public class BusExamQuestionServiceImpl implements IBusExamQuestionService
{
@Autowired
private RedisService redisService;
@Autowired
private BusExamQuestionMapper busExamQuestionMapper;
@ -45,6 +53,8 @@ public class BusExamQuestionServiceImpl implements IBusExamQuestionService
@Override
public List<BusExamQuestion> selectBusExamQuestionList(BusExamQuestion busExamQuestion)
{
busExamQuestion.setActiveComId(SecurityUtils.getLoginUser().getProjectDeptId());
busExamQuestion.setActiveProjectId(SecurityUtils.getLoginUser().getProjectId());
return busExamQuestionMapper.selectBusExamQuestionList(busExamQuestion);
}
@ -58,7 +68,11 @@ public class BusExamQuestionServiceImpl implements IBusExamQuestionService
@Override
public int insertBusExamQuestion(BusExamQuestion busExamQuestion)
{
ProProjectInfo info = redisService.getCacheObject(CacheConstants.PRO_PROJECT+busExamQuestion.getProjectId());
busExamQuestion.setComId(info.getComId());
busExamQuestion.setCreateBy(SecurityUtils.getUsername());
busExamQuestion.setCreateTime(DateUtils.getNowDate());
busExamQuestion.setUpdateTime(DateUtils.getNowDate());
int rows = busExamQuestionMapper.insertBusExamQuestion(busExamQuestion);
insertBusExamQuestionResult(busExamQuestion);
return rows;

View File

@ -1,18 +1,10 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="部门主键" prop="deptId">
<el-form-item label="项目名称" prop="projectName" v-if="!userStore.currentProId">
<el-input
v-model="queryParams.deptId"
placeholder="请输入部门主键"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="项目主键" prop="projectId">
<el-input
v-model="queryParams.projectId"
placeholder="请输入项目主键"
v-model="queryParams.projectName"
placeholder="请输入项目名称"
clearable
@keyup.enter="handleQuery"
/>
@ -45,64 +37,6 @@
/>
</el-select>
</el-form-item>
<el-form-item label="单选题数量" prop="singleNum">
<el-input
v-model="queryParams.singleNum"
placeholder="请输入单选题数量"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="多选题数量" prop="multipleNum">
<el-input
v-model="queryParams.multipleNum"
placeholder="请输入多选题数量"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="判断题数量" prop="estimateNum">
<el-input
v-model="queryParams.estimateNum"
placeholder="请输入判断题数量"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="试卷分数" prop="fullMark">
<el-input
v-model="queryParams.fullMark"
placeholder="请输入试卷分数"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="通过分数" prop="passMark">
<el-input
v-model="queryParams.passMark"
placeholder="请输入通过分数"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="答题次数" prop="useNumber">
<el-input
v-model="queryParams.useNumber"
placeholder="请输入答题次数"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="删除标识" prop="isDel">
<el-select v-model="queryParams.isDel" placeholder="请选择删除标识" clearable>
<el-option
v-for="dict in sys_is_del"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery"></el-button>
<el-button icon="Refresh" @click="resetQuery"></el-button>
@ -153,11 +87,10 @@
<el-table v-loading="loading" :data="busExamInfoList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键" align="center" prop="id" />
<el-table-column label="部门主键" align="center" prop="deptId" />
<el-table-column label="项目主键" align="center" prop="projectId" />
<el-table-column label="试卷编号" align="center" prop="id" />
<el-table-column label="所属公司" align="center" prop="comName" />
<el-table-column label="项目名称" align="center" prop="projectName" />
<el-table-column label="试卷名称" align="center" prop="examTitle" />
<el-table-column label="试卷类型" align="center" prop="examType" />
<el-table-column label="工种类型" align="center" prop="craftType">
<template #default="scope">
<dict-tag :options="pro_craft_type" :value="scope.row.craftType"/>
@ -174,16 +107,24 @@
<el-table-column label="试卷分数" align="center" prop="fullMark" />
<el-table-column label="通过分数" align="center" prop="passMark" />
<el-table-column label="答题次数" align="center" prop="useNumber" />
<el-table-column label="删除标识" align="center" prop="isDel">
<el-table-column label="是否启用" align="center" prop="isDel">
<template #default="scope">
<dict-tag :options="sys_is_del" :value="scope.row.isDel"/>
<el-tooltip :content="scope.row.isDel == 0 ? '启用' : '停用'" placement="top">
<el-switch
:active-value="parseInt(0)"
:inactive-value="parseInt(1)"
v-model="scope.row.isDel"
:disabled="scope.row.disabledState"
@change="setStatus($event, scope.row)"
/>
</el-tooltip>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<el-table-column label="操作" fixed="right" width="150" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['manage:busExamInfo:edit']"></el-button>
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['manage:busExamInfo:remove']"></el-button>
<el-button v-if="!scope.row.disabledState" link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['manage:busExamInfo:edit']"></el-button>
<el-button v-if="!scope.row.disabledState" link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['manage:busExamInfo:remove']"></el-button>
<el-button v-if="scope.row.disabledState" type="danger" link disabled>-</el-button>
</template>
</el-table-column>
</el-table>
@ -197,19 +138,16 @@
/>
<!-- 添加或修改基础试卷对话框 -->
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
<el-dialog :title="title" v-model="open" width="680px" append-to-body>
<el-form ref="busExamInfoRef" :model="form" :rules="rules" label-width="80px">
<el-form-item label="部门主键" prop="deptId">
<el-input v-model="form.deptId" placeholder="请输入部门主键" />
</el-form-item>
<el-form-item label="项目主键" prop="projectId">
<el-input v-model="form.projectId" placeholder="请输入项目主键" />
<el-form-item label="项目名称" v-if="form.projectId">
<el-tag effect="plain">{{ form.projectName }}</el-tag>
</el-form-item>
<el-form-item label="试卷名称" prop="examTitle">
<el-input v-model="form.examTitle" placeholder="请输入试卷名称" />
<el-input v-model="form.examTitle" placeholder="请输入试卷名称" maxlength="64" show-word-limit/>
</el-form-item>
<el-form-item label="工种类型" prop="craftType">
<el-select v-model="form.craftType" placeholder="请选择工种类型">
<el-select v-model="form.craftType" placeholder="请选择工种类型" style="width:100%">
<el-option
v-for="dict in pro_craft_type"
:key="dict.value"
@ -219,7 +157,7 @@
</el-select>
</el-form-item>
<el-form-item label="工种岗位" prop="craftPost">
<el-select v-model="form.craftPost" placeholder="请选择工种岗位">
<el-select v-model="form.craftPost" placeholder="请选择工种岗位" style="width:100%">
<el-option
v-for="dict in pro_craft_post"
:key="dict.value"
@ -228,38 +166,18 @@
></el-option>
</el-select>
</el-form-item>
<el-form-item label="单选题数量" prop="singleNum">
<el-input v-model="form.singleNum" placeholder="请输入单选题数量" />
<el-form-item label="合格分数" prop="passMark">
<el-input v-model.number="form.passMark" placeholder="请输入合格分数" />
</el-form-item>
<el-form-item label="多选题数量" prop="multipleNum">
<el-input v-model="form.multipleNum" placeholder="请输入多选题数量" />
</el-form-item>
<el-form-item label="判断题数量" prop="estimateNum">
<el-input v-model="form.estimateNum" placeholder="请输入判断题数量" />
</el-form-item>
<el-form-item label="试卷分数" prop="fullMark">
<el-input v-model="form.fullMark" placeholder="请输入试卷分数" />
</el-form-item>
<el-form-item label="通过分数" prop="passMark">
<el-input v-model="form.passMark" placeholder="请输入通过分数" />
</el-form-item>
<el-form-item label="答题次数" prop="useNumber">
<el-input v-model="form.useNumber" placeholder="请输入答题次数" />
</el-form-item>
<el-form-item label="删除标识" prop="isDel">
<el-select v-model="form.isDel" placeholder="请选择删除标识">
<el-option
v-for="dict in sys_is_del"
:key="dict.value"
:label="dict.label"
:value="parseInt(dict.value)"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item>
<el-divider content-position="center">试卷问题信息</el-divider>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
<!-- <el-divider content-position="center">试卷问题信息</el-divider>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" icon="Plus" @click="handleAddBusExamInfoQues"></el-button>
@ -267,8 +185,8 @@
<el-col :span="1.5">
<el-button type="danger" icon="Delete" @click="handleDeleteBusExamInfoQues"></el-button>
</el-col>
</el-row>
<el-table :data="busExamInfoQuesList" :row-class-name="rowBusExamInfoQuesIndex" @selection-change="handleBusExamInfoQuesSelectionChange" ref="busExamInfoQues">
</el-row> -->
<!-- <el-table :data="busExamInfoQuesList" :row-class-name="rowBusExamInfoQuesIndex" @selection-change="handleBusExamInfoQuesSelectionChange" ref="busExamInfoQues">
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="序号" align="center" prop="index" width="50"/>
<el-table-column label="问题主键" prop="questionId" width="150">
@ -286,24 +204,18 @@
<el-input v-model="scope.row.sortBy" placeholder="请输入排序" />
</template>
</el-table-column>
</el-table>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
</el-table> -->
</div>
</template>
<script setup name="BusExamInfo">
import { listBusExamInfo, getBusExamInfo, delBusExamInfo, addBusExamInfo, updateBusExamInfo } from "@/api/manage/busExamInfo";
import useUserStore from '@/store/modules/user'
const { proxy } = getCurrentInstance();
const { pro_craft_type, sys_is_del, pro_craft_post } = proxy.useDict('pro_craft_type', 'sys_is_del', 'pro_craft_post');
const userStore = useUserStore()
const busExamInfoList = ref([]);
const busExamInfoQuesList = ref([]);
const open = ref(false);
@ -321,21 +233,19 @@ const data = reactive({
queryParams: {
pageNum: 1,
pageSize: 10,
deptId: null,
projectId: null,
projectName: null,
examTitle: null,
examType: null,
craftType: null,
craftPost: null,
singleNum: null,
multipleNum: null,
estimateNum: null,
fullMark: null,
passMark: null,
useNumber: null,
isDel: null,
},
rules: {
examTitle: [{ required: true, message: "试卷名称不能为空", trigger: "blur" }],
craftType: [{ required: true, message: "工种类型不能为空", trigger: "change" }],
craftPost: [{ required: true, message: "工种岗位不能为空", trigger: "change" }],
passMark: [
{ required: true, message: "合格分数不能为空", trigger: "blur" },
{ type: "number", message: "请输入数字类型", trigger: "blur" },
]
}
});
@ -345,6 +255,9 @@ const { queryParams, form, rules } = toRefs(data);
function getList() {
loading.value = true;
listBusExamInfo(queryParams.value).then(response => {
response.rows.forEach(item => {
item.disabledState = initRowDisabled(item);
})
busExamInfoList.value = response.rows;
total.value = response.total;
loading.value = false;
@ -405,7 +318,13 @@ function handleSelectionChange(selection) {
/** 新增按钮操作 */
function handleAdd() {
if(!userStore.currentProId){
proxy.$modal.msgWarning("请切换到项目数据!!!");
return false;
}
reset();
form.value.projectId = userStore.currentProId;
form.value.projectName = userStore.currentProName;
open.value = true;
title.value = "添加基础试卷";
}
@ -444,6 +363,28 @@ function submitForm() {
});
}
/** 启用状态滑块控制 */
function setStatus(val, row) {
proxy.$modal
.confirm(`是否确认${val == 0 ? "启用" : "停用"}当前数据项?`)
.then(function () {
let param = {'id': row.id, 'isDel': val};
return updateBusExamInfo(param);
})
.then(() => {
getList();
proxy.$modal.msgSuccess("修改成功");
})
.catch(() => {
//
if (val == 0) {
row.isDel = 1;
} else {
row.isDel = 0;
}
});
}
/** 删除按钮操作 */
function handleDelete(row) {
const _ids = row.id || ids.value;
@ -494,5 +435,30 @@ function handleExport() {
}, `busExamInfo_${new Date().getTime()}.xlsx`)
}
/** 初始化行标识 */
function initRowDisabled(row) {
let roles = userStore.roles;
if(roles.includes("admin")){
return false;
}else if(roles.includes("gsAdmin") && row.comId){
return false;
}else if(row.projectId){
return false;
}else{
return true;
}
}
getList();
</script>
<style lang="scss" scope>
.gap-2{
.el-tag--default{
margin:3px 4px;
}
}
.el-divider__text{
color: #409eff;
font-weight: 800;
}
</style>

View File

@ -1,18 +1,18 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="单位主键" prop="deptId">
<el-form-item label="项目名称" prop="projectName" v-if="!userStore.currentProId">
<el-input
v-model="queryParams.deptId"
placeholder="请输入单位主键"
v-model="queryParams.projectName"
placeholder="请输入项目名称"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="项目主键" prop="projectId">
<el-form-item label="问题描述" prop="questionDesc">
<el-input
v-model="queryParams.projectId"
placeholder="请输入项目主键"
v-model="queryParams.questionDesc"
placeholder="请输入问题描述"
clearable
@keyup.enter="handleQuery"
/>
@ -37,16 +37,6 @@
/>
</el-select>
</el-form-item>
<el-form-item label="问题难度" prop="questionDiff">
<el-select v-model="queryParams.questionDiff" placeholder="请选择问题难度" clearable>
<el-option
v-for="dict in edu_question_diff"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="问题类型" prop="questionType">
<el-select v-model="queryParams.questionType" placeholder="请选择问题类型" clearable>
<el-option
@ -57,32 +47,6 @@
/>
</el-select>
</el-form-item>
<el-form-item label="问题描述" prop="questionDesc">
<el-input
v-model="queryParams.questionDesc"
placeholder="请输入问题描述"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="问题答案" prop="questionAnswer">
<el-input
v-model="queryParams.questionAnswer"
placeholder="请输入问题答案"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="是否删除" prop="isDel">
<el-select v-model="queryParams.isDel" placeholder="请选择是否删除" clearable>
<el-option
v-for="dict in sys_is_del"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery"></el-button>
<el-button icon="Refresh" @click="resetQuery"></el-button>
@ -133,40 +97,57 @@
<el-table v-loading="loading" :data="busExamQuestionList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键" align="center" prop="id" />
<el-table-column label="单位主键" align="center" prop="deptId" />
<el-table-column label="项目主键" align="center" prop="projectId" />
<el-table-column label="工种类型" align="center" prop="craftType">
<el-table-column label="问题编号" align="center" prop="id" width="80"/>
<el-table-column label="所属公司" align="center" prop="comName" />
<el-table-column label="项目名称" align="center" prop="projectName" />
<el-table-column label="问题描述" align="center" prop="questionDesc" width="200"/>
<el-table-column label="工种类型" align="center" prop="craftType" width="100">
<template #default="scope">
<dict-tag :options="pro_craft_type" :value="scope.row.craftType"/>
</template>
</el-table-column>
<el-table-column label="工种岗位" align="center" prop="craftPost">
<el-table-column label="工种岗位" align="center" prop="craftPost" width="250">
<template #default="scope">
<dict-tag :options="pro_craft_post" :value="scope.row.craftPost"/>
<div class="flex gap-2">
<el-tag
v-for="dict in pro_craft_post"
v-show="scope.row.craftPost.indexOf(dict.value)>-1"
effect="dark"
>
{{ dict.label }}
</el-tag>
</div>
</template>
</el-table-column>
<el-table-column label="问题难度" align="center" prop="questionDiff">
<template #default="scope">
<dict-tag :options="edu_question_diff" :value="scope.row.questionDiff"/>
</template>
</el-table-column>
<el-table-column label="问题类型" align="center" prop="questionType">
<el-table-column label="问题类型" align="center" prop="questionType" width="80">
<template #default="scope">
<dict-tag :options="edu_question_type" :value="scope.row.questionType"/>
</template>
</el-table-column>
<el-table-column label="问题描述" align="center" prop="questionDesc" />
<el-table-column label="问题答案" align="center" prop="questionAnswer" />
<el-table-column label="是否删除" align="center" prop="isDel">
<el-table-column label="是否启用" align="center" prop="isDel" width="88">
<template #default="scope">
<dict-tag :options="sys_is_del" :value="scope.row.isDel"/>
<el-tooltip :content="scope.row.isDel == 0 ? '启用' : '停用'" placement="top">
<el-switch
:active-value="parseInt(0)"
:inactive-value="parseInt(1)"
v-model="scope.row.isDel"
:disabled="scope.row.disabledState"
@change="setStatus($event, scope.row)"
/>
</el-tooltip>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<el-table-column label="创建时间" align="center" prop="createTime" width="120">
<template #default="scope">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['manage:busExamQuestion:edit']"></el-button>
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['manage:busExamQuestion:remove']"></el-button>
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" width="150" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-button v-if="!scope.row.disabledState" link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['manage:busExamQuestion:edit']"></el-button>
<el-button v-if="!scope.row.disabledState" link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['manage:busExamQuestion:remove']"></el-button>
<el-button v-if="scope.row.disabledState" type="danger" link disabled>-</el-button>
</template>
</el-table-column>
</el-table>
@ -180,16 +161,13 @@
/>
<!-- 添加或修改基础题库对话框 -->
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
<el-dialog :title="title" v-model="open" width="680px" append-to-body>
<el-form ref="busExamQuestionRef" :model="form" :rules="rules" label-width="80px">
<el-form-item label="单位主键" prop="deptId">
<el-input v-model="form.deptId" placeholder="请输入单位主键" />
</el-form-item>
<el-form-item label="项目主键" prop="projectId">
<el-input v-model="form.projectId" placeholder="请输入项目主键" />
<el-form-item label="项目名称" v-if="form.projectId">
<el-tag effect="plain">{{ form.projectName }}</el-tag>
</el-form-item>
<el-form-item label="工种类型" prop="craftType">
<el-select v-model="form.craftType" placeholder="请选择工种类型">
<el-select v-model="form.craftType" placeholder="请选择工种类型" style="width:100%">
<el-option
v-for="dict in pro_craft_type"
:key="dict.value"
@ -199,7 +177,7 @@
</el-select>
</el-form-item>
<el-form-item label="工种岗位" prop="craftPost">
<el-select v-model="form.craftPost" placeholder="请选择工种岗位">
<el-select v-model="form.craftPost" multiple placeholder="请选择工种岗位" style="width:100%">
<el-option
v-for="dict in pro_craft_post"
:key="dict.value"
@ -208,18 +186,8 @@
></el-option>
</el-select>
</el-form-item>
<el-form-item label="问题难度" prop="questionDiff">
<el-select v-model="form.questionDiff" placeholder="请选择问题难度">
<el-option
v-for="dict in edu_question_diff"
:key="dict.value"
:label="dict.label"
:value="parseInt(dict.value)"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="问题类型" prop="questionType">
<el-select v-model="form.questionType" placeholder="请选择问题类型">
<el-select v-model="form.questionType" placeholder="请选择问题类型" style="width:100%">
<el-option
v-for="dict in edu_question_type"
:key="dict.value"
@ -229,25 +197,9 @@
</el-select>
</el-form-item>
<el-form-item label="问题描述" prop="questionDesc">
<el-input v-model="form.questionDesc" placeholder="请输入问题描述" />
<el-input v-model="form.questionDesc" placeholder="请输入问题描述" type="textarea" rows="2" maxlength="64" show-word-limit/>
</el-form-item>
<el-form-item label="问题答案" prop="questionAnswer">
<el-input v-model="form.questionAnswer" placeholder="请输入问题答案" />
</el-form-item>
<el-form-item label="是否删除" prop="isDel">
<el-select v-model="form.isDel" placeholder="请选择是否删除">
<el-option
v-for="dict in sys_is_del"
:key="dict.value"
:label="dict.label"
:value="parseInt(dict.value)"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item>
<el-divider content-position="center">题库问题信息</el-divider>
<el-divider content-position="center">问题答案信息</el-divider>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" icon="Plus" @click="handleAddBusExamQuestionResult"></el-button>
@ -258,27 +210,26 @@
</el-row>
<el-table :data="busExamQuestionResultList" :row-class-name="rowBusExamQuestionResultIndex" @selection-change="handleBusExamQuestionResultSelectionChange" ref="busExamQuestionResult">
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="序号" align="center" prop="index" width="50"/>
<el-table-column label="选项" prop="opt" width="150">
<el-table-column label="答案选项" prop="opt" width="105" align="center">
<template #default="scope">
<el-input v-model="scope.row.opt" placeholder="请输入选项" />
<el-input v-model="scope.row.opt" placeholder="答案选项" maxlength="1"/>
</template>
</el-table-column>
<el-table-column label="问题选项" prop="result" width="150">
<el-table-column label="答案描述" prop="result">
<template #default="scope">
<el-input v-model="scope.row.result" placeholder="请输入问题选项" />
<el-input v-model="scope.row.result" placeholder="请输入答案描述" maxlength="128" show-word-limit/>
</template>
</el-table-column>
<el-table-column label="是否删除" prop="isDel" width="150">
<el-table-column label="正确答案" align="center" width="150">
<template #default="scope">
<el-select v-model="scope.row.isDel" placeholder="请选择是否删除">
<el-option
v-for="dict in sys_is_del"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
<el-checkbox
v-model="scope.row.isOk"
:checked="scope.row.isOk==1"
label="正确答案"
:true-label="parseInt(1)"
:false-label="parseInt(0)"
border
/>
</template>
</el-table-column>
</el-table>
@ -295,10 +246,12 @@
<script setup name="BusExamQuestion">
import { listBusExamQuestion, getBusExamQuestion, delBusExamQuestion, addBusExamQuestion, updateBusExamQuestion } from "@/api/manage/busExamQuestion";
import useUserStore from '@/store/modules/user'
const { proxy } = getCurrentInstance();
const { pro_craft_type, edu_question_type, sys_is_del, pro_craft_post, edu_question_diff } = proxy.useDict('pro_craft_type', 'edu_question_type', 'sys_is_del', 'pro_craft_post', 'edu_question_diff');
const userStore = useUserStore()
const busExamQuestionList = ref([]);
const busExamQuestionResultList = ref([]);
const open = ref(false);
@ -316,17 +269,17 @@ const data = reactive({
queryParams: {
pageNum: 1,
pageSize: 10,
deptId: null,
projectId: null,
projectName: null,
craftType: null,
craftPost: null,
questionDiff: null,
questionType: null,
questionDesc: null,
questionAnswer: null,
isDel: null,
},
rules: {
craftType: [{ required: true, message: "工种类型不能为空", trigger: "change" }],
craftPost: [{ required: true, message: "工种岗位不能为空", trigger: "change" }],
questionType: [{ required: true, message: "问题类型不能为空", trigger: "change" }],
questionDesc: [{ required: true, message: "问题描述不能为空", trigger: "blur" }]
}
});
@ -336,6 +289,9 @@ const { queryParams, form, rules } = toRefs(data);
function getList() {
loading.value = true;
listBusExamQuestion(queryParams.value).then(response => {
response.rows.forEach(item => {
item.disabledState = initRowDisabled(item);
})
busExamQuestionList.value = response.rows;
total.value = response.total;
loading.value = false;
@ -352,7 +308,7 @@ function cancel() {
function reset() {
form.value = {
id: null,
deptId: null,
comId: null,
projectId: null,
craftType: null,
craftPost: null,
@ -392,7 +348,13 @@ function handleSelectionChange(selection) {
/** 新增按钮操作 */
function handleAdd() {
if(!userStore.currentProId){
proxy.$modal.msgWarning("请切换到项目数据!!!");
return false;
}
reset();
form.value.projectId = userStore.currentProId;
form.value.projectName = userStore.currentProName;
open.value = true;
title.value = "添加基础题库";
}
@ -402,6 +364,7 @@ function handleUpdate(row) {
reset();
const _id = row.id || ids.value
getBusExamQuestion(_id).then(response => {
response.data.craftPost = response.data.craftPost.split(',');
form.value = response.data;
busExamQuestionResultList.value = response.data.busExamQuestionResultList;
open.value = true;
@ -413,6 +376,31 @@ function handleUpdate(row) {
function submitForm() {
proxy.$refs["busExamQuestionRef"].validate(valid => {
if (valid) {
if (busExamQuestionResultList.value.length == 0) {
proxy.$modal.msgError("请添加问题答案信息");
return false;
}
let answer = [];
//
busExamQuestionResultList.value.forEach((item,idx) => {
if(!item.opt){
proxy.$modal.msgError("请输入第"+(idx+1)+"个问题的答案选项");
return false;
}
if(!item.result){
proxy.$modal.msgError("请输入第"+(idx+1)+"个问题的答案描述");
return false;
}
if (item.isOk != 0) {
answer.push(item.opt);
}
});
if (answer.length == 0) {
proxy.$modal.msgError("请选择正确答案信息");
return false;
}
form.value.craftPost = form.value.craftPost.toString();
form.value.questionAnswer = answer.toString();
form.value.busExamQuestionResultList = busExamQuestionResultList.value;
if (form.value.id != null) {
updateBusExamQuestion(form.value).then(response => {
@ -431,6 +419,28 @@ function submitForm() {
});
}
/** 启用状态滑块控制 */
function setStatus(val, row) {
proxy.$modal
.confirm(`是否确认${val == 0 ? "启用" : "停用"}当前数据项?`)
.then(function () {
let param = {'id': row.id, 'isDel': val};
return updateBusExamQuestion(param);
})
.then(() => {
getList();
proxy.$modal.msgSuccess("修改成功");
})
.catch(() => {
//
if (val == 0) {
row.isDel = 1;
} else {
row.isDel = 0;
}
});
}
/** 删除按钮操作 */
function handleDelete(row) {
const _ids = row.id || ids.value;
@ -452,7 +462,7 @@ function handleAddBusExamQuestionResult() {
let obj = {};
obj.opt = "";
obj.result = "";
obj.isDel = "";
obj.isOk = 0;
busExamQuestionResultList.value.push(obj);
}
@ -481,5 +491,30 @@ function handleExport() {
}, `busExamQuestion_${new Date().getTime()}.xlsx`)
}
/** 初始化行标识 */
function initRowDisabled(row) {
let roles = userStore.roles;
if(roles.includes("admin")){
return false;
}else if(roles.includes("gsAdmin") && row.comId){
return false;
}else if(row.projectId){
return false;
}else{
return true;
}
}
getList();
</script>
<style lang="scss" scope>
.gap-2{
.el-tag--default{
margin:3px 4px;
}
}
.el-divider__text{
color: #409eff;
font-weight: 800;
}
</style>

View File

@ -1,291 +0,0 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="问题主键" prop="questionId">
<el-input
v-model="queryParams.questionId"
placeholder="请输入问题主键"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="选项" prop="opt">
<el-input
v-model="queryParams.opt"
placeholder="请输入选项"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="问题选项" prop="result">
<el-input
v-model="queryParams.result"
placeholder="请输入问题选项"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="是否删除" prop="isDel">
<el-select v-model="queryParams.isDel" placeholder="请选择是否删除" clearable>
<el-option
v-for="dict in sys_is_del"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery"></el-button>
<el-button icon="Refresh" @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="Plus"
@click="handleAdd"
v-hasPermi="['manage:busExamQuestionResult:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="Edit"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['manage:busExamQuestionResult:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="Delete"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['manage:busExamQuestionResult:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="Download"
@click="handleExport"
v-hasPermi="['manage:busExamQuestionResult:export']"
>导出</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="busExamQuestionResultList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键" align="center" prop="id" />
<el-table-column label="问题主键" align="center" prop="questionId" />
<el-table-column label="选项" align="center" prop="opt" />
<el-table-column label="问题选项" align="center" prop="result" />
<el-table-column label="是否删除" align="center" prop="isDel">
<template #default="scope">
<dict-tag :options="sys_is_del" :value="scope.row.isDel"/>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['manage:busExamQuestionResult:edit']"></el-button>
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['manage:busExamQuestionResult:remove']"></el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改题库问题对话框 -->
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
<el-form ref="busExamQuestionResultRef" :model="form" :rules="rules" label-width="80px">
<el-form-item label="问题主键" prop="questionId">
<el-input v-model="form.questionId" placeholder="请输入问题主键" />
</el-form-item>
<el-form-item label="选项" prop="opt">
<el-input v-model="form.opt" placeholder="请输入选项" />
</el-form-item>
<el-form-item label="问题选项" prop="result">
<el-input v-model="form.result" placeholder="请输入问题选项" />
</el-form-item>
<el-form-item label="是否删除" prop="isDel">
<el-select v-model="form.isDel" placeholder="请选择是否删除">
<el-option
v-for="dict in sys_is_del"
:key="dict.value"
:label="dict.label"
:value="parseInt(dict.value)"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup name="BusExamQuestionResult">
import { listBusExamQuestionResult, getBusExamQuestionResult, delBusExamQuestionResult, addBusExamQuestionResult, updateBusExamQuestionResult } from "@/api/manage/busExamQuestionResult";
const { proxy } = getCurrentInstance();
const { sys_is_del } = proxy.useDict('sys_is_del');
const busExamQuestionResultList = ref([]);
const open = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
questionId: null,
opt: null,
result: null,
isDel: null,
},
rules: {
}
});
const { queryParams, form, rules } = toRefs(data);
/** 查询题库问题列表 */
function getList() {
loading.value = true;
listBusExamQuestionResult(queryParams.value).then(response => {
busExamQuestionResultList.value = response.rows;
total.value = response.total;
loading.value = false;
});
}
//
function cancel() {
open.value = false;
reset();
}
//
function reset() {
form.value = {
id: null,
questionId: null,
opt: null,
result: null,
isDel: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null
};
proxy.resetForm("busExamQuestionResultRef");
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
proxy.resetForm("queryRef");
handleQuery();
}
//
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
/** 新增按钮操作 */
function handleAdd() {
reset();
open.value = true;
title.value = "添加题库问题";
}
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
const _id = row.id || ids.value
getBusExamQuestionResult(_id).then(response => {
form.value = response.data;
open.value = true;
title.value = "修改题库问题";
});
}
/** 提交按钮 */
function submitForm() {
proxy.$refs["busExamQuestionResultRef"].validate(valid => {
if (valid) {
if (form.value.id != null) {
updateBusExamQuestionResult(form.value).then(response => {
proxy.$modal.msgSuccess("修改成功");
open.value = false;
getList();
});
} else {
addBusExamQuestionResult(form.value).then(response => {
proxy.$modal.msgSuccess("新增成功");
open.value = false;
getList();
});
}
}
});
}
/** 删除按钮操作 */
function handleDelete(row) {
const _ids = row.id || ids.value;
proxy.$modal.confirm('是否确认删除题库问题编号为"' + _ids + '"的数据项?').then(function() {
return delBusExamQuestionResult(_ids);
}).then(() => {
getList();
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
/** 导出按钮操作 */
function handleExport() {
proxy.download('manage/busExamQuestionResult/export', {
...queryParams.value
}, `busExamQuestionResult_${new Date().getTime()}.xlsx`)
}
getList();
</script>