Quellcode durchsuchen

[26110502] 数据补传前端: 功率预测下新增DataResend.vue(场站select默认第一个+补传按钮, 点击调用reUpload接口并提示结果), reportLog.js新增reUpload api

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
taosj vor 5 Stunden
Ursprung
Commit
47082a4df4

+ 9 - 0
forecast-backend-vue/src/api/fileupload/reportLog.js

@@ -36,3 +36,12 @@ export function exportUploadRate(data) {
     timeout: 120000
   })
 }
+
+// 数据补传(按每日配置补插当日上报成功记录)
+export function reUpload(stationCode) {
+  return request({
+    url: '/fileupload/reportLog/reUpload',
+    method: 'get',
+    params: {stationCode}
+  })
+}

+ 63 - 0
forecast-backend-vue/src/views/ufo/electricity/forecast/DataResend.vue

@@ -0,0 +1,63 @@
+<template>
+  <div class="data-resend-page">
+    <a-card :bordered="false">
+      <a-row :gutter="[12, 12]" align="middle">
+        <a-col :xs="24" :md="8">
+          <StationSelector v-model:value="stationCode" :options="stationOptions" :multiple="false" />
+        </a-col>
+        <a-col :xs="24" :md="8">
+          <a-space>
+            <a-button type="primary" :loading="resending" :disabled="!stationCode" @click="handleResend">补传</a-button>
+          </a-space>
+        </a-col>
+      </a-row>
+    </a-card>
+  </div>
+</template>
+
+<script setup name="DataResend">
+import {onMounted, ref} from 'vue';
+import {message} from 'ant-design-vue';
+import {listStation} from '@/api/config/station';
+import {reUpload} from '@/api/fileupload/reportLog';
+import StationSelector from '../components/StationSelector.vue';
+
+const resending = ref(false);
+const stationOptions = ref([]);
+const stationCode = ref(undefined);
+
+const loadStationOptions = async () => {
+  const res = await listStation({pageNum: 1, pageSize: 500});
+  const list = (res && res.rows) || [];
+  stationOptions.value = list.map((item) => ({label: item.stationName, value: item.stationCode}));
+  if (!stationCode.value && stationOptions.value.length) {
+    stationCode.value = stationOptions.value[0].value;
+  }
+};
+
+const handleResend = async () => {
+  if (!stationCode.value) {
+    message.warning('请先选择场站');
+    return;
+  }
+  resending.value = true;
+  try {
+    const res = await reUpload(stationCode.value);
+    message.success(res.msg || '补传完成');
+  } catch (e) {
+    // request.js 已统一提示错误
+  } finally {
+    resending.value = false;
+  }
+};
+
+onMounted(async () => {
+  await loadStationOptions();
+});
+</script>
+
+<style lang="less" scoped>
+.data-resend-page {
+  padding: 16px;
+}
+</style>