move.vue 3.31 KB
Newer Older
xd's avatar
xd committed
1
<template>
xd's avatar
xd committed
2 3
  <div class="ct">
    <el-dialog
xd's avatar
xd committed
4
      title="请选择分组"
xd's avatar
xd committed
5
      :visible.sync="moveDialog"
xd's avatar
xd committed
6
      width="30%"
xd's avatar
xd committed
7
      :show-close="false"
8
      :close-on-click-modal="false"      
xd's avatar
xd committed
9
    >
xd's avatar
xd committed
10 11 12 13 14 15 16 17 18
      <el-tree
        ref="tree"
        class="tree"
        show-checkbox
        :check-strictly="true"
        :data="treeData"
        node-key="id"
        @node-click="handleNodeClick"
        @check-change="checkChange"
19 20
        v-loading="orgLoading" 
        element-loading-text="正在加载数据"
xd's avatar
xd committed
21 22 23
      >
      </el-tree>

xd's avatar
xd committed
24
      <span slot="footer" class="dialog-footer">
xd's avatar
xd committed
25 26 27 28
        <el-button @click="handleCancel" size="small">取 消</el-button>
        <el-button type="primary" @click="handleFinish" size="small"
          >确 定</el-button
        >
xd's avatar
xd committed
29 30
      </span>
    </el-dialog>
xd's avatar
xd committed
31
    <div></div>
xd's avatar
xd committed
32 33 34 35
  </div>
</template>

<script>
wengjianling's avatar
wengjianling committed
36
import { getOrgTree, moveMember } from "@/api/in/mail";
xd's avatar
xd committed
37 38
import { log } from "util";

xd's avatar
xd committed
39 40 41 42 43
export default {
  props: {
    moveDialog: {
      type: Boolean,
      default: false
xd's avatar
xd committed
44 45 46 47
    },
    idList: {
      type: Array,
      default: () => []
xd's avatar
xd committed
48 49
    }
  },
xd's avatar
xd committed
50
  data() {
xd's avatar
xd committed
51
    return {
52 53
      treeData: [],
      orgLoading: false
xd's avatar
xd committed
54
    };
xd's avatar
xd committed
55
  },
xd's avatar
xd committed
56
  created() {
xd's avatar
xd committed
57 58
    console.log(this.idList,'idList')  
    this.getList()
xd's avatar
xd committed
59
  },
xd's avatar
xd committed
60
  methods: {
xd's avatar
xd committed
61 62
    handleCancel() {
      this.$emit("handleCancel");
xd's avatar
xd committed
63
    },
xd's avatar
xd committed
64
    handleFinish() {
wengjianling's avatar
wengjianling committed
65
      console.log(this.idList)
xd's avatar
xd committed
66 67
      let groupId = this.$refs.tree.getCheckedKeys()[0]
      let data = {
wengjianling's avatar
wengjianling committed
68
        departmentId: groupId,
xd's avatar
xd committed
69
        ids: this.idList+""
xd's avatar
xd committed
70 71
      }
      moveMember(data).then(res=> {
xd's avatar
xd committed
72
        this.$emit("handleFinish", false);
xd's avatar
xd committed
73
      })
L.lawliet's avatar
L.lawliet committed
74

xd's avatar
xd committed
75
    },
xd's avatar
xd committed
76 77 78 79 80 81 82 83 84 85 86 87 88
    handleNodeClick(item, node, self) {
      //自己定义的editCheckId,防止单选出现混乱
      this.editCheckId = item.id;
      this.$refs.tree.setCheckedKeys([item.id]);
    },
    checkChange(item, node, self) {
      if (node == true) {
        this.editCheckId = item.id;
        this.$refs.tree.setCheckedKeys([item.id]);
      } else {
        if (this.editCheckId == item.id) {
          this.$refs.tree.setCheckedKeys([item.id]);
        }
xd's avatar
xd committed
89
      }
xd's avatar
xd committed
90 91 92
    },

    getList() {
93
      this.orgLoading = true
wengjianling's avatar
wengjianling committed
94 95 96
      getOrgTree().then(res => {
        console.log(res.data.organizations)
        this.treeData = [res.data.organizations];
97
        this.orgLoading = false
xd's avatar
xd committed
98 99
      });
    }
xd's avatar
xd committed
100 101 102 103
  }
};
</script>

xd's avatar
xd committed
104
<style scoped>
xd's avatar
xd committed
105 106 107 108 109 110 111
.tree >>> .is-leaf + .el-checkbox .el-checkbox__inner {
  display: inline-block;
}
.tree >>> .el-checkbox .el-checkbox__inner {
  display: none;
}

xd's avatar
xd committed
112 113 114 115 116 117 118
.choose {
  padding: 16px;
  font-size: 16px;
  font-weight: bold;
  color: rgba(56, 56, 56, 1);
  box-sizing: border-box;
}
xd's avatar
xd committed
119
.title {
xd's avatar
xd committed
120 121 122
  display: flex;
  align-items: center;
  justify-content: space-between;
xd's avatar
xd committed
123 124
  /* border-bottom: 1px solid #f8f8f8; */
  padding-bottom: 10px;
xd's avatar
xd committed
125 126 127 128 129 130
}
.transfer-footer {
  margin-left: 20px;
  padding: 6px 5px;
}
.ct >>> .el-dialog__header {
xd's avatar
xd committed
131
  border-bottom: 1px solid #f8f8f8;
xd's avatar
xd committed
132 133
}
.ct >>> .el-dialog__body {
xd's avatar
xd committed
134
  padding: 20px 40px;
xd's avatar
xd committed
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154
}
.ct >>> .el-transfer-panel {
  width: 250px;
}
.circle {
  width: 30px;
  height: 30px;
  line-height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(208, 2, 27, 1);
  position: relative;
}
.circle >>> .icon {
  width: 28px;
  height: 28px;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
xd's avatar
xd committed
155
.br {
xd's avatar
xd committed
156 157 158
  border-top: 1px solid #f8f8f8;
  border-bottom: 1px solid #f8f8f8;
  padding: 24px 0;
xd's avatar
xd committed
159
}
xd's avatar
xd committed
160
</style>