Commit 0e75a67f2811ba3dd9f83441fd03c1df3e1bcc0d

Authored by YunaiV
1 parent b5815a62

mp:菜单的清空处理

yudao-ui-admin/src/views/mp/menu/index.vue
@@ -254,6 +254,7 @@ export default { @@ -254,6 +254,7 @@ export default {
254 }, 254 },
255 /** 搜索按钮操作 */ 255 /** 搜索按钮操作 */
256 handleQuery() { 256 handleQuery() {
  257 + this.resetForm();
257 // 默认选中第一个 258 // 默认选中第一个
258 if (this.accountId) { 259 if (this.accountId) {
259 this.setAccountId(this.accountId) 260 this.setAccountId(this.accountId)
@@ -262,7 +263,7 @@ export default { @@ -262,7 +263,7 @@ export default {
262 }, 263 },
263 /** 重置按钮操作 */ 264 /** 重置按钮操作 */
264 resetQuery() { 265 resetQuery() {
265 - this.resetForm('queryForm') 266 + this.resetForm();
266 // 默认选中第一个 267 // 默认选中第一个
267 if (this.accounts.length > 0) { 268 if (this.accounts.length > 0) {
268 this.setAccountId(this.accounts[0].id) 269 this.setAccountId(this.accounts[0].id)
@@ -302,6 +303,23 @@ export default { @@ -302,6 +303,23 @@ export default {
302 }); 303 });
303 return menuList; 304 return menuList;
304 }, 305 },
  306 + // 重置表单,清空表单数据
  307 + resetForm() {
  308 + // 菜单操作
  309 + this.isActive = -1;
  310 + this.isSubMenuActive = -1;
  311 + this.isSubMenuFlag = -1;
  312 +
  313 + // 菜单编辑
  314 + this.showRightFlag = false;
  315 + this.nameMaxLength = 0;
  316 + this.showConfigureContent = 0;
  317 + this.hackResetWxReplySelect = true;
  318 + this.hackResetWxReplySelect = false;
  319 + this.tempObj = {};
  320 + this.tempSelfObj = {};
  321 + this.dialogNewsVisible = false;
  322 + },
305 323
306 // ======================== 菜单操作 ======================== 324 // ======================== 菜单操作 ========================
307 // 一级菜单点击事件 325 // 一级菜单点击事件
@@ -397,7 +415,6 @@ export default { @@ -397,7 +415,6 @@ export default {
397 this.isSubMenuActive = -1; 415 this.isSubMenuActive = -1;
398 }).catch(() => {}); 416 }).catch(() => {});
399 }, 417 },
400 - // TODO 切换公众号时,清空;或者清空菜单时,也要清空表单;  
401 418
402 // ======================== 菜单编辑 ======================== 419 // ======================== 菜单编辑 ========================
403 handleSave() { 420 handleSave() {
@@ -423,7 +440,7 @@ export default { @@ -423,7 +440,7 @@ export default {
423 this.loading = true 440 this.loading = true
424 return deleteMenu(this.accountId); 441 return deleteMenu(this.accountId);
425 }).then(() => { 442 }).then(() => {
426 - this.getList(); 443 + this.handleQuery();
427 this.$modal.msgSuccess("清空成功"); 444 this.$modal.msgSuccess("清空成功");
428 }).catch(() => {}).finally(() => { 445 }).catch(() => {}).finally(() => {
429 this.loading = false 446 this.loading = false
@@ -494,11 +511,6 @@ export default { @@ -494,11 +511,6 @@ export default {
494 url: article.url, 511 url: article.url,
495 }) 512 })
496 }) 513 })
497 - // this.tempObj.mediaName = item.name  
498 - // this.tempObj.url = item.url  
499 - // item.mediaType = this.tempObj.mediaType  
500 - // item.content.articles = item.content.articles.slice(0,1)  
501 - // this.tempObj.content = item.content  
502 }, 514 },
503 deleteMaterial() { 515 deleteMaterial() {
504 this.$delete(this.tempObj,'articleId') 516 this.$delete(this.tempObj,'articleId')