socializationLaborReducers.js 1.8 KB
import * as types from '../constants/ActionTypes';

// 默认数据
const initialState = {
    posCategory: null,
    qualifyCertificate: [],
    // postlist: [],
    getLaborAllDataList: [],
    getPostList: [],
    higher_up_data:[],
    errordata:[]
};
export default (state = initialState, action) => {
    if (action.type == types.GET_POST_LIST) {   //  获取岗位 的  默认列表
        return {
            ...state,
            getPostList: action.data
        }
    }
    if (action.type == types.GET_LABOR_ALL_DATA_LIST) {
        return {
            ...state,
            getLaborAllDataList: action.data
        }
    }
    if (action.type == types.GET_POSCATEGORY) {
        return {
            ...state,
            posCategory: action.posCategory
        }
    }
    if (action.type == types.GETPOSTALL) {
        return {
            ...state,
            higher_up_data:action.data
            // posCategory: action.posCategory
        }
    }
    if (action.type == types.ADD_CERTIFICATE_BOX) {
        return {
            ...state,
            qualifyCertificate: state.qualifyCertificate.concat([action.data])
        }
    }
    if (action.type == types.REMOVE_CERTIFICATE_BOX) {
        return {
            ...state,
            qualifyCertificate: action.data
        }
    }
    if (action.type == types.PUT_POST) {   //添加岗位 (新增add)
        // return {
        //     ...state,
        //     getPostList: state.getPostList.concat(action.data)
        // }
        return Object.assign({}, state, {
            getPostList: action.data
        });
    } 
    if (action.type == types.DATA_ERRORS) {   //添加岗位 (新增add)
        return Object.assign({}, state, {
            errordata: action.data
        });
    }
    return state;
}