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 254 },
255 255 /** 搜索按钮操作 */
256 256 handleQuery() {
  257 + this.resetForm();
257 258 // 默认选中第一个
258 259 if (this.accountId) {
259 260 this.setAccountId(this.accountId)
... ... @@ -262,7 +263,7 @@ export default {
262 263 },
263 264 /** 重置按钮操作 */
264 265 resetQuery() {
265   - this.resetForm('queryForm')
  266 + this.resetForm();
266 267 // 默认选中第一个
267 268 if (this.accounts.length > 0) {
268 269 this.setAccountId(this.accounts[0].id)
... ... @@ -302,6 +303,23 @@ export default {
302 303 });
303 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 415 this.isSubMenuActive = -1;
398 416 }).catch(() => {});
399 417 },
400   - // TODO 切换公众号时,清空;或者清空菜单时,也要清空表单;
401 418  
402 419 // ======================== 菜单编辑 ========================
403 420 handleSave() {
... ... @@ -423,7 +440,7 @@ export default {
423 440 this.loading = true
424 441 return deleteMenu(this.accountId);
425 442 }).then(() => {
426   - this.getList();
  443 + this.handleQuery();
427 444 this.$modal.msgSuccess("清空成功");
428 445 }).catch(() => {}).finally(() => {
429 446 this.loading = false
... ... @@ -494,11 +511,6 @@ export default {
494 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 515 deleteMaterial() {
504 516 this.$delete(this.tempObj,'articleId')
... ...