竞赛调整暂提

This commit is contained in:
joylink_fanyuhong 2024-02-22 11:10:39 +08:00
parent 0be7c03f81
commit d9ba49392d
11 changed files with 1161 additions and 6 deletions

View File

@ -0,0 +1,123 @@
import request from '@/utils/request';
// 竞赛赛季添加
export function addContestSeason(data) {
return request({
url: '/api/exercise/race/season',
method: 'post',
data
});
}
// 竞赛赛季分页查询
export function queryContestSeasonPaged(params) {
return request({
url: '/api/exercise/race/season/page',
method: 'get',
params
});
}
// 竞赛赛季修改
export function updateContestSeason(id, data) {
return request({
url: `/api/exercise/race/season/${id}`,
method: 'post',
data
});
}
// 竞赛赛季删除
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'
});
}
// 竞赛评分创建基本信息
export function createContextScore(data) {
return request({
url: '/api/exercise/race/score',
method: 'post',
data
});
}
// 竞赛评分列表分页
export function queryContextScorePaged(params) {
return request({
url: '/api/exercise/race/score/page',
method: 'get',
params
});
}
// 竞赛评分删除
export function deleteContextScore(id) {
return request({
url: `/api/exercise/race/score/${id}`,
method: 'delete'
});
}
// 竞赛评分修改评分详情内容
export function updateContextScoreDetail(id, data) {
return request({
url: `/api/exercise/race/score/edit/rule/${id}`,
method: 'post',
data
});
}
// 竞赛评分绑定任务(废弃)
/* export function contextScoreBindTask(ruleId, taskId) {
return request({
url: `/api/exercise/race/score/${ruleId}/${taskId}/bind/task`,
method: 'post'
});
}*/
// 竞赛评分详情
export function getContextScoreDetail(id) {
return request({
url: `/api/exercise/race/score/${id}`,
method: 'get'
});
}
// 竞赛场景分页列表
export function queryContextSencePaged(params) {
return request({
url: '/api/exercise/race/scene/page',
method: 'get',
params
});
}
// 竞赛场景删除
export function deleteContextSence(id) {
return request({
url: `/api/exercise/race/scene/${id}`,
method: 'delete'
});
}
// 竞赛场景详情
export function getContextSenceDetail(id) {
return request({
url: `/api/exercise/race/scene/${id}`,
method: 'get'
});
}
// 实训场景发布到大赛场景
export function publishContextSence(data) {
return request({
url: `/api/exercise/race/scene/publish/training`,
method: 'post',
data
});
}

View File

