|
@@ -9,7 +9,7 @@
|
|
|
@row-del="rowDel"
|
|
|
@row-update="rowUpdate"
|
|
|
@row-save="rowSave"
|
|
|
- @on-load="onLoad">
|
|
|
+ @tree-load="treeLoad">
|
|
|
<template slot-scope="scope"
|
|
|
slot="icon">
|
|
|
<div style="text-align:center">
|
|
@@ -19,7 +19,7 @@
|
|
|
<template slot-scope="scope"
|
|
|
slot="type">
|
|
|
<div style="text-align:center">
|
|
|
- <el-tag v-if="scope.row.type === '0'" size="small" type="success">菜单</el-tag>
|
|
|
+ <el-tag v-if="scope.row.type !== '1'" size="small" type="success">菜单</el-tag>
|
|
|
<el-tag v-else-if="scope.row.type === '1'" size="small" type="info">按钮</el-tag>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -38,9 +38,13 @@
|
|
|
return {
|
|
|
form: {},
|
|
|
option: tableOption,
|
|
|
+ lazy:true,
|
|
|
data: []
|
|
|
};
|
|
|
},
|
|
|
+ created() {
|
|
|
+ this.onLoad()
|
|
|
+ },
|
|
|
watch: {
|
|
|
'form.type'() {
|
|
|
this.showHide()
|
|
@@ -98,24 +102,47 @@
|
|
|
done();
|
|
|
},
|
|
|
onLoad() {
|
|
|
- fetchMenuTree().then(res => {
|
|
|
+ fetchMenuTree(this.option.lazy).then(res => {
|
|
|
this.data = res.data.data;
|
|
|
});
|
|
|
},
|
|
|
+ treeLoad(node, child, resolve){
|
|
|
+ fetchMenuTree(this.option.lazy, node.id).then(res => {
|
|
|
+ resolve(res.data.data)
|
|
|
+ })
|
|
|
+ },
|
|
|
showHide(){
|
|
|
this.$refs.crud.option.column.filter(item => {
|
|
|
+ // 不是按钮类型 要输入path
|
|
|
if (item.prop === "path") {
|
|
|
- item.addDisplay = this.form.type === "0"
|
|
|
- item.editDisplay = this.form.type === "0"
|
|
|
+ item.addDisplay = this.form.type !== "1"
|
|
|
+ item.editDisplay = this.form.type !== "1"
|
|
|
}
|
|
|
+ // 不是按钮类型 要输入path
|
|
|
if (item.prop === "icon") {
|
|
|
- item.addDisplay = this.form.type === "0"
|
|
|
- item.editDisplay = this.form.type === "0"
|
|
|
+ item.addDisplay = this.form.type !== "1"
|
|
|
+ item.editDisplay = this.form.type !== "1"
|
|
|
+ }
|
|
|
+
|
|
|
+ // 是按钮类型输入code
|
|
|
+ if (item.prop === "code") {
|
|
|
+ item.addDisplay = this.form.type === "1"
|
|
|
+ item.editDisplay = this.form.type === "1"
|
|
|
}
|
|
|
+
|
|
|
+ // 是按钮类型输入code
|
|
|
if (item.prop === "code") {
|
|
|
item.addDisplay = this.form.type === "1"
|
|
|
item.editDisplay = this.form.type === "1"
|
|
|
}
|
|
|
+
|
|
|
+ // 是顶部菜单不显示上级菜单
|
|
|
+ if (item.prop === "parentId") {
|
|
|
+ item.addDisplay = this.form.type !== "2"
|
|
|
+ item.editDisplay = this.form.type !== "2"
|
|
|
+ }
|
|
|
+
|
|
|
+ // 是按钮类型输入 上级菜单
|
|
|
if (item.prop === "parentId") {
|
|
|
item.rules[0].required = this.form.type === "1"
|
|
|
}
|