|
@@ -20,6 +20,7 @@
|
|
|
default-expand-all
|
|
|
:expand-on-click-node="false"
|
|
|
check-strictly
|
|
|
+ :draggable="false"
|
|
|
:filter-node-method="menuFilterNode"
|
|
|
@node-click="menuClick"
|
|
|
@node-drop="nodeDrop"
|
|
@@ -78,6 +79,7 @@ export default {
|
|
|
children: "Children",
|
|
|
},
|
|
|
menuFilterText: "",
|
|
|
+ authorityList: [],
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
@@ -94,6 +96,9 @@ export default {
|
|
|
this.menuloading = true;
|
|
|
var menuList = await this.$API.wing.post("GetUserFeatureList");
|
|
|
this.menuList = menuList;
|
|
|
+ this.authorityList = await this.$API.wing.post(
|
|
|
+ "GetUserFeatureSelectList"
|
|
|
+ );
|
|
|
this.menuloading = false;
|
|
|
},
|
|
|
//树点击
|
|
@@ -101,7 +106,7 @@ export default {
|
|
|
if (!data.MenuId) {
|
|
|
data.MenuId = data.Id;
|
|
|
}
|
|
|
- this.$refs.save.setData(data, true);
|
|
|
+ this.$refs.save.setData(data, this.authorityList);
|
|
|
this.$refs.main.$el.scrollTop = 0;
|
|
|
},
|
|
|
//树过滤
|
|
@@ -112,13 +117,6 @@ export default {
|
|
|
}`;
|
|
|
return targetText.indexOf(value) !== -1;
|
|
|
},
|
|
|
- //树拖拽
|
|
|
- nodeDrop(draggingNode, dropNode, dropType) {
|
|
|
- this.$refs.save.setData({});
|
|
|
- this.$message(
|
|
|
- `拖拽对象:${draggingNode.data.meta.title}, 释放对象:${dropNode.data.meta.title}, 释放对象的位置:${dropType}`
|
|
|
- );
|
|
|
- },
|
|
|
//增加
|
|
|
async add(node) {
|
|
|
var newMenuData = {
|
|
@@ -126,46 +124,9 @@ export default {
|
|
|
Label: `未命名${newMenuIndex++}`,
|
|
|
FatherCode: node?.data?.Id,
|
|
|
};
|
|
|
-
|
|
|
this.$refs.menu.append(newMenuData, node);
|
|
|
this.$refs.menu.setCurrentKey(newMenuData.MenuId);
|
|
|
- this.$refs.save.setData(newMenuData);
|
|
|
- },
|
|
|
- //删除菜单
|
|
|
- async delMenu() {
|
|
|
- var CheckedNodes = this.$refs.menu.getCheckedNodes();
|
|
|
- if (CheckedNodes.length == 0) {
|
|
|
- this.$message.warning("请选择需要删除的项");
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- var confirm = await this.$confirm("确认删除已选择的菜单吗?", "提示", {
|
|
|
- type: "warning",
|
|
|
- confirmButtonText: "删除",
|
|
|
- confirmButtonClass: "el-button--danger",
|
|
|
- }).catch(() => {});
|
|
|
- if (confirm != "confirm") {
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- this.menuloading = true;
|
|
|
- var reqData = {
|
|
|
- ids: CheckedNodes.map((item) => item.id),
|
|
|
- };
|
|
|
- var res = await this.$API.demo.post.post(reqData);
|
|
|
- this.menuloading = false;
|
|
|
-
|
|
|
- if (res.code == 200) {
|
|
|
- CheckedNodes.forEach((item) => {
|
|
|
- var node = this.$refs.menu.getNode(item);
|
|
|
- if (node.isCurrent) {
|
|
|
- this.$refs.save.setData({});
|
|
|
- }
|
|
|
- this.$refs.menu.remove(item);
|
|
|
- });
|
|
|
- } else {
|
|
|
- this.$message.warning(res.message);
|
|
|
- }
|
|
|
+ this.$refs.save.setData(newMenuData, this.authorityList);
|
|
|
},
|
|
|
},
|
|
|
};
|