import ajax from '@/server/ajax'
import api from '@/server/api'
import com from '@/util/common'
// import moment from 'moment'
// const curStreet = '新江湾城街道'

export default {
  initData({dispatch}) {
    dispatch('getHandleList')
    dispatch('getResourceCount')
    dispatch('getCommunityRate')
    dispatch('getMarketShare')
  },
  getHandleList({commit}) { // 获取并全局设置联勤联动处置列表
    ajax.get({url: api.GET_HANDLE_LIST}).then(res => {
      commit('SET_HANDLE_LIST', com.confirm(res, 'data.content', []))
    })
  },
  getResourceCount({commit}) { // 获取运行体征
    ajax.get({url: api.GET_RESOURCE_COUNT}).then(res => {
      commit('SET_RESOURCE_COUNT', com.confirm(res, 'data.content', {}))
    })
  },
  getCommunityRate({commit}) { // 小区占比
    ajax.get({url: api.GET_COMMUNITY_RATE}).then(res => {
      commit('SET_COMMUNITY_RATE', com.confirm(res, 'data.content', {}))
    })
  },
  getMarketShare({commit}) { // 市场份额
    ajax.get({url: api.GET_MARKET_SHARE}).then(res => {
      commit('SET_MARKET_SHARE', com.confirm(res, 'data.content', {}))
    })
  },
}
