This commit is contained in:
joylink_fanyuhong 2024-03-12 10:33:51 +08:00
commit 29d5474e40
51 changed files with 4394 additions and 280 deletions

391
src/api/contest.js Normal file
View File

@ -0,0 +1,391 @@
import request from '@/utils/request';
/**
* 获取竞赛试卷分页列表
* @param {Object} params
* @param {String} params.name 试卷名称
*/
export function getPaperList(params) {
return request({
url: '/api/exercise/race/paper/page',
method: 'GET',
params
});
}
/**
* 创建试卷
* @param {Object} data
* @param {String} data.name 试卷名称
* @param {String} data.desc 基础描述
* @param {Number} data.seasonId 所属赛季id
* @param {Boolean} data.supportCopy 是否支持拷贝
*/
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} params
* @param {String} params.group 分组ZZ=中职;GZ=高职
*/
export function getPaperMenu(params) {
return request({
url: '/api/exercise/race/paper/menu',
method: 'GET',
params
});
}
/**
* @param {Object} data
* @param {Array} data.modules 所有模块
* @param {Number} data.modules[i].module_name 模块名字
* @param {Number} data.modules[i].duration 考试总时间
* @param {Number} data.modules[i].group 任务分组
* @param {Number} data.modules[i].group.taskIds 此分组中的任务id
* @param {Number} data.modules[i].group.name 此组的名字
* @param {Number} data.modules[i].group.group 此分组的子分组
*/
export function paperModuleTaskSetting(paperId, data) {
return request({
url: `/api/exercise/race/paper/${paperId}/config`,
method: 'POST',
data
});
}
/**
* @param {Number} id 模块id
*/
export function getPaperDetail(id) {
return request({
url: `/api/exercise/race/paper/${id}`,
method: 'GET'
});
}
/**
* @param {Number} id 模块id
*/
export function copyPaper(id) {
console.log(id);
return request({
url: `/api/exercise/race/paper/${id}/copy`,
method: 'PUT'
});
}
/** 查看所有任务数据 */
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 getTaskDetail(id) {
return request({
url: `/api/exercise/race/task/${id}`,
method: 'GET'
});
}
/**
* @param {Number} id 任务id
*/
export function getchildrenTaskDatas(id) {
return request({
url: `/api/exercise/race/task/${id}/children`,
method: 'GET'
});
}
/**
* @param {Array} data
* @param {Number} taskId 任务id
* @param {Number} data[i].bindId 绑定id根据bindtype来区分对应的id
* @param {String} data[i].bindType rule =0评分规则;scene=1场景
* @param {Number} data[i].status 0=绑定 1=解绑
*/
export function bindTask(taskId, data) {
return request({
url: `/api/exercise/race/task/${taskId}/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',
method: 'post',
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',
method: 'get',
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}`,
method: 'post',
data
});
}
/**
* @param {Number} id 赛季id
*/
export function deleteContestSeason(id) {
return request({
url: `/api/exercise/race/season/${id}`,
method: 'delete'
});
}
/**
* @param {Object} data
* @param {String} data.name 名称
*/
export function createContextScore(data) {
return request({
url: '/api/exercise/race/score',
method: 'post',
data
});
}
/**
* @param {Object} params
* @param {String} params.name 名称
*/
export function queryContextScorePaged(params) {
return request({
url: '/api/exercise/race/score/page',
method: 'get',
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}`,
method: 'post',
data
});
}
/**
* @param {Number} id 评分id
*/
export function getContextScoreDetail(id) {
return request({
url: `/api/exercise/race/score/${id}`,
method: 'get'
});
}
/**
* @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
});
}
/**
* @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`,
method: 'post',
data
});
}
/**
* @param {String} paperId 试卷id
* @param {String} moduleId 模块id
*/
export function getTaskTree(paperId, moduleId) {
return request({
url: `/api/exercise/race/paper/${paperId}/module/${moduleId}/task`,
method: 'get'
});
}
/**
* @param {String} paperId 试卷id
* @param {String} moduleId 模块id
*/
export function beginContestExercise(paperId, moduleId) {
return request({
url: `/api/race/${paperId}/${moduleId}`,
method: 'POST'
});
}
/** 竞赛完成训练 */
export function finishContestExercise() {
return request({
url: '/api/race/finish',
method: 'PUT'
});
}
/** html
* @param {String} id 赛季id
* @param {String} data.htmlContent 内容
*/
export function editSeasonContent(id, data) {
return request({
url: `/api/exercise/race/season/${id}/html`,
method: 'post',
data
});
}
/** html
* @param {String} id 赛季id
*/
export function getSeasonContent(id) {
return request({
url: `/api/exercise/race/season/${id}/html`,
method: 'get'
});
}
export function getTheoryList() {
return request({
url: '/api/exercise/race/paper/questions',
method: 'get'
});
}

View File

@ -15,3 +15,20 @@ export function selectQuestionTypeNum(companyId) {
method: 'get'
});
}
/** 加载场景 */
export function loadRace(simulationId, sceneId) {
return request({
url: `/api/race/${simulationId}/load/${sceneId}`,
method: 'put'
});
}
/** 完成任务 */
export function overTask(taskId, data) {
return request({
url: `/api/race/${taskId}/finish`,
method: 'put',
data
});
}

View File

@ -599,3 +599,11 @@ export function controlYjTrain(simulationId, right) {
params: { right }
});
}
/** 创建仿真不通过功能id */
export function createSimulationNoFunction(mapId, data) {
return request({
url: `/simulation/new/${mapId}`,
method: 'post',
data
});
}

View File

@ -40,11 +40,10 @@ export default {
userRulesManage: 'User Rights Statistics',
contestDataManage:'Contest data management',
contestSubjectManage:'contest subject management',
contestModuleManage:'contest module management',
contestTaskManage:'contest task management',
contestSceneManage:'contest scene management',
contestTaskScoreManage:'contest task score management',
contestSceneDraftManage:'contest scene draft management',
contestSeasonManage:'contest season management',
fileManage: 'File Manage',
frontResourceManage: 'Front-End Resource Management',
iscsPrerecordManage: 'ISCS Advance record management',

View File

@ -107,4 +107,6 @@ export default {
iscsResourcesManage: 'ISCS Resources Manage',
projectManage: 'Project Manage',
frontProjectConfigManage: 'Front Project Config Manage',
}
training: 'Training',
theory: 'Theory'
};

View File

@ -40,11 +40,10 @@ export default {
userRulesManage: '用户权限管理',
contestDataManage:'竞赛数据管理',
contestSubjectManage:'竞赛题目管理',
contestModuleManage:'竞赛模块管理',
contestTaskManage:'竞赛任务管理',
contestSceneManage:'竞赛场景管理',
contestTaskScoreManage:'竞赛任务评分管理',
contestSceneDraftManage:'竞赛场景草稿管理',
contestSeasonManage:'竞赛赛季管理',
fileManage: '文件管理',
frontResourceManage: '前端资源管理',
iscsPrerecordManage: 'ISCS预录管理',

View File

@ -111,4 +111,6 @@ export default {
iscsResourcesManage: 'ISCS资源管理',
projectManage: '项目管理',
frontProjectConfigManage: '前端项目配置管理',
}
training: '实训',
theory: '理论'
};

View File

