diff --git a/src/js/store/index.js b/src/js/store/index.js index 623524e6d..197b66ebc 100644 --- a/src/js/store/index.js +++ b/src/js/store/index.js @@ -4,6 +4,7 @@ import cloneDeep from "lodash/cloneDeep"; import user from "./modules/user"; import app from "./modules/app"; import tagsView from "./modules/tagsView"; +import categoryStr from "./modules/categoryStr"; import { requestPost } from "@/js/dai/request"; import { dateFormats } from "@/utils/index"; @@ -44,6 +45,7 @@ export default new Vuex.Store({ user, app, tagsView, + categoryStr, }, mutations: { // 重置vuex本地储存状态 diff --git a/src/js/store/modules/categoryStr.js b/src/js/store/modules/categoryStr.js new file mode 100644 index 000000000..182b19b6c --- /dev/null +++ b/src/js/store/modules/categoryStr.js @@ -0,0 +1,15 @@ +const category = { + state: { + categoryCode:'' + }, + mutations: { + setCategoryCode(state,str){ + state.categoryCode = str + } + }, + actions: { + + } + } + export default category + \ No newline at end of file diff --git a/src/views/modules/base/resi.vue b/src/views/modules/base/resi.vue index 51c44f56f..cb805615a 100644 --- a/src/views/modules/base/resi.vue +++ b/src/views/modules/base/resi.vue @@ -326,25 +326,7 @@ :resi-id="editUserId" @changegroup="handleChangeGroup" /> - +
@@ -599,15 +581,15 @@ export default { props: {}, - async activated() { - console.log("this.$route.query---", this.$route.query); - if (this.$route.query && this.$route.query.columnName) { - this.searchList = []; - let query = this.$route.query; - this.defaultCategotyKey = query.columnName; - console.log("defaultCategotyKey----", this.defaultCategotyKey); - } - }, + // async activated() { + // console.log("this.$route.query---", this.$route.query); + // if (this.$route.query && this.$route.query.columnName) { + // this.searchList = []; + // let query = this.$route.query; + // this.defaultCategotyKey = query.columnName; + // console.log("defaultCategotyKey----", this.defaultCategotyKey); + // } + // }, computed: { ...mapGetters(["clientHeight", "iframeHeight"]), @@ -621,15 +603,13 @@ export default { async created() { this.updateBtnAuths(); - if (this.$route.query) { - let query = this.$route.query; - this.defaultCategotyKey = query.columnName; - } + // if (this.$route.query) { + // let query = this.$route.query; + // this.defaultCategotyKey = query.columnName; + // } // await this.getFormList() - // console.log('this.$refs.resiSearch', this) - this.getTableData(); this.pageLoading = true; console.log("storeoooo----0000", this.$store); }, @@ -1503,7 +1483,6 @@ export default { } }); }); - // } this.formList = itemList; this.tabsList = groupList; } @@ -1568,6 +1547,21 @@ export default { }); }, }, + watch: { + '$route': { + handler: function (newVal, oldVal){ + if(newVal.name == "base-resi"){ + this.getTableData({categoryKey:this.$store.state.categoryStr.categoryCode||'',pageNo: this.currentPage, + pageSize: this.pageSize}) + // this.$refs.myResiSearch.form.categoryKey.push(this.$store.state.categoryStr.categoryCode) + this.$store.commit('setCategoryCode','') + } + }, + deep: true, + immediate: true + } +}, + }; diff --git a/src/views/modules/home/index.vue b/src/views/modules/home/index.vue index 87fb3a3e0..dd61603a9 100644 --- a/src/views/modules/home/index.vue +++ b/src/views/modules/home/index.vue @@ -283,11 +283,9 @@ export default { }, methods: { handleClickCategory(item) { + this.$store.commit('setCategoryCode',item.code) this.$router.push({ - path: "/main/base-resi", - query: { - category: item.code, - }, + path: "/main/base-resi" }); },