import { routerRedux } from 'dva/router';
import * as processService from '../../services/FM/productProcess';

export default {

  namespace: 'FMProductProcess',
  state: {
  },

  subscriptions: {
    setup({ dispatch, history }) {  // eslint-disable-line

    },
  },

  effects: {
    *getMaxNum ({ payload,onComplete }, { call, put }) {
      const ret = yield call(processService.getProcessDetailList, payload);
      if (typeof onComplete === 'function') {
        let num=0;
        if(ret&&ret.length){
          ret.forEach((n,i)=>{
            if(num==0){
              num=n.NUM;
            }
          });
        }
        onComplete(num+1)
      }
    },

  },

  reducers: {
    save(state, action) {
      return { ...state, ...action.payload };
    },
  },

};
