From be5ec40bc0705ebc76468b7b8fd474871e098b39 Mon Sep 17 00:00:00 2001 From: zc <> Date: Thu, 16 Dec 2021 06:35:59 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E9=83=A8=E9=97=A8=E9=BB=98=E8=AE=A4=E4=B8=8D?= =?UTF-8?q?=E9=80=89=E4=B8=ADbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复编辑用户部门默认不选中bug --- src/views/system/dept/index.vue | 24 ++---------------------- src/views/system/user/index.vue | 24 ++++++------------------ 2 files changed, 8 insertions(+), 40 deletions(-) diff --git a/src/views/system/dept/index.vue b/src/views/system/dept/index.vue index ac296a25..4286203b 100644 --- a/src/views/system/dept/index.vue +++ b/src/views/system/dept/index.vue @@ -135,15 +135,10 @@ label="上级部门" prop="parentId" > - @@ -296,25 +291,10 @@ function resetQuery() { handleQuery() } -function flatten(origin: any) { - let result: any = [] - for (let i = 0; i < origin.length; i++) { - const item = origin[i] - if (Array.isArray(item.children)) { - result = result.concat(flatten(item.children)) - result.push(item) - } else { - result.push(item) - } - } - return result -} - /** 查询部门下拉树结构 */ function getTreeselect() { getDeptSelectList().then(response => { dataMap.deptOptions = response.data - dataMap.originOptions = flatten(response?.data) as any }) } diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index 132db431..88d33498 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -264,6 +264,7 @@ width="600px" append-to-body @opened="showDialog" + @closed="cancel" > - @@ -428,7 +425,7 @@ import {listUser, getUser, delUser, addUser, updateUser, patch} from '@/api/system/user' import {getDeptSelectList} from '@/api/system/dept' -import Treeselect from '@/components/TreeSelect/Index.vue' +import TreeSelect from '@/components/TreeSelect/Index.vue' import {listRoles} from '@/api/system/role' import {Search, Plus, Edit, Refresh, Delete} from '@element-plus/icons' @@ -666,11 +663,7 @@ function handleSelectionChange(selection: any) { /** 新增按钮操作 */ function handleAdd() { - console.log(dataMap.formVal) dataMap.addformFlag = true - resetForm() - dataMap.originOptions = [] - // loadDeptOptions() dataMap.open = true dataMap.title = '添加用户' dataMap.formVal.password = "123456" @@ -696,15 +689,12 @@ function resetForm() { /** 修改按钮操作 */ async function handleUpdate(row: { [key: string]: any }) { - resetForm() const userId = row.id || dataMap.ids const response = await getUser(userId); dataMap.formVal = response.data - console.log(response.data) dataMap.title = '修改用户' dataMap.formVal.password = '' - dataMap.formVal.deptId = 1 - // dataMap.formVal.deptId = parseInt(response.data.deptId) + dataMap.formVal.deptId =response.data.deptId dataMap.open = true } @@ -754,9 +744,6 @@ function cancel() { resetForm() } -function getParentValue(event: any) { - console.log(event) -} function getDeptId(e: any) { dataMap.formVal.deptId = e @@ -787,6 +774,7 @@ onMounted(() => { function showDialog() { loadDeptOptions() + loadRoleOptions() } From 858aeaecfb2262670f7dfc5740bc10ce6faa61e3 Mon Sep 17 00:00:00 2001 From: zc <> Date: Thu, 16 Dec 2021 07:28:53 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=94=B9=E5=8F=98?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=8A=B6=E6=80=81=E6=8F=90=E7=A4=BA=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E4=BB=A5=E5=8F=8A=E5=8F=96=E6=B6=88=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复改变用户状态提示错误以及取消显示错误bug --- src/views/system/user/index.vue | 61 +++++++++++++++++---------------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index 88d33498..625ffedb 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -264,7 +264,7 @@ width="600px" append-to-body @opened="showDialog" - @closed="cancel" + @close="cancel" > - - + + + + {{ dict.dictLabel }} + + + @@ -366,21 +367,6 @@ - - - - - {{ dict.dictLabel }} - - - - - - + + + + + + + + + { ElMessage.success(text + '成功') }).catch( ()=>{ - row.status = row.status === '1' ? 1 : 0 + row.status = row.status === 1 ? 0 : 1 }) }