@ -227,7 +227,8 @@ const ContestModuleManage = () => import('@/views/contestDataManage/contestModul
const ContestTaskManage = () => import('@/views/contestDataManage/contestTaskManage/ContestTaskManage'); const ContestTaskManage = () => import('@/views/contestDataManage/contestTaskManage/ContestTaskManage');
const ContestSceneManage = () => import('@/views/contestDataManage/contestSceneManage/ContestSceneManage'); const ContestSceneManage = () => import('@/views/contestDataManage/contestSceneManage/ContestSceneManage');
const ContestTaskScoreManage = () => import('@/views/contestDataManage/contestTaskScoreManage/ContestTaskScoreManage'); const ContestTaskScoreManage = () => import('@/views/contestDataManage/contestTaskScoreManage/ContestTaskScoreManage');
const ContestSeasonManage = () => import('@/views/contestDataManage/contestSceneManage/ContestSceneManage'); const ContestSeasonManage = () => import('@/views/contestDataManage/contestSeasonManage/ContestSeasonManage');
const ContestScoreEdit = () => import('@/views/contestDataManage/contestTaskScoreManage/edit');
// import { GenerateRouteProjectList } from '@/scripts/ProjectConfig'; // import { GenerateRouteProjectList } from '@/scripts/ProjectConfig';
// import { getSessionStorage } from '@/utils/auth'; // import { getSessionStorage } from '@/utils/auth';
@ -2072,7 +2073,12 @@ export const asyncRouter = [
} }
}, },
{ {
// 竞赛场景草稿管理 path: 'contestTaskScoreEdit',
component: ContestScoreEdit,
hidden: true
},
{
// 竞赛赛季管理
path: 'contestSeasonManage', path: 'contestSeasonManage',
component: ContestSeasonManage, component: ContestSeasonManage,
meta: { meta: {

View File

@ -1,3 +1,115 @@
<template> <template>
<div>竞赛场景管理</div> <div>
<query-list-page ref="user" :card-padding="10" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
</div>
</template> </template>
<script>
import { queryContextSencePaged, deleteContextSence } from '@/api/contest';
export default {
name: 'ContestSeasonManage',
data() {
return {
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
reset: true,
labelWidth: '80px',
leftSpan: 18,
beforeQuery: this.beforeQuery,
queryObject: {
name: {
type: 'text',
label: '名 称'
},
type: {
type: 'select',
label: '类 型',
config: {
data: [{label: '二维', value: 1}, {label: '三维', value: 2}]
}
}
}
},
queryList: {
query: queryContextSencePaged,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: '名 称',
prop: 'name'
},
{
title: '类 型',
prop: 'type',
type: 'tag',
columnValue: (row) => { return row.type === 1 ? '二维' : '三维'; }
},
{
title: '创建时间',
prop: 'createTime',
type: 'tag',
columnValue: (row) => { return row.modifyInfo.createTime; }
},
{
title: '修改时间',
prop: 'updateTime',
type: 'tag',
columnValue: (row) => { return row.modifyInfo.updateTime; }
},
{
type: 'button',
title: '操 作',
width: '320',
buttons: [
// {
// name: '',
// handleClick: this.doEdit
// },
{
name: '删 除',
handleClick: this.doDelete,
type: 'danger'
}
]
}
]
// actions: [
// { text: ' ', handler: this.doCreate }
// ]
}
};
},
methods: {
reloadTable() {
this.queryList.reload();
},
doCreate() {
// this.$refs.addSeason.doShow();
},
doEdit(row) {
// this.$refs.addSeason.doShow(row);
},
doDelete(index, row) {
this.$confirm('该操作将删除竞赛场景,是否继续?', '提 示', {
confirmButtonText: '确 定',
cancelButtonText: '取 消',
type: 'warning'
}).then(() => {
deleteContextSence(row.id).then(resp => {
this.reloadTable();
}).catch(error => {
this.$message.error(`删除删除竞赛场景失败: ${error.message}`);
});
});
}
}
};
</script>
<style scoped>
</style>

View File

@ -1,10 +1,125 @@
<template> <template>
<div>竞赛赛季管理</div> <div>
<query-list-page ref="user" :card-padding="10" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<add-season ref="addSeason" @reloadTable="reloadTable" />
</div>
</template> </template>
<script> <script>
import { queryContestSeasonPaged, deleteContestSeason } from '@/api/contest';
import AddSeason from './add';
export default { export default {
name: 'ContestSeasonManage' name: 'ContestSeasonManage',
components: {
AddSeason
},
data() {
return {
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
reset: true,
labelWidth: '80px',
leftSpan: 18,
beforeQuery: this.beforeQuery,
queryObject: {
code: {
type: 'text',
label: '编 号'
},
group: {
type: 'select',
label: '组 别',
config: {
data: [{label: '高职', value: 1}, {label: '中职', value: 2}]
}
},
term: {
type: 'text',
label: '年 度'
}
}
},
queryList: {
query: queryContestSeasonPaged,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: '编 号',
prop: 'code'
},
{
title: '组 别',
prop: 'group',
type: 'tag',
columnValue: (row) => { return row.group === 1 ? '高职' : '中职'; }
},
{
title: '年 度',
prop: 'term'
},
{
title: '创建时间',
prop: 'createTime',
type: 'tag',
columnValue: (row) => { return row.modifyInfo.createTime; }
},
{
title: '修改时间',
prop: 'updateTime',
type: 'tag',
columnValue: (row) => { return row.modifyInfo.updateTime; }
},
{
type: 'button',
title: '操 作',
width: '320',
buttons: [
{
name: '编辑',
handleClick: this.doEdit
},
{
name: '删 除',
handleClick: this.doDelete,
type: 'danger'
}
]
}
],
actions: [
{ text: '添 加', handler: this.doCreate }
]
}
};
},
methods: {
reloadTable() {
this.queryList.reload();
},
doCreate() {
this.$refs.addSeason.doShow();
},
doEdit(row) {
this.$refs.addSeason.doShow(row);
},
doDelete(index, row) {
this.$confirm('该操作将删除竞赛赛季,是否继续?', '提 示', {
confirmButtonText: '确 定',
cancelButtonText: '取 消',
type: 'warning'
}).then(() => {
deleteContestSeason(row.id).then(resp => {
this.reloadTable();
}).catch(error => {
this.$message.error(`删除删除竞赛赛季失败: ${error.message}`);
});
});
}
}
}; };
</script> </script>

