Blame view

src/components/report/selectCommunityFloor.vue 2.37 KB
51f9221a   wuxw   加入报表功能
1
  <template>
59833eeb   wuxw   测试报表代码
2
3
4
5
6
7
8
9
10
11
12
13
    <div class="">
      <div class="list-group-border-radius">
            <div class=" treeview">
              <ul class="list-group text-center ">
                <li v-for="(item, index) in floors" :key="index" @click="handleSelectFloor(item)"
                  :class="{ 'vc-node-selected': selectedFloorId === item.floorId }"
                  class="list-group-item node-orgTree">
                  {{ item.floorNum }}
                </li>
              </ul>
            </div>
          </div>
51f9221a   wuxw   加入报表功能
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
    </div>
  </template>
  
  <script>
  import { getCommunityId } from '@/api/community/communityApi'
  import { queryFloors } from '@/api/report/reportFeeSummaryApi'
  
  export default {
    name: 'SelectCommunityFloor',
    data() {
      return {
        floors: [],
        selectedFloorId: '',
        callBack: null
      }
    },
    methods: {
      open(params) {
        this.callBack = params.callBack
        this.loadCommunityFloors()
      },
      async loadCommunityFloors() {
        try {
          const communityId = await getCommunityId()
          const params = {
            _uid: '123mlkdinkldldijdhuudjdjkkd',
            page: 1,
            row: 100,
            communityId
          }
  
          const defaultFloor = {
            floorNum: this.$t('common.all'),
            floorId: ''
          }
  
59833eeb   wuxw   测试报表代码
50
          const data = await queryFloors(params)
51f9221a   wuxw   加入报表功能
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
          this.floors = [defaultFloor, ...data.apiFloorDataVoList]
          this.handleSelectFloor(defaultFloor)
        } catch (error) {
          console.error('Failed to load floors:', error)
        }
      },
      handleSelectFloor(floor) {
        this.selectedFloorId = floor.floorId
        if (this.callBack) {
          this.callBack(floor)
        }
      }
    }
  }
  </script>
  
  <style lang="scss" scoped>
  .select-community-floor-container {
    .border-radius {
      border-radius: 4px;
    }
  
    .margin-xs-r {
      margin-right: 5px;
    }
  
    .treeview {
      overflow-y: auto;
    }
  
    .attendance-staff {
      background-color: #fff;
      border: 1px solid #ebeef5;
    }
  
    .list-group {
      padding-left: 0;
      margin-bottom: 0;
      list-style: none;
    }
  
    .list-group-item {
      position: relative;
      display: block;
      padding: 10px 15px;
      margin-bottom: -1px;
      background-color: #fff;
      border: 1px solid #ebeef5;
      cursor: pointer;
  
      &:hover {
        background-color: #f5f7fa;
      }
    }
  
    .vc-node-selected {
      background-color: #ecf5ff;
      color: #409eff;
    }
  
    .text-center {
      text-align: center;
    }
  }
  </style>