更新后端接口并修改应用

This commit is contained in:
ChenYi 2025-07-28 14:38:00 +08:00
parent ecebc32a99
commit afeb8fcaee
18 changed files with 12736 additions and 14562 deletions

View File

@ -2,6 +2,6 @@ import { defineConfig } from '@hey-api/openapi-ts';
export default defineConfig({
client: '@hey-api/client-axios',
input: 'http://localhost:44315/swagger/AbpPro/swagger.json',
input: 'http://localhost:10500/swagger/AbpPro/swagger.json',
output: 'src/api-client',
});

View File

@ -1,3 +0,0 @@
// IoTClient 主入口文件
export * from './services';
export * from './types';

View File

@ -1,301 +0,0 @@
import type { Options } from '@hey-api/client-axios';
import type {
DeviceArchivesDown,
DeviceInfoPageListInput,
DeviceInfoPageListResult,
IoTDBCTWingLogInfoDtoPageListInput,
IoTDBCTWingLogInfoDtoPageListResult,
IoTDBOneNETLogInfoPageListInput,
IoTDBOneNETLogInfoPageListResult,
IoTDBTreeModelDeviceDataPageAllResponse,
IoTDBTreeModelDeviceDataPageDataInput,
IoTErrorResponse,
OneNetAccountDeleteInput,
OneNETAccountDeleteResponse,
OneNetAccountInsertInput,
OneNetAccountInsertResponse,
OneNetAccountModifyInput,
OneNetAccountModifyResponse,
OneNETAccountPageListInput,
OneNETAccountPageListResult,
OneNETProductCreateInput,
OneNETProductCreateResponse,
OneNETProductPageListInput,
OneNETProductPageListResult,
PostDeviceInfoCreateData,
PostUsersPageData,
SelectResultListAllResponse,
SelectResultListInput,
} from './types';
import {
createClient,
createConfig,
formDataBodySerializer,
} from '@hey-api/client-axios';
export const client = createClient(createConfig());
/**
*
*/
export const postDeviceInfoPage = <ThrowOnError extends boolean = false>(
options?: Options<DeviceInfoPageListInput, ThrowOnError>,
) => {
return (options?.client ?? client).post<
DeviceInfoPageListResult,
PostRolesAllError,
ThrowOnError
>({
...options,
url: '/DeviceInfo/Page',
});
};
/**
*
*/
export const postDeviceInfoCreate = <ThrowOnError extends boolean = false>(
options?: Options<PostDeviceInfoCreateData, ThrowOnError>,
) => {
return (options?.client ?? client).post<
PostUsersCreateResponse,
PostUsersCreateError,
ThrowOnError
>({
...options,
url: '/Aggregation/Device/Create',
});
};
/**
*
*/
export const postDeviceInfoUpdate = <ThrowOnError extends boolean = false>(
options?: Options<PostDeviceInfoCreateData, ThrowOnError>,
) => {
return (options?.client ?? client).post<
PostUsersUpdateResponse,
PostUsersUpdateError,
ThrowOnError
>({
...options,
url: '/Aggregation/Device/Update',
});
};
/**
*
*/
export const postDeviceInfoDelete = <ThrowOnError extends boolean = false>(
options?: Options<PostUsersDeleteData, ThrowOnError>,
) => {
return (options?.client ?? client).post<
PostUsersDeleteResponse,
PostUsersDeleteError,
ThrowOnError
>({
...options,
url: '/Aggregation/Device/Delete',
});
};
/**
*
*/
export const postDeviceInfoArchivesDown = <
ThrowOnError extends boolean = false,
>(
options?: Options<DeviceArchivesDown, ThrowOnError>,
) => {
return (options?.client ?? client).post<
PostUsersDeleteResponse,
PostUsersDeleteError,
ThrowOnError
>({
...options,
url: '/DeviceInfo/ArchivesDown',
});
};
/**
*
*/
export const postTableModelPacketInfoPage = <
ThrowOnError extends boolean = false,
>(
options?: Options<PostUsersPageData, ThrowOnError>,
) => {
return (options?.client ?? client).post<
PostRolesAllResponse,
PostRolesAllError,
ThrowOnError
>({
...options,
url: '/TableModel/PacketInfoPage',
});
};
/**
* IoTDB设备树模型数据分页
*/
export const postTreeModelDeviceDataInfoPage = <
ThrowOnError extends boolean = false,
>(
options?: Options<IoTDBTreeModelDeviceDataPageDataInput, ThrowOnError>,
) => {
return (options?.client ?? client).post<
IoTDBTreeModelDeviceDataPageAllResponse,
IoTErrorResponse,
ThrowOnError
>({
...options,
...formDataBodySerializer,
url: '/TreeModel/DeviceDataInfoPage',
});
};
/**
*
*/
export const getSelectResultList = <ThrowOnError extends boolean = false>(
options?: Options<SelectResultListInput, ThrowOnError>,
) => {
return (options?.client ?? client).get<
SelectResultListAllResponse,
IoTErrorResponse,
ThrowOnError
>({
...options,
url: '/Common/GetSelectList',
});
};
/**
* OneNET
*/
export const postOneNETLogInfoPage = <ThrowOnError extends boolean = false>(
options?: Options<IoTDBOneNETLogInfoPageListInput, ThrowOnError>,
) => {
return (options?.client ?? client).post<
IoTDBOneNETLogInfoPageListResult,
IoTErrorResponse,
ThrowOnError
>({
...options,
...formDataBodySerializer,
url: '/TableModel/OneNETLogInfo',
});
};
/**
* CTWing
*/
export const postCTWingLogInfoPage = <ThrowOnError extends boolean = false>(
options?: Options<IoTDBCTWingLogInfoDtoPageListInput, ThrowOnError>,
) => {
return (options?.client ?? client).post<
IoTDBCTWingLogInfoDtoPageListResult,
IoTErrorResponse,
ThrowOnError
>({
...options,
...formDataBodySerializer,
url: '/TableModel/CTWingLogInfo',
});
};
/**
* OneNET
*/
export const postOneNETAccountInfoPage = <ThrowOnError extends boolean = false>(
options?: Options<OneNETAccountPageListInput, ThrowOnError>,
) => {
return (options?.client ?? client).post<
OneNETAccountPageListResult,
IoTErrorResponse,
ThrowOnError
>({
...options,
url: '/OneNETAccount/ListAsync',
});
};
/**
* OneNET
*/
export const postOneNETAccountInsert = <ThrowOnError extends boolean = false>(
options?: Options<OneNetAccountInsertInput, ThrowOnError>,
) => {
return (options?.client ?? client).post<
OneNetAccountInsertResponse,
IoTErrorResponse,
ThrowOnError
>({
...options,
url: '/OneNETAccount/InsertAsync',
});
};
/**
* OneNET
*/
export const postOneNETAccountModify = <ThrowOnError extends boolean = false>(
options?: Options<OneNetAccountModifyInput, ThrowOnError>,
) => {
return (options?.client ?? client).post<
OneNetAccountModifyResponse,
IoTErrorResponse,
ThrowOnError
>({
...options,
url: '/OneNETAccount/ModifyAsync',
});
};
/**
* OneNET
*/
export const postOneNETAccountDelete = <ThrowOnError extends boolean = false>(
options?: Options<OneNetAccountDeleteInput, ThrowOnError>,
) => {
return (options?.client ?? client).post<
OneNETAccountDeleteResponse,
IoTErrorResponse,
ThrowOnError
>({
...options,
url: '/OneNETAccount/DeleteAsync',
});
};
/**
* OneNET
*/
export const postOneNETProductInfoPage = <ThrowOnError extends boolean = false>(
options?: Options<OneNETProductPageListInput, ThrowOnError>,
) => {
return (options?.client ?? client).post<
OneNETProductPageListResult,
IoTErrorResponse,
ThrowOnError
>({
...options,
...formDataBodySerializer,
url: '/OneNETProduct/ListAsync',
});
};
/**
* OneNET
*/
export const postOneNETProductCreate = <ThrowOnError extends boolean = false>(
options?: Options<OneNETProductCreateInput, ThrowOnError>,
) => {
return (options?.client ?? client).post<
OneNETProductCreateResponse,
IoTErrorResponse,
ThrowOnError
>({
...options,
url: '/OneNETProduct/InsertAsync',
});
};

