import { useMemo, useState } from 'react'; import styles from './index.less'; import { Input, Select } from 'antd'; import { DeleteOutlined } from '@ant-design/icons'; const TableRender = ({ value, onChange, onlyShow = false }) => { const defaultItem = { type: '', scale: '' }; const options = ['UF', 'RO', 'NF', 'MF', 'MBR']; const list = useMemo(() => { return value ? JSON.parse(value) : [defaultItem]; }, [value]); const handleChange = (idx, item) => { const newList = JSON.parse(JSON.stringify(list)); newList[idx] = item; const result = JSON.stringify(newList); onChange(result); }; const handleAddClick = () => { const result = JSON.stringify([...list, defaultItem]); onChange(result); }; const handleDelClick = idx => { const newList = JSON.parse(JSON.stringify(list)); newList.splice(idx, 1); const result = JSON.stringify(newList); onChange(result); }; const renderItems = (item, idx) => { const { type, scale } = item; return (