设备刷新缓存按钮
This commit is contained in:
parent
6c1fdb7adb
commit
fa8a4c9cc7
@ -221,7 +221,8 @@
|
|||||||
"Timestamps": "Timestamps",
|
"Timestamps": "Timestamps",
|
||||||
"FormattedTimestamps": "Formatted Timestamps",
|
"FormattedTimestamps": "Formatted Timestamps",
|
||||||
"DevicePath": "DevicePath",
|
"DevicePath": "DevicePath",
|
||||||
"DeviceAddress": "Device Address"
|
"DeviceAddress": "Device Address",
|
||||||
|
"CacheRefresh": "Cache Refresh"
|
||||||
},
|
},
|
||||||
"CTWingLog": {
|
"CTWingLog": {
|
||||||
"PlatformTenantId": "PlatformTenantId",
|
"PlatformTenantId": "PlatformTenantId",
|
||||||
|
|||||||
@ -63,5 +63,8 @@
|
|||||||
"BelongingIoTPlatform": "Belonging TPlatform",
|
"BelongingIoTPlatform": "Belonging TPlatform",
|
||||||
"AppId": "AppId",
|
"AppId": "AppId",
|
||||||
"AppKey": "AppKey",
|
"AppKey": "AppKey",
|
||||||
"AppSecret": "AppSecret"
|
"AppSecret": "AppSecret",
|
||||||
|
"operationSuccess": "OperationSuccess",
|
||||||
|
"operationFailed": "OperationFailed",
|
||||||
|
"loading": "Loading"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -221,7 +221,8 @@
|
|||||||
"Timestamps": "UTC时标(纳秒)",
|
"Timestamps": "UTC时标(纳秒)",
|
||||||
"FormattedTimestamps": "本地时间",
|
"FormattedTimestamps": "本地时间",
|
||||||
"DevicePath": "设备路径",
|
"DevicePath": "设备路径",
|
||||||
"DeviceAddress": "设备地址"
|
"DeviceAddress": "设备地址",
|
||||||
|
"CacheRefresh": "缓存刷新"
|
||||||
},
|
},
|
||||||
"CTWingLog": {
|
"CTWingLog": {
|
||||||
"PlatformTenantId": "物联网平台租户Id",
|
"PlatformTenantId": "物联网平台租户Id",
|
||||||
|
|||||||
@ -64,5 +64,8 @@
|
|||||||
"BelongingIoTPlatform": "所属平台",
|
"BelongingIoTPlatform": "所属平台",
|
||||||
"AppId": "应用Id",
|
"AppId": "应用Id",
|
||||||
"AppKey": "应用Key",
|
"AppKey": "应用Key",
|
||||||
"AppSecret": "应用Secret"
|
"AppSecret": "应用Secret",
|
||||||
|
"operationSuccess": "操作成功",
|
||||||
|
"operationFailed": "操作失败",
|
||||||
|
"loading": "正在处理"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,18 +2,20 @@
|
|||||||
import type { VbenFormProps } from '#/adapter/form';
|
import type { VbenFormProps } from '#/adapter/form';
|
||||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||||
|
|
||||||
import { h, ref } from 'vue';
|
import { computed, h, ref } from 'vue';
|
||||||
import { useRouter } from 'vue-router';
|
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, Modal, Tag } from 'ant-design-vue';
|
||||||
|
import { Loading } from '#/components/Loading';
|
||||||
|
|
||||||
import { useVbenForm } from '#/adapter/form';
|
import { useVbenForm } from '#/adapter/form';
|
||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
import {
|
import {
|
||||||
postAggregationDeviceCreateAsync,
|
postAggregationDeviceCreateAsync,
|
||||||
postAggregationDeviceDeleteAsync,
|
postAggregationDeviceDeleteAsync,
|
||||||
|
postDeviceInfoCacheDeviceDataToRedis,
|
||||||
postDeviceInfoPage,
|
postDeviceInfoPage,
|
||||||
} from '#/api-client';
|
} from '#/api-client';
|
||||||
import { TableAction } from '#/components/table-action';
|
import { TableAction } from '#/components/table-action';
|
||||||
@ -68,6 +70,8 @@ const gridOptions: VxeGridProps<any> = {
|
|||||||
const [Grid, gridApi] = useVbenVxeGrid({ formOptions, gridOptions });
|
const [Grid, gridApi] = useVbenVxeGrid({ formOptions, gridOptions });
|
||||||
|
|
||||||
const editRow: Record<string, any> = ref({});
|
const editRow: Record<string, any> = ref({});
|
||||||
|
const cacheRefreshLoading = ref(false);
|
||||||
|
const pageLoading = ref(false);
|
||||||
const [UserModal, userModalApi] = useVbenModal({
|
const [UserModal, userModalApi] = useVbenModal({
|
||||||
draggable: true,
|
draggable: true,
|
||||||
onConfirm: submit,
|
onConfirm: submit,
|
||||||
@ -241,21 +245,60 @@ const openAddModal = async () => {
|
|||||||
editRow.value = {};
|
editRow.value = {};
|
||||||
userModalApi.open();
|
userModalApi.open();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 缓存刷新按钮处理函数
|
||||||
|
const handleCacheRefresh = async () => {
|
||||||
|
if (cacheRefreshLoading.value) return; // 防止重复点击
|
||||||
|
|
||||||
|
cacheRefreshLoading.value = true;
|
||||||
|
pageLoading.value = true;
|
||||||
|
try {
|
||||||
|
await postDeviceInfoCacheDeviceDataToRedis({
|
||||||
|
body: {},
|
||||||
|
});
|
||||||
|
Message.success($t('common.operationSuccess'));
|
||||||
|
} catch (error) {
|
||||||
|
console.error('缓存刷新失败:', error);
|
||||||
|
Message.error($t('common.operationFailed'));
|
||||||
|
} finally {
|
||||||
|
cacheRefreshLoading.value = false;
|
||||||
|
pageLoading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 工具栏按钮配置
|
||||||
|
const toolbarActions = computed(() => [
|
||||||
|
{
|
||||||
|
label: $t('common.add'),
|
||||||
|
type: 'primary',
|
||||||
|
icon: 'ant-design:plus-outlined',
|
||||||
|
onClick: openAddModal.bind(null),
|
||||||
|
auth: ['AbpIdentity.Users.Create'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: cacheRefreshLoading.value
|
||||||
|
? $t('common.loading')
|
||||||
|
: $t('abp.IoTDBBase.CacheRefresh'),
|
||||||
|
type: 'primary',
|
||||||
|
icon: cacheRefreshLoading.value
|
||||||
|
? 'ant-design:loading-outlined'
|
||||||
|
: 'ant-design:reload-outlined',
|
||||||
|
onClick: handleCacheRefresh,
|
||||||
|
disabled: cacheRefreshLoading.value,
|
||||||
|
style: {
|
||||||
|
backgroundColor: '#52c41a',
|
||||||
|
borderColor: '#52c41a',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Page auto-content-height>
|
<Page auto-content-height>
|
||||||
|
<Loading :loading="pageLoading" tip="缓存刷新中..." />
|
||||||
<Grid>
|
<Grid>
|
||||||
<template #toolbar-actions>
|
<template #toolbar-actions>
|
||||||
<TableAction :actions="[
|
<TableAction :actions="toolbarActions" />
|
||||||
{
|
|
||||||
label: $t('common.add'),
|
|
||||||
type: 'primary',
|
|
||||||
icon: 'ant-design:plus-outlined',
|
|
||||||
onClick: openAddModal.bind(null),
|
|
||||||
auth: ['AbpIdentity.Users.Create'],
|
|
||||||
},
|
|
||||||
]" />
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #isArchiveStatus="{ row }">
|
<template #isArchiveStatus="{ row }">
|
||||||
@ -302,35 +345,35 @@ const openAddModal = async () => {
|
|||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #action="{ row }">
|
<template #action="{ row }">
|
||||||
<TableAction :actions="[
|
<TableAction :actions="[
|
||||||
|
{
|
||||||
|
label: $t('common.edit'),
|
||||||
|
type: 'link',
|
||||||
|
size: 'small',
|
||||||
|
auth: ['AbpIdentity.Users.Update'],
|
||||||
|
onClick: onEdit.bind(null, row),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: $t('abp.deviceInfos.viewData'),
|
||||||
|
type: 'link',
|
||||||
|
size: 'small',
|
||||||
|
auth: ['AbpIdentity.Users.Update'],
|
||||||
|
onClick: toStatusData.bind(null, row),
|
||||||
|
},
|
||||||
|
]" :drop-down-actions="[
|
||||||
{
|
{
|
||||||
label: $t('common.edit'),
|
label: $t('common.delete'),
|
||||||
type: 'link',
|
icon: 'ant-design:delete-outlined',
|
||||||
size: 'small',
|
type: 'primary',
|
||||||
auth: ['AbpIdentity.Users.Update'],
|
auth: ['AbpIdentity.Users.Delete'],
|
||||||
onClick: onEdit.bind(null, row),
|
popConfirm: {
|
||||||
},
|
title: $t('common.askConfirmDelete'),
|
||||||
{
|
confirm: onDel.bind(null, row),
|
||||||
label: $t('abp.deviceInfos.viewData'),
|
|
||||||
type: 'link',
|
|
||||||
size: 'small',
|
|
||||||
auth: ['AbpIdentity.Users.Update'],
|
|
||||||
onClick: toStatusData.bind(null, row),
|
|
||||||
},
|
|
||||||
]" :drop-down-actions="[
|
|
||||||
{
|
|
||||||
label: $t('common.delete'),
|
|
||||||
icon: 'ant-design:delete-outlined',
|
|
||||||
type: 'primary',
|
|
||||||
auth: ['AbpIdentity.Users.Delete'],
|
|
||||||
popConfirm: {
|
|
||||||
title: $t('common.askConfirmDelete'),
|
|
||||||
confirm: onDel.bind(null, row),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
]" />
|
},
|
||||||
</template>
|
]" />
|
||||||
|
</template>
|
||||||
</Grid>
|
</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" />
|
<component :is="editRow.id ? EditForm : AddForm" />
|
||||||
|
|||||||
@ -437,6 +437,8 @@ watch(
|
|||||||
{ immediate: false }, // 改为false,避免立即触发
|
{ immediate: false }, // 改为false,避免立即触发
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 页面初始化时,延迟初始化表格
|
// 页面初始化时,延迟初始化表格
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
// 延迟初始化,确保VXE表格组件已完全挂载
|
// 延迟初始化,确保VXE表格组件已完全挂载
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user