From 2316d93843b62c1adccfcfa6e052c32eea6df663 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8C=BF=E5=B0=8F=E5=A4=A9?= <1638245306@qq.com> Date: Sat, 11 Jun 2022 20:48:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=8F=98=E5=8C=96:=20?= =?UTF-8?q?=E4=BC=98=E5=8C=96table-seletor=E9=80=89=E6=8B=A9=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/application/settings.py | 1 + .../table-selector/table-selector.vue | 54 ++++++------------- 2 files changed, 17 insertions(+), 38 deletions(-) diff --git a/backend/application/settings.py b/backend/application/settings.py index c8ce5e9..d88d9af 100644 --- a/backend/application/settings.py +++ b/backend/application/settings.py @@ -378,4 +378,5 @@ PLUGINS_URL_PATTERNS = [] # from dvadmin_upgrade_center.settings import * # 升级中心 # from dvadmin_celery.settings import * # celery 异步任务 # ... +from dvadmin_drag_h5.settings import * # ********** 一键导入插件配置结束 ********** diff --git a/web/src/components/table-selector/table-selector.vue b/web/src/components/table-selector/table-selector.vue index 0aeda52..45833ad 100644 --- a/web/src/components/table-selector/table-selector.vue +++ b/web/src/components/table-selector/table-selector.vue @@ -201,6 +201,7 @@ export default { // this.dict = d2CrudPlus.util.dict.mergeDefault(this.dict, true) // } // this.initData() + console.log(this) }, computed: { _elProps () { @@ -327,32 +328,23 @@ export default { this.$emit('current-change', event) }, openDialog () { - if (this.disabled) { + const that = this + if (that.disabled) { return } - this.dialogVisible = true - setTimeout(() => { - if (this.selected != null) { - const ids = this.selected.map( - (item) => item[this._elProps.props.value] - ) - ids.forEach((id) => { - const current = this.$refs.elTree.store.nodesMap[id] - if (current != null) { - this.doExpandParent(current) - } - }) - this.$nextTick(() => { - if (this.multiple) { - // this.$refs.elTree.setCheckedKeys(ids, this.leafOnly); - this.$refs.elTree.setCheckboxRow(ids) - } else if (ids.length > 0) { - // this.$refs.elTree.setCurrentKey(ids[0]); - this.$refs.elTree.setRadioRow(ids[0]) - } - }) - } - }, 1) + that.dialogVisible = true + if (that.value != null) { + that.$nextTick(() => { + const refs = Object.assign({}, that.$refs) + const { elTree } = refs + console.log(elTree) + if (that.multiple) { + elTree.setCheckboxRow(that.selected, true) + } else { + elTree.setRadioRow(that.selected[0]) + } + }) + } }, doExpandParent (node) { if (node.parent != null) { @@ -412,20 +404,6 @@ export default { // 获取选中的行数据 refreshSelected () { let nodes = null - // if (this.multiple) { - // nodes = this.$refs.elTree.getCheckedNodes( - // this.leafOnly, - // this.includeHalfChecked - // ); - // } else { - // const node = this.$refs.elTree.getCurrentNode(); - // if (node == null) { - // nodes = []; - // } else { - // nodes = [node]; - // } - // } - if (this.multiple) { nodes = this.$refs.elTree.getCheckboxRecords() } else {