@ -223,11 +223,15 @@ const ThirdJumpSim = () => import('@/views/newMap/display/thirdJump');
const TmsPage = () => import('@/views/jlmap3d/drive/sceneview/tmsPage');
const ContestSubjectManage = () => import('@/views/contestDataManage/contestSubjectManage/ContestSubjectManage');
const ContestModuleManage = () => import('@/views/contestDataManage/contestModuleManage/ContestModuleManage');
const ContestTaskManage = () => import('@/views/contestDataManage/contestTaskManage/ContestTaskManage');
const ContestSceneManage = () => import('@/views/contestDataManage/contestSceneManage/ContestSceneManage');
const ContestTaskScoreManage = () => import('@/views/contestDataManage/contestTaskScoreManage/ContestTaskScoreManage');
const ContestSceneDraftManage = () => import('@/views/contestDataManage/contestSceneDraftManage/ContestSceneDraftManage');
const ContestSeasonManage = () => import('@/views/contestDataManage/contestSeasonManage/ContestSeasonManage');
const ContestScoreEdit = () => import('@/views/contestDataManage/contestTaskScoreManage/edit');
const ContestList = () => import('@/views/contest/contestList');
const ContestDetail = () => import('@/views/contest/contestDetail');
const ScoringSettlement = () => import('@/views/contest/ScoringSettlement');
const TheoryPage = () => import('@/views/contest/theory');
// import { GenerateRouteProjectList } from '@/scripts/ProjectConfig';
// import { getSessionStorage } from '@/utils/auth';
@ -674,7 +678,6 @@ export const publicAsyncRoute = [
component: PisScreen,
hidden: true
}
];
// 城市轨道项目
export const asyncRouter = [
@ -2039,14 +2042,6 @@ export const asyncRouter = [
i18n: 'newRouter.contestSubjectManage'
}
},
{
// 竞赛模块管理
path: 'contestModuleManage',
component: ContestModuleManage,
meta: {
i18n: 'newRouter.contestModuleManage'
}
},
{
// 竞赛任务管理
path: 'contestTaskManage',
@ -2072,11 +2067,16 @@ export const asyncRouter = [
}
},
{
// 竞赛场景草稿管理
path: 'contestSceneDraftManage',
component: ContestSceneDraftManage,
path: 'contestTaskScoreEdit',
component: ContestScoreEdit,
hidden: true
},
{
// 竞赛赛季管理
path: 'contestSeasonManage',
component: ContestSeasonManage,
meta: {
i18n: 'newRouter.contestSceneDraftManage'
i18n: 'newRouter.contestSeasonManage'
}
}
]
@ -2191,6 +2191,54 @@ export const asyncRouter = [
]
}
];
export const dsxlRouter = [
{
path: '/contest',
component: Layout,
redirect: '/contest/list',
meta: {
i18n: 'router.training',
roles: [user]
},
children: [
{
path: 'list',
component: ContestList,
meta: {
i18n: 'router.training'
}
},
{
path: 'detail',
component: ContestDetail,
hidden: true
},
{
path: 'scoringSettlement',
component: ScoringSettlement,
hidden: true
}
]
},
{
path: '/theory',
component: Layout,
redirect: '/theory/list',
meta: {
i18n: 'router.theory',
roles: [user]
},
children: [
{
path: 'list',
component: TheoryPage,
meta: {
i18n: 'router.theory'
}
}
]
}
];
const createRouter = () => new Router({
base: process.env.VUE_APP_PRO == 'local' ? '/' : '/cbtc/',
mode: 'history', // require service support

View File

@ -84,8 +84,9 @@ class ValidateHandler {
valid = ((operate.val).toString() === stepOperation.val.toString()) && valid;
}
const opParam = operate.param === undefined ? {} : operate.param;
const stepParam = stepOperation.params === undefined ? {} : stepOperation.params;
if ((opParam || stepOperation.params) && !opParam.hasOwnProperty('fileBase64Str')) {
valid = this.checkParamConsistent(opParam, stepOperation.params, operate.operation) && valid;
valid = this.checkParamConsistent(opParam, stepParam, operate.operation) && valid;
}
if (valid && store.state.trainingNew.voiceStepIndex > -1) {

View File

@ -263,7 +263,8 @@ const map = {
picture:'', // 当前的客户端
domConfig: null, // 仿真配置
initClient: '', // 仿真初始客户端
linkSwitchMap: {} // 联动道岔数据
linkSwitchMap: {}, // 联动道岔数据
simulationCreatorId: ''
},
getters: {
@ -1209,6 +1210,9 @@ const map = {
},
setLinkSwitchMap: (state, linkSwitchMap) => {
state.linkSwitchMap = linkSwitchMap;
},
setSimulationCreatorId: (state, creatorId) => {
state.simulationCreatorId = creatorId;
}
},
@ -1499,6 +1503,9 @@ const map = {
},
updateNccDisplayConfig: ({ commit }, displayConfig) => {
commit('updateNccDisplayConfig', displayConfig);
},
setSimulationCreatorId:({ commit }, creatorId) => {
commit('setSimulationCreatorId', creatorId);
}
}
};

View File

@ -1,5 +1,5 @@
// import { loginInfo } from '@/scripts/ProjectConfig';
import { userTrainingPlatform, admin, publicAsyncRoute, asyncRouter, constantRoutes, superAdmin, user } from '@/router/index';
import { userTrainingPlatform, admin, publicAsyncRoute, asyncRouter, constantRoutes, superAdmin, user, dsxlRouter } from '@/router/index';
import { getSessionStorage } from '@/utils/auth';
import store from '@/store/index';
@ -40,7 +40,11 @@ function hasPermission(roles, route, parentsRoles) {
*/
function resetAsyncRouter() {
let list = publicAsyncRoute;
if (getSessionStorage('project') !== 'dsxl') {
list = [...list, ...asyncRouter];
} else {
list = [...list, ...dsxlRouter];
}
return list;
}

View File

@ -21,7 +21,8 @@ const training = {
voiceStepIndex: -1,
examSwitch: false, // 考试开始结束标注
stepRecord: [], // 操作记录
joinTrainingInfo: null
joinTrainingInfo: null,
isRecord: false
},
getters: {
teachMode: (state) => {
@ -131,6 +132,9 @@ const training = {
},
setJoinTrainingInfo: (state, joinTrainingInfo) => {
state.joinTrainingInfo = joinTrainingInfo;
},
setIsRecord: (state, flag) => {
state.isRecord = flag;
}
},
actions: {
@ -234,6 +238,9 @@ const training = {
},
setJoinTrainingInfo: ({ commit }, joinTrainingInfo ) => {
commit('setJoinTrainingInfo', joinTrainingInfo);
},
setIsRecord: ({ commit }, flag) => {
commit('setIsRecord', flag);
}
}
};

View File

@ -27,21 +27,21 @@ export function handlerUrl() {
// BASE_API = 'https://joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://114.116.51.125/jlcloud';
// BASE_API = 'http://192.168.3.47:9000'; // 周寅
// BASE_API = 'http://192.168.33.93:9000'; // 周寅
// BASE_API = 'http://192.168.3.94:9000'; // 旭强
// BASE_API = 'http://192.168.3.15:9000'; // 张赛
// BASE_API = 'http://192.168.33.207:9000'; // 张赛
// BASE_API = 'http://192.168.3.5:9000'; // 夏增彬
// BASE_API = 'http://192.168.3.37:9000'; // 卫志宏
// BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康
// BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛
BASE_SITE = 'https://test.joylink.club/cbtc';
OSS_URL = 'https://192.168.33.233/oss-rtss';
OSS_URL = 'http://192.168.33.233/oss-rtss';
} else if (process.env.NODE_ENV === 'test' && process.env.VUE_APP_PRO === 'local-test') {
// 本地打包测试分支
BASE_API = 'https://192.168.33.233/rtss-server'; // api地址
BASE_SITE = 'https://192.168.33.233/cbtc'; // 前端项目地址
OSS_URL = 'https://192.168.33.233/oss-rtss'; // 资源地址
BASE_API = 'http://192.168.33.233/rtss-server'; // api地址
BASE_SITE = 'http://192.168.33.233/cbtc'; // 前端项目地址
OSS_URL = 'http://192.168.33.233/oss-rtss'; // 资源地址
} else if (process.env.NODE_ENV === 'test') {
// 测试分支
BASE_API = 'https://test.joylink.club/jlcloud';

View File

@ -0,0 +1,86 @@
<template>
<div class="taskContainer">
<el-card class="father">
<div style="margin-bottom:10px;font-size: 22px;font-weight: bolder;height: 34px;text-align: center;line-height: 34px;">打分汇总</div>
<el-tree
:data="taskDta"
node-key="id"
default-expand-all
:props="defaultProps"
:expand-on-click-node="false"
style="margin-bottom:50px"
>
<span slot-scope="{ node, data }" class="custom-tree-node">
<span>{{ node.label }}</span>
<div style="display: flex; justify-content: space-between;">
<div v-if="data.sceneid" style="width:80px;">得分:{{ data.score }}</div>
</div>
</span>
</el-tree>
<div class="son">
<el-button type="primary" size="medium" @click="confirm">确认</el-button>
</div>
</el-card>
</div>
</template>
<script>
import { finishContestExercise} from '@/api/contest';
export default {
name:'ScoringSettlement',
data() {
return {
taskDta:[],
defaultProps: {
children: 'child',
label: 'name'
}
};
},
created() {
finishContestExercise().then((res) => {
this.taskDta = res.data.node;
}).catch(error => {
this.$message.error(error.message);
});
},
methods: {
confirm() {
this.$confirm('是否确认?', this.$t('tip.hint'), {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$router.push('/contest/list');
});
}
}
};
</script>
<style lang="scss" scoped>
.taskContainer{
width: 50%;
margin: 10px auto;
.custom-tree-node {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 16px;
padding-right: 20px;
}
.father{
position: relative;
.son{
position: absolute;
bottom: 10px;
left: 50%;
transform: translateX(-50%);
}
}
}
</style>

View File

@ -0,0 +1,240 @@
<template>
<el-row class="container">
<el-col :span="5" class="container-left">
<el-tree
:data="taskData"
node-key="index"
current-node-key
:props="defaultProps"
default-expand-all
:highlight-current="false"
style="background-color: transparent;max-height: calc(100% - 54px);overflow-y: auto;"
:expand-on-click-node="false"
@node-click="handleClick"
>
<div slot-scope="{ node, data }" class="custom-tree-node" :style="{ cursor: data.nodeType === 'MODULE_GROUP'? 'not-allowed':'pointer' }">
<div :style="{ color: nowData.name === data.name && nowData.id === data.id? '#8f079d': '#fff' }">{{ data.name }}</div>
</div>
</el-tree>
<div class="button-group">
<el-button-group>
<el-button size="small" type="primary" @click="submit">提交</el-button>
<el-button size="small" type="danger" @click="goBack">返回</el-button>
</el-button-group>
</div>
</el-col>
<el-col :span="19" class="container-right">
<el-card class="box-card">
<div slot="header" style="text-align: center">
<span style="font-size: 28px;">{{ nowData.name }}</span>
</div>
<div style="padding: 20px;">
<el-row style="margin-top: 10px;white-space: pre-wrap;">
<el-col :span="3" style="text-align: right;">基础描述</el-col>
<el-col :span="20">{{ nowData.desc }}</el-col>
</el-row>
<el-row style="margin-top: 10px;white-space: pre-wrap;">
<el-col :span="3" style="text-align: right;">考核内容</el-col>
<el-col :span="20">{{ nowData.content }}</el-col>
</el-row>
<el-row style="margin-top: 10px;white-space: pre-wrap;">
<el-col :span="3" style="text-align: right;">评价标准</el-col>
<el-col :span="20">{{ nowData.standards }}</el-col>
</el-row>
</div>
<div style="text-align: center;margin-top: 15px;">
<el-button v-show="nowData.ruleId" v-loading="loading" type="primary" @click="showScoreRule">评分表</el-button>
<el-button v-show="nowData.sceneId" v-loading="loading" type="primary" @click="startTask">开始任务</el-button>
<el-button v-loading="loading" type="primary" :disabled="nowKey === taskList.length-1" @click="nextTask">下一任务</el-button>
</div>
</el-card>
</el-col>
<score-rule ref="scoreRule" />
</el-row>
</template>
<script>
import { getTaskTree, getContextSenceDetail} from '@/api/contest';
import { createSimulationNoFunction } from '@/api/simulation';
import { getPublishMapInfo } from '@/api/jmap/map';
import ScoreRule from './scoreRule';
export default {
name: 'ContestDetail',
components: {
ScoreRule
},
data() {
return {
loading: false,
nowKey: 0,
taskList: [],
taskData: [],
nowData: {},
defaultProps: {
children: 'children',
label: 'name',
disabled: true
},
funcitonData: {
type: 'METRO',
itemMap: {
},
domConfig: {
singleMember: false,
singleClient: false,
client: '',
hasTraining: true,
trainingType: 'SCENE',
hasExam: false,
trainingDesign: false,
hasLpf: false,
hasVoice: true,
joint: false,
hasDeviceManage: false,
hasMemberManage: true
}
}
};
},
mounted() {
// this.taskData = JSON.parse(this.resp);
getTaskTree(this.$route.query.paperId, this.$route.query.moduleId).then(resp => {
const data = resp.data.child;
this.handleData(data, 1);
this.taskData = data;
this.taskList = [];
this.eachTask(this.taskList, this.taskData);
if (this.$route.query.nowKey && this.$route.query.nowKey >= this.taskList.length) {
this.nowKey = this.taskList.length - 1 || 0;
} else {
this.nowKey = this.$route.query.nowKey || 0;
}
this.nowData = this.taskList[this.nowKey];
}).catch(() => this.$message.error('加载数据失败!'));
},
methods: {
handleData(data, index) {
data.forEach((elem, i) => {
elem.index = index + '_' + i;
if (elem.children) {
this.handleData(elem.children, index + 1);
}
});
},
handleClick(data) {
const index = this.taskList.findIndex(ele => {
return ele.id === data.id;
});
if (index < 0) {
return;
}
this.nowKey = index;
this.nowData = this.taskList[this.nowKey];
},
eachTask(list, data) {
data.forEach(ele => {
if (ele.nodeType === 'TASK') {
list.push(ele);
}
if (ele.children) {
this.eachTask(list, ele.children);
}
});
},
nextTask() {
this.nowKey++;
this.nowData = this.taskList[this.nowKey];
},
startTask() {
this.loading = true;
try {
getContextSenceDetail(this.nowData.sceneId).then(resp => {
getPublishMapInfo(resp.data.mapid).then(resp1 => {
createSimulationNoFunction(resp.data.mapid, this.funcitonData).then(resp2 => {
const query = {
lineCode: resp1.data.lineCode,
mapId: resp.data.mapid,
group: resp2.data,
simType: 'METRO',
project: 'dsxl',
paperId: this.$route.query.paperId,
moduleId: this.$route.query.moduleId,
sceneId: this.nowData.sceneId,
taskId: this.nowData.id,
nowKey: this.nowKey
};
this.$router.push({ path: '/display/demon', query: query });
this.loading = false;
});
});
});
} catch (e) {
this.$message.error('创建仿真失败!');
this.loading = false;
}
},
showScoreRule() {
this.$refs.scoreRule.doShow(this.nowData.ruleId);
},
goBack() {
this.$confirm('是否确认返回,返回将放弃改模块测试?', this.$t('tip.hint'), {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$router.push('/contest/list');
}).catch(() => {});
},
submit() {
this.$confirm('是否确认提交?', this.$t('tip.hint'), {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$router.push('/contest/scoringSettlement');
}).catch(() => {});
}
}
};
</script>
<style scoped>
.box-card {
color: #fff;
background-color: transparent;
height: 100%;
border: 1px solid #01468B;
}
.container {
background: linear-gradient(to bottom, #01468B, #00172E);
height: 100%;
}
.container-left{
height: 100%;
padding-top: 10px;
}
.container-right{
background: #00172E;
border: 1px solid #01468B;
height: 100%;
padding: 10px;
}
.custom-tree-node{
color: #fff;
}
.button-group {
width: 20.9%;
text-align: right;
padding: 10px;
border-top: 1px solid #01468B;
position: absolute;
bottom: 0;
}
/deep/.el-tree-node__content{
background-color: transparent !important;
}
/deep/.el-card__header{
border-bottom: 1px solid #01468B;
}
</style>

View File

@ -0,0 +1,262 @@
<template>
<div class="contestPlatform" :style="'padding-left:'+(widthLeft)+'px'">
<div class="contestPaperList" :style="{width: widthLeft+'px'}">
<paper-list ref="paperList" @changeModuleData="changeModuleData" />
<drap-left :width-left="widthLeft" @drapWidth="drapWidth" />
</div>
<div class="module-box">
<div style="height: 50px;text-align: center;line-height: 50px;font-size: 26px;font-weight: bolder;color: #fff;">{{ paperName }}</div>
<el-tabs v-model="activeModuleName" class="tabs-box" type="border-card">
<el-tab-pane label="详情" name="detail">
<div v-if="showSeasonInfo" class="tabs-season" v-html="detailHtmlContent" />
<div v-else class="tabs-module">
<template v-for="(mod, modIndex) in moduleList">
<el-card :key="modIndex" class="tabs-module-card">
<div style="margin-bottom:10px;font-size: 20px;height: 30px;text-align: center;line-height: 30px;">{{ mod.moduleName }}</div>
<div style="margin-bottom:10px">考试时间{{ mod.duration }}分钟</div>
<div class="tabs-module-card-tree"> 任务目录
<el-tree
:data="moduleTreeDatas[modIndex].children"
current-node-key
node-key="id"
:props="defaultProps"
default-expand-all
:expand-on-click-node="false"
:highlight-current="false"
style="background: transparent;color: #fff;"
/>
</div>
<div class="tabs-module-card-button">
<div style="display: flex; justify-content: center;margin-top: 10px;">
<el-button type="primary" size="medium" @click="showScoreRule(mod.moduleScoreRuleId)">评分表</el-button>
<el-button type="primary" size="medium" @click="beginExercise(mod.customModuleId)">开始训练</el-button>
</div>
</div>
</el-card>
</template>
</div>
</el-tab-pane>
</el-tabs>
<score-rule ref="scoreRule" />
</div>
</div>
</template>
<script>
import paperList from './paperList';
import drapLeft from '@/views/components/drapLeft/index';
import ScoreRule from './scoreRule';
import { getTaskTreeDatas, getPaperDetail, beginContestExercise} from '@/api/contest';
let id = 1;
export default {
name: 'ContestList',
components: {
paperList,
drapLeft,
ScoreRule
},
data() {
return {
widthLeft: 380,
paperName:'赛季',
paperId:'',
activeModuleName:'detail',
moduleList:[],
moduleTreeDatas:[],
taskTreeDatas:[],
defaultProps: {
disabled: true
},
allTaskDatas:{},
showSeasonInfo:false,
detailHtmlContent:'赛季信息'
};
},
computed: {
width() {
return this.$store.state.app.width;
}
},
created() {
getTaskTreeDatas().then((res) => {
this.allTaskDatas = res.data.reduce((acc, obj) => {
acc[obj.name] = obj.id;
return acc;
}, {});
}).catch(error => {
this.$message.error(error.message);
});
},
methods: {
drapWidth(width) {
this.widthLeft = Number(width);
},
changeModuleData(paper, season) {
if (paper) {
this.paperName = paper.name;
this.paperId = paper.id;
this.showSeasonInfo = false;
getPaperDetail(paper.id).then((res) => {
this.moduleList = res.data.moduleVo.modules;
this.moduleTreeDatas = this.moduleList.map(moduleItem=>{
let children = [];
if (moduleItem.group.length) {
children = moduleItem.group.map(taskCatalog=> this.transformTree(taskCatalog));
}
return {
id:id++,
label:moduleItem.moduleName,
duration:moduleItem.duration,
moduleScoreRuleId:moduleItem.moduleScoreRuleId,
customModuleId:moduleItem.customModuleId,
type:'module',
children
};
});
this.taskTreeDatas = this.moduleTreeDatas[0].children;
}).catch(error => {
this.$message.error(error.message);
});
} else {
this.showSeasonInfo = true;
this.paperName = season.seasonCode + '—' + season.seasonName;
this.detailHtmlContent = season.detailHtmlContent;
}
},
showScoreRule(moduleScoreRuleId) {
this.$refs.scoreRule.doShow(moduleScoreRuleId);
},
beginExercise(moduleId) {
beginContestExercise(this.paperId, moduleId).then(res => {
this.$router.push({path: '/contest/detail', query:{paperId:this.paperId, moduleId }});
}).catch(error => {
this.$message.error(error.message);
});
},
transformTree(data) {
const result = {label:data.name, children:[], id:id++, type:'taskCatalog' };
data.taskIds.forEach(taskId => {
let label = '';
for (const key in this.allTaskDatas) {
if (this.allTaskDatas[key] === taskId) {
label = key;
break;
}
}
result.children.push({label, id:id++, type:'tasks', parentId:result.id });
});
if (data.group.length) {
const changeGroup = data.group.map(taskCatalog=>
this.transformTree(taskCatalog)
);
result.children.push(...changeGroup);
}
return result;
}
}
};
</script>
<style lang="scss" scoped>
.contestPlatform {
position: relative;
height: 100%;
width: 100%;
overflow: hidden;
.contestPaperList {
position:absolute;
left:0;
top:0;
height: 100%;
background: #00172E;
}
.module-box{
height: 100%;
width: 100%;
padding-bottom: 20px;
background: #00172E;
.tabs-box{
height: calc(100% - 30px);
margin: 0 10px;
overflow-y: auto;
background: transparent;
&::-webkit-scrollbar{
background: #06284a;
}
&::-webkit-scrollbar-thumb{
background: #0c0909;
}
&::-webkit-scrollbar-track{
background: #06284a;
}
.tabs-season{
padding:10px;
color: #fff;
}
.tabs-module{
display: flex;
justify-content: space-between;
color: #fff;
.tabs-module-card{
position: relative;
width:49%;
margin-top: 10px;
padding:10px;
background: transparent;
color: #fff;
.tabs-module-card-tree{
max-height:calc(100vh - 370px);
overflow: auto;
margin-bottom:50px;
&::-webkit-scrollbar{
background: #06284a;
}
&::-webkit-scrollbar-thumb{
background: #0c0909;
}
&::-webkit-scrollbar-track{
background: #06284a;
}
}
.tabs-module-card-button{
position: absolute;
bottom: 10px;
left: 50%;
transform: translateX(-50%);
}
}
}
}
}
}
.el-card{
border: solid 1px #01468B;
}
/deep/{
.el-tree-node__content{
background-color: transparent !important;
}
.el-tabs__nav-scroll{
background: #00172E;
}
.el-tabs--border-card>.el-tabs__header .el-tabs__item{
color: #fff;
border: solid 1px #01468B;
}
.el-tabs--border-card>.el-tabs__header .el-tabs__item.is-active{
background: #01468B;
}
.el-tabs--border-card{
border: solid 1px #01468B;
}
.el-table th.el-table__cell{
background-color: #01468B;
color: #fff;
}
.el-table--border, .el-table--group{
border-width: 0;
}
}
</style>

View File

@ -0,0 +1,161 @@
<template>
<div v-loading="loading" class="paper-list-main">
<div id="trainingMapTree" class="left-paper-list">
<div class="paperListName">
<div style="width: 50px;">组别</div>
<div>
<el-radio v-model="formModel.group" label="GZ" style="color: #fff;" @input="queryPaper">高职</el-radio>
<el-radio v-model="formModel.group" label="ZZ" style="color: #fff;" @input="queryPaper">中职</el-radio>
</div>
</div>
<el-tree
:data="menuTreeData"
node-key="id"
:default-expanded-keys="expanded_keys"
current-node-key
:highlight-current="true"
:props="defaultProps"
style="background-color: transparent;overflow-y: auto;"
:expand-on-click-node="false"
@node-click="handleClick"
>
<div slot-scope="{ node, data }" class="custom-tree-node">
<div :style="{ color: nowData.type === data.type && nowData.label === data.label && nowData.id === data.id? '#ffd04b': '#fff' }">
<span v-if="data.type=='season'">{{ data.seasonCode + '' + data.seasonName }}</span>
<span v-else>{{ node.label }}</span>
</div>
</div>
</el-tree>
</div>
</div>
</template>
<script>
import { getPaperMenu } from '@/api/contest';
export default {
name: 'PaperList',
components: {
},
data() {
return {
loading: true,
formModel: {
group:'GZ' //
},
defaultProps: {
disabled: true
},
menuTreeData:[],
nowData: {},
expanded_keys:[]
};
},
mounted() {
this.queryPaper();
},
methods: {
queryPaper() {
getPaperMenu({ group:this.formModel.group}).then((res) => {
this.menuTreeData = this.transformTree(res.data.menu);
this.$emit('changeModuleData', null, this.menuTreeData[0]);
this.expanded_keys = [this.menuTreeData[0].id];
this.nowData = this.menuTreeData[0];
this.loading = false;
}).catch(error => {
this.$message.error(error.message);
});
},
handleClick(data) {
this.nowData = data;
if (data.type == 'season') {
this.$emit('changeModuleData', null, data);
} else {
this.$emit('changeModuleData', data);
}
},
transformTree(data) {
const result = [];
for (let i = 0; i < data.length; i++) {
const season = data[i];
const seasonItem = {
id: season.seasonId,
label: season.seasonName,
seasonName:season.seasonName,
seasonCode:season.seasonCode,
detailHtmlContent:season.detailHtmlContent,
type:'season',
children:[]
};
if (season.papers) {
for (let i = 0; i < season.papers.length; i++) {
const paper = season.papers[i];
const paperItem = {
id: paper.id,
label: paper.name,
name:paper.name,
type:'paper'
};
seasonItem.children.push(paperItem);
}
}
result.push(seasonItem);
}
return result;
}
}
};
</script>
<style lang="scss" scoped>
.paper-list-main{
height: 100%;
display:flex;
flex-direction:column;
.left-paper-list{
width: 100%;
height: 100%;
flex: 1;
overflow-y: scroll;
padding-bottom: 10px;
background: linear-gradient(to bottom, #01468B, #00172E);
&::-webkit-scrollbar{
background: #06284a;
}
&::-webkit-scrollbar-thumb{
background: #0c0909;
}
&::-webkit-scrollbar-track{
background: #06284a;
}
.paperListName{
display: flex;
justify-content: left;
align-items: center;
position: sticky;
top: 0;
z-index: 9;
height: 55px;
padding: 10px 0 10px 17px;
border-bottom: 1px solid #00172E;
background: #01468B;
color: #fff;
}
.custom-tree-node{
width: 100%;
font-size: 16px;
}
}
}
/deep/{
.el-tree-node__content{
height: 56px;
overflow: hidden;
color: #fff;
&:hover{
background: #00172E !important;
}
}
.el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content{
background-color: #00172E !important;
}
}
</style>

View File

@ -0,0 +1,71 @@
<template>
<el-dialog v-dialogDrag title="评分表" :visible.sync="dialogVisible" width="800px" :before-close="handleClose" center :close-on-click-modal="false">
<el-table
ref="table"
v-loading="loading"
:data="tableData"
border
show-summary
default-expand-all
row-key="id"
:summary-method="getSummaries"
:tree-props="{children: 'children'}"
style="width: 100%;margin-top: 10px;"
>
<el-table-column type="index" width="50" />
<el-table-column label="描述" prop="name" />
<el-table-column label="评分标准" prop="criteria" />
<el-table-column label="分值" prop="score" width="50">
<template slot-scope="scope">
<span>{{ scope.row.score === 0? '': scope.row.score/100 }}</span>
</template>
</el-table-column>
</el-table>
</el-dialog>
</template>
<script>
import { getContextScoreDetail } from '@/api/contest';
export default {
name: 'ScoreRule',
data() {
return {
tableData: [],
dialogVisible: false,
loading: false
};
},
methods: {
doShow(id) {
this.dialogVisible = true;
this.loading = true;
getContextScoreDetail(id).then(resp => {
this.tableData = resp.data.rule ? resp.data.rule.units : [];
this.loading = false;
}).catch(() => { this.loading = false; this.tableData = []; });
},
handleClose() {
this.dialogVisible = false;
},
handleSummaries(data, sums) {
data.forEach(item => {
sums[3] += Number(item.score);
if (item.children && item.children.length) {
this.handleSummaries(item.children, sums);
}
});
},
getSummaries(param) {
const { data } = param;
const sums = ['总分', '/', '/', 0, '/'];
this.handleSummaries(data, sums);
sums[3] = sums[3] / 100;
return sums;
}
}
};
</script>
<style scoped>
</style>

View File

@ -0,0 +1,281 @@
<template>
<el-row class="container">
<el-col :span="5" class="container-left">
<div class="question-container">
<div v-for="(id,j) in idList" :key="id" class="question-box" :class="{'select-question':index===j}" @click="handleClick(j)">{{ j+1 }}</div>
</div>
</el-col>
<el-col :span="19" class="container-right">
<el-card v-loading="loading" class="box-card">
<div slot="header" style="text-align: center">
<span style="font-size: 28px;">{{ `${index +1}` }}</span>
</div>
<div class="question-title">[{{ questionData.typeString }}] {{ questionData.title }}</div>
<div class="options">
<component
:is="type === 2 ? 'el-checkbox-group' : 'el-radio-group'"
v-model="questionData.answer"
class="options-container"
>
<component
:is="type === 2 ? 'el-checkbox' : 'el-radio'"
v-for="el in questionData.options"
:key="el.value"
:disabled="showAnswer"
class="option"
:label="el.value"
>{{ el.label }}</component>
</component>
</div>
<div class="show-answer">
<span v-if="showAnswer" :class="isCorrect? 'correct': 'error'">{{ isCorrect ? '回答正确' : `回答错误正确答案应为:${tip}` }}</span>
</div>
<div class="footer">
<el-button type="primary" :disabled="index === 0" @click="navigate('-')">上一题</el-button>
<el-button type="primary" :disabled="showAnswer" @click="navigate()">确认</el-button>
<el-button
type="primary"
:disabled="index === idList.length - 1"
@click="navigate('+')"
>下一题</el-button>
</div>
</el-card>
</el-col>
</el-row>
</template>
<script>
const types = {
select: '选择题',
judge: '判断题',
multi: '多选题'
};
import {getQuestionInfo } from '@/api/questionBank';
import { getTheoryList } from '@/api/contest';
export default {
name: 'Theory',
data() {
return {
loading: false,
showAnswer: false,
isCorrect: false,
questionData: {
title: '',
typeString: '',
options: [],
answer: ''
},
currentAnswer: '',
idList: [],
id: '',
type: 1,
index:0,
tip: ''
};
},
watch: {
id(val) {
if (val) {
this.getQuestionInfo(val);
}
}
},
mounted() {
this.getData();
},
beforeDestroy() {
},
methods: {
getData() {
this.loading = true;
getTheoryList().then(resp => {
this.idList = resp.data;
this.id = this.idList[this.index];
}).catch(() => {
this.$message.error('获取试题列表失败!');
});
},
getQuestionInfo(val) {
this.loading = true;
this.showAnswer = false;
this.isCorrect = false;
this.tip = '';
getQuestionInfo(val, {random: false}).then(res => {
const data = res.data;
this.questionData = {
title: data.topic,
typeString: types[data.type],
options: data.optionList.map(opt => ({ label: opt.content, value: opt.id })),
answer: data.type === 'multi' ? [] : NaN
};
if (data.type === 'multi') {
this.type = 2;
} else {
this.type = 1;
}
this.currentAnswer = data.answer;
this.loading = false;
}).catch(() => {
this.loading = false;
this.$message.error('获取试题详情失败!');
});
},
handleClick(j) {
this.index = j;
this.id = this.idList[this.index];
},
compareArrays(arr1, arr2) {
if (arr1.length !== arr2.length) {
return false;
}
for (let i = 0; i < arr1.length; i++) {
if (arr1[i] != arr2[i]) {
return false;
}
}
return true;
},
navigate(direction) {
if (direction === '-') {
this.index--;
this.id = this.idList[this.index];
} else if (direction === '+') {
this.index++;
this.id = this.idList[this.index];
} else {
if (this.questionData.typeString === '多选题') {
const an = this.currentAnswer.split(',');
if (this.compareArrays(an, this.questionData.answer)) {
this.isCorrect = true;
this.showAnswer = true;
} else {
this.isCorrect = false;
this.showAnswer = true;
let op = '';
this.questionData.options.forEach(ele => {
const nId = ele.value + '';
if (an.includes(nId)) {
const nContent = op ? ';' + ele.label : ele.label;
op += nContent;
}
});
this.tip = op;
}
} else {
if (this.questionData.answer == this.currentAnswer) {
this.isCorrect = true;
this.showAnswer = true;
} else {
this.isCorrect = false;
this.showAnswer = true;
const op = this.questionData.options.find(ele => ele.value == this.currentAnswer);
this.tip = op.label;
}
}
}
}
}
};
</script>
<style lang="scss" scoped>
.show-answer {
height: 30px;
padding: 0 30px;
span {
font-size: 18px;
}
.correct {
color: green;
}
.error {
color: red;
}
}
.select-question {
border: 2px solid #8f079d !important;
color: #8f079d !important;
font-weight: bolder;
}
.question-container {
height: 100%;
overflow-y: auto;
display: flex;
flex-wrap: wrap;
}
.question-box {
border: 1px solid #fff;
margin: 10px;
display: inline-block;
color: #fff;
text-align: center;
line-height: 40px;
width: 40px;
height: 40px;
cursor: pointer;
}
.question-title {
padding: 30px;
font-size: 20px;
}
/deep/.el-checkbox{
color: #fff;
}
/deep/.el-radio{
color: #fff;
}
.options-container {
display: flex;
flex-direction: column;
padding: 30px;
font-size: 20px;
& > .option {
line-height: 2rem;
height: 2rem;
/deep/.el-radio__label{
font-size: 18px;
}
/deep/.el-checkbox__label{
font-size: 18px;
}
}
}
.footer {
display: flex;
justify-content: center;
}
.box-card {
color: #fff;
background-color: transparent;
height: 100%;
border: 1px solid #01468B;
}
.container {
background: linear-gradient(to bottom, #01468B, #00172E);
height: 100%;
}
.container-left{
height: 100%;
padding-top: 10px;
}
.container-right{
background: #00172E;
border: 1px solid #01468B;
height: 100%;
padding: 10px;
}
.custom-tree-node{
color: #fff;
}
.button-group {
width: 20.9%;
text-align: right;
padding: 10px;
border-top: 1px solid #01468B;
position: absolute;
bottom: 0;
}
</style>

View File

@ -1,3 +0,0 @@
<template>
<div>竞赛模块管理</div>
</template>

View File

@ -1,3 +0,0 @@
<template>
<div>竞赛场景草稿管理</div>
</template>

View File

@ -1,3 +1,122 @@
<template>
<div>竞赛场景管理</div>
<div>
<query-list-page ref="user" :card-padding="10" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
</div>
</template>
<script>
import { queryContestSencePaged, deleteContestSence } 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: 'Local'}, {label: '三维', value: 'Link'}]
}
}
}
},
queryList: {
query: queryContestSencePaged,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: '名 称',
prop: 'name'
},
{
title: '地图',
prop: 'mapName'
},
{
title: '类 型',
prop: 'type',
type: 'tag',
columnValue: (row) => { return row.type === 'Local' ? '二维' : '三维'; },
tagType: (row) => { return ''; }
},
{
title: '创建时间',
prop: 'createTime',
type: 'tag',
columnValue: (row) => { return row.modifyInfo.createTime; },
tagType: (row) => { return ''; }
},
{
title: '修改时间',
prop: 'updateTime',
type: 'tag',
columnValue: (row) => { return row.modifyInfo.updateTime; },
tagType: (row) => { return ''; }
},
{
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(() => {
deleteContestSence(row.id).then(resp => {
this.reloadTable();
}).catch(error => {
this.$message.error(`删除删除竞赛场景失败: ${error.message}`);
});
});
}
}
};
</script>
<style scoped>
</style>

View File

@ -0,0 +1,140 @@
<template>
<div>
<query-list-page ref="user" :card-padding="10" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<add-season ref="addSeason" @reloadTable="reloadTable" />
<edit-content ref="editContent" />
</div>
</template>
<script>
import { queryContestSeasonPaged, deleteContestSeason } from '@/api/contest';
import AddSeason from './add';
import EditContent from './editContent';
export default {
name: 'ContestSeasonManage',
components: {
AddSeason,
EditContent
},
data() {
return {
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
reset: true,
labelWidth: '80px',
leftSpan: 18,
queryObject: {
code: {
type: 'text',
label: '编 号'
},
group: {
type: 'select',
label: '组 别',
config: {
data: [{label: '高职', value: 'GZ'}, {label: '中职', value: 'ZZ'}]
}
},
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 === 'GZ' ? '高职' : '中职'; },
tagType: (row) => { return ''; }
},
{
title: '年 度',
prop: 'term'
},
{
title: '创建时间',
prop: 'createTime',
type: 'tag',
columnValue: (row) => { return row.modifyInfo.createTime; },
tagType: (row) => { return ''; }
},
{
title: '修改时间',
prop: 'updateTime',
type: 'tag',
columnValue: (row) => { return row.modifyInfo.updateTime; },
tagType: (row) => { return ''; }
},
{
type: 'button',
title: '操 作',
width: '320',
buttons: [
{
name: '赛季内容编辑',
handleClick: this.doEditContent
},
{
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(index, row) {
this.$refs.addSeason.doShow(row);
},
doEditContent(index, row) {
this.$refs.editContent.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>
<style scoped>
</style>

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: 'GZ'}, {label: '中职', value: 'ZZ'}],
formModel: {
id: '',
code: '',
term: '',
group: 'GZ'
},
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(this.formModel.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

@ -0,0 +1,67 @@
<template>
<el-dialog v-dialogDrag v-loading="loading" title="编辑赛季内容" :visible.sync="dialogVisible" width="80%" :before-close="handleClose" center :close-on-click-modal="false">
<quill-editor
:ref="'contentInput'"
v-model="seasonContent"
style="width: 80%;margin-left: 10%;margin-top: 10px;"
:margin-bottom="20"
editor-type="default"
:no-handle-p="true"
:height="450"
placeholder="请输入"
/>
<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 { editSeasonContent, getSeasonContent } from '@/api/contest';
import QuillEditor from '@/components/QuillEditor/index';
export default {
name: 'EditContent',
components: {
QuillEditor
},
data() {
return {
dialogVisible: false,
seasonContent:'',
id: '',
loading: false
};
},
methods:{
doShow(row) {
this.dialogVisible = true;
if (row) {
this.loading = true;
this.id = row.id;
getSeasonContent(row.id).then(resp => {
this.seasonContent = resp.data.html || '';
this.loading = false;
}).catch(e => {
this.loading = false;
this.$message.error('获取内容数据失败!');
});
}
},
handleClose() {
this.id = '';
this.dialogVisible = false;
this.seasonContent = '';
this.loading = false;
},
doSave() {
editSeasonContent(this.id, {htmlContent: this.seasonContent}).then(resp => {
this.handleClose();
this.$message.success('修改内容成功!');
}).catch(e => {
this.$message.error('修改内容失败!');
});
}
}
};
</script>

View File

@ -0,0 +1,124 @@
<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.id"
:label="item.code"
:value="item.id"
/>
</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, queryContestSeasonPaged} from '@/api/contest';
export default {
name: 'AddContestTask',
data() {
return {
dialogVisible: false,
formModel: {
id: '',
name: '', //
desc: '', //
seasonId: '' // id
},
seasonOptions:[],
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) {
queryContestSeasonPaged({pageSize:999}).then((res) => {
this.seasonOptions = res.data.list;
});
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: ''
};
}
},
handleClose() {
this.formModel = {
id: '',
name: '',
desc: '',
seasonId: ''
};
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(this.formModel.id, 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,181 @@
<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" />
<edit-module ref="editModule" />
</div>
</template>
<script>
import { getPaperList, deletePaper, copyPaper } from '@/api/contest';
import AddEditPaper from './AddEditPaper.vue';
import EditModule from './EditModule.vue';
export default {
name: 'SubjectManage',
components: { AddEditPaper, EditModule },
data() {
return {
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
seasonlist: [],
examQueryForm: {
reset: true,
leftSpan: 14,
textAlign: 'right',
labelWidth: '90px',
queryObject: {
name: {
type: 'text',
label: '试卷名称:'
},
seasonName: {
type: 'text',
label: '赛季名称:'
},
group: {
type: 'select',
label: '组 别',
config: {
data: [{label: '高职', value: 'GZ'}, {label: '中职', value: 'ZZ'}]
}
}
}
},
examQueryList: {
query: obj => this.getListApi(obj),
selectCheckShow: false,
indexShow: false,
columns: [
{
title: '试卷名称',
prop: 'name'
},
{
title: '试卷描述',
prop: 'desc'
},
{
title: '组别',
prop: 'group',
type: 'tag',
columnValue: (row) => { return row.group === 'GZ' ? '高职' : '中职'; },
tagType: (row) => { return ''; }
},
{
title: '所属赛季',
prop: 'seasonName'
},
{
title: '创建时间',
prop: 'createTime',
type: 'tag',
columnValue: (row) => { return row.modifyInfo.createTime; },
tagType: (row) => { return ''; }
},
{
title: '修改时间',
prop: 'updateTime',
type: 'tag',
columnValue: (row) => { return row.modifyInfo.updateTime; },
tagType: (row) => { return ''; }
},
{
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.editModule,
type: 'primary'
},
{
name: '拷贝试卷',
handleClick: this.copyContestPaper,
type: 'warning'
}
]
}
],
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 });
}
});
},
editModule(index, row) {
this.$refs.editModule.doShow(row);
},
copyContestPaper(index, row) {
copyPaper(row.id).then(() => {
this.paperListRefresh();
}).catch(error => {
this.$message.error(error.message);
});
},
paperListRefresh() {
this.$nextTick(() => {
this.$refs.examQueryListPage.refresh(true);
});
}
}
};
</script>
<style scoped></style>

