skyouc
2024-12-21 c635d78b479510ebe2556a420948effcd30a0731
zy-asrs-flow/src/utils/common-util.js
@@ -1,24 +1,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;
    }
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;
    }
}