🐛 修复 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[]> => {
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'
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

View File

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

View File

@ -32,13 +32,13 @@ const message = useMessage() // 消息弹窗
const dialogVisible = ref(false) //
const formLoading = ref(false) // 12
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: []

View File

@ -61,7 +61,7 @@
<el-select v-model="formData.sex" placeholder="请选择">
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.SYSTEM_USER_SEX)"
:key="dict.value"
:key="dict.value as number"
:label="dict.label"
:value="dict.value"
/>
@ -75,7 +75,7 @@
v-for="item in postList"
:key="item.id"
:label="item.name"
:value="item.id"
:value="item.id!"
/>
</el-select>
</el-form-item>
@ -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<FormRules>({
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<Tree[]>([]) //
const postList = ref([]) //
const postList = ref([] as PostApi.PostVO[]) //
/** 打开弹窗 */
const open = async (type: string, id?: number) => {

View File

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