Introducing new features. 完成用户管理的增删改查

This commit is contained in:
aeizzz 2023-02-01 10:37:24 +08:00
parent 69c1c847ab
commit 066f5a54e9
10 changed files with 427 additions and 231 deletions

9
src/api/admin/dept.ts Normal file
View File

@ -0,0 +1,9 @@
import request from "/@/utils/request";
export const depttree = (params?: Object) => {
return request({
url: '/admin/dept/tree',
method: "get",
params
})
}

40
src/api/admin/menu.ts Normal file
View File

@ -0,0 +1,40 @@
import request from "/@/utils/request";
export const pageList = (params?: Object) => {
return request({
url: '/admin/menu/tree',
method: "get",
params
})
}
export const info = (id: String) => {
return request({
url: `/admin/menu/${id}`,
method: "get",
})
}
export const save = (data: Object) => {
return request({
url: '/admin/menu',
method: "post",
data: data
})
}
export const update = (data: Object) => {
return request({
url: '/admin/menu',
method: "put",
data: data
})
}
export const addObj = (data: Object) => {
return request({
url: '/admin/menu',
method: "post",
data: data
})
}

10
src/api/admin/post.ts Normal file
View File

@ -0,0 +1,10 @@
import request from "/@/utils/request";
export const list = (params?: Object) => {
return request({
url: '/admin/post/list',
method: "get",
params
})
}

10
src/api/admin/role.ts Normal file
View File

@ -0,0 +1,10 @@
import request from "/@/utils/request";
export const list = (params?: Object) => {
return request({
url: '/admin/role/list',
method: "get",
params
})
}

39
src/api/admin/user.ts Normal file
View File

@ -0,0 +1,39 @@
import request from "/@/utils/request";
export const pageList = (params?: Object) => {
return request({
url: '/admin/user/page',
method: "get",
params
})
}
export const addObj = (obj: Object) => {
return request({
url: '/admin/user',
method: 'post',
data: obj
})
}
export const getObj = (id: String) => {
return request({
url: '/admin/user/' + id,
method: 'get'
})
}
export const delObj = (id: String) => {
return request({
url: '/admin/user/' + id,
method: 'delete'
})
}
export const putObj = (obj: Object) => {
return request({
url: '/admin/user',
method: 'put',
data: obj
})
}

View File

@ -29,33 +29,4 @@ export function useMenuApi() {
};
}
export const pageList = (params?: Object) => {
return request({
url: '/admin/menu/tree',
method: "get",
params
})
}
export const info = (id: String) => {
return request({
url: `/admin/menu/${id}`,
method: "get",
})
}
export const save = (data: Object) => {
return request({
url: '/admin/menu',
method: "post",
data: data
})
}
export const update = (data: Object) => {
return request({
url: '/admin/menu',
method: "put",
data: data
})
}

View File

