OneNET账号完善
This commit is contained in:
parent
bcc80ab751
commit
b4b7eac73c
@ -24,12 +24,12 @@ import type {
|
|||||||
IoTDBTreeModelDeviceDataPageAllResponse,
|
IoTDBTreeModelDeviceDataPageAllResponse,
|
||||||
IoTDBTreeModelDeviceDataPageDataInput,
|
IoTDBTreeModelDeviceDataPageDataInput,
|
||||||
IoTErrorResponse,
|
IoTErrorResponse,
|
||||||
|
OneNetAccountDeleteInput,
|
||||||
|
OneNETAccountDeleteResponse,
|
||||||
OneNetAccountInsertInput,
|
OneNetAccountInsertInput,
|
||||||
OneNetAccountInsertResponse,
|
OneNetAccountInsertResponse,
|
||||||
OneNetAccountModifyInput,
|
OneNetAccountModifyInput,
|
||||||
OneNetAccountModifyResponse,
|
OneNetAccountModifyResponse,
|
||||||
OneNetAccountDeleteInput,
|
|
||||||
OneNETAccountDeleteResponse,
|
|
||||||
OneNETAccountPageListInput,
|
OneNETAccountPageListInput,
|
||||||
OneNETAccountPageListResult,
|
OneNETAccountPageListResult,
|
||||||
OneNETProductCreateInput,
|
OneNETProductCreateInput,
|
||||||
|
|||||||
@ -12,10 +12,10 @@ import { message as Message } from 'ant-design-vue';
|
|||||||
import { useVbenForm } from '#/adapter/form';
|
import { useVbenForm } from '#/adapter/form';
|
||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
import {
|
import {
|
||||||
postOneNETAccountInsert,
|
|
||||||
postOneNETAccountModify,
|
|
||||||
postOneNETAccountDelete,
|
postOneNETAccountDelete,
|
||||||
postOneNETAccountInfoPage,
|
postOneNETAccountInfoPage,
|
||||||
|
postOneNETAccountInsert,
|
||||||
|
postOneNETAccountModify,
|
||||||
} from '#/api-client';
|
} from '#/api-client';
|
||||||
import { TableAction } from '#/components/table-action';
|
import { TableAction } from '#/components/table-action';
|
||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
@ -73,7 +73,7 @@ const [UserModal, userModalApi] = useVbenModal({
|
|||||||
draggable: true,
|
draggable: true,
|
||||||
onConfirm: submit,
|
onConfirm: submit,
|
||||||
onBeforeClose: () => {
|
onBeforeClose: () => {
|
||||||
editRow.value = {};
|
// 只在确认提交后重置,而不是每次关闭都重置
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -117,7 +117,7 @@ const [EditForm, editFormApi] = useVbenForm({
|
|||||||
async function submit() {
|
async function submit() {
|
||||||
const isEdit = !!editRow.value.id;
|
const isEdit = !!editRow.value.id;
|
||||||
const formApi = isEdit ? editFormApi : addFormApi;
|
const formApi = isEdit ? editFormApi : addFormApi;
|
||||||
const api = isEdit ? postOneNETAccountInsert : postOneNETAccountModify;
|
const api = isEdit ? postOneNETAccountModify : postOneNETAccountInsert;
|
||||||
const { valid } = await formApi.validate();
|
const { valid } = await formApi.validate();
|
||||||
if (!valid) return;
|
if (!valid) return;
|
||||||
|
|
||||||
@ -141,6 +141,7 @@ async function submit() {
|
|||||||
editRow.value.id ? $t('common.editSuccess') : $t('common.addSuccess'),
|
editRow.value.id ? $t('common.editSuccess') : $t('common.addSuccess'),
|
||||||
);
|
);
|
||||||
userModalApi.close();
|
userModalApi.close();
|
||||||
|
editRow.value = {};
|
||||||
gridApi.reload();
|
gridApi.reload();
|
||||||
} else {
|
} else {
|
||||||
Message.error(
|
Message.error(
|
||||||
@ -169,7 +170,7 @@ async function onDel(record: any) {
|
|||||||
Message.warning($t('abp.OneNETManagement.CannotDeleteAccountWithProducts'));
|
Message.warning($t('abp.OneNETManagement.CannotDeleteAccountWithProducts'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const resp = await postOneNETAccountDelete({ body: { id: record.id } });
|
const resp = await postOneNETAccountDelete({ body: { id: record.id } });
|
||||||
if (resp.data) {
|
if (resp.data) {
|
||||||
@ -178,12 +179,10 @@ async function onDel(record: any) {
|
|||||||
} else {
|
} else {
|
||||||
Message.error($t('common.deleteFail'));
|
Message.error($t('common.deleteFail'));
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch {
|
||||||
Message.error($t('common.deleteFail'));
|
Message.error($t('common.deleteFail'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -218,17 +217,18 @@ async function onDel(record: any) {
|
|||||||
auth: ['AbpIdentity.Users.Delete'],
|
auth: ['AbpIdentity.Users.Delete'],
|
||||||
disabled: row.productCount > 0,
|
disabled: row.productCount > 0,
|
||||||
popConfirm: {
|
popConfirm: {
|
||||||
title: row.productCount > 0
|
title:
|
||||||
? $t('abp.OneNETManagement.CannotDeleteAccountWithProducts')
|
row.productCount > 0
|
||||||
: $t('common.askConfirmDelete'),
|
? $t('abp.OneNETManagement.CannotDeleteAccountWithProducts')
|
||||||
|
: $t('common.askConfirmDelete'),
|
||||||
confirm: onDel.bind(null, row),
|
confirm: onDel.bind(null, row),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]" />
|
]" />
|
||||||
</template>
|
</template>
|
||||||
</Grid>
|
</Grid>
|
||||||
<UserModal :title="editRow.value?.id ? $t('common.edit') : $t('common.add')" class="w-[800px]">
|
<UserModal :title="editRow.id ? $t('common.edit') : $t('common.add')" class="w-[800px]">
|
||||||
<component :is="editRow.value?.id ? EditForm : AddForm" />
|
<component :is="editRow.id ? EditForm : AddForm" />
|
||||||
</UserModal>
|
</UserModal>
|
||||||
</Page>
|
</Page>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user