Browse Source

首页点击人群类别联动

V1.0
mk 3 years ago
parent
commit
e6c538478f
  1. 2
      src/js/store/index.js
  2. 15
      src/js/store/modules/categoryStr.js
  3. 64
      src/views/modules/base/resi.vue
  4. 6
      src/views/modules/home/index.vue

2
src/js/store/index.js

@ -4,6 +4,7 @@ import cloneDeep from "lodash/cloneDeep";
import user from "./modules/user"; import user from "./modules/user";
import app from "./modules/app"; import app from "./modules/app";
import tagsView from "./modules/tagsView"; import tagsView from "./modules/tagsView";
import categoryStr from "./modules/categoryStr";
import { requestPost } from "@/js/dai/request"; import { requestPost } from "@/js/dai/request";
import { dateFormats } from "@/utils/index"; import { dateFormats } from "@/utils/index";
@ -44,6 +45,7 @@ export default new Vuex.Store({
user, user,
app, app,
tagsView, tagsView,
categoryStr,
}, },
mutations: { mutations: {
// 重置vuex本地储存状态 // 重置vuex本地储存状态

15
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

64
src/views/modules/base/resi.vue

@ -326,25 +326,7 @@
:resi-id="editUserId" :resi-id="editUserId"
@changegroup="handleChangeGroup" @changegroup="handleChangeGroup"
/> />
<!-- <div v-if="dialogVisible"
class="resi-other">
<div class="tabs-other-info">
<el-tabs v-model="activeName"
@tab-click="handleClick">
<el-tab-pane v-for="item in tabsList"
:key="item.groupId"
:label="item.label"
:name="'group' + item.groupId">
<resi-form :ref="'group' + item.groupId"
:columns="3"
:form-info="item.formInfo && item.formInfo"
:support-add="item.supportAdd"
:form-id="item.columnName"
:form-list="item.itemList" />
</el-tab-pane>
</el-tabs>
</div>
</div> -->
</div> </div>
<div class="resi-btns"> <div class="resi-btns">
@ -599,15 +581,15 @@ export default {
props: {}, props: {},
async activated() { // async activated() {
console.log("this.$route.query---", this.$route.query); // console.log("this.$route.query---", this.$route.query);
if (this.$route.query && this.$route.query.columnName) { // if (this.$route.query && this.$route.query.columnName) {
this.searchList = []; // this.searchList = [];
let query = this.$route.query; // let query = this.$route.query;
this.defaultCategotyKey = query.columnName; // this.defaultCategotyKey = query.columnName;
console.log("defaultCategotyKey----", this.defaultCategotyKey); // console.log("defaultCategotyKey----", this.defaultCategotyKey);
} // }
}, // },
computed: { computed: {
...mapGetters(["clientHeight", "iframeHeight"]), ...mapGetters(["clientHeight", "iframeHeight"]),
@ -621,15 +603,13 @@ export default {
async created() { async created() {
this.updateBtnAuths(); this.updateBtnAuths();
if (this.$route.query) { // if (this.$route.query) {
let query = this.$route.query; // let query = this.$route.query;
this.defaultCategotyKey = query.columnName; // this.defaultCategotyKey = query.columnName;
} // }
// await this.getFormList() // await this.getFormList()
// console.log('this.$refs.resiSearch', this) // console.log('this.$refs.resiSearch', this)
this.getTableData();
this.pageLoading = true; this.pageLoading = true;
console.log("storeoooo----0000", this.$store); console.log("storeoooo----0000", this.$store);
}, },
@ -1503,7 +1483,6 @@ export default {
} }
}); });
}); });
// }
this.formList = itemList; this.formList = itemList;
this.tabsList = groupList; 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
}
},
}; };
</script> </script>

6
src/views/modules/home/index.vue

@ -283,11 +283,9 @@ export default {
}, },
methods: { methods: {
handleClickCategory(item) { handleClickCategory(item) {
this.$store.commit('setCategoryCode',item.code)
this.$router.push({ this.$router.push({
path: "/main/base-resi", path: "/main/base-resi"
query: {
category: item.code,
},
}); });
}, },

Loading…
Cancel
Save