This commit is contained in:
joylink_fanyuhong 2024-02-22 11:33:03 +08:00
commit d77e872858
8 changed files with 921 additions and 44 deletions

View File

@ -1,6 +1,209 @@
import request from '@/utils/request';
// 竞赛赛季添加
/**
* 获取竞赛试卷分页列表
* @param {Object} data
* @param {String} data.name 试卷名称
*/
export function getPaperList(data) {
return request({
url: '/api/exercise/race/pager/page',
method: 'GET',
data
});
}
/**
* 创建试卷
* @param {Object} data
* @param {String} data.name 试卷名称
* @param {String} data.desc 基础描述
* @param {Number} data.seasonId 所属赛季id
*/
export function createPaper(data) {
return request({
url: '/api/exercise/race/paper',
method: 'POST',
data
});
}
/**
* @param {Object} data 同创建试卷
* @param {Number} id 试卷id
*/
export function editPaper(id, data) {
return request({
url: `/api/exercise/race/paper/${id}`,
method: 'POST',
data
});
}
/**
* @param {Number} id 任务id
*/
export function deletePaper(id) {
return request({
url: `/api/exercise/race/paper/${id}`,
method: 'DELETE'
});
}
/**
* 获取竞赛模块分页列表
* @param {Object} data
* @param {String} data.paperName 试卷名称
* @param {Number} data.paperId 试卷id
* @param {String} data.code 模块名称
*/
export function getModuleList(data) {
return request({
url: '/api/exercise/race/module/page',
method: 'GET',
data
});
}
/**
* 创建模块
* @param {Object} data
* @param {String} data.code 模块名称
* @param {String} data.desc 基础描述
* @param {Number} data.paperId 试卷id
*/
export function createModule(data) {
return request({
url: '/api/exercise/race/module',
method: 'POST',
data
});
}
/**
* @param {Object} data 同创建试卷
* @param {Number} id 模块id
*/
export function editModule(id, data) {
return request({
url: `/api/exercise/race/module/${id}`,
method: 'POST',
data
});
}
/**
* @param {Number} id 模块id
*/
export function deleteModule(id) {
return request({
url: `/api/exercise/race/module/${id}`,
method: 'DELETE'
});
}
/**
* @param {Number} id 模块id
*/
export function getModuleDetail(id) {
return request({
url: `/api/exercise/race/module/${id}`,
method: 'GET'
});
}
/**
* @param {Object} data
* @param {Number} data.taskIds 模块里所有任务id一级任务的id
* @param {Number} data.group 任务分组
* @param {Number} data.group.taskIds 次分组中的任务id
* @param {Number} data.group.name 分组的名字
* @param {Number} data.group.group 次分组的子分组
*/
export function moduleTaskSetting(moudleId, data) {
return request({
url: `/api/exercise/race/module/setting/${moudleId}/task`,
method: 'POST',
data
});
}
/** 查看所有任务数据 */
export function getTaskTreeDatas() {
return request({
url: '/api/exercise/race/task/tree',
method: 'GET'
});
}
/**
* 创建任务
* @param {Object} data
* @param {String} data.name 任务名称
* @param {String} data.desc 基础描述
* @param {String} data.content 考核内容
* @param {String} data.standards 评价标准
* @param {Number} data.parentId 如果是子任务需要父任务的id
*/
export function createTask(data) {
return request({
url: '/api/exercise/race/task',
method: 'POST',
data
});
}
/**
* @param {Object} data 同创建任务
* @param {Number} id 任务id
*/
export function editTask(id, data) {
return request({
url: `/api/exercise/race/task/${id}`,
method: 'POST',
data
});
}
/**
* @param {Number} id 任务id
*/
export function deleteTask(id) {
return request({
url: `/api/exercise/race/task/${id}`,
method: 'DELETE'
});
}
/**
* @param {Number} id 任务id
*/
export function getchildrenTaskDatas(id) {
return request({
url: `/api/exercise/race/task/${id}/children`,
method: 'GET'
});
}
/**
* @param {Object} data
* @param {Number} data.taskId 任务id
* @param {Number} data.bindId 绑定id根据bindtype来区分对应的id
* @param {String} data.bindType rule =评分规则;scene=场景
*/
export function bindTask(data) {
return request({
url: '/api/exercise/race/task/bind',
method: 'POST',
data
});
}
/**
* @param {Object} data
* @param {Number} data.group 分组 1-高职 2中职
* @param {String} data.term 赛季
* @param {String} data.code 编号
*/
export function addContestSeason(data) {
return request({
url: '/api/exercise/race/season',
@ -8,7 +211,12 @@ export function addContestSeason(data) {
data
});
}
// 竞赛赛季分页查询
/**
* @param {Object} params
* @param {Number} params.group 分组 1-高职 2中职
* @param {String} params.term 赛季
* @param {String} params.code 编号
*/
export function queryContestSeasonPaged(params) {
return request({
url: '/api/exercise/race/season/page',
@ -16,7 +224,13 @@ export function queryContestSeasonPaged(params) {
params
});
}
// 竞赛赛季修改
/**
* @param {Object} data
* @param {Number} id 赛季id
* @param {String} data.group 分组 ZZ=中职GZ=高职
* @param {String} data.term 赛季
* @param {String} data.code 编号
*/
export function updateContestSeason(id, data) {
return request({
url: `/api/exercise/race/season/${id}`,
@ -24,29 +238,19 @@ export function updateContestSeason(id, data) {
data
});
}
// 竞赛赛季删除
/**
* @param {Number} id 赛季id
*/
export function deleteContestSeason(id) {
return request({
url: `/api/exercise/race/season/${id}`,
method: 'delete'
});
}
// 竞赛场景分页查询
export function queryContestSencePaged(params) {
return request({
url: '/api/exercise/race/scene/page',
method: 'get',
params
});
}
// 竞赛场景删除
export function deleteContestSence(id) {
return request({
url: `/api/exercise/race/scene/${id}`,
method: 'delete'
});
}
// 竞赛评分创建基本信息
/**
* @param {Object} data
* @param {String} data.name 名称
*/
export function createContextScore(data) {
return request({
url: '/api/exercise/race/score',
@ -54,7 +258,10 @@ export function createContextScore(data) {
data
});
}
// 竞赛评分列表分页
/**
* @param {Object} params
* @param {String} params.name 名称
*/
export function queryContextScorePaged(params) {
return request({
url: '/api/exercise/race/score/page',
@ -62,14 +269,25 @@ export function queryContextScorePaged(params) {
params
});
}
// 竞赛评分删除
/**
* @param {Number} id 评分id
*/
export function deleteContextScore(id) {
return request({
url: `/api/exercise/race/score/${id}`,
method: 'delete'
});
}
// 竞赛评分修改评分详情内容
/**
* @param {Number} id 评分id
* @param {Object} data
* @param {Array [object]} data.units 评分单元
* @param {String} data.units[0].text 文字描述
* @param {Number} data.units[0].sceneStepId 场景步骤ID
* @param {Number} data.units[0].score 分值
* @param {String} data.units[0].worker 作业程序
* @param {String} data.units[0].criteria 评分标准
*/
export function updateContextScoreDetail(id, data) {
return request({
url: `/api/exercise/race/score/edit/rule/${id}`,
@ -77,43 +295,49 @@ export function updateContextScoreDetail(id, data) {
data
});
}
// 竞赛评分绑定任务(废弃)
/* export function contextScoreBindTask(ruleId, taskId) {
return request({
url: `/api/exercise/race/score/${ruleId}/${taskId}/bind/task`,
method: 'post'
});
}*/
// 竞赛评分详情
/**
* @param {Number} id 评分id
*/
export function getContextScoreDetail(id) {
return request({
url: `/api/exercise/race/score/${id}`,
method: 'get'
});
}
// 竞赛场景分页列表
export function queryContextSencePaged(params) {
/**
* @param {Object} params
* @param {String} params.type 竞赛类型 local=场景;link=3D
*/
export function queryContestSencePaged(params) {
return request({
url: '/api/exercise/race/scene/page',
method: 'get',
params
});
}
// 竞赛场景删除
export function deleteContextSence(id) {
/**
* @param {Number} id 场景id
*/
export function deleteContestSence(id) {
return request({
url: `/api/exercise/race/scene/${id}`,
method: 'delete'
});
}
// 竞赛场景详情
/**
* @param {Number} id 场景id
*/
export function getContextSenceDetail(id) {
return request({
url: `/api/exercise/race/scene/${id}`,
method: 'get'
});
}
// 实训场景发布到大赛场景
/**
* @param {Object} data
* @param {Number} data.traningPublishId 草稿实训场景id
* @param {String} data.name 大赛场景名称
*/
export function publishContextSence(data) {
return request({
url: `/api/exercise/race/scene/publish/training`,

View File

@ -0,0 +1,128 @@
<template>
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogVisible" width="500px" :before-close="handleClose" center :close-on-click-modal="false">
<el-form ref="ruleForm" :model="formModel" :rules="rules" label-width="100px">
<el-form-item label="模块名称:" prop="code">
<el-input v-model="formModel.code" style="width: 350px;" />
</el-form-item>
<el-form-item label="模块描述:" prop="desc">
<el-input v-model="formModel.desc" type="textarea" style="width:350px;" />
</el-form-item>
<el-form-item label="试卷:" prop="paperId">
<el-select v-model="formModel.seasonId" placeholder="请选择" style="width:350px;">
<el-option
v-for="item in paperOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button v-loading="loading" type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
<el-button @click="handleClose">{{ $t('global.cancel') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { createModule, editModule, getPaperList} from '@/api/contest';
export default {
name: 'AddContestTask',
data() {
return {
dialogVisible: false,
formModel: {
id: '',
code: '', //
desc: '', //
paperId: '' // id
},
paperOptions:[],
loading: false
};
},
computed: {
rules() {
const crules = {
code: [
{ required: true, message: '请输入模块名称', trigger: 'blur' }
],
desc: [
{ required: true, message: '请输入模块描述', trigger: 'blur' }
],
paperId: [
{ required: true, message: '请选择所属试卷', trigger: 'blur' }
]
};
return crules;
},
title() {
return this.formModel.id ? '修改模块' : '创建模块';
}
},
methods:{
doShow(row) {
getPaperList().then((res) => {
this.paperOptions = res.data.list;
});
this.dialogVisible = true;
if (row) {
this.formModel.id = row.id;
this.formModel.code = row.code;
this.formModel.desc = row.desc;
this.formModel.paperId = row.paperId;
} else {
this.formModel = {
id: '',
code: '',
desc: '',
paperId: ''
};
this.$nextTick(() => {
this.$refs.ruleForm.resetFields();
});
}
},
handleClose() {
this.formModel = {
id: '',
code: '',
desc: '',
paperId: ''
};
this.$refs.ruleForm.resetFields();
this.dialogVisible = false;
this.loading = false;
},
doSave() {
this.$refs.ruleForm.validate((valid) => {
if (valid) {
this.loading = true;
const data = Object.assign({}, this.formModel);
delete data.id;
if (this.formModel.id) {
editModule(data).then(() => {
this.$message.success('修改模块成功!');
this.handleClose();
this.$emit('moduleListRefresh');
}).catch(error => {
this.$message.error(error.message);
this.loading = false;
});
} else {
createModule(data).then(() => {
this.$message.success('创建模块成功!');
this.handleClose();
this.$emit('moduleListRefresh');
}).catch(error => {
this.$message.error(error.message);
this.loading = false;
});
}
}
});
}
}
};
</script>

View File

@ -1,3 +1,175 @@
<template>
<div>竞赛模块管理</div>
<div style="width: 100%;">
<QueryListPage
ref="moduleQueryListPage"
:card-padding="10"
:query-form="examQueryForm"
:pager-config="pagerConfig"
:query-list="examQueryList"
/>
<add-edit-module ref="addEditModule" @moduleListRefresh="moduleListRefresh" />
<detail-module ref="detailModule" />
</div>
</template>
<script>
import { getPaperList, deleteModule } from '@/api/contest';
import AddEditModule from './AddEditModule.vue';
import DetailModule from './DetailModule.vue';
export default {
name: 'MoudleManage',
components: { AddEditModule, DetailModule },
data() {
return {
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
seasonlist: [],
examQueryForm: {
leftSpan: 14,
textAlign: 'right',
labelWidth: '90px',
reset: true,
columnNum: 3,
queryObject: {
code: {
type: 'text',
label: '模块名称:'
},
paperName: {
type: 'text',
label: '试卷名称:'
},
paperId: {
type: 'text',
label: '试卷id:'
}
}
},
examQueryList: {
query: obj => this.getListApi(obj),
selectCheckShow: false,
indexShow: false,
columns: [
{
title: '模块名称',
prop: 'code'
},
{
title: '模块描述',
prop: 'desc'
},
{
title: '试卷名称',
prop: 'paperName'
},
{
title: '试卷id',
prop: 'paperId'
},
{
title: '考试时间',
prop: 'duration'
},
{
title: '创建时间',
prop: 'createTime'
},
{
title: '更新时间',
prop: 'updateTime'
},
{
title: '创建者id',
prop: 'creatorId'
},
{
title: '创建者姓名',
prop: 'creatorName'
},
{
title: '更新者id',
prop: 'updaterId'
},
{
title: '更新者姓名',
prop: 'updaterName'
},
{
type: 'button',
title: this.$t('global.operate'),
width: '350',
buttons: [
{
name: '编辑',
handleClick: this.editPaper,
type: 'primary'
},
{
name: '删除',
handleClick: this.handleDelete,
type: 'danger'
},
{
name: '模块详情',
handleClick: this.openDetailDialog,
type: 'info'
}
]
}
],
actions: [{ text: '新建模块', handler: this.creatPaper }]
}
};
},
computed: {
userId() {
return this.$store.state.user.id;
}
},
methods: {
getListApi(obj) {
return getPaperList({ ...obj });
},
editPaper(index, row) {
this.$refs.addEditModule.doShow(row);
},
creatPaper() {
this.$refs.addEditModule.doShow();
},
handleDelete(data) {
this.$confirm('确定删除该试卷吗?', this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
})
.then(() => deleteModule(data.id))
.then(() => {
this.moduleListRefresh();
this.$message({
type: 'success',
message: '删除成功!'
});
})
.catch(res => {
if (res.code && res.code !== 200) {
this.$message({ type: 'error', message: res.message });
}
});
},
openDetailDialog(index, row) {
this.$refs.detailModule.doShow(row.id);
},
moduleListRefresh() {
this.$nextTick(() => {
this.$refs.moduleQueryListPage.refresh(true);
});
}
}
};
</script>
<style scoped></style>

View File

@ -0,0 +1,97 @@
<template>
<el-dialog v-dialogDrag title="模块详情" :visible.sync="dialogVisible" width="500px" :before-close="handleClose" center :close-on-click-modal="false">
<el-form ref="ruleForm" :model="formModel" :rules="rules" label-width="100px">
<el-form-item label="任务:" prop="paperId">
<el-select v-model="formModel.taskIds" multiple placeholder="请选择" style="width:350px;">
<el-option
v-for="item in taskOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="分组:" prop="paperId">
<el-tree
:data="formModel.group"
:props="defaultProps"
accordion
/>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button v-loading="loading" type="primary" @click="doSave">设置模块任务</el-button>
<el-button @click="handleClose">{{ $t('global.cancel') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { getModuleDetail, getTaskTreeDatas, moduleTaskSetting} from '@/api/contest';
export default {
name: 'DetailModule',
data() {
return {
dialogVisible: false,
formModel: {
taskIds: [], //
group:[{name:'', taskIds: [], group:[] }]//
},
taskOptions:[],
loading: false,
moduleId:'',
defaultProps: {
children: 'children',
label: 'label'
}
};
},
computed: {
rules() {
const crules = {
taskIds: [
{ required: true, message: '请选择模块任务', trigger: 'blur' }
]
};
return crules;
}
},
methods:{
doShow(moduleId) {
getTaskTreeDatas().then((res) => {
this.taskOptions = res.data;
});
getModuleDetail(moduleId).then((res) => {
this.formModel = res.data;
});
this.dialogVisible = true;
this.moduleId = moduleId;
},
handleClose() {
this.formModel = {
taskIds: [], //
group:[{name:'', taskIds: [], group:[] }]//
};
this.$refs.ruleForm.resetFields();
this.dialogVisible = false;
this.loading = false;
},
doSave() {
this.$refs.ruleForm.validate((valid) => {
if (valid) {
this.loading = true;
const data = Object.assign({}, this.formModel);
moduleTaskSetting(this.moduleId, data).then(() => {
this.$message.success('模块任务设置成功!');
this.handleClose();
}).catch(error => {
this.$message.error(error.message);
this.loading = false;
});
}
});
}
}
};
</script>

View File

@ -5,7 +5,7 @@
</template>
<script>
import { queryContextSencePaged, deleteContextSence } from '@/api/contest';
import { queryContestSencePaged, deleteContestSence } from '@/api/contest';
export default {
name: 'ContestSeasonManage',
data() {
@ -34,7 +34,7 @@ export default {
}
},
queryList: {
query: queryContextSencePaged,
query: queryContestSencePaged,
selectCheckShow: false,
indexShow: true,
columns: [
@ -99,7 +99,7 @@ export default {
cancelButtonText: '取 消',
type: 'warning'
}).then(() => {
deleteContextSence(row.id).then(resp => {
deleteContestSence(row.id).then(resp => {
this.reloadTable();
}).catch(error => {
this.$message.error(`删除删除竞赛场景失败: ${error.message}`);

View File

@ -0,0 +1,131 @@
<template>
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogVisible" width="500px" :before-close="handleClose" center :close-on-click-modal="false">
<el-form ref="ruleForm" :model="formModel" :rules="rules" label-width="100px">
<el-form-item label="试卷名称:" prop="name">
<el-input v-model="formModel.name" style="width: 350px;" />
</el-form-item>
<el-form-item label="试卷描述:" prop="desc">
<el-input v-model="formModel.desc" type="textarea" style="width:350px;" />
</el-form-item>
<el-form-item label="所属赛季:" prop="seasonId">
<el-select v-model="formModel.seasonId" placeholder="请选择" style="width:350px;">
<el-option
v-for="item in seasonOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button v-loading="loading" type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
<el-button @click="handleClose">{{ $t('global.cancel') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { createPaper, editPaper} from '@/api/contest';
export default {
name: 'AddContestTask',
data() {
return {
dialogVisible: false,
formModel: {
id: '',
name: '', //
desc: '', //
seasonId: 0 // id
},
seasonOptions:[{
value: 1,
label: '赛季1'
}, {
value: 2,
label: '赛季2'
}],
loading: false
};
},
computed: {
rules() {
const crules = {
name: [
{ required: true, message: '请输入试卷名称', trigger: 'blur' }
],
desc: [
{ required: true, message: '请输入试卷描述', trigger: 'blur' }
],
seasonId: [
{ required: true, message: '请选择试卷所属赛季', trigger: 'blur' }
]
};
return crules;
},
title() {
return this.formModel.id ? '修改试卷' : '创建试卷';
}
},
methods:{
doShow(row) {
this.dialogVisible = true;
if (row) {
this.formModel.id = row.id;
this.formModel.name = row.name;
this.formModel.desc = row.desc;
this.formModel.seasonId = row.seasonId;
} else {
this.formModel = {
id: '',
name: '',
desc: '',
seasonId: ''
};
this.$nextTick(() => {
this.$refs.ruleForm.resetFields();
});
}
},
handleClose() {
this.formModel = {
id: '',
name: '',
desc: '',
seasonId: ''
};
this.$refs.ruleForm.resetFields();
this.dialogVisible = false;
this.loading = false;
},
doSave() {
this.$refs.ruleForm.validate((valid) => {
if (valid) {
this.loading = true;
const data = Object.assign({}, this.formModel);
delete data.id;
if (this.formModel.id) {
editPaper(data).then(() => {
this.$message.success('修改试卷成功!');
this.handleClose();
this.$emit('paperListRefresh');
}).catch(error => {
this.$message.error(error.message);
this.loading = false;
});
} else {
createPaper(data).then(() => {
this.$message.success('创建试卷成功!');
this.handleClose();
this.$emit('paperListRefresh');
}).catch(error => {
this.$message.error(error.message);
this.loading = false;
});
}
}
});
}
}
};
</script>

View File

@ -1,3 +1,128 @@
<template>
<div>竞赛题目管理</div>
<div style="width: 100%;">
<QueryListPage
ref="examQueryListPage"
:card-padding="10"
:query-form="examQueryForm"
:pager-config="pagerConfig"
:query-list="examQueryList"
/>
<add-edit-paper ref="addEditPaper" @paperListRefresh="paperListRefresh" />
</div>
</template>
<script>
import { getPaperList, deletePaper } from '@/api/contest';
import AddEditPaper from './AddEditPaper.vue';
export default {
name: 'SubjectManage',
components: { AddEditPaper },
data() {
return {
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
seasonlist: [],
examQueryForm: {
leftSpan: 14,
textAlign: 'right',
labelWidth: '90px',
reset: true,
columnNum: 3,
queryObject: {
name: {
type: 'text',
label: '试卷名称:'
}
}
},
examQueryList: {
query: obj => this.getListApi(obj),
selectCheckShow: false,
indexShow: false,
columns: [
{
title: '试卷名称',
prop: 'name'
},
{
title: '试卷描述',
prop: 'desc'
},
{
title: '所属赛季',
prop: 'seasonId'
},
{
type: 'button',
title: this.$t('global.operate'),
width: '350',
buttons: [
{
name: '编辑',
handleClick: this.editPaper,
type: 'primary'
},
{
name: '删除',
handleClick: this.handleDelete,
type: 'danger'
}
]
}
],
actions: [{ text: '新建试卷', handler: this.creatPaper }]
}
};
},
computed: {
userId() {
return this.$store.state.user.id;
}
},
created() {
this.seasonlist = [];
},
methods: {
getListApi(obj) {
return getPaperList({ ...obj });
},
editPaper(index, row) {
this.$refs.addEditPaper.doShow(row);
},
creatPaper() {
this.$refs.addEditPaper.doShow();
},
handleDelete(index, data) {
this.$confirm('确定删除该试卷吗?', this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
})
.then(() => deletePaper(data.id))
.then(() => {
this.paperListRefresh();
this.$message({
type: 'success',
message: '删除成功!'
});
})
.catch(res => {
if (res.code && res.code !== 200) {
this.$message({ type: 'error', message: res.message });
}
});
},
paperListRefresh() {
this.$nextTick(() => {
this.$refs.examQueryListPage.refresh(true);
});
}
}
};
</script>
<style scoped></style>

View File

@ -5,7 +5,7 @@
</template>
<script>
import { queryContextSencePaged } from '@/api/contest';
import { queryContestSencePaged } from '@/api/contest';
export default {
name: 'ContestSeasonManage',
data() {
@ -35,7 +35,7 @@ export default {
}
},
queryList: {
query: queryContextSencePaged,
query: queryContestSencePaged,
selectCheckShow: false,
indexShow: true,
columns: [