修复前端打包问题

提取基础接口为配置
This commit is contained in:
xiaowang
2026-03-10 23:23:15 +08:00
parent 191c558049
commit 580a89c64d
27 changed files with 257 additions and 222 deletions
+19 -18
View File
@@ -43,7 +43,7 @@
<template v-else-if="column.key === 'status'">
<a-switch
:checked="record.status === 1"
@change="(checked) => handleStatusChange(record, checked)"
@change="(checked: any) => handleStatusChange(record, checked === true)"
/>
</template>
<template v-else-if="column.key === 'actions'">
@@ -197,12 +197,13 @@
</template>
<script setup lang="ts">
import { ref, reactive, onMounted, computed } from 'vue'
import { ref, reactive, onMounted } from 'vue'
import { message, Modal } from 'ant-design-vue'
import type { FormInstance } from 'ant-design-vue'
import { PlusOutlined } from '@ant-design/icons-vue'
import { DEFAULT_AVATAR } from '@/constants'
import { userApi, type UserVO, adminShopApi, type Shop } from '@/api/admin'
import { userApi, adminShopApi, type Shop } from '@/api/admin'
import type { UserVO } from '@/api/user'
import { usePermission } from '@/utils/permission'
const { hasPermission, loadUserPermissions } = usePermission()
@@ -233,7 +234,7 @@ const viewModalVisible = ref(false)
const isEdit = ref(false)
const isAdmin = ref(false)
const formRef = ref<FormInstance>()
const currentUser = ref<UserVO | null>(null)
const currentUser = ref<UserVO | Record<string, any> | null>(null)
const currentUserInfo = getCurrentUserInfo()
const viewFormState = reactive({
@@ -270,7 +271,7 @@ const formRules = {
password: [{ required: true, message: '请输入密码', trigger: 'blur' }],
shopId: [{ required: true, message: '请选择店铺', trigger: 'change' }],
type: [{ required: true, message: '请选择用户类型', trigger: 'change' }]
}
} as any
const columns = [
{ title: '头像', key: 'avatar', width: 80 },
@@ -313,7 +314,7 @@ const fetchShopList = async () => {
shopList.value = []
formState.shopId = currentUserInfo.shopId
} else {
const res = await adminShopApi.listAllShops()
const res = await adminShopApi.listAllShops() as unknown as any[]
shopList.value = res || []
if (currentUserInfo && currentUserInfo.type !== 4 && currentUserInfo.shopId) {
formState.shopId = currentUserInfo.shopId
@@ -346,9 +347,9 @@ const fetchUserList = async () => {
const res = await userApi.listUsers(params)
// 前端再次过滤,确保只显示级别比当前用户低的用户
let filteredList = res.list || []
let filteredList = (res as any).list || []
if (currentUserInfo && currentUserInfo.type !== 4) {
filteredList = filteredList.filter(user => {
filteredList = filteredList.filter((user: any) => {
if (currentUserInfo.type === 2) {
// 店长可以看到美甲师(3)和用户(0)
return user.type === 3 || user.type === 0
@@ -392,13 +393,13 @@ const showAddModal = () => {
modalVisible.value = true
}
const showEditModal = (record: UserVO) => {
const showEditModal = (record: UserVO | Record<string, any>) => {
isEdit.value = true
currentUser.value = record
Object.assign(formState, {
account: record.account,
nickname: record.nickname,
phone: record.phone,
phone: (record as any).phone || '',
password: '',
type: record.type,
shopId: record.shopId
@@ -406,11 +407,11 @@ const showEditModal = (record: UserVO) => {
modalVisible.value = true
}
const showViewModal = (record: UserVO) => {
const showViewModal = (record: UserVO | Record<string, any>) => {
Object.assign(viewFormState, {
account: record.account,
nickname: record.nickname,
phone: record.phone,
phone: (record as any).phone || '',
shopId: record.shopId,
type: record.type,
createTime: record.createTime
@@ -426,7 +427,7 @@ const checkAccountExists = async (account: string) => {
try {
const res = await userApi.listUsers({ page: 1, size: 1000, keyword: account, status: 1 })
// 只检查未被删除的账号(status为1表示正常,0表示删除)
return res.list?.some(user => user.account === account)
return (res as any).list?.some((user: any) => user.account === account)
} catch (error) {
console.error('检查账号是否存在失败:', error)
return false
@@ -467,9 +468,9 @@ const handleModalOk = async () => {
status: 0 // 只查询已删除的用户
})
if (deletedUser.list && deletedUser.list.length > 0) {
if ((deletedUser as any).list && (deletedUser as any).list.length > 0) {
// 找到已删除的账号,恢复它
const user = deletedUser.list[0]
const user = (deletedUser as any).list[0]
await userApi.updateUserStatus(user.id, 1)
message.success('账号已恢复')
} else {
@@ -500,7 +501,7 @@ const handleModalCancel = () => {
formRef.value?.resetFields()
}
const handleStatusChange = async (record: UserVO, checked: boolean) => {
const handleStatusChange = async (record: UserVO | Record<string, any>, checked: boolean) => {
try {
await userApi.updateUserStatus(record.id, checked ? 1 : 0)
message.success('状态更新成功')
@@ -511,7 +512,7 @@ const handleStatusChange = async (record: UserVO, checked: boolean) => {
}
}
const handleResetPassword = (record: UserVO) => {
const handleResetPassword = (record: UserVO | Record<string, any>) => {
Modal.confirm({
title: '确认重置密码',
content: `确定要将用户 ${record.nickname} 的密码重置为 888888 吗?`,
@@ -526,7 +527,7 @@ const handleResetPassword = (record: UserVO) => {
})
}
const handleDelete = async (record: UserVO) => {
const handleDelete = async (record: UserVO | Record<string, any>) => {
try {
if (record.type === 4) {
message.warning('管理员账号无法被删除')