Merge remote-tracking branch 'origin/test'

This commit is contained in:
fan 2024-03-04 09:20:30 +08:00
commit 31f1192de0
16 changed files with 415 additions and 354 deletions

View File

@ -325,7 +325,7 @@ export function publishContextSence(data) {
*/
export function getTaskTree(paperId, moduleId) {
return request({
url: `/api/exercise/race/paper/page/${paperId}/module/${moduleId}/task`,
url: `/api/exercise/race/paper/${paperId}/module/${moduleId}/task`,
method: 'get'
});
}

View File

@ -230,6 +230,7 @@ const ContestSeasonManage = () => import('@/views/contestDataManage/contestSeaso
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');
// import { GenerateRouteProjectList } from '@/scripts/ProjectConfig';
// import { getSessionStorage } from '@/utils/auth';
@ -690,6 +691,11 @@ export const publicAsyncRoute = [
path: 'detail',
component: ContestDetail,
hidden: true
},
{
path: 'scoringSettlement',
component: ScoringSettlement,
hidden: true
}
]
}

View File

@ -0,0 +1,13 @@
<template>
<div>打分结算</div>
</template>
<script>
export default {
name: 'ScoringSettlement'
};
</script>
<style scoped>
</style>

View File

@ -3,7 +3,7 @@
<el-col :span="5" class="container-left">
<el-tree
:data="taskData"
node-key="name"
node-key="index"
current-node-key
:props="defaultProps"
default-expand-all
@ -12,7 +12,7 @@
:expand-on-click-node="false"
>
<div slot-scope="{ node, data }" class="custom-tree-node">
<div :style="{ color: nowData.name === data.name? '#8f079d': '#fff' }">{{ data.groupName||data.name }}</div>
<div :style="{ color: nowData.name === data.name && nowData.id === data.id? '#8f079d': '#fff' }">{{ data.name }}</div>
</div>
</el-tree>
<div class="button-group">
@ -23,7 +23,7 @@
</div>
</el-col>
<el-col :span="19" class="container-right">
<el-card class="box-card" style="color: #fff;background-color: transparent;height: 100%">
<el-card class="box-card">
<div slot="header" style="text-align: center">
<span style="font-size: 28px;">{{ nowData.name }}</span>
</div>
@ -42,8 +42,8 @@
</el-row>
</div>
<div style="text-align: center;margin-top: 15px;">
<el-button v-show="nowData.ruleId" type="primary">评分表</el-button>
<el-button v-show="nowData.sceneId" type="primary">开始任务</el-button>
<el-button v-show="nowData.ruleId" type="primary" @click="showScoreRule">评分表</el-button>
<el-button v-show="nowData.sceneId" v-loading="loading" type="primary" @click="startTask">开始任务</el-button>
<el-button type="primary" :disabled="nowKey === taskList.length-1" @click="nextTask">下一任务</el-button>
</div>
</el-card>
@ -53,7 +53,9 @@
</template>
<script>
import { getTaskTree } from '@/api/contest';
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',
@ -62,6 +64,7 @@ export default {
},
data() {
return {
loading: false,
nowKey: 0,
taskList: [],
taskData: [],
@ -74,124 +77,50 @@ export default {
funcitonData: {
type: 'METRO',
itemMap: {
DEFAULT_MEMBER: ''
},
domConfig: {
singleMember: false,
singleClient: false,
client: 'dispatchWork',
hasTraining: false,
client: '',
hasTraining: true,
trainingType: 'SCENE',
hasExam: false,
trainingDesign: true,
trainingDesign: false,
hasLpf: false,
hasVoice: true,
joint: false,
hasDeviceManage: false,
hasMemberManage: true
}
},
resp: {
customModuleId: 2,
child: [
{
id: 0,
name: '车站行车作业',
desc: '',
content: '',
standards: '',
sceneId: 0,
ruleId: 0,
parentId: 0,
children: [
{
id: 45,
name: '正常行车组织工作',
desc: '利用智慧城轨运营模拟训练平台ATS系统加载既定的列车运行图选取某时刻900开始模拟列车运行。',
content: '1组织管辖车站范围内图定列车按计划运行\n2控制权交接',
standards: '。。',
sceneId: 0,
ruleId: 0,
parentId: 0,
children: [
{
id: 46,
name: '组织管辖车站范围内图定列车按计划运行',
desc: '核对运行计划。',
content: '行调与车站值班员确认本站站台及相邻区间列车状态。',
standards: '车站值班员手指口呼确认本站站台及相邻区间列车占用状态并与行调核对车次及位置正确、用语标准。',
sceneId: 0,
ruleId: 0,
parentId: 45,
isTask: true
},
{
id: 47,
name: '控制权交接',
desc: '控制权交接操作。',
content: '行调与车站值班员确认ATS站中控状态并进行控制权转换操作。',
standards: '车站值班员手指口呼确认本站ATS站中控状态并进行控制权转换操作正常完成控制权转换。按标准用语汇报。',
sceneId: 0,
ruleId: 0,
parentId: 45,
isTask: true
}
],
isTask: true
},
{
id: 35,
name: '运营工作准备',
desc: '利用智慧城轨运营模拟训练平台ATS系统加载既定的列车运行图选取运营开始前30分钟开始运营前检查工作。',
content: '1人员准备\n2检查ATS设备\n3检查IBP\n4站台门检查',
standards: '。。',
sceneId: 0,
ruleId: 0,
parentId: 0,
children: [
{
id: 41,
name: '人员准备',
desc: '检查人员工作状态',
content: '检查运营前人员形象礼仪及精神状态。',
standards: '运营前人员形象礼仪及精神状态符合企业服务标准要求。',
sceneId: 0,
ruleId: 0,
parentId: 35,
isTask: true
},
{
id: 42,
name: '检查本地ATS设备',
desc: '检查车站ATS状态。',
content: '检查车站ATS工作站中的所有道岔、信号机、计轴区段状态。',
standards: '手指口呼确认道岔、信号机、计轴状态等设备状态是否全部正常。',
sceneId: 0,
ruleId: 0,
parentId: 35,
isTask: true
}
],
isTask: true
}
],
isTask: false
}
]
}
}
};
},
mounted() {
// this.taskData = JSON.parse(this.resp);
this.taskData = this.resp.child;
this.taskList = [];
this.eachTask(this.taskList, this.taskData);
this.nowKey = 0;
this.nowData = this.taskList[this.nowKey];
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];
// console.log(this.taskData, this.taskList, this.nowData, '===', data);
}).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);
}
});
},
handleChange(data, node) {
node.isCurrent = false;
this.$set(node, 'isCurrent', false);
@ -199,7 +128,7 @@ export default {
},
eachTask(list, data) {
data.forEach(ele => {
if (ele.isTask) {
if (ele.nodeType === 'TASK') {
list.push(ele);
}
if (ele.children) {
@ -211,17 +140,64 @@ export default {
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,
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.$router.push('/contest/list');
this.$confirm('是否确认返回,返回将放弃改模块测试?', this.$t('tip.hint'), {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$router.push('/contest/list');
}).catch(() => {});
},
submit() {
this.$router.push('/contest/list');
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%;
@ -232,7 +208,7 @@ export default {
}
.container-right{
background: #00172E;
border: solid 1px #01468B;
border: 1px solid #01468B;
height: 100%;
padding: 10px;
}
@ -243,12 +219,15 @@ export default {
width: 20.9%;
text-align: right;
padding: 10px;
border-top: 2px solid #01468B;
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

@ -1,47 +1,42 @@
<template>
<div class="trainingPlatform" :style="'padding-left:'+(widthLeft)+'px'">
<div class="trainingPubMapList" :style="{width: widthLeft+'px'}">
<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>
<div style="height: 50px;text-align: center;line-height: 50px;font-size: 26px;font-weight: bolder;">{{ paperName }}</div>
<el-tabs v-model="activeModuleName" class="tabs-box" type="border-card" @tab-click="handleTabClick">
<template v-for="(mod, modIndex) in moduleList">
<el-tab-pane :key="modIndex" :label="mod.moduleName" :name="mod.customModuleId+''">
<el-card style="padding:10px">
<div>考试时间{{ mod.duration }}分钟</div>
</el-card>
<el-card style="margin-top: 10px;">
<div style="padding:10px"> 任务目录</div>
<el-tree
:data="taskTreeDatas"
node-key="id"
default-expand-all
:expand-on-click-node="false"
/>
</el-card>
<el-card style="margin-top: 10px;">
<div style="padding:10px"> 评分规则</div>
<el-table
:data="ruleData"
border
show-summary
:summary-method="getSummaries"
style="width: 100%;margin-top: 10px;"
>
<el-table-column type="index" width="50" />
<el-table-column label="描述" prop="text" />
<el-table-column label="作业程序" prop="worker" />
<el-table-column label="分值" prop="score" width="50" />
<el-table-column label="评分标准" prop="criteria" />
</el-table>
</el-card>
<el-button type="primary" size="medium" style="margin-top: 10px;" @click="beginExercise(mod.customModuleId)">开始训练</el-button>
</el-tab-pane>
</template>
<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 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 style="margin-bottom:50px"> 任务目录
<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>
@ -49,25 +44,30 @@
<script>
import paperList from './paperList';
import drapLeft from '@/views/components/drapLeft/index';
import ScoreRule from './scoreRule';
import { getPaperDetail, getContextScoreDetail} from '@/api/contest';
let id = 1;
export default {
name: 'TrainingPlatform',
name: 'ContestList',
components: {
paperList,
drapLeft
drapLeft,
ScoreRule
},
data() {
return {
widthLeft: 380,
paperName:'试卷',
paperId:'',
activeModuleName:'',
activeModuleName:'detail',
moduleList:[],
moduleTreeDatas:[],
taskTreeDatas:[],
ruleData:[]
ruleData:[],
defaultProps: {
disabled: true
}
};
},
computed: {
@ -84,7 +84,6 @@ export default {
this.paperId = paper.id;
getPaperDetail(paper.id).then((res) => {
this.moduleList = res.data.moduleVo.modules;
this.activeModuleName = this.moduleList[0].customModuleId + '';
this.moduleTreeDatas = this.moduleList.map(moduleItem=>{
let children = [];
if (moduleItem.group.length) {
@ -108,41 +107,12 @@ export default {
this.$message.error(error.message);
});
},
handleTabClick(tab) {
const moduleItem = this.moduleTreeDatas.find((item)=>item.customModuleId == tab.name);
this.taskTreeDatas = moduleItem.children;
getContextScoreDetail(moduleItem.moduleScoreRuleId).then(res => {
this.ruleData = res.data.rule ? res.data.rule.units : [];
}).catch(() => { this.ruleData = []; });
showScoreRule(moduleScoreRuleId) {
this.$refs.scoreRule.doShow(moduleScoreRuleId);
},
beginExercise(moduleId) {
this.$router.push({path: '/contest/detail', query:{paperId:this.paperId, moduleId }});
},
getSummaries(param) {
const { columns, data } = param;
const sums = [];
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '总分';
return;
}
if (index === 3) {
const values = data.map(item => Number(item[column.property]));
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
sums[index] += '';
} else {
sums[index] = '/';
}
});
return sums;
},
transformTree(data) {
const result = {label:data.name, children:[], id:id++, type:'taskCatalog' };
if (data.group.length) {
@ -157,32 +127,85 @@ export default {
};
</script>
<style lang="scss" scoped>
.trainingPlatform {
.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-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-button{
position: absolute;
bottom: 10px;
left: 50%;
transform: translateX(-50%);
}
}
}
}
}
.trainingPubMapList {
position:absolute;
left:0;
top:0;
height: 100%;
}
.el-card{
border: solid 1px #01468B;
}
/deep/{
.el-tree-node__content{
background-color: transparent !important;
}
.el-tabs__nav-scroll{
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;
.el-tabs--border-card>.el-tabs__header .el-tabs__item{
color: #fff;
border: solid 1px #01468B;
}
&::-webkit-scrollbar-track{
background: #06284a;
.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

@ -3,8 +3,8 @@
<div id="trainingMapTree" class="left-paper-list">
<div class="paperListName">
<el-form :inline="true" :model="formModel" class="demo-form-inline">
<el-form-item label="组别" :label-style="{ color: 'red' }">
<el-select v-model="formModel.group" placeholder="请选择" clearable>
<el-form-item label="组别">
<el-select v-model="formModel.group" placeholder="请选择" clearable style="width: 120px;" @change="queryPaper">
<el-option
v-for="item in groupOption"
:key="item.value"
@ -14,7 +14,7 @@
</el-select>
</el-form-item>
<el-form-item label="赛季">
<el-select v-model="formModel.seasonId" placeholder="请选择" clearable>
<el-select v-model="formModel.seasonId" placeholder="请选择" clearable style="width: 120px;" @change="filterPaper">
<el-option
v-for="item in seasonOptions"
:key="item.id"
@ -22,9 +22,6 @@
:value="item.id"
/>
</el-select>
<el-form-item>
<el-button type="primary" size="medium" @click="queryPaper">查询</el-button>
</el-form-item>
</el-form-item>
</el-form>
</div>
@ -35,7 +32,7 @@
active-text-color="#ffd04b"
>
<template v-for="(paper,paperIndex) in paperList">
<el-menu-item :key="paperIndex" :index="paper.id+''" @click="showPaperDetail(paper)">
<el-menu-item v-show="!formModel.seasonId||paper.seasonId==formModel.seasonId" :key="paperIndex" :index="paper.id+''" @click="showPaperDetail(paper)">
{{ paper.name }}
</el-menu-item>
</template>
@ -46,7 +43,7 @@
<script>
import { queryContestSeasonPaged, getPaperList} from '@/api/contest';
export default {
name: 'DemonList',
name: 'PaperList',
components: {
},
data() {
@ -70,21 +67,34 @@ export default {
},
mounted() {
this.loading = false;
queryContestSeasonPaged({pageSize:999}).then((res) => {
this.seasonOptions = res.data.list;
});
getPaperList({ group:'GZ', pageSize:999}).then((res) => {
this.paperList = res.data.list;
this.defaultIndex = this.paperList[0].id + '';
this.$emit('changeModuleData', this.paperList[0]);
});
this.querySeason();
},
methods: {
queryPaper() {
const data = Object.assign({pageSize:999}, this.formModel);
getPaperList(data).then((res) => {
getPaperList({ group:this.formModel.group, pageSize:999}).then((res) => {
this.paperList = res.data.list;
});
this.querySeason();
},
querySeason() {
queryContestSeasonPaged({pageSize:999, group:this.formModel.group }).then((res) => {
this.seasonOptions = res.data.list;
});
},
filterPaper() {
if (this.formModel.seasonId) {
const paper = this.paperList.find(paper=>paper.seasonId == this.formModel.seasonId);
this.defaultIndex = paper.id + '';
this.$emit('changeModuleData', paper);
} else {
this.defaultIndex = this.paperList[0].id + '';
this.$emit('changeModuleData', this.paperList[0]);
}
},
showPaperDetail(paper) {

View File

@ -1,17 +1,21 @@
<template>
<el-dialog v-dialogDrag title="评分表" :visible.sync="dialogVisible" width="500px" :before-close="handleClose" center :close-on-click-modal="false">
<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="text" />
<el-table-column label="作业程序" prop="worker" />
<el-table-column label="分值" prop="score" width="50" />
<el-table-column label="描述" prop="name" />
<el-table-column label="评分标准" prop="criteria" />
<el-table-column label="分值" prop="score" width="50" />
</el-table>
</el-dialog>
</template>
@ -23,39 +27,34 @@ export default {
data() {
return {
tableData: [],
dialogVisible: false
dialogVisible: false,
loading: false
};
},
methods: {
doShow(index, row) {
doShow(id) {
this.dialogVisible = true;
getContextScoreDetail(this.$route.query.id).then(resp => {
this.loading = true;
getContextScoreDetail(id).then(resp => {
this.tableData = resp.data.rule ? resp.data.rule.units : [];
}).catch(() => { this.$message.error('初始化数据失败!'); });
this.loading = false;
}).catch(() => { this.$message.error('初始化数据失败!'); this.loading = false; this.tableData = []; });
},
getSummaries(param) {
const { columns, data } = param;
const sums = [];
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '总分';
return;
}
if (index === 3) {
const values = data.map(item => Number(item[column.property]));
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
sums[index] += '';
} else {
sums[index] = '/';
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);
return sums;
}
}

View File

@ -7,16 +7,6 @@
<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="group">
<el-select v-model="formModel.group" placeholder="请选择" style="width:350px;">
<el-option
v-for="item in groupOption"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="所属赛季:" prop="seasonId">
<el-select v-model="formModel.seasonId" placeholder="请选择" style="width:350px;">
<el-option
@ -45,17 +35,9 @@ export default {
id: '',
name: '', //
desc: '', //
seasonId: '', // id
group:'' //
seasonId: '' // id
},
seasonOptions:[],
groupOption:[{
value: 'ZZ',
label: '中职'
}, {
value: 'GZ',
label: '高职'
}],
loading: false
};
},
@ -68,9 +50,6 @@ export default {
desc: [
{ required: true, message: '请输入试卷描述', trigger: 'blur' }
],
group: [
{ required: true, message: '请选择试卷所属赛季', trigger: 'blur' }
],
seasonId: [
{ required: true, message: '请选择试卷所属赛季', trigger: 'blur' }
]
@ -83,7 +62,7 @@ export default {
},
methods:{
doShow(row) {
queryContestSeasonPaged().then((res) => {
queryContestSeasonPaged({pageSize:999}).then((res) => {
this.seasonOptions = res.data.list;
});
this.dialogVisible = true;
@ -92,13 +71,11 @@ export default {
this.formModel.name = row.name;
this.formModel.desc = row.desc;
this.formModel.seasonId = row.seasonId;
this.formModel.group = row.group;
} else {
this.formModel = {
id: '',
name: '',
desc: '',
group:'',
seasonId: ''
};
}

View File

@ -85,7 +85,7 @@ export default {
doShow(type, data, isAdd) {
this.isAdd = isAdd;
if (type == 'module') {
queryContextScorePaged().then((res) => {
queryContextScorePaged({pageSize:999}).then((res) => {
this.bindRuleOptions = res.data.list;
});
this.editType = 'module';

View File

@ -51,10 +51,10 @@ export default {
},
methods:{
doShow(row) {
queryContextScorePaged().then((res) => {
queryContextScorePaged({pageSize:999}).then((res) => {
this.bindRuleOptions = res.data.list;
});
queryContestSencePaged().then((res) => {
queryContestSencePaged({pageSize:999}).then((res) => {
this.bindSceneOptions = res.data.list;
});
this.dialogVisible = true;

View File

@ -91,9 +91,6 @@ export default {
this.$message.error(error.message);
});
},
queryChildrenTask() {
console.log(111);
},
creatTask() {
this.$refs.addEditTask.doShow();
},

View File

@ -95,7 +95,7 @@ export default {
deleteContextScore(row.id).then(resp => {
this.reloadTable();
}).catch(error => {
this.$message.error(`删除删除竞赛评分规则失败: ${error.message}`);
this.$message.error(`删除竞赛评分规则失败: ${error.message}`);
});
});
}

View File

@ -1,21 +1,22 @@
<template>
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogVisible" width="500px" :before-close="handleClose" center :close-on-click-modal="false">
<el-form ref="ruleForm" :model="formModel" :rules="rules" label-width="130px">
<el-form-item label="单元描述:" prop="text">
<el-input v-model="formModel.text" style="width: 200px;" />
<el-form-item label="项目:" prop="name">
<el-input v-model="formModel.name" autosize type="textarea" style="width: 200px;" />
</el-form-item>
<el-form-item label="作业程序:" prop="worker">
<el-input v-model="formModel.worker" style="width: 200px;" />
<!-- <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="场景步骤ID:" prop="sceneStepId">-->
<!-- <el-input v-model="formModel.sceneStepId" style="width: 200px;" />-->
<!-- </el-form-item>-->
<el-form-item label="单元分值:" prop="score">
<el-input-number v-model="formModel.score" style="width: 200px;" :min="0" />
</el-form-item>
<el-form-item label="评分标准:" prop="criteria">
<el-input v-model="formModel.criteria" style="width: 200px;" />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button v-loading="loading" type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
@ -30,27 +31,21 @@ export default {
return {
dialogVisible: false,
formModel: {
text: '',
worker: '',
id: '',
name: '',
score: 0,
criteria: '',
sceneStepId: ''
children: []
},
index: -1,
loading: false
loading: false,
type: 'edit'
};
},
computed: {
rules() {
const crules = {
text: [
{ required: true, message: '请输入单元描述', trigger: 'blur' }
],
worker: [
{ required: true, message: '请输入作业程序', trigger: 'blur' }
],
criteria: [
{ required: true, message: '请输入评分标准', trigger: 'blur' }
name: [
{ required: true, message: '请输入项目', trigger: 'blur' }
]
};
return crules;
@ -60,26 +55,26 @@ export default {
}
},
methods:{
doShow(index, row) {
doShow(row, type) {
this.dialogVisible = true;
this.type = type;
if (row) {
this.index = index;
this.formModel.text = row.text;
this.formModel.worker = row.worker;
this.formModel.id = row.id;
this.formModel.name = row.name;
this.formModel.score = row.score;
this.formModel.criteria = row.criteria;
this.formModel.sceneStepId = row.sceneStepId;
this.formModel.children = row.children;
}
},
handleClose() {
this.type = 'edit';
this.formModel = {
text: '',
worker: '',
id: '',
name: '',
score: 0,
criteria: '',
sceneStepId: ''
children: []
};
this.index = -1;
this.$refs.ruleForm.resetFields();
this.dialogVisible = false;
this.loading = false;
@ -89,7 +84,13 @@ export default {
if (valid) {
this.loading = true;
const data = Object.assign({}, this.formModel);
this.$emit('addData', this.index, data);
if (this.type === 'edit') {
this.$emit('editData', data);
} else if (this.type === 'add') {
this.$emit('addData', data);
} else {
this.$emit('charuData', data);
}
this.handleClose();
}
});

View File

@ -5,31 +5,40 @@
<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="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="text" />
<el-table-column label="作业程序" prop="worker" />
<el-table-column label="分值" prop="score" width="50" />
<el-table-column label="项目" prop="name" />
<el-table-column label="评分标准" prop="criteria" />
<!-- <el-table-column label="场景步骤ID" prop="sceneStepId" width="100">-->
<!-- <template slot-scope="scope">-->
<!-- <span>{{ scope.row.sceneStepId === 0? '': scope.row.sceneStepId }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="操作" width="150">
<el-table-column label="分值" prop="score" width="50">
<template slot-scope="scope">
<span>{{ scope.row.score === 0? '': scope.row.score }}</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)"
@ -37,13 +46,13 @@
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<detail-add ref="detailAdd" @addData="addData" />
<detail-add ref="detailAdd" @addData="addData" @editData="editData" @charuData="charuData" />
<import-scene ref="importScene" @importData="importData" />
<select-scene ref="selectScene" @selectSceneId="selectSceneId" />
</div>
@ -63,16 +72,27 @@ export default {
},
data() {
return {
tableData:[]
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 => {
this.tableData = resp.data.rule ? resp.data.rule.units : [];
const data = resp.data.rule ? resp.data.rule.units : [];
this.handleData(data, '1');
this.tableData = data;
}).catch(() => { this.$message.error('初始化数据失败!'); });
},
goBack() {
@ -84,8 +104,28 @@ export default {
.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(index, data);
this.$refs.detailAdd.doShow(data, 'edit');
},
doClear() {
this.tableData = [];
@ -102,38 +142,48 @@ export default {
});
},
doAdd() {
this.$refs.detailAdd.doShow();
this.$refs.detailAdd.doShow('', 'add');
},
addData(index, data) {
if (index > -1) {
this.$set(this.tableData, index, data);
} else {
this.tableData.push(data);
}
},
getSummaries(param) {
const { columns, data } = param;
const sums = [];
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '总分';
return;
handleEditData(data, list) {
list.find((ele, i) => {
if (data.id === ele.id) {
Object.assign(ele, data);
return true;
}
if (index === 3) {
const values = data.map(item => Number(item[column.property]));
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
sums[index] += '';
} else {
sums[index] = '/';
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);
return sums;
}
}

View File

@ -232,6 +232,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

@ -122,6 +122,9 @@ export default {
}
},
watch: {
'$store.state.map.mapViewLoadedCount': function (val) {
// this.loadTraining({ id: 12483 });
},
'$store.state.trainingNew.trainingDetail': function(val) {
this.initAdjacentTraining();
},