src/views/authority/role.vue
@@ -2,10 +2,12 @@
  <basic-container
    :class="[
      'hasButThree',
      $store.state.control.windowWidth >= 1024 ? 'oneRowSearch' : '',
      $store.state.control.screenSize == 1366 ? 'smallSize' : 'normalSize',
      $store.state.control.windowWidth >= 1024 ? 'tooRowSearch1' : ''
    ]"
  >
    <avue-crud
      class="tablesss"
      :option="option"
      :table-loading="loading"
      :data="data"
@@ -103,7 +105,7 @@
  grant,
  grantTree,
  remove,
  update,
  update
} from "@/api/system/role";
import { mapGetters } from "vuex";
import website from "@/config/website";
@@ -115,7 +117,7 @@
      box: false,
      props: {
        label: "title",
        value: "key",
        value: "key"
      },
      menuGrantList: [],
      dataScopeGrantList: [],
@@ -131,7 +133,7 @@
        pageSize: 10,
        currentPage: 1,
        total: 0,
        ...this.$store.state.control.changePageSize,
        ...this.$store.state.control.changePageSize
      },
      option: {
        tip: false,
@@ -156,9 +158,9 @@
              {
                required: true,
                message: "请输入角色名称",
                trigger: "blur",
              },
            ],
                trigger: "blur"
              }
            ]
          },
          // {
          //   label: "所属单位",
@@ -192,9 +194,9 @@
              {
                required: true,
                message: "请输入角色别名",
                trigger: "blur",
              },
            ],
                trigger: "blur"
              }
            ]
          },
          {
            label: "上级角色",
@@ -204,15 +206,15 @@
            hide: true,
            span: 24,
            props: {
              label: "title",
              label: "title"
            },
            rules: [
              {
                required: false,
                message: "请选择上级角色",
                trigger: "click",
              },
            ],
                trigger: "click"
              }
            ]
          },
          {
            label: "角色排序",
@@ -223,13 +225,13 @@
              {
                required: true,
                message: "请输入角色排序",
                trigger: "blur",
              },
            ],
          },
        ],
                trigger: "blur"
              }
            ]
          }
        ]
      },
      data: [],
      data: []
    };
  },
  computed: {
@@ -239,27 +241,30 @@
        addBtn: this.vaildData(this.permission.role_add, false),
        viewBtn: this.vaildData(this.permission.role_view, false),
        delBtn: this.vaildData(this.permission.role_delete, false),
        editBtn: this.vaildData(this.permission.role_edit, false),
        editBtn: this.vaildData(this.permission.role_edit, false)
      };
    },
    ids() {
      let ids = [];
      this.selectionList.forEach((ele) => {
      this.selectionList.forEach(ele => {
        ids.push(ele.id);
      });
      return ids.join(",");
    },
    idsArray() {
      let ids = [];
      this.selectionList.forEach((ele) => {
      this.selectionList.forEach(ele => {
        ids.push(ele.id);
      });
      return ids;
    },
    }
  },
  mounted() {
    this.$store.commit("setWindowSizeHeightAdd");
  },
  methods: {
    initData(roleId) {
      getRoleTreeById(roleId).then((res) => {
      getRoleTreeById(roleId).then(res => {
        const column = this.findObject(this.option.column, "parentId");
        column.dicData = res.data.data;
      });
@@ -272,7 +277,7 @@
        this.box = false;
        this.$message({
          type: "success",
          message: "操作成功!",
          message: "操作成功!"
        });
        this.onLoad(this.page);
      });
@@ -283,11 +288,11 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          done();
        },
        (error) => {
        error => {
          window.console.log(error);
          loading();
        }
@@ -299,11 +304,11 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          done();
        },
        (error) => {
        error => {
          window.console.log(error);
          loading();
        }
@@ -313,7 +318,7 @@
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        type: "warning"
      })
        .then(() => {
          return remove(row.id);
@@ -322,7 +327,7 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
        });
    },
@@ -358,11 +363,11 @@
      this.menuTreeObj = [];
      this.dataScopeTreeObj = [];
      this.apiScopeTreeObj = [];
      grantTree().then((res) => {
      grantTree().then(res => {
        this.menuGrantList = res.data.data.menu;
        this.dataScopeGrantList = res.data.data.dataScope;
        this.apiScopeGrantList = res.data.data.apiScope;
        getRole(this.ids).then((res) => {
        getRole(this.ids).then(res => {
          this.menuTreeObj = res.data.data.menu;
          this.dataScopeTreeObj = res.data.data.dataScope;
          this.apiScopeTreeObj = res.data.data.apiScope;
@@ -378,7 +383,7 @@
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        type: "warning"
      })
        .then(() => {
          return remove(this.ids);
@@ -387,7 +392,7 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          this.$refs.crud.toggleSelection();
        });
@@ -407,12 +412,13 @@
        page.currentPage,
        page.pageSize,
        Object.assign(params, this.query)
      ).then((res) => {
      ).then(res => {
        this.data = res.data.data;
        this.loading = false;
        this.$store.commit("setWindowSizeHeightAdd");
        this.selectionClear();
      });
    },
  },
    }
  }
};
</script>