Blame view

src/components/report/SelectAdminCommunity.vue 2.39 KB
b25b036d   wuxw   v1.9 优化日期
1
  <template>
10d3499d   wuxw   开发完成 admin 台账功能
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
102
103
104
105
106
    <div class="select-admin-community">
      <el-card class="border-radius">
        <div class="treeview attendance-staff" style="height: 650px;">
          <ul class="list-group text-center border-radius">
            <li
              v-for="(item, index) in communityList"
              :key="index"
              class="list-group-item node-orgTree"
              :class="{ 'vc-node-selected': selectedCommunityId === item.communityId }"
              @click="handleCommunityClick(item)"
            >
              {{ item.name }}
            </li>
          </ul>
        </div>
      </el-card>
    </div>
  </template>
  
  <script>
  import { listAdminCommunitys } from '@/api/report/communityFeeSummaryApi'
  
  export default {
    name: 'SelectAdminCommunity',
    data() {
      return {
        communityList: [
          { name: this.$t('communityFeeSummary.allCommunities'), communityId: '' }
        ],
        selectedCommunityId: ''
      }
    },
    created() {
      this.loadAdminCommunities()
    },
    methods: {
      async loadAdminCommunities() {
        try {
          const params = {
            _uid: '123mlkdinkldldijdhuudjdjkkd',
            page: 1,
            row: 100
          }
          
          const { data } = await listAdminCommunitys(params)
          this.communityList = [...this.communityList, ...data]
        } catch (error) {
          console.error('Failed to load communities:', error)
        }
      },
      handleCommunityClick(community) {
        this.selectedCommunityId = community.communityId
        this.$emit('changeCommunity', community)
      }
    }
  }
  </script>
  
  <style lang="scss" scoped>
  .select-admin-community {
    .border-radius {
      border-radius: 4px;
    }
    
    .treeview {
      overflow-y: auto;
    }
    
    .list-group {
      padding-left: 0;
      margin-bottom: 0;
      
      &-item {
        position: relative;
        display: block;
        padding: 10px 15px;
        margin-bottom: -1px;
        background-color: #fff;
        border: 1px solid #ddd;
        cursor: pointer;
        
        &:first-child {
          border-top-left-radius: 4px;
          border-top-right-radius: 4px;
        }
        
        &:last-child {
          margin-bottom: 0;
          border-bottom-right-radius: 4px;
          border-bottom-left-radius: 4px;
        }
        
        &.vc-node-selected {
          background-color: #409EFF;
          color: #fff;
          border-color: #409EFF;
        }
        
        &:hover:not(.vc-node-selected) {
          background-color: #f5f5f5;
        }
      }
    }
  }
  </style>