大赛训练产品调整暂提

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> </el-row>
</div> </div>
<div style="text-align: center;margin-top: 15px;"> <div style="text-align: center;margin-top: 15px;">
<el-button v-show="nowData.ruleId" type="primary">评分表</el-button> <el-button v-show="!nowData.ruleId" type="primary" @click="showScoreRule">评分表</el-button>
<el-button v-show="nowData.sceneId" type="primary">开始任务</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> <el-button type="primary" :disabled="nowKey === taskList.length-1" @click="nextTask">下一任务</el-button>
</div> </div>
</el-card> </el-card>
@ -53,7 +53,8 @@
</template> </template>
<script> <script>
import { getTaskTree } from '@/api/contest'; import { getTaskTree, getContextSenceDetail} from '@/api/contest';
import { createSimulationNoFunction } from '@/api/simulation';
import ScoreRule from './scoreRule'; import ScoreRule from './scoreRule';
export default { export default {
name: 'ContestDetail', name: 'ContestDetail',
@ -74,15 +75,15 @@ export default {
funcitonData: { funcitonData: {
type: 'METRO', type: 'METRO',
itemMap: { itemMap: {
DEFAULT_MEMBER: ''
}, },
domConfig: { domConfig: {
singleMember: false, singleMember: false,
singleClient: false, singleClient: false,
client: 'dispatchWork', client: '',
hasTraining: false, hasTraining: true,
trainingType: 'SCENE',
hasExam: false, hasExam: false,
trainingDesign: true, trainingDesign: false,
hasLpf: false, hasLpf: false,
hasVoice: true, hasVoice: true,
joint: false, joint: false,
@ -211,6 +212,14 @@ export default {
this.nowKey++; this.nowKey++;
this.nowData = this.taskList[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() { goBack() {
this.$router.push('/contest/list'); this.$router.push('/contest/list');
}, },

View File

@ -1,5 +1,5 @@
<template> <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 <el-table
:data="tableData" :data="tableData"
border border
@ -23,15 +23,21 @@ export default {
data() { data() {
return { return {
tableData: [], tableData: [],
dialogVisible: false dialogVisible: false,
loading: false
}; };
}, },
methods: { methods: {
doShow(index, row) { doShow() {
this.dialogVisible = true; this.dialogVisible = true;
this.loading = true;
getContextScoreDetail(this.$route.query.id).then(resp => { getContextScoreDetail(this.$route.query.id).then(resp => {
this.tableData = resp.data.rule ? resp.data.rule.units : []; 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) { getSummaries(param) {
const { columns, data } = param; const { columns, data } = param;

View File

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

View File

@ -5,17 +5,20 @@
<span>评分规则详情</span> <span>评分规则详情</span>
<div style="float: right; padding: 3px 0"> <div style="float: right; padding: 3px 0">
<el-button type="text" @click="doAdd">添加</el-button> <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="doClear">清空</el-button>
<el-button type="text" @click="doSave">保存</el-button> <el-button type="text" @click="doSave">保存</el-button>
<el-button type="text" @click="goBack">返回</el-button> <el-button type="text" @click="goBack">返回</el-button>
</div> </div>
</div> </div>
<el-table <el-table
ref="table"
:data="tableData" :data="tableData"
border border
show-summary show-summary
row-key="text"
:summary-method="getSummaries" :summary-method="getSummaries"
:tree-props="{children: 'children'}"
style="width: 100%;margin-top: 10px;" style="width: 100%;margin-top: 10px;"
> >
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
@ -23,13 +26,17 @@
<el-table-column label="作业程序" prop="worker" /> <el-table-column label="作业程序" prop="worker" />
<el-table-column label="分值" prop="score" width="50" /> <el-table-column label="分值" prop="score" width="50" />
<el-table-column label="评分标准" prop="criteria" /> <el-table-column label="评分标准" prop="criteria" />
<!-- <el-table-column label="场景步骤ID" prop="sceneStepId" width="100">--> <!-- <el-table-column label="场景步骤ID" prop="sceneStepId" width="100">-->
<!-- <template slot-scope="scope">--> <!-- <template slot-scope="scope">-->
<!-- <span>{{ scope.row.sceneStepId === 0? '': scope.row.sceneStepId }}</span>--> <!-- <span>{{ scope.row.sceneStepId === 0? '': scope.row.sceneStepId }}</span>-->
<!-- </template>--> <!-- </template>-->
<!-- </el-table-column>--> <!-- </el-table-column>-->
<el-table-column label="操作" width="150"> <el-table-column label="操作" width="250">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button
size="mini"
@click="handleCharu(scope.$index,scope.row)"
>插入</el-button>
<el-button <el-button
size="mini" size="mini"
@click="handleEdit(scope.$index,scope.row)" @click="handleEdit(scope.$index,scope.row)"
@ -43,7 +50,7 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-card> </el-card>
<detail-add ref="detailAdd" @addData="addData" /> <detail-add ref="detailAdd" @addData="addData" @charuData="charuData" />
<import-scene ref="importScene" @importData="importData" /> <import-scene ref="importScene" @importData="importData" />
<select-scene ref="selectScene" @selectSceneId="selectSceneId" /> <select-scene ref="selectScene" @selectSceneId="selectSceneId" />
</div> </div>
@ -63,7 +70,8 @@ export default {
}, },
data() { data() {
return { return {
tableData:[] tableData:[],
chaData: []
}; };
}, },
mounted() { mounted() {
@ -74,6 +82,23 @@ export default {
getContextScoreDetail(this.$route.query.id).then(resp => { getContextScoreDetail(this.$route.query.id).then(resp => {
this.tableData = resp.data.rule ? resp.data.rule.units : []; this.tableData = resp.data.rule ? resp.data.rule.units : [];
}).catch(() => { this.$message.error('初始化数据失败!'); }); }).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() { goBack() {
this.$router.go(-1); this.$router.go(-1);
@ -84,8 +109,33 @@ export default {
.then(() => { this.$message.success('保存评分规则单元成功!'); }) .then(() => { this.$message.success('保存评分规则单元成功!'); })
.catch(() => { this.$message.error('保存评分规则单元失败!'); }); .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) { handleEdit(index, data) {
this.$refs.detailAdd.doShow(index, data); this.$refs.detailAdd.doShow(index, data, 'edit');
}, },
doClear() { doClear() {
this.tableData = []; this.tableData = [];
@ -102,7 +152,7 @@ export default {
}); });
}, },
doAdd() { doAdd() {
this.$refs.detailAdd.doShow(); this.$refs.detailAdd.doShow(-1, '', 'edit');
}, },
addData(index, data) { addData(index, data) {
if (index > -1) { if (index > -1) {
@ -111,6 +161,16 @@ export default {
this.tableData.push(data); 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) { getSummaries(param) {
const { columns, data } = param; const { columns, data } = param;
const sums = []; const sums = [];

View File

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