1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  | 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;  
 |      }  
 |  } 
 |  
  |