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() }