src/views/system/topmenu.vue
@@ -2,10 +2,12 @@
  <basic-container
    :class="[
      'topmenu',
      $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"
@@ -91,7 +93,7 @@
  remove,
  grant,
  grantTree,
  getTopTree,
  getTopTree
} from "@/api/system/topmenu";
import { mapGetters } from "vuex";
import iconList from "@/config/iconList";
@@ -105,13 +107,13 @@
      loading: true,
      props: {
        label: "title",
        value: "key",
        value: "key"
      },
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
        ...this.$store.state.control.changePageSize,
        ...this.$store.state.control.changePageSize
      },
      selectionList: [],
      menuGrantList: [],
@@ -138,9 +140,9 @@
              {
                required: true,
                message: "请输入菜单名",
                trigger: "blur",
              },
            ],
                trigger: "blur"
              }
            ]
          },
          {
            label: "菜单图标",
@@ -152,9 +154,9 @@
              {
                required: true,
                message: "请输入菜单图标",
                trigger: "click",
              },
            ],
                trigger: "click"
              }
            ]
          },
          {
            label: "菜单编号",
@@ -164,9 +166,9 @@
              {
                required: true,
                message: "请输入菜单编号",
                trigger: "blur",
              },
            ],
                trigger: "blur"
              }
            ]
          },
          {
            label: "菜单排序",
@@ -177,13 +179,13 @@
              {
                required: true,
                message: "请输入菜单排序",
                trigger: "blur",
              },
            ],
          },
        ],
                trigger: "blur"
              }
            ]
          }
        ]
      },
      data: [],
      data: []
    };
  },
  computed: {
@@ -193,23 +195,26 @@
        addBtn: this.vaildData(this.permission.topmenu_add, false),
        viewBtn: this.vaildData(this.permission.topmenu_view, false),
        delBtn: this.vaildData(this.permission.topmenu_delete, false),
        editBtn: this.vaildData(this.permission.topmenu_edit, false),
        editBtn: this.vaildData(this.permission.topmenu_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: {
    submit() {
@@ -218,7 +223,7 @@
        this.box = false;
        this.$message({
          type: "success",
          message: "操作成功!",
          message: "操作成功!"
        });
        this.onLoad(this.page);
      });
@@ -229,11 +234,11 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          done();
        },
        (error) => {
        error => {
          window.console.log(error);
          loading();
        }
@@ -245,11 +250,11 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          done();
        },
        (error) => {
        error => {
          window.console.log(error);
          loading();
        }
@@ -259,7 +264,7 @@
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        type: "warning"
      })
        .then(() => {
          return remove(row.id);
@@ -268,7 +273,7 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
        });
    },
@@ -280,7 +285,7 @@
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        type: "warning"
      })
        .then(() => {
          return remove(this.ids);
@@ -289,7 +294,7 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          this.$refs.crud.toggleSelection();
        });
@@ -300,9 +305,9 @@
        return;
      }
      this.menuTreeObj = [];
      grantTree().then((res) => {
      grantTree().then(res => {
        this.menuGrantList = res.data.data.menu;
        getTopTree(this.ids).then((res) => {
        getTopTree(this.ids).then(res => {
          this.menuTreeObj = res.data.data.menu;
          this.box = true;
        });
@@ -310,7 +315,7 @@
    },
    beforeOpen(done, type) {
      if (["edit", "view"].includes(type)) {
        getDetail(this.form.id).then((res) => {
        getDetail(this.form.id).then(res => {
          this.form = res.data.data;
        });
      }
@@ -321,7 +326,7 @@
        () => {
          this.onLoad(this.page);
        },
        (error) => {
        error => {
          window.console.log(error);
        }
      );
@@ -358,15 +363,16 @@
        page.currentPage,
        page.pageSize,
        Object.assign(params, this.query)
      ).then((res) => {
      ).then(res => {
        const data = res.data.data;
        this.page.total = data.total;
        this.data = data.records;
        this.loading = false;
        this.$store.commit("setWindowSizeHeightAdd");
        this.selectionClear();
      });
    },
  },
    }
  }
};
</script>