diff --git a/src/components/oa/chooseOrgTree.vue b/src/components/oa/chooseOrgTree.vue
deleted file mode 100644
index 311494f..0000000
--- a/src/components/oa/chooseOrgTree.vue
+++ /dev/null
@@ -1,107 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/components/org/ChooseOrgTree.vue b/src/components/org/ChooseOrgTree.vue
index 677bc27..a9df940 100644
--- a/src/components/org/ChooseOrgTree.vue
+++ b/src/components/org/ChooseOrgTree.vue
@@ -35,7 +35,7 @@ export default {
},
defaultProps: {
children: 'children',
- label: 'name'
+ label: 'text'
}
}
},
@@ -50,11 +50,48 @@ export default {
communityId: getCommunityId()
}
const { data } = await listOrgTree(params)
- this.chooseOrgInfo.orgs = data
+
+ // 确保数据是数组格式
+ let treeData = data
+
+ // 如果返回的是对象而不是数组,尝试提取数组
+ if (Array.isArray(treeData)) {
+ this.chooseOrgInfo.orgs = treeData
+ } else if (treeData && Array.isArray(treeData.children)) {
+ this.chooseOrgInfo.orgs = treeData.children
+ } else if (treeData && Array.isArray(treeData.data)) {
+ this.chooseOrgInfo.orgs = treeData.data
+ } else if (treeData && Array.isArray(treeData.list)) {
+ this.chooseOrgInfo.orgs = treeData.list
+ } else {
+ // 如果都不是数组,转换为数组格式
+ this.chooseOrgInfo.orgs = Array.isArray(treeData) ? treeData : [treeData]
+ }
+
+ // 确保每个节点都有 children 属性且为数组
+ this.processTreeData(this.chooseOrgInfo.orgs)
} catch (error) {
console.error('获取组织树失败:', error)
+ this.chooseOrgInfo.orgs = []
}
},
+ processTreeData(nodes) {
+ if (!Array.isArray(nodes)) return
+
+ nodes.forEach(node => {
+ // 确保每个节点都有 children 属性且为数组
+ if (!node.children) {
+ node.children = []
+ } else if (!Array.isArray(node.children)) {
+ node.children = []
+ }
+
+ // 递归处理子节点
+ if (node.children && node.children.length > 0) {
+ this.processTreeData(node.children)
+ }
+ })
+ },
handleNodeClick(data) {
this.chooseOrgInfo.curOrg = data
this.chooseOrgInfo.curOrg.orgId = data.id
diff --git a/src/components/staff/chooseOrgTree.vue b/src/components/staff/chooseOrgTree.vue
deleted file mode 100644
index 67b5eb5..0000000
--- a/src/components/staff/chooseOrgTree.vue
+++ /dev/null
@@ -1,78 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/components/system/searchCommunityDataList.vue b/src/components/system/searchCommunityDataList.vue
index 13d8082..8cc89f1 100644
--- a/src/components/system/searchCommunityDataList.vue
+++ b/src/components/system/searchCommunityDataList.vue
@@ -155,7 +155,7 @@
-
+