OneNET账号完善

This commit is contained in:
ChenYi 2025-07-28 11:23:12 +08:00
parent bcc80ab751
commit b4b7eac73c
2 changed files with 15 additions and 15 deletions

View File

@ -24,12 +24,12 @@ import type {
IoTDBTreeModelDeviceDataPageAllResponse,
IoTDBTreeModelDeviceDataPageDataInput,
IoTErrorResponse,
OneNetAccountDeleteInput,
OneNETAccountDeleteResponse,
OneNetAccountInsertInput,
OneNetAccountInsertResponse,
OneNetAccountModifyInput,
OneNetAccountModifyResponse,
OneNetAccountDeleteInput,
OneNETAccountDeleteResponse,
OneNETAccountPageListInput,
OneNETAccountPageListResult,
OneNETProductCreateInput,

View File

@ -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'));
}
}
</script>
<template>
@ -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),
},
},
]" />
</template>
</Grid>
<UserModal :title="editRow.value?.id ? $t('common.edit') : $t('common.add')" class="w-[800px]">
<component :is="editRow.value?.id ? EditForm : AddForm" />
<UserModal :title="editRow.id ? $t('common.edit') : $t('common.add')" class="w-[800px]">
<component :is="editRow.id ? EditForm : AddForm" />
</UserModal>
</Page>
</template>