修改bug--新版考试系统

This commit is contained in:
Vce 2024-05-23 20:28:46 +08:00
parent c642a35eae
commit af0e9c0c7a
7 changed files with 304 additions and 288 deletions

View File

@ -8,6 +8,8 @@ export const getWorkerInfoListApi = data => post('xmgl/workerInfo/selectWorkerIn
export const getDepartmentListApi = data => post('xmgl/departmentInfo/selectDepartmentDetailsList', data); // 查询项目级所有部门
export const getTeamInfoListApi = data => post('xmgl/teamInfo/getProjectTeamList', data); // 查询项目级所有班组
export const getEnterpriseInfoApi = data => post('xmgl/enterpriseInfo/list', data) //列表查看劳务公司
//部门班组(新)
export const getQueryDepartmentListApi = (data) => get('xmgl/departmentInfo/queryDepartmentAndTeamList', data)
// 科目管理
export const addExamSubjectApi = data => post('exam/subject/add', data) //添加
@ -81,7 +83,7 @@ export const editPaperApi = data => post('exam/paper/edit', data) //编辑
export const getQuestionOption = data => post('exam/paper/queryQuestionById', data) //查询题目及选项
export const delPaperApi = data => post('exam/paper/delete', data) //查询题目及选项
//考试记录
export const getExamTrainRecordApi = data => post('exam/trainRecord/page', data) //查询题目及选项
export const getExamTrainRecordApi = data => post('exam/trainRecord/examRecordPage', data) //查询题目及选项
// 通知管理
export const editConfigApi = data => post('exam/config/edit', data) //通过id查询考试通知配置信息

View File

@ -4,8 +4,8 @@
<!-- header -->
<div class="searchBox whiteBlock">
<el-form :inline="true" size="medium" class="demo-form-inline">
<el-form-item label="科目" prop="subjectName">
<el-select v-model="subjectName" placeholder="请选择" clearable>
<el-form-item label="科目" prop="name">
<el-select v-model="name" placeholder="请选择" clearable>
<el-option v-for="item in subjectNameList" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</el-form-item>
@ -25,7 +25,7 @@
<!-- table -->
<div class="table_wrap whiteBlock" style="height: 677px">
<el-table class="tables" :data="listData" height="200">
<el-table-column width="200" align="center" prop="subjectName" label="考试科目"></el-table-column>
<el-table-column width="200" align="center" prop="name" label="考试科目"></el-table-column>
<el-table-column align="center" prop="name" label="试题名称"></el-table-column>
<el-table-column align="center" prop="radio" label="单选题"></el-table-column>
<el-table-column align="center" prop="multi" label="多选题"></el-table-column>
@ -46,10 +46,6 @@
<el-button size="mini" type="text" style="color:#ec4b52;margin-left:10px;font-size:14px" class="delete-btn" icon="el-icon-delete" @click.native.stop="removeExam(scope.row) ">
<span style="color:black">删除</span>
</el-button>
<!-- <div @click="gotoExamManage(scope.row)" style="margin-left:10px;" class="operationText">
<img src="@/assets/images/icon-setting.png" width="15px" height="15px" />
<span style="white-space: nowrap;display:flex;align-items:center">考试管理</span>
</div> -->
</div>
</template>
</el-table-column>
@ -61,36 +57,37 @@
<div class="dialogContainer">
<!-- <div class="dialogLeft"> -->
<el-form :model="examForm" ref="examForm" :rules="examRules" label-width="100px" class="demo-ruleForm">
<el-form-item label="考试科目" prop="subjectType" >
<el-select v-model="examForm.subjectType" placeholder="请选择">
<el-form-item label="考试科目" prop="subjectId" >
<el-select v-model="examForm.subjectId" placeholder="请选择">
<el-option :label="item.name" :value="item.id" v-for="(item,i) in examSubjectList" :key="i"></el-option>
</el-select>
</el-form-item>
<el-form-item label="试卷名称" prop="subjectName" >
<el-input v-model="examForm.subjectName"></el-input>
<el-form-item label="试卷名称" prop="name" >
<el-input v-model="examForm.name"></el-input>
</el-form-item>
<el-form-item label="考试时间" prop="examTime" >
<el-input-number :min="0" :controls="false" :precision="0" style="width: 190px" v-model="examForm.examTime"></el-input-number>
<el-form-item label="考试时间" prop="duration" >
<el-input-number :min="0" :controls="false" :precision="0" style="width: 190px" v-model="examForm.duration"></el-input-number>
<span style="margin-left: 10px;color:#a6a7b2;">分钟</span>
</el-form-item>
<el-form-item label="及格分数线" prop="passScore" >
<el-input-number :min="0" :max="100" :controls="false" :precision="0" style="width: 190px" v-model="examForm.passScore"></el-input-number>
<el-form-item label="及格分数线" prop="passLine" >
<el-input-number :min="0" :max="100" :controls="false" :precision="0" style="width: 190px" v-model="examForm.passLine"></el-input-number>
<span style="margin-left: 10px;color:#a6a7b2;"></span>
</el-form-item>
<!-- <el-form-item label="学习周期" prop="studyCycle">
<el-date-picker v-model="examForm.studyCycle" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
</el-form-item> -->
<el-form-item label="备注" prop="desc">
<el-input type="textarea" rows="3" :show-word-limit="true" v-model="examForm.desc"></el-input>
<el-form-item label="备注" prop="remark">
<el-input type="textarea" rows="3" :show-word-limit="true" v-model="examForm.remark"></el-input>
</el-form-item>
<el-form-item label="抽题模式" prop="examMode" >
<el-radio-group v-model="examForm.examMode" @input="handleDialog">
<el-form-item label="抽题模式" prop="checkQuestionType" >
<el-radio-group v-model="examForm.checkQuestionType" @input="handleDialog">
<div style="display:flex">
<div @click="dialogVisible2 = true">
<el-radio label="1">手动抽题</el-radio>
<!-- <div @click="dialogVisible2 = true"> -->
<div @click="openDoor">
<el-radio :label="1">手动抽题</el-radio>
</div>
<div style="margin-left:10px" @click="dialogVisible3 = true">
<el-radio label="2">随机抽题</el-radio>
<el-radio :label="2">随机抽题</el-radio>
</div>
</div>
</el-radio-group>
@ -118,7 +115,7 @@
@node-click="onNodeClick"
:current-node-key="currentNodekey"
node-key="id">
<span class="custom-tree-node" slot-scope="{ node, data }">
<span class="custom-tree-node" slot-scope="{ node }">
<span style="width: 100%;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;display: inline-block;" class="courseName" :title="node.label">
{{ node.label }}
</span>
@ -170,9 +167,9 @@
<el-radio label="0">从指定科目类型中选择</el-radio>
<el-radio label="1">从全部题库中选择</el-radio>
</el-radio-group><br>
<el-select v-model="randomQuestion.subjectName" :disabled="isDisabled" size="mini" placeholder="请选择" style="margin-top: 5px">
<el-select v-model="randomQuestion.name" :disabled="isDisabled" size="mini" placeholder="请选择" style="margin-top: 5px">
<el-option :label="item.name" :value="item.id" v-for="(item,i) in subjectNameList" :key="i"></el-option>
<!-- <el-option v-for="item in subjectNameList" :key="item.value" :label="item.subjectName" :value="item.value"></el-option> -->
<!-- <el-option v-for="item in subjectNameList" :key="item.value" :label="item.name" :value="item.value"></el-option> -->
</el-select>
</div>
<div>
@ -225,7 +222,7 @@
<div class="">基本信息</div>
</div>
<div style="width:80%;display:grid;grid-gap:20px;grid-template-columns: repeat(2, 1fr);">
<p style="margin-bottom: 10px; margin-left:20px;width:50%">科目名称{{examDetailInfo.subjectName}}</p>
<p style="margin-bottom: 10px; margin-left:20px;width:50%">科目名称{{examDetailInfo.name}}</p>
<p style="margin-bottom: 10px; margin-left:20px;width:50%">试题名称{{examDetailInfo.name}}</p>
<p style="margin-bottom: 10px; margin-left:20px;width:50%">考试时长{{examDetailInfo.duration}}</p>
<p style="margin-bottom: 10px; margin-left:20px;width:50%">及格分数{{examDetailInfo.passLine}}</p>
@ -307,7 +304,7 @@
</el-form-item>
</el-form>
<el-table class="tables" style="min-height:500px" :data="listData" height="200" max-height="530px">
<el-table-column width="200" align="center" prop="subjectName" label="科目"></el-table-column>
<el-table-column width="200" align="center" prop="name" label="科目"></el-table-column>
<el-table-column align="center" prop="questionName" label="试题名称"></el-table-column>
<el-table-column align="center" prop="examCycle" label="考试周期"></el-table-column>
<el-table-column align="center" prop="examPersonCount" label="考试人数"></el-table-column>
@ -399,10 +396,10 @@ export default {
},
examJudge:{},
radio:"1",
subjectName:"",
name:"",
},
emActiveTab: 'examRecord',
examManageInfo:{examTotalScore:'100',passScore: 60,questionCount: '100', examPeriod: '2024-05-12 00:00:00-2024-06-01 00:00:00', joinCount: '100',noJoinCount: '2'},
examManageInfo:{examTotalScore:'100',passLine: 60,questionCount: '100', examPeriod: '2024-05-12 00:00:00-2024-06-01 00:00:00', joinCount: '100',noJoinCount: '2'},
isExamManage: false, //
examInfoList: [], //
activeTab: '1', // Tab
@ -413,14 +410,22 @@ export default {
label: "workerName",
},
questionList: [],
subjectName: '', //
name: '', //
questionName: '', //
data: generateData(),
value: [1],
renderFunc(h, option) {
return <span>{ option.key } - { option.label }</span>;
},
examForm: {},
examForm: {
subjectId:'',
name:'',
duration:'',
passLine:'',
remark:'',
checkQuestionType:'',
questions:[]
},
subjectNameList: [
{ value: '选项1', label: '黄金糕' },
{ value: '选项2', label: '双皮奶' },
@ -463,48 +468,39 @@ export default {
{ ruleType: '', symbol: '', ruleScore: '' },
],
examRules:{
subjectType: [
subjectId: [
{
required: true,
message: '必填',
trigger: 'change',
},
],
name: [
{
required: true,
message: '必填',
trigger: 'change',
},
],
duration: [
{
required: true,
message: '必填',
trigger: 'blur',
},
],
subjectName: [
passLine: [
{
required: true,
message: '必填',
trigger: 'blur',
},
],
examTime: [
checkQuestionType: [
{
required: true,
message: '必填',
trigger: 'blur',
},
],
passScore: [
{
required: true,
message: '必填',
trigger: 'blur',
},
],
examMode: [
{
required: true,
message: '必填',
trigger: 'blur',
},
],
},
addEditRules: {
subdivisionProjectName: [
{
required: true,
message: this.$t('message.personnelPosition.required'),
trigger: 'blur',
trigger: 'change',
},
],
},
@ -527,9 +523,7 @@ export default {
cpsCheckedTotal: [], //
addCourseForm: {}, //
cpsEleRecords: [], //
studyCycle: [], //
searchKeyWord: '', //
personType: 0, //
personnelName:"", //
@ -538,7 +532,7 @@ export default {
question: {
//
pageNo: 1,
pageSize: 10,
pageSize: 100000,
total: 0,
},
questionSubjectId:'',
@ -567,12 +561,12 @@ export default {
},
watch: {
dialogVisible(newV,oldV){
if (this.title == '新增考试') {
this.clearDialog()
if(this.dialogVisible === false) {
// this.$refs.examForm.resetFields()
}
if(newV === false){
if(this.title === '新增考试') {
this.$refs.examForm.resetFields()
this.clearDialog()
}
},
"randomQuestion.examSingle.diffculty"(){
@ -592,14 +586,14 @@ export default {
}
});
},
"randomQuestion.subjectName"(){
console.log(this.randomQuestion.subjectName);
"randomQuestion.name"(){
console.log(this.randomQuestion.name);
this.clearFilter();
this.getList({
pageNo: 1,
pageSize: 99999,
questionName: "",
questionSubjectId: this.randomQuestion.subjectName,
questionSubjectId: this.randomQuestion.name,
})
},
},
@ -616,11 +610,11 @@ export default {
},
methods: {
cancel2(){
this.examForm.examMode = null
this.examForm.checkQuestionType = null
this.dialogVisible2 = false
},
cancel3(){
this.examForm.examMode = null
this.examForm.checkQuestionType = null
this.dialogVisible3 = false
},
singleChange(){
@ -636,13 +630,13 @@ export default {
type:1,
number:this.randomQuestion.examSingle.count,
difficulty:this.randomQuestion.examSingle.diffculty,
subjectId:this.randomQuestion.examSingle.subjectName,
subjectId:this.randomQuestion.examSingle.name,
}
let multipleRandom = {
type:2,
number:this.randomQuestion.examMultiple.count?this.randomQuestion.examMultiple.count:'',
difficulty:this.randomQuestion.examMultiple.diffculty?this.randomQuestion.examMultiple.diffculty:'',
subjectId:this.randomQuestion.examMultiple.subjectName?this.randomQuestion.examMultiple.subjectName:'',
subjectId:this.randomQuestion.examMultiple.name?this.randomQuestion.examMultiple.name:'',
}
this.randomQueryList.push(singleRandom)
this.randomQueryList.push(multipleRandom)
@ -653,7 +647,6 @@ export default {
}
})
},
// pageQuestionBankApi
removeExam(obj){
this.$confirm('此操作将永久删除, 是否继续?', '提示', {
confirmButtonText: '确定',
@ -696,6 +689,7 @@ export default {
pageSize: row ? row.pageSize : this.question.pageSize,
questionName: "",
subjectId: row ? row.questionSubjectId : this.questionSubjectId,
isEnable:1
}).then((result) => {
if (result.success) {
console.log(result);
@ -752,9 +746,6 @@ export default {
this.isExamManage = true;
},
handleD4Tab(val){
this.activeTab = val
},
async examDetail(val) {
console.log("~~~~~~~~~~~~~~",val);
this.examDetailInfo = val;
@ -772,20 +763,6 @@ export default {
}
})
},
cancelRule(type, val) {
if (type === 1) {
} else {
this.listData3.pop()
}
},
editRule(val) {},
addRule() {
this.listData3.push({
ruleType: '',
symbol: '',
ruleScore: '',
})
},
//
async addExam() { //
@ -793,20 +770,47 @@ export default {
this.title = "新增考试";
this.dialogVisible = true
},
openDoor(){
// this.examForm.questions = this.examForm.questions.split(',')
let tempStr = this.examForm.questions.split(',')
console.log(tempStr,789)
console.log(this.questionList,789)
// this.examForm.questions = String.prototype.split(this.examForm.questions,',')
// this.$nextTick(()=>{
// this.examForm.questions = tempStr
// this.questionList.map((item,index) => {
// console.log("33333333333333333333")
// tempStr.map((item2,index2) => {
// if(item.id = item2){
// that.$refs.questionListTable.toggleRowSelection(taht.questionList[index],true)
// console.log("=======================")
// console.log(this.questionList[index])
// }
// })
// })
// })
this.dialogVisible2 = true
this.$nextTick(() => {
for(let i=0;i<this.questionList.length;i++){
for(let j = 0;j<tempStr.length;j++){
if(tempStr[j] == this.questionList[i].id){
this.$refs.questionListTable.toggleRowSelection(this.questionList[i],true)
}
}
}
})
},
//
async editExam(row) { //
this.personType = 1
this.title = "编辑考试";
console.log(row);
// console.log(row);
this.examForm = row
this.examForm.id = row.id
this.examForm.examMode = row.checkQuestionType.toString();
this.examForm.subjectName = row.name;
this.examForm.examTime = row.duration;
this.examForm.passScore = row.passLine;
this.examForm.subjectType = row.subjectId;
this.examForm.desc = row.remark;
this.editExam.questions = row.questions
// this.examForm.studyCycle = [row.beginTime,row.endTime];
console.log(this.examForm);
this.dialogVisible = true
},
@ -843,7 +847,7 @@ export default {
pageNo: this.pagInfo.pageNo,
pageSize: this.pagInfo.pageSize,
name: this.questionName,
subjectId:this.subjectName,
subjectId:this.name,
}).then((result) => {
if (result.success) {
console.log(result);
@ -854,35 +858,26 @@ export default {
},
///
submitBtn() {
// if(this.studyCycle.length > 0){
// console.log('==========studyCycle-submitBtn==========',this.studyCycle)
// this.addCourseForm.beginTime = this.studyCycle[0]
// this.addCourseForm.endTime = this.studyCycle[1]
// }
console.log(this.compulsoryList)
// this.addCourseForm.projectSn = this.$store.state.projectSn;
// this.examForm.projectSn = this.projectSn
this.$refs.examForm.validate((valid) => {
if (valid) {
let examInfo = {
checkQuestionType:this.examForm.examMode,
name:this.examForm.subjectName,
duration:this.examForm.examTime,
passLine:this.examForm.passScore,
checkQuestionType:this.examForm.checkQuestionType,
name:this.examForm.name,
duration:this.examForm.duration,
passLine:this.examForm.passLine,
projectSn:this.$store.state.projectSn,
subjectId:this.examForm.subjectType,
remark:this.examForm.desc,
// beginTime: dateFormat(this.examForm.studyCycle[0], "yyyy-MM-dd"),
// endTime: dateFormat(this.examForm.studyCycle[1], "yyyy-MM-dd"),
questions:this.examForm.examMode == 1 ? this.examAddDetail.questions.map(item => item.id).join(',') : this.randomQuestionList.map(item => item.id).join(','),
subjectId:this.examForm.subjectId,
remark:this.examForm.remark,
questions:this.examForm.checkQuestionType == 1 ? this.examForm.questions.map(item => item.id).join(',') : this.randomQuestionList.map(item => item.id).join(','),
examRecordList:this.compulsoryList.map(item => {
return {
id:item.id,
}
}),
radio:this.examForm.examMode == 1 ? this.examAddDetail.questions.filter(item => item.type == 1).length : this.randomQuestion.examSingle.count,
multi:this.examForm.examMode == 1 ? this.examAddDetail.questions.filter(item => item.type == 2).length : this.randomQuestion.examMultiple.count,
radio:this.examForm.checkQuestionType == 1 ? this.examForm.questions.filter(item => item.type == 1).length : this.randomQuestion.examSingle.count,
multi:this.examForm.checkQuestionType == 1 ? this.examForm.questions.filter(item => item.type == 2).length : this.randomQuestion.examMultiple.count,
}
if (this.title == '新增考试') {
@ -908,7 +903,8 @@ export default {
},
// /dialog
handleDialog(val){
if(val === '1'){
// if(val === '1'){
if(val === 1){
this.currentNodekey = this.subjectNameList[0].id;
this.$nextTick(() => {
this.$refs.groupTreeList.setCurrentKey(this.subjectNameList[0].id) //
@ -918,7 +914,8 @@ export default {
this.dialogVisible2 = false
this.dialogVisible2 = true
}
if(val === '2'){
// if(val === '2'){
if(val === 2){
this.dialogVisible3 = false;
if(this.randomQuestion.radio == 1) {
this.getList({
@ -948,7 +945,14 @@ export default {
}
},
clearDialog(){
this.examForm = {}
this.examForm = {
subjectId:'',
name:'',
duration:'',
passLine:'',
remark:'',
checkQuestionType:'',
}
},
//
sizeChange(val) {
@ -981,7 +985,7 @@ export default {
console.log(value, direction, movedKeys);
},
submitBtn2(){
this.examAddDetail.questions = this.$refs.questionListTable.selection;
this.examForm.questions = this.$refs.questionListTable.selection;
this.dialogVisible2 = false;
},
submitBtn3(){

View File

@ -29,7 +29,7 @@
style="display: flex;justify-content:center;word-wrap: break-word;white-space: normal; flex-wrap: wrap">
<div v-for="(item,index) in JSON.parse(scope.row.fileUrl)" :key="index" class="videoBox" @click="playerVideo(item.url)">
<el-tooltip class="item" effect="dark" :content="item.name" placement="left">
<img src="@/assets/images/video-icon.png" alt="" width="50px" height="50px" style="margin-right: 120px;" class=""/>
<img src="@/assets/images/video-icon.png" alt="" width="50px" height="50px" style="margin-right: 120px; cursor: pointer;" class=""/>
</el-tooltip>
</div>
</span>
@ -43,7 +43,7 @@
<!-- <img :preview="item ? $store.state.FILEURL + item.url : ''"
:src="item ? $store.state.FILEURL + item.url : ''" alt="" width="50px" height="50px" style="margin-right: 10px;"/> -->
<img :preview="item.url ? item.url : ''"
:src="item.url ? item.url : ''" alt="" width="50px" height="50px" style="margin-right: 10px;"/>
:src="item.url ? item.url : ''" alt="" width="50px" height="50px" style="margin-right: 10px;cursor:pointer"/>
</div>
</span>
</template>
@ -84,8 +84,8 @@
<el-input v-model="addCourseForm.courseName"></el-input>
</el-form-item>
<el-form-item label="课程视频" prop="fileUrl" required>
<div>单个文件不超过100M,最多可上传5个附件</div>
<el-upload class="upload-demo" drag multiple name="files" :limit="5" :action="$store.state.UPLOADURL"
<div>单个文件不超过100M,最多可上传1个附件</div>
<el-upload class="upload-demo" drag multiple name="files" :limit="1" :action="$store.state.UPLOADURL"
accept=".mp4"
:on-remove="(file, fileList) => materialHandleRemove(file,fileList)"
:on-success="(res, file) => materialHandleSuccess(res, file)"

View File

@ -11,7 +11,7 @@
</el-form-item>
<el-form-item label="培训前" prop="examNum" :rules="[
{ type: 'number', message: '必须为数字值', trigger: 'change'}] ">
{required:true, type: 'number', message: '必须为数字值', trigger: 'change'}] ">
<div style="width: 80px">
<!-- <el-input v-model.number="noticeForm.examNum" size="medium" :disabled="isDisabled" @blur="disabledFn" autocomplete="off"></el-input> -->
<el-input v-model.number="noticeForm.examNum" size="medium" :disabled="isDisabled" autocomplete="off"></el-input>
@ -159,6 +159,10 @@ export default {
submitNoticeForm(noticeForm) {
// this.$refs[this.noticeForm].validate((valid) => {
// if (valid) {
if(typeof this.noticeForm.examNum !== 'number'){
this.$message.error('请输入数字类型')
return
}
console.log(7788)
editConfigApi({
id:this.noticeForm.id,
@ -168,9 +172,9 @@ export default {
projectSn: this.$store.state.projectSn,
}).then(result => {
if (result.success) {
this.getConfig()
console.log('信息编辑成功', result);
this.$message.success(result.message);
this.isDisabled = true
this.isDisabled2 = true
}

View File

@ -15,8 +15,6 @@
<div class="table_wrap whiteBlock" style="height:677px">
<!-- <vue-scroll> -->
<el-table class="tables" :data="ruleList" max-height="667px">
<el-table-column align="center" prop="dictData" label="规则类型">
<template slot-scope="scope">
<span v-if="!scope.row.isEdit">

View File

@ -35,45 +35,6 @@
</div>
<div class="right">
<div class="search_wrap">
<!-- <el-upload
style="display: inline-block; margin-left: 15px;"
class="upload-demo"
name="excelFile"
:action="
$http.defaults.baseURL + 'xmgl/workerInfo/uploadExcelWorkerInfo'
"
:on-change="handleChangeE"
:on-success="handleSuccessE"
:on-error="handleErrorE"
:show-file-list="false"
:headers="headers"
:data="{ projectSn: $store.state.projectSn }"
:limit="1"
accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
:auto-upload="true"
>
<el-button size="medium" type="primary" plain>Excel导入</el-button>
</el-upload> -->
<!-- <el-upload
style="display: inline-block; margin-left: 15px;margin-right: auto;"
class="upload-demo"
name="excelFile"
:action="
$http.defaults.baseURL + 'xmgl/workerInfo/uploadExcelWorkerInfo'
"
:on-change="handleChangeE"
:on-success="handleSuccessE"
:on-error="handleErrorE"
:show-file-list="false"
:headers="headers"
:data="{ projectSn: $store.state.projectSn }"
:limit="1"
accept=".docx"
:auto-upload="true"
>
<el-button size="medium" type="primary" plain>word导入</el-button>
</el-upload> -->
<el-form
:model="tableParameter"
size="medium"
@ -94,9 +55,6 @@
<el-button type="warning" @click="refreshBtn" plain>{{
$t("message.laborMange.refresh")
}}</el-button>
<!-- <el-button type="primary" @click="exportFn" plain>{{
$t("message.laborMange.export")
}}</el-button> -->
</el-form-item>
</el-form>
<el-button type="primary" size="medium" @click="addQuestionBtn"
@ -111,12 +69,6 @@
style="width: 100%; color: #737996"
@selection-change="handleCheckedCitiesChange"
>
<!-- <el-table-column
type="selection"
width="70"
align="center"
label="序号"
></el-table-column> -->
<el-table-column prop="questionName" label="试题内容"></el-table-column>
<el-table-column prop="type" width="100px" label="题目类型">
<template slot-scope="scope">
@ -229,14 +181,16 @@
style="width: 75%;margin: 0 auto;"
:rules="questionFormRules"
>
<el-form-item label="试题内容" prop="content">
<el-form-item label="试题内容" prop="questionName">
<el-input
v-model="questionForm.content"
placeholder="请输入"
type="textarea"
:rows="2"
@input="handleInputArea()"
v-model="questionForm.questionName"
rows="2"
placeholder="请输入"
></el-input>
<!-- :minlength="0"
:maxlength="500"
@input="handleInputArea()" -->
</el-form-item>
<el-form-item label="科目类型" prop="subjectId">
<el-select v-model="questionForm.subjectId" placeholder="请选择">
@ -259,9 +213,9 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="难易程度" prop="level">
<el-form-item label="难易程度" prop="difficulty">
<el-select
v-model="questionForm.level"
v-model="questionForm.difficulty"
placeholder="请选择"
style="width: 100%;"
>
@ -277,6 +231,7 @@
<el-form-item label="试题分数" prop="score">
<el-input-number
:min="0"
:max="100"
:precision="0"
:controls="false"
v-model="questionForm.score"
@ -540,9 +495,18 @@ export default {
{ name: "单选题", value: 1 },
{ name: "多选题", value: 2 },
],
questionForm: {
questionName: null,
subjectId:'',
type: 1,
difficulty: 1,
score: 0,
isApplication: 1,
},
questionFormRules: {
content: [
questionName: [
{
required: true,
message: "请输入",
@ -553,7 +517,7 @@ export default {
{
required: true,
message: "请选择",
trigger: "blur",
trigger: "change",
},
],
type: [
@ -563,18 +527,18 @@ export default {
trigger: "blur",
},
],
level: [
difficulty: [
{
required: true,
message: "请选择",
trigger: "blur",
trigger: "change",
},
],
isApplication: [
{
required: true,
message: "请选择",
trigger: "blur",
trigger: "change",
},
],
score: [
@ -585,13 +549,6 @@ export default {
},
],
},
questionForm: {
content: '',
type: 1,
level: 1,
isApplication: 1,
score: 0
},
editQuestion:{},
title: "添加试题",
previewDialogVisible: false,
@ -642,6 +599,11 @@ export default {
watch:{
previewDialogVisible(newV,oldV){
if(newV === false) this.resetForm()
},
dialogVisible(newV,oldV){
if(this.title === '添加试题'){
this.$refs.questionForm.resetFields()
}
}
},
methods: {
@ -695,36 +657,10 @@ export default {
this.total = result.result.total
}
})
// this.tableData = [
// {name: '1',isEnable: 1,uploadTime: '2024-04-30 00:00:00'},
// {name: '2',isEnable: 0,uploadTime: '2024-04-30 00:00:00'},
// {name: '3',isEnable: 1,uploadTime: '2024-04-30 00:00:00'},
// {name: '4',isEnable: 0,uploadTime: '2024-04-30 00:00:00'},
// {name: '5',isEnable: 1,uploadTime: '2024-04-30 00:00:00'},
// ]
},
multipleOption(option,options){
if(options === undefined) return true
return options.includes(option) ? true : false
// let isFlag = 0
// for(let i = 0;options.length;i++){
// if(option === options[i]){
// isFlag++
// }
// }
// if(isFlag === 1){
// return true
// }else{
// return false
// }
// options.split('').map(item => {
// if(option === item){
// return true
// }else{
// return false
// }
// })
// return this.questionForm.options.includes(item.optionCode) ? true : false
},
optionStr(index){
let str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('')
@ -735,9 +671,9 @@ export default {
},
resetForm(){
this.questionForm = {
content: "",
questionName: "",
type: 1,
level: 1,
difficulty: 1,
isApplication: 1,
score: 0
}
@ -790,9 +726,9 @@ export default {
console.log(this.questionForm)
editQuestionBankApi({
id:this.questionForm.id,
questionName:this.questionForm.content,
questionName:this.questionForm.questionName,
type:this.questionForm.type,
difficulty:this.questionForm.level,
difficulty:this.questionForm.difficulty,
isEnable:this.questionForm.isApplication,
// optionList: this.questionForm.type == 1 ? this.questionArr.map((item,index) => {
// return {
@ -821,13 +757,18 @@ export default {
let option = this.optionStr(this.radio)
//
let multiOptions = ''
console.log(this.checkList,'this.checkList========================')
if(this.questionForm.type !== 1 && this.checkList.length === 0){
this.$message.warning('请选择答案')
return
}
this.checkList.map(item =>{
multiOptions += this.optionStr(item)
})
addQuestionBankApi({
questionName:this.questionForm.content,
questionName:this.questionForm.questionName,
type:this.questionForm.type,
difficulty:this.questionForm.level,
difficulty:this.questionForm.difficulty,
isEnable:this.questionForm.isApplication,
// optionList: this.questionArr.type == 1 ? this.questionArr.map((item,index) => {
// return {
@ -885,9 +826,9 @@ export default {
console.log(item);
this.title = "编辑试题";
this.questionForm.content = item.questionName;
this.questionForm.questionName = item.questionName;
this.questionForm.type = item.type;
this.questionForm.level = item.difficulty;
this.questionForm.difficulty = item.difficulty;
this.questionForm.isApplication = item.isEnable;
detailIdQuestionBankApi({
@ -930,7 +871,7 @@ export default {
addQuestionBtn() {
this.questionForm = {}
this.title = "添加试题";
this.questionForm.content = "";
// this.questionForm.questionName = "";
this.questionArr = [{ isCheck: true, questionContent: "" },{ isCheck: true, questionContent: "" },{ isCheck: true, questionContent: "" },{ isCheck: true, questionContent: "" }];
this.radio = 0;
this.checkList = [];
@ -938,6 +879,10 @@ export default {
},
//
addQuestionAnswer() {
if(!this.questionForm.type){
this.$message.warning('请选择题目类型')
return
}
this.questionArr.push({ isCheck: true , questionContent: "" });
},
//

View File

@ -69,20 +69,22 @@
layout="total, sizes, prev, pager, next" :total="Number(pagInfo.total)" background></el-pagination>
</div>
<!-- 新增 -->
<el-dialog :modal-append-to-body="false" destroy-on-close=true: :title="title" :visible.sync="dialogVisible" width="1000px">
<el-dialog :modal-append-to-body="false" :destroy-on-close="true" :title="title" :visible.sync="dialogVisible" width="1000px">
<el-steps :active="active" align-center>
<el-step title="教育信息"></el-step>
<el-step title="人员信息"></el-step>
</el-steps>
<div class="dialogContainer" v-show="active == 1">
<el-form :model="addCourseForm" ref="examForm" label-width="100px" class="demo-addCourseForm">
<el-form :model="addCourseForm" ref="examForm" label-width="110px" class="demo-addCourseForm">
<div class="item-flex">
<el-form-item label="培训计划名称" prop="name" required>
<el-form-item label="培训计划名称" prop="name"
:rules="[{required:true, message:'必填', trigger:'change'}]">
<el-input v-model="addCourseForm.name" placeholder="请输入教育主题" maxlength="50" ></el-input>
</el-form-item>
</div>
<div class="item-flex">
<el-form-item label="科目类型" prop="subjectId" required>
<el-form-item label="科目类型" prop="subjectId"
:rules="[{required:true, message:'必填', trigger:'change'}]">
<el-select v-model="addCourseForm.subjectId" placeholder="请选择科目类型">
<el-option :label="item.name" :value="item.id" v-for="(item, i) in subjectNameList"
:key="i"></el-option>
@ -90,7 +92,8 @@
</el-form-item>
</div>
<div class="item-flex">
<el-form-item label="选择课件" prop="courseId">
<el-form-item label="选择课件" prop="courseId"
:rules="[{required:true, message:'必填', trigger:'change'}]">
<el-select v-model="addCourseForm.courseId" placeholder="请选择课件">
<el-option :label="item.courseName" :value="item.id" v-for="(item, i) in courseList"
:key="i"></el-option>
@ -98,7 +101,8 @@
</el-form-item>
</div>
<div class="item-flex">
<el-form-item label="选择试卷" prop="examPaperId">
<el-form-item label="选择试卷" prop="examPaperId"
:rules="[{required:true, message:'必填', trigger:'change'}]">
<el-select v-model="addCourseForm.examPaperId" placeholder="请选择试卷">
<el-option :label="item.name" :value="item.id" v-for="(item, i) in examPaperSubjectList"
:key="i"></el-option>
@ -106,17 +110,20 @@
</el-form-item>
</div>
<div class="item-flex">
<el-form-item label="教育主题" prop="title" required>
<el-form-item label="教育主题" prop="title"
:rules="[{required:true, message:'必填', trigger:'change'}]">
<el-input v-model="addCourseForm.title" placeholder="请输入教育主题" maxlength="50" ></el-input>
</el-form-item>
</div>
<div class="item-flex">
<el-form-item label="培训开始时间" prop="trainBeginTime" required>
<el-form-item label="培训开始时间" prop="trainBeginTime"
:rules="[{required:true, message:'必填', trigger:'change'}]">
<el-date-picker v-model="addCourseForm.trainBeginTime" type="datetime" placeholder="选择日期时间" value-format="yyyy-MM-dd HH:mm:ss" default-time="00:00:00"></el-date-picker>
</el-form-item>
</div>
<div class="item-flex">
<el-form-item label="培训结束时间" prop="trainEndTime" required>
<el-form-item label="培训结束时间" prop="trainEndTime"
:rules="[{required:true, message:'必填', trigger:'change'}]">
<el-date-picker v-model="addCourseForm.trainEndTime" type="datetime" placeholder="选择日期时间" value-format="yyyy-MM-dd HH:mm:ss" default-time="00:00:00"></el-date-picker>
</el-form-item>
</div>
@ -134,7 +141,11 @@
<el-table-column type="index" label="序号" align="center"></el-table-column>
<el-table-column align="center" prop="workerName" label="姓名"></el-table-column>
<el-table-column align="center" prop="idCard" label="身份证"></el-table-column>
<el-table-column align="center" prop="teamName" label="所在班组"></el-table-column>
<el-table-column align="center" label="班组/部门">
<template slot-scope="scope">
{{scope.row.teamName}}{{scope.row.departmentName}}
</template>
</el-table-column>
<el-table-column align="center" prop="typeName" label="工种"></el-table-column>
<!-- <el-table-column align="center" prop="jobTypeName" label="作业类别">
<template slot-scope="scope">
@ -160,7 +171,7 @@
</div>
</div>
<div class="dialogFooter">
<el-button @click="next" type="primary" v-if="active === 1">下一步</el-button>
<el-button @click="next('examForm')" type="primary" v-if="active === 1">下一步</el-button>
<el-button @click="last" type="primary" v-if="active === 2">上一步</el-button>
<el-button @click="dialogVisible = false"><i class="el-icon-circle-close"></i> </el-button>
<el-button type="primary" @click="submitBtn('examForm')"><i class="el-icon-circle-check"></i>
@ -176,14 +187,15 @@
<el-form :inline="true" size="medium" class="demo-form-inline">
<!-- <el-form-item label="选择企业" prop="enterpriseId"> -->
<el-form-item label="" prop="enterpriseId">
<el-select v-model="workerInfo.enterpriseId" placeholder="请选择企业" clearable="">
<el-select v-model="workerInfo.enterpriseId" placeholder="请选择企业" @change="getTeamInfoList" clearable="">
<el-option v-for="item in enterpriseInfoList" :key="item.id" :label="item.enterpriseName" :value="item.id"></el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="选择班组" prop="teamId"> -->
<el-form-item label="" prop="teamId">
<el-select v-model="workerInfo.teamId" placeholder="请选择班组" clearable="">
<el-option v-for="item in teamInfoList" :key="item.id" :label="item.teamName" :value="item.id"></el-option>
<el-select v-model="workerInfo.departmentAndTeam" placeholder="请选择班组/部门" clearable="">
<!-- <el-option v-for="item in teamInfoList" :key="item.id" :label="item.teamName" :value="item.id"></el-option> -->
<el-option v-for="item in teamInfoList" :key="item.id" :label="item.departmentTeamName" :value="item"></el-option>
</el-select>
</el-form-item>
<el-form-item prop="workerName">
@ -206,8 +218,13 @@
<el-table-column align="center" prop="workerName" label="姓名"></el-table-column>
<el-table-column align="center" prop="idCard" label="身份证"></el-table-column>
<el-table-column align="center" prop="enterpriseName" label="企业"></el-table-column>
<el-table-column align="center" prop="departmentName" label="部门"></el-table-column>
<el-table-column align="center" prop="teamName" label="班组"></el-table-column>
<el-table-column align="center" label="班组/部门">
<template slot-scope="scope">
{{scope.row.teamName}}{{scope.row.departmentName}}
</template>
</el-table-column>
<!-- <el-table-column align="center" prop="departmentName" label="部门"></el-table-column>
<el-table-column align="center" prop="teamName" label="班组"></el-table-column> -->
<el-table-column align="center" prop="typeName" label="工种"></el-table-column>
<el-table-column align="center" prop="age" label="年龄"></el-table-column>
<el-table-column align="center" prop="enterDate" label="进场日期"></el-table-column>
@ -240,7 +257,6 @@
<script>
import trainRecord from './trainRecord.vue'
import {
addTrainApi,
pagePaperApi,
@ -260,6 +276,8 @@ import {
pageQuestionBankApi,
listCourseApi,
getQueryDepartmentListApi,
} from '@/assets/js/api/examSystem/examSystem'
@ -310,11 +328,9 @@ export default {
dialogVisible2: false, //
dialogVisible3: false, //
workerInfo: {
subdivisionProjectName: '',
children: [],
id: '',
level: 0,
parentId: '',
enterpriseId: '',
departmentAndTeam:{}
},
listData: [],
subjectId:'',
@ -324,6 +340,7 @@ export default {
],
addCourseForm: {
examType:2,
name: ""
}, //
personType: 0, //
@ -359,9 +376,11 @@ export default {
},
watch: {
dialogVisible(newV, oldV) {
this.clearDialog()
if (newV === false) {
// this.clearDialog()
if (this.dialogVisible === false) {
if(this.title = '新增'){
this.$refs.examForm.resetFields()
}
}
},
// subjectId(newV,oldV){
@ -391,6 +410,17 @@ export default {
this.getEnterpriseInfoList();
},
methods: {
// getTeamList(){
// // -
// let data = {
// enterpriseId: this.workerInfo.enterpriseId,
// projectSn: this.projectSn,
// };
// getTeamInfoList(data).then((res) => {
// this.teamListData = res.result.list;
// });
// },
getCourseList(){
listCourseApi({
projectSn: this.projectSn,
@ -439,18 +469,29 @@ export default {
}
this.getWorkerInfoList();
},
getWorkerInfoList (){
async getWorkerInfoList (){
// this.workerInfo.departmentAndTeam.gtMaterialDepartmentTeamId = ''
let data = {
workerName:this.workerInfo.workerName,
teamId:this.workerInfo.teamId,
projectSn: this.projectSn,
enterpriseId: this.workerInfo.enterpriseId,
pageNo: this.worker.pageNo,
// pageSize: this.worker.pageSize,
pageSize: 999999,
// presence: 1,
departmentId:'',
teamId:'',
}
getWorkerInfoListApi(data).then((res) => {
if(this.workerInfo.departmentAndTeam){
if(this.workerInfo.departmentAndTeam.gtMaterialDepartmentTeamType?this.workerInfo.departmentAndTeam.gtMaterialDepartmentTeamType === 1:false) {
data.departmentId = this.workerInfo.departmentAndTeam?this.workerInfo.departmentAndTeam.gtMaterialDepartmentTeamId:''
}
if(this.workerInfo.departmentAndTeam.gtMaterialDepartmentTeamType?this.workerInfo.departmentAndTeam.gtMaterialDepartmentTeamType === 2:false) {
data.teamId = this.workerInfo.departmentAndTeam?this.workerInfo.departmentAndTeam.gtMaterialDepartmentTeamId:''
}
}
await getWorkerInfoListApi(data).then((res) => {
if (res.code == 200) {
console.log(res.result.records);
this.workerList = res.result.records;
@ -467,45 +508,65 @@ export default {
})
},
getTeamInfoList (){
this.workerInfo.departmentAndTeam = ''
let data = {
projectSn: this.projectSn,
enterpriseId: this.workerInfo.enterpriseId?this.workerInfo.enterpriseId:'',
}
getTeamInfoListApi(data).then((res)=>{
// getTeamInfoListApi(data).then((res)=>{
getQueryDepartmentListApi(data).then((res)=>{
if (res.code == 200) {
this.teamInfoList = res.result
console.log('==========班组列表--'+this.personType+'==========',this.teamInfoList)
// this.workerInfo.departmentAndTeam = null
}
})
},
next() {
next(examForm) {
// if(this.active == 2) {
// this.$message.warning('');
// return
// };
// this.active++;
if(!this.addCourseForm.name){
this.$message.error('请输入培训计划名称')
return
}
if(!this.addCourseForm.subjectId){
this.$message.error('请选择科目类型')
return
}
if(!this.addCourseForm.title){
this.$message.error('请输入教育主题')
return
}
if(!this.addCourseForm.trainBeginTime){
this.$message.error('请选择培训开始时间')
return
}
if(!this.addCourseForm.trainEndTime){
this.$message.error('请选择培训结束时间')
return
}
if(this.active == 1) {
this.active++;
};
this.$refs[examForm].validate((valid) => {
if(valid){
if(this.active == 1) {
this.active++;
};
}
})
// if(!this.addCourseForm.name){
// this.$message.error('')
// return
// }
// if(!this.addCourseForm.subjectId){
// this.$message.error('')
// return
// }
// if(!this.addCourseForm.courseId){
// this.$message.error('')
// return
// }
// if(!this.addCourseForm.examPaperId){
// this.$message.error('')
// return
// }
// if(!this.addCourseForm.title){
// this.$message.error('')
// return
// }
// if(!this.addCourseForm.trainBeginTime){
// this.$message.error('')
// return
// }
// if(!this.addCourseForm.trainEndTime){
// this.$message.error('')
// return
// }
},
last() {
if(this.active == 2) {
@ -768,6 +829,7 @@ export default {
.item-flex {
display: flex;
}
.item-flex_child{
@ -959,13 +1021,14 @@ export default {
// justify-content: space-between;
width: 100%;
// height:575px;
/deep/ .el-dialog__body {
padding: 0 20px;
}
.dialogLeft {
width: 35%;
width: 50%;
height: 100%;
// background-color: darkred;