View File

@ -0,0 +1,354 @@
<template>
<el-dialog v-dialogDrag title="模块配置" :visible.sync="dialogVisible" width="50%" :before-close="handleClose" center :close-on-click-modal="false">
<div class="taskContainer">
<div style="margin-bottom: 10px;">
<el-card>
<div class="taskTitle">
<div>试卷模块管理</div>
<div>
<el-button
type="primary"
size="small"
@click="creatModule"
>
新建模块
</el-button>
</div>
</div>
</el-card>
</div>
<el-card>
<el-tree
:data="taskTreeDatas"
node-key="id"
default-expand-all
:expand-on-click-node="false"
>
<span slot-scope="{ node, data }" class="custom-tree-node">
<span :class="getLabeColorClass(data.type)">{{ node.label }}</span>
<span>
<el-button
v-if="data.type=='module'"
type="text"
size="mini"
@click="() => editModule(data)"
>
修改模块信息
</el-button>
<el-button
v-if="data.type=='taskCatalog'"
type="text"
size="mini"
@click="() => editTaskCatalog(data)"
>
修改任务目录
</el-button>
<el-button
v-if="data.type=='module'||data.type=='taskCatalog'"
type="text"
size="mini"
@click="() => addTaskCatalog(data)"
>
添加任务目录
</el-button>
<el-button
v-if="data.type=='taskCatalog'"
type="text"
size="mini"
@click="() => addTasks(data)"
>
添加任务
</el-button>
<el-button
v-if="data.type=='tasks'"
type="text"
size="mini"
@click="() => moveUp(data)"
>
上移
</el-button>
<el-button
v-if="data.type=='tasks'"
type="text"
size="mini"
@click="() => moveDown(data)"
>
下移
</el-button>
<el-button
type="text"
style="color: red;"
size="mini"
@click="() => deleteTreeData(data)"
>
删除
</el-button>
</span>
</span></el-tree>
</el-card>
<edit-module-task ref="editModuleTask" @changeTreeData="changeTreeData" />
</div>
<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 EditModuleTask from './EditModuleTask';
import { getTaskTreeDatas, getPaperDetail, paperModuleTaskSetting} from '@/api/contest';
let id = 1;
export default {
name:'ContestTaskManage',
components: {
EditModuleTask
},
data() {
return {
dialogVisible: false,
loading:false,
paperId:'',
taskTreeDatas:[],
allTaskDatas:{}
};
},
methods: {
doShow(row) {
getTaskTreeDatas().then((res) => {
this.allTaskDatas = res.data.reduce((acc, obj) => {
acc[obj.name] = obj.id;
return acc;
}, {});
getPaperDetail(row.id).then((res) => {
if (res.data.moduleVo) {
this.taskTreeDatas = res.data.moduleVo.modules.map(moduleItem=>{
let children = [];
if (moduleItem.group.length) {
children = moduleItem.group.map(taskCatalog=> this.transformTree(taskCatalog));
}
return {
id:id++,
label:moduleItem.moduleName,
duration:moduleItem.duration,
moduleScoreRuleId:moduleItem.moduleScoreRuleId,
type:'module',
children
};
});
}
}).catch(error => {
this.$message.error(error.message);
});
}).catch(error => {
this.$message.error(error.message);
});
this.paperId = row.id;
this.dialogVisible = true;
},
handleClose() {
id = 1;
this.dialogVisible = false;
this.taskTreeDatas = [];
},
creatModule() {
this.$refs.editModuleTask.doShow('module', undefined, true);
},
editModule(data) {
this.$refs.editModuleTask.doShow('module', data);
},
addTaskCatalog(data) {
this.$refs.editModuleTask.doShow('taskCatalog', data, true);
},
editTaskCatalog(data) {
this.$refs.editModuleTask.doShow('taskCatalog', data);
},
addTasks(data) {
this.$refs.editModuleTask.doShow('tasks', data, true);
},
deleteTreeData(data) {
this.$confirm(`确定删除${data.label}吗?`, this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
})
.then(() => this.findLabel(this.taskTreeDatas, data.id, true));
},
moveUp(data) {
const targetData = this.findLabel(this.taskTreeDatas, data.parentId);
const index = targetData.children.findIndex(item=>item.label == data.label);
if (index === 0) {
return;
}
const temp = targetData.children[index];
this.$set(targetData.children, index, targetData.children[index - 1]);
this.$set(targetData.children, index - 1, temp);
const copy = JSON.parse(JSON.stringify(this.taskTreeDatas));
this.taskTreeDatas = [];
this.taskTreeDatas = copy;
},
moveDown(data) {
const targetData = this.findLabel(this.taskTreeDatas, data.parentId).children;
const index = targetData.findIndex(item=>item.label == data.label);
if (index === targetData.length - 1 || targetData[index + 1].type == 'taskCatalog') {
return;
}
const temp = targetData[index];
this.$set(targetData, index, targetData[index + 1]);
this.$set(targetData, index + 1, temp);
const copy = JSON.parse(JSON.stringify(this.taskTreeDatas));
this.taskTreeDatas = [];
this.taskTreeDatas = copy;
},
changeTreeData(type, data, isAdd) {
if (data instanceof Array) {
if (data.length > 0 && !data[0].id) {
for (let i = 0; i < data.length; i++) {
data[i].id = id++;
}
}
} else if (!data.id) {
data.id = id++;
}
if (type == 'module') {
if (isAdd) {
this.taskTreeDatas.push(data);
} else {
const targetData = this.findLabel(this.taskTreeDatas, data.id);
targetData.label = data.label;
targetData.duration = data.duration;
targetData.moduleScoreRuleId = data.moduleScoreRuleId;
}
} else if (type == 'taskCatalog') {
if (isAdd) {
const targetData = this.findLabel(this.taskTreeDatas, data.parentId);
targetData.children.push(data);
} else {
const targetData = this.findLabel(this.taskTreeDatas, data.id);
targetData.label = data.label;
}
} else {
const targetData = this.findLabel(this.taskTreeDatas, data[0].parentId);
data.forEach(item=>{
const hasTasks = targetData.children.map(item=>item.label);
if ( !hasTasks.includes(item.label)) {
targetData.children.unshift(item);
}
});
}
},
doSave() {
const allTaskDatas = this.allTaskDatas;
const moduleDatas = this.taskTreeDatas.map(moduleItem=>{
let group = [];
if (moduleItem.children.length) {
group = moduleItem.children.map(taskCatalog=> transformTreeDataToSend(taskCatalog));
}
return {
moduleName:moduleItem.label, duration:moduleItem.duration, moduleScoreRuleId:moduleItem.moduleScoreRuleId, group};
});
paperModuleTaskSetting(this.paperId, {modules:moduleDatas}).then(() => {
this.$message.success('模块配置任务成功!');
this.handleClose();
}).catch(error => {
this.$message.error(error.message);
this.loading = false;
});
function transformTreeDataToSend(taskCatalog) {
const result = {taskIds:[], name:taskCatalog.label, group:[]};
for (let i = 0; i < taskCatalog.children.length; i++) {
const node = taskCatalog.children[i];
if (node.type == 'tasks') {
result.taskIds.push(allTaskDatas[node.label]);
} else if (node.type == 'taskCatalog') {
result.group.push(transformTreeDataToSend(node));
}
}
return result;
}
},
transformTree(data) {
const result = {label:data.name, children:[], id:id++, type:'taskCatalog' };
data.taskIds.forEach(taskId => {
let label = '';
for (const key in this.allTaskDatas) {
if (this.allTaskDatas[key] === taskId) {
label = key;
break;
}
}
result.children.push({label, id:id++, type:'tasks', parentId:result.id });
});
if (data.group.length) {
const changeGroup = data.group.map(taskCatalog=>
this.transformTree(taskCatalog)
);
result.children.push(...changeGroup);
}
return result;
},
findLabel( treeData, targetLabelId, isDelete) {
for (let i = 0; i < treeData.length; i++) {
if (treeData[i].id === targetLabelId) {
if (isDelete) {
treeData.splice(i, 1);
}
return treeData[i];
}
if (treeData[i].children) {
const result = this.findLabel(treeData[i].children, targetLabelId, isDelete);
if (result) {
return result;
}
}
}
return undefined;
},
findName( treeData, targetName) {
for (const item of treeData) {
if (item.name === targetName) {
return item;
}
if (item.group) {
const result = this.findName(item.group, targetName);
if (result) {
return result;
}
}
}
return undefined;
},
getLabeColorClass(value) {
return {
'yellow': value === 'module',
'green': value === 'taskCatalog'
};
}
}
};
</script>
<style lang="scss" scoped>
.taskContainer{
margin: 0 auto;
.taskTitle {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px;
}
.custom-tree-node {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 16px;
padding-right: 20px;
}
}
.yellow { color: rgb(230, 162, 60); }
.green { color: green; }
</style>

