Commit 7ab616ea authored by 张伯涛's avatar 张伯涛

1.退出登录接口注释

2.用户管理部门树默认展开
parent 0276c2d9
...@@ -154,13 +154,13 @@ export const useUserStore = defineStore({ ...@@ -154,13 +154,13 @@ export const useUserStore = defineStore({
* @description: logout * @description: logout
*/ */
async logout(goLogin = false) { async logout(goLogin = false) {
if (this.getToken) { // if (this.getToken) {
try { // try {
await doLogout(); // await doLogout();
} catch { // } catch {
console.log('注销Token失败'); // console.log('注销Token失败');
} // }
} // }
this.setToken(undefined); this.setToken(undefined);
this.setSessionTimeout(false); this.setSessionTimeout(false);
this.setUserInfo(null); this.setUserInfo(null);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div class="m-4 mr-0 overflow-hidden bg-white"> <div class="m-4 mr-0 overflow-hidden bg-white">
<BasicTree <BasicTree
title="部门列表" title="部门列表"
ref="basicTreeRef" ref="treeRef"
toolbar toolbar
search search
treeWrapperClassName="h-[calc(100%-35px)] overflow-auto" treeWrapperClassName="h-[calc(100%-35px)] overflow-auto"
...@@ -15,19 +15,31 @@ ...@@ -15,19 +15,31 @@
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, ref } from 'vue'; import {nextTick, onMounted, ref, unref} from 'vue';
import {BasicTree, TreeItem} from '@/components/Tree'; import {BasicTree, TreeActionType, TreeItem} from '@/components/Tree';
import { getDeptList } from '@/api/system/dept/dept'; import { getDeptList } from '@/api/system/dept/dept';
import {Nullable} from "@vben/types";
defineOptions({ name: 'DeptTree' }); defineOptions({ name: 'DeptTree' });
const emit = defineEmits(['select']); const emit = defineEmits(['select']);
const treeData = ref<TreeItem[]>([]); const treeData = ref<TreeItem[]>([]);
const treeRef = ref<Nullable<TreeActionType>>(null);
function getTree() {
const tree = unref(treeRef);
if (!tree) {
throw new Error('tree is null!');
}
return tree;
}
async function fetch() { async function fetch() {
const res = await getDeptList() const res = await getDeptList()
treeData.value = handleTree(res.data, 'businessId',undefined,undefined,undefined) treeData.value = handleTree(res.data, 'businessId',undefined,undefined,undefined)
await nextTick(() => {
getTree().expandAll(true)
})
} }
function handleTree(data, id, parentId, children, rootId) { function handleTree(data, id, parentId, children, rootId) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment