2
0

feat:带宽配置限速判断修改

This commit is contained in:
zhongzm
2024-12-25 11:30:38 +08:00
parent 2707dc3643
commit 4ff8bcd475

View File

@@ -124,7 +124,7 @@ import { useElementSize } from '@vueuse/core';
import { fetchRateLimitList, addRateLimit, editRateLimit, removeRateLimit } from '@/service/api/auth';
import { message, Modal, Button } from 'ant-design-vue';
import type { Rule } from 'ant-design-vue/es/form';
import { PlusOutlined, ExclamationCircleOutlined,DeleteOutlined,FormOutlined } from '@ant-design/icons-vue';
import { PlusOutlined, ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { bandwidthUnits, convertBandwidth, formatBandwidth, type BandwidthUnit } from '@/utils/units';
interface RateLimitForm extends Omit<Api.Auth.RateLimitAdd, 'upLimit' | 'downLimit'> {
@@ -327,7 +327,8 @@ const {
dataIndex: 'upLimit',
title: '上行限速',
align: 'center',
customRender: ({ text }) => {
customRender: ({ text, record }) => {
if (!record.upLimitEnable) return '无限制';
const { value, unit } = formatBandwidth(text);
return `${value} ${unit}`;
}
@@ -337,7 +338,8 @@ const {
dataIndex: 'downLimit',
title: '下行限速',
align: 'center',
customRender: ({ text }) => {
customRender: ({ text, record }) => {
if (!record.downLimitEnable) return '无限制';
const { value, unit } = formatBandwidth(text);
return `${value} ${unit}`;
}
@@ -351,10 +353,10 @@ const {
customRender: ({ record }) => (
<div class="flex justify-center gap-2">
<Button type="link" onClick={() => handleEdit(record)}>
<FormOutlined />
修改
</Button>
<Button type="link" danger onClick={() => handleDelete(record)}>
<DeleteOutlined />
删除
</Button>
</div>
)