View File

@ -0,0 +1,163 @@
<template>
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogVisible" width="540px" :before-close="handleClose" center :close-on-click-modal="false" append-to-body @keydown.enter.native.prevent>
<el-form ref="ruleForm" :model="formModel" :rules="rules" label-width="120px">
<el-form-item v-if="editType == 'module'" label="模块名称:" prop="moduleName">
<el-input v-model="formModel.moduleName" style="width: 350px;" />
</el-form-item>
<el-form-item v-if="editType == 'module'" label="考试时间(分钟):" prop="duration">
<el-input v-model="formModel.duration" style="width:350px;" />
</el-form-item>
<el-form-item v-if="editType == 'module'" label="评分规则:" prop="moduleScoreRuleId">
<el-select v-model="formModel.moduleScoreRuleId" placeholder="请选择" style="width:320px;">
<el-option
v-for="item in bindRuleOptions"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item v-if="editType == 'taskCatalog'" label="目录名称:" prop="taskCatalogName">
<el-input v-model="formModel.taskCatalogName" style="width: 350px;" />
</el-form-item>
<el-form-item v-if="editType == 'tasks'" label="任务:" prop="tasks">
<el-select v-model="formModel.tasks" multiple placeholder="请选择" style="width: 350px;">
<el-option
v-for="item in taskOptions"
:key="item.id"
:label="item.name"
:value="item.name"
/>
</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 { getTaskTreeDatas, queryContextScorePaged} from '@/api/contest';
export default {
name: 'AddContestTask',
data() {
return {
dialogVisible: false,
formModel:{
moduleName:'',
duration:'',
moduleScoreRuleId:'',
moduleId:'',
taskCatalogName:'',
taskCatalogId:'',
tasks:[]
},
bindRuleOptions:[],
taskOptions:[],
loading: false,
title:'',
editType:'',
parentId:'',
idAdd:false
};
},
computed: {
rules() {
const crules = {
moduleName: [
{ required: true, message: '请输入模块名称', trigger: 'blur' }
],
duration: [
{ required: true, message: '请输入考试时间', trigger: 'blur' }
],
taskCatalogName: [
{ required: true, message: '请输入任务名称', trigger: 'blur' }
],
tasks: [
{ required: true, message: '请选择任务', trigger: 'blur' }
]
};
return crules;
}
},
methods:{
doShow(type, data, isAdd) {
this.isAdd = isAdd;
if (type == 'module') {
queryContextScorePaged({pageSize:999}).then((res) => {
this.bindRuleOptions = res.data.list;
});
this.editType = 'module';
this.title = '创建模块';
if (data) {
this.title = '修改模块信息';
this.formModel.moduleName = data.label;
this.formModel.duration = data.duration;
this.formModel.moduleScoreRuleId = data.moduleScoreRuleId;
this.formModel.moduleId = data.id;
}
} else if (type == 'taskCatalog') {
this.editType = 'taskCatalog';
this.title = isAdd ? '创建任务目录' : '修改任务目录';
this.parentId = isAdd ? data.id : data.parentId;
if (!isAdd) {
this.formModel.taskCatalogId = data.id;
this.formModel.taskCatalogName = data.label;
}
} else {
this.editType = 'tasks';
this.parentId = data.id;
getTaskTreeDatas().then((res) => {
this.taskOptions = res.data;
this.formModel.tasks = data.children.filter(item => !item.children).map(item=>item.label);
}).catch(error => {
this.$message.error(error.message);
});
this.title = data.label;
}
this.dialogVisible = true;
},
handleClose() {
this.formModel = {
moduleName:'',
duration:'',
moduleScoreRuleId:'',
taskCatalogName:'',
tasks: []
};
this.parentId = '';
this.editType = '';
this.isAdd = false;
this.dialogVisible = false;
this.loading = false;
},
doSave() {
this.$refs.ruleForm.validate((valid) => {
if (valid) {
if (this.editType == 'module') {
const data = {label:this.formModel.moduleName, duration:this.formModel.duration, moduleScoreRuleId:this.formModel.moduleScoreRuleId, type:'module', children:[]};
if (!this.isAdd) {
data.id = this.formModel.moduleId;
}
this.$emit('changeTreeData', 'module', data, this.isAdd);
} else if (this.editType == 'taskCatalog') {
const data = {label:this.formModel.taskCatalogName, type:'taskCatalog', parentId:this.parentId, children:[]};
if (!this.isAdd) {
data.id = this.formModel.taskCatalogId;
}
this.$emit('changeTreeData', 'taskCatalog', data, this.isAdd);
} else {
const data = this.formModel.tasks.reverse().map(task=>{ return {label:task, type:'tasks', parentId:this.parentId}; });
this.$emit('changeTreeData', 'task', data);
}
this.handleClose();
this.dialogVisible = false;
}
});
}
}
};
</script>

