完善设备数据跳转

This commit is contained in:
ChenYi 2025-07-14 11:06:36 +08:00
parent 6563b24045
commit 551323d5d1
2 changed files with 81 additions and 118 deletions

View File

@ -123,9 +123,9 @@ async function submit() {
const formValues = await formApi.getValues(); const formValues = await formApi.getValues();
const fetchParams: any = isEdit const fetchParams: any = isEdit
? { ? {
id: editRow.value.id, id: editRow.value.id,
...formValues, ...formValues,
} }
: formValues; : formValues;
try { try {
@ -171,7 +171,7 @@ function onDel(row: any) {
const toStatusData = (row: Record<string, any>) => { const toStatusData = (row: Record<string, any>) => {
// 使 // 使
router.push({ router.push({
path: '/iotdb/status', path: '/iotdb/deviceData',
query: { query: {
DeviceType: 10, DeviceType: 10,
DeviceId: row.focusId, DeviceId: row.focusId,
@ -202,59 +202,46 @@ const openAddModal = async () => {
<Page auto-content-height> <Page auto-content-height>
<Grid> <Grid>
<template #toolbar-actions> <template #toolbar-actions>
<TableAction <TableAction :actions="[
:actions="[ {
{ label: $t('common.add'),
label: $t('common.add'), type: 'primary',
type: 'primary', icon: 'ant-design:plus-outlined',
icon: 'ant-design:plus-outlined', onClick: openAddModal.bind(null),
onClick: openAddModal.bind(null), auth: ['AbpIdentity.Users.Create'],
auth: ['AbpIdentity.Users.Create'], },
}, ]" />
]"
/>
</template> </template>
<template #isSelfDevelop="{ row }"> <template #isSelfDevelop="{ row }">
<component <component :is="h(Tag, { color: row.selfDevelop ? 'green' : 'red' }, () =>
:is=" row.selfDevelop ? $t('common.yes') : $t('common.no'),
h(Tag, { color: row.selfDevelop ? 'green' : 'red' }, () => )
row.selfDevelop ? $t('common.yes') : $t('common.no'), " />
)
"
/>
</template> </template>
<template #isStatus="{ row }"> <template #isStatus="{ row }">
<component <component :is="h(Tag, { color: row.status ? 'green' : 'red' }, () =>
:is=" row.status ? $t('common.yes') : $t('common.no'),
h(Tag, { color: row.status ? 'green' : 'red' }, () => )
row.status ? $t('common.yes') : $t('common.no'), " />
)
"
/>
</template> </template>
<template #isEnable="{ row }"> <template #isEnable="{ row }">
<component <component :is="h(Tag, { color: row.enabled ? 'green' : 'red' }, () =>
:is=" row.enabled ? $t('common.yes') : $t('common.no'),
h(Tag, { color: row.enabled ? 'green' : 'red' }, () => )
row.enabled ? $t('common.yes') : $t('common.no'), " />
)
"
/>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
<TableAction <TableAction :actions="[
:actions="[ {
{ label: $t('common.edit'),
label: $t('common.edit'), type: 'link',
type: 'link', size: 'small',
size: 'small', auth: ['AbpIdentity.Users.Update'],
auth: ['AbpIdentity.Users.Update'], onClick: onEdit.bind(null, row),
onClick: onEdit.bind(null, row), },
}, ]" :drop-down-actions="[
]"
:drop-down-actions="[
{ {
label: row.enabled ? $t('common.disabled') : $t('common.enabled'), label: row.enabled ? $t('common.disabled') : $t('common.enabled'),
icon: `ant-design:${row.enabled ? 'close' : 'check'}-outlined`, icon: `ant-design:${row.enabled ? 'close' : 'check'}-outlined`,
@ -280,15 +267,11 @@ const openAddModal = async () => {
auth: ['AbpIdentity.Users.Delete'], auth: ['AbpIdentity.Users.Delete'],
onClick: toStatusData.bind(null, row), onClick: toStatusData.bind(null, row),
}, },
]" ]" />
/>
</template> </template>
</Grid> </Grid>
<UserModal <UserModal :title="editRow.id ? $t('common.edit') : $t('common.add')" class="w-[800px]">
:title="editRow.id ? $t('common.edit') : $t('common.add')"
class="w-[800px]"
>
<component :is="editRow.id ? EditForm : AddForm" /> <component :is="editRow.id ? EditForm : AddForm" />
</UserModal> </UserModal>
</Page> </Page>

View File

@ -127,14 +127,14 @@ async function submit() {
const formValues = await formApi.getValues(); const formValues = await formApi.getValues();
const fetchParams: any = isEdit const fetchParams: any = isEdit
? { ? {
id: editRow.value.id, id: editRow.value.id,
...formValues, ...formValues,
password: formValues.password || '000000', password: formValues.password || '000000',
} }
: { : {
...formValues, ...formValues,
password: formValues.password || '000000', password: formValues.password || '000000',
}; };
try { try {
userModalApi.setState({ loading: true, confirmLoading: true }); userModalApi.setState({ loading: true, confirmLoading: true });
@ -178,7 +178,7 @@ function onDel(row: any) {
const toStatusData = (row: Record<string, any>) => { const toStatusData = (row: Record<string, any>) => {
// 使 // 使
router.push({ router.push({
path: '/iotdb/point', path: '/iotdb/deviceData',
query: { query: {
DeviceType: row.meterType, DeviceType: row.meterType,
DeviceId: row.meterId, DeviceId: row.meterId,
@ -212,24 +212,22 @@ const openAddModal = async () => {
<Page auto-content-height> <Page auto-content-height>
<Grid> <Grid>
<template #toolbar-actions> <template #toolbar-actions>
<TableAction <TableAction :actions="[
:actions="[ {
{ label: $t('common.add'),
label: $t('common.add'), type: 'primary',
type: 'primary', icon: 'ant-design:plus-outlined',
icon: 'ant-design:plus-outlined', onClick: openAddModal.bind(null),
onClick: openAddModal.bind(null), auth: ['AbpIdentity.Users.Create'],
auth: ['AbpIdentity.Users.Create'], },
}, ]" />
]"
/>
</template> </template>
<template #isMeterType="{ row }"> <template #isMeterType="{ row }">
{{ meterTypeOptions[row.meterType - 1]?.label }} {{ meterTypeOptions[row.meterType - 1]?.label }}
</template> </template>
<template #isSingleRate="{ row }"> <template #isSingleRate="{ row }">
{{ rateOptions.find((item) => item.value === row.singleRate)?.label }} {{rateOptions.find((item) => item.value === row.singleRate)?.label}}
</template> </template>
<template #isArchiveStatus="{ row }"> <template #isArchiveStatus="{ row }">
{{ {{
@ -240,54 +238,40 @@ const openAddModal = async () => {
{{ row.tripState ? $t('common.SwitchOff') : $t('common.Closing') }} {{ row.tripState ? $t('common.SwitchOff') : $t('common.Closing') }}
</template> </template>
<template #isHaveValve="{ row }"> <template #isHaveValve="{ row }">
<component <component :is="h(Tag, { color: row.haveValve ? 'green' : 'red' }, () =>
:is=" row.haveValve ? $t('common.yes') : $t('common.no'),
h(Tag, { color: row.haveValve ? 'green' : 'red' }, () => )
row.haveValve ? $t('common.yes') : $t('common.no'), " />
)
"
/>
</template> </template>
<template #isSelfDevelop="{ row }"> <template #isSelfDevelop="{ row }">
<component <component :is="h(Tag, { color: row.selfDevelop ? 'green' : 'red' }, () =>
:is=" row.selfDevelop ? $t('common.yes') : $t('common.no'),
h(Tag, { color: row.selfDevelop ? 'green' : 'red' }, () => )
row.selfDevelop ? $t('common.yes') : $t('common.no'), " />
)
"
/>
</template> </template>
<template #isDynamicPassword="{ row }"> <template #isDynamicPassword="{ row }">
<component <component :is="h(Tag, { color: row.dynamicPassword ? 'green' : 'red' }, () =>
:is=" row.dynamicPassword ? $t('common.yes') : $t('common.no'),
h(Tag, { color: row.dynamicPassword ? 'green' : 'red' }, () => )
row.dynamicPassword ? $t('common.yes') : $t('common.no'), " />
)
"
/>
</template> </template>
<template #isEnable="{ row }"> <template #isEnable="{ row }">
<component <component :is="h(Tag, { color: row.enabled ? 'green' : 'red' }, () =>
:is=" row.enabled ? $t('common.yes') : $t('common.no'),
h(Tag, { color: row.enabled ? 'green' : 'red' }, () => )
row.enabled ? $t('common.yes') : $t('common.no'), " />
)
"
/>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
<TableAction <TableAction :actions="[
:actions="[ {
{ label: $t('common.edit'),
label: $t('common.edit'), type: 'link',
type: 'link', size: 'small',
size: 'small', auth: ['AbpIdentity.Users.Update'],
auth: ['AbpIdentity.Users.Update'], onClick: onEdit.bind(null, row),
onClick: onEdit.bind(null, row), },
}, ]" :drop-down-actions="[
]"
:drop-down-actions="[
{ {
label: $t('common.delete'), label: $t('common.delete'),
icon: 'ant-design:delete-outlined', icon: 'ant-design:delete-outlined',
@ -312,14 +296,10 @@ const openAddModal = async () => {
auth: ['AbpIdentity.Users.Delete'], auth: ['AbpIdentity.Users.Delete'],
onClick: archivesIssued.bind(null, row), onClick: archivesIssued.bind(null, row),
}, },
]" ]" />
/>
</template> </template>
</Grid> </Grid>
<UserModal <UserModal :title="editRow.id ? $t('common.edit') : $t('common.add')" class="w-[800px]">
:title="editRow.id ? $t('common.edit') : $t('common.add')"
class="w-[800px]"
>
<component :is="editRow.id ? EditForm : AddForm" /> <component :is="editRow.id ? EditForm : AddForm" />
</UserModal> </UserModal>
</Page> </Page>