import React, { useState, useEffect } from "react"; import { Modal, CheckboxGroup, Checkbox, } from "@douyinfe/semi-ui"; function Setup (props) { const { close, tableType, tableList, length } = props; const [check, setCheck] = useState([]); const checkboxcss = { width: "25%", height: 16, margin: "0 0 20px 0" }; useEffect(() => { //获取是否勾选信息 const checkItem = localStorage.getItem(tableType); setCheck(checkItem ? JSON.parse(checkItem) : []) ischeck(); }, []); function ischeck (value) { if (check.length >= length) { if (check.includes(value)) { return false; } else { return true; } } } return ( 表格属性设置 {check.length}/{length} } visible={true} style={{ width: 600 }} onOk={() => { localStorage.setItem(tableType, JSON.stringify(check)); close(); }} onCancel={() => { close(); }} > { setCheck(check); ischeck(); }} > {tableList.map((item, index) => { return (
{item.title}
{item.list?.map((itm) => { return ( {itm.name} ); })}
) })}
); } export default Setup;