View File

@ -0,0 +1,107 @@
<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="130px">
<el-form-item label="赛季编码:" prop="code">
<el-input v-model="formModel.code" style="width: 200px;" />
</el-form-item>
<el-form-item label="赛季组别:" prop="group">
<el-select v-model="formModel.group" filterable placeholder="请选择" size="small" style="width: 200px;">
<el-option v-for="item in groupList" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="赛季年度:" prop="term">
<el-input v-model="formModel.term" style="width: 200px;" />
</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 { addContestSeason, updateContestSeason } from '@/api/contest';
export default {
name: 'AddSeason',
data() {
return {
dialogVisible: false,
groupList:[{label: '高职', value: 1}, {label: '中职', value: 2}],
formModel: {
id: '',
code: '',
term: '',
group: 1
},
loading: false
};
},
computed: {
rules() {
const crules = {
code: [
{ required: true, message: '请输入赛季编码', trigger: 'blur' }
],
term: [
{ 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.code = row.code;
this.formModel.term = row.term;
this.formModel.group = row.group;
}
},
handleClose() {
this.formModel = {
id: '',
code: '',
term: '',
group: 1
};
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) {
updateContestSeason(data.id, data).then(() => {
this.$message.success('修改竞赛赛季成功!');
this.handleClose();
this.$emit('reloadTable');
}).catch(error => {
this.$message.error(error.message);
this.loading = false;
});
} else {
addContestSeason(data).then(() => {
this.$message.success('创建竞赛赛季成功!');
this.handleClose();
this.$emit('reloadTable');
}).catch(error => {
this.$message.error(error.message);
this.loading = false;
});
}
}
});
}
}
};
</script>

View File

@ -1,3 +1,107 @@
<template> <template>
<div>竞赛任务评分管理</div> <div>
<query-list-page ref="user" :card-padding="10" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<add-score ref="addScore" @reloadTable="reloadTable" />
</div>
</template> </template>
<script>
import { queryContextScorePaged, deleteContextScore } from '@/api/contest';
import AddScore from './add';
export default {
name: 'ContestSeasonManage',
components: {
AddScore
},
data() {
return {
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
reset: true,
labelWidth: '80px',
leftSpan: 18,
beforeQuery: this.beforeQuery,
queryObject: {
name: {
type: 'text',
label: '名 称'
}
}
},
queryList: {
query: queryContextScorePaged,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: '名 称',
prop: 'name'
},
{
title: '创建时间',
prop: 'createTime',
type: 'tag',
columnValue: (row) => { return row.modifyInfo.createTime; }
},
{
title: '修改时间',
prop: 'updateTime',
type: 'tag',
columnValue: (row) => { return row.modifyInfo.updateTime; }
},
{
type: 'button',
title: '操 作',
width: '320',
buttons: [
{
name: '编辑',
handleClick: this.doEdit
},
{
name: '删 除',
handleClick: this.doDelete,
type: 'danger'
}
]
}
],
actions: [
{ text: '添 加', handler: this.doCreate }
]
}
};
},
methods: {
reloadTable() {
this.queryList.reload();
},
doCreate() {
this.$refs.addScore.doShow();
},
doEdit(row) {
this.$router.push({path: '/systemManagement/contestDataManage/contestTaskScoreManage/edit', query:{id:row.id}});
},
doDelete(index, row) {
this.$confirm('该操作将删除竞赛评分规则,是否继续?', '提 示', {
confirmButtonText: '确 定',
cancelButtonText: '取 消',
type: 'warning'
}).then(() => {
deleteContextScore(row.id).then(resp => {
this.reloadTable();
}).catch(error => {
this.$message.error(`删除删除竞赛评分规则失败: ${error.message}`);
});
});
}
}
};
</script>
<style scoped>
</style>

View File

