diff --git a/src/views/fileManager/components/addTableData.vue b/src/views/fileManager/components/addTableData.vue index 391c8dc2..c29a2d5f 100644 --- a/src/views/fileManager/components/addTableData.vue +++ b/src/views/fileManager/components/addTableData.vue @@ -37,15 +37,16 @@ > - + check-strictly + :props="{ value: 'id', label: 'label', children: 'children' }" + style="width: 100%" + /> { } else { console.error('获取档案标识代码字典失败:', markCodeRes.data.msg) } + const convertToVueTree = (data) => { + if (!data || !Array.isArray(data)) return []; + return data.map((item) => { + const node = { + id: item.id, + label: item.title + }; + if (item.children && Array.isArray(item.children) && item.children.length > 0) { + const children = convertToVueTree(item.children); + if (children.length > 0) node.children = children; + + } + return node; + }); + }; + const deptRes = await getDeptTree(); + dictData.unit_name = convertToVueTree(deptRes.data.data); + + // 获取文件大小限制字典 const fileSizeRes = await getDictDataByTypeApi({ dictType: 'file_size_limit' }) @@ -237,6 +259,7 @@ const fetchDictData = async () => { console.error('获取字典数据失败:', error) // 使用默认值 dictData.mark_code = [] + dictData.unit_name = [] dictData.file_size_limit = [] } }