From 7de898980626dfd0c66c0ca39c2cbecd62ad7654 Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Tue, 5 Mar 2024 13:44:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E9=A1=B5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../contestTaskManage/ContestTaskManage.vue | 54 ++++++++++--------- 1 file changed, 29 insertions(+), 25 deletions(-) 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 {