@ -0,0 +1,71 @@
<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="130px">
<el-form-item label="评分规则名称:" prop="code">
<el-input v-model="formModel.code" style="width: 200px;" />
</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 { createContextScore } from '@/api/contest';
export default {
name: 'AddSeason',
data() {
return {
dialogVisible: false,
formModel: {
name: ''
},
loading: false
};
},
computed: {
rules() {
const crules = {
name: [
{ required: true, message: '请输入评分规则名称', trigger: 'blur' }
]
};
return crules;
},
title() {
return '创建评分规则';
}
},
methods:{
doShow() {
this.dialogVisible = true;
},
handleClose() {
this.formModel = {
name: ''
};
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);
createContextScore(data).then(() => {
this.$message.success('创建评分规则成功!');
this.handleClose();
this.$emit('reloadTable');
}).catch(error => {
this.$message.error(error.message);
this.loading = false;
});
}
});
}
}
};
</script>

View File

@ -0,0 +1,100 @@
<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="130px">
<el-form-item label="单元描述:" prop="text">
<el-input v-model="formModel.text" style="width: 200px;" />
</el-form-item>
<el-form-item label="作业程序:" prop="worker">
<el-input v-model="formModel.worker" style="width: 200px;" />
</el-form-item>
<el-form-item label="场景步骤ID:" prop="sceneStepId">
<el-input v-model="formModel.sceneStepId" disabled style="width: 200px;" />
</el-form-item>
<el-form-item label="单元分值:" prop="score">
<el-input-number v-model="formModel.score" style="width: 200px;" :min="0" />
</el-form-item>
<el-form-item label="评分标准:" prop="criteria">
<el-input v-model="formModel.criteria" style="width: 200px;" />
</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>
export default {
name: 'AddSeason',
data() {
return {
dialogVisible: false,
formModel: {
text: '',
worker: '',
score: 0,
criteria: '',
sceneStepId: ''
},
index: -1,
loading: false
};
},
computed: {
rules() {
const crules = {
text: [
{ required: true, message: '请输入单元描述', trigger: 'blur' }
],
worker: [
{ required: true, message: '请输入作业程序', trigger: 'blur' }
],
criteria: [
{ required: true, message: '请输入评分标准', trigger: 'blur' }
]
};
return crules;
},
title() {
return '评分规则单元';
}
},
methods:{
doShow(index, row) {
this.dialogVisible = true;
if (row) {
this.index = index;
this.formModel.text = row.text;
this.formModel.worker = row.worker;
this.formModel.score = row.score;
this.formModel.criteria = row.criteria;
this.formModel.sceneStepId = row.sceneStepId;
}
},
handleClose() {
this.formModel = {
text: '',
worker: '',
score: 0,
criteria: '',
sceneStepId: ''
};
this.index = -1;
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);
this.$emit('addData', this.index, data);
this.handleClose();
}
});
}
}
};
</script>

View File

@ -0,0 +1,131 @@
<template>
<div>
<el-card style="margin: 10px;padding: 10px;">
<div slot="header" style="font-size: 18px;text-align: center;">
<span>评分规则详情</span>
<div style="float: right; padding: 3px 0">
<el-button type="text" @click="doAdd">添加</el-button>
<el-button type="text" @click="doImport">场景导入</el-button>
<el-button type="text" @click="doClear">清空</el-button>
<el-button type="text" @click="doSave">保存</el-button>
<el-button type="text" @click="goBack">返回</el-button>
</div>
</div>
<el-table
:data="tableData"
border
show-summary
:summary-method="getSummaries"
style="width: 100%;margin-top: 10px;"
>
<el-table-column type="index" width="50" />
<el-table-column label="描述" prop="text" />
<el-table-column label="作业程序" prop="worker" />
<el-table-column label="分值" prop="score" width="50" />
<el-table-column label="评分标准" prop="criteria" />
<el-table-column label="场景步骤ID" prop="sceneStepId" width="100" />
<el-table-column label="操作" width="150">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleEdit(scope.$index,scope.row)"
>编辑</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<detail-add ref="detailAdd" @addData="addData" />
<import-scene ref="importScene" @importData="importData" />
<select-scene ref="selectScene" @selectSceneId="selectSceneId" />
</div>
</template>
<script>
import DetailAdd from './detailAdd';
import ImportScene from './importScene';
import SelectScene from './selectScene';
import { updateContextScoreDetail } from '@/api/contest';
export default {
name: 'EditScoreRule',
components: {
DetailAdd,
ImportScene,
SelectScene
},
data() {
return {
tableData:[]
};
},
methods: {
goBack() {
this.$router.go(-1);
},
doSave() {
const data = Object.assign({}, this.tableData);
updateContextScoreDetail(this.$route.query.id, data);
},
handleEdit(index, data) {
this.$refs.detailAdd.doShow(index, data);
},
doClear() {
this.tableData = [];
},
doImport() {
this.$refs.selectScene.doShow();
},
selectSceneId(id) {
this.$refs.importScene.doShow(id);
},
importData(data) {
data.forEach(elem => {
this.tableData.push(elem);
});
},
doAdd() {
this.$refs.detailAdd.doShow();
},
addData(index, data) {
if (index > -1) {
this.$set(this.tableData, index, data);
} else {
this.tableData.push(data);
}
},
getSummaries(param) {
const { columns, data } = param;
const sums = [];
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '总分';
return;
}
if (index === 3) {
const values = data.map(item => Number(item[column.property]));
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
sums[index] += '';
} else {
sums[index] = '/';
}
});
return sums;
}
}
};
</script>
<style scoped>
</style>

