diff --git a/core/core-frontend/src/layout/components/Header.vue b/core/core-frontend/src/layout/components/Header.vue index 4f46ba5719..bd2b4b3857 100644 --- a/core/core-frontend/src/layout/components/Header.vue +++ b/core/core-frontend/src/layout/components/Header.vue @@ -136,8 +136,7 @@ onMounted(() => {
- - + { - + { diff --git a/core/core-frontend/src/views/mobile/personal/index.vue b/core/core-frontend/src/views/mobile/personal/index.vue index 7bcec24b54..d2cb6eb3b6 100644 --- a/core/core-frontend/src/views/mobile/personal/index.vue +++ b/core/core-frontend/src/views/mobile/personal/index.vue @@ -2,9 +2,7 @@ import icon_right_outlined from '@/assets/svg/icon_right_outlined.svg' import { useUserStoreWithOut } from '@/store/modules/user' import userImg from '@/assets/img/user.png' -import { mountedOrg, switchOrg } from '@/api/user' import { ref, onMounted, computed } from 'vue' -import OrgCell from '@/views/mobile/components/OrgCell.vue' import { useRouter } from 'vue-router_2' import { logoutApi } from '@/api/login' import { logoutHandler } from '@/utils/logout' @@ -24,143 +22,12 @@ interface OrgTreeNode { } const userStore = useUserStoreWithOut() const { push } = useRouter() -const navBarTitle = ref('组织') -const name = ref('') -const showNavBar = ref(true) const logout = async () => { await logoutApi() logoutHandler() push('/login') } -const orgClick = () => { - showNavBar.value = false -} -const activeDirectName = ref('') - -let orgOption = null -const findName = () => { - const stack = [...orgOption] - while (stack.length) { - const item = stack.pop() - if (item?.id === userStore.getOid) { - name.value = item?.name - break - } - if (item?.children?.length) { - item.children.forEach(kid => stack.push(kid)) - } - } -} - -let directIdCopy = [] -let directNameCopy = [] - -const dfsOrgTree = (arr, depth) => { - arr.forEach(item => { - const { name, id } = item - if (depth <= directIdCopy.length) { - if (depth < directIdCopy.length) { - directIdCopy = directIdCopy.slice(0, depth) - directNameCopy = directNameCopy.slice(0, depth) - } - directIdCopy.splice(directIdCopy.length - 1, 1, id) - directNameCopy.splice(directNameCopy.length - 1, 1, name) - } else { - directIdCopy.push(id) - directNameCopy.push(name) - } - - let nextDepth = depth + 1 - - if (id === userStore.getOid) { - directName.value = [...directNameCopy] - directId.value = [...directIdCopy] - nextDepth = 999 - } - if (item?.children?.length && nextDepth !== 999) { - dfsOrgTree(item?.children, nextDepth) - } - }) -} - -onMounted(() => { - mountedOrg().then(res => { - orgOption = res.data as OrgTreeNode[] - tableData.value = res.data as OrgTreeNode[] - findName() - dfsOrgTree(orgOption, 1) - directName.value.pop() - directId.value.pop() - activeDirectName.value = directName.value[directName.value.length - 1] - }) -}) - -const switchHandler = (id: number | string) => { - switchOrg(id).then(res => { - const token = res.data.token - userStore.setToken(token) - userStore.setExp(res.data.exp) - userStore.setTime(Date.now()) - window.location.reload() - }) -} - -const onClickLeft = () => { - directName.value.pop() - activeDirectName.value = directName.value[directName.value.length - 1] - directId.value.pop() - if (!directName.value.length) { - showNavBar.value = true - } -} - -const clearOrg = () => { - if (!directName.value.length) return - directName.value = [] - activeDirectName.value = '' - directId.value = [] -} - -const orgCellClick = (type, val) => { - if (type !== 'right') { - switchHandler(val.id) - } else { - directName.value.push(val.name) - activeDirectName.value = val.name - directId.value.push(val.id) - } -} - -const handleDir = index => { - if (index === directId.value.length - 1) return - directId.value = directId.value.slice(0, index + 1) - directName.value = directName.value.slice(0, index + 1) - activeDirectName.value = directName.value[directName.value.length - 1] -} - -const tableData = ref([]) -const directName = ref([]) -const directId = ref([]) - -const dfsTree = (ids, arr) => { - const id = ids.shift() - return arr.reduce((pre, ele) => { - if (id && ele.id === id) { - if (!ids.length) { - return ele.children || [] - } - const children = dfsTree([...ids], ele.children || []) - pre = children || [] - } - return pre - }, []) -} - -const activeTableData = computed(() => { - return directId.value.length ? dfsTree([...directId.value], tableData.value) : tableData.value -}) - const showPwd = ref(false) const success = () => { showPwd.value = false @@ -170,66 +37,20 @@ const success = () => { diff --git a/de-xpack b/de-xpack index 07da549b03..ff952fbd0c 160000 --- a/de-xpack +++ b/de-xpack @@ -1 +1 @@ -Subproject commit 07da549b03b237067219a6078e0671a65b4add28 +Subproject commit ff952fbd0c1d3017cd161d1313cbeba64a3dd1e0