feat
This commit is contained in:
@@ -3,13 +3,13 @@ import { Form, Input, InputNumber, Button, Card, Typography, Modal, message, Div
|
||||
import { PlusOutlined, DeleteOutlined, EditOutlined, CheckOutlined, CloseOutlined } from '@ant-design/icons';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { supabase } from "@/config/supabase";
|
||||
|
||||
import { supabaseService } from "@/hooks/supabaseService";
|
||||
const { Text } = Typography;
|
||||
|
||||
const SectionList = ({
|
||||
form,
|
||||
isView,
|
||||
formValues,
|
||||
type,
|
||||
currentCurrency = 'CNY'
|
||||
}) => {
|
||||
const [editingSectionIndex, setEditingSectionIndex] = useState(null);
|
||||
@@ -143,14 +143,17 @@ const SectionList = ({
|
||||
const fetchUnits = async () => {
|
||||
setLoadingUnits(true);
|
||||
try {
|
||||
const { data: unitsData, error } = await supabase
|
||||
.from('resources')
|
||||
.select('*')
|
||||
.eq('type', 'units')
|
||||
.order('created_at', { ascending: false });
|
||||
|
||||
if (error) throw error;
|
||||
setUnits(unitsData || []);
|
||||
const { data: units } = await supabaseService.select('resources', {
|
||||
filter: {
|
||||
'type': { eq: 'units' },
|
||||
'attributes->>template_type': { in: `(${type},common)` }
|
||||
},
|
||||
order: {
|
||||
column: 'created_at',
|
||||
ascending: false
|
||||
}
|
||||
});
|
||||
setUnits(units || []);
|
||||
} catch (error) {
|
||||
message.error('获取单位列表失败');
|
||||
console.error(error);
|
||||
|
||||
Reference in New Issue
Block a user