<template>
  <el-dialog
    :visible="dialogVisible"
    width="40%"
    style="height: 98%"
    :before-close="handleClose"
    top="5vh"
    lock-scroll
  >
    <div class="title" slot="title">
      <div class="divider"></div>
      <div class="label">赋予角色</div>
    </div>
    <div class="dialog-content">
      <el-transfer
        v-model="roles"
        :data="data"
        :titles="['赋予角色', '拥有角色']"
      ></el-transfer>
    </div>
    <div class="dialog-footer">
      <el-button @click="cancelForm">取 消</el-button>
      <el-button type="primary" @click="handleSubmit"
        >确定<i class="el-icon-right" style="margin-left: 5px"></i
      ></el-button>
    </div>
  </el-dialog>
</template>
  
  <script>
export default {
  name: "EditRole",
  components: {},
  props: {
    visible: {
      type: Boolean,
      default: false,
    },
    currentRoleData: {
      type: Object,
      default: () => ({}),
    },
  },
  computed: {},
  watch: {
    visible: {
      handler: function (value) {
        this.dialogVisible = value;
      },
      deep: true,
      immediate: true,
    },
  },
  data() {
    return {
      dialogForm: {},
      formLabelWidth: "100px",
      dialogVisible: false,
      data: [{ value: 1, key: "测试" }],
      roles: [],
    };
  },
  methods: {
    // 取消编辑
    cancelForm() {
      this.$emit("handleClose");
    },

    async handleSubmit() {},
    reload() {
      this.$emit("refresh");
      this.$emit("handleClose");
    },
    handleClose(done) {
      this.$confirm("确认关闭？")
        .then((_) => {
          done();
          this.$emit("handleClose");
          this.files = [];
        })
        .catch((_) => {});
    },
  },
};
</script>
  
  <style lang='scss' scoped>
.title {
  display: flex;
  margin-bottom: 16px;
  .divider {
    width: 8px;
    border-left: 4px solid #409eff;
    margin-right: 8px;
  }
  .label {
    font-weight: bold;
  }
}
.dialog-content {
  padding: 0 32px;
  display: flex;
  .basic-info {
    flex: 1;
    margin-right: 48px;
  }
}

.dialog-footer {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
}
</style>