pc端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.1 KiB

import { getDevices, getDevicesAll } from 'apis/index';
const user = {
namespaced: true,
state: {
devices: [],
devicesAll: null,
},
getters: {},
mutations: {
/**
* 设置devices数据
* @param {*} state
* @param {array} devices
*/
setDevices(state, devices) {
state.devices = devices;
},
/**
* 设置devicesAll的数据
* @param {*} state
* @param {*} devices
*/
setDevicesAll(state, devices) {
state.devicesAll = devices;
},
},
actions: {
// 获取设备列表(站点列表)
async getDevices({ commit }) {
try {
const data = await getDevices();
commit('setDevices', data || []);
return data;
} catch (error) {
throw new Error(error);
}
},
// 获取设备列表(站点列表) 完整信息
async getDevicesAll({ commit }) {
try {
const data = await getDevicesAll();
commit('setDevicesAll', data || null);
return data;
} catch (error) {
throw new Error(error);
}
},
},
};
export default user;