import webapi from './webapi'


/************************** 属性表单 start **************************/

// 初始化表单
export function initForm(reduce, gf, param) {
  return async (dispatch, getState) => {
    let data = param
    reduce('attributeForm', { type: 'update', data })
  }
}

// 更新表单
export function updateFormObj(reduce, gf, fields) {
  return async (dispatch, getState) => {
    if (!fields)
      fields = gf(['attributeForm'])
    // 更新表单数据
    reduce('attributeForm', { type: 'update', data: fields })
  }
}

// 更新加载中状态
export function loading(reduce, gf, data) {
  return async (dispatch, getState) => {
    reduce('status', { type: 'loading', data })
  }
}

export function collapse(reduce, gf, data) {
  return async (dispatch, getState) => {
    reduce('status', { type: 'colllapse', data })
  }
}

/************************** 属性表单 end **************************/
