拖旺项目:聊城公交辅助决策系统
zhaoxing
2022-05-08 d5859b70023f40c195c58f81d3abcd14980cb722
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
<template>
  <div class="divtool">
    <div class="item1">
      <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange">全选</el-checkbox>
    </div>
    <div class="item3">
      <el-checkbox-group v-model="checkedCities" @change="handleCheckedCitiesChange">
        <el-checkbox class="checkitem" v-for="city in cities" :label="city" :key="city">{{city}}</el-checkbox>
      </el-checkbox-group>
    </div>
  </div>
</template>
 
<script>
import utils from "../../unit/map";
export default {
  name: "seltoolcl",
  data(){
    return {
      checkAll: false,
      checkedCities: ['1分公司', '2分公司', '3分公司', '4分公司', '总公司', '新能源公司'],
      cities: ['1分公司', '2分公司', '3分公司', '4分公司', '总公司', '新能源公司'],
      isIndeterminate: true
    }
  },
  created() {
    this.getFenGongSiAll()
  },
  methods: {
    getFenGongSiAll(){
      this.$axios.get(this.$Interface.mapResource.getFenGongSiAll, {}).then((res) => {
        // console.log("---------",res)
        this.checkedCities = []
        this.cities = []
        res.data.map(item => {
          this.checkedCities.push(item.companyName)
          this.cities.push(item.companyName)
        })
      })
    },
    handleCheckAllChange(val) {
      this.checkedCities = val ? this.cities : [];
      this.isIndeterminate = false;
      utils.queryCheLiangAttrByType(this.checkedCities.toString())
    },
    handleCheckedCitiesChange(value) {
      let checkedCount = value.length;
      this.checkAll = checkedCount === this.cities.length;
      this.isIndeterminate = checkedCount > 0 && checkedCount < this.cities.length;
      utils.queryCheLiangAttrByType(value.toString())
    }
  }
}
</script>
 
<style lang="less" scoped>
  .divtool{
    display: flex;
    position: absolute;
    width: 156px;
    top: 200px;
    left: 300px;
    color: #f3f3f3;
    opacity: 0.8;
    padding-top: 10px;
    background: linear-gradient(180deg,#06203f, #08141c);
    border: 2px solid #2a488a;
    flex-direction: column;
    justify-content: center;
    label {
      padding-left: 20px;
      height: 30px;
      opacity: 1;
      text-align: center;
      color: #ffffff;
    }
    .el-checkbox__label {
      opacity: 0.8;
      font-size: 12px;
      text-align: center;
      color: #ffffff;
    }
    .el-checkbox__input .is-checked {
      opacity: 0.8;
      font-size: 12px;
      text-align: center;
      color: #ffffff;
    }
  }
</style>