2
0

fix:终端设备界面信息增加字段修改

This commit is contained in:
zhongzm
2025-01-16 20:45:33 +08:00
parent a9a6fd9b88
commit 0b20cec9bd
4 changed files with 177 additions and 13 deletions

View File

@@ -217,6 +217,37 @@ export function getDashboardSiteList(params: { pageNum: number; pageSize: number
params params
}); });
} }
/** 获取KYC审核列表 */
export function fetchKycList(params: Api.Kyc.KycParams) {
return request<Api.Kyc.KycResponse>({
url: '/system/kyc/page',
method: 'get',
params
});
}
/** KYC审核通过 */
export function approveKyc(id: string, userId: number) {
return request<any>({
url: `/system/kyc/approve`,
method: 'put',
data: { id, userId }
});
}
/** KYC审核拒绝 */
export function rejectKyc(id: string, userId: number, reason: string) {
return request<any>({
url: `/system/kyc/reject`,
method: 'put',
data: {
id,
userId,
description: reason
}
});
}

39
src/typings/api.d.ts vendored
View File

@@ -565,9 +565,15 @@ declare namespace Api {
interface TerminalDevice { interface TerminalDevice {
id: number; id: number;
clientName: string; name: string;
clientDeviceType: string; ip: string;
clientMac: string; authStatus: number;
ssid: string;
apName: string;
activity: number;
trafficDown: number;
trafficUp: number;
uptime: number;
createBy: string | null; createBy: string | null;
createTime: string; createTime: string;
updateBy: string | null; updateBy: string | null;
@@ -663,4 +669,31 @@ declare namespace Api {
rows: DashboardSite[]; rows: DashboardSite[];
total: number; total: number;
} }
namespace Kyc {
interface KycInfo {
id: string;
userId: number;
userName: string;
fullName: string;
idType: string;
idFile: string;
identifyPicture: string;
status: string;
reason?: string;
createTime: string;
updateTime: string;
}
interface KycParams {
pageNum: number;
pageSize: number;
userName?: string;
status?: number;
}
interface KycResponse {
rows: KycInfo[];
total: number;
}
}
} }

View File

