rebuild(stage-5): establish market data gateway and charts
This commit is contained in:
@@ -16,6 +16,9 @@ const statuses = ref<CredentialStatus[]>([]);
|
||||
const values = reactive<Record<string, string>>({});
|
||||
const loading = ref(true);
|
||||
const errorMessage = ref("");
|
||||
const syncing = ref(false);
|
||||
const syncResult = ref("");
|
||||
const syncError = ref("");
|
||||
|
||||
async function load(): Promise<void> {
|
||||
loading.value = true;
|
||||
@@ -45,6 +48,23 @@ async function save(name: string): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
async function syncReference(): Promise<void> {
|
||||
syncing.value = true;
|
||||
syncError.value = "";
|
||||
syncResult.value = "";
|
||||
try {
|
||||
const result = await api.post<{ calendar_days: number; entities: number }>(
|
||||
"/market/reference-sync",
|
||||
);
|
||||
syncResult.value = `已同步 ${result.calendar_days} 个日历日期、${result.entities} 个股票条目`;
|
||||
ui.showToast("基础行情资料已同步");
|
||||
} catch (error) {
|
||||
syncError.value = error instanceof Error ? error.message : "同步失败,请稍后重试。";
|
||||
} finally {
|
||||
syncing.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(load);
|
||||
</script>
|
||||
|
||||
@@ -65,6 +85,17 @@ onMounted(load);
|
||||
<p v-if="errorMessage" class="field-error" role="alert">{{ errorMessage }}</p>
|
||||
</div>
|
||||
</section>
|
||||
<section class="card">
|
||||
<header class="card-header"><h2>基础行情资料</h2><span class="faint">交易日历与股票目录</span></header>
|
||||
<div class="card-body disabled-row">
|
||||
<p class="muted">保存有效行情凭据后执行;同步结果用于日期判断和全局搜索。</p>
|
||||
<span v-if="syncResult" class="up">{{ syncResult }}</span>
|
||||
<span v-if="syncError" class="field-error" role="alert">{{ syncError }}</span>
|
||||
<button class="btn" type="button" :disabled="syncing" @click="syncReference">
|
||||
{{ syncing ? "正在同步" : "同步基础资料" }}
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
<section class="card">
|
||||
<header class="card-header"><h2>历史数据回补</h2><span class="tag">暂不可用</span></header>
|
||||
<div class="card-body disabled-row">
|
||||
|
||||
Reference in New Issue
Block a user