From a3ef3fb5cfb33d11d97cf13dbd66d3fcab13134a Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Thu, 24 Oct 2024 12:10:20 +0800 Subject: [PATCH] chore: --- .../plugins/common/remote-select.vue | 42 ++++++++++++------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/packages/ui/certd-client/src/components/plugins/common/remote-select.vue b/packages/ui/certd-client/src/components/plugins/common/remote-select.vue index 360ec6eac..8c23ea406 100644 --- a/packages/ui/certd-client/src/components/plugins/common/remote-select.vue +++ b/packages/ui/certd-client/src/components/plugins/common/remote-select.vue @@ -12,10 +12,10 @@ @update:value="emit('update:value', $event)" />
- +
-
+
{{ message }}
@@ -42,23 +42,35 @@ const attrs = useAttrs(); const optionsRef = ref([]); const message = ref(""); +const hasError = ref(false); +const loading = ref(false); const getOptions = async () => { message.value = ""; - const res = await doRequest( - { - type: props.type, - typeName: props.typeName, - action: props.action, - input: props.form - }, - { - onError(err: any) { - message.value = `获取选项出错:${err.message}`; + hasError.value = false; + loading.value = true; + try { + const res = await doRequest( + { + type: props.type, + typeName: props.typeName, + action: props.action, + input: props.form }, - showErrorNotify: false + { + onError(err: any) { + hasError.value = true; + message.value = `获取选项出错:${err.message}`; + }, + showErrorNotify: false + } + ); + if (res && res.length > 0) { + message.value = "获取数据成功,请从下拉框中选择"; } - ); - return res; + return res; + } finally { + loading.value = false; + } }; const filterOption = (input: string, option: any) => {