|
@@ -23,15 +23,17 @@
|
|
|
<div class="right-imgs"></div>
|
|
|
<div>
|
|
|
<span class="selectIocn"></span>
|
|
|
- <el-select
|
|
|
- v-model="communityId"
|
|
|
- placeholder="所有社区"
|
|
|
+ <el-cascader
|
|
|
class="saveColumn-select"
|
|
|
- @change="$store.commit('setHomeCommunityAll', communityId)"
|
|
|
+ ref="multipleValue"
|
|
|
+ :options="scOptions"
|
|
|
+ :props="{ checkStrictly: true, label: 'name' }"
|
|
|
+ collapse-tags
|
|
|
+ :show-all-levels="false"
|
|
|
clearable
|
|
|
- >
|
|
|
- <el-option v-for="(item, index) in communityList" :label="item.communityName" :value="item.id" :key="index"></el-option>
|
|
|
- </el-select>
|
|
|
+ @change="selectChange"
|
|
|
+ v-model="communityValue"
|
|
|
+ ></el-cascader>
|
|
|
</div>
|
|
|
|
|
|
<div class="time">
|
|
@@ -85,21 +87,22 @@ export default {
|
|
|
week: '星期一',
|
|
|
date: '00:00:00'
|
|
|
},
|
|
|
- communityList: [],
|
|
|
- communityId: ''
|
|
|
+ communityValue: [],
|
|
|
+ scOptions: []
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
- ...mapState(['homeCommunityAll']),
|
|
|
+ ...mapState(['globalCommunity']),
|
|
|
menuList() {
|
|
|
return this.$store.getters['getMenuList'] || [];
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
- homeCommunityAll(val) {
|
|
|
- if (!!val) {
|
|
|
- this.communityId = val;
|
|
|
- }
|
|
|
+ globalCommunity: {
|
|
|
+ handler(newVal, oldVal) {
|
|
|
+ console.log(newVal, oldVal);
|
|
|
+ },
|
|
|
+ deep: true
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
@@ -138,21 +141,59 @@ export default {
|
|
|
this.time.week = this.$moment().format('dddd');
|
|
|
this.time.thisTime = this.$moment().format('YYYY/MM/DD');
|
|
|
},
|
|
|
+ selectChange() {
|
|
|
+ let thisValue = this.$refs.multipleValue.getCheckedNodes()[0];
|
|
|
+ // 选择是否为公司
|
|
|
+ if (!!thisValue && thisValue.data.type == 'org') {
|
|
|
+ let arrs = [];
|
|
|
+ let ids = [thisValue.value];
|
|
|
+ this.fitersValue(arrs, thisValue.data);
|
|
|
+ arrs.map((item) => {
|
|
|
+ ids.push(item.value);
|
|
|
+ });
|
|
|
+ this.$store.commit('setGlobalCommunity', {
|
|
|
+ type: 'org',
|
|
|
+ value: ids
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$store.commit('setGlobalCommunity', {
|
|
|
+ value: [thisValue.value]
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fitersValue(arrs, value) {
|
|
|
+ value.children.map((item) => {
|
|
|
+ if (item.type == 'org') {
|
|
|
+ arrs.push(item);
|
|
|
+ if (!!item.children) {
|
|
|
+ this.fitersValue(arrs, item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
communityNameList() {
|
|
|
this.$http.get('/sc-community/assets/tree/community/findCompanyCommunityTree').then(({ data, msg, status }) => {
|
|
|
if (status == 0) {
|
|
|
- // this.communityList = data;
|
|
|
- // this.$store.commit('setAreaSelect', data);
|
|
|
- console.log(data)
|
|
|
+ this.scOptions = data;
|
|
|
+ this.communityValue = [data[0].value];
|
|
|
+ if (data[0].type == 'org') {
|
|
|
+ let arrs = [];
|
|
|
+ let ids = [data[0].value];
|
|
|
+ this.fitersValue(arrs, data[0]);
|
|
|
+ arrs.map((item) => {
|
|
|
+ ids.push(item.value);
|
|
|
+ });
|
|
|
+ this.$store.commit('setGlobalCommunity', {
|
|
|
+ type: 'org',
|
|
|
+ value: ids
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$store.commit('setGlobalCommunity', {
|
|
|
+ value: [data[0].value]
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
- // this.$http.get('/sc-community/assets/community/list').then(({ data, msg, status }) => {
|
|
|
- // if (status == 0) {
|
|
|
- // this.communityList = data;
|
|
|
- // this.$store.commit('setAreaSelect', data);
|
|
|
- // }
|
|
|
- // });
|
|
|
},
|
|
|
selectTab(item, index) {
|
|
|
this.tagTabIndex = index;
|
|
@@ -267,7 +308,7 @@ $colorOption: rgba(250, 250, 250, 0.6);
|
|
|
height: 24px;
|
|
|
background-image: url('~@/assets/img/homeTop/icon_shequ@2x.png');
|
|
|
background-size: cover;
|
|
|
- margin-top: 5px;
|
|
|
+ vertical-align: text-bottom;
|
|
|
}
|
|
|
.time {
|
|
|
display: flex;
|