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
<template>
<el-select
placeholder="请选择预设视频分类"
@focus="getAssetTypeData"
multiple
v-model="assetTypeIdList"
@change="getSelectDep"
>
<el-checkbox :style="selfstyle" v-model="checkedThing" @change="selectAllThing">全选</el-checkbox>
<el-option v-for="item in videoContentCat" :label="item.name" :value="item.id" :key="item.id"></el-option>
</el-select>
</template>
<script>
export default {
data() {
return {
videoContentCat: [],
assetTypeIdList: [],
checkedThing: false,
selfstyle: {
textAlign: "right",
width: "100%",
paddingRight: "10px"
}
};
},
methods: {
// this.$refs.mulDisplay.videoContentCat // 使用时父组件直接获取此值即可
// 获取视频分类列表
getAssetTypeData() {
let vm = this;
vm.$https({
url: "videoContentCat/getList",
method: "get",
authType: this.backToken
})
.then(res => {
let data = res.data.data;
this.videoContentCat = data;
// this.value1[0]=data.expireDateEnd
//this.value1[1]=data.expireDateStart
})
.catch(function(err) {
console.log(err);
});
},
getSelectDep(assetTypeIdList) {
if (assetTypeIdList.length === this.videoContentCat.length) {
this.checkedThing = true;
} else {
this.checkedThing = false;
}
},
selectAllThing() {
// debugger
this.assetTypeIdList = [];
if (this.checkedThing) {
this.videoContentCat.map(item => {
this.assetTypeIdList.push(item.id);
});
} else {
this.assetTypeIdList = [];
}
}
}
};
</script>
<style>
</style>