mulVideo.vue 1.72 KB
Newer Older
1 2 3 4 5 6 7 8 9
<template>
  <el-select
    placeholder="请选择预设视频分类"
    @focus="getAssetTypeData"
    multiple
    v-model="assetTypeIdList"
    @change="getSelectDep"
  >
    <el-checkbox :style="selfstyle" v-model="checkedThing" @change="selectAllThing">全选</el-checkbox>
qzhxx's avatar
qzhxx committed
10
    <el-option v-for="item in videoContentCat" :label="item.name" :value="item.id" :key="item.id"></el-option>
11 12 13 14 15 16 17
  </el-select>
</template>

<script>
export default {
  data() {
    return {
qzhxx's avatar
qzhxx committed
18
      videoContentCat: [],
19 20 21 22 23 24 25 26 27 28
      assetTypeIdList: [],
      checkedThing: false,
      selfstyle: {
        textAlign: "right",
        width: "100%",
        paddingRight: "10px"
      }
    };
  },
  methods: {
qzhxx's avatar
qzhxx committed
29
    // this.$refs.mulDisplay.videoContentCat	// 使用时父组件直接获取此值即可
30 31 32 33
    // 获取视频分类列表
    getAssetTypeData() {
      let vm = this;
      vm.$https({
qzhxx's avatar
qzhxx committed
34
        url: "videoContentCat/getList",
35 36 37 38 39
        method: "get",
        authType: this.backToken
      })
        .then(res => {
          let data = res.data.data;
qzhxx's avatar
qzhxx committed
40
          this.videoContentCat = data;
41 42 43 44 45 46 47 48
          // this.value1[0]=data.expireDateEnd
          //this.value1[1]=data.expireDateStart
        })
        .catch(function(err) {
          console.log(err);
        });
    },
    getSelectDep(assetTypeIdList) {
qzhxx's avatar
qzhxx committed
49
      if (assetTypeIdList.length === this.videoContentCat.length) {
50 51 52 53 54 55 56 57 58 59
        this.checkedThing = true;
      } else {
        this.checkedThing = false;
      }
    },

    selectAllThing() {
      // debugger
      this.assetTypeIdList = [];
      if (this.checkedThing) {
qzhxx's avatar
qzhxx committed
60
        this.videoContentCat.map(item => {
61 62 63 64 65 66 67 68 69 70 71 72
          this.assetTypeIdList.push(item.id);
        });
      } else {
        this.assetTypeIdList = [];
      }
    }
  }
};
</script>

<style>
</style>