展示任务树
This commit is contained in:
parent
0444ef9c46
commit
47d6193733
@ -45,7 +45,7 @@
|
|||||||
import paperList from './paperList';
|
import paperList from './paperList';
|
||||||
import drapLeft from '@/views/components/drapLeft/index';
|
import drapLeft from '@/views/components/drapLeft/index';
|
||||||
import ScoreRule from './scoreRule';
|
import ScoreRule from './scoreRule';
|
||||||
import { getPaperDetail, getContextScoreDetail, beginContestExercise} from '@/api/contest';
|
import { getTaskTreeDatas, getPaperDetail, beginContestExercise} from '@/api/contest';
|
||||||
let id = 1;
|
let id = 1;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -66,7 +66,8 @@ export default {
|
|||||||
taskTreeDatas:[],
|
taskTreeDatas:[],
|
||||||
defaultProps: {
|
defaultProps: {
|
||||||
disabled: true
|
disabled: true
|
||||||
}
|
},
|
||||||
|
allTaskDatas:{}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -74,6 +75,17 @@ export default {
|
|||||||
return this.$store.state.app.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: {
|
methods: {
|
||||||
drapWidth(width) {
|
drapWidth(width) {
|
||||||
this.widthLeft = Number(width);
|
this.widthLeft = Number(width);
|
||||||
@ -115,6 +127,16 @@ export default {
|
|||||||
},
|
},
|
||||||
transformTree(data) {
|
transformTree(data) {
|
||||||
const result = {label:data.name, children:[], id:id++, type:'taskCatalog' };
|
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) {
|
if (data.group.length) {
|
||||||
const changeGroup = data.group.map(taskCatalog=>
|
const changeGroup = data.group.map(taskCatalog=>
|
||||||
this.transformTree(taskCatalog)
|
this.transformTree(taskCatalog)
|
||||||
|
Loading…
Reference in New Issue
Block a user