From 74717f723bf1a03a6a01f738a5c87e8f65fa9c70 Mon Sep 17 00:00:00 2001 From: fhysy <1149505133@qq.com> Date: Thu, 9 Oct 2025 16:09:58 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=AE=BE=E5=A4=87=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=A7=E5=93=81=E9=80=89=E6=8B=A9=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 为设备表单添加产品选择弹窗组件 - 实现产品选择后的数据回填和图片自动设置 - 禁用编辑模式下的产品字段 - 移除旧的产品下拉选项变更逻辑 - 添加产品选择相关的状态管理和事件处理 - 更新表单架构以支持产品选择按钮渲染 --- .../src/components/product-select/data.ts | 2 + .../application/platform/platform-drawer.vue | 3 +- apps/web-antd/src/views/device/device/data.ts | 1 + .../src/views/device/device/device-drawer.vue | 145 ++++++++++++++++-- 4 files changed, 137 insertions(+), 14 deletions(-) diff --git a/apps/web-antd/src/components/product-select/data.ts b/apps/web-antd/src/components/product-select/data.ts index 920c545..a262627 100644 --- a/apps/web-antd/src/components/product-select/data.ts +++ b/apps/web-antd/src/components/product-select/data.ts @@ -33,10 +33,12 @@ export const querySchema: FormSchemaGetter = () => [ { component: 'Select', componentProps: { + allowClear: true, options: enabledOptions, }, fieldName: 'enabled', label: '启用状态', + defaultValue: '1', }, ]; diff --git a/apps/web-antd/src/views/application/platform/platform-drawer.vue b/apps/web-antd/src/views/application/platform/platform-drawer.vue index ccc620f..08c2179 100644 --- a/apps/web-antd/src/views/application/platform/platform-drawer.vue +++ b/apps/web-antd/src/views/application/platform/platform-drawer.vue @@ -123,9 +123,8 @@ const [BasicDrawer, drawerApi] = useVbenDrawer({ const { id } = drawerApi.getData() as { id?: number | string }; isUpdate.value = !!id; - const record = await platformInfo(id); - if (isUpdate.value && id) { + const record = await platformInfo(id); formApi.setState((prev) => { const currentSchema = prev?.schema ?? []; const newSchema = []; diff --git a/apps/web-antd/src/views/device/device/data.ts b/apps/web-antd/src/views/device/device/data.ts index ad29f8a..f6df1cb 100644 --- a/apps/web-antd/src/views/device/device/data.ts +++ b/apps/web-antd/src/views/device/device/data.ts @@ -105,6 +105,7 @@ export const drawerSchema: FormSchemaGetter = () => [ { label: '所属产品', fieldName: 'productId', + disabled: true, component: 'Select', componentProps: {}, rules: 'selectRequired', diff --git a/apps/web-antd/src/views/device/device/device-drawer.vue b/apps/web-antd/src/views/device/device/device-drawer.vue index 23ecba9..c50f67b 100644 --- a/apps/web-antd/src/views/device/device/device-drawer.vue +++ b/apps/web-antd/src/views/device/device/device-drawer.vue @@ -1,10 +1,14 @@