Procházet zdrojové kódy

Merge branch 'dev'

skyline před 1 dnem
rodič
revize
dbb57611bf

+ 18 - 4
admin-web/src/views/admin/statistics/daily-stat.vue

@@ -58,6 +58,13 @@
           查询
         </el-button>
 
+        <el-date-picker
+            v-model="state.syncDate"
+            type="date"
+            placeholder="同步日期"
+            value-format="YYYY-MM-DD"
+            class="wd180 ml10"/>
+
         <el-button class="ml10" plain size="default" type="warning" @click="handleSyncDailyStat">
           <SvgIcon name="ele-RefreshRight"/>
           重新同步
@@ -114,6 +121,7 @@ import ExtSelect from "/@/components/form/ExtSelect.vue";
 const queryRef = ref();
 
 const state = reactive({
+  syncDate: '',
   formQuery: {
     stationId: '',
     startDate: '',
@@ -150,8 +158,10 @@ onMounted(() => {
   // 默认查询昨天数据
   const yesterday = new Date();
   yesterday.setDate(yesterday.getDate() - 1);
-  state.formQuery.startDate = yesterday.toISOString().split('T')[0];
-  state.formQuery.endDate = yesterday.toISOString().split('T')[0];
+  const yesterdayStr = yesterday.toISOString().split('T')[0];
+  state.formQuery.startDate = yesterdayStr;
+  state.formQuery.endDate = yesterdayStr;
+  state.syncDate = yesterdayStr;
 
   loadData();
 
@@ -179,9 +189,13 @@ const loadData = (refresh: boolean = false) => {
 };
 
 const handleSyncDailyStat = () => {
-  Msg.confirm('确认重新同步该日期的统计数据吗?将同步所有站点的数据。', '重新同步日统计').then(() => {
+  if (!state.syncDate) {
+    Msg.message('请选择同步日期', 'warning');
+    return;
+  }
+  Msg.confirm(`确认重新同步 ${state.syncDate} 的统计数据吗?将同步所有站点的数据。`, '重新同步日统计').then(() => {
     Msg.showLoading('同步中...');
-    $body(`/daily-stat/sync`, {statDate: state.formQuery.startDate}).then(() => {
+    $body(`/daily-stat/sync`, {statDate: state.syncDate}).then(() => {
       Msg.message("同步完成");
       Msg.hideLoading();
       loadData(true);

+ 16 - 3
admin-web/src/views/admin/statistics/month-stat.vue

@@ -48,6 +48,12 @@
           查询
         </el-button>
 
+        <el-input
+            v-model="state.syncMonth"
+            placeholder="同步月份 如 2026-05"
+            clearable
+            class="wd180 ml10"/>
+
         <el-button class="ml10" plain size="default" type="warning" @click="handleSyncMonthStat">
           <SvgIcon name="ele-RefreshRight"/>
           重新同步
@@ -104,6 +110,7 @@ import ExtSelect from "/@/components/form/ExtSelect.vue";
 const queryRef = ref();
 
 const state = reactive({
+  syncMonth: '',
   formQuery: {
     stationId: '',
     statMonth: ''
@@ -140,7 +147,9 @@ onMounted(() => {
   // 默认查询上月数据
   const now = new Date();
   const lastMonth = new Date(now.getFullYear(), now.getMonth() - 1, 1);
-  state.formQuery.statMonth = lastMonth.getFullYear() + '-' + String(lastMonth.getMonth() + 1).padStart(2, '0');
+  const lastMonthStr = lastMonth.getFullYear() + '-' + String(lastMonth.getMonth() + 1).padStart(2, '0');
+  state.formQuery.statMonth = lastMonthStr;
+  state.syncMonth = lastMonthStr;
 
   loadData();
 
@@ -168,9 +177,13 @@ const loadData = (refresh: boolean = false) => {
 };
 
 const handleSyncMonthStat = () => {
-  Msg.confirm('确认重新同步该月份的统计数据吗?将同步所有站点的数据。', '重新同步月统计').then(() => {
+  if (!state.syncMonth) {
+    Msg.message('请输入同步月份', 'warning');
+    return;
+  }
+  Msg.confirm(`确认重新同步 ${state.syncMonth} 的统计数据吗?将同步所有站点的数据。`, '重新同步月统计').then(() => {
     Msg.showLoading('同步中...');
-    $body(`/month-stat/sync`, {statMonth: state.formQuery.statMonth}).then(() => {
+    $body(`/month-stat/sync`, {statMonth: state.syncMonth}).then(() => {
       Msg.message("同步完成");
       Msg.hideLoading();
       loadData(true);