import { Map, fromJS, List } from "immutable";

export function showState(
  state = Map(
    fromJS({
      loading: true,
    })
  ),
  action
) {
  // 框架在初始化state的值时，action默认带一个type小于1的随机值(即：action={type: 0.12354556435634})，这里判断小于1时返回默认值
  if (action.type && action.type < 1) return state;
  state = state.sf(["loading"], action);
  return state;
}
//统计图与表格的切换
export function showTable(
  state = Map(
    fromJS({
      showTable: false,
    })
  ),
  action
) {
  // 框架在初始化state的值时，action默认带一个type小于1的随机值(即：action={type: 0.12354556435634})，这里判断小于1时返回默认值
  if (action.type && action.type < 1) return state;
  state = state.sf(["showTable"], action);
  return state;
}
//经营状况统计图和表格数据
export function conditionData(state = List(), action) {
  if (action.type && action.type < 1) return state;
  state = List(fromJS(action));
  return state;
}
