|
@@ -94,6 +94,7 @@ export default {
|
|
|
tableList: [], // 数据列表
|
|
|
formLabelWidth: '100px',
|
|
|
branchStatus: false,
|
|
|
+ operationType: 'create',
|
|
|
form: {
|
|
|
name: null,
|
|
|
path: null,
|
|
@@ -124,8 +125,8 @@ export default {
|
|
|
*/
|
|
|
onOperation (type, row) {
|
|
|
this.branchStatus = true
|
|
|
+ this.operationType = type
|
|
|
if (type == 'update') {
|
|
|
- console.log(row)
|
|
|
this.form = {
|
|
|
name: row.name,
|
|
|
path: row.path,
|
|
@@ -133,29 +134,42 @@ export default {
|
|
|
parentId: row.parentId,
|
|
|
sort: row.sort,
|
|
|
component: row.component,
|
|
|
+ id: row.id
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
onBranchSubmit (type) {
|
|
|
let form = this.form
|
|
|
- addSilder({
|
|
|
- path: form.path,
|
|
|
- component: form.component,
|
|
|
- name: form.name,
|
|
|
- permission: form.permission,
|
|
|
- sort: form.sort,
|
|
|
- parentId: form.parentId,
|
|
|
- hidden: form.hidden
|
|
|
- }).then(res => {
|
|
|
- if (res.code == 200) {
|
|
|
- this.$message({
|
|
|
- message: '添加成功',
|
|
|
- type: 'success'
|
|
|
- })
|
|
|
- this.lookSilder()
|
|
|
- this.branchStatus = false
|
|
|
- }
|
|
|
- })
|
|
|
+ if (this.operationType == 'create') {
|
|
|
+ addSilder({
|
|
|
+ path: form.path,
|
|
|
+ component: form.component,
|
|
|
+ name: form.name,
|
|
|
+ permission: form.permission,
|
|
|
+ sort: form.sort,
|
|
|
+ parentId: form.parentId
|
|
|
+ }).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message({
|
|
|
+ message: '添加成功',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ this.lookSilder()
|
|
|
+ this.branchStatus = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else if (this.operationType == 'update') {
|
|
|
+ resetSilder(form).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message({
|
|
|
+ message: '修改成功',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ this.lookSilder()
|
|
|
+ this.branchStatus = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
lookSilder () {
|
|
@@ -176,7 +190,8 @@ export default {
|
|
|
permission: res.permission,
|
|
|
icon: res.icon,
|
|
|
parentId: res.parentId,
|
|
|
- hidden: res.hidden
|
|
|
+ component: res.component,
|
|
|
+ sort: res.sort
|
|
|
}
|
|
|
if (res.sysMenus && res.sysMenus.length > 0) {
|
|
|
tempList.children = this.setTableData(res.sysMenus)
|
|
@@ -187,7 +202,14 @@ export default {
|
|
|
},
|
|
|
onDelete (row) { // 删除左则菜单
|
|
|
deleteSilder(row.id).then(res => {
|
|
|
- console.log(res);
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message({
|
|
|
+ message: '删除成功',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ this.lookSilder()
|
|
|
+ this.branchStatus = false
|
|
|
+ }
|
|
|
})
|
|
|
},
|
|
|
onFormClose (formName) { // 关闭弹窗重置验证
|