zoneOptionContent.vue
2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<template>
<div class="zone-option-content">
<span class="condition-item-text">{{$t('asisTab.storeT')}}</span>
<div class="condition-item-option" v-show="objectVal === 1">
<el-select v-model="zoneVal" filterable :placeholder="$t('pholder.areaSelect')" class="shop-sel-box">
<el-option v-for="item in zoneData" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</div>
<div class="condition-item-option" v-show="objectVal === 2">
<el-select v-model="mutiZoneVal" filterable :placeholder="$t('pholder.areaSelect')" class="shop-sel-box" multiple collapse-tags @change="zoneChangeHandle">
<div :class="isZoneSelAll ? 'sel-all-box selected' : 'sel-all-box'" @click="selAllHandle('zone')">
<span class="custom-checkbox__input">
<span class="custom-checkbox__inner"></span>
</span>
<span style="padding-left: 5px;">{{$t('allPages.all')}}</span>
</div>
<el-option v-for="item in zoneData" :key="item.id" :label="item.name" :value="item.id">
<span class="custom-checkbox__input">
<span class="custom-checkbox__inner"></span>
</span>
<span style="padding-left: 5px;">{{ item.name }}</span>
</el-option>
</el-select>
</div>
</div>
</template>
<script>
import Bus from '../../views/public/eventBus'
export default {
props: {
objectVal: Number,
},
name: 'zone-option-content',
data() {
return {
zoneVal: '',
mutiZoneVal: [],
zoneData: [],
isZoneSelAll: false,
}
},
watch: {
},
created() {
},
mounted() {
},
methods: {
zoneChangeHandle() {
this.isZoneSelAll = this.isZoneSelAll.length >= this.zoneData.length ? true: false;
},
selAllHandle(selType) {
if(this.isZoneSelAll) {
this.isZoneSelAll = false;
if(this.mutiZoneVal.length == this.zoneData.length) {
this.mutiZoneVal = [];
}
} else {
this.isZoneSelAll = true;
if(this.mutiZoneVal.length == this.zoneData.length) {
this.mutiZoneVal = [];
} else {
this.mutiZoneVal = [];
this.zoneData.forEach(item => {
this.mutiZoneVal.push(item.id);
})
}
}
},
}
}
</script>
<style>
</style>