|
@@ -9,8 +9,6 @@
|
|
|
@row-del="rowDel"
|
|
|
@row-update="rowUpdate"
|
|
|
@row-save="rowSave"
|
|
|
- @current-change="currentChange"
|
|
|
- @size-change="sizeChange"
|
|
|
@on-load="onLoad">
|
|
|
<template slot-scope="scope"
|
|
|
slot="icon">
|
|
@@ -30,9 +28,9 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import { addObj, delObj, fetchMenuTree, getObj, putObj } from '@/api/admin/menu'
|
|
|
+ import {addObj, delObj, fetchMenuTree, getObj, putObj} from '@/api/admin/menu'
|
|
|
import {mapGetters} from "vuex";
|
|
|
- import { tableOption } from '@/const/crud/admin/menu'
|
|
|
+ import {tableOption} from '@/const/crud/admin/menu'
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
@@ -42,7 +40,11 @@
|
|
|
data: []
|
|
|
};
|
|
|
},
|
|
|
-
|
|
|
+ watch: {
|
|
|
+ 'form.type'() {
|
|
|
+ this.showHide()
|
|
|
+ }
|
|
|
+ },
|
|
|
computed: {
|
|
|
...mapGetters(["permissions"]),
|
|
|
permissionList() {
|
|
@@ -73,14 +75,12 @@
|
|
|
confirmButtonText: "确定",
|
|
|
cancelButtonText: "取消",
|
|
|
type: "warning"
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- return delObj(row.id);
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- this.onLoad();
|
|
|
- this.$message.success("删除成功");
|
|
|
- });
|
|
|
+ }).then(() => {
|
|
|
+ return delObj(row.id);
|
|
|
+ }).then(() => {
|
|
|
+ this.onLoad();
|
|
|
+ this.$message.success("删除成功");
|
|
|
+ });
|
|
|
},
|
|
|
beforeOpen(done, type) {
|
|
|
if (["edit", "view"].includes(type)) {
|
|
@@ -94,6 +94,25 @@
|
|
|
fetchMenuTree().then(res => {
|
|
|
this.data = res.data.data;
|
|
|
});
|
|
|
+ },
|
|
|
+ showHide(){
|
|
|
+ this.$refs.crud.option.column.filter(item => {
|
|
|
+ if (item.prop === "path") {
|
|
|
+ item.addDisplay = this.form.type === "0"
|
|
|
+ item.editDisplay = this.form.type === "0"
|
|
|
+ }
|
|
|
+ if (item.prop === "icon") {
|
|
|
+ item.addDisplay = this.form.type === "0"
|
|
|
+ item.editDisplay = this.form.type === "0"
|
|
|
+ }
|
|
|
+ if (item.prop === "code") {
|
|
|
+ item.addDisplay = this.form.type === "1"
|
|
|
+ item.editDisplay = this.form.type === "1"
|
|
|
+ }
|
|
|
+ if (item.prop === "parentId") {
|
|
|
+ item.rules[0].required = this.form.type === "1"
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
};
|