diff --git a/src/api/system/user/index.ts b/src/api/system/user/index.ts index e488c0d7..3ae4928c 100644 --- a/src/api/system/user/index.ts +++ b/src/api/system/user/index.ts @@ -17,23 +17,8 @@ export interface UserVO { createTime: Date } -export interface UserPageReqVO extends PageParam { - deptId?: number - username?: string - mobile?: string - status?: number - createTime?: Date[] -} - -export interface UserExportReqVO { - code?: string - name?: string - status?: number - createTime?: Date[] -} - // 查询用户管理列表 -export const getUserPageApi = (params: UserPageReqVO) => { +export const getUserPage = (params: PageParam) => { return request.get({ url: '/system/user/page', params }) } @@ -53,12 +38,12 @@ export const updateUserApi = (data: UserVO | Recordable) => { } // 删除用户 -export const deleteUserApi = (id: number) => { +export const deleteUser = (id: number) => { return request.delete({ url: '/system/user/delete?id=' + id }) } // 导出用户 -export const exportUserApi = (params: UserExportReqVO) => { +export const exportUser = (params) => { return request.download({ url: '/system/user/export', params }) } diff --git a/src/views/system/tenantPackage/index.vue b/src/views/system/tenantPackage/index.vue index ac24ea94..7e99815d 100644 --- a/src/views/system/tenantPackage/index.vue +++ b/src/views/system/tenantPackage/index.vue @@ -112,7 +112,7 @@ const { t } = useI18n() // 国际化 const loading = ref(true) // 列表的加载中 const total = ref(0) // 列表的总页数 const list = ref([]) // 列表的数据 -const queryParams: Record = ref>({ +const queryParams = reactive({ pageNo: 1, pageSize: 10, name: null, diff --git a/src/views/system/user/components/UserDeptTree.vue b/src/views/system/user/DeptTree.vue similarity index 66% rename from src/views/system/user/components/UserDeptTree.vue rename to src/views/system/user/DeptTree.vue index 59004a92..87ffaf9a 100644 --- a/src/views/system/user/components/UserDeptTree.vue +++ b/src/views/system/user/DeptTree.vue @@ -1,6 +1,6 @@ @@ -26,25 +26,30 @@ import { ElTree } from 'element-plus' import * as DeptApi from '@/api/system/dept' import { defaultProps, handleTree } from '@/utils/tree' -const emits = defineEmits(['node-click']) const deptName = ref('') -const deptOptions = ref([]) // 树形结构 +const deptList = ref([]) // 树形结构 const treeRef = ref>() + +/** 获得部门树 */ const getTree = async () => { const res = await DeptApi.getSimpleDeptList() - deptOptions.value = [] - deptOptions.value.push(...handleTree(res)) + deptList.value = [] + deptList.value.push(...handleTree(res)) } -const filterNode = (value: string, data: Tree) => { - if (!value) return true - return data.name.includes(value) +/** 基于名字过滤 */ +const filterNode = (name: string, data: Tree) => { + if (!name) return true + return data.name.includes(name) } -const handleDeptNodeClick = async (row: { [key: string]: any }) => { +/** 处理部门被点击 */ +const handleNodeClick = async (row: { [key: string]: any }) => { emits('node-click', row) } +const emits = defineEmits(['node-click']) +/** 初始化 */ onMounted(async () => { await getTree() }) diff --git a/src/views/system/user/components/UserForm.vue b/src/views/system/user/components/UserForm.vue index 4ea21607..a69bf971 100644 --- a/src/views/system/user/components/UserForm.vue +++ b/src/views/system/user/components/UserForm.vue @@ -56,7 +56,7 @@ @@ -70,7 +70,7 @@ v-for="item in postOptions" :key="item.id" :label="item.name" - :value="item.id as number" + :value="item.id" /> @@ -102,7 +102,6 @@ import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { defaultProps, handleTree } from '@/utils/tree' import { ElForm, FormItemRule } from 'element-plus' import { Arrayable } from 'element-plus/es/utils' -import { UserVO } from '@/api/login/types' type Form = InstanceType @@ -210,7 +209,8 @@ const cancel = () => { } /* 打开弹框 */ -const openForm = (row: undefined | UserVO) => { +const open = (type: string, id?: number) => { + console.log(type, id) resetForm() getTree() // 部门树 if (row && row.id) { @@ -232,6 +232,6 @@ onMounted(async () => { defineExpose({ resetForm, - openForm + open }) diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index aeeaced7..cdd47436 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -1,20 +1,19 @@