export const generateColumnsState = (cols) => cols.reduce((acc, { dataIndex, show = true }) => ({ ...acc, [dataIndex]: { show: show } }), {}); export const repairBug = (tabKey, key, val) => { const stateStr = localStorage.getItem(tabKey); if (stateStr) { const state = JSON.parse(stateStr); const oldVal = state[key]?.show; let hasVal = false; if (oldVal === true) { hasVal = true; } if (oldVal === false) { hasVal = true; } if (hasVal) { return oldVal; } else { return val; } } else { return val; } }