move.vue 3.14 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 8 9
      :show-close="false"
      :close-on-click-modal="false"
    >
xd's avatar
xd committed
10 11 12 13 14 15 16 17 18 19 20 21
      <el-tree
        ref="tree"
        class="tree"
        show-checkbox
        :check-strictly="true"
        :data="treeData"
        node-key="id"
        @node-click="handleNodeClick"
        @check-change="checkChange"
      >
      </el-tree>

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

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

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

xd's avatar
xd committed
72
    },
xd's avatar
xd committed
73 74 75 76 77 78 79 80 81 82 83 84 85
    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
86
      }
xd's avatar
xd committed
87 88 89
    },

    getList() {
wengjianling's avatar
wengjianling committed
90 91 92
      getOrgTree().then(res => {
        console.log(res.data.organizations)
        this.treeData = [res.data.organizations];
xd's avatar
xd committed
93 94
      });
    }
xd's avatar
xd committed
95 96 97 98
  }
};
</script>

xd's avatar
xd committed
99
<style scoped>
xd's avatar
xd committed
100 101 102 103 104 105 106
.tree >>> .is-leaf + .el-checkbox .el-checkbox__inner {
  display: inline-block;
}
.tree >>> .el-checkbox .el-checkbox__inner {
  display: none;
}

xd's avatar
xd committed
107 108 109 110 111 112 113
.choose {
  padding: 16px;
  font-size: 16px;
  font-weight: bold;
  color: rgba(56, 56, 56, 1);
  box-sizing: border-box;
}
xd's avatar
xd committed
114
.title {
xd's avatar
xd committed
115 116 117
  display: flex;
  align-items: center;
  justify-content: space-between;
xd's avatar
xd committed
118 119
  /* border-bottom: 1px solid #f8f8f8; */
  padding-bottom: 10px;
xd's avatar
xd committed
120 121 122 123 124 125
}
.transfer-footer {
  margin-left: 20px;
  padding: 6px 5px;
}
.ct >>> .el-dialog__header {
xd's avatar
xd committed
126
  border-bottom: 1px solid #f8f8f8;
xd's avatar
xd committed
127 128
}
.ct >>> .el-dialog__body {
xd's avatar
xd committed
129
  padding: 20px 40px;
xd's avatar
xd committed
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
}
.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
150
.br {
xd's avatar
xd committed
151 152 153
  border-top: 1px solid #f8f8f8;
  border-bottom: 1px solid #f8f8f8;
  padding: 24px 0;
xd's avatar
xd committed
154
}
xd's avatar
xd committed
155
</style>