View File

@ -0,0 +1,173 @@
<template>
<el-dialog v-dialogDrag title="场景导入" :visible.sync="dialogVisible" width="900px" :before-close="cancel" center :close-on-click-modal="false">
<el-form ref="form" :model="addModel" label-width="70px" :rules="rules" :inline="true">
<el-form-item label="角色:" prop="memberId" style="display:inline-block">
<el-select v-model="addModel.memberId" placeholder="" style="width:200px" size="mini" @change="changeMember">
<el-option
v-for="item in memberList"
:key="item.id"
:label="item.label"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="总分:" prop="fullMarks" style="display:inline-block">
<el-input-number v-model="addModel.fullMarks" :disabled="true" style="width:200px" :min="0" size="mini" :step="1" />
</el-form-item>
<el-form-item>
<el-button type="primary" size="mini" @click="commit">导入</el-button>
</el-form-item>
</el-form>
<el-table
id="gradeRules"
ref="gradeRules"
:data="allStepList"
border
:max-height="tableHeight"
>
<el-table-column
type="index"
label="序号"
width="80"
/>
<el-table-column
prop="description"
label="步骤描述"
/>
<el-table-column
prop="score"
label="分值"
width="200"
>
<template v-if="addModel.memberId == scope.row.memberId" slot-scope="scope">
<el-input-number v-model="currentStepMap[scope.row.id]" style="width:145px" :min="0" size="mini" :step="1" @change="stepScoreChange" />
</template>
</el-table-column>
</el-table>
</el-dialog>
</template>
<script>
import {handleMemberList} from '@/utils/simulation';
import { getTrainingStepList, getTrainingPlayers, getTrainingGradeRules } from '@/api/trainingManage';
import { getContextSenceDetail } from '@/api/contest';
export default {
name: 'ImportScene',
data() {
return {
trainingId:'',
loading:false,
dialogVisible: false,
allStepList:[],
memberList:[],
currentStepMap:{}, // key stepId value
gradeRulesMap:{}, // map keymemberId value
addModel:{
memberId:'',
fullMarks:''
},
rules:{
memberId: [
{ required: true, message: '请选择角色', trigger: 'change' }
],
fullMarks: [
{ required: true, message: '请输入总分', trigger: 'blur' }
]
}
};
},
computed: {
tableHeight() {
const s = 250;
const h = this.$store.state.app.height;
return h - s;
}
},
methods:{
async doShow(id) {
this.dialogVisible = true;
try {
this.trainingId = id;
const stepResp = await getTrainingStepList(id);
this.allStepList = stepResp.data || [];
const gradeResp = await getTrainingGradeRules(id);
this.gradeRulesMap = {};
gradeResp.data.forEach(gradeRule=> {
this.gradeRulesMap[gradeRule.memberId] = gradeRule;
});
const playerResp = await getTrainingPlayers(id);
this.memberList = handleMemberList(playerResp.data);
if (this.memberList.length > 0) {
this.changeMember(this.memberList[0].id, stepResp);
}
} catch (e) {
console.error(e);
this.$message.error('初始化数据失败!');
}
},
changeMember(memberId) {
const currentStepMap = {};
this.allStepList.forEach(each=>{
if (each.memberId == memberId) {
currentStepMap[each.id] = 0;
}
});
if (this.gradeRulesMap[memberId]) {
this.addModel.fullMarks = this.gradeRulesMap[memberId].fullMarks;
this.gradeRulesMap[memberId].details.forEach(each=>{
currentStepMap[each.elementId] = each.score;
});
} else {
this.addModel.fullMarks = 0;
}
this.currentStepMap = Object.assign({}, currentStepMap);
this.addModel.memberId = memberId;
},
cancel() {
this.addModel.fullMarks = 0;
this.addModel.memberId = '';
this.gradeRulesMap = {};
this.currentStepMap = {};
this.allStepList = [];
this.trainingId = '';
},
commit() {
const that = this;
this.$refs.form.validate((valid) => {
if (valid) {
const scoreDetails = [];
for (const key in this.currentStepMap) {
scoreDetails.push({elementId: key, score: this.currentStepMap[key]});
}
if (this.addModel.fullMarks === 0) {
this.$message.error('规则无评分项!');
return;
}
this.gradeRulesMap[this.addModel.memberId] = { memberId: this.addModel.memberId, details: scoreDetails, fullMarks: this.addModel.fullMarks };
this.loading = true;
const gradeRulesList = Object.values(that.gradeRulesMap);
// updateTrainingGradeRules(this.trainingId, gradeRulesList).then(resp => {
// this.loading = false;
// this.$message.success('');
// }).catch((e) => {
// this.loading = false;
// console.error(e);
// this.$message.error('');
// });
}
});
},
stepScoreChange() {
let fullMarks = 0;
for (const stepKey in this.currentStepMap) {
fullMarks += this.currentStepMap[stepKey];
}
this.addModel.fullMarks = fullMarks;
}
}
};
</script>
<style scoped>
</style>

