yanghao 2 săptămâni în urmă
părinte
comite
ce2bde5eaa
1 a modificat fișierele cu 18 adăugiri și 3 ștergeri
  1. 18 3
      src/views/pms/qhse/data/index.vue

+ 18 - 3
src/views/pms/qhse/data/index.vue

@@ -205,6 +205,8 @@ import { Base64 } from 'js-base64'
 import PmsTree from './PmsTree.vue'
 import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
 import { IotInfoClassifyApi } from '@/api/pms/info'
+import { useUserStore } from '@/store/modules/user'
+import { getUserProfile } from '@/api/system/user/profile'
 // import { IotTreeApi } from '@/api/system/tree'
 defineOptions({ name: 'IotTree' })
 
@@ -351,10 +353,22 @@ const clickNodeId = ref('')
 const nodeId = ref('')
 const deptId = ref('')
 const nodeName = ref('')
+const userStore = useUserStore()
 
-const breadcrumbs = ref<BreadcrumbItem[]>([
-  { id: null, name: '科瑞石油技术', type: 'root' } // 根节点
-])
+const breadcrumbs = ref<BreadcrumbItem[]>([{ id: null, name: '科瑞石油技术', type: 'root' }])
+
+const loadRootBreadcrumb = async () => {
+  const currentDeptId = userStore.getUser.deptId
+  if (!currentDeptId) return
+
+  try {
+    const currentDept = await getUserProfile()
+
+    console.log('sssssssssssssssssssssssss', currentDept)
+
+    breadcrumbs.value[0].name = currentDept.dept.name
+  } catch {}
+}
 
 // 共享的面包屑更新逻辑
 const updateBreadcrumbs = async (node: FileRow) => {
@@ -497,6 +511,7 @@ const resetQuery = () => {
 /** 初始化 */
 onMounted(async () => {
   id.value = Number(params.id) || 0
+  await loadRootBreadcrumb()
 })
 </script>
 <style scoped>