fix:Ap设备界面设备重启
This commit is contained in:
@@ -723,6 +723,9 @@ const local: any = {
|
||||
plemac:'Please enter MAC address',
|
||||
search:'Search',
|
||||
reset:'Reset',
|
||||
confirmReboot:'Confirm Restart',
|
||||
rebootConfirmContent:'Sure to restart { name }?',
|
||||
rebootSuccess:'Send to restart success',
|
||||
editConfig:'Edit config',
|
||||
forget:'Forget device',
|
||||
restart:'Restart device',
|
||||
|
||||
@@ -726,6 +726,9 @@ const local:any = {
|
||||
editConfig:'修改配置',
|
||||
forget:'移除设备',
|
||||
restart:'重启设备',
|
||||
confirmReboot:'确定重启',
|
||||
rebootConfirmContent:'确定要重启设备{ name }吗',
|
||||
rebootSuccess:'重启发送成功',
|
||||
adopt:'纳管设备',
|
||||
addDevice:'增加设备',
|
||||
sn:'产品序号',
|
||||
|
||||
@@ -266,6 +266,14 @@ export function addApDevice(siteId: string, params: Api.Device.AddApDeviceItem)
|
||||
data: requestData
|
||||
});
|
||||
}
|
||||
/** 重启 AP 设备 */
|
||||
export function rebootApDevice(siteId: string, deviceMac: string) {
|
||||
return request<any>({
|
||||
url: `/system/device/reboot/${siteId}/${deviceMac}`,
|
||||
method: 'post'
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取站点列表 */
|
||||
export function fetchSiteList(params: Api.Site.SiteParams) {
|
||||
return request<Api.Site.SiteResponse>({
|
||||
|
||||
1
src/typings/auto-imports.d.ts
vendored
1
src/typings/auto-imports.d.ts
vendored
@@ -244,6 +244,7 @@ declare global {
|
||||
const readLoalXlsx: typeof import('../utils/execl-utils')['readLoalXlsx']
|
||||
const readSheet: typeof import('../utils/execl-utils')['readSheet']
|
||||
const readonly: typeof import('vue')['readonly']
|
||||
const rebootApDevice: typeof import('../service/api/auth')['rebootApDevice']
|
||||
const ref: typeof import('vue')['ref']
|
||||
const refAutoReset: typeof import('@vueuse/core')['refAutoReset']
|
||||
const refDebounced: typeof import('@vueuse/core')['refDebounced']
|
||||
|
||||
@@ -228,7 +228,7 @@ import { useTable } from '@/hooks/common/table';
|
||||
import { SimpleScrollbar } from '~/packages/materials/src';
|
||||
import { computed, shallowRef } from 'vue';
|
||||
import { useElementSize } from '@vueuse/core';
|
||||
import { fetchApDeviceList,forgetApDevice, addApDevice, adoptApDevice } from '@/service/api/auth';
|
||||
import { fetchApDeviceList,forgetApDevice, addApDevice, adoptApDevice, rebootApDevice } from '@/service/api/auth';
|
||||
import {Card as ACard, Table as ATable, Tag as ATag, Modal, message } from 'ant-design-vue';
|
||||
import DeviceSearch from './modules/device-search.vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
@@ -303,7 +303,6 @@ const {
|
||||
}
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('API Error:', error);
|
||||
return {
|
||||
data: {
|
||||
rows: [],
|
||||
@@ -448,13 +447,20 @@ const handleForgetDevice = (record: Api.Device.ApDevice) => {
|
||||
};
|
||||
|
||||
const handleRestart = (record: Api.Device.ApDevice) => {
|
||||
// 处理重启设备
|
||||
Modal.confirm({
|
||||
title: t('common.confirm'),
|
||||
content: t('page.apdevice.restartConfirm'),
|
||||
title: t('page.apdevice.confirmReboot'),
|
||||
content: t('page.apdevice.rebootConfirmContent', { name: record.name || record.mac }),
|
||||
okText: t('common.confirm'),
|
||||
cancelText: t('common.cancel'),
|
||||
onOk: async () => {
|
||||
// 调用重启设备 API
|
||||
console.log('Restart device:', record);
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
const { error } = await rebootApDevice(selectedSiteId.value, record.mac);
|
||||
hide();
|
||||
|
||||
if (!error) {
|
||||
message.success(t('page.apdevice.rebootSuccess'));
|
||||
getData(); // 刷新列表
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user