🐛 修复 user 在 IDEA 报错的问题

This commit is contained in:
YunaiV 2023-12-03 01:03:41 +08:00
parent fa421d0895
commit 3d2d48b601
6 changed files with 29 additions and 40 deletions

View File

@ -77,5 +77,5 @@ export const updateUserStatus = (id: number, status: number) => {
// 获取用户精简信息列表 // 获取用户精简信息列表
export const getSimpleUserList = (): Promise<UserVO[]> => { export const getSimpleUserList = (): Promise<UserVO[]> => {
return request.get({ url: '/system/user/list-all-simple' }) return request.get({ url: '/system/user/simple-list' })
} }

View File

@ -1,37 +1,25 @@
import request from '@/config/axios' 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 { export interface ProfileVO {
id: number id: number
username: string username: string
nickname: string nickname: string
dept: ProfileDept dept: {
roles: ProfileRole[] id: number
posts: ProfilePost[] name: string
socialUsers: SocialUser[] }
roles: {
id: number
name: string
}[]
posts: {
id: number
name: string
}[]
socialUsers: {
type: number
openid: string
}[]
email: string email: string
mobile: string mobile: string
sex: number sex: number

View File

@ -41,7 +41,7 @@
<li class="list-group-item"> <li class="list-group-item">
<Icon class="mr-5px" icon="ep:calendar" /> <Icon class="mr-5px" icon="ep:calendar" />
{{ t('profile.user.createTime') }} {{ t('profile.user.createTime') }}
<div class="pull-right">{{ formatDate(userInfo?.createTime) }}</div> <div class="pull-right">{{ formatDate(userInfo.createTime) }}</div>
</li> </li>
</ul> </ul>
</div> </div>
@ -55,7 +55,7 @@ import { getUserProfile, ProfileVO } from '@/api/system/user/profile'
defineOptions({ name: 'ProfileUser' }) defineOptions({ name: 'ProfileUser' })
const { t } = useI18n() const { t } = useI18n()
const userInfo = ref<ProfileVO>() const userInfo = ref({} as ProfileVO)
const getUserInfo = async () => { const getUserInfo = async () => {
const users = await getUserProfile() const users = await getUserProfile()
userInfo.value = users userInfo.value = users

View File

@ -32,13 +32,13 @@ const message = useMessage() // 消息弹窗
const dialogVisible = ref(false) // const dialogVisible = ref(false) //
const formLoading = ref(false) // 12 const formLoading = ref(false) // 12
const formData = ref({ const formData = ref({
id: undefined, id: -1,
nickname: '', nickname: '',
username: '', username: '',
roleIds: [] roleIds: []
}) })
const formRef = ref() // Ref const formRef = ref() // Ref
const roleList = ref([]) // const roleList = ref([] as RoleApi.RoleVO[]) //
/** 打开弹窗 */ /** 打开弹窗 */
const open = async (row: UserApi.UserVO) => { const open = async (row: UserApi.UserVO) => {
@ -86,7 +86,7 @@ const submitForm = async () => {
/** 重置表单 */ /** 重置表单 */
const resetForm = () => { const resetForm = () => {
formData.value = { formData.value = {
id: undefined, id: -1,
nickname: '', nickname: '',
username: '', username: '',
roleIds: [] roleIds: []

View File

@ -61,7 +61,7 @@
<el-select v-model="formData.sex" placeholder="请选择"> <el-select v-model="formData.sex" placeholder="请选择">
<el-option <el-option
v-for="dict in getIntDictOptions(DICT_TYPE.SYSTEM_USER_SEX)" v-for="dict in getIntDictOptions(DICT_TYPE.SYSTEM_USER_SEX)"
:key="dict.value" :key="dict.value as number"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
/> />
@ -75,7 +75,7 @@
v-for="item in postList" v-for="item in postList"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.id" :value="item.id!"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -102,6 +102,7 @@ import { defaultProps, handleTree } from '@/utils/tree'
import * as PostApi from '@/api/system/post' import * as PostApi from '@/api/system/post'
import * as DeptApi from '@/api/system/dept' import * as DeptApi from '@/api/system/dept'
import * as UserApi from '@/api/system/user' import * as UserApi from '@/api/system/user'
import { FormRules } from 'element-plus'
defineOptions({ name: 'SystemUserForm' }) defineOptions({ name: 'SystemUserForm' })
@ -126,7 +127,7 @@ const formData = ref({
status: CommonStatusEnum.ENABLE, status: CommonStatusEnum.ENABLE,
roleIds: [] roleIds: []
}) })
const formRules = reactive({ const formRules = reactive<FormRules>({
username: [{ required: true, message: '用户名称不能为空', trigger: 'blur' }], username: [{ required: true, message: '用户名称不能为空', trigger: 'blur' }],
nickname: [{ required: true, message: '用户昵称不能为空', trigger: 'blur' }], nickname: [{ required: true, message: '用户昵称不能为空', trigger: 'blur' }],
password: [{ required: true, message: '用户密码不能为空', trigger: 'blur' }], password: [{ required: true, message: '用户密码不能为空', trigger: 'blur' }],
@ -147,7 +148,7 @@ const formRules = reactive({
}) })
const formRef = ref() // Ref const formRef = ref() // Ref
const deptList = ref<Tree[]>([]) // const deptList = ref<Tree[]>([]) //
const postList = ref([]) // const postList = ref([] as PostApi.PostVO[]) //
/** 打开弹窗 */ /** 打开弹窗 */
const open = async (type: string, id?: number) => { const open = async (type: string, id?: number) => {

View File

@ -47,7 +47,7 @@
> >
<el-option <el-option
v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)" v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
:key="dict.value" :key="dict.value as number"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
/> />
@ -113,7 +113,7 @@
label="部门" label="部门"
align="center" align="center"
key="deptName" key="deptName"
prop="dept.name" prop="deptName"
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
/> />
<el-table-column label="手机号码" align="center" prop="mobile" width="120" /> <el-table-column label="手机号码" align="center" prop="mobile" width="120" />