View File

@ -0,0 +1,133 @@
<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="content">
<el-input v-model="formModel.content" type="textarea" style="width: 350px;" />
</el-form-item>
<el-form-item label="评价标准:" prop="standards">
<el-input v-model="formModel.standards" type="textarea" style="width: 350px;" />
</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 { createTask, editTask} from '@/api/contest';
export default {
name: 'AddContestTask',
data() {
return {
dialogVisible: false,
formModel: {
id: '',
name: '', //
desc: '', //
content: '', //
standards: '', //
parentId:''
},
creatSonTask:false,
loading: false
};
},
computed: {
rules() {
const crules = {
name: [
{ required: true, message: '请输入任务名称', trigger: 'blur' }
],
desc: [
{ required: true, message: '请输入任务描述', trigger: 'blur' }
]
};
return crules;
},
title() {
if (this.creatSonTask) return '添加子任务';
return this.formModel.id ? '修改任务' : '新建任务';
}
},
methods:{
doShow(row, creatSonTask) {
this.dialogVisible = true;
if (creatSonTask) {
this.creatSonTask = true;
}
if (!creatSonTask && row) {
this.formModel.id = row.id;
this.formModel.name = row.name;
this.formModel.desc = row.desc;
this.formModel.content = row.content;
this.formModel.standards = row.standards;
} else {
this.formModel = {
id: '',
name: '',
desc: '',
content: '',
standards:'',
parentId:''
};
if (creatSonTask) {
this.formModel.parentId = row.id;
}
}
},
handleClose() {
this.formModel = {
id: '',
name: '',
desc: '',
content: '',
standards:'',
parentId:''
};
this.creatSonTask = false;
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.parentId == '') {
delete data.parentId;
}
if (this.formModel.id) {
editTask(this.formModel.id, data).then(() => {
this.$message.success('修改任务成功!');
this.handleClose();
this.$emit('reloadTaskTree');
}).catch(error => {
this.$message.error(error.message);
this.loading = false;
});
} else {
createTask(data).then(() => {
this.$message.success('创建任务成功!');
this.handleClose();
this.$emit('reloadTaskTree');
}).catch(error => {
this.$message.error(error.message);
this.loading = false;
});
}
}
});
}
}
};
</script>

View File

