From 882663c9834f4871b3a60c3b33cdb2b22d47d483 Mon Sep 17 00:00:00 2001 From: MSuMshk <2039814060@qq.com> Date: Wed, 18 Feb 2026 08:43:53 +0800 Subject: [PATCH] refactor(@vben/web-antd): remove create store status selection --- .../list/components/StoreEditorDrawer.vue | 95 +------------------ .../composables/store-list-page/constants.ts | 1 - .../composables/store-list-page/helpers.ts | 2 - .../list/composables/useStoreListPage.ts | 10 -- apps/web-antd/src/views/store/list/index.vue | 7 -- .../src/views/store/list/styles/drawer.less | 38 +++++--- apps/web-antd/src/views/store/list/types.ts | 1 - 7 files changed, 25 insertions(+), 129 deletions(-) diff --git a/apps/web-antd/src/views/store/list/components/StoreEditorDrawer.vue b/apps/web-antd/src/views/store/list/components/StoreEditorDrawer.vue index c53e591..2e54293 100644 --- a/apps/web-antd/src/views/store/list/components/StoreEditorDrawer.vue +++ b/apps/web-antd/src/views/store/list/components/StoreEditorDrawer.vue @@ -6,36 +6,18 @@ */ import type { SelectOptionItem } from '../types'; -import type { ServiceType, StoreBusinessStatus } from '#/api/store'; +import type { ServiceType } from '#/api/store'; -import { IconifyIcon } from '@vben/icons'; - -import { - Button, - Drawer, - Form, - FormItem, - Input, - message, - Select, - Upload, -} from 'ant-design-vue'; - -import { requestClient } from '#/api/request'; +import { Button, Drawer, Form, FormItem, Input } from 'ant-design-vue'; interface Props { address: string; - businessStatus: StoreBusinessStatus; - businessStatusOptions: SelectOptionItem[]; contactPhone: string; - coverImage?: string; isSubmitting: boolean; managerName: string; name: string; onSetAddress: (value: string) => void; - onSetBusinessStatus: (value: StoreBusinessStatus) => void; onSetContactPhone: (value: string) => void; - onSetCoverImage?: (value: string) => void; onSetManagerName: (value: string) => void; onSetName: (value: string) => void; onSetServiceTypes: (value: ServiceType[]) => void; @@ -57,20 +39,6 @@ function readTextValue(value: string | undefined) { return value ?? ''; } -/** 解析下拉枚举值。 */ -function readEnumValue(value: unknown): T | undefined { - if (value === undefined || value === null || value === '') return undefined; - const numericValue = Number(value); - return Number.isFinite(numericValue) ? (numericValue as T) : undefined; -} - -/** 同步营业状态。 */ -function handleBusinessStatusChange(value: unknown) { - const nextStatus = readEnumValue(value); - if (nextStatus === undefined) return; - props.onSetBusinessStatus(nextStatus); -} - /** 切换服务方式。 */ function toggleServiceType(value: ServiceType) { const current = [...props.serviceTypes]; @@ -82,31 +50,6 @@ function toggleServiceType(value: ServiceType) { } props.onSetServiceTypes(current); } - -/** 处理图片上传。 */ -async function handleUpload(options: any) { - const { file, onSuccess, onError } = options; - try { - const formData = new FormData(); - formData.append('file', file); - // 假设后端上传接口为 /upload,返回 { url: string } - const res = await requestClient.post<{ url: string }>('/upload', formData, { - headers: { 'Content-Type': 'multipart/form-data' }, - }); - - const url = res?.url || (typeof res === 'string' ? res : ''); - if (url) { - props.onSetCoverImage?.(url); - onSuccess(res, file); - message.success('上传成功'); - } else { - throw new Error('Upload response missing url'); - } - } catch (error) { - onError(error); - message.error('上传失败'); - } -}