feat: 优化界面显示,对deck添加编辑功能

This commit is contained in:
2024-09-26 21:08:38 +08:00
parent 02a1752a13
commit 12f1084612
29 changed files with 801 additions and 165 deletions

View File

@@ -0,0 +1,39 @@
import { query } from '@/modules';
import { Select as AntSelect, message, SelectProps } from 'antd';
import { useEffect, useState } from 'react';
export const Select = (props: SelectProps) => {
const [options, setOptions] = useState<{ value: string; id: string }[]>([]);
useEffect(() => {
fetch();
}, []);
const fetch = async () => {
const res = await query.post({
path: 'container',
key: 'list',
});
if (res.code !== 200) {
message.error(res.message || '获取容器列表失败');
return;
}
const data = res.data || [];
setOptions(
data.map((item: any) => {
return {
label: item.title,
value: item.id,
};
}),
);
};
return (
<AntSelect
{...props}
options={options}
// onChange={(e) => {
// const labelValue = options.find((item) => item.value === e);
// props.onChange?.(e, options);
// }}
/>
);
};