diff --git a/src/views/contestDataManage/contestTaskManage/ContestTaskManage.vue b/src/views/contestDataManage/contestTaskManage/ContestTaskManage.vue index 5c334675a..35648d2c7 100644 --- a/src/views/contestDataManage/contestTaskManage/ContestTaskManage.vue +++ b/src/views/contestDataManage/contestTaskManage/ContestTaskManage.vue @@ -21,11 +21,14 @@ :data="taskDta" node-key="id" default-expand-all + :props="defaultProps" :expand-on-click-node="false" > - - {{ node.label }} - +
+
+ {{ node.label }} +
+
任务绑定 - - +
+
@@ -76,7 +79,13 @@ export default { }, data() { return { - taskDta:[] + taskDta:[], + defaultProps: { + children: 'children', + label: 'name', + id: 'id', + parentId:'parentId' + } }; }, created() { @@ -86,7 +95,7 @@ export default { methods: { getTreeData() { getTaskTreeDatas().then((res) => { - this.taskDta = this.transformTree(res.data); + this.taskDta = res.data; }).catch(error => { this.$message.error(error.message); }); @@ -126,22 +135,6 @@ export default { this.$message({ type: 'error', message: res.message }); } }); - }, - transformTree(data) { - const result = []; - for (let i = 0; i < data.length; i++) { - const node = data[i]; - const item = { - id: node.id, - label: node.name, - parentId:node.parentId - }; - if (node.children) { - item.children = this.transformTree(node.children); - } - result.push(item); - } - return result; } } }; @@ -149,8 +142,9 @@ export default {