View File

@ -1,259 +0,0 @@
export type IoTPageInput = {
/**
*
*/
filter?: null | string;
/**
* .1
*/
pageIndex?: number;
/**
* .
*/
pageSize?: number;
/**
*
*/
readonly skipCount?: number;
/**
*
* <example>
* name desc
* </example>
*/
sorting?: null | string;
};
export type IoTIdInput = {
id?: string;
};
export type IoTRemoteServiceValidationErrorInfo = {
members?: Array<string> | null;
message?: null | string;
};
export type IoTErrorResponse = {
code?: null | string;
data?: null | {
[key: string]: unknown;
};
details?: null | string;
message?: null | string;
validationErrors?: Array<IoTRemoteServiceValidationErrorInfo> | null;
};
export type IoTDBTreeModelDeviceDataPageDataInput = {
body?: IoTPageInput;
};
export type IoTDBTreeModelDeviceDataDto = {
DeviceId?: null | string;
DeviceType?: null | string;
IoTDataType?: null | string;
ProjectId?: null | string;
ProjectName?: null | string;
SystemName?: null | string;
Timestamps?: null | string;
};
export type IoTDBTreeModelDeviceDataPageListResultDto = {
items?: Array<IoTDBTreeModelDeviceDataDto> | null;
totalCount?: number;
};
export type IoTDBTreeModelDeviceDataPageAllResponse =
IoTDBTreeModelDeviceDataPageListResultDto;
export type SelectResultListInput = {
query?: {
ThirdAttributeTypeName?: null | string;
TypeName?: null | string;
};
};
export type SelectResultListDto = {
key?: null | string;
secondValue?: null | string;
thirdValue?: null | string;
value?: null | string;
};
export type SelectResultListAllResponse = {
items?: Array<SelectResultListDto> | null;
};
export type OneNETLogInfoDto = {
deviceId: string;
devicePath: string;
deviceType: string;
focusAddress: string;
/** 数据类型 */
ioTDataType?: string;
isEncrypted: boolean;
messageType: string;
meterAddress: string;
plaintextMessage: string;
platformDeviceId: string;
productId: string;
projectId: string;
protocol: string;
rawMessage: string;
receivedPayload: string;
receivedTime: Date;
systemName: string;
timestamps: number;
};
export type IoTDBOneNETLogInfoPageListInput = {
body?: IoTPageInput;
};
export type IoTDBOneNETLogInfoPageListResult = {
items?: Array<OneNETLogInfoDto> | null;
totalCount?: number;
};
export type CTWingLogInfoDto = {
/** 设备ID */
deviceId?: string;
/** 设备路径 */
devicePath?: string;
/** 设备类型 */
deviceType?: string;
/** 集中器地址 */
focusAddress?: string;
/** IMEI */
imei?: string;
/** IMSI */
imsi?: string;
/** 数据类型 */
ioTDataType?: string;
/** 消息类型 */
messageType?: string;
/** 表计地址 */
meterAddress?: string;
/** 平台设备ID */
platformDeviceId?: string;
/** 平台租户ID */
platformTenantId?: string;
/** 产品ID */
productId?: string;
/** 项目ID */
projectId?: string;
/** 协议 */
protocol?: string;
/** 原始消息 */
rawMessage?: string;
/** 接收载荷 */
receivedPayload?: string;
/** 接收时间 */
receivedTime?: Date;
/** 服务ID */
serviceId?: string;
/** 系统名称 */
systemName?: string;
/** 时间戳 */
timestamps?: number;
};
export type IoTDBCTWingLogInfoDtoPageListInput = {
body?: IoTPageInput;
};
export type IoTDBCTWingLogInfoDtoPageListResult = {
items?: Array<CTWingLogInfoDto> | null;
totalCount?: number;
};
export type OneNETAccountDto = {
accesskey: string;
accountName: string;
oneNETAccountId?: string;
phoneNumber: string;
productCount: number;
};
export type OneNETAccountPageListInput = {
body?: IoTPageInput;
};
export type OneNETAccountPageListResult = {
items?: Array<OneNETAccountDto> | null;
totalCount?: number;
};
export type OneNetAccountInsertInput = {
body?: OneNETAccountDto;
};
export type OneNetAccountInsertResponse = {
body?: OneNETAccountDto;
};
export type OneNetAccountModifyInput = {
body?: OneNETAccountDto;
};
export type OneNetAccountModifyResponse = {
body?: OneNETAccountDto;
};
export type OneNetAccountDeleteInput = {
body?: IoTIdInput;
};
export type OneNETAccountDeleteResponse = {
body?: OneNETAccountDto;
};
export type OneNETProductDto = {
ioTPlatformProductId: string;
isEncrypted?: string;
oneNETAccountId: string;
productAccesskey: string;
productName: string;
};
export type OneNETProductPageListInput = {
body?: IoTPageInput;
};
export type OneNETProductPageListResult = {
items?: Array<OneNETProductDto> | null;
totalCount?: number;
};
export type OneNETProductCreateInput = {
body?: OneNETProductDto;
};
export type OneNETProductCreateResponse = {
body?: OneNETProductDto;
};
export type DeviceInfoDto = {
dynamicPassword?: boolean;
haveValve?: boolean;
id?: string;
meterAddress: number;
meterName: string;
meterType?: number;
password?: number | string;
selfDevelop?: boolean;
singleRate?: number | string;
};
export type DeviceInfoPageListInput = {
body?: IoTPageInput;
};
export type DeviceInfoPageListResult = {
items?: Array<DeviceInfoDto> | null;
totalCount?: number;
};
export type DeviceArchivesDown = {
focusAddress: number | string;
meterAddress: number | string;
meterType: number | string;
};
export type PostDeviceCreateData = {
body?: DeviceInfoDto;
};
export type postDeviceUpdateData = {
body?: DeviceInfoDto;
};