@ -0,0 +1,103 @@
<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" label-width="120px">
<el-form-item label="任务名称:" prop="name">
<el-input v-model="formModel.name" style="width: 320px;" />
</el-form-item>
<el-form-item label="绑定场景:" prop="sceneId">
<el-select v-model="formModel.sceneId" placeholder="请选择" style="width:320px;">
<el-option
v-for="item in bindSceneOptions"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="绑定评分规则:" prop="ruleId">
<el-select v-model="formModel.ruleId" placeholder="请选择" style="width:320px;">
<el-option
v-for="item in bindRuleOptions"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</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 { bindTask, queryContextScorePaged, queryContestSencePaged} from '@/api/contest';
export default {
name: 'AddContestTask',
data() {
return {
dialogVisible: false,
formModel: {
taskId: '',
name:'',
sceneId: '', // id
ruleId: '' // id
},
bindSceneOptions: [],
bindRuleOptions:[],
loading: false
};
},
methods:{
doShow(row) {
queryContextScorePaged({pageSize:999}).then((res) => {
this.bindRuleOptions = res.data.list;
});
queryContestSencePaged({pageSize:999}).then((res) => {
this.bindSceneOptions = res.data.list;
});
this.dialogVisible = true;
this.formModel.taskId = row.id;
this.formModel.name = row.name;
this.formModel.sceneId = row.sceneId;
this.formModel.ruleId = row.ruleId;
},
handleClose() {
this.formModel = {
taskId: '',
name: '',
sceneId: '',
ruleId: ''
};
this.$refs.ruleForm.resetFields();
this.dialogVisible = false;
this.loading = false;
},
doSave() {
this.$refs.ruleForm.validate((valid) => {
if (valid) {
this.loading = true;
const data = [];
if ( this.formModel.ruleId) {
data.push({bindType:0, bindId:this.formModel.ruleId, status:0});
}
if (this.formModel.sceneId) {
data.push({bindType:1, bindId:this.formModel.sceneId, status:0});
}
bindTask(this.formModel.taskId, 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,174 @@
<template>
<div class="taskContainer">
<div style="margin-bottom: 10px;">
<el-card>
<div class="taskTitle">
<div>竞赛任务管理</div>
<div>
<el-button
type="primary"
size="small"
@click="creatTask"
>
新建任务
</el-button>
</div>
</div>
</el-card>
</div>
<el-card>
<el-tree
:data="taskDta"
node-key="id"
default-expand-all
:props="defaultProps"
:expand-on-click-node="false"
>
<div slot-scope="{ node, data }" class="custom-tree-node">
<div class="left-label" :title="node.label">
{{ node.label }}
</div>
<div class="right-button">
<el-button
type="text"
size="mini"
@click="() => editTask(data)"
>
修改任务
</el-button>
<el-button
type="text"
style="color: red;"
size="mini"
@click="() => deleteTaskById(data)"
>
删除任务
</el-button>
<el-button
type="text"
size="mini"
@click="() => creatChildrenTask(data)"
>
添加子任务
</el-button>
<el-button
type="text"
size="mini"
@click="() => bindTask(data)"
>
任务绑定
</el-button>
</div>
</div>
</el-tree>
</el-card>
<add-edit-task ref="addEditTask" @reloadTaskTree="getTreeData" />
<bind-task ref="bindTask" />
</div>
</template>
<script>
import AddEditTask from './AddEditTask';
import BindTask from './BindTask';
import { getTaskTreeDatas, getTaskDetail, deleteTask} from '@/api/contest';
export default {
name:'ContestTaskManage',
components: {
AddEditTask, BindTask
},
data() {
return {
taskDta:[],
defaultProps: {
children: 'children',
label: 'name',
id: 'id',
parentId:'parentId'
}
};
},
created() {
this.getTreeData();
},
methods: {
getTreeData() {
getTaskTreeDatas().then((res) => {
this.taskDta = res.data;
}).catch(error => {
this.$message.error(error.message);
});
},
creatTask() {
this.$refs.addEditTask.doShow();
},
creatChildrenTask(data) {
this.$refs.addEditTask.doShow(data, true);
},
editTask(data) {
getTaskDetail(data.id).then((res) => {
this.$refs.addEditTask.doShow(res.data);
});
},
bindTask(data) {
getTaskDetail(data.id).then((res) => {
this.$refs.bindTask.doShow(res.data);
});
},
deleteTaskById(data) {
this.$confirm('确定删除该任务吗?', this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
})
.then(() => deleteTask(data.id))
.then(() => {
this.getTreeData();
this.$message({
type: 'success',
message: '删除成功!'
});
})
.catch(res => {
if (res.code && res.code !== 200) {
this.$message({ type: 'error', message: res.message });
}
});
}
}
};
</script>
<style lang="scss" scoped>
.taskContainer{
width: 70%;
margin: 0 auto;
overflow: hidden;
.taskTitle {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px;
}
.custom-tree-node {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
font-size: 16px;
padding-right: 20px;
.left-label{
flex: 1;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
cursor: pointer;
}
.right-button{
width:255px;
}
}
}
</style>

View File

@ -1,3 +1,108 @@
<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>
<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,
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; },
tagType: (row) => { return ''; }
},
{
title: '修改时间',
prop: 'updateTime',
type: 'tag',
columnValue: (row) => { return row.modifyInfo.updateTime; },
tagType: (row) => { return ''; }
},
{
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(index, row) {
this.$router.push({path: '/systemManagement/contestDataManage/contestTaskScoreEdit', 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="name">
<el-input v-model="formModel.name" 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,102 @@
<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="name">
<el-input v-model="formModel.name" autosize type="textarea" style="width: 200px;" />
</el-form-item>
<!-- <el-form-item label="作业程序:" prop="content">-->
<!-- <el-input v-model="formModel.content" style="width: 200px;" />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="场景步骤ID:" prop="sceneStepId">-->
<!-- <el-input v-model="formModel.sceneStepId" style="width: 200px;" />-->
<!-- </el-form-item>-->
<el-form-item label="评分标准:" prop="criteria">
<el-input v-model="formModel.criteria" autosize type="textarea" style="width: 200px;" />
</el-form-item>
<el-form-item label="单元分值:" prop="score">
<el-input-number v-model="formModel.score" :precision="2" style="width: 200px;" :min="0" />
</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: {
id: '',
name: '',
score: 0,
criteria: '',
children: []
},
loading: false,
type: 'edit'
};
},
computed: {
rules() {
const crules = {
name: [
{ required: true, message: '请输入项目', trigger: 'blur' }
]
};
return crules;
},
title() {
return '评分规则单元';
}
},
methods:{
doShow(row, type) {
this.dialogVisible = true;
this.type = type;
if (row) {
this.formModel.id = row.id;
this.formModel.name = row.name;
this.formModel.score = row.score / 100;
this.formModel.criteria = row.criteria;
this.formModel.children = row.children;
}
},
handleClose() {
this.type = 'edit';
this.formModel = {
id: '',
name: '',
score: 0,
criteria: '',
children: []
};
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);
data.score = data.score * 100;
if (this.type === 'edit') {
this.$emit('editData', data);
} else if (this.type === 'add') {
this.$emit('addData', data);
} else {
this.$emit('charuData', data);
}
this.handleClose();
}
});
}
}
};
</script>

View File

@ -0,0 +1,196 @@
<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
ref="table"
:data="tableData"
border
show-summary
default-expand-all
row-key="id"
:summary-method="getSummaries"
:tree-props="{children: 'children'}"
style="width: 100%;margin-top: 10px;"
>
<el-table-column type="index" width="50" />
<el-table-column label="项目" prop="name" />
<el-table-column label="评分标准" prop="criteria" />
<el-table-column label="分值" prop="score" width="50">
<template slot-scope="scope">
<span>{{ scope.row.score === 0? '': scope.row.score/100 }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="场景步骤ID" prop="sceneStepId" width="100">-->
<!-- </el-table-column>-->
<el-table-column label="操作" width="250">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleCharu(scope.$index,scope.row)"
>插入</el-button>
<el-button
size="mini"
@click="handleEdit(scope.$index,scope.row)"
>编辑</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<detail-add ref="detailAdd" @addData="addData" @editData="editData" @charuData="charuData" />
<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, getContextScoreDetail } from '@/api/contest';
export default {
name: 'EditScoreRule',
components: {
DetailAdd,
ImportScene,
SelectScene
},
data() {
return {
tableData:[],
chaData: []
};
},
mounted() {
this.getData();
},
methods: {
handleData(list, index) {
list.forEach((elem, i) => {
elem.id = index + '_' + i;
if (elem.children && elem.children.length) {
this.handleData(elem.children, elem.id);
}
});
},
getData() {
getContextScoreDetail(this.$route.query.id).then(resp => {
const data = resp.data.rule ? resp.data.rule.units : [];
this.handleData(data, '1');
this.tableData = data;
}).catch(() => { this.$message.error('初始化数据失败!'); });
},
goBack() {
this.$router.go(-1);
},
doSave() {
const data = [...this.tableData];
updateContextScoreDetail(this.$route.query.id, {units: data})
.then(() => { this.$message.success('保存评分规则单元成功!'); })
.catch(() => { this.$message.error('保存评分规则单元失败!'); });
},
deleteTreeData(id, list) {
list.find((ele, i) => {
if (id === ele.id) {
list.splice(i, 1);
return true;
}
if (ele.children && ele.children.length) {
this.deleteTreeData(id, ele.children);
}
});
},
handleDelete(data) {
this.deleteTreeData(data.id, this.tableData);
this.handleData(this.tableData, '1');
this.tableData = [...this.tableData];
},
handleCharu(index, data) {
this.chaData = data;
this.$refs.detailAdd.doShow('', 'charu');
},
handleEdit(index, data) {
this.$refs.detailAdd.doShow(data, 'edit');
},
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('', 'add');
},
handleEditData(data, list) {
list.find((ele, i) => {
if (data.id === ele.id) {
Object.assign(ele, data);
return true;
}
if (ele.children && ele.children.length) {
this.handleEditData(data, ele.children);
}
});
},
editData(data) {
this.handleEditData(data, this.tableData);
this.tableData = [...this.tableData];
},
addData(data) {
this.tableData.push(data);
this.handleData(this.tableData, '1');
},
charuData(data) {
if ( this.chaData.children) {
this.chaData.children.push(data);
} else {
this.$set(this.chaData, 'children', [data]);
}
this.handleData(this.tableData, '1');
this.tableData = [...this.tableData];
},
handleSummaries(data, sums) {
data.forEach(item => {
sums[3] += Number(item.score);
if (item.children && item.children.length) {
this.handleSummaries(item.children, sums);
}
});
},
getSummaries(param) {
const { data } = param;
const sums = ['总分', '/', '/', 0, '/'];
this.handleSummaries(data, sums);
sums[3] = sums[3] / 100;
return sums;
}
}
};
</script>
<style scoped>
</style>

View File

