Move searchStore into the commonStore
This commit is contained in:
parent
117dc3e4fa
commit
f4dbda3abb
|
@ -235,6 +235,12 @@ import searchApi from "~/apis/searchApi";
|
|||
import { mapActions, mapState } from "pinia";
|
||||
import mammoth from "mammoth";
|
||||
|
||||
// import { useAuthStore } from "~/stores/authStore";
|
||||
import { useCommonStore } from "~/stores/commonStore";
|
||||
import { useEntityStore } from "~/stores/entityStore";
|
||||
// import { useSearchStore } from "@search/stores/searchStore";
|
||||
// import { useResearchStore } from "@research/stores/researchStore";
|
||||
|
||||
export default {
|
||||
beforeMount() {
|
||||
this.httpService = useNuxtApp()["$http"];
|
||||
|
@ -274,11 +280,11 @@ export default {
|
|||
// data= new Tree(this.treeItems);
|
||||
// },
|
||||
computed: {
|
||||
...mapState("entity", [
|
||||
...mapState(useEntityStore, [
|
||||
"activeEntityViewSchemaGetter",
|
||||
"selectedItemEntityGetter",
|
||||
]),
|
||||
...mapState(useSearchStore, ["searchActiveTabGetter", "domainActiveGetter"]),
|
||||
...mapState(useCommonStore, ["searchActiveTabGetter", "domainActiveGetter"]),
|
||||
permitUrl() {
|
||||
return import.meta.env.VITE_PERMIT;
|
||||
},
|
||||
|
|
|
@ -235,6 +235,7 @@ import { mapActions, mapState } from "pinia";
|
|||
import mammoth from "mammoth";
|
||||
import { useSearchStore } from "@search/stores/searchStore";
|
||||
import { useEntityStore } from "@search/stores/entityStore";
|
||||
import { useCommonStore } from "~/stores/commonStore";
|
||||
|
||||
export default {
|
||||
mounted() {
|
||||
|
@ -275,7 +276,7 @@ export default {
|
|||
"activeEntityViewSchemaGetter",
|
||||
"selectedItemEntityGetter",
|
||||
]),
|
||||
...mapState(useSearchStore, [
|
||||
...mapState(useCommonStore, [
|
||||
"searchActiveTabGetter",
|
||||
"domainActiveGetter",
|
||||
]),
|
||||
|
@ -284,7 +285,7 @@ export default {
|
|||
},
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useSearchStore, ["domainActiveSetter"]),
|
||||
...mapActions(useCommonStore, ["domainActiveSetter"]),
|
||||
async getDefultList(sortKey = "lasttitle") {
|
||||
let url = searchApi.search.queryNormal;
|
||||
url = url.replace("{{appname}}", buildName());
|
||||
|
|
|
@ -250,7 +250,7 @@ export default {
|
|||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState(useSearchStore, [
|
||||
...mapState(useCommonStore, [
|
||||
"domainActiveGetter",
|
||||
"searchActiveTabGetter",
|
||||
"searchSchemaGetter",
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
<script>
|
||||
|
||||
import { useResearchStore } from "../../../stores/researchStore";
|
||||
import { useCommonStore } from "~/stores/commonStore";
|
||||
|
||||
import { mapState } from "pinia";
|
||||
|
||||
|
@ -53,7 +54,7 @@ export default {
|
|||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState(useSearchStore, ["searchActiveTabGetter"]),
|
||||
...mapState(useCommonStore, ["searchActiveTabGetter"]),
|
||||
...mapState(useResearchStore, ["researchSchemaGetter"]),
|
||||
},
|
||||
watch: {
|
||||
|
|
|
@ -405,7 +405,7 @@ import researchApi from "@search/apis/researchApi";
|
|||
import { mapState, mapActions } from "pinia";
|
||||
|
||||
// import { useResearchStore } from "@search/stores/researchStore";
|
||||
import { useSearchStore } from "@search/stores/searchStore";
|
||||
import { useCommonStore } from "@search/stores/commonStore";
|
||||
import { useEntityStore } from "@search/stores/entityStore";
|
||||
|
||||
export default {
|
||||
|
@ -478,7 +478,7 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
// ...mapState(useResearchStore, ["searchActiveTabGetter"]),
|
||||
...mapState(useSearchStore, ["searchActiveTabGetter"]),
|
||||
...mapState(useCommonStore, ["searchActiveTabGetter"]),
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useEntityStore, ["SET_ITEM_ENTITY", "SET_LIST_ENTITY"]),
|
||||
|
|
|
@ -67,6 +67,8 @@
|
|||
import { mapActions, mapState } from "pinia";
|
||||
import searchApi from "~/apis/searchApi";
|
||||
|
||||
import { useSearchStore } from "@search/stores/seachStore";
|
||||
import { useCommonStore } from "@stores/commonStore";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
|
@ -84,7 +86,7 @@ export default {
|
|||
mounted() {
|
||||
this.query = this.searchSynonymTitleGetter ?? null;
|
||||
this.synonyms = this.searchSynonymFormGetter ?? undefined;
|
||||
if(!this.synonyms){
|
||||
if (!this.synonyms) {
|
||||
this.getSynonyms();
|
||||
}
|
||||
},
|
||||
|
@ -109,23 +111,19 @@ export default {
|
|||
...mapState({
|
||||
activeSchemaGetter: "activeSchemaGetter",
|
||||
}),
|
||||
...mapState(useSearchStore, [
|
||||
"searchSynonymFormGetter",
|
||||
"searchSynonymTitleGetter",
|
||||
]),
|
||||
...mapState(useSearchStore, ["searchSynonymFormGetter"]),
|
||||
...mapState(useCommonStore, ["searchSynonymTitleSetter"]),
|
||||
},
|
||||
methods: {
|
||||
...mapActions("search", [
|
||||
"searchSynonymFormSetter",
|
||||
"searchSynonymTitleSetter",
|
||||
]),
|
||||
...mapActions(useCommonStore, ["searchSynonymFormSetter"]),
|
||||
...mapActions(useSearchStore, ["searchSynonymTitleSetter"]),
|
||||
getSynonyms() {
|
||||
if(!this.query){
|
||||
// this.mySwalConfirm({
|
||||
// title: "خطا!!",
|
||||
// html: `عبارت جستجو نباید خالی باشد`,
|
||||
// icon: "",
|
||||
// })
|
||||
if (!this.query) {
|
||||
// this.mySwalConfirm({
|
||||
// title: "خطا!!",
|
||||
// html: `عبارت جستجو نباید خالی باشد`,
|
||||
// icon: "",
|
||||
// })
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -108,17 +108,15 @@ export default {
|
|||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState(useCommonStore, ["activeSchemaGetter"]),
|
||||
...mapState(useSearchStore, [
|
||||
"searchSynonymFormGetter",
|
||||
...mapState(useCommonStore, [
|
||||
"activeSchemaGetter",
|
||||
"searchSynonymTitleGetter",
|
||||
]),
|
||||
...mapState(useSearchStore, ["searchSynonymFormGetter"]),
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useSearchStore, [
|
||||
"searchSynonymFormSetter",
|
||||
"searchSynonymTitleSetter",
|
||||
]),
|
||||
...mapActions(useCommonStore, ["searchSynonymTitleSetter"]),
|
||||
...mapActions(useSearchStore, ["searchSynonymFormSetter"]),
|
||||
async getSynonyms() {
|
||||
if (!this.query) {
|
||||
// this.mySwalConfirm({
|
||||
|
|
|
@ -194,6 +194,7 @@
|
|||
import favoriteApi from "~/apis/favoriteApi";
|
||||
import { mapState, mapActions } from "pinia";
|
||||
import idbUtil from "~/mixins/idb.js";
|
||||
import { useCommonStore } from "~/stores/commonStore";
|
||||
|
||||
/**
|
||||
* @vue-prop {Array} [summeryKeys=] - کلیدهای خلاصه
|
||||
|
@ -351,7 +352,7 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
...mapState(["userPermisionGetter", "currentUser", "selectedlists"]),
|
||||
...mapState(useSearchStore, ["searchActiveTabGetter", "domainActiveGetter"]),
|
||||
...mapState(useCommonStore, ["searchActiveTabGetter", "domainActiveGetter"]),
|
||||
|
||||
showActionMenu() {
|
||||
let show = false;
|
||||
|
|
|
@ -243,6 +243,7 @@ import favoriteApi from "~/apis/favoriteApi";
|
|||
import { mapState, mapActions } from "pinia";
|
||||
import tableActions from "~/json/search/listTableContextMenu";
|
||||
// import idbUtil from "~/mixins/idb.js";
|
||||
import { useCommonStore } from "~/stores/commonStore";
|
||||
|
||||
/**
|
||||
* @vue-prop {Array} [summeryKeys=] - کلیدهای خلاصه
|
||||
|
@ -379,7 +380,7 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
...mapState(["userPermisionGetter", "currentUser", "selectedlists"]),
|
||||
...mapState(useSearchStore, ["searchActiveTabGetter", "domainActiveGetter"]),
|
||||
...mapState(useCommonStore, ["searchActiveTabGetter", "domainActiveGetter"]),
|
||||
|
||||
myKey() {
|
||||
if (this.key_data) return this.key_data;
|
||||
|
|
|
@ -205,8 +205,8 @@ import searchApis from "~/apis/searchApi";
|
|||
import favoriteApi from "~/apis/favoriteApi";
|
||||
import { mapState, mapActions } from "pinia";
|
||||
import idbUtil from "~/mixins/idb.js";
|
||||
import { useCommonStore } from "~/stores/commonStore";
|
||||
|
||||
/**
|
||||
* @vue-prop {Array} [summeryKeys=] - کلیدهای خلاصه
|
||||
* @vue-prop {Object} [pagination=] - صفحه بندی
|
||||
*
|
||||
|
@ -346,7 +346,7 @@ export default {
|
|||
computed: {
|
||||
...mapState(["userPermisionGetter", "currentUser"]),
|
||||
|
||||
...mapState(useSearchStore, ["searchActiveTabGetter", "domainActiveGetter"]),
|
||||
...mapState(useCommonStore, ["searchActiveTabGetter", "domainActiveGetter"]),
|
||||
|
||||
showActionMenu() {
|
||||
let show = false;
|
||||
|
|
|
@ -192,6 +192,8 @@ import searchApis from "~/apis/searchApi";
|
|||
|
||||
import favoriteApi from "~/apis/favoriteApi";
|
||||
import { mapState, mapActions } from "pinia";
|
||||
import { useCommonStore } from "~/stores/commonStore";
|
||||
|
||||
export default {
|
||||
props: ["summeryKeys", "pagination"],
|
||||
name: "MajlesQavaninContent",
|
||||
|
@ -237,7 +239,7 @@ export default {
|
|||
"currentUser",
|
||||
"selectedlists",
|
||||
]),
|
||||
...mapState(useSearchStore,[
|
||||
...mapState(useCommonStore,[
|
||||
"searchActiveTabGetter",
|
||||
]),
|
||||
|
||||
|
|
|
@ -161,6 +161,8 @@
|
|||
|
||||
import favoriteApi from "~/apis/favoriteApi";
|
||||
import { mapState, mapActions } from "pinia";
|
||||
import { useCommonStore } from "~/stores/commonStore";
|
||||
import { useAuthStore } from "~/stores/authStore";
|
||||
|
||||
/**
|
||||
* @vue-prop {Array} [summeryKeys=] - کلیدهای خلاصه
|
||||
|
@ -230,8 +232,8 @@ export default {
|
|||
this.httpService = new HttpService(import.meta.env.VITE_REPO_BASE_URL);
|
||||
},
|
||||
computed: {
|
||||
...mapState(["userPermisionGetter", "currentUser"]),
|
||||
...mapState(useSearchStore, ["searchActiveTabGetter"]),
|
||||
...mapState(useAuthStore,["userPermisionGetter", "currentUser"]),
|
||||
...mapState(useCommonStore, ["searchActiveTabGetter"]),
|
||||
|
||||
showActionMenu() {
|
||||
let show = false;
|
||||
|
|
|
@ -184,6 +184,7 @@ import searchApis from "~/apis/searchApi";
|
|||
import favoriteApi from "~/apis/favoriteApi";
|
||||
import { mapState, mapActions } from "pinia";
|
||||
import idbUtil from "~/mixins/idb.js";
|
||||
import { useCommonStore } from "~/stores/commonStore";
|
||||
|
||||
/**
|
||||
* @vue-prop {Array} [summeryKeys=] - کلیدهای خلاصه
|
||||
|
@ -324,7 +325,7 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
...mapState(["userPermisionGetter", "currentUser"]),
|
||||
...mapState(useSearchStore, ["searchActiveTabGetter", "domainActiveGetter"]),
|
||||
...mapState(useCommonStore, ["searchActiveTabGetter", "domainActiveGetter"]),
|
||||
|
||||
showActionMenu() {
|
||||
let show = false;
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
|
||||
|
||||
import { mapState } from "pinia";
|
||||
import { useCommonStore } from "~/stores/commonStore";
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -70,7 +71,7 @@ export default {
|
|||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState(useSearchStore, ["searchActiveTabGetter"]),
|
||||
...mapState(useCommonStore, ["searchActiveTabGetter"]),
|
||||
},
|
||||
watch: {
|
||||
searchActiveTabGetter: {
|
||||
|
|
|
@ -313,6 +313,7 @@ import favoriteApi from "~/apis/favoriteApi";
|
|||
import tableActions from "~/json/search/listTableContextMenu";
|
||||
import { mapState, mapActions } from "pinia";
|
||||
import idbUtil from "~/mixins/idb.js";
|
||||
import { useCommonStore } from "~/stores/commonStore";
|
||||
|
||||
/**
|
||||
* @vue-prop {Array} [summeryKeys=] - کلیدهای خلاصه
|
||||
|
@ -451,7 +452,7 @@ export default {
|
|||
...mapState(["userPermisionGetter", "currentUser", "selectedlists"]),
|
||||
// ...mapState(useSearchStore, ["activeTabGetter"]),
|
||||
...mapState("entity", ["selectedItemEntityGetter"]),
|
||||
...mapState(useSearchStore, ["searchActiveTabGetter", "domainActiveGetter"]),
|
||||
...mapState(useCommonStore, ["searchActiveTabGetter", "domainActiveGetter"]),
|
||||
|
||||
showActionMenu() {
|
||||
let show = false;
|
||||
|
|
|
@ -118,7 +118,7 @@ export default {
|
|||
},
|
||||
},
|
||||
computed: {
|
||||
...mapState(useSearchStore, ["searchActiveTabGetter"]),
|
||||
...mapState(useCommonStore, ["searchActiveTabGetter"]),
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -1035,17 +1035,15 @@ export default {
|
|||
},
|
||||
|
||||
computed: {
|
||||
...mapState(useSearchStore, [
|
||||
"searchActiveTabGetter",
|
||||
"searchSchemaGetter",
|
||||
"searchSynonymTitleGetter",
|
||||
]),
|
||||
...mapState(useCommonStore, [
|
||||
"currentUser",
|
||||
"organNameGetter",
|
||||
"isSidebarCollapsed",
|
||||
"searchSchemaGetter",
|
||||
"userPermisionGetter",
|
||||
"domainActiveGetter",
|
||||
"searchActiveTabGetter",
|
||||
"searchSynonymTitleGetter",
|
||||
]),
|
||||
// metaTitle() {
|
||||
// return import.meta.env.VITE_SEARCH_PAGE_TITLE;
|
||||
|
@ -1162,15 +1160,12 @@ export default {
|
|||
methods: {
|
||||
...mapActions(useCommonStore, [
|
||||
"TOGGLE_SIDEBAR_MENU",
|
||||
"sidebarCollapsedSetter",
|
||||
"domainActiveSetter",
|
||||
]),
|
||||
|
||||
...mapActions(useSearchStore, [
|
||||
"searchActiveTabSetter",
|
||||
"searchSchemaSetter",
|
||||
"sidebarCollapsedSetter",
|
||||
"searchSynonymTitleSetter",
|
||||
]),
|
||||
...mapActions(useCommonStore, ["searchSchemaSetter"]),
|
||||
initComponent() {
|
||||
let activeItem = this.searchSchemaGetter[0];
|
||||
if (this.$route.query.key) {
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
import type {
|
||||
activeSearchChartSchema,
|
||||
activeSearchListSchema,
|
||||
Domain,
|
||||
searchActiveTab,
|
||||
searchChartActiveTab,
|
||||
searchListActiveTab,
|
||||
searchSchema,
|
||||
searchSynonymForm,
|
||||
searchSynonymTitle,
|
||||
selectionFilterItems,
|
||||
} from "~/types/searchTypes";
|
||||
|
||||
|
@ -24,7 +21,8 @@ import type {
|
|||
export const useSearchStore = defineStore("searchStore", {
|
||||
persist: {
|
||||
storage: piniaPluginPersistedstate.localStorage(),
|
||||
}, state: () => ({
|
||||
},
|
||||
state: () => ({
|
||||
selectedProject: undefined as selectedProject | undefined,
|
||||
isReturnFromItemshowPage: false as isReturnFromItemshowPage,
|
||||
list: undefined as list | undefined,
|
||||
|
@ -34,14 +32,8 @@ export const useSearchStore = defineStore("searchStore", {
|
|||
// pieData: [],
|
||||
selectedItem: undefined as selectedItem | undefined,
|
||||
|
||||
|
||||
// activeTab: undefined,
|
||||
|
||||
searchActiveTab: undefined as searchActiveTab | undefined,
|
||||
searchSchema: undefined as searchSchema | undefined,
|
||||
|
||||
searchActiveSchema: undefined as searchActiveTab | undefined,
|
||||
|
||||
searchListActiveTab: undefined as searchListActiveTab | undefined,
|
||||
searchListSchema: undefined as searchListActiveTab[] | undefined,
|
||||
activeSearchListSchema: undefined as activeSearchListSchema | undefined,
|
||||
|
@ -50,7 +42,6 @@ export const useSearchStore = defineStore("searchStore", {
|
|||
searchChartSchema: undefined as searchChartActiveTab[] | undefined,
|
||||
activeSearchChartSchema: undefined as activeSearchChartSchema | undefined,
|
||||
|
||||
searchSynonymTitle: undefined as searchSynonymTitle | undefined,
|
||||
searchSynonymForm: undefined as searchSynonymForm | undefined,
|
||||
|
||||
selectionFilterItems: [] as selectionFilterItems,
|
||||
|
@ -78,25 +69,25 @@ export const useSearchStore = defineStore("searchStore", {
|
|||
return state.list;
|
||||
},
|
||||
|
||||
searchSynonymTitleGetter(state) {
|
||||
return state.searchSynonymTitle;
|
||||
},
|
||||
// searchSynonymTitleGetter(state) {
|
||||
// return state.searchSynonymTitle;
|
||||
// },
|
||||
searchSynonymFormGetter(state) {
|
||||
return state.searchSynonymForm;
|
||||
},
|
||||
|
||||
|
||||
// activeTabGetter(state) {
|
||||
// return state.activeTab;
|
||||
// },
|
||||
|
||||
// search page
|
||||
searchActiveTabGetter(state) {
|
||||
return state.searchActiveTab;
|
||||
},
|
||||
searchSchemaGetter(state) {
|
||||
return state.searchSchema;
|
||||
},
|
||||
// moved to common store.
|
||||
// searchActiveTabGetter(state) {
|
||||
// return state.searchActiveTab;
|
||||
// },
|
||||
// searchSchemaGetter(state) {
|
||||
// return state.searchSchema;
|
||||
// },
|
||||
|
||||
searchActiveSchemaGetter(state) {
|
||||
return state.searchActiveSchema;
|
||||
|
@ -149,27 +140,26 @@ export const useSearchStore = defineStore("searchStore", {
|
|||
SET_LIST(list = undefined) {
|
||||
this.list = list;
|
||||
},
|
||||
|
||||
|
||||
searchSynonymFormSetter(searchSynonymForm = undefined) {
|
||||
this.searchSynonymForm = searchSynonymForm;
|
||||
},
|
||||
searchSynonymTitleSetter(searchSynonymTitle = undefined) {
|
||||
this.searchSynonymTitle = searchSynonymTitle;
|
||||
},
|
||||
// searchSynonymTitleSetter(searchSynonymTitle = undefined) {
|
||||
// this.searchSynonymTitle = searchSynonymTitle;
|
||||
// },
|
||||
|
||||
|
||||
// activeTabSetter(activeTab = undefined) {
|
||||
// this.activeTab = activeTab;
|
||||
// },
|
||||
|
||||
// search page
|
||||
searchActiveTabSetter(searchActiveTab: searchActiveTab = undefined) {
|
||||
this.searchActiveTab = searchActiveTab;
|
||||
},
|
||||
searchSchemaSetter(searchSchema = undefined) {
|
||||
this.searchSchema = searchSchema;
|
||||
},
|
||||
|
||||
// searchActiveTabSetter(searchActiveTab: searchActiveTab = undefined) {
|
||||
// this.searchActiveTab = searchActiveTab;
|
||||
// },
|
||||
// searchSchemaSetter(searchSchema = undefined) {
|
||||
// this.searchSchema = searchSchema;
|
||||
// },
|
||||
|
||||
searchActiveSchemaSetter(searchActiveSchema = undefined) {
|
||||
this.searchActiveSchema = searchActiveSchema;
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue
Block a user