View File

@ -1,5 +1,4 @@
// This file is auto-generated by @hey-api/openapi-ts
export * from './schemas.gen';
export * from './services.gen';
export * from './types.gen';
export * from './IoTClient';
export * from './types.gen';

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -12,10 +12,10 @@ import { message as Message, Modal, Tag } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import {
postMetersCreate,
postMetersDelete,
postMetersPage,
postMetersUpdate,
postDeviceInfoPage,
postAggregationDeviceDeleteAsync,
postDeviceInfoPage,
postAggregationDeviceCreateAsync,
} from '#/api-client';
import { TableAction } from '#/components/table-action';
import { $t } from '#/locales';
@ -55,7 +55,7 @@ const gridOptions: VxeGridProps<any> = {
proxyConfig: {
ajax: {
query: async ({ page }, formValues) => {
const { data } = await postMetersPage({
const { data } = await postDeviceInfoPage({
body: {
pageIndex: page.currentPage,
pageSize: page.pageSize,
@ -119,7 +119,8 @@ const [EditForm, editFormApi] = useVbenForm({
async function submit() {
const isEdit = !!editRow.value.id;
const formApi = isEdit ? editFormApi : addFormApi;
const api = isEdit ? postMetersUpdate : postMetersCreate;
// TODO: 使
const api = postAggregationDeviceCreateAsync;
const { valid } = await formApi.validate();
if (!valid) return;
@ -164,7 +165,7 @@ function onDel(row: any) {
Modal.confirm({
title: `${$t('common.confirmDelete')}${row.meterName} ?`,
onOk: async () => {
const result = await postMetersDelete({ body: { id: row.id } });
const result = await postAggregationDeviceDeleteAsync({ body: { id: row.id } });
if (result) {
gridApi.reload();
Message.success($t('common.deleteSuccess'));

View File

@ -12,10 +12,10 @@ import { message as Message, Modal, Tag } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import {
postMetersCreate,
postMetersDelete,
postMetersPage,
postMetersUpdate,
postDeviceInfoPage,
postAggregationDeviceDeleteAsync,
postDeviceInfoPage,
postAggregationDeviceCreateAsync,
} from '#/api-client';
import { TableAction } from '#/components/table-action';
import { $t } from '#/locales';
@ -55,7 +55,7 @@ const gridOptions: VxeGridProps<any> = {
proxyConfig: {
ajax: {
query: async ({ page }, formValues) => {
const { data } = await postMetersPage({
const { data } = await postDeviceInfoPage({
body: {
pageIndex: page.currentPage,
pageSize: page.pageSize,
@ -119,7 +119,8 @@ const [EditForm, editFormApi] = useVbenForm({
async function submit() {
const isEdit = !!editRow.value.id;
const formApi = isEdit ? editFormApi : addFormApi;
const api = isEdit ? postMetersUpdate : postMetersCreate;
// TODO: 使
const api = postAggregationDeviceCreateAsync;
const { valid } = await formApi.validate();
if (!valid) return;
@ -164,7 +165,7 @@ function onDel(row: any) {
Modal.confirm({
title: `${$t('common.confirmDelete')}${row.meterName} ?`,
onOk: async () => {
const result = await postMetersDelete({ body: { id: row.id } });
const result = await postAggregationDeviceDeleteAsync({ body: { id: row.id } });
if (result) {
gridApi.reload();
Message.success($t('common.deleteSuccess'));

View File

@ -13,11 +13,11 @@ import { useVbenForm } from '#/adapter/form';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import {
postDeviceInfoArchivesDown,
postDeviceInfoCreate,
postDeviceInfoDelete,
postAggregationDeviceCreateAsync,
postAggregationDeviceDeleteAsync,
postDeviceInfoPage,
postDeviceInfoUpdate,
} from '#/api-client/IoTClient';
postAggregationDeviceFindByIdAsync,
} from '#/api-client';
import { TableAction } from '#/components/table-action';
import { $t } from '#/locales';
@ -120,7 +120,8 @@ const [EditForm, editFormApi] = useVbenForm({
async function submit() {
const isEdit = !!editRow.value.id;
const formApi = isEdit ? editFormApi : addFormApi;
const api = isEdit ? postDeviceInfoUpdate : postDeviceInfoCreate;
// TODO: 使
const api = postAggregationDeviceCreateAsync;
const { valid } = await formApi.validate();
if (!valid) return;
@ -165,7 +166,7 @@ function onDel(row: any) {
Modal.confirm({
title: `${$t('common.confirmDelete')}${row.meterName} ?`,
onOk: async () => {
const result = await postDeviceInfoDelete({ body: { id: row.id } });
const result = await postAggregationDeviceDeleteAsync({ body: { id: row.id } });
if (result) {
gridApi.reload();
Message.success($t('common.deleteSuccess'));

View File

@ -8,8 +8,8 @@ import { useRoute } from 'vue-router';
import { Page } from '@vben/common-ui';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { postMetersPage } from '#/api-client';
import { postCTWingLogInfoPage } from '#/api-client/IoTClient';
import { postDeviceInfoPage } from '#/api-client';
import { postCTWingLogInfoPage } from '#/api-client';
import DeviceSelect from '../deviceData/DeviceSelect.vue';
import { querySchema, tableSchema } from './schema';
@ -33,7 +33,7 @@ const deviceOptions = ref<any[]>();
//
const fetchDeviceOptions = async () => {
try {
const { data } = await postMetersPage({
const { data } = await postDeviceInfoPage({
body: {
pageIndex: 1,
pageSize: 1000,

View File

@ -2,7 +2,7 @@
import { ref, computed } from 'vue';
import { Select, Divider, Row } from 'ant-design-vue';
import { ChevronLeft, ChevronRight } from '@vben/icons';
import { postMetersPage } from '#/api-client';
import { postDeviceInfoPage } from '#/api-client';
import { $t } from '#/locales';
import { useDebounceFn } from '@vueuse/core';
@ -49,7 +49,7 @@ const maxPage = computed(() => {
const fetchData = async () => {
loading.value = true;
try {
const { data } = await postMetersPage({
const { data } = await postDeviceInfoPage({
body: {
pageIndex: query.value.pageIndex,
pageSize: query.value.pageSize,

View File

@ -8,8 +8,8 @@ import { useRoute } from 'vue-router';
import { Page } from '@vben/common-ui';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { postMetersPage } from '#/api-client';
import { postTreeModelDeviceDataInfoPage } from '#/api-client/IoTClient';
import { postDeviceInfoPage } from '#/api-client';
import { postTreeModelDeviceDataInfoPage } from '#/api-client';
import { $t } from '#/locales';
import { generateDynamicColumns } from './dynamicColumns';
@ -27,7 +27,7 @@ const selectedDeviceInfo = ref<any>(null);
// ID
const fetchDeviceOptions = async () => {
try {
const { data } = await postMetersPage({
const { data } = await postDeviceInfoPage({
body: {
pageIndex: 1,
pageSize: 1000,

View File

@ -8,8 +8,8 @@ import { useRoute } from 'vue-router';
import { Page } from '@vben/common-ui';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { postMetersPage } from '#/api-client';
import { postOneNETLogInfoPage } from '#/api-client/IoTClient';
import { postDeviceInfoPage } from '#/api-client';
import { postOneNETLogInfoPage } from '#/api-client';
import DeviceSelect from '../deviceData/DeviceSelect.vue';
import { querySchema, tableSchema } from './schema';
@ -33,7 +33,7 @@ const deviceOptions = ref<any[]>();
//
const fetchDeviceOptions = async () => {
try {
const { data } = await postMetersPage({
const { data } = await postDeviceInfoPage({
body: {
pageIndex: 1,
pageSize: 1000,

View File

@ -9,7 +9,7 @@ import { Page } from '@vben/common-ui';
import { Tag } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { postTableModelPacketInfoPage } from '#/api-client/IoTClient';
import { postTableModelPacketInfoPage } from '#/api-client';
import { $t } from '#/locales';
import { querySchema, tableSchema } from './schema';
@ -62,40 +62,28 @@ const [Grid] = useVbenVxeGrid({ formOptions, gridOptions });
{{ row.deviceType }}
</template>
<template #ismanualOrNot="{ row }">
<component
:is="
h(Tag, { color: row.manualOrNot ? 'green' : 'red' }, () =>
row.manualOrNot ? $t('common.yes') : $t('common.no'),
)
"
/>
<component :is="h(Tag, { color: row.manualOrNot ? 'green' : 'red' }, () =>
row.manualOrNot ? $t('common.yes') : $t('common.no'),
)
" />
</template>
<template #isTimeout="{ row }">
<component
:is="
h(Tag, { color: row.isTimeout ? 'green' : 'red' }, () =>
row.isTimeout ? $t('common.yes') : $t('common.no'),
)
"
/>
<component :is="h(Tag, { color: row.isTimeout ? 'green' : 'red' }, () =>
row.isTimeout ? $t('common.yes') : $t('common.no'),
)
" />
</template>
<template #isSend="{ row }">
<component
:is="
h(Tag, { color: row.isSend ? 'green' : 'red' }, () =>
row.isSend ? $t('common.yes') : $t('common.no'),
)
"
/>
<component :is="h(Tag, { color: row.isSend ? 'green' : 'red' }, () =>
row.isSend ? $t('common.yes') : $t('common.no'),
)
" />
</template>
<template #isReceived="{ row }">
<component
:is="
h(Tag, { color: row.isReceived ? 'green' : 'red' }, () =>
row.isReceived ? $t('common.yes') : $t('common.no'),
)
"
/>
<component :is="h(Tag, { color: row.isReceived ? 'green' : 'red' }, () =>
row.isReceived ? $t('common.yes') : $t('common.no'),
)
" />
</template>
</Grid>
</Page>

View File

@ -12,11 +12,11 @@ import { message as Message } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import {
postOneNETAccountDelete,
postOneNETAccountInfoPage,
postOneNETAccountInsert,
postOneNETAccountModify,
} from '#/api-client/IoTClient';
postOneNetAccountDeleteAsync,
postOneNetAccountListAsync,
postOneNetAccountInsertAsync,
postOneNetAccountModifyAsync,
} from '#/api-client';
import { TableAction } from '#/components/table-action';
import { $t } from '#/locales';
@ -53,7 +53,7 @@ const gridOptions: VxeGridProps<any> = {
proxyConfig: {
ajax: {
query: async ({ page }, formValues) => {
const { data } = await postOneNETAccountInfoPage({
const { data } = await postOneNetAccountListAsync({
body: {
pageIndex: page.currentPage,
pageSize: page.pageSize,
@ -117,21 +117,21 @@ const [EditForm, editFormApi] = useVbenForm({
async function submit() {
const isEdit = !!editRow.value.id;
const formApi = isEdit ? editFormApi : addFormApi;
const api = isEdit ? postOneNETAccountModify : postOneNETAccountInsert;
const api = isEdit ? postOneNetAccountModifyAsync : postOneNetAccountInsertAsync;
const { valid } = await formApi.validate();
if (!valid) return;
const formValues = await formApi.getValues();
const fetchParams: any = isEdit
? {
id: editRow.value.id,
...formValues,
password: formValues.password || '000000',
}
id: editRow.value.id,
...formValues,
password: formValues.password || '000000',
}
: {
...formValues,
password: formValues.password || '000000',
};
...formValues,
password: formValues.password || '000000',
};
try {
userModalApi.setState({ loading: true, confirmLoading: true });
@ -172,7 +172,7 @@ async function onDel(record: any) {
}
try {
const resp = await postOneNETAccountDelete({ body: { id: record.id } });
const resp = await postOneNetAccountDeleteAsync({ body: { id: record.id } });
if (resp.data) {
Message.success($t('common.deleteSuccess'));
gridApi.reload();
@ -189,27 +189,31 @@ async function onDel(record: any) {
<Page auto-content-height>
<Grid>
<template #toolbar-actions>
<TableAction :actions="[
{
label: $t('common.add'),
type: 'primary',
icon: 'ant-design:plus-outlined',
onClick: openAddModal.bind(null),
auth: ['AbpIdentity.Users.Create'],
},
]" />
<TableAction
:actions="[
{
label: $t('common.add'),
type: 'primary',
icon: 'ant-design:plus-outlined',
onClick: openAddModal.bind(null),
auth: ['AbpIdentity.Users.Create'],
},
]"
/>
</template>
<template #action="{ row }">
<TableAction :actions="[
{
label: $t('common.edit'),
type: 'link',
size: 'small',
auth: ['AbpIdentity.Users.Update'],
onClick: onEdit.bind(null, row),
},
]" :drop-down-actions="[
<TableAction
:actions="[
{
label: $t('common.edit'),
type: 'link',
size: 'small',
auth: ['AbpIdentity.Users.Update'],
onClick: onEdit.bind(null, row),
},
]"
:drop-down-actions="[
{
label: $t('common.delete'),
icon: 'ant-design:delete-outlined',
@ -224,10 +228,14 @@ async function onDel(record: any) {
confirm: onDel.bind(null, row),
},
},
]" />
]"
/>
</template>
</Grid>
<UserModal :title="editRow.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.id ? EditForm : AddForm" />
</UserModal>
</Page>

View File

@ -12,10 +12,10 @@ import { message as Message, Modal, Tag } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import {
postMetersCreate,
postMetersDelete,
postMetersPage,
postMetersUpdate,
postOneNetProductInsertAsync,
postOneNetProductDeleteAsync,
postOneNetProductListAsync,
postOneNetProductModifyAsync,
} from '#/api-client';
import { TableAction } from '#/components/table-action';
import { $t } from '#/locales';
@ -55,7 +55,7 @@ const gridOptions: VxeGridProps<any> = {
proxyConfig: {
ajax: {
query: async ({ page }, formValues) => {
const { data } = await postMetersPage({
const { data } = await postOneNetProductListAsync({
body: {
pageIndex: page.currentPage,
pageSize: page.pageSize,
@ -119,7 +119,7 @@ const [EditForm, editFormApi] = useVbenForm({
async function submit() {
const isEdit = !!editRow.value.id;
const formApi = isEdit ? editFormApi : addFormApi;
const api = isEdit ? postMetersUpdate : postMetersCreate;
const api = isEdit ? postOneNetProductModifyAsync : postOneNetProductInsertAsync;
const { valid } = await formApi.validate();
if (!valid) return;
@ -164,7 +164,7 @@ function onDel(row: any) {
Modal.confirm({
title: `${$t('common.confirmDelete')}${row.meterName} ?`,
onOk: async () => {
const result = await postMetersDelete({ body: { id: row.id } });
const result = await postOneNetProductDeleteAsync({ body: { id: row.id } });
if (result) {
gridApi.reload();
Message.success($t('common.deleteSuccess'));