Blame view

src/components/work/CommunityRepairTree.vue 1.5 KB
b25b036d   wuxw   v1.9 优化日期
1
  <template>
e0196f8a   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
    <el-card class="tree-card">
      <el-tree
        ref="repairTree"
        :data="treeData"
        node-key="id"
        :props="defaultProps"
        :default-expand-all="true"
        @node-click="handleNodeClick"
      />
    </el-card>
  </template>
  
  <script>
  import { queryCommunityRepairTree } from '@/api/work/adminRepairApi'
  
  export default {
    name: 'CommunityRepairTree',
    data() {
      return {
        treeData: [],
        defaultProps: {
          children: 'children',
          label: 'text'
        }
      }
    },
    created() {
      this.loadTreeData()
    },
    methods: {
      async loadTreeData() {
        try {
          const { data } = await queryCommunityRepairTree()
          this.treeData = data
        } catch (error) {
          this.$message.error(this.$t('adminRepair.treeFetchError'))
        }
      },
      handleNodeClick(data, node) {
        console.log(node)
        if (data.id.startsWith('c_')) {
          this.$emit('selectCommunity', {
            communityName: data.communityName,
            communityId: data.communityId
          })
        } else if (data.id.startsWith('r_')) {
          this.$emit('selectRepairSetting', {
            communityId: data.communityId,
            repairType: data.repairType
          })
        } else if (data.id.startsWith('s_')) {
          this.$emit('selectState', {
            communityId: data.communityId,
            repairType: data.repairType,
            state: data.state
          })
        }
      }
    }
  }
  </script>
  
  <style lang="scss" scoped>
  .tree-card {
07e12785   wuxw   v1.9 admin账户中部分页面...
66
67
    max-height: 80vh;
    overflow-y: auto;
e0196f8a   wuxw   开发完成admin下巡检任务
68
69
  }
  </style>