展示任务树
This commit is contained in:
parent
0444ef9c46
commit
47d6193733
@ -45,7 +45,7 @@
|
||||
import paperList from './paperList';
|
||||
import drapLeft from '@/views/components/drapLeft/index';
|
||||
import ScoreRule from './scoreRule';
|
||||
import { getPaperDetail, getContextScoreDetail, beginContestExercise} from '@/api/contest';
|
||||
import { getTaskTreeDatas, getPaperDetail, beginContestExercise} from '@/api/contest';
|
||||
let id = 1;
|
||||
|
||||
export default {
|
||||
@ -66,7 +66,8 @@ export default {
|
||||
taskTreeDatas:[],
|
||||
defaultProps: {
|
||||
disabled: true
|
||||
}
|
||||
},
|
||||
allTaskDatas:{}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -74,6 +75,17 @@ export default {
|
||||
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);
|
||||
@ -115,6 +127,16 @@ export default {
|
||||
},
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user