diff --git a/src/api/system/user/index.ts b/src/api/system/user/index.ts index 689fec0d..beb6e515 100644 --- a/src/api/system/user/index.ts +++ b/src/api/system/user/index.ts @@ -77,5 +77,5 @@ export const updateUserStatus = (id: number, status: number) => { // 获取用户精简信息列表 export const getSimpleUserList = (): Promise => { - return request.get({ url: '/system/user/list-all-simple' }) + return request.get({ url: '/system/user/simple-list' }) } diff --git a/src/api/system/user/profile.ts b/src/api/system/user/profile.ts index b2623c8b..1e80e854 100644 --- a/src/api/system/user/profile.ts +++ b/src/api/system/user/profile.ts @@ -1,37 +1,25 @@ import request from '@/config/axios' -export interface ProfileDept { - id: number - name: string -} -export interface ProfileRole { - id: number - name: string -} -export interface ProfilePost { - id: number - name: string -} -export interface SocialUser { - id: number - type: number - openid: string - token: string - rawTokenInfo: string - nickname: string - avatar: string - rawUserInfo: string - code: string - state: string -} export interface ProfileVO { id: number username: string nickname: string - dept: ProfileDept - roles: ProfileRole[] - posts: ProfilePost[] - socialUsers: SocialUser[] + dept: { + id: number + name: string + } + roles: { + id: number + name: string + }[] + posts: { + id: number + name: string + }[] + socialUsers: { + type: number + openid: string + }[] email: string mobile: string sex: number diff --git a/src/views/Profile/components/ProfileUser.vue b/src/views/Profile/components/ProfileUser.vue index b493499f..0d469efb 100644 --- a/src/views/Profile/components/ProfileUser.vue +++ b/src/views/Profile/components/ProfileUser.vue @@ -41,7 +41,7 @@
  • {{ t('profile.user.createTime') }} -
    {{ formatDate(userInfo?.createTime) }}
    +
    {{ formatDate(userInfo.createTime) }}
  • @@ -55,7 +55,7 @@ import { getUserProfile, ProfileVO } from '@/api/system/user/profile' defineOptions({ name: 'ProfileUser' }) const { t } = useI18n() -const userInfo = ref() +const userInfo = ref({} as ProfileVO) const getUserInfo = async () => { const users = await getUserProfile() userInfo.value = users diff --git a/src/views/system/user/UserAssignRoleForm.vue b/src/views/system/user/UserAssignRoleForm.vue index 57d73537..67a5ddb9 100644 --- a/src/views/system/user/UserAssignRoleForm.vue +++ b/src/views/system/user/UserAssignRoleForm.vue @@ -32,13 +32,13 @@ const message = useMessage() // 消息弹窗 const dialogVisible = ref(false) // 弹窗的是否展示 const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 const formData = ref({ - id: undefined, + id: -1, nickname: '', username: '', roleIds: [] }) const formRef = ref() // 表单 Ref -const roleList = ref([]) // 角色的列表 +const roleList = ref([] as RoleApi.RoleVO[]) // 角色的列表 /** 打开弹窗 */ const open = async (row: UserApi.UserVO) => { @@ -86,7 +86,7 @@ const submitForm = async () => { /** 重置表单 */ const resetForm = () => { formData.value = { - id: undefined, + id: -1, nickname: '', username: '', roleIds: [] diff --git a/src/views/system/user/UserForm.vue b/src/views/system/user/UserForm.vue index 60583b82..60a360ba 100644 --- a/src/views/system/user/UserForm.vue +++ b/src/views/system/user/UserForm.vue @@ -61,7 +61,7 @@ @@ -75,7 +75,7 @@ v-for="item in postList" :key="item.id" :label="item.name" - :value="item.id" + :value="item.id!" /> @@ -102,6 +102,7 @@ import { defaultProps, handleTree } from '@/utils/tree' import * as PostApi from '@/api/system/post' import * as DeptApi from '@/api/system/dept' import * as UserApi from '@/api/system/user' +import { FormRules } from 'element-plus' defineOptions({ name: 'SystemUserForm' }) @@ -126,7 +127,7 @@ const formData = ref({ status: CommonStatusEnum.ENABLE, roleIds: [] }) -const formRules = reactive({ +const formRules = reactive({ username: [{ required: true, message: '用户名称不能为空', trigger: 'blur' }], nickname: [{ required: true, message: '用户昵称不能为空', trigger: 'blur' }], password: [{ required: true, message: '用户密码不能为空', trigger: 'blur' }], @@ -147,7 +148,7 @@ const formRules = reactive({ }) const formRef = ref() // 表单 Ref const deptList = ref([]) // 树形结构 -const postList = ref([]) // 岗位列表 +const postList = ref([] as PostApi.PostVO[]) // 岗位列表 /** 打开弹窗 */ const open = async (type: string, id?: number) => { diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index b5fcb422..a35c3b4d 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -47,7 +47,7 @@ > @@ -113,7 +113,7 @@ label="部门" align="center" key="deptName" - prop="dept.name" + prop="deptName" :show-overflow-tooltip="true" />