From 949c3c570463d8ba52052ee0c2d4f22b3a7965e1 Mon Sep 17 00:00:00 2001 From: likunming Date: Tue, 12 Nov 2024 16:25:54 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E4=BF=AE=E5=A4=8D=E7=BB=A7=E6=89=BF?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E4=BC=9A=E8=A7=A6=E5=8F=91afterEditorOpen?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E9=97=AE=E9=A2=98=E3=80=82=202=E3=80=81?= =?UTF-8?q?=E4=BF=AE=E5=A4=8Ddb-click-operation=E9=85=8D=E7=BD=AE=E7=9A=84?= =?UTF-8?q?=E6=8C=89=E9=92=AEenableIf=E8=BF=94=E5=9B=9Efalse=E6=97=B6?= =?UTF-8?q?=E4=BB=8D=E7=84=B6=E4=BC=9A=E8=A2=AB=E8=B0=83=E7=94=A8=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../platform/components/select/WGridSelect.vue | 6 +++--- .../platform/components/toolbar/WToolbar.vue | 18 +++++++++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/io.sc.platform.core.frontend/src/platform/components/select/WGridSelect.vue b/io.sc.platform.core.frontend/src/platform/components/select/WGridSelect.vue index 730dd1af..d4029405 100644 --- a/io.sc.platform.core.frontend/src/platform/components/select/WGridSelect.vue +++ b/io.sc.platform.core.frontend/src/platform/components/select/WGridSelect.vue @@ -312,13 +312,13 @@ const rowClick = (args) => { watch( () => modelValue.value, - (newVal, oldVal) => { - fieldMethodsClass.updateValue(newVal); + async (newVal, oldVal) => { if (Tools.isEmpty(newVal)) { fieldMethodsClass.clearObjectValue(); } else if (newVal !== oldVal && needFetchData.value) { - fetchData(newVal); + await fetchData(newVal); } + fieldMethodsClass.updateValue(newVal); }, ); diff --git a/io.sc.platform.core.frontend/src/platform/components/toolbar/WToolbar.vue b/io.sc.platform.core.frontend/src/platform/components/toolbar/WToolbar.vue index 6f64f5a7..97e766ff 100644 --- a/io.sc.platform.core.frontend/src/platform/components/toolbar/WToolbar.vue +++ b/io.sc.platform.core.frontend/src/platform/components/toolbar/WToolbar.vue @@ -452,7 +452,6 @@ const tickedComputed = computed(() => { }); const buttonClick = async (button) => { - let beforeResult = true; const context = {}; const args = { selected: firstSelectedComputed.value, @@ -463,16 +462,29 @@ const buttonClick = async (button) => { context: context, selectedColName: props.grid.getSelectedCell()['colName'], }; + if (button.enableIf && !button.enableIf(args)) { + return; + } + let beforeResult = true; if (button.beforeClick) { beforeResult = await button.beforeClick(args); } if (beforeResult && button.click) { - await button.click({ ...args, _click: button._click }); + let callAfterEditorOpen = true; + const clickProps = { ...args }; + if (button._click) { + callAfterEditorOpen = false; + clickProps['_click'] = (_args: any) => { + button._click(_args || args); + callAfterEditorOpen = true; + }; + } + await button.click(clickProps); nextTick(async () => { if (button.afterClick) { await button.afterClick(args); } - if (button.afterEditorOpen) { + if (button.afterEditorOpen && callAfterEditorOpen) { button.afterEditorOpen(args); } });