Blame view

src/components/org/ChooseOrgTree.vue 1.7 KB
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
1
  <template>
03f63ab4   wuxw   优化到商户信息
2
3
4
5
6
7
8
9
10
11
12
13
14
    <el-dialog
      :title="$t('scheduleClassesPage.selectOrg')"
      :visible.sync="dialogVisible"
      width="60%"
    >
      <el-tree
        ref="orgTree"
        :data="chooseOrgInfo.orgs"
        :props="defaultProps"
        node-key="id"
        highlight-current
        @node-click="handleNodeClick"
      />
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
15
      <span slot="footer" class="dialog-footer">
03f63ab4   wuxw   优化到商户信息
16
17
        <el-button @click="dialogVisible = false">{{ $t('common.cancel') }}</el-button>
        <el-button type="primary" @click="_doChooseOrg">{{ $t('common.confirm') }}</el-button>
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
18
19
20
      </span>
    </el-dialog>
  </template>
03f63ab4   wuxw   优化到商户信息
21
  
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
22
  <script>
03f63ab4   wuxw   优化到商户信息
23
24
  import { getCommunityId } from '@/api/community/communityApi'
  import { listOrgTree } from '@/api/org/orgApi'
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
25
26
27
28
29
  
  export default {
    name: 'ChooseOrgTree',
    data() {
      return {
03f63ab4   wuxw   优化到商户信息
30
31
32
33
34
35
        dialogVisible: false,
        chooseOrgInfo: {
          orgs: [],
          orgId: '',
          curOrg: {}
        },
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
36
37
        defaultProps: {
          children: 'children',
03f63ab4   wuxw   优化到商户信息
38
          label: 'name'
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
39
40
41
42
        }
      }
    },
    methods: {
03f63ab4   wuxw   优化到商户信息
43
44
45
      open() {
        this.dialogVisible = true
        this._loadChooseOrgs()
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
46
      },
03f63ab4   wuxw   优化到商户信息
47
      async _loadChooseOrgs() {
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
48
        try {
03f63ab4   wuxw   优化到商户信息
49
50
51
52
53
          const params = {
            communityId: getCommunityId()
          }
          const { data } = await listOrgTree(params)
          this.chooseOrgInfo.orgs = data
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
54
        } catch (error) {
03f63ab4   wuxw   优化到商户信息
55
          console.error('获取组织树失败:', error)
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
56
57
58
        }
      },
      handleNodeClick(data) {
03f63ab4   wuxw   优化到商户信息
59
60
        this.chooseOrgInfo.curOrg = data
        this.chooseOrgInfo.curOrg.orgId = data.id
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
61
      },
03f63ab4   wuxw   优化到商户信息
62
63
64
      _doChooseOrg() {
        this.$emit('switchOrg', this.chooseOrgInfo.curOrg)
        this.dialogVisible = false
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
65
66
67
68
      }
    }
  }
  </script>
03f63ab4   wuxw   优化到商户信息
69
  
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
70
  <style lang="scss" scoped>
03f63ab4   wuxw   优化到商户信息
71
72
73
  ::v-deep .el-dialog__body {
    padding: 20px;
    max-height: 60vh;
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
74
75
76
    overflow-y: auto;
  }
  </style>