|
@@ -29,7 +29,7 @@
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import {addObj, delObj, fetchMenuTree, getObj, putObj} from '@/api/admin/menu'
|
|
import {addObj, delObj, fetchMenuTree, getObj, putObj} from '@/api/admin/menu'
|
|
- import { validatenull } from '@/util/validate'
|
|
|
|
|
|
+ import {validatenull} from '@/util/validate'
|
|
import {mapGetters} from "vuex";
|
|
import {mapGetters} from "vuex";
|
|
import {tableOption} from '@/const/crud/admin/menu'
|
|
import {tableOption} from '@/const/crud/admin/menu'
|
|
|
|
|
|
@@ -38,7 +38,7 @@
|
|
return {
|
|
return {
|
|
form: {},
|
|
form: {},
|
|
option: tableOption,
|
|
option: tableOption,
|
|
- lazy:true,
|
|
|
|
|
|
+ lazy: true,
|
|
data: []
|
|
data: []
|
|
};
|
|
};
|
|
},
|
|
},
|
|
@@ -61,27 +61,26 @@
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- rowSave(row,done,loading) {
|
|
|
|
- if (validatenull(row.parentId)){
|
|
|
|
|
|
+ rowSave(row, done) {
|
|
|
|
+ if (validatenull(row.parentId)) {
|
|
row.parentId = -1
|
|
row.parentId = -1
|
|
}
|
|
}
|
|
- addObj(row).then(() => {
|
|
|
|
- done()
|
|
|
|
- this.onLoad();
|
|
|
|
|
|
+ addObj(row).then(res => {
|
|
|
|
+ row.id = res.data.data.menuId;
|
|
|
|
+ done(row);
|
|
this.$message.success("添加成功");
|
|
this.$message.success("添加成功");
|
|
});
|
|
});
|
|
},
|
|
},
|
|
- rowUpdate(row,index, done,loading) {
|
|
|
|
- if (validatenull(row.parentId)){
|
|
|
|
|
|
+ rowUpdate(row, index, done, loading) {
|
|
|
|
+ if (validatenull(row.parentId)) {
|
|
row.parentId = -1
|
|
row.parentId = -1
|
|
}
|
|
}
|
|
putObj(row).then(() => {
|
|
putObj(row).then(() => {
|
|
- done()
|
|
|
|
- this.onLoad();
|
|
|
|
|
|
+ done(row)
|
|
this.$message.success("修改成功");
|
|
this.$message.success("修改成功");
|
|
});
|
|
});
|
|
},
|
|
},
|
|
- rowDel(row) {
|
|
|
|
|
|
+ rowDel(row, index, done) {
|
|
this.$confirm("确定将选择数据删除?", {
|
|
this.$confirm("确定将选择数据删除?", {
|
|
confirmButtonText: "确定",
|
|
confirmButtonText: "确定",
|
|
cancelButtonText: "取消",
|
|
cancelButtonText: "取消",
|
|
@@ -89,7 +88,7 @@
|
|
}).then(() => {
|
|
}).then(() => {
|
|
return delObj(row.id);
|
|
return delObj(row.id);
|
|
}).then(() => {
|
|
}).then(() => {
|
|
- this.onLoad();
|
|
|
|
|
|
+ done(row);
|
|
this.$message.success("删除成功");
|
|
this.$message.success("删除成功");
|
|
});
|
|
});
|
|
},
|
|
},
|
|
@@ -103,16 +102,15 @@
|
|
},
|
|
},
|
|
onLoad() {
|
|
onLoad() {
|
|
fetchMenuTree(this.option.lazy).then(res => {
|
|
fetchMenuTree(this.option.lazy).then(res => {
|
|
- debugger
|
|
|
|
this.data = res.data.data;
|
|
this.data = res.data.data;
|
|
});
|
|
});
|
|
},
|
|
},
|
|
- treeLoad(node, child, resolve){
|
|
|
|
|
|
+ treeLoad(node, child, resolve) {
|
|
fetchMenuTree(this.option.lazy, node.id).then(res => {
|
|
fetchMenuTree(this.option.lazy, node.id).then(res => {
|
|
resolve(res.data.data)
|
|
resolve(res.data.data)
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- showHide(){
|
|
|
|
|
|
+ showHide() {
|
|
this.$refs.crud.option.column.filter(item => {
|
|
this.$refs.crud.option.column.filter(item => {
|
|
// 不是按钮类型 要输入path
|
|
// 不是按钮类型 要输入path
|
|
if (item.prop === "path") {
|
|
if (item.prop === "path") {
|
|
@@ -135,10 +133,6 @@
|
|
if (item.prop === "parentId") {
|
|
if (item.prop === "parentId") {
|
|
item.addDisplay = this.form.type !== "2"
|
|
item.addDisplay = this.form.type !== "2"
|
|
item.editDisplay = this.form.type !== "2"
|
|
item.editDisplay = this.form.type !== "2"
|
|
- }
|
|
|
|
-
|
|
|
|
- // 是按钮类型输入 上级菜单
|
|
|
|
- if (item.prop === "parentId") {
|
|
|
|
item.rules[0].required = this.form.type === "1"
|
|
item.rules[0].required = this.form.type === "1"
|
|
}
|
|
}
|
|
|
|
|