2021-12-22 19:32:34 +08:00
|
|
|
import store from '../store'
|
|
|
|
|
|
|
|
|
|
let entities = []
|
|
|
|
|
|
|
|
|
|
const load = (value) => {
|
|
|
|
|
entities = value
|
|
|
|
|
|
|
|
|
|
// 将卫星状态信息存储到store中
|
|
|
|
|
const satellites = filter('Satellite')
|
|
|
|
|
const satellite_state_arr = satellites.map(({ id, show }) => { return { id, show } })
|
2021-12-23 11:16:54 +08:00
|
|
|
store.dispatch('satelliteSystem/setSatellites', {
|
|
|
|
|
satellites: satellite_state_arr
|
|
|
|
|
})
|
2021-12-22 19:32:34 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const get = id => entities.find(entity => entity.id === id)
|
|
|
|
|
|
|
|
|
|
const find = keyword => entities.find(entity => entity.id.startsWith(keyword))
|
|
|
|
|
|
|
|
|
|
const filter = keyword => entities.filter(entity => entity.id.startsWith(keyword))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default { get, load, find }
|