This commit is contained in:
“sunzy” 2021-12-22 19:16:07 +08:00
commit 090c57aa5d
6 changed files with 112 additions and 8 deletions

View File

@ -90,3 +90,11 @@ export function getExamListByMapIdAndPrdType(mapId, prdType) {
params: { prdType: prdType }
});
}
/** 更新试卷规则 */
export function updateExamRule(data) {
return request({
url: `/api/exam/update/rules`,
method: 'put',
data:data
});
}

View File

@ -3,14 +3,14 @@ export function getBaseUrl() {
if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud';
BASE_API = 'http://114.116.51.125/jlcloud';
// BASE_API = 'http://114.116.51.125/jlcloud';
// BASE_API = 'http://192.168.8.152:9000'; // 袁琪
// BASE_API = 'http://192.168.8.172:9200'; // 旭强
// BASE_API = 'http://192.168.8.109:9000'; // 张赛
// BASE_API = 'http://192.168.8.140:9000'; // 杜康
// BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康
// BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛
BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛
} else {
BASE_API = process.env.VUE_APP_BASE_API;
}

View File

@ -86,6 +86,16 @@ export default {
},
tagType: (row) => { return ''; }
},
{
title: '试卷规则状态',
prop: 'abnormal',
type: 'tag',
width: '80',
columnValue: (row) => {
return row.abnormal ? '异常' : '正常';
},
tagType: (row) => { return ''; }
},
{
title: '开始时间',
prop: 'startTime'

View File

@ -62,13 +62,13 @@ export default {
return this.display == 2;
},
isNextStep() {
return this.display == 1 && this.$route.params.mode != 'edit';
return this.display == 1;
},
isUpdate() {
return this.display == 1 && this.$route.params.mode == 'edit';
return this.$route.params.mode == 'edit';
},
isCreate() {
return this.display == 2;
return this.display == 2 && this.$route.params.mode !== 'edit';
},
isFastCreate() {
return this.display == 1 && this.$route.params.mode != 'edit' && Number(this.$route.params.ruleId);
@ -149,7 +149,11 @@ export default {
this.$refs.exam.checkedForm('goNextStep');
},
update() {
if(this.display === 1) {
this.$refs.exam.updateForm();
} else if (this.display === 2) {
this.$refs.rule.updateOk();
}
},
create() {
this.$refs.rule.creatOk();

View File

@ -8,13 +8,25 @@
<span>{{ getOperateName(scope.row) }}</span>
</template>
</el-table-column>
<el-table-column prop="num" :label="$t('publish.questionsNumber')" width="100" />
<el-table-column prop="num" :label="$t('publish.questionsNumber')" width="100">
<template slot-scope="scope">
<span>{{ scope.row.num }}</span>
<el-tooltip v-if="checkNum(scope.row)" effect="dark" content="题库数量不足" placement="top">
<span style="color:red;cursor: pointer;">!</span>
</el-tooltip>
</template>
</el-table-column>
<el-table-column prop="point" :label="$t('publish.eachScore')" width="100" />
<el-table-column :label="$t('publish.totalScore')" width="100">
<template slot-scope="scope">
<span>{{ Number(scope.row.num) * Number(scope.row.point) }}</span>
</template>
</el-table-column>
<el-table-column label="题库题数">
<template slot-scope="scope">
<span>{{ getTopicNum(scope.row) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('global.operate')" width="100">
<template slot-scope="scope">
<el-button type="text" size="small" @click="handleForm(scope)">{{ $t('global.edit') }}</el-button>
@ -38,7 +50,7 @@
</template>
<script>
import { createExam } from '@/api/management/exam';
import { createExam, updateExamRule } from '@/api/management/exam';
import { UrlConfig, getOperateTypeMap } from '@/scripts/ConstDic';
import editRule from './editRule';
import ConstConfig from '@/scripts/ConstConfig';
@ -135,6 +147,36 @@ export default {
this.$messageBox(this.$t('publish.addExamRules'));
}
},
async updateOk() {
if (this.ruleList.length) {
let flag = 0;
this.ruleList.forEach(rule => {
flag = flag + (Number(rule.num) * Number(rule.point));
});
if (flag == this.examData.fullMark) {
const result = {
id: this.$route.params.ruleId,
duration: Number(this.examData.duration) * 60, //
examDefinitionRulesVOList: this.ruleList, //
fullPoint: Number(this.examData.fullMark), //
mapId: this.examData.mapId,
prdType: this.examData.prdType,
name: this.examData.name, //
passingPoint: Number(this.examData.passMark), //
remarks: this.examData.desc, //
endTime: this.examData.endDate,
startTime: this.examData.startDate,
type: this.examData.type, //
trial: this.examData.trial == 2 //
};
await this.update(result);
} else {
this.$messageBox(this.$t('publish.addExamRluesError'));
}
} else {
this.$messageBox(this.$t('publish.addExamRules'));
}
},
async save(data) {
try {
const res = await createExam(data);
@ -150,6 +192,21 @@ export default {
this.$messageBox(`${this.$t('publish.saveRuleFailed')} ${error.message}`);
}
},
async update(data) {
try {
const res = await updateExamRule(data);
this.$message.success({ message: res.message });
this.$store.dispatch('exam/setRuleList', []); //
const path = `${this.$route.path.match(/(\/.*)\/examRule/)[1]}${UrlConfig.examRuleManage}`;
if (this.$route.query.source === 'org') {
this.$router.go(-1);
} else {
this.$router.replace({ path: `${path}`, query: { mapId: this.$route.query.mapId, noPreLogout: this.$route.query.noPreLogout} });
}
} catch (error) {
this.$messageBox(`${this.$t('publish.saveRuleFailed')} ${error.message}`);
}
},
addRuleList(data) {
const element = {
trainingType: data.trainingType,
@ -200,6 +257,22 @@ export default {
return trainingName;
}
},
getTopicNum(row) {
//this.operationTypeNums
//console.log(row, this.operationTypeNums);
return this.operationTypeNums[row.trainingType] ? (this.operationTypeNums[row.trainingType][row.operateType]||0): 0;
},
checkNum(row) {
if(!this.operationTypeNums[row.trainingType]) {
return true;
} else if(!this.operationTypeNums[row.trainingType][row.operateType]){
return true;
} else if(row.num > this.operationTypeNums[row.trainingType][row.operateType]) {
return true;
} else {
return false;
}
},
handleForm(data) {
this.indexCourse = data.$index;
const list = JSON.stringify(data.row);

View File

@ -104,6 +104,15 @@ export default {
default: return 'danger';
}
}
},
{
title: '试卷规则状态',
prop: 'abnormal',
type: 'tag',
columnValue: (row) => {
return row.abnormal ? '异常' : '正常';
},
tagType: (row) => { return ''; }
},
{
type: 'button',