| | |
| | | <template>
|
| | | <div class="app-container">
|
| | | <el-row :gutter="20">
|
| | | <splitpanes class="default-theme">
|
| | | <splitpanes :horizontal="appStore.device === 'mobile'" class="default-theme">
|
| | | <!--部门数据-->
|
| | | <pane size="16">
|
| | | <el-col>
|
| | |
| | | </el-col>
|
| | | </pane>
|
| | | <!--用户数据-->
|
| | | <pane>
|
| | | <el-col size="84">
|
| | | <pane size="84">
|
| | | <el-col>
|
| | | <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
| | | <el-form-item label="用户名称" prop="userName">
|
| | | <el-input v-model="queryParams.userName" placeholder="请输入用户名称" clearable style="width: 240px" @keyup.enter="handleQuery" />
|
| | |
| | | </el-col>
|
| | | <el-col :span="12">
|
| | | <el-form-item label="归属部门" prop="deptId">
|
| | | <el-tree-select v-model="form.deptId" :data="deptOptions" :props="{ value: 'id', label: 'label', children: 'children' }" value-key="id" placeholder="请选择归属部门" check-strictly />
|
| | | <el-tree-select v-model="form.deptId" :data="enabledDeptOptions" :props="{ value: 'id', label: 'label', children: 'children' }" value-key="id" placeholder="请选择归属部门" check-strictly />
|
| | | </el-form-item>
|
| | | </el-col>
|
| | | </el-row>
|
| | |
| | |
|
| | | <script setup name="User">
|
| | | import { getToken } from "@/utils/auth";
|
| | | import useAppStore from '@/store/modules/app'
|
| | | import { changeUserStatus, listUser, resetUserPwd, delUser, getUser, updateUser, addUser, deptTreeSelect } from "@/api/system/user";
|
| | | import { Splitpanes, Pane } from "splitpanes"
|
| | | import "splitpanes/dist/splitpanes.css"
|
| | |
|
| | | const router = useRouter();
|
| | | const appStore = useAppStore()
|
| | | const { proxy } = getCurrentInstance();
|
| | | const { sys_normal_disable, sys_user_sex } = proxy.useDict("sys_normal_disable", "sys_user_sex");
|
| | |
|
| | |
| | | const dateRange = ref([]);
|
| | | const deptName = ref("");
|
| | | const deptOptions = ref(undefined);
|
| | | const enabledDeptOptions = ref(undefined);
|
| | | const initPassword = ref(undefined);
|
| | | const postOptions = ref([]);
|
| | | const roleOptions = ref([]);
|
| | |
| | | proxy.$refs["deptTreeRef"].filter(val);
|
| | | });
|
| | |
|
| | | /** 查询部门下拉树结构 */
|
| | | function getDeptTree() {
|
| | | deptTreeSelect().then(response => {
|
| | | deptOptions.value = response.data;
|
| | | });
|
| | | };
|
| | |
|
| | | /** 查询用户列表 */
|
| | | function getList() {
|
| | | loading.value = true;
|
| | |
| | | });
|
| | | };
|
| | |
|
| | | /** 查询部门下拉树结构 */
|
| | | function getDeptTree() {
|
| | | deptTreeSelect().then(response => {
|
| | | deptOptions.value = response.data;
|
| | | enabledDeptOptions.value = filterDisabledDept(JSON.parse(JSON.stringify(response.data)));
|
| | | });
|
| | | };
|
| | |
|
| | | /** 过滤禁用的部门 */
|
| | | function filterDisabledDept(deptList) {
|
| | | return deptList.filter(dept => {
|
| | | if (dept.disabled) {
|
| | | return false;
|
| | | }
|
| | | if (dept.children && dept.children.length) {
|
| | | dept.children = filterDisabledDept(dept.children);
|
| | | }
|
| | | return true;
|
| | | });
|
| | | };
|
| | |
|
| | | /** 节点单击事件 */
|
| | | function handleNodeClick(data) {
|
| | | queryParams.value.deptId = data.id;
|