@@ -17,6 +17,7 @@ declare global {
const addThemeVarsToHtml: typeof import('../store/modules/theme/shared')['addThemeVarsToHtml'] const addThemeVarsToHtml: typeof import('../store/modules/theme/shared')['addThemeVarsToHtml']
const afterAll: typeof import('vitest')['afterAll'] const afterAll: typeof import('vitest')['afterAll']
const afterEach: typeof import('vitest')['afterEach'] const afterEach: typeof import('vitest')['afterEach']
const approveKyc: typeof import('../service/api/auth')['approveKyc']
const assert: typeof import('vitest')['assert'] const assert: typeof import('vitest')['assert']
const assign: typeof import('lodash-es')['assign'] const assign: typeof import('lodash-es')['assign']
const asyncComputed: typeof import('@vueuse/core')['asyncComputed'] const asyncComputed: typeof import('@vueuse/core')['asyncComputed']
@@ -132,6 +133,8 @@ declare global {
const fetchGetConstantRoutes: typeof import('../service/api/route')['fetchGetConstantRoutes'] const fetchGetConstantRoutes: typeof import('../service/api/route')['fetchGetConstantRoutes']
const fetchGetMenuTree: typeof import('../service/api/menu')['fetchGetMenuTree'] const fetchGetMenuTree: typeof import('../service/api/menu')['fetchGetMenuTree']
const fetchIsRouteExist: typeof import('../service/api/route')['fetchIsRouteExist'] const fetchIsRouteExist: typeof import('../service/api/route')['fetchIsRouteExist']
const fetchKycImg: typeof import('../service/api/auth')['fetchKycImg']
const fetchKycList: typeof import('../service/api/auth')['fetchKycList']
const fetchLogin: typeof import('../service/api/auth')['fetchLogin'] const fetchLogin: typeof import('../service/api/auth')['fetchLogin']
const fetchPackageList: typeof import('../service/api/auth')['fetchPackageList'] const fetchPackageList: typeof import('../service/api/auth')['fetchPackageList']
const fetchRateLimitList: typeof import('../service/api/auth')['fetchRateLimitList'] const fetchRateLimitList: typeof import('../service/api/auth')['fetchRateLimitList']
@@ -230,6 +233,7 @@ declare global {
const refDefault: typeof import('@vueuse/core')['refDefault'] const refDefault: typeof import('@vueuse/core')['refDefault']
const refThrottled: typeof import('@vueuse/core')['refThrottled'] const refThrottled: typeof import('@vueuse/core')['refThrottled']
const refWithControl: typeof import('@vueuse/core')['refWithControl'] const refWithControl: typeof import('@vueuse/core')['refWithControl']
const rejectKyc: typeof import('../service/api/auth')['rejectKyc']
const removeEmptyChildren: typeof import('../utils/menu')['removeEmptyChildren'] const removeEmptyChildren: typeof import('../utils/menu')['removeEmptyChildren']
const removeRateLimit: typeof import('../service/api/auth')['removeRateLimit'] const removeRateLimit: typeof import('../service/api/auth')['removeRateLimit']
const resolveComponent: typeof import('vue')['resolveComponent'] const resolveComponent: typeof import('vue')['resolveComponent']

View File

@@ -56,8 +56,9 @@ import { SimpleScrollbar } from '~/packages/materials/src';
import { computed, shallowRef, watch } from 'vue'; import { computed, shallowRef, watch } from 'vue';
import { useElementSize } from '@vueuse/core'; import { useElementSize } from '@vueuse/core';
import { fetchTerminalList } from '@/service/api/auth'; import { fetchTerminalList } from '@/service/api/auth';
import { Card as ACard, Table as ATable } from 'ant-design-vue'; import { Card as ACard, Table as ATable, Tag as ATag } from 'ant-design-vue';
import TerminalSearch from './modules/terminal-search.vue'; import TerminalSearch from './modules/terminal-search.vue';
import { formatStorage, formatTime } from '@/utils/units';
const wrapperEl = shallowRef<HTMLElement | null>(null); const wrapperEl = shallowRef<HTMLElement | null>(null);
@@ -68,6 +69,43 @@ const scrollConfig = computed(() => ({
x: 800 x: 800
})); }));
const getAuthStatusText = (status: number) => {
switch (status) {
case 1:
return 'pending';
case 2:
return 'authorized';
default:
return '未知';
}
};
const getAuthStatusColor = (status: number) => {
switch (status) {
case 1:
return 'warning';
case 2:
return 'success';
default:
return 'default';
}
};
const formatDetailedTime = (seconds: number): string => {
const days = Math.floor(seconds / 86400);
const hours = Math.floor((seconds % 86400) / 3600);
const minutes = Math.floor((seconds % 3600) / 60);
const remainingSeconds = seconds % 60;
const parts = [];
if (days > 0) parts.push(`${days}`);
if (hours > 0) parts.push(`${hours}小时`);
if (minutes > 0) parts.push(`${minutes}分钟`);
if (remainingSeconds > 0 || parts.length === 0) parts.push(`${remainingSeconds}`);
return parts.join('');
};
const { const {
columns, columns,
columnChecks, columnChecks,
@@ -114,25 +152,83 @@ const {
pagination: true, pagination: true,
columns: (): AntDesign.TableColumn<Api.Device.TerminalDevice>[] => [ columns: (): AntDesign.TableColumn<Api.Device.TerminalDevice>[] => [
{ {
key: 'clientName', key: 'name',
dataIndex: 'clientName', dataIndex: 'name',
title: '设备名称', title: '设备名称',
align: 'center', align: 'center',
width: 150 width: 150
}, },
{ {
key: 'clientDeviceType', key: 'ip',
dataIndex: 'clientDeviceType', dataIndex: 'ip',
title: '设备类型', title: 'IP地址',
align: 'center', align: 'center',
width: 150 width: 150
}, },
{ {
key: 'clientMac', key: 'authStatus',
dataIndex: 'clientMac', dataIndex: 'authStatus',
title: 'MAC地址', title: '状态',
align: 'center', align: 'center',
width: 180 width: 120,
customRender: ({ text }) => h(ATag, {
color: getAuthStatusColor(text)
}, () => getAuthStatusText(text))
},
{
key: 'ssid',
dataIndex: 'ssid',
title: '网络',
align: 'center',
width: 150
},
{
key: 'apName',
dataIndex: 'apName',
title: '所属AP设备',
align: 'center',
width: 150
},
{
key: 'activity',
dataIndex: 'activity',
title: '下载速率',
align: 'center',
width: 120,
customRender: ({ text }) => {
const { value, unit } = formatStorage(text);
return `${value.toFixed(2)} ${unit}/s`;
}
},
{
key: 'trafficDown',
dataIndex: 'trafficDown',
title: '下载量',
align: 'center',
width: 120,
customRender: ({ text }) => {
const { value, unit } = formatStorage(text);
return `${value.toFixed(2)} ${unit}`;
}
},
{
key: 'trafficUp',
dataIndex: 'trafficUp',
title: '上传量',
align: 'center',
width: 120,
customRender: ({ text }) => {
const { value, unit } = formatStorage(text);
return `${value.toFixed(2)} ${unit}`;
}
},
{
key: 'uptime',
dataIndex: 'uptime',
title: '在线时长',
align: 'center',
width: 150,
customRender: ({ text }) => formatDetailedTime(text)
} }
] ]
}); });