import ajax from '../../util/ajax'
import api from '../../util/api'

export default {
  namespaced: true,
  state: {
    healthList: {},
  },
  mutations: {
    updateList (state, payload) {
      state.healthList = payload || {}
    },
  },
  actions: {
    getHealthList ({ commit }, payload) { // 获取体检记录列表
      return new Promise((resolve, reject) => {
        ajax({
          ...api.health.healthList,
          queryData: {
            ...payload,
          }
        }).then(res => {
          commit('updateList', res)
          resolve(res)
        }).catch(reject)
      })
    }
  }
}
