mallOptionContent.vue
3.04 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
82
83
84
85
86
87
88
89
90
91
<template>
<div class="mall-option-content">
<span class="condition-item-text">{{$t('asisTab.mallT')}}</span>
<div class="condition-item-option" v-show="objectVal === 1">
<el-select v-model="mallVal" filterable :placeholder="$t('pholder.shopSelect')" class="mall-sel-box" @change="mallChange">
<el-option v-for="item in mallData" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</div>
<div class="condition-item-option" v-show="objectVal === 2">
<!-- @visible-change="visibleHandle" @focus="mallFocus" -->
<el-select v-model="mutiMallVal" filterable :placeholder="$t('pholder.shopSelect')" class="mall-sel-box" multiple collapse-tags @change="mallChangeHandle">
<!-- v-show="isFocus" -->
<div :class="isMallSelAll ? 'sel-all-box selected' : 'sel-all-box'" @click="selAllHandle('mall')">
<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 mallData" :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,
mallData: Array
},
name: 'mall-option-content',
data() {
return {
mallVal: '',
mutiMallVal: [],
isMallSelAll: false,
}
},
watch: {
mallData(val) {
this.mallVal = val[0].id;
this.mutiMallVal = [this.mallVal];
},
mallVal(val) {
Bus.$emit('mallVal',val)
}
},
created() {
},
mounted() {
},
methods: {
mallChange() {
this.mutiMallVal = [this.mallVal];
},
mallChangeHandle() {
this.mutiMallVal.length >= this.mallData.length ? true: false
},
selAllHandle(selType) {
if(this.isMallSelAll) {
this.isMallSelAll = false;
if(this.mutiMallVal.length == this.mallData.length) {
this.mutiMallVal = [];
}
} else {
this.isMallSelAll = true;
if(this.mutiMallVal.length == this.mallData.length) {
this.mutiMallVal = [];
} else {
this.mutiMallVal = [];
this.mallData.forEach(item => {
this.mutiMallVal.push(item.id);
})
}
}
},
}
}
</script>
<style>
</style>