OneNET产品管理完善
This commit is contained in:
parent
0a1bffe8f8
commit
d88c93bdfb
@ -1304,7 +1304,7 @@ export const DeviceTableModelDataInfoPageInputSchema = {
|
|||||||
export const DeviceTableModelDataInfoPageOutputSchema = {
|
export const DeviceTableModelDataInfoPageOutputSchema = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
properties: {
|
properties: {
|
||||||
dataBaseName: {
|
systemName: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
description: '系统名称',
|
description: '系统名称',
|
||||||
nullable: true
|
nullable: true
|
||||||
|
|||||||
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 PostOneNetProductModifyAsyncError = unknown;
|
||||||
|
|
||||||
|
export type PostOneNetProductDeleteAsyncData = {
|
||||||
|
query?: {
|
||||||
|
input?: IdInput;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export type PostOneNetProductDeleteAsyncResponse = (OneNETProductInfoDto);
|
||||||
|
|
||||||
|
export type PostOneNetProductDeleteAsyncError = unknown;
|
||||||
|
|
||||||
export type PostOneNetProductGetAsyncData = {
|
export type PostOneNetProductGetAsyncData = {
|
||||||
query?: {
|
query?: {
|
||||||
input?: IdInput;
|
input?: IdInput;
|
||||||
|
|||||||
@ -267,6 +267,9 @@
|
|||||||
"AccountAccesskey": "AccountAccesskey",
|
"AccountAccesskey": "AccountAccesskey",
|
||||||
"ProductCount": "ProductCount",
|
"ProductCount": "ProductCount",
|
||||||
"OneNETAccountId": "OneNETAccountId",
|
"OneNETAccountId": "OneNETAccountId",
|
||||||
|
"OneNETProductId": "OneNETProductId",
|
||||||
|
"ProductKey": "ProductKey",
|
||||||
|
"ProductSecret": "ProductSecret",
|
||||||
"IoTPlatformProductId": "IoTPlatformProductId",
|
"IoTPlatformProductId": "IoTPlatformProductId",
|
||||||
"ProductName": "ProductName",
|
"ProductName": "ProductName",
|
||||||
"ProductAccesskey": "ProductAccesskey",
|
"ProductAccesskey": "ProductAccesskey",
|
||||||
|
|||||||
@ -269,6 +269,9 @@
|
|||||||
"AccountAccesskey": "账户通信密钥",
|
"AccountAccesskey": "账户通信密钥",
|
||||||
"ProductCount": "产品数量",
|
"ProductCount": "产品数量",
|
||||||
"OneNETAccountId": "OneNET账户Id",
|
"OneNETAccountId": "OneNET账户Id",
|
||||||
|
"OneNETProductId": "OneNET产品Id",
|
||||||
|
"ProductKey": "产品密钥",
|
||||||
|
"ProductSecret": "产品密钥",
|
||||||
"IoTPlatformProductId": "物联网平台对应的产品Id",
|
"IoTPlatformProductId": "物联网平台对应的产品Id",
|
||||||
"ProductName": "产品名称",
|
"ProductName": "产品名称",
|
||||||
"ProductAccesskey": "产品访问密钥",
|
"ProductAccesskey": "产品访问密钥",
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import { useRouter } from 'vue-router';
|
|||||||
|
|
||||||
import { Page, useVbenModal } from '@vben/common-ui';
|
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 { useVbenForm } from '#/adapter/form';
|
||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
@ -21,16 +21,14 @@ import { TableAction } from '#/components/table-action';
|
|||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
addUserFormSchema,
|
addProductFormSchema,
|
||||||
editUserFormSchemaEdit,
|
editProductFormSchemaEdit,
|
||||||
meterTypeOptions,
|
|
||||||
querySchema,
|
querySchema,
|
||||||
rateOptions,
|
|
||||||
tableSchema,
|
tableSchema,
|
||||||
} from './schema';
|
} from './schema';
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'AbpUser',
|
name: 'OneNETProduct',
|
||||||
});
|
});
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@ -75,7 +73,7 @@ const [UserModal, userModalApi] = useVbenModal({
|
|||||||
draggable: true,
|
draggable: true,
|
||||||
onConfirm: submit,
|
onConfirm: submit,
|
||||||
onBeforeClose: () => {
|
onBeforeClose: () => {
|
||||||
editRow.value = {};
|
// 只在确认提交后重置,而不是每次关闭都重置
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -91,7 +89,7 @@ const [AddForm, addFormApi] = useVbenForm({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
layout: 'horizontal',
|
layout: 'horizontal',
|
||||||
schema: addUserFormSchema.value,
|
schema: addProductFormSchema.value,
|
||||||
showCollapseButton: false,
|
showCollapseButton: false,
|
||||||
showDefaultActions: false,
|
showDefaultActions: false,
|
||||||
wrapperClass: 'grid-cols-2',
|
wrapperClass: 'grid-cols-2',
|
||||||
@ -109,7 +107,7 @@ const [EditForm, editFormApi] = useVbenForm({
|
|||||||
},
|
},
|
||||||
// 提交函数
|
// 提交函数
|
||||||
layout: 'horizontal',
|
layout: 'horizontal',
|
||||||
schema: editUserFormSchemaEdit.value,
|
schema: editProductFormSchemaEdit.value,
|
||||||
showCollapseButton: false,
|
showCollapseButton: false,
|
||||||
showDefaultActions: false,
|
showDefaultActions: false,
|
||||||
wrapperClass: 'grid-cols-2',
|
wrapperClass: 'grid-cols-2',
|
||||||
@ -119,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 ? postOneNetProductModifyAsync : postOneNetProductInsertAsync;
|
const api = isEdit ? postOneNetProductModifyAsync : postOneNetProductInsertAsync;
|
||||||
const { valid } = await formApi.validate();
|
const { valid } = await formApi.validate();
|
||||||
if (!valid) return;
|
if (!valid) return;
|
||||||
|
|
||||||
@ -128,11 +126,9 @@ async function submit() {
|
|||||||
? {
|
? {
|
||||||
id: editRow.value.id,
|
id: editRow.value.id,
|
||||||
...formValues,
|
...formValues,
|
||||||
password: formValues.password || '000000',
|
|
||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
...formValues,
|
...formValues,
|
||||||
password: formValues.password || '000000',
|
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -143,6 +139,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(
|
||||||
@ -160,35 +157,25 @@ async function onEdit(record: any) {
|
|||||||
editFormApi.setValues({ ...record });
|
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 () => {
|
const openAddModal = async () => {
|
||||||
editRow.value = {};
|
editRow.value = {};
|
||||||
userModalApi.open();
|
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>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -208,47 +195,6 @@ const openAddModal = async () => {
|
|||||||
/>
|
/>
|
||||||
</template>
|
</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 }">
|
<template #isEnable="{ row }">
|
||||||
<component
|
<component
|
||||||
:is="
|
:is="
|
||||||
@ -281,20 +227,6 @@ const openAddModal = async () => {
|
|||||||
confirm: onDel.bind(null, row),
|
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>
|
</template>
|
||||||
|
|||||||
@ -9,103 +9,37 @@ import { $t } from '#/locales';
|
|||||||
export const querySchema = computed(() => [
|
export const querySchema = computed(() => [
|
||||||
{
|
{
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
fieldName: 'meterAddress',
|
fieldName: 'productName',
|
||||||
label: $t('abp.meters.meterAddress'),
|
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'] => [
|
export const tableSchema: any = computed((): VxeGridProps['columns'] => [
|
||||||
{ title: $t('common.seq'), type: 'seq', width: 50 },
|
{ title: $t('common.seq'), type: 'seq', width: 50 },
|
||||||
{ field: 'meterName', title: $t('abp.meters.meterName'), minWidth: '150' },
|
|
||||||
{
|
{
|
||||||
field: 'meterAddress',
|
field: 'oneNETProductId',
|
||||||
title: $t('abp.meters.meterAddress'),
|
title: $t('abp.OneNETManagement.OneNETProductId'),
|
||||||
minWidth: '150',
|
minWidth: '150',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'meterType',
|
field: 'productName',
|
||||||
title: $t('abp.meters.meterType'),
|
title: $t('abp.OneNETManagement.ProductName'),
|
||||||
minWidth: '150',
|
minWidth: '150',
|
||||||
slots: { default: 'isMeterType' },
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'dynamicPassword',
|
field: 'productKey',
|
||||||
title: $t('abp.meters.dynamicPassword'),
|
title: $t('abp.OneNETManagement.ProductKey'),
|
||||||
minWidth: '150',
|
minWidth: '150',
|
||||||
slots: { default: 'isDynamicPassword' },
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'password',
|
field: 'productSecret',
|
||||||
title: $t('abp.meters.password'),
|
title: $t('abp.OneNETManagement.ProductSecret'),
|
||||||
minWidth: '100',
|
minWidth: '150',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'singleRate',
|
field: 'accountName',
|
||||||
title: $t('abp.meters.singleRate'),
|
title: $t('abp.OneNETManagement.AccountName'),
|
||||||
minWidth: '150',
|
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',
|
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',
|
component: 'Input',
|
||||||
fieldName: 'meterName',
|
fieldName: 'oneNETProductId',
|
||||||
label: $t('abp.meters.meterName'),
|
label: $t('abp.OneNETManagement.OneNETProductId'),
|
||||||
rules: z.string().min(1, {
|
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',
|
component: 'Input',
|
||||||
fieldName: 'meterAddress',
|
fieldName: 'productName',
|
||||||
label: $t('abp.meters.meterAddress'),
|
label: $t('abp.OneNETManagement.ProductName'),
|
||||||
rules: z
|
rules: z.string().min(1, {
|
||||||
.string()
|
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.OneNETManagement.ProductName')}`,
|
||||||
.min(1, {
|
}),
|
||||||
message: `${$t('common.pleaseInput')}${$t('common.numberType')}${$t('abp.meters.meterAddress')}`,
|
|
||||||
})
|
|
||||||
.refine((value) => /^\d+$/.test(value), {
|
|
||||||
message: $t('abp.meters.checkmeterAddress'),
|
|
||||||
}),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: 'Select',
|
component: 'Input',
|
||||||
componentProps: {
|
fieldName: 'productKey',
|
||||||
allowClear: true,
|
label: $t('abp.OneNETManagement.ProductKey'),
|
||||||
options: meterTypeOptions,
|
rules: z.string().min(1, {
|
||||||
placeholder: `${$t('common.pleaseSelect')}${$t('abp.meters.meterType')}`,
|
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.OneNETManagement.ProductKey')}`,
|
||||||
},
|
}),
|
||||||
fieldName: 'meterType',
|
|
||||||
label: $t('abp.meters.meterType'),
|
|
||||||
rules: z
|
|
||||||
.number()
|
|
||||||
.min(1, {
|
|
||||||
message: `${$t('common.pleaseSelect')}${$t('abp.meters.meterType')}`,
|
|
||||||
})
|
|
||||||
.default(1),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: 'Select',
|
component: 'Input',
|
||||||
componentProps: {
|
fieldName: 'productSecret',
|
||||||
allowClear: true,
|
label: $t('abp.OneNETManagement.ProductSecret'),
|
||||||
options: rateOptions,
|
rules: z.string().min(1, {
|
||||||
placeholder: `${$t('common.pleaseSelect')}${$t('abp.meters.singleRate')}`,
|
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.OneNETManagement.ProductSecret')}`,
|
||||||
},
|
}),
|
||||||
dependencies: {
|
},
|
||||||
show(values: any) {
|
{
|
||||||
return values.meterType === 1;
|
component: 'Input',
|
||||||
},
|
fieldName: 'accountName',
|
||||||
rules(values: any) {
|
label: $t('abp.OneNETManagement.AccountName'),
|
||||||
if (values.meterType === 1) {
|
rules: z.string().min(1, {
|
||||||
return 'required';
|
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.OneNETManagement.AccountName')}`,
|
||||||
}
|
}),
|
||||||
return null;
|
|
||||||
},
|
|
||||||
triggerFields: ['meterType'],
|
|
||||||
},
|
|
||||||
fieldName: 'singleRate',
|
|
||||||
label: $t('abp.meters.singleRate'),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: 'Switch',
|
component: 'Switch',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
class: 'w-auto',
|
class: 'w-auto',
|
||||||
},
|
},
|
||||||
fieldName: 'selfDevelop',
|
fieldName: 'enabled',
|
||||||
label: $t('abp.meters.selfDevelop'),
|
label: $t('common.isEnable'),
|
||||||
},
|
|
||||||
{
|
|
||||||
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'),
|
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export const editUserFormSchemaEdit: any = computed(() => [
|
export const editProductFormSchemaEdit: any = computed(() => [
|
||||||
{
|
{
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
fieldName: 'meterName',
|
fieldName: 'oneNETProductId',
|
||||||
label: $t('abp.meters.meterName'),
|
label: $t('abp.OneNETManagement.OneNETProductId'),
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'Input',
|
||||||
|
fieldName: 'productName',
|
||||||
|
label: $t('abp.OneNETManagement.ProductName'),
|
||||||
rules: z.string().min(1, {
|
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',
|
component: 'Input',
|
||||||
fieldName: 'meterAddress',
|
fieldName: 'productKey',
|
||||||
label: $t('abp.meters.meterAddress'),
|
label: $t('abp.OneNETManagement.ProductKey'),
|
||||||
rules: z
|
rules: z.string().min(1, {
|
||||||
.string()
|
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.OneNETManagement.ProductKey')}`,
|
||||||
.min(1, {
|
}),
|
||||||
message: `${$t('common.pleaseInput')}${$t('common.numberType')}${$t('abp.meters.meterAddress')}`,
|
|
||||||
})
|
|
||||||
.refine((value) => /^\d+$/.test(value), {
|
|
||||||
message: $t('abp.meters.checkmeterAddress'),
|
|
||||||
}),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: 'Select',
|
component: 'Input',
|
||||||
componentProps: {
|
fieldName: 'productSecret',
|
||||||
allowClear: true,
|
label: $t('abp.OneNETManagement.ProductSecret'),
|
||||||
options: meterTypeOptions,
|
rules: z.string().min(1, {
|
||||||
placeholder: `${$t('common.pleaseSelect')}${$t('abp.meters.meterType')}`,
|
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.OneNETManagement.ProductSecret')}`,
|
||||||
},
|
}),
|
||||||
fieldName: 'meterType',
|
|
||||||
label: $t('abp.meters.meterType'),
|
|
||||||
rules: z
|
|
||||||
.number()
|
|
||||||
.min(1, {
|
|
||||||
message: `${$t('common.pleaseSelect')}${$t('abp.meters.meterType')}`,
|
|
||||||
})
|
|
||||||
.default(1),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: 'Select',
|
component: 'Input',
|
||||||
componentProps: {
|
fieldName: 'accountName',
|
||||||
allowClear: true,
|
label: $t('abp.OneNETManagement.AccountName'),
|
||||||
options: rateOptions,
|
rules: z.string().min(1, {
|
||||||
placeholder: `${$t('common.pleaseSelect')}${$t('abp.meters.singleRate')}`,
|
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.OneNETManagement.AccountName')}`,
|
||||||
},
|
}),
|
||||||
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: 'Switch',
|
component: 'Switch',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
class: 'w-auto',
|
class: 'w-auto',
|
||||||
},
|
},
|
||||||
fieldName: 'selfDevelop',
|
fieldName: 'enabled',
|
||||||
label: $t('abp.meters.selfDevelop'),
|
label: $t('common.isEnable'),
|
||||||
},
|
|
||||||
{
|
|
||||||
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'),
|
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user