View File

@ -0,0 +1,113 @@
<template>
<el-dialog v-dialogDrag title="场景选择" :visible.sync="dialogVisible" width="80%" :before-close="cancel" center :close-on-click-modal="false">
<query-list-page ref="user" :card-padding="10" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
</el-dialog>
</template>
<script>
import { queryContextSencePaged } from '@/api/contest';
export default {
name: 'ContestSeasonManage',
data() {
return {
dialogVisible: false,
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
reset: true,
labelWidth: '80px',
leftSpan: 18,
beforeQuery: this.beforeQuery,
queryObject: {
name: {
type: 'text',
label: '名 称'
},
type: {
type: 'select',
label: '类 型',
config: {
data: [{label: '二维', value: 1}, {label: '三维', value: 2}]
}
}
}
},
queryList: {
query: queryContextSencePaged,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: '名 称',
prop: 'name'
},
{
title: '类 型',
prop: 'type',
type: 'tag',
columnValue: (row) => { return row.type === 1 ? '二维' : '三维'; }
},
{
title: '创建时间',
prop: 'createTime',
type: 'tag',
columnValue: (row) => { return row.modifyInfo.createTime; }
},
{
title: '修改时间',
prop: 'updateTime',
type: 'tag',
columnValue: (row) => { return row.modifyInfo.updateTime; }
},
{
type: 'button',
title: '操 作',
width: '320',
buttons: [
{
name: '选 择',
handleClick: this.doSelect,
type: 'danger'
}
]
}
]
}
};
},
methods: {
doShow() {
this.dialogVisible = true;
},
cancel() {
this.dialogVisible = false;
},
reloadTable() {
this.queryList.reload();
},
doSelect(row) {
this.$emit('selectSceneId', row.id);
this.cancel();
}
// doDelete(index, row) {
// this.$confirm('', ' ', {
// confirmButtonText: ' ',
// cancelButtonText: ' ',
// type: 'warning'
// }).then(() => {
// deleteContextSence(row.id).then(resp => {
// this.reloadTable();
// }).catch(error => {
// this.$message.error(`: ${error.message}`);
// });
// });
// }
}
};
</script>
<style scoped>
</style>