

const common = {
    // 主动变更数据源为 ‘-’
    checkValFormat: (val) => {
        let timeFormat = "-";
        if (val || val === 0) {
            timeFormat = val;
        }
        return timeFormat;
    },
    checkTableValFormat: (row, column, cellValue) => {
        let valFormater = "-";
        if (cellValue || cellValue === 0) {
            valFormater = cellValue;
        }
        return valFormater;
    },
    // 处理后台接口返回数据某字段null值为“-”
    handleDataIsNull(data) {
        let obj = data || {};
        for (let item in obj) {
            obj[item] =
                obj[item] == null || obj[item] == "null" ? "-" : obj[item];
        }
        return obj;
    }
};
export default common;
