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')); } } - - - - + +