@ -0,0 +1,174 @@
<template>
<el-dialog v-dialogDrag v-loading="loading" 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 { 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;
this.loading = true;
try {
this.trainingId = id;
const resp = await getContextSenceDetail(id);
this.allStepList = JSON.parse(resp.data.scene.storageSimulation.stepJson);
const members = JSON.parse(resp.data.scene.storageSimulation.memberJson);
const ps = resp.data.scene.storageSimulation.playerIds;
const players = [];
members.forEach(mem => { if (ps.includes(mem.id)) { players.push(mem); } });
this.memberList = handleMemberList(players);
if (this.memberList.length > 0) {
this.changeMember(this.memberList[0].id);
}
this.loading = false;
} 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 = '';
this.dialogVisible = false;
},
commit() {
this.$refs.form.validate((valid) => {
if (valid) {
const scoreDetails = [];
for (const key in this.currentStepMap) {
scoreDetails.push({id: 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 };
const data = [];
this.allStepList.forEach(elem => {
if (elem.memberId == this.addModel.memberId) {
data.push({text: elem.description,
worker: '',
score: this.currentStepMap[elem.id],
criteria: '',
sceneStepId: elem.id});
}
});
this.$emit('importData', data);
this.cancel();
}
});
},
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,120 @@
<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 { queryContestSencePaged } 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: 'Local'}, {label: '三维', value: 'Link'}]
}
}
}
},
queryList: {
query: queryContestSencePaged,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: '名 称',
prop: 'name'
},
{
title: '地图',
prop: 'mapName'
},
{
title: '类 型',
prop: 'type',
type: 'tag',
columnValue: (row) => { return row.type === 'Local' ? '二维' : '三维'; },
tagType: (row) => { return ''; }
},
{
title: '创建时间',
prop: 'createTime',
type: 'tag',
columnValue: (row) => { return row.modifyInfo.createTime; },
tagType: (row) => { return ''; }
},
{
title: '修改时间',
prop: 'updateTime',
type: 'tag',
columnValue: (row) => { return row.modifyInfo.updateTime; },
tagType: (row) => { return ''; }
},
{
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(index, 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>

View File

@ -242,6 +242,10 @@ export default {
type: this.$route.query.type
};
this.judgeOtherPage(params);
} else if (this.$store.state.projectConfig.projectCode === 'DSXL') {
this.loading = false;
path = '/contest/list';
this.$router.push({ path: path });
} else {
this.loading = false;
path = '/simulation/simulationIndex';

View File

@ -247,7 +247,7 @@ export default {
}
},
isRecord() {
return !!this.$route.query.record;
return !!this.$store.state.trainingNew.record;
}
},
watch:{

View File

@ -31,7 +31,7 @@
<div class="chat-box-footer">
<el-input v-model="textContent" size="small" placeholder="请输入会话文字点击T发送" style="flex: 1; margin-left: 5px;" :rows="1" />
<el-button :id="sendTextId" size="mini" class="chat-box-footer-create" :disabled="contentSend" @click="sendText">T</el-button>
<el-button v-if="!$route.query.record" class="chat-box-footer-create chat-box-footer-send" :class="{'active': recordSending}" :disabled="audioPlay" size="mini" type="primary" @click="startRecording()">
<el-button v-if="!$store.state.trainingNew.isRecord" class="chat-box-footer-create chat-box-footer-send" :class="{'active': recordSending}" :disabled="audioPlay" size="mini" type="primary" @click="startRecording()">
<el-progress id="voice_progress_bar" type="circle" :show-text="false" :percentage="100/60*seconds" :width="40" :stroke-width="2" status="success" />
<i v-if="recordSending" class="el-icon-close close_icon" @click.stop="cancleRecording()" />
<span class="iconfont icon-yuyin">&#xe62b;</span>

View File

@ -139,6 +139,7 @@ export default {
this.$store.dispatch('runPlan/setRunPlanInfo', resp.data.runPlan);
this.$store.dispatch('training/setDomConfig', resp.data.paramVO && resp.data.paramVO.domConfig ? resp.data.paramVO.domConfig : {});
this.$store.dispatch('map/setLinkSwitchMap', resp.data.linkSwitchMap || {});
this.$store.dispatch('map/setSimulationCreatorId', resp.data.creator.id);
if (this.simType === 'METRO') {
this.$store.dispatch('runPlan/clear');
const respSl = await getByGroupStationList(this.group);

View File

@ -46,12 +46,6 @@ import { addSimulationMember } from '@/api/jointSimulation';
import ConstConfig from '@/scripts/ConstConfig';
export default {
name: 'AddMember',
props: {
stationList: {
type: Array,
required: true
}
},
data() {
return {
dialogVisible: false,
@ -78,7 +72,9 @@ export default {
'STATION_SWITCH_MAN',
'STATION_FACILITATOR',
'STATION_WORKER',
'DEVICE_MANAGER'
'DEVICE_MANAGER',
'STATION_ATTENDANT',
'STATION_HEAD'
]
};
},
@ -111,7 +107,7 @@ export default {
methods: {
initData() {
this.filterStationList = [];
this.stationList.forEach(item => {
this.$store.state.map.map.stationList.forEach(item => {
if (!item.depot) {
this.filterStationList.push(item);
}

View File

@ -49,7 +49,7 @@
</div>
<div class="room__footer" />
</div>
<add-member ref="addMember" :station-list="stationList" />
<add-member ref="addMember" />
</el-drawer>
</template>
@ -88,8 +88,6 @@ export default {
label: 'labelName'
},
simulationUserList: [],
stationList: [],
availableStationList:[],
activeTrains: [],
standList: [],
doorList: [],

View File

@ -272,6 +272,9 @@ export default {
this.microphone = null;
this.recordSending = false;
this.recorders = null;
if (this.$store.state.trainingNew.trainingSwitch) {
this.$store.dispatch('trainingNew/handleMatchVoice', {content: 'false'});
}
}
},
//

View File

@ -98,6 +98,7 @@ export default {
},
watch: {
'$store.state.socket.simulationOver':function(val) {
if (this.$store.state.map.simulationCreatorId !== this.$store.state.user.id) {
this.$alert('您所在仿真已被销毁', '提示', {
confirmButtonText: '确定',
showClose: false,
@ -109,6 +110,7 @@ export default {
}
}
});
}
},
'$store.state.socket.simulationRoleList':function(val) {
(val || []).forEach(item => {
@ -232,6 +234,9 @@ export default {
}
} else if (this.projectDevice) {
this.logout();
} else if (this.$route.query.nowKey) {
const query = { paperId: this.$route.query.paperId, moduleId: this.$route.query.moduleId, nowKey: +this.$route.query.nowKey + 1 };
this.$router.replace({ path:'/contest/detail', query });
} else {
this.$router.go(-1);
}

View File

@ -130,7 +130,6 @@ import EditOperate from './editOperate';
import CreateDraftTraining from './createDraftTraining';
import GradeRules from './gradeRules';
import TrackList from './trackList';
import { EventBus } from '@/scripts/event-bus';
export default {
name: 'DesignIndex',
@ -217,15 +216,13 @@ export default {
e.stopPropagation();
});
},
beforeDestroy() {
this.$store.dispatch('trainingNew/setIsRecord', false);
},
methods: {
goBackList() {
const qObj = {...this.$route.query};
qObj.record = false;
this.$router.replace({ query:{...qObj}});
this.$store.dispatch('trainingNew/setIsRecord', false);
this.showMode = 'draftTrainingList';
this.$nextTick(() => {
EventBus.$emit('viewLoading', false);
});
},
computedRoleDisabled(role) {
if (!this.editData.client) {

View File

@ -26,6 +26,7 @@ import ConstConfig from '@/scripts/ConstConfig';
import { loadDraftTraining } from '@/api/jmap/training';
import { deleteTraining, publishTraining, jumpToTraining } from '@/api/trainingManage';
import { OperateMode } from '@/scripts/ConstDic';
import { publishContextSence } from '@/api/contest';
export default {
name: 'List',
@ -84,7 +85,7 @@ export default {
{
type: 'button',
title: this.$t('trainingManage.operate'),
width: '300',
width: '250',
buttons: [
{
name: this.$t('trainingManage.record'),
@ -110,6 +111,12 @@ export default {
type: 'text',
showControl:(row) => { return row.id; }
},
{
name: '发布至竞赛',
handleClick: this.publishToContest,
type: 'text',
showControl:(row) => { return row.id; }
},
{
name: this.$t('trainingManage.preview'),
handleClick: this.previewScript,
@ -196,7 +203,7 @@ export default {
return;
}
const qObj = {...this.$route.query};
qObj.record = true;
this.$store.dispatch('trainingNew/setIsRecord', true);
this.$router.replace({ query:{...qObj}});
this.$store.dispatch('training/changeOperateMode', { mode: OperateMode.NORMAL }); //
getTrainingAll(row.id).then(resp => {
@ -247,6 +254,43 @@ export default {
});
}).catch(e => {});
},
publishToContest(index, row) {
this.$prompt('请输入发布后名称', '提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
inputValue: row.name,
inputErrorMessage: '输入不能为空',
inputValidator: (value) => {
if (!value) {
return '输入不能为空';
}
}
}).then(suc => {
if (!row.id || !suc.value) { return; }
publishContextSence({dafitid: +row.id, name: suc.value, forcePublish: false}).then(res => {
this.$message.success('发布至竞赛成功!');
}).catch(err => {
if (err.code == 12000) {
this.$confirm('已有名称重复场景,是否继续发布,继续发布将强行覆盖重复实训?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
publishContextSence({dafitid: +row.id, name: suc.value, forcePublish: true}).then(res => {
this.$message.success('发布至竞赛成功!');
}).catch(() => {
this.$message.error(`发布至竞赛失败!,${err.message}`);
});
}).catch(e => {});
} else {
this.$message.error(`发布至竞赛失败!,${err.message}`);
}
});
});
},
publishScript(index, row) {
this.$prompt('请输入发布后名称', '提示',
{

View File

@ -126,6 +126,15 @@ export default {
this.stepIndex = data.index;
this.stepDetail = data.data;
this.trainingType = data.type;
if (!this.stepDetail.operations) {
this.$set(this.stepDetail, 'operations', []);
}
if (!this.stepDetail.simCommands) {
this.$set(this.stepDetail, 'simCommands', []);
}
if (!this.stepDetail.tipPosition) {
this.$set(this.stepDetail, 'tipPosition', {});
}
},
clearOperation() {
this.$confirm('清除操作将清除所有关联操作', '提示', {

View File

@ -65,7 +65,13 @@ export default {
this.dialogVisible = false;
},
doShow() {
const playerList = JSON.parse(this.trainingDetail.playerIdJson);
let playerList = [];
if (this.$route.query.paperId) {
playerList = this.trainingDetail.playerIds;
} else {
playerList = JSON.parse(this.trainingDetail.playerIdJson);
}
const memberData = this.$store.state.training.memberData;
const newMemberData = {};
playerList.forEach(playerId => {

View File

@ -4,7 +4,7 @@
<div ref="drapBox" class="reminder-box">
<div class="tip-title">
<div style="display: flex;justify-content: center;align-items: center;">
<i v-if="!trainingDesign && !examSwitch && simulationCreator" class="icon el-icon-document" @click="trainingListShow" />
<i v-if="!trainingDesign && !examSwitch && simulationCreator && !isRace" class="icon el-icon-document" @click="trainingListShow" />
<i v-show="!isShrink && !trainingSwitch && trainingDetail && simulationCreator" class="icon el-icon-video-play" @click="handlerStart" />
<i v-show="!isShrink && trainingSwitch && simulationCreator" class="icon el-icon-switch-button" @click="handlerEnd" />
<i v-show="isShrink" class="icon el-icon-minus" @click="shrink" />
@ -33,7 +33,7 @@
</el-radio-group>
</span>
</p>
<p class="list-item">
<p v-if="!isRace" class="list-item">
<span class="list-label" style="vertical-align: top;"> {{ $t('display.training.trainingInstructions') }}</span>
<span class="list-elem elem-span">{{ trainingDetail ?trainingDetail.description:'' }}</span>
</p>
@ -44,11 +44,11 @@
<el-button v-if="trainingSwitch" size="small" type="danger" @click="handlerEnd">结束</el-button>
</span>
</p>
<p v-if="!examSwitch && simulationCreator" class="list-item">
<p v-if="!examSwitch && simulationCreator && !isRace" class="list-item">
<span class="list-label"> </span>
<span class="list-elem elem-span training-box" @click="loadTraining(previousTraining)">{{ previousTraining? previousTraining.name: '' }}</span>
</p>
<p v-if="!examSwitch && simulationCreator" class="list-item">
<p v-if="!examSwitch && simulationCreator && !isRace" class="list-item">
<span class="list-label"> </span>
<span class="list-elem elem-span training-box" @click="loadTraining(nextTraining)">{{ nextTraining? nextTraining.name:'' }}</span>
</p>
@ -69,6 +69,8 @@
<script>
import { ScriptMode } from '@/scripts/ConstDic';
import { startTraining, endTraining, getPublishTrainingDetail, loadPublishTraining, prepareScene } from '@/api/jmap/training';
import { loadRace, overTask } from '@/api/race';
import { getContextSenceDetail } from '@/api/contest';
import ScenePlayRole from './scenePlayRole';
import TestResult from './testResult';
import { EventBus } from '@/scripts/event-bus';
@ -119,9 +121,17 @@ export default {
},
simulationCreator() {
return this.$store.state.training.simulationCreator;
},
isRace() {
return this.$route.query.paperId;
}
},
watch: {
'$store.state.map.mapViewLoadedCount': function (val) {
if (this.isRace && !this.$store.state.trainingNew.trainingDetail) {
this.loadRaceScene(this.$route.query.sceneId);
}
},
'$store.state.trainingNew.trainingDetail': function(val) {
this.initAdjacentTraining();
},
@ -137,6 +147,9 @@ export default {
}
}
},
beforeDestroy() {
this.$store.dispatch('trainingNew/setTrainingDetail', null);
},
mounted() {
EventBus.$on('setTrainingList', (trainingList) => {
this.trainingList = trainingList;
@ -181,7 +194,7 @@ export default {
handlePrepareScene() {
prepareScene(this.group, {mode: this.demoMode}).then(() => {
this.$refs.scenePlayRole.doShow();
}).catch(() => {
}).catch((e) => {
this.$message.error('预开始场景实训失败!');
});
},
@ -201,6 +214,15 @@ export default {
trainDetail: this.$store.state.trainingNew.stepRecord
};
EventBus.$emit('trainExamSubmit', data);
} else {
if (this.isRace) {
overTask(this.$route.query.taskId, {simulationId: this.group, scoreList: this.$store.state.trainingNew.stepRecord }).then((resp) => {
if (this.demoMode === ScriptMode.TEST) {
this.$refs.testResult.doShow(resp.data);
}
}).catch((e) => {
this.$message.error('结束任务失败!');
});
} else {
endTraining(this.group, this.$store.state.trainingNew.stepRecord).then((resp) => {
if (this.demoMode === ScriptMode.TEST) {
@ -211,10 +233,32 @@ export default {
this.$message.error('结束实训失败!');
});
}
}
},
trainingListShow() {
EventBus.$emit('handleSliderShow');
},
async loadRaceScene(sceneId) {
if (this.trainingSwitch) {
this.$message.error('请先结束当前实训后再加载新的实训!');
return;
}
try {
const detailResp = await getContextSenceDetail(sceneId);
this.training = detailResp.data.scene.storageSimulation;
this.training.type = 'SCENE';
this.training.name = detailResp.data.name;
if (this.training.mapLocationJson) {
const mapLocation = JSON.parse(this.training.mapLocationJson);
this.$jlmap.updateTransform(mapLocation.scale, {x:mapLocation.x, y:mapLocation.y});
}
this.$store.dispatch('trainingNew/setTrainingDetail', this.training);
await loadRace(this.group, sceneId, {mode: ''});
this.$message.success('加载场景成功!');
} catch (e) {
this.$message.error('加载场景失败!');
}
},
async loadTraining(training) {
if (this.trainingSwitch) {
this.$message.error('请先结束当前实训后再加载新的实训!');