Bläddra i källkod

:zap: 修复菜单和机构模块关闭编辑界面再打开新增界面数据没有清空的问题

smallchill 5 år sedan
förälder
incheckning
141ab2c334
2 ändrade filer med 18 tillägg och 32 borttagningar
  1. 9 16
      src/views/system/dept.vue
  2. 9 16
      src/views/system/menu.vue

+ 9 - 16
src/views/system/dept.vue

@@ -132,6 +132,7 @@
               dicData: [],
               type: "tree",
               hide: true,
+              addDisabled: false,
               props: {
                 label: "title"
               },
@@ -212,13 +213,10 @@
         });
       },
       handleAdd(row) {
-        this.$refs.crud.value.parentId = row.id;
-        this.$refs.crud.option.column.filter(item => {
-          if (item.prop === "parentId") {
-            item.value = row.id;
-            item.addDisabled = true;
-          }
-        });
+        this.parentId = row.id;
+        const column = this.findObject(this.option.column, "parentId");
+        column.value = row.id;
+        column.addDisabled = true;
         this.$refs.crud.rowAdd();
       },
       rowSave(row, done, loading) {
@@ -328,15 +326,10 @@
         done();
       },
       beforeClose(done) {
-        this.$refs.crud.tableForm = {};
-        this.$refs.crud.value.parentId = "";
-        this.$refs.crud.value.addDisabled = false;
-        this.$refs.crud.option.column.filter(item => {
-          if (item.prop === "parentId") {
-            item.value = "";
-            item.addDisabled = false;
-          }
-        });
+        this.parentId = "";
+        const column = this.findObject(this.option.column, "parentId");
+        column.value = "";
+        column.addDisabled = false;
         done();
       },
       currentChange(currentPage) {

+ 9 - 16
src/views/system/menu.vue

@@ -112,6 +112,7 @@
               type: "tree",
               dicData: [],
               hide: true,
+              addDisabled: false,
               props: {
                 label: "title"
               },
@@ -274,13 +275,10 @@
         });
       },
       handleAdd(row) {
-        this.$refs.crud.value.parentId = row.id;
-        this.$refs.crud.option.column.filter(item => {
-          if (item.prop === "parentId") {
-            item.value = row.id;
-            item.addDisabled = true;
-          }
-        });
+        this.parentId = row.id;
+        const column = this.findObject(this.option.column, "parentId");
+        column.value = row.id;
+        column.addDisabled = true;
         this.$refs.crud.rowAdd();
       },
       rowSave(row, done, loading) {
@@ -388,15 +386,10 @@
         done();
       },
       beforeClose(done) {
-        this.$refs.crud.tableForm = {};
-        this.$refs.crud.value.parentId = "";
-        this.$refs.crud.value.addDisabled = false;
-        this.$refs.crud.option.column.filter(item => {
-          if (item.prop === "parentId") {
-            item.value = "";
-            item.addDisabled = false;
-          }
-        });
+        this.parentId = "";
+        const column = this.findObject(this.option.column, "parentId");
+        column.value = "";
+        column.addDisabled = false;
         done();
       },
       currentChange(currentPage) {