diff --git a/src/api/axiosHandler.ts b/src/api/axiosHandler.ts index b3791fa..5a31b64 100644 --- a/src/api/axiosHandler.ts +++ b/src/api/axiosHandler.ts @@ -8,7 +8,7 @@ import router from '@/router'; import { clearToken } from '@/utils/auth'; -import { Message } from '@arco-design/web-vue'; +import { message } from 'ant-design-vue'; /** * 处理业务逻辑定义的错误code @@ -28,5 +28,5 @@ export const handleCodeError = (error: any) => { default: errMessage = error.msg || `未知错误-${error.code}`; } - Message.error(errMessage); + message.error(errMessage); }; diff --git a/src/components/upload/ImageUpload.vue b/src/components/upload/ImageUpload.vue index 2cab3c7..f1a2529 100644 --- a/src/components/upload/ImageUpload.vue +++ b/src/components/upload/ImageUpload.vue @@ -118,10 +118,10 @@ const handleError = (error) => { }; const customRequest = async (option) => { - const { onProgress, onError, onSuccess, fileItem, name } = option; + const { onProgress, onError, onSuccess, file, name } = option; try { // 1. 获取预签名上传URL - const response = await fetchImageUploadFile({ suffix: getFileExtension(fileItem.file.name) }); + const response = await fetchImageUploadFile({ suffix: getFileExtension(file.name) }); const preSignedUrl = response?.data?.upload_url; if (!preSignedUrl) { @@ -129,9 +129,9 @@ const customRequest = async (option) => { } console.log('preSignedUrl', preSignedUrl); // 2. 使用预签名URL上传文件 - const blob = new Blob([fileItem.file], { type: fileItem.file.type }); + const blob = new Blob([file], { type: file.type }); await axios.put(preSignedUrl, blob, { - headers: { 'Content-Type': fileItem.file.type }, + headers: { 'Content-Type': file.type }, }); onSuccess(JSON.stringify(response)); diff --git a/src/hooks/table-hooks.ts b/src/hooks/table-hooks.ts deleted file mode 100644 index 9cdb296..0000000 --- a/src/hooks/table-hooks.ts +++ /dev/null @@ -1,172 +0,0 @@ -/* - * @Author: 田鑫 - * @Date: 2023-02-16 15:02:51 - * @LastEditors: 田鑫 - * @LastEditTime: 2023-03-09 11:20:59 - * @Description: table-hooks - */ -import type { PaginationProps, TableBorder, TableColumnData, TableData, TableRowSelection } from '@arco-design/web-vue'; -type Size = 'mini' | 'small' | 'medium' | 'large'; -interface IDefaultProps { - /** 是否显示边框 */ - bordered?: TableBorder; - /** 是否显示选中效果 */ - hoverable?: boolean; - /** 表格的大小 */ - size?: Size; - /** 是否允许调整列宽 */ - 'column-resizable'?: boolean; - /** 是否为加载中状态 */ - loading?: boolean; - /** 分页参数 */ - pagination?: PaginationProps; - /** table数据类型 */ - data?: any[]; - /** 表头参数 */ - columns?: TableColumnData[]; - /** 表格行 key 的取值字段 */ - 'row-key'?: string; - /** 表格的行选择器配置 */ - 'row-selection'?: TableRowSelection; - 'selected-keys'?: (string | number)[]; - [x: string]: any; -} -interface IPagination { - /** 当前页数 */ - current?: number; - /** 总页数默认是0条 */ - total?: number; -} -interface ITableResponse { - current?: number; - records?: T[]; - size?: number; - total?: number; - [x: string]: any; -} -type GetListFunc = (v: object) => Promise>; -export default function useTableProps(loadListFunc: GetListFunc) { - const defaultProps: IDefaultProps = { - bordered: { cell: true }, - size: 'large', - 'column-resizable': true, - loading: true, - data: [] as any[], - pagination: { - current: 1, - pageSize: 20, - total: 0, - showPageSize: true, - showTotal: true, - }, - hoverable: false, - columns: [], - }; - //* 属性组 - const propsRes = reactive(defaultProps); - //* 设置请求参数,如果出了分页参数还有搜索参数,在模板页面调用此方法,可以加入参数 - const loadListParams = reactive({ - page: 1, - size: 20, - }); - /** - * 单独设置默认属性 - * @param params - */ - const setProps = (params: IDefaultProps) => { - if (Object.keys(params).length > 0) { - Object.assign(defaultProps, params); - } - }; - /** - * 设置表头数据 - * @param columns - */ - const setColumns = (columns: TableColumnData[]) => { - propsRes.columns = columns; - }; - /** - * 设置loading - * @param status - */ - const setLoading = (status: boolean) => { - propsRes.loading = status; - }; - /** - * 设置分页 - * @param param0 - */ - const setPagination = ({ current, total }: IPagination) => { - propsRes.pagination!.current = current; - total && (propsRes.pagination!.total = total); - Object.assign(loadListParams, { page: current }); - }; - /** - * 设置列表请求参数 - * @param params - */ - const setLoadListParams = (params?: R) => { - Object.assign(loadListParams, params); - }; - /** - * 加载列表 - * @returns - */ - const loadTableData = async (resetPageIndex = false) => { - if (resetPageIndex) { - setPagination({ current: 1 }); - } - setLoading(true); - try { - const resData = await loadListFunc({ - ...loadListParams, - }); - console.log(resData); - const response = resData as ITableResponse; - propsRes.data = response.records; - setPagination({ - current: response.current, - total: response.total, - }); - setLoading(false); - return resData; - } catch (error) { - setLoading(false); - return []; - } - }; - - // 事件触发组 - const propsEvent = reactive({ - // 排序触发 - sorterChange: (dataIndex: string, direction: string) => { - console.log(dataIndex, direction); - }, - // 分页触发 - pageChange: (current: number) => { - setPagination({ current }); - loadTableData(); - }, - // 修改每页显示条数 - pageSizeChange: (size: number) => { - propsRes.pagination!.pageSize = size; - Object.assign(loadListParams, { size }); - loadTableData(); - }, - selectionChange: (rowKeys: (string | number)[]) => { - propsRes['selected-keys'] = rowKeys; - }, - }); - - return { - propsRes, - propsEvent, - loadListParams, - setProps, - setColumns, - setLoading, - setPagination, - loadTableData, - setLoadListParams, - }; -} diff --git a/src/stores/modules/app/index.ts b/src/stores/modules/app/index.ts index 4637a63..765ed52 100644 --- a/src/stores/modules/app/index.ts +++ b/src/stores/modules/app/index.ts @@ -3,7 +3,7 @@ * @Date: 2025-06-23 03:56:22 */ import { defineStore } from 'pinia'; -import type { AppState, RouteRecordNormalized, NotificationReturn } from './types'; +import type { AppState, RouteRecordNormalized } from './types'; import defaultSettings from '@/config/settings.json'; import type { AppRouteRecordRaw } from '@/router/routes/types'; diff --git a/src/stores/modules/app/types.ts b/src/stores/modules/app/types.ts index 332d660..b324dc9 100644 --- a/src/stores/modules/app/types.ts +++ b/src/stores/modules/app/types.ts @@ -1,8 +1,7 @@ import type { RouteRecordNormalized } from 'vue-router'; -import type { NotificationReturn } from '@arco-design/web-vue/es/notification/interface'; import type { AppRouteRecordRaw } from '@/router/routes/types'; -export { RouteRecordNormalized, NotificationReturn }; +export { RouteRecordNormalized }; export interface AppState { theme: string; diff --git a/src/views/material-center/components/finished-products/explore/detail/components/ai-suggest/index.vue b/src/views/material-center/components/finished-products/explore/detail/components/ai-suggest/index.vue index 38547c5..8e57e0f 100644 --- a/src/views/material-center/components/finished-products/explore/detail/components/ai-suggest/index.vue +++ b/src/views/material-center/components/finished-products/explore/detail/components/ai-suggest/index.vue @@ -1,7 +1,6 @@