大赛训练产品调整暂提

This commit is contained in:
fan 2024-02-29 18:01:55 +08:00
parent 32866bab90
commit 126507f87f
5 changed files with 119 additions and 31 deletions

View File

@ -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" 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,8 @@
</template>
<script>
import { getTaskTree } from '@/api/contest';
import { getTaskTree, getContextSenceDetail} from '@/api/contest';
import { createSimulationNoFunction } from '@/api/simulation';
import ScoreRule from './scoreRule';
export default {
name: 'ContestDetail',
@ -74,15 +75,15 @@ 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,
@ -211,6 +212,14 @@ export default {
this.nowKey++;
this.nowData = this.taskList[this.nowKey];
},
startTask() {
getContextSenceDetail(this.nowData.sceneId).then(resp => {
}).catch(() => this.$message.error('获取任务场景详情失败!'));
},
showScoreRule() {
this.$refs.scoreRule.doShow();
},
goBack() {
this.$router.push('/contest/list');
},

View File

@ -1,5 +1,5 @@
<template>
<el-dialog v-dialogDrag title="评分表" :visible.sync="dialogVisible" width="500px" :before-close="handleClose" center :close-on-click-modal="false">
<el-dialog v-dialogDrag v-loading="loading" title="评分表" :visible.sync="dialogVisible" width="800px" :before-close="handleClose" center :close-on-click-modal="false">
<el-table
:data="tableData"
border
@ -23,15 +23,21 @@ export default {
data() {
return {
tableData: [],
dialogVisible: false
dialogVisible: false,
loading: false
};
},
methods: {
doShow(index, row) {
doShow() {
this.dialogVisible = true;
this.loading = true;
getContextScoreDetail(this.$route.query.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; });
},
handleClose() {
this.dialogVisible = false;
},
getSummaries(param) {
const { columns, data } = param;

View File

@ -7,9 +7,9 @@
<el-form-item label="作业程序:" prop="worker">
<el-input v-model="formModel.worker" style="width: 200px;" />
</el-form-item>
<!-- <el-form-item label="场景步骤ID:" prop="sceneStepId">-->
<!-- <el-input v-model="formModel.sceneStepId" 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>
@ -34,10 +34,12 @@ export default {
worker: '',
score: 0,
criteria: '',
sceneStepId: ''
sceneStepId: '',
children: []
},
index: -1,
loading: false
loading: false,
type: 'edit'
};
},
computed: {
@ -60,24 +62,28 @@ export default {
}
},
methods:{
doShow(index, row) {
doShow(index, row, type) {
this.dialogVisible = true;
this.type = type;
this.index = index;
if (row) {
this.index = index;
this.formModel.text = row.text;
this.formModel.worker = row.worker;
this.formModel.score = row.score;
this.formModel.criteria = row.criteria;
this.formModel.sceneStepId = row.sceneStepId;
this.formModel.children = row.children;
}
},
handleClose() {
this.type = 'edit';
this.formModel = {
text: '',
worker: '',
score: 0,
criteria: '',
sceneStepId: ''
sceneStepId: '',
children: []
};
this.index = -1;
this.$refs.ruleForm.resetFields();
@ -89,7 +95,11 @@ 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('addData', this.index, data);
} else {
this.$emit('charuData', this.index, data);
}
this.handleClose();
}
});

View File

@ -5,17 +5,20 @@
<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
row-key="text"
:summary-method="getSummaries"
:tree-props="{children: 'children'}"
style="width: 100%;margin-top: 10px;"
>
<el-table-column type="index" width="50" />
@ -23,13 +26,17 @@
<el-table-column label="作业程序" prop="worker" />
<el-table-column label="分值" prop="score" width="50" />
<el-table-column label="评分标准" prop="criteria" />
<!-- <el-table-column label="场景步骤ID" prop="sceneStepId" width="100">-->
<!-- <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="场景步骤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="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)"
@ -43,7 +50,7 @@
</el-table-column>
</el-table>
</el-card>
<detail-add ref="detailAdd" @addData="addData" />
<detail-add ref="detailAdd" @addData="addData" @charuData="charuData" />
<import-scene ref="importScene" @importData="importData" />
<select-scene ref="selectScene" @selectSceneId="selectSceneId" />
</div>
@ -63,7 +70,8 @@ export default {
},
data() {
return {
tableData:[]
tableData:[],
chaData: []
};
},
mounted() {
@ -74,6 +82,23 @@ export default {
getContextScoreDetail(this.$route.query.id).then(resp => {
this.tableData = resp.data.rule ? resp.data.rule.units : [];
}).catch(() => { this.$message.error('初始化数据失败!'); });
this.tableData = [{
text: 'w',
worker: 'w',
score: 1,
criteria: 'w',
sceneStepId: 'w',
children: [
{
text: 'q',
worker: 'q',
score: 2,
criteria: 'q',
sceneStepId: 'q',
children: []
}
]
}];
},
goBack() {
this.$router.go(-1);
@ -84,8 +109,33 @@ export default {
.then(() => { this.$message.success('保存评分规则单元成功!'); })
.catch(() => { this.$message.error('保存评分规则单元失败!'); });
},
deleteTreeData(obj, list) {
list.find((ele, i) => {
if (obj.index === 0) {
list.splice(i, 1);
return true;
}
obj.index--;
if (ele.children && ele.children.length) {
this.deleteTreeData(obj, ele.children);
}
if (obj.index <= 0) {
return true;
}
});
},
handleDelete(index, data) {
const obj = { index: index };
this.deleteTreeData(obj, this.tableData);
this.tableData = [...this.tableData];
},
handleCharu(index, data) {
this.chaData = data;
this.$refs.detailAdd.doShow(index, '', 'charu');
},
handleEdit(index, data) {
this.$refs.detailAdd.doShow(index, data);
this.$refs.detailAdd.doShow(index, data, 'edit');
},
doClear() {
this.tableData = [];
@ -102,7 +152,7 @@ export default {
});
},
doAdd() {
this.$refs.detailAdd.doShow();
this.$refs.detailAdd.doShow(-1, '', 'edit');
},
addData(index, data) {
if (index > -1) {
@ -111,6 +161,16 @@ export default {
this.tableData.push(data);
}
},
charuData(index, data) {
if ( this.chaData.children) {
const sd = this.chaData.children;
sd.push(data);
this.$set(this.chaData, 'children', sd);
} else {
this.$set(this.chaData, 'children', [data]);
}
this.tableData = [...this.tableData];
},
getSummaries(param) {
const { columns, data } = param;
const sums = [];

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();
},