@ -4,7 +4,7 @@
<el-row :gutter="35">
<el-col :span="12" class="mb20">
<el-form-item label="菜单类型">
<el-radio-group v-model="state.ruleForm.menuType">
<el-radio-group v-model="state.ruleForm.menType">
<el-radio-button label="0">左菜单</el-radio-button>
<el-radio-button label="1">按钮</el-radio-button>
<el-radio-button label="2">顶菜单</el-radio-button>
@ -66,10 +66,8 @@
<script setup lang="ts" name="systemMenuDialog">
import {defineAsyncComponent, nextTick, onMounted, reactive, ref} from 'vue';
import {storeToRefs} from 'pinia';
import {useRoutesList} from '/@/stores/routesList';
import {i18n} from '/@/i18n/index';
import {info, pageList, update} from "/@/api/menu";
import {info, pageList, update, addObj} from "/@/api/admin/menu";
import type {menuData} from './menu'
// /
@ -80,11 +78,8 @@ const IconSelector = defineAsyncComponent(() => import('/@/components/iconSelect
//
const menuDialogFormRef = ref();
const stores = useRoutesList();
const { routesList } = storeToRefs(stores);
//
const state = reactive({
// `/src/router/route.ts` `dynamicRoutes`
ruleForm: {
menuId: '',
name: '',
@ -106,7 +101,7 @@ const state = reactive({
},
});
//
//
const getMenuData = async () => {
pageList().then(res => {
let menu: menuData;
@ -135,7 +130,6 @@ const openDialog = (type: string, row?: any) => {
if (type === 'edit') {
//
info(row.id).then(res => {
console.log(res.data, 'res.data')
state.ruleForm = (res.data as menuData)
})
state.dialog.title = '修改菜单';
@ -150,6 +144,7 @@ const openDialog = (type: string, row?: any) => {
}
state.dialog.type = type;
state.dialog.isShowDialog = true;
getMenuData();
};
//
const closeDialog = () => {
@ -168,13 +163,15 @@ const onSubmit = () => {
emit('refresh');
}).catch(err => {
})
}else{
addObj(state.ruleForm).then(() => {
closeDialog(); //
emit('refresh');
}).catch(err => {
})
}
};
//
onMounted(() => {
getMenuData();
});
// 使
defineExpose({

View File

@ -57,7 +57,7 @@
import { defineAsyncComponent, ref, onMounted, reactive } from 'vue';
import { RouteRecordRaw } from 'vue-router';
import { ElMessageBox, ElMessage } from 'element-plus';
import { pageList } from '/@/api/menu'
import { pageList } from '/@/api/admin/menu'
import type { menuData } from './menu'
//
const MenuDialog = defineAsyncComponent(() => import('/@/views/system/menu/dialog.vue'));

View File

@ -1,79 +1,83 @@
<template>
<div class="system-user-dialog-container">
<el-dialog :title="state.dialog.title" v-model="state.dialog.isShowDialog" width="769px">
<el-dialog :title="state.dialog.title" v-model="state.dialog.isShowDialog" width="60%">
<el-form ref="userDialogFormRef" :model="state.ruleForm" size="default" label-width="90px">
<el-row :gutter="35">
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="账户名称">
<el-input v-model="state.ruleForm.userName" placeholder="请输入账户名称" clearable></el-input>
<el-col :span="12" class="mb20">
<el-form-item label="用户名">
<el-input v-model="state.ruleForm.username" placeholder="请输入用户名" :disabled="state.dialog.type === 'edit'"></el-input>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="用户昵称">
<el-input v-model="state.ruleForm.userNickname" placeholder="请输入用户昵称" clearable></el-input>
<el-col :span="12" class="mb20">
<el-form-item label="密码">
<el-input v-model="state.ruleForm.password" type="password" placeholder="请输入密码" clearable></el-input>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="关联角色">
<el-select v-model="state.ruleForm.roleSign" placeholder="请选择" clearable class="w100">
<el-option label="超级管理员" value="admin"></el-option>
<el-option label="普通用户" value="common"></el-option>
<el-col :span="12" class="mb20">
<el-form-item label="姓名">
<el-input v-model="state.ruleForm.name" placeholder="请输入姓名" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="12" class="mb20">
<el-form-item label="手机号">
<el-input v-model="state.ruleForm.phone" placeholder="请输入手机号" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="12" class="mb20">
<el-form-item label="角色">
<el-select v-model="state.role" placeholder="请选择" clearable class="w100" multiple>
<el-option
v-for="item in state.roleData"
:key="item.roleId"
:label="item.roleName"
:value="item.roleId"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-col :span="12" class="mb20">
<el-form-item label="岗位">
<el-select v-model="state.post" placeholder="请选择" clearable class="w100" multiple>
<el-option
v-for="item in state.postData"
:key="item.postId"
:label="item.postName"
:value="item.postId"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12" class="mb20">
<el-form-item label="部门">
<el-cascader
:options="state.deptData"
:props="{ checkStrictly: true, value: 'deptName', label: 'deptName' }"
placeholder="请选择部门"
clearable
class="w100"
v-model="state.ruleForm.department"
>
<template #default="{ node, data }">
<span>{{ data.deptName }}</span>
<span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
</template>
</el-cascader>
<el-tree-select
v-model="state.ruleForm.deptId"
:data="state.deptData"
:props="{ value: 'id', label: 'name', children: 'children' }"
class="w100"
clearable
check-strictly
placeholder="请选择所属部门"
>
</el-tree-select>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="手机号">
<el-input v-model="state.ruleForm.phone" placeholder="请输入手机号" clearable></el-input>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-col :span="12" class="mb20">
<el-form-item label="邮箱">
<el-input v-model="state.ruleForm.email" placeholder="请输入" clearable></el-input>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="性别">
<el-select v-model="state.ruleForm.sex" placeholder="请选择" clearable class="w100">
<el-option label="男" value="男"></el-option>
<el-option label="女" value="女"></el-option>
</el-select>
<el-col :span="12" class="mb20">
<el-form-item label="昵称">
<el-input v-model="state.ruleForm.nickname" placeholder="请输入昵称" clearable></el-input>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="账户密码">
<el-input v-model="state.ruleForm.password" placeholder="请输入" type="password" clearable></el-input>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="账户过期">
<el-date-picker v-model="state.ruleForm.overdueTime" type="date" placeholder="请选择" class="w100"> </el-date-picker>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="用户状态">
<el-switch v-model="state.ruleForm.status" inline-prompt active-text="启" inactive-text="禁"></el-switch>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
<el-form-item label="用户描述">
<el-input v-model="state.ruleForm.describe" type="textarea" placeholder="请输入用户描述" maxlength="150"></el-input>
<el-col :span="12" class="mb20">
<el-form-item label="状态">
<el-radio-group v-model="state.ruleForm.lockFlag">
<el-radio label="0" border>有效</el-radio>
<el-radio label="9" border>禁用</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
@ -89,8 +93,12 @@
</template>
<script setup lang="ts" name="systemUserDialog">
import { reactive, ref } from 'vue';
import {nextTick, reactive, ref, watchEffect} from 'vue';
import { getObj,addObj, putObj } from '/@/api/admin/user'
import { list as roleList } from '/@/api/admin/role'
import { list as postList } from '/@/api/admin/post'
import { depttree } from '/@/api/admin/dept'
import { ElMessage } from 'element-plus';
// /
const emit = defineEmits(['refresh']);
@ -98,19 +106,28 @@ const emit = defineEmits(['refresh']);
const userDialogFormRef = ref();
const state = reactive({
ruleForm: {
userName: '', //
userNickname: '', //
roleSign: '', //
department: [] as string[], //
phone: '', //
email: '', //
sex: '', //
password: '', //
overdueTime: '', //
status: true, //
describe: '', //
userId: '',
username: '',
password: '' as String | undefined,
salt: '',
wxOpenid: '',
qqOpenid: '',
lockFlag: '',
phone: '' as String | undefined,
deptId: '',
roleList: [],
postList: [],
nickname: '',
name: '',
email: '',
post: [] as String[],
role: [] as String[],
},
deptData: [] as DeptTreeType[], //
post: [] as String[],
role: [] as String[],
deptData: [], //
postData: [], //
roleData: [], //
dialog: {
isShowDialog: false,
type: '',
@ -120,21 +137,36 @@ const state = reactive({
});
//
const openDialog = (type: string, row: RowUserType) => {
const openDialog = (type: string, row: any) => {
if (type === 'edit') {
state.ruleForm = row;
state.dialog.title = '修改用户';
state.dialog.submitTxt = '修 改';
state.ruleForm = Object.assign(state.ruleForm,row)
row.roleList.map((item: any) => {
state.role.push(item.roleId)
})
row.postList.map((item: any) => {
state.post.push(item.postId)
})
state.ruleForm.password = "******"
} else {
state.dialog.title = '新增用户';
state.dialog.submitTxt = '新 增';
// 使
// nextTick(() => {
// userDialogFormRef.value.resetFields();
// });
nextTick(() => {
userDialogFormRef.value.resetFields();
state.ruleForm = Object.assign({})
state.role = []
state.post = []
});
}
state.dialog.type = type;
state.dialog.isShowDialog = true;
getMenuData();
// 使
getDeptData();
getPostData();
getRoleData();
};
//
const closeDialog = () => {
@ -148,37 +180,57 @@ const onCancel = () => {
const onSubmit = () => {
closeDialog();
emit('refresh');
// if (state.dialog.type === 'add') { }
if (state.dialog.type === 'edit') {
//
if (state.ruleForm.phone && state.ruleForm.phone.indexOf("*") >= 0) {
state.ruleForm.phone = undefined;
}
if (state.ruleForm.password && state.ruleForm.password.indexOf("******") >= 0) {
state.ruleForm.password = undefined;
}
putObj(state.ruleForm).then(() => {
closeDialog(); //
emit('refresh');
}).catch(err => {
ElMessage.error(err.msg)
})
}else{
if (state.ruleForm.phone && state.ruleForm.phone.indexOf("*") > 0) {
state.ruleForm.phone = undefined;
}
addObj(state.ruleForm).then(() => {
ElMessage.success("保存成功")
closeDialog(); //
emit('refresh');
}).catch(err => {
ElMessage.error(err.msg)
})
}
};
watchEffect(() => {
state.ruleForm.post = state.post;
state.ruleForm.role = state.role
})
//
const getMenuData = () => {
state.deptData.push({
deptName: 'vueNextAdmin',
createTime: new Date().toLocaleString(),
status: true,
sort: Math.random(),
describe: '顶级部门',
id: Math.random(),
children: [
{
deptName: 'IT外包服务',
createTime: new Date().toLocaleString(),
status: true,
sort: Math.random(),
describe: '总部',
id: Math.random(),
},
{
deptName: '资本控股',
createTime: new Date().toLocaleString(),
status: true,
sort: Math.random(),
describe: '分部',
id: Math.random(),
},
],
});
const getDeptData = () => {
//
depttree().then(res => {
state.deptData = res.data
})
};
//
const getPostData =() => {
postList().then(res => {
state.postData = res.data
})
}
//
const getRoleData =() => {
roleList().then(res => {
state.roleData = res.data
})
}
//
defineExpose({

View File

@ -1,60 +1,98 @@
<template>
<div class="system-user-container layout-padding">
<el-card shadow="hover" class="layout-padding-auto">
<div class="system-user-search mb15">
<el-input size="default" placeholder="请输入用户名称" style="max-width: 180px"> </el-input>
<el-button size="default" type="primary" class="ml10">
<el-icon>
<ele-Search />
</el-icon>
查询
</el-button>
<el-button size="default" type="success" class="ml10" @click="onOpenAddUser('add')">
<el-icon>
<ele-FolderAdd />
</el-icon>
新增用户
</el-button>
</div>
<el-table :data="state.tableData.data" v-loading="state.tableData.loading" style="width: 100%">
<el-table-column type="index" label="序号" width="60" />
<el-table-column prop="userName" label="账户名称" show-overflow-tooltip></el-table-column>
<el-table-column prop="userNickname" label="用户昵称" show-overflow-tooltip></el-table-column>
<el-table-column prop="roleSign" label="关联角色" show-overflow-tooltip></el-table-column>
<el-table-column prop="department" label="部门" show-overflow-tooltip></el-table-column>
<el-table-column prop="phone" label="手机号" show-overflow-tooltip></el-table-column>
<el-table-column prop="email" label="邮箱" show-overflow-tooltip></el-table-column>
<el-table-column prop="status" label="用户状态" show-overflow-tooltip>
<template #default="scope">
<el-tag type="success" v-if="scope.row.status">启用</el-tag>
<el-tag type="info" v-else>禁用</el-tag>
</template>
</el-table-column>
<el-table-column prop="describe" label="用户描述" show-overflow-tooltip></el-table-column>
<el-table-column prop="createTime" label="创建时间" show-overflow-tooltip></el-table-column>
<el-table-column label="操作" width="100">
<template #default="scope">
<el-button :disabled="scope.row.userName === 'admin'" size="small" text type="primary" @click="onOpenEditUser('edit', scope.row)"
>修改</el-button
>
<el-button :disabled="scope.row.userName === 'admin'" size="small" text type="primary" @click="onRowDel(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="onHandleSizeChange"
@current-change="onHandleCurrentChange"
class="mt15"
:pager-count="5"
:page-sizes="[10, 20, 30]"
v-model:current-page="state.tableData.param.pageNum"
background
v-model:page-size="state.tableData.param.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="state.tableData.total"
>
</el-pagination>
</el-card>
<el-row :gutter="20">
<el-col :span="4" :xs="24">
<el-card shadow="hover" class="layout-padding-auto">
<div class="head-container">
<el-input
v-model="deptData.search.deptName"
placeholder="请输入部门名称"
clearable
prefix-icon="Search"
style="margin-bottom: 20px"
@change="getDeptTree"
/>
</div>
<div class="head-container">
<el-tree
:data="deptData.deptList"
:props="{ label: 'name', children: 'children',value: 'id' }"
:expand-on-click-node="false"
ref="deptTreeRef"
:loading="deptData.loading"
node-key="id"
highlight-current
default-expand-all
@node-click="handleNodeClick"
/>
</div>
</el-card>
</el-col>
<el-col :span="20" :xs="24">
<el-card shadow="hover" class="layout-padding-auto">
<div class="system-user-search mb15">
<el-input size="default" placeholder="请输入用户名称" style="max-width: 180px" v-model="state.search.username"> </el-input>
<el-button size="default" type="primary" class="ml10" @click="getTableData">
<el-icon>
<ele-Search />
</el-icon>
查询
</el-button>
<el-button size="default" type="success" class="ml10" @click="onOpenAddUser('add')">
<el-icon>
<ele-FolderAdd />
</el-icon>
新增用户
</el-button>
</div>
<el-table :data="state.tableData.data" v-loading="state.tableData.loading" style="width: 100%">
<el-table-column type="index" label="序号" width="60" />
<el-table-column prop="username" label="用户名" show-overflow-tooltip></el-table-column>
<el-table-column prop="name" label="姓名" show-overflow-tooltip></el-table-column>
<el-table-column prop="phone" label="手机号" show-overflow-tooltip></el-table-column>
<el-table-column label="岗位" show-overflow-tooltip>
<template #default="scope">
<el-tag v-for="(item,index) in scope.row.postList" type="success">{{item.postName}}</el-tag>
</template>
</el-table-column>
<el-table-column label="角色" show-overflow-tooltip>
<template #default="scope">
<el-tag v-for="(item,index) in scope.row.roleList" type="success">{{item.roleName}}</el-tag>
</template>
</el-table-column>
<el-table-column label="状态" show-overflow-tooltip>
<template #default="scope">
<el-tag v-if="scope.row.lockFlag === '0'" type="success">有效</el-tag>
<el-tag v-if="scope.row.lockFlag === '9'" type="success">锁定</el-tag>
</template>
</el-table-column>
<el-table-column prop="createTime" label="创建时间" show-overflow-tooltip></el-table-column>
<el-table-column label="操作" width="100">
<template #default="scope">
<el-button :disabled="scope.row.userName === 'admin'" size="small" text type="primary" @click="onOpenEditUser('edit', scope.row)"
>修改</el-button
>
<el-button :disabled="scope.row.userName === 'admin'" size="small" text type="primary" @click="onRowDel(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="onHandleSizeChange"
@current-change="onHandleCurrentChange"
class="mt15"
:pager-count="5"
:page-sizes="[10, 20, 30]"
v-model:current-page="state.tableData.param.pageNum"
background
v-model:page-size="state.tableData.param.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="state.tableData.total"
>
</el-pagination>
</el-card>
</el-col>
</el-row>
<UserDialog ref="userDialogRef" @refresh="getTableData()" />
</div>
</template>
@ -62,13 +100,15 @@
<script setup lang="ts" name="systemUser">
import { defineAsyncComponent, reactive, onMounted, ref } from 'vue';
import { ElMessageBox, ElMessage } from 'element-plus';
import { pageList, delObj } from '/@/api/admin/user'
import { depttree } from '/@/api/admin/dept'
//
const UserDialog = defineAsyncComponent(() => import('/@/views/system/user/dialog.vue'));
//
const userDialogRef = ref();
const state = reactive<SysUserState>({
const state = reactive({
tableData: {
data: [],
total: 0,
@ -78,54 +118,81 @@ const state = reactive<SysUserState>({
pageSize: 10,
},
},
search: {
deptId: '',
username: ''
}
});
const search = reactive({
deptName: ''
})
const deptData = reactive({
deptList: [],
search: {
deptName: ''
},
loading: false
})
//
const getTableData = () => {
state.tableData.loading = true;
const data = [];
for (let i = 0; i < 2; i++) {
data.push({
userName: i === 0 ? 'admin' : 'test',
userNickname: i === 0 ? '我是管理员' : '我是普通用户',
roleSign: i === 0 ? 'admin' : 'common',
department: i === 0 ? ['vueNextAdmin', 'IT外包服务'] : ['vueNextAdmin', '资本控股'],
phone: '12345678910',
email: 'vueNextAdmin@123.com',
sex: '女',
password: '123456',
overdueTime: new Date(),
status: true,
describe: i === 0 ? '不可删除' : '测试用户',
createTime: new Date().toLocaleString(),
});
}
state.tableData.data = data;
state.tableData.total = state.tableData.data.length;
setTimeout(() => {
state.tableData.loading = false;
}, 500);
pageList(state.search).then(res => {
state.tableData.data = res.data.records;
state.tableData.total = res.data.total;
state.tableData.loading = false;
}).catch(err => {
ElMessage.error(err.msg)
state.tableData.loading = false;
})
};
//
const getDeptTree = () => {
deptData.loading = true
depttree(deptData.search).then(res => {
deptData.deptList = res.data
}).catch(err => {
ElMessage.error(err.msg)
}).finally(() => {
deptData.loading = false
})
}
//
const handleNodeClick = (e: any) => {
state.search.deptId = e.id
getTableData()
}
//
const onOpenAddUser = (type: string) => {
userDialogRef.value.openDialog(type);
};
//
const onOpenEditUser = (type: string, row: RowUserType) => {
const onOpenEditUser = (type: string, row: any) => {
userDialogRef.value.openDialog(type, row);
};
//
const onRowDel = (row: RowUserType) => {
ElMessageBox.confirm(`此操作将永久删除账户名称:“${row.userName}”,是否继续?`, '提示', {
const onRowDel = (row: any) => {
ElMessageBox.confirm(`此操作将永久删除账户名称:“${row.username}”,是否继续?`, '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
getTableData();
ElMessage.success('删除成功');
//
delObj(row.userId).then(res => {
getTableData();
ElMessage.success('删除成功');
}).catch(err => {
ElMessage.error(err.msg)
})
})
.catch(() => {});
};
//
const onHandleSizeChange = (val: number) => {
@ -140,6 +207,7 @@ const onHandleCurrentChange = (val: number) => {
//
onMounted(() => {
getTableData();
getDeptTree();
});
</script>