OneNET账号完善
This commit is contained in:
parent
bcc80ab751
commit
b4b7eac73c
@ -24,12 +24,12 @@ import type {
|
||||
IoTDBTreeModelDeviceDataPageAllResponse,
|
||||
IoTDBTreeModelDeviceDataPageDataInput,
|
||||
IoTErrorResponse,
|
||||
OneNetAccountDeleteInput,
|
||||
OneNETAccountDeleteResponse,
|
||||
OneNetAccountInsertInput,
|
||||
OneNetAccountInsertResponse,
|
||||
OneNetAccountModifyInput,
|
||||
OneNetAccountModifyResponse,
|
||||
OneNetAccountDeleteInput,
|
||||
OneNETAccountDeleteResponse,
|
||||
OneNETAccountPageListInput,
|
||||
OneNETAccountPageListResult,
|
||||
OneNETProductCreateInput,
|
||||
|
||||
@ -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>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user