From 6ff685308227459f7b518afcc6379dbdb7fd64ae Mon Sep 17 00:00:00 2001 From: 若依 <yzz_ivy@163.com> Date: 星期五, 28 十月 2022 19:42:26 +0800 Subject: [PATCH] !606 重置时取消部门选中 Merge pull request !606 from 也曾为你像超人/N/A --- ruoyi-ui/src/views/system/user/index.vue | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ruoyi-ui/src/views/system/user/index.vue b/ruoyi-ui/src/views/system/user/index.vue index fc8e385..4e0b3dc 100644 --- a/ruoyi-ui/src/views/system/user/index.vue +++ b/ruoyi-ui/src/views/system/user/index.vue @@ -20,6 +20,7 @@ :expand-on-click-node="false" :filter-node-method="filterNode" ref="tree" + node-key="id" default-expand-all highlight-current @node-click="handleNodeClick" @@ -342,9 +343,8 @@ </template> <script> -import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus } from "@/api/system/user"; +import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus, deptTreeSelect } from "@/api/system/user"; import { getToken } from "@/utils/auth"; -import { treeselect } from "@/api/system/dept"; import Treeselect from "@riophae/vue-treeselect"; import "@riophae/vue-treeselect/dist/vue-treeselect.css"; @@ -462,7 +462,7 @@ }, created() { this.getList(); - this.getTreeselect(); + this.getDeptTree(); this.getConfigKey("sys.user.initPassword").then(response => { this.initPassword = response.msg; }); @@ -479,8 +479,8 @@ ); }, /** 查询部门下拉树结构 */ - getTreeselect() { - treeselect().then(response => { + getDeptTree() { + deptTreeSelect().then(response => { this.deptOptions = response.data; }); }, @@ -537,6 +537,8 @@ resetQuery() { this.dateRange = []; this.resetForm("queryForm"); + this.queryParams.deptId = undefined; + this.$refs.tree.setCurrentKey(null); this.handleQuery(); }, // 多选框选中数据 @@ -561,7 +563,6 @@ /** 新增按钮操作 */ handleAdd() { this.reset(); - this.getTreeselect(); getUser().then(response => { this.postOptions = response.posts; this.roleOptions = response.roles; @@ -573,14 +574,13 @@ /** 修改按钮操作 */ handleUpdate(row) { this.reset(); - this.getTreeselect(); const userId = row.userId || this.ids; getUser(userId).then(response => { this.form = response.data; this.postOptions = response.posts; this.roleOptions = response.roles; - this.form.postIds = response.postIds; - this.form.roleIds = response.roleIds; + this.$set(this.form, "postIds", response.postIds); + this.$set(this.form, "roleIds", response.roleIds); this.open = true; this.title = "修改用户"; this.form.password = ""; -- Gitblit v1.9.2