OneNET产品管理完善
This commit is contained in:
parent
0a1bffe8f8
commit
d88c93bdfb
@ -1304,7 +1304,7 @@ export const DeviceTableModelDataInfoPageInputSchema = {
|
||||
export const DeviceTableModelDataInfoPageOutputSchema = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
dataBaseName: {
|
||||
systemName: {
|
||||
type: 'string',
|
||||
description: '系统名称',
|
||||
nullable: true
|
||||
@ -8383,4 +8383,4 @@ export const WindowsTimeZoneSchema = {
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
} as const;
|
||||
} as const;
|
||||
File diff suppressed because one or more lines are too long
@ -617,7 +617,7 @@ export type DeviceTableModelDataInfoPageOutput = {
|
||||
/**
|
||||
* 系统名称
|
||||
*/
|
||||
dataBaseName?: (string) | null;
|
||||
systemName?: (string) | null;
|
||||
/**
|
||||
* 数据类型
|
||||
*/
|
||||
@ -4840,6 +4840,16 @@ export type PostOneNetProductModifyAsyncResponse = (OneNETProductInfoDto);
|
||||
|
||||
export type PostOneNetProductModifyAsyncError = unknown;
|
||||
|
||||
export type PostOneNetProductDeleteAsyncData = {
|
||||
query?: {
|
||||
input?: IdInput;
|
||||
};
|
||||
};
|
||||
|
||||
export type PostOneNetProductDeleteAsyncResponse = (OneNETProductInfoDto);
|
||||
|
||||
export type PostOneNetProductDeleteAsyncError = unknown;
|
||||
|
||||
export type PostOneNetProductGetAsyncData = {
|
||||
query?: {
|
||||
input?: IdInput;
|
||||
@ -5374,4 +5384,4 @@ export type PostUsersResetTwoFactorError = (RemoteServiceErrorResponse);
|
||||
|
||||
export type PostUsersNeedChangePasswordResponse = (NeedChangePasswordOutput);
|
||||
|
||||
export type PostUsersNeedChangePasswordError = (RemoteServiceErrorResponse);
|
||||
export type PostUsersNeedChangePasswordError = (RemoteServiceErrorResponse);
|
||||
@ -267,6 +267,9 @@
|
||||
"AccountAccesskey": "AccountAccesskey",
|
||||
"ProductCount": "ProductCount",
|
||||
"OneNETAccountId": "OneNETAccountId",
|
||||
"OneNETProductId": "OneNETProductId",
|
||||
"ProductKey": "ProductKey",
|
||||
"ProductSecret": "ProductSecret",
|
||||
"IoTPlatformProductId": "IoTPlatformProductId",
|
||||
"ProductName": "ProductName",
|
||||
"ProductAccesskey": "ProductAccesskey",
|
||||
|
||||
@ -269,6 +269,9 @@
|
||||
"AccountAccesskey": "账户通信密钥",
|
||||
"ProductCount": "产品数量",
|
||||
"OneNETAccountId": "OneNET账户Id",
|
||||
"OneNETProductId": "OneNET产品Id",
|
||||
"ProductKey": "产品密钥",
|
||||
"ProductSecret": "产品密钥",
|
||||
"IoTPlatformProductId": "物联网平台对应的产品Id",
|
||||
"ProductName": "产品名称",
|
||||
"ProductAccesskey": "产品访问密钥",
|
||||
|
||||
@ -7,7 +7,7 @@ import { useRouter } from 'vue-router';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { message as Message, Modal, Tag } from 'ant-design-vue';
|
||||
import { message as Message, Tag } from 'ant-design-vue';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
@ -21,16 +21,14 @@ import { TableAction } from '#/components/table-action';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import {
|
||||
addUserFormSchema,
|
||||
editUserFormSchemaEdit,
|
||||
meterTypeOptions,
|
||||
addProductFormSchema,
|
||||
editProductFormSchemaEdit,
|
||||
querySchema,
|
||||
rateOptions,
|
||||
tableSchema,
|
||||
} from './schema';
|
||||
|
||||
defineOptions({
|
||||
name: 'AbpUser',
|
||||
name: 'OneNETProduct',
|
||||
});
|
||||
|
||||
const router = useRouter();
|
||||
@ -75,7 +73,7 @@ const [UserModal, userModalApi] = useVbenModal({
|
||||
draggable: true,
|
||||
onConfirm: submit,
|
||||
onBeforeClose: () => {
|
||||
editRow.value = {};
|
||||
// 只在确认提交后重置,而不是每次关闭都重置
|
||||
return true;
|
||||
},
|
||||
});
|
||||
@ -91,7 +89,7 @@ const [AddForm, addFormApi] = useVbenForm({
|
||||
},
|
||||
},
|
||||
layout: 'horizontal',
|
||||
schema: addUserFormSchema.value,
|
||||
schema: addProductFormSchema.value,
|
||||
showCollapseButton: false,
|
||||
showDefaultActions: false,
|
||||
wrapperClass: 'grid-cols-2',
|
||||
@ -109,7 +107,7 @@ const [EditForm, editFormApi] = useVbenForm({
|
||||
},
|
||||
// 提交函数
|
||||
layout: 'horizontal',
|
||||
schema: editUserFormSchemaEdit.value,
|
||||
schema: editProductFormSchemaEdit.value,
|
||||
showCollapseButton: false,
|
||||
showDefaultActions: false,
|
||||
wrapperClass: 'grid-cols-2',
|
||||
@ -119,7 +117,7 @@ const [EditForm, editFormApi] = useVbenForm({
|
||||
async function submit() {
|
||||
const isEdit = !!editRow.value.id;
|
||||
const formApi = isEdit ? editFormApi : addFormApi;
|
||||
const api = isEdit ? postOneNetProductModifyAsync : postOneNetProductInsertAsync;
|
||||
const api = isEdit ? postOneNetProductModifyAsync : postOneNetProductInsertAsync;
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) return;
|
||||
|
||||
@ -128,11 +126,9 @@ async function submit() {
|
||||
? {
|
||||
id: editRow.value.id,
|
||||
...formValues,
|
||||
password: formValues.password || '000000',
|
||||
}
|
||||
: {
|
||||
...formValues,
|
||||
password: formValues.password || '000000',
|
||||
};
|
||||
|
||||
try {
|
||||
@ -143,6 +139,7 @@ async function submit() {
|
||||
editRow.value.id ? $t('common.editSuccess') : $t('common.addSuccess'),
|
||||
);
|
||||
userModalApi.close();
|
||||
editRow.value = {};
|
||||
gridApi.reload();
|
||||
} else {
|
||||
Message.error(
|
||||
@ -160,35 +157,25 @@ async function onEdit(record: any) {
|
||||
editFormApi.setValues({ ...record });
|
||||
}
|
||||
|
||||
function onDel(row: any) {
|
||||
Modal.confirm({
|
||||
title: `${$t('common.confirmDelete')}${row.meterName} ?`,
|
||||
onOk: async () => {
|
||||
const result = await postOneNetProductDeleteAsync({ body: { id: row.id } });
|
||||
if (result) {
|
||||
gridApi.reload();
|
||||
Message.success($t('common.deleteSuccess'));
|
||||
} else {
|
||||
Message.error($t('common.deleteFail'));
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
const toStatusData = (row: Record<string, any>) => {
|
||||
// 或者使用编程式导航
|
||||
router.push({
|
||||
path: '/iotdb/point',
|
||||
query: {
|
||||
DeviceType: row.meterType,
|
||||
DeviceId: row.meterId,
|
||||
FocusAddress: row.focusAddress,
|
||||
},
|
||||
});
|
||||
};
|
||||
const openAddModal = async () => {
|
||||
editRow.value = {};
|
||||
userModalApi.open();
|
||||
};
|
||||
|
||||
// 删除函数
|
||||
async function onDel(record: any) {
|
||||
try {
|
||||
const resp = await postOneNetProductDeleteAsync({ 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>
|
||||
@ -208,47 +195,6 @@ const openAddModal = async () => {
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template #isMeterType="{ row }">
|
||||
{{ meterTypeOptions[row.meterType - 1]?.label }}
|
||||
</template>
|
||||
<template #isSingleRate="{ row }">
|
||||
{{ rateOptions.find((item) => item.value === row.singleRate)?.label }}
|
||||
</template>
|
||||
<template #isArchiveStatus="{ row }">
|
||||
{{
|
||||
row.archiveStatus ? $t('common.Issued') : $t('common.Undistributed')
|
||||
}}
|
||||
</template>
|
||||
<template #isTripState="{ row }">
|
||||
{{ row.tripState ? $t('common.SwitchOff') : $t('common.Closing') }}
|
||||
</template>
|
||||
<template #isHaveValve="{ row }">
|
||||
<component
|
||||
:is="
|
||||
h(Tag, { color: row.haveValve ? 'green' : 'red' }, () =>
|
||||
row.haveValve ? $t('common.yes') : $t('common.no'),
|
||||
)
|
||||
"
|
||||
/>
|
||||
</template>
|
||||
<template #isSelfDevelop="{ row }">
|
||||
<component
|
||||
:is="
|
||||
h(Tag, { color: row.selfDevelop ? 'green' : 'red' }, () =>
|
||||
row.selfDevelop ? $t('common.yes') : $t('common.no'),
|
||||
)
|
||||
"
|
||||
/>
|
||||
</template>
|
||||
<template #isDynamicPassword="{ row }">
|
||||
<component
|
||||
:is="
|
||||
h(Tag, { color: row.dynamicPassword ? 'green' : 'red' }, () =>
|
||||
row.dynamicPassword ? $t('common.yes') : $t('common.no'),
|
||||
)
|
||||
"
|
||||
/>
|
||||
</template>
|
||||
<template #isEnable="{ row }">
|
||||
<component
|
||||
:is="
|
||||
@ -281,20 +227,6 @@ const openAddModal = async () => {
|
||||
confirm: onDel.bind(null, row),
|
||||
},
|
||||
},
|
||||
{
|
||||
label: $t('abp.meters.pointData'),
|
||||
icon: 'ant-design:profile-outlined',
|
||||
type: 'primary',
|
||||
auth: ['AbpIdentity.Users.Delete'],
|
||||
onClick: toStatusData.bind(null, row),
|
||||
},
|
||||
{
|
||||
label: $t('abp.meters.archivesIssued'),
|
||||
icon: 'ant-design:cloud-download-outlined',
|
||||
type: 'primary',
|
||||
auth: ['AbpIdentity.Users.Delete'],
|
||||
onClick: archivesIssued.bind(null, row),
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
|
||||
@ -9,103 +9,37 @@ import { $t } from '#/locales';
|
||||
export const querySchema = computed(() => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'meterAddress',
|
||||
label: $t('abp.meters.meterAddress'),
|
||||
fieldName: 'productName',
|
||||
label: $t('abp.OneNETManagement.ProductName'),
|
||||
},
|
||||
]);
|
||||
export const meterTypeOptions = [
|
||||
{
|
||||
label: $t('abp.meters.ElectricityMeter'),
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: $t('abp.meters.waterMeter'),
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
label: $t('abp.meters.GasMeter'),
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
label: $t('abp.meters.HeatMeter'),
|
||||
value: 4,
|
||||
},
|
||||
{
|
||||
label: $t('abp.meters.WaterMeterFlowmeter'),
|
||||
value: 5,
|
||||
},
|
||||
{
|
||||
label: $t('abp.meters.GasMeterFlowmeter'),
|
||||
value: 6,
|
||||
},
|
||||
];
|
||||
export const rateOptions = [
|
||||
{
|
||||
label: $t('abp.meters.MultipleRate'),
|
||||
value: false,
|
||||
},
|
||||
{
|
||||
label: $t('abp.meters.SingleRate'),
|
||||
value: true,
|
||||
},
|
||||
];
|
||||
|
||||
export const tableSchema: any = computed((): VxeGridProps['columns'] => [
|
||||
{ title: $t('common.seq'), type: 'seq', width: 50 },
|
||||
{ field: 'meterName', title: $t('abp.meters.meterName'), minWidth: '150' },
|
||||
{
|
||||
field: 'meterAddress',
|
||||
title: $t('abp.meters.meterAddress'),
|
||||
field: 'oneNETProductId',
|
||||
title: $t('abp.OneNETManagement.OneNETProductId'),
|
||||
minWidth: '150',
|
||||
},
|
||||
{
|
||||
field: 'meterType',
|
||||
title: $t('abp.meters.meterType'),
|
||||
field: 'productName',
|
||||
title: $t('abp.OneNETManagement.ProductName'),
|
||||
minWidth: '150',
|
||||
slots: { default: 'isMeterType' },
|
||||
},
|
||||
{
|
||||
field: 'dynamicPassword',
|
||||
title: $t('abp.meters.dynamicPassword'),
|
||||
field: 'productKey',
|
||||
title: $t('abp.OneNETManagement.ProductKey'),
|
||||
minWidth: '150',
|
||||
slots: { default: 'isDynamicPassword' },
|
||||
},
|
||||
{
|
||||
field: 'password',
|
||||
title: $t('abp.meters.password'),
|
||||
minWidth: '100',
|
||||
field: 'productSecret',
|
||||
title: $t('abp.OneNETManagement.ProductSecret'),
|
||||
minWidth: '150',
|
||||
},
|
||||
{
|
||||
field: 'singleRate',
|
||||
title: $t('abp.meters.singleRate'),
|
||||
field: 'accountName',
|
||||
title: $t('abp.OneNETManagement.AccountName'),
|
||||
minWidth: '150',
|
||||
slots: { default: 'isSingleRate' },
|
||||
},
|
||||
{
|
||||
field: 'selfDevelop',
|
||||
title: $t('abp.meters.selfDevelop'),
|
||||
minWidth: '150',
|
||||
slots: { default: 'isSelfDevelop' },
|
||||
},
|
||||
{ field: 'brandType', title: $t('abp.meters.brandType'), minWidth: '150' },
|
||||
{
|
||||
field: 'archiveStatus',
|
||||
title: $t('abp.meters.archiveStatus'),
|
||||
minWidth: '150',
|
||||
slots: { default: 'isArchiveStatus' },
|
||||
},
|
||||
{
|
||||
field: 'tripState',
|
||||
title: $t('abp.meters.tripState'),
|
||||
minWidth: '150',
|
||||
slots: { default: 'isTripState' },
|
||||
},
|
||||
{ field: 'timesA', title: $t('abp.meters.timesA'), minWidth: '100' },
|
||||
{ field: 'timev', title: $t('abp.meters.timev'), minWidth: '100' },
|
||||
{
|
||||
field: 'haveValve',
|
||||
title: $t('abp.meters.haveValve'),
|
||||
minWidth: '150',
|
||||
slots: { default: 'isHaveValve' },
|
||||
},
|
||||
{
|
||||
field: 'enabled',
|
||||
@ -122,321 +56,102 @@ export const tableSchema: any = computed((): VxeGridProps['columns'] => [
|
||||
},
|
||||
]);
|
||||
|
||||
export const addUserFormSchema: any = computed(() => [
|
||||
export const addProductFormSchema: any = computed(() => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'meterName',
|
||||
label: $t('abp.meters.meterName'),
|
||||
fieldName: 'oneNETProductId',
|
||||
label: $t('abp.OneNETManagement.OneNETProductId'),
|
||||
rules: z.string().min(1, {
|
||||
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.meters.meterName')}`,
|
||||
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.OneNETManagement.OneNETProductId')}`,
|
||||
}),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'meterAddress',
|
||||
label: $t('abp.meters.meterAddress'),
|
||||
rules: z
|
||||
.string()
|
||||
.min(1, {
|
||||
message: `${$t('common.pleaseInput')}${$t('common.numberType')}${$t('abp.meters.meterAddress')}`,
|
||||
})
|
||||
.refine((value) => /^\d+$/.test(value), {
|
||||
message: $t('abp.meters.checkmeterAddress'),
|
||||
}),
|
||||
fieldName: 'productName',
|
||||
label: $t('abp.OneNETManagement.ProductName'),
|
||||
rules: z.string().min(1, {
|
||||
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.OneNETManagement.ProductName')}`,
|
||||
}),
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
options: meterTypeOptions,
|
||||
placeholder: `${$t('common.pleaseSelect')}${$t('abp.meters.meterType')}`,
|
||||
},
|
||||
fieldName: 'meterType',
|
||||
label: $t('abp.meters.meterType'),
|
||||
rules: z
|
||||
.number()
|
||||
.min(1, {
|
||||
message: `${$t('common.pleaseSelect')}${$t('abp.meters.meterType')}`,
|
||||
})
|
||||
.default(1),
|
||||
component: 'Input',
|
||||
fieldName: 'productKey',
|
||||
label: $t('abp.OneNETManagement.ProductKey'),
|
||||
rules: z.string().min(1, {
|
||||
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.OneNETManagement.ProductKey')}`,
|
||||
}),
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
options: rateOptions,
|
||||
placeholder: `${$t('common.pleaseSelect')}${$t('abp.meters.singleRate')}`,
|
||||
},
|
||||
dependencies: {
|
||||
show(values: any) {
|
||||
return values.meterType === 1;
|
||||
},
|
||||
rules(values: any) {
|
||||
if (values.meterType === 1) {
|
||||
return 'required';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
triggerFields: ['meterType'],
|
||||
},
|
||||
fieldName: 'singleRate',
|
||||
label: $t('abp.meters.singleRate'),
|
||||
component: 'Input',
|
||||
fieldName: 'productSecret',
|
||||
label: $t('abp.OneNETManagement.ProductSecret'),
|
||||
rules: z.string().min(1, {
|
||||
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.OneNETManagement.ProductSecret')}`,
|
||||
}),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'accountName',
|
||||
label: $t('abp.OneNETManagement.AccountName'),
|
||||
rules: z.string().min(1, {
|
||||
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.OneNETManagement.AccountName')}`,
|
||||
}),
|
||||
},
|
||||
{
|
||||
component: 'Switch',
|
||||
componentProps: {
|
||||
class: 'w-auto',
|
||||
},
|
||||
fieldName: 'selfDevelop',
|
||||
label: $t('abp.meters.selfDevelop'),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'brandType',
|
||||
label: $t('abp.meters.brandType'),
|
||||
rules: z.string().optional(),
|
||||
},
|
||||
{
|
||||
component: 'Switch',
|
||||
componentProps: {
|
||||
class: 'w-auto',
|
||||
},
|
||||
fieldName: 'dynamicPassword',
|
||||
label: $t('abp.meters.dynamicPassword'),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'password',
|
||||
label: $t('abp.meters.password'),
|
||||
rules: z.string().optional(),
|
||||
},
|
||||
{
|
||||
component: 'Switch',
|
||||
componentProps: {
|
||||
class: 'w-auto',
|
||||
},
|
||||
dependencies: {
|
||||
show(values: any) {
|
||||
return values.meterType === 2;
|
||||
},
|
||||
triggerFields: ['meterType'],
|
||||
},
|
||||
fieldName: 'haveValve',
|
||||
label: $t('abp.meters.haveValve'),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'timesA',
|
||||
label: $t('abp.meters.timesA'),
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: `${$t('common.pleaseInput')}${$t('abp.meters.timesA')}`,
|
||||
},
|
||||
dependencies: {
|
||||
show(values: any) {
|
||||
return values.meterType === 1;
|
||||
},
|
||||
triggerFields: ['meterType'],
|
||||
},
|
||||
rules: z
|
||||
.string({
|
||||
message: `${$t('common.pleaseInput')}${$t('abp.meters.timesA')}`,
|
||||
})
|
||||
.default('1'),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'timev',
|
||||
label: $t('abp.meters.timev'),
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: `${$t('common.pleaseInput')}${$t('abp.meters.timev')}`,
|
||||
},
|
||||
dependencies: {
|
||||
show(values: any) {
|
||||
return values.meterType === 1;
|
||||
},
|
||||
triggerFields: ['meterType'],
|
||||
},
|
||||
rules: z
|
||||
.string({
|
||||
message: `${$t('common.pleaseInput')}${$t('abp.meters.timesA')}`,
|
||||
})
|
||||
.default('1'),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'meteringCode',
|
||||
label: $t('abp.meters.meteringCode'),
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: `${$t('common.pleaseInput')}${$t('abp.meters.meteringCode')}`,
|
||||
},
|
||||
rules: z
|
||||
.string({
|
||||
message: `${$t('common.pleaseInput')}${$t('abp.meters.meteringCode')}`,
|
||||
})
|
||||
.default('1'),
|
||||
fieldName: 'enabled',
|
||||
label: $t('common.isEnable'),
|
||||
},
|
||||
]);
|
||||
|
||||
export const editUserFormSchemaEdit: any = computed(() => [
|
||||
export const editProductFormSchemaEdit: any = computed(() => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'meterName',
|
||||
label: $t('abp.meters.meterName'),
|
||||
fieldName: 'oneNETProductId',
|
||||
label: $t('abp.OneNETManagement.OneNETProductId'),
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'productName',
|
||||
label: $t('abp.OneNETManagement.ProductName'),
|
||||
rules: z.string().min(1, {
|
||||
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.meters.meterName')}`,
|
||||
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.OneNETManagement.ProductName')}`,
|
||||
}),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'meterAddress',
|
||||
label: $t('abp.meters.meterAddress'),
|
||||
rules: z
|
||||
.string()
|
||||
.min(1, {
|
||||
message: `${$t('common.pleaseInput')}${$t('common.numberType')}${$t('abp.meters.meterAddress')}`,
|
||||
})
|
||||
.refine((value) => /^\d+$/.test(value), {
|
||||
message: $t('abp.meters.checkmeterAddress'),
|
||||
}),
|
||||
fieldName: 'productKey',
|
||||
label: $t('abp.OneNETManagement.ProductKey'),
|
||||
rules: z.string().min(1, {
|
||||
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.OneNETManagement.ProductKey')}`,
|
||||
}),
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
options: meterTypeOptions,
|
||||
placeholder: `${$t('common.pleaseSelect')}${$t('abp.meters.meterType')}`,
|
||||
},
|
||||
fieldName: 'meterType',
|
||||
label: $t('abp.meters.meterType'),
|
||||
rules: z
|
||||
.number()
|
||||
.min(1, {
|
||||
message: `${$t('common.pleaseSelect')}${$t('abp.meters.meterType')}`,
|
||||
})
|
||||
.default(1),
|
||||
component: 'Input',
|
||||
fieldName: 'productSecret',
|
||||
label: $t('abp.OneNETManagement.ProductSecret'),
|
||||
rules: z.string().min(1, {
|
||||
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.OneNETManagement.ProductSecret')}`,
|
||||
}),
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
options: rateOptions,
|
||||
placeholder: `${$t('common.pleaseSelect')}${$t('abp.meters.singleRate')}`,
|
||||
},
|
||||
dependencies: {
|
||||
show(values: any) {
|
||||
return values.meterType === 1;
|
||||
},
|
||||
rules(values: any) {
|
||||
if (values.meterType === 1) {
|
||||
return 'required';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
triggerFields: ['meterType'],
|
||||
},
|
||||
fieldName: 'singleRate',
|
||||
label: $t('abp.meters.singleRate'),
|
||||
component: 'Input',
|
||||
fieldName: 'accountName',
|
||||
label: $t('abp.OneNETManagement.AccountName'),
|
||||
rules: z.string().min(1, {
|
||||
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.OneNETManagement.AccountName')}`,
|
||||
}),
|
||||
},
|
||||
{
|
||||
component: 'Switch',
|
||||
componentProps: {
|
||||
class: 'w-auto',
|
||||
},
|
||||
fieldName: 'selfDevelop',
|
||||
label: $t('abp.meters.selfDevelop'),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'brandType',
|
||||
label: $t('abp.meters.brandType'),
|
||||
rules: z.string().optional(),
|
||||
},
|
||||
{
|
||||
component: 'Switch',
|
||||
componentProps: {
|
||||
class: 'w-auto',
|
||||
},
|
||||
fieldName: 'dynamicPassword',
|
||||
label: $t('abp.meters.dynamicPassword'),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'password',
|
||||
label: $t('abp.meters.password'),
|
||||
rules: z.string().optional(),
|
||||
},
|
||||
{
|
||||
component: 'Switch',
|
||||
componentProps: {
|
||||
class: 'w-auto',
|
||||
},
|
||||
dependencies: {
|
||||
show(values: any) {
|
||||
return values.meterType === 2;
|
||||
},
|
||||
triggerFields: ['meterType'],
|
||||
},
|
||||
fieldName: 'haveValve',
|
||||
label: $t('abp.meters.haveValve'),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'timesA',
|
||||
label: $t('abp.meters.timesA'),
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: `${$t('common.pleaseInput')}${$t('abp.meters.timesA')}`,
|
||||
},
|
||||
dependencies: {
|
||||
show(values: any) {
|
||||
return values.meterType === 1;
|
||||
},
|
||||
triggerFields: ['meterType'],
|
||||
},
|
||||
rules: z
|
||||
.string({
|
||||
message: `${$t('common.pleaseInput')}${$t('abp.meters.timesA')}`,
|
||||
})
|
||||
.default('1'),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'timev',
|
||||
label: $t('abp.meters.timev'),
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: `${$t('common.pleaseInput')}${$t('abp.meters.timev')}`,
|
||||
},
|
||||
dependencies: {
|
||||
show(values: any) {
|
||||
return values.meterType === 1;
|
||||
},
|
||||
triggerFields: ['meterType'],
|
||||
},
|
||||
rules: z
|
||||
.string({
|
||||
message: `${$t('common.pleaseInput')}${$t('abp.meters.timev')}`,
|
||||
})
|
||||
.default('1'),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'meteringCode',
|
||||
label: $t('abp.meters.meteringCode'),
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: `${$t('common.pleaseInput')}${$t('abp.meters.meteringCode')}`,
|
||||
},
|
||||
rules: z
|
||||
.string({
|
||||
message: `${$t('common.pleaseInput')}${$t('abp.meters.meteringCode')}`,
|
||||
})
|
||||
.min(1, {
|
||||
message: `${$t('common.MustGreaterTthan0')}`,
|
||||
})
|
||||
.default('1'),
|
||||
fieldName: 'enabled',
|
||||
label: $t('common.isEnable'),
|
||||
},
|
||||
]);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user