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 360ec6ea..8c23ea40 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) => {