lalala 6 лет назад
Родитель
Сommit
4b786ee8a6

+ 0 - 1
admin-update/src/components/module/operate-line.vue

@@ -16,7 +16,6 @@
 			<div
 				class="operate-list operate-list-add"
 				@click="addFn()"
-				v-show="(data.children || []).length < 5"
 			>
 				<i class="iconfont icontupiantianjia icon-add"></i>
 			</div>

+ 29 - 14
admin-update/src/views/setting/wx-menu.vue

@@ -173,18 +173,38 @@
 				this.addDialog = true;
 			},
 			operateAddFn(index) {
-				this.isModifyParents = false;
-				this.isAdd = true;
-				// this.dialogData = this.menuData[3].children[index];
-				this.addDialog = true;
-				if (this.$refs['form']) {
-					console.log('asdf');
-					this.resetForm()
+				if (this.operateData.length > 4) {
+					this.$message.warning('亲,最多只能设置五个子菜单!')
+					return false
 				}
+				// this.isModifyParents = false;
+
+				let form = {
+					name: '子菜单名',
+					menuOption: '0',
+					replyUrl: '',
+					targetId: 0
+				};
+				
+				this.$set(this.operateShow, this.activeIndex, false);
+				this.operateData.push(form);
+				this.menuData[this.activeIndex].children = JSON.parse(JSON.stringify(this.operateData));
+
+				setTimeout(() => {
+					this.$set(this.operateShow, this.activeIndex, true);
+				});
+				// this.isAdd = true;
+				// this.dialogData = this.menuData[3].children[index];
+				// this.addDialog = true;
+				// if (this.$refs['form']) {
+				// 	console.log('asdf');
+				// 	this.resetForm()
+				// }
 			},
 			operateDelFn(index) {
 				console.log('我点击了删除按钮!', index)
 				// this.closeOperate();
+				this.$set(this.operateShow, this.activeIndex, false);
 				this.operateData.splice(index, 1);
 				
 				this.menuData[this.activeIndex].children = JSON.parse(JSON.stringify(this.operateData));
@@ -219,8 +239,6 @@
 				} else {
 					// 如果是子菜单操作时
 					if (this.isAdd) {
-						this.$set(this.operateShow, this.activeIndex, false);
-						this.operateData.push(form);
 					} else {
 						this.operateData[this.subActiveIndex] = form;
 					}
@@ -233,11 +251,8 @@
 					console.log('this.activeIndex', this.activeIndex);
 					
 					this.addDialog = false;
-					if (this.isAdd) {
-						setTimeout(() => {
-							this.$set(this.operateShow, this.activeIndex, true);
-						});
-					}
+					// if (this.isAdd) {
+					// }
 				});
 			},
 			resetForm() {