he wei
2024-09-21 70edda3b00f2528a473c28ec5a50b739ed160f0f
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
92
93
94
95
96
97
98
99
100
101
<template>
  <div class="res-line-wrapper">
    <div class="res-line-times">
      <flex-box no-header size="mini">
        <div class="checkbox-wrapper">
          <div class="checkbox-wrapper-header">
            <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange">全选</el-checkbox>
          </div>
          <div class="checkbox-group-wrapper">
            <el-checkbox-group v-model="checkedTimes" @change="handleCheckedTimesChange">
              <div class="checkbox-item" v-for="item in times" :key="item">
                <el-checkbox :label="item">{{item}}</el-checkbox>
              </div>
            </el-checkbox-group>
          </div>
        </div>
      </flex-box>
    </div>
    <div class="res-line-content">
      <flex-box no-header size="mini"></flex-box>
    </div>
  </div>
</template>
 
<script>
import FlexBox from "@/components/FlexBox";
export default {
  name: "resLineContrast",
  components: {
    FlexBox
  },
  props: {
    list: {
      type: Array,
      default() {
        return []
      },
      updateTime: {
        type: Number,
        default: 0,
      }
    },
  },
  data() {
    return {
      checkedTimes: [],
      times: [],
      checkAll: false,
      isIndeterminate: false,
    }
  },
  methods: {
    handleCheckAllChange(val) {
      let times = this.times.map(item=>{
        return item;
      });
      this.checkedTimes = val ? times : [];
      this.isIndeterminate = false;
    },
    handleCheckedTimesChange(value) {
      let checkedCount = value.length;
      this.checkAll = checkedCount === this.times.length;
      this.isIndeterminate = checkedCount > 0 && checkedCount < this.times.length;
    }
  },
  mounted() {
 
  }
}
</script>
 
<style scoped>
.res-line-wrapper {
  display: flex;
  height: 100%;
}
.res-line-times {
  padding: 0 0 0 8px;
}
.res-line-content {
  flex: 1;
  padding: 0 8px;
}
.checkbox-item {
  padding-bottom: 8px;
}
.checkbox-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 190px;
}
.checkbox-wrapper-header {
  padding: 8px 16px;
}
.checkbox-group-wrapper {
  flex: 1;
  overflow-y: scroll;
  padding: 0 16px;
}
</style>