diff --git a/src/views/system/dept.vue b/src/views/system/dept.vue index a4b9a24..c62272e 100644 --- a/src/views/system/dept.vue +++ b/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) { diff --git a/src/views/system/menu.vue b/src/views/system/menu.vue index c72cd97..8afdb50 100644 --- a/src/views/system/menu.vue +++ b/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) {