xiangpei
2025-04-18 7feee0463330ee014b0ac1a6f8e31118bb699f12
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
<template>
  <el-dialog
      title="选择所属组织"
      :visible.sync="dialogTreeVisible"
      width="30%"
      :close-on-click-modal="false"
      :append-to-body="true">
    <el-tree
        style="padding-bottom: 30px"
        :data="treeData"
        node-key="id"
        :expand-on-click-node="false"
        :default-expand-all="true"
        :highlight-current="true"
        @node-click="nodeClick"
        :default-expanded-keys="[1, 1]"
        :default-checked-keys="[5]"
        :props="defaultProps">
    </el-tree>
    <div slot="footer" class="dialog-footer">
      <el-button @click="dialogTreeVisible = false" size="small">取 消</el-button>
      <el-button type="primary" @click="dialogTreeVisible = false" size="small">确 定</el-button>
    </div>
  </el-dialog>
</template>
 
<script>
export default {
  name: "UserOrgTreeDialog",
  data() {
    return {
      defaultProps: {
        children: 'children',
        label: 'orgName'
      }
    }
  },
  computed: {
    dialogTreeVisible: {
      get() {
        return this.$store.state.user.dialogTreeVisible;
      },
      set(value) {
        this.$store.state.user.dialogTreeVisible = value;
      }
    },
    treeData: {
      get() {
        return this.$store.state.user.treeData;
      }
    }
  },
  methods: {
    nodeClick(data){
      this.$store.state.user.userForm.belongOrg = data.id;
      this.$store.state.user.userForm.belongOrgName = data.orgName;
    }
  }
}
</script>
 
<style scoped>
 
</style>