From b4b7eac73c4121843d4890062eae2794a6815da6 Mon Sep 17 00:00:00 2001
From: ChenYi <296215406@outlook.com>
Date: Mon, 28 Jul 2025 11:23:12 +0800
Subject: [PATCH] =?UTF-8?q?OneNET=E8=B4=A6=E5=8F=B7=E5=AE=8C=E5=96=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
apps/web-antd/src/api-client/services.gen.ts | 4 +--
.../views/onenetmanagement/account/index.vue | 26 +++++++++----------
2 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/apps/web-antd/src/api-client/services.gen.ts b/apps/web-antd/src/api-client/services.gen.ts
index dbdce62..624a259 100644
--- a/apps/web-antd/src/api-client/services.gen.ts
+++ b/apps/web-antd/src/api-client/services.gen.ts
@@ -24,12 +24,12 @@ import type {
IoTDBTreeModelDeviceDataPageAllResponse,
IoTDBTreeModelDeviceDataPageDataInput,
IoTErrorResponse,
+ OneNetAccountDeleteInput,
+ OneNETAccountDeleteResponse,
OneNetAccountInsertInput,
OneNetAccountInsertResponse,
OneNetAccountModifyInput,
OneNetAccountModifyResponse,
- OneNetAccountDeleteInput,
- OneNETAccountDeleteResponse,
OneNETAccountPageListInput,
OneNETAccountPageListResult,
OneNETProductCreateInput,
diff --git a/apps/web-antd/src/views/onenetmanagement/account/index.vue b/apps/web-antd/src/views/onenetmanagement/account/index.vue
index 3baded2..477f499 100644
--- a/apps/web-antd/src/views/onenetmanagement/account/index.vue
+++ b/apps/web-antd/src/views/onenetmanagement/account/index.vue
@@ -12,10 +12,10 @@ import { message as Message } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import {
- postOneNETAccountInsert,
- postOneNETAccountModify,
postOneNETAccountDelete,
postOneNETAccountInfoPage,
+ postOneNETAccountInsert,
+ postOneNETAccountModify,
} from '#/api-client';
import { TableAction } from '#/components/table-action';
import { $t } from '#/locales';
@@ -73,7 +73,7 @@ const [UserModal, userModalApi] = useVbenModal({
draggable: true,
onConfirm: submit,
onBeforeClose: () => {
- editRow.value = {};
+ // 只在确认提交后重置,而不是每次关闭都重置
return true;
},
});
@@ -117,7 +117,7 @@ const [EditForm, editFormApi] = useVbenForm({
async function submit() {
const isEdit = !!editRow.value.id;
const formApi = isEdit ? editFormApi : addFormApi;
- const api = isEdit ? postOneNETAccountInsert : postOneNETAccountModify;
+ const api = isEdit ? postOneNETAccountModify : postOneNETAccountInsert;
const { valid } = await formApi.validate();
if (!valid) return;
@@ -141,6 +141,7 @@ async function submit() {
editRow.value.id ? $t('common.editSuccess') : $t('common.addSuccess'),
);
userModalApi.close();
+ editRow.value = {};
gridApi.reload();
} else {
Message.error(
@@ -169,7 +170,7 @@ async function onDel(record: any) {
Message.warning($t('abp.OneNETManagement.CannotDeleteAccountWithProducts'));
return;
}
-
+
try {
const resp = await postOneNETAccountDelete({ body: { id: record.id } });
if (resp.data) {
@@ -178,12 +179,10 @@ async function onDel(record: any) {
} else {
Message.error($t('common.deleteFail'));
}
- } catch (error) {
+ } catch {
Message.error($t('common.deleteFail'));
}
}
-
-
@@ -218,17 +217,18 @@ async function onDel(record: any) {
auth: ['AbpIdentity.Users.Delete'],
disabled: row.productCount > 0,
popConfirm: {
- title: row.productCount > 0
- ? $t('abp.OneNETManagement.CannotDeleteAccountWithProducts')
- : $t('common.askConfirmDelete'),
+ title:
+ row.productCount > 0
+ ? $t('abp.OneNETManagement.CannotDeleteAccountWithProducts')
+ : $t('common.askConfirmDelete'),
confirm: onDel.bind(null, row),
},
},
]" />
-
-
+
+