diff --git a/web/src/views/Channel/component/TableRow.js b/web/src/views/Channel/component/TableRow.js
index 3fe204b6..06d0881a 100644
--- a/web/src/views/Channel/component/TableRow.js
+++ b/web/src/views/Channel/component/TableRow.js
@@ -11,10 +11,6 @@ import {
MenuItem,
TableCell,
IconButton,
- FormControl,
- InputLabel,
- InputAdornment,
- Input,
Dialog,
DialogActions,
DialogContent,
@@ -25,6 +21,7 @@ import {
Grid,
Collapse,
Typography,
+ TextField,
Box
} from '@mui/material';
@@ -34,7 +31,7 @@ import TableSwitch from 'ui-component/Switch';
import ResponseTimeLabel from './ResponseTimeLabel';
import GroupLabel from './GroupLabel';
-import { IconDotsVertical, IconEdit, IconTrash, IconPencil, IconCopy, IconWorldWww } from '@tabler/icons-react';
+import { IconDotsVertical, IconEdit, IconTrash, IconCopy, IconWorldWww } from '@tabler/icons-react';
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp';
import { copy } from 'utils/common';
@@ -78,30 +75,34 @@ export default function ChannelTableRow({ item, manageChannel, handleOpenModal,
}
};
- const handlePriority = async () => {
- if (priorityValve === '' || priorityValve === item.priority) {
+ const handlePriority = async (event) => {
+ const currentValue = parseInt(event.target.value);
+ if (isNaN(currentValue) || currentValue === priorityValve) {
return;
}
- if (priorityValve < 0) {
+ if (currentValue < 0) {
showError('优先级不能小于 0');
return;
}
- await manageChannel(item.id, 'priority', priorityValve);
+ await manageChannel(item.id, 'priority', currentValue);
+ setPriority(currentValue);
};
- const handleWeight = async () => {
- if (weightValve === '' || weightValve === item.weight) {
+ const handleWeight = async (event) => {
+ const currentValue = parseInt(event.target.value);
+ if (isNaN(currentValue) || currentValue === weightValve) {
return;
}
- if (weightValve <= 0) {
- showError('权重不能小于 0');
+ if (currentValue < 1) {
+ showError('权重不能小于 1');
return;
}
- await manageChannel(item.id, 'weight', weightValve);
+ await manageChannel(item.id, 'weight', currentValue);
+ setWeight(currentValue);
};
const handleResponseTime = async () => {
@@ -178,42 +179,26 @@ export default function ChannelTableRow({ item, manageChannel, handleOpenModal,
-
- 优先级
- setPriority(e.target.value)}
- sx={{ textAlign: 'center' }}
- endAdornment={
-
-
-
-
-
- }
- />
-
+
-
- 权重
- setWeight(e.target.value)}
- sx={{ textAlign: 'center' }}
- endAdornment={
-
-
-
-
-
- }
- />
-
+