2022-07-26 17:31:19 +08:00
|
|
|
import { defineStore } from "pinia";
|
2022-07-28 11:18:53 +08:00
|
|
|
import { tenantSelect } from "@/api/subPlatform/tenant";
|
2022-07-26 17:31:19 +08:00
|
|
|
|
|
|
|
const useDataStore = defineStore("data", {
|
|
|
|
state: () => ({
|
|
|
|
siteList: [],
|
|
|
|
}),
|
|
|
|
getters: {
|
|
|
|
getSiteName: (state) => {
|
|
|
|
return (siteId) =>
|
|
|
|
state.siteList.find((el) => el.id === siteId)?.name || "无";
|
|
|
|
},
|
|
|
|
},
|
|
|
|
actions: {
|
2022-08-30 12:14:35 +08:00
|
|
|
async setSiteList() {
|
|
|
|
console.log(this.siteList);
|
2022-07-28 11:18:53 +08:00
|
|
|
if (this.siteList.length !== 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
const { rows } = await tenantSelect();
|
|
|
|
this.siteList = rows;
|
2022-07-26 17:31:19 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
export default useDataStore;
|