|
@@ -29,6 +29,7 @@
|
|
|
|
|
|
<script>
|
|
|
import {addObj, delObj, fetchMenuTree, getObj, putObj} from '@/api/admin/menu'
|
|
|
+ import { validatenull } from '@/util/validate'
|
|
|
import {mapGetters} from "vuex";
|
|
|
import {tableOption} from '@/const/crud/admin/menu'
|
|
|
|
|
@@ -56,16 +57,22 @@
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- rowSave(row, loading, done) {
|
|
|
+ rowSave(row,done,loading) {
|
|
|
+ if (validatenull(row.parentId)){
|
|
|
+ row.parentId = -1
|
|
|
+ }
|
|
|
addObj(row).then(() => {
|
|
|
- loading();
|
|
|
+ done()
|
|
|
this.onLoad();
|
|
|
this.$message.success("添加成功");
|
|
|
});
|
|
|
},
|
|
|
- rowUpdate(row, index, loading, done) {
|
|
|
+ rowUpdate(row,index, done,loading) {
|
|
|
+ if (validatenull(row.parentId)){
|
|
|
+ row.parentId = -1
|
|
|
+ }
|
|
|
putObj(row).then(() => {
|
|
|
- loading();
|
|
|
+ done()
|
|
|
this.onLoad();
|
|
|
this.$message.success("修改成功");
|
|
|
});
|