From ee10c142a67797747278c7095c6a0b3d73172622 Mon Sep 17 00:00:00 2001 From: ChenYi <296215406@outlook.com> Date: Tue, 5 Aug 2025 11:16:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=BE=E5=A4=87=E6=89=B9?= =?UTF-8?q?=E9=87=8F=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../devicemanagement/deviceinfo/index.vue | 38 +++++++++++++++---- .../devicemanagement/deviceinfo/schema.ts | 2 +- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/apps/web-antd/src/views/devicemanagement/deviceinfo/index.vue b/apps/web-antd/src/views/devicemanagement/deviceinfo/index.vue index f25179e..5a77e27 100644 --- a/apps/web-antd/src/views/devicemanagement/deviceinfo/index.vue +++ b/apps/web-antd/src/views/devicemanagement/deviceinfo/index.vue @@ -180,6 +180,9 @@ const [BatchAddModal, batchAddModalApi] = useVbenModal({ }, }); +// 获取批量添加模态框的状态 +const batchAddModalState = batchAddModalApi.useStore(); + // 新增和编辑提交的逻辑 async function submit() { const isEdit = !!editRow.value.id; @@ -466,14 +469,25 @@ const getAddressLines = () => { } }; -// 监听批量添加表单的地址列表变化 -watch( - () => batchAddFormApi.getValues()?.addressList, - (newValue) => { - getAddressLines(); - }, - { immediate: true }, -); +// 使用计算属性来实时计算行数 +const computedAddressLines = computed(() => { + try { + const formValues = batchAddFormApi.getValues(); + const addressList = formValues?.addressList; + if (!addressList || typeof addressList !== 'string') { + return 0; + } + const lines = addressList.split('\n').filter((line: string) => line.trim()); + return lines.length; + } catch { + return 0; + } +}); + +// 监听计算属性的变化,更新 addressLines +watch(computedAddressLines, (newValue) => { + addressLines.value = newValue; +}, { immediate: true }); // 缓存刷新按钮处理函数 const handleCacheRefresh = async () => { @@ -634,6 +648,14 @@ const toolbarActions = computed(() => [ 共 {{ addressLines }} 行设备地址 +
+ + +
diff --git a/apps/web-antd/src/views/devicemanagement/deviceinfo/schema.ts b/apps/web-antd/src/views/devicemanagement/deviceinfo/schema.ts index e127d86..5255c51 100644 --- a/apps/web-antd/src/views/devicemanagement/deviceinfo/schema.ts +++ b/apps/web-antd/src/views/devicemanagement/deviceinfo/schema.ts @@ -674,7 +674,7 @@ export const batchAddDeviceFormSchema: any = computed(() => [ componentProps: { rows: 4, placeholder: $t('common.pleaseInput') + $t('abp.deviceInfos.deviceAddress') + ',每行一个设备地址', - showCount: false, + showCount: true, maxLength: 2000, style: { resize: 'vertical',