修改设备批量添加

This commit is contained in:
ChenYi 2025-08-05 11:16:38 +08:00
parent 22b6895eed
commit ee10c142a6
2 changed files with 31 additions and 9 deletions

View File

@ -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 }} 行设备地址
</span>
</div>
<div class="flex gap-2">
<Button @click="batchAddModalApi.close()">
{{ $t('common.cancel') }}
</Button>
<Button type="primary" :loading="batchAddModalState?.confirmLoading" @click="submitBatchAdd">
{{ $t('common.confirm') }}
</Button>
</div>
</div>
</template>
</BatchAddModal>

View File

@ -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',