mirror of https://github.com/certd/certd
chore:
parent
d782655cb4
commit
a3ef3fb5cf
|
@ -12,10 +12,10 @@
|
||||||
@update:value="emit('update:value', $event)"
|
@update:value="emit('update:value', $event)"
|
||||||
/>
|
/>
|
||||||
<div class="ml-5">
|
<div class="ml-5">
|
||||||
<fs-button title="刷新选项" icon="ion:refresh-outline" @click="refreshOptions"></fs-button>
|
<fs-button :loading="loading" title="刷新选项" icon="ion:refresh-outline" @click="refreshOptions"></fs-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="helper error">
|
<div class="helper" :class="{ error: hasError }">
|
||||||
{{ message }}
|
{{ message }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -42,23 +42,35 @@ const attrs = useAttrs();
|
||||||
|
|
||||||
const optionsRef = ref([]);
|
const optionsRef = ref([]);
|
||||||
const message = ref("");
|
const message = ref("");
|
||||||
|
const hasError = ref(false);
|
||||||
|
const loading = ref(false);
|
||||||
const getOptions = async () => {
|
const getOptions = async () => {
|
||||||
message.value = "";
|
message.value = "";
|
||||||
const res = await doRequest(
|
hasError.value = false;
|
||||||
{
|
loading.value = true;
|
||||||
type: props.type,
|
try {
|
||||||
typeName: props.typeName,
|
const res = await doRequest(
|
||||||
action: props.action,
|
{
|
||||||
input: props.form
|
type: props.type,
|
||||||
},
|
typeName: props.typeName,
|
||||||
{
|
action: props.action,
|
||||||
onError(err: any) {
|
input: props.form
|
||||||
message.value = `获取选项出错:${err.message}`;
|
|
||||||
},
|
},
|
||||||
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) => {
|
const filterOption = (input: string, option: any) => {
|
||||||
|
|
Loading…
Reference in New Issue