<template>
  <div class="pd10">
    <el-row :gutter="10">
      <el-col :span="12" :xs="24">
        <role ref="role" @roleClick="roleClick"></role>
      </el-col>
      <el-col :span="6" :xs="24">
        <menus ref="menu" v-loading="loading" @menuClick="menuClick"></menus>
      </el-col>
      <el-col :span="6" :xs="24">
        <permission v-loading="loading" ref="per"></permission>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import Role from "./components/Role";
import Menus from "./components/Menu";
import Permission from "./components/Permission";
export default {
  name: "rolesmanagement",
  components: { Role, Menus, Permission },
  data() {
    return {
      role: undefined,
      menu: undefined,
      loading: false,
      checkedMenuIds: [],
    };
  },
  methods: {
    roleClick(role) {
      this.loading = true;
      this.role = role;
      this.menu = undefined;
      this.$refs.menu.roleClick(role);
      this.$refs.per.roleClick(role);
      setTimeout(() => {
        this.loading = false;
      }, 1000);
      // this.$refs.permission.resClick(this.menu, this.role)
    },
    menuClick(menu, checkedMenuIds) {
      if (!this.role) {
        this.$message.warning("请选择角色");
        return;
      }
      this.menu = menu;
      this.$refs.permission.menuClick(this.menu, this.role, checkedMenuIds);
    },
  },
};
</script>
<style lang="less" scoped>
@import url("../../../../styles/comStyle.less");
</style>



