|
|
@@ -87,6 +87,7 @@
|
|
|
isAdd: false,
|
|
|
addDialog: false,
|
|
|
activeIndex: null,
|
|
|
+ subActiveIndex: null,
|
|
|
menuData: [],
|
|
|
// 常用链接
|
|
|
urlIndex: null,
|
|
|
@@ -128,12 +129,12 @@
|
|
|
this.commonUrlData = res;
|
|
|
});
|
|
|
},
|
|
|
- submitFn() {
|
|
|
+ async submitFn() {
|
|
|
console.log(this.menuData);
|
|
|
// return false;
|
|
|
- this.$service.setting.updateMenu(this.menuData).then(res => {
|
|
|
+ await this.$service.setting.updateMenu(this.menuData).then(res => {
|
|
|
this.$message.success(res.msg || '提交');
|
|
|
- this.closeOperate();
|
|
|
+ // this.closeOperate();
|
|
|
this.resetForm();
|
|
|
});
|
|
|
},
|
|
|
@@ -161,6 +162,7 @@
|
|
|
operateClickFn(item) {
|
|
|
this.isModifyParents = false;
|
|
|
this.isAdd = false;
|
|
|
+ this.subActiveIndex = item.index;
|
|
|
console.log('item', item);
|
|
|
// this.dialogData = item;
|
|
|
item.targetId = item.targetId ? parseInt(item.targetId) : 0;
|
|
|
@@ -177,7 +179,7 @@
|
|
|
this.addDialog = true;
|
|
|
if (this.$refs['form']) {
|
|
|
console.log('asdf');
|
|
|
- this.$refs['form'].resetFields();
|
|
|
+ this.resetForm()
|
|
|
}
|
|
|
},
|
|
|
operateDelFn(index) {
|
|
|
@@ -190,6 +192,7 @@
|
|
|
closeOperate() {
|
|
|
this.activeIndex = null;
|
|
|
this.operateShow = this.operateShow.map(e => (e = false));
|
|
|
+ this.addDialog = false;
|
|
|
// if (this.addDialog) {
|
|
|
// this.resetForm();
|
|
|
// }
|
|
|
@@ -212,19 +215,36 @@
|
|
|
} else {
|
|
|
// 如果是子菜单操作时
|
|
|
if (this.isAdd) {
|
|
|
+ this.$set(this.operateShow, this.activeIndex, false);
|
|
|
this.operateData.push(form);
|
|
|
} else {
|
|
|
- this.operateData = form;
|
|
|
+ this.operateData[this.subActiveIndex] = form;
|
|
|
}
|
|
|
+
|
|
|
+ console.log('this.operateData', this.operateData)
|
|
|
+
|
|
|
+ this.menuData[this.activeIndex].children = JSON.parse(JSON.stringify(this.operateData));
|
|
|
}
|
|
|
- setTimeout(() => {
|
|
|
- this.$set(this.operateShow, this.activeIndex, true);
|
|
|
+ this.submitFn().then(res => {
|
|
|
+ console.log('this.activeIndex', this.activeIndex);
|
|
|
+
|
|
|
+ this.addDialog = false;
|
|
|
+ if (this.isAdd) {
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$set(this.operateShow, this.activeIndex, true);
|
|
|
+ });
|
|
|
+ }
|
|
|
});
|
|
|
- this.submitFn();
|
|
|
},
|
|
|
resetForm() {
|
|
|
+ this.form = {
|
|
|
+ name: '',
|
|
|
+ menuOption: '0',
|
|
|
+ replyUrl: '',
|
|
|
+ targetId: 0
|
|
|
+ };
|
|
|
this.$refs['form'].resetFields();
|
|
|
- this.addDialog = false;
|
|
|
+ // this.addDialog = false;
|
|
|
}
|
|
|
}
|
|
|
};
|