Compare commits

..

No commits in common. "b4b7eac73c4121843d4890062eae2794a6815da6" and "7029e3777ecde40ea97ade0fa9c5a361b29ab35e" have entirely different histories.

10 changed files with 98 additions and 122 deletions

View File

@ -24,15 +24,15 @@ import type {
IoTDBTreeModelDeviceDataPageAllResponse,
IoTDBTreeModelDeviceDataPageDataInput,
IoTErrorResponse,
OneNetAccountDeleteInput,
OneNETAccountDeleteResponse,
OneNetAccountInsertInput,
OneNetAccountInsertResponse,
OneNetAccountModifyInput,
OneNetAccountModifyResponse,
OneNETAccountCreateInput,
OneNETAccountCreateInput,
OneNETAccountCreateResponse,
OneNETAccountCreateResponse,
OneNETAccountPageListInput,
OneNETAccountPageListResult,
OneNETProductCreateInput,
OneNETProductCreateInput,
OneNETProductCreateResponse,
OneNETProductCreateResponse,
OneNETProductPageListInput,
OneNETProductPageListResult,
@ -3148,6 +3148,7 @@ export const postOneNETAccountInfoPage = <ThrowOnError extends boolean = false>(
ThrowOnError
>({
...options,
...formDataBodySerializer,
url: '/OneNETAccount/ListAsync',
});
};
@ -3155,51 +3156,20 @@ export const postOneNETAccountInfoPage = <ThrowOnError extends boolean = false>(
/**
* OneNET
*/
export const postOneNETAccountInsert = <ThrowOnError extends boolean = false>(
options?: Options<OneNetAccountInsertInput, ThrowOnError>,
export const postOneNETAccountCreate = <ThrowOnError extends boolean = false>(
options?: Options<OneNETAccountCreateInput, ThrowOnError>,
) => {
return (options?.client ?? client).post<
OneNetAccountInsertResponse,
OneNETAccountCreateResponse,
IoTErrorResponse,
ThrowOnError
>({
...options,
...formDataBodySerializer,
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
*/

View File

@ -5178,25 +5178,10 @@ export type OneNETAccountPageListResult = {
totalCount?: number;
};
export type OneNetAccountInsertInput = {
export type OneNETAccountCreateInput = {
body?: OneNETAccountDto;
};
export type OneNetAccountInsertResponse = {
body?: OneNETAccountDto;
};
export type OneNetAccountModifyInput = {
body?: OneNETAccountDto;
};
export type OneNetAccountModifyResponse = {
body?: OneNETAccountDto;
};
export type OneNetAccountDeleteInput = {
body?: IdInput;
};
export type OneNETAccountDeleteResponse = {
export type OneNETAccountCreateResponse = {
body?: OneNETAccountDto;
};

View File

@ -52,6 +52,5 @@
"exporting": "Exporting data...",
"exportSuccess": "Data exported successfully",
"exportFailed": "Data export failed",
"getDataFailed": "Failed to get data",
"PhoneNumberFormatError": "PhoneNumber Format Error"
"getDataFailed": "Failed to get data"
}

View File

@ -263,7 +263,7 @@
"DeviceLastActiveTime": "设备最后活跃时间"
},
"OneNETManagement": {
"AccountName": "账号名称",
"AccountName": "账号名称",
"PhoneNumber": "手机号码",
"AccountAccesskey": "账户通信密钥",
"ProductCount": "产品数量",

View File

@ -53,6 +53,5 @@
"exportSuccess": "数据导出成功",
"exportFailed": "数据导出失败",
"getDataFailed": "获取数据失败",
"IsEnabled": "是否启用",
"PhoneNumberFormatError": "手机号码格式错误"
"IsEnabled": "是否启用"
}

View File

@ -12,6 +12,7 @@ import { message as Message, Modal, Tag } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import {
postMetersArchivesDown,
postMetersCreate,
postMetersDelete,
postMetersPage,
@ -185,6 +186,22 @@ const toStatusData = (row: Record<string, any>) => {
},
});
};
//
const archivesIssued = async (row: Record<string, any>) => {
const result = await postMetersArchivesDown({
body: {
meterAddress: row.meterAddress,
meterType: row.meterType,
focusAddress: row.focusAddress,
},
});
if (result) {
gridApi.reload();
Message.success($t('common.success'));
} else {
Message.error($t('common.error'));
}
};
const openAddModal = async () => {
editRow.value = {};
userModalApi.open();

View File

@ -12,6 +12,7 @@ import { message as Message, Modal, Tag } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import {
postMetersArchivesDown,
postMetersCreate,
postMetersDelete,
postMetersPage,
@ -185,7 +186,22 @@ const toStatusData = (row: Record<string, any>) => {
},
});
};
//
const archivesIssued = async (row: Record<string, any>) => {
const result = await postMetersArchivesDown({
body: {
meterAddress: row.meterAddress,
meterType: row.meterType,
focusAddress: row.focusAddress,
},
});
if (result) {
gridApi.reload();
Message.success($t('common.success'));
} else {
Message.error($t('common.error'));
}
};
const openAddModal = async () => {
editRow.value = {};
userModalApi.open();

View File

@ -12,10 +12,8 @@ import { message as Message } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import {
postOneNETAccountDelete,
postOneNETAccountCreate,
postOneNETAccountInfoPage,
postOneNETAccountInsert,
postOneNETAccountModify,
} from '#/api-client';
import { TableAction } from '#/components/table-action';
import { $t } from '#/locales';
@ -73,7 +71,7 @@ const [UserModal, userModalApi] = useVbenModal({
draggable: true,
onConfirm: submit,
onBeforeClose: () => {
//
editRow.value = {};
return true;
},
});
@ -117,7 +115,7 @@ const [EditForm, editFormApi] = useVbenForm({
async function submit() {
const isEdit = !!editRow.value.id;
const formApi = isEdit ? editFormApi : addFormApi;
const api = isEdit ? postOneNETAccountModify : postOneNETAccountInsert;
const api = postOneNETAccountCreate;
const { valid } = await formApi.validate();
if (!valid) return;
@ -141,7 +139,6 @@ async function submit() {
editRow.value.id ? $t('common.editSuccess') : $t('common.addSuccess'),
);
userModalApi.close();
editRow.value = {};
gridApi.reload();
} else {
Message.error(
@ -163,26 +160,6 @@ const openAddModal = async () => {
editRow.value = {};
userModalApi.open();
};
//
async function onDel(record: any) {
if (record.productCount > 0) {
Message.warning($t('abp.OneNETManagement.CannotDeleteAccountWithProducts'));
return;
}
try {
const resp = await postOneNETAccountDelete({ body: { id: record.id } });
if (resp.data) {
Message.success($t('common.deleteSuccess'));
gridApi.reload();
} else {
Message.error($t('common.deleteFail'));
}
} catch {
Message.error($t('common.deleteFail'));
}
}
</script>
<template>
@ -215,15 +192,25 @@ async function onDel(record: any) {
icon: 'ant-design:delete-outlined',
type: 'primary',
auth: ['AbpIdentity.Users.Delete'],
disabled: row.productCount > 0,
popConfirm: {
title:
row.productCount > 0
? $t('abp.OneNETManagement.CannotDeleteAccountWithProducts')
: $t('common.askConfirmDelete'),
title: $t('common.askConfirmDelete'),
confirm: onDel.bind(null, row),
},
},
{
label: $t('abp.Account.pointData'),
icon: 'ant-design:profile-outlined',
type: 'primary',
auth: ['AbpIdentity.Users.Delete'],
onClick: toStatusData.bind(null, row),
},
{
label: $t('abp.Account.archivesIssued'),
icon: 'ant-design:cloud-download-outlined',
type: 'primary',
auth: ['AbpIdentity.Users.Delete'],
onClick: archivesIssued.bind(null, row),
},
]" />
</template>
</Grid>

View File

@ -32,7 +32,7 @@ export const tableSchema: any = computed((): VxeGridProps['columns'] => [
minWidth: '150',
},
{
field: 'accountAccesskey',
field: 'accesskey',
title: $t('abp.OneNETManagement.AccountAccesskey'),
minWidth: '150',
},
@ -53,7 +53,7 @@ export const tableSchema: any = computed((): VxeGridProps['columns'] => [
export const addAccountFormSchema: any = computed(() => [
{
component: 'Input',
fieldName: 'oneNETAccountId',
fieldName: 'OneNETAccountId',
label: $t('abp.OneNETManagement.OneNETAccountId'),
rules: z.string().min(1, {
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.OneNETManagement.OneNETAccountId')}`,
@ -82,10 +82,10 @@ export const addAccountFormSchema: any = computed(() => [
rules: z
.string()
.min(1, {
message: `${$t('common.pleaseInput')}${$t('abp.OneNETManagement.PhoneNumber')}`,
message: `${$t('common.pleaseInput')}${$t('common.numberType')}${$t('abp.OneNETManagement.PhoneNumber')}`,
})
.refine((value) => /^1[3-9]\d{9}$/.test(value), {
message: $t('common.PhoneNumberFormatError'),
.refine((value) => /^\d+$/.test(value), {
message: $t('abp.OneNETManagement.PhoneNumber'),
}),
},
]);
@ -93,37 +93,23 @@ export const addAccountFormSchema: any = computed(() => [
export const editAccountFormSchemaEdit: any = computed(() => [
{
component: 'Input',
fieldName: 'oneNETAccountId',
label: $t('abp.OneNETManagement.OneNETAccountId'),
disabled: true,
},
{
component: 'Input',
fieldName: 'accountName',
label: $t('abp.OneNETManagement.AccountName'),
fieldName: 'meterName',
label: $t('abp.meters.meterName'),
rules: z.string().min(1, {
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.OneNETManagement.AccountName')}`,
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.meters.meterName')}`,
}),
},
{
component: 'Input',
fieldName: 'accountAccesskey',
label: $t('abp.OneNETManagement.AccountAccesskey'),
rules: z.string().min(1, {
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.OneNETManagement.AccountAccesskey')}`,
}),
},
{
component: 'Input',
fieldName: 'phoneNumber',
label: $t('abp.OneNETManagement.PhoneNumber'),
fieldName: 'meterAddress',
label: $t('abp.meters.meterAddress'),
rules: z
.string()
.min(1, {
message: `${$t('common.pleaseInput')}${$t('abp.OneNETManagement.PhoneNumber')}`,
message: `${$t('common.pleaseInput')}${$t('common.numberType')}${$t('abp.meters.meterAddress')}`,
})
.refine((value) => /^1[3-9]\d{9}$/.test(value), {
message: $t('common.PhoneNumberFormatError'),
.refine((value) => /^\d+$/.test(value), {
message: $t('abp.meters.checkmeterAddress'),
}),
},
]);

View File

@ -12,6 +12,7 @@ import { message as Message, Modal, Tag } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import {
postMetersArchivesDown,
postMetersCreate,
postMetersDelete,
postMetersPage,
@ -185,6 +186,22 @@ const toStatusData = (row: Record<string, any>) => {
},
});
};
//
const archivesIssued = async (row: Record<string, any>) => {
const result = await postMetersArchivesDown({
body: {
meterAddress: row.meterAddress,
meterType: row.meterType,
focusAddress: row.focusAddress,
},
});
if (result) {
gridApi.reload();
Message.success($t('common.success'));
} else {
Message.error($t('common.error'));
}
};
const openAddModal = async () => {
editRow.value = {};
userModalApi.open();