From bc822c6ca3e1ce3e16a38ba877449fc697be9511 Mon Sep 17 00:00:00 2001
From: xyc <jc_xiong@hotmail.com>
Date: 星期二, 06 十月 2026 14:09:41 +0800
Subject: [PATCH] fix(holiday): 折线图按标签精度绘制

---
 traffic-audit-web/src/views/HolidayStat.vue |   63 +++++++++++++++++++++++++++++--
 1 files changed, 58 insertions(+), 5 deletions(-)

diff --git a/traffic-audit-web/src/views/HolidayStat.vue b/traffic-audit-web/src/views/HolidayStat.vue
index 230ff0e..6875128 100644
--- a/traffic-audit-web/src/views/HolidayStat.vue
+++ b/traffic-audit-web/src/views/HolidayStat.vue
@@ -100,7 +100,10 @@
             <el-table :data="adjustments" border stripe size="small" style="margin-top:12px" v-loading="adjustmentLoading">
               <el-table-column prop="year" label="骞翠唤" width="90" align="center"></el-table-column>
               <el-table-column prop="flowDate" label="鏃ユ湡" width="130" align="center"></el-table-column>
-              <el-table-column label="璋冩暣鍚庡浗鐪侀亾杞︽祦锛堜竾杈嗘锛�" width="230" align="right">
+              <el-table-column label="璋冩暣鍓嶅浗鐪侀亾杞︽祦閲忥紙涓囪締娆★級" width="240" align="right">
+                <template slot-scope="s">{{ formatOriginalAdjustmentValue(s.row.originalValue) }}</template>
+              </el-table-column>
+              <el-table-column label="璋冩暣鍚庡浗鐪侀亾杞︽祦閲忥紙涓囪締娆★級" width="240" align="right">
                 <template slot-scope="s">{{ formatAdjustmentValue(s.row.adjustedValue) }}</template>
               </el-table-column>
               <el-table-column prop="reason" label="璋冩暣鍘熷洜" min-width="280" show-overflow-tooltip></el-table-column>
@@ -113,17 +116,22 @@
               </el-table-column>
             </el-table>
             <el-dialog :title="adjustmentForm.id ? '缂栬緫璋冩暣' : '鏂板璋冩暣'" :visible.sync="adjustmentDialogVisible" width="560px" v-dialog-drag>
-              <el-form label-width="120px">
+              <el-form label-width="220px">
                 <el-form-item label="骞翠唤">
-                  <el-select v-model="adjustmentForm.year" style="width:100%" @change="adjustmentForm.flowDate = ''">
+                  <el-select v-model="adjustmentForm.year" style="width:100%" @change="onAdjustmentYearChange">
                     <el-option v-for="item in availableAdjustmentYears" :key="item" :label="item + '骞�'" :value="item"></el-option>
                   </el-select>
                 </el-form-item>
                 <el-form-item label="鏃ユ湡">
                   <el-date-picker v-model="adjustmentForm.flowDate" type="date" value-format="yyyy-MM-dd"
-                                  style="width:100%" :picker-options="adjustmentDatePickerOptions" placeholder="閫夋嫨鏃ユ湡"></el-date-picker>
+                                  style="width:100%" :picker-options="adjustmentDatePickerOptions" placeholder="閫夋嫨鏃ユ湡"
+                                  @change="onAdjustmentDateChange"></el-date-picker>
                 </el-form-item>
-                <el-form-item label="璋冩暣鍚庤溅娴侀噺">
+                <el-form-item label="璋冩暣鍓嶅浗鐪侀亾杞︽祦閲忥紙涓囪締娆★級">
+                  <el-input :value="formatOriginalAdjustmentValue(adjustmentForm.originalValue)" readonly
+                            :placeholder="adjustmentOriginalLoading ? '鏌ヨ涓�...' : ''"></el-input>
+                </el-form-item>
+                <el-form-item label="璋冩暣鍚庤溅娴侀噺锛堜竾杈嗘锛�">
                   <el-input-number v-model="adjustmentForm.adjustedValue" :min="0" :precision="4" :step="0.0001" controls-position="right" style="width:100%"></el-input-number>
                 </el-form-item>
                 <el-form-item label="璋冩暣鍘熷洜">
@@ -249,10 +257,13 @@
       adjustmentLoading: false,
       adjustmentDialogVisible: false,
       adjustmentSaving: false,
+      adjustmentOriginalLoading: false,
+      adjustmentOriginalRequestId: 0,
       adjustmentForm: {
         id: null,
         year: new Date().getFullYear() - 1,
         flowDate: '',
+        originalValue: null,
         adjustedValue: null,
         reason: ''
       }
@@ -319,11 +330,49 @@
         id: source.id || null,
         year: source.year || this.adjustmentYear,
         flowDate: source.flowDate || '',
+        originalValue: source.originalValue === undefined || source.originalValue === null
+          ? null : Number(source.originalValue),
         adjustedValue: source.adjustedValue === undefined || source.adjustedValue === null
           ? null : Number(source.adjustedValue),
         reason: source.reason || ''
       }
       this.adjustmentDialogVisible = true
+      this.loadAdjustmentOriginalValue()
+    },
+    onAdjustmentYearChange() {
+      this.adjustmentOriginalRequestId += 1
+      this.adjustmentOriginalLoading = false
+      this.adjustmentForm.flowDate = ''
+      this.adjustmentForm.originalValue = null
+    },
+    onAdjustmentDateChange() {
+      this.loadAdjustmentOriginalValue()
+    },
+    loadAdjustmentOriginalValue() {
+      const year = this.adjustmentForm.year
+      const flowDate = this.adjustmentForm.flowDate
+      const requestId = ++this.adjustmentOriginalRequestId
+      this.adjustmentForm.originalValue = null
+      if (!year || !flowDate) {
+        this.adjustmentOriginalLoading = false
+        return
+      }
+      this.adjustmentOriginalLoading = true
+      api.get('/holiday/adjustments/source-value', { params: { year: year, flowDate: flowDate } })
+        .then(res => {
+          if (requestId !== this.adjustmentOriginalRequestId) return
+          if (res.code !== 200) throw new Error(res.message || '璋冩暣鍓嶅�煎姞杞藉け璐�')
+          this.adjustmentForm.originalValue = res.data === null || res.data === undefined || res.data === ''
+            ? null : Number(res.data)
+        })
+        .catch(err => {
+          if (requestId !== this.adjustmentOriginalRequestId) return
+          this.adjustmentForm.originalValue = null
+          this.showError(err, '璋冩暣鍓嶅�煎姞杞藉け璐�')
+        })
+        .finally(() => {
+          if (requestId === this.adjustmentOriginalRequestId) this.adjustmentOriginalLoading = false
+        })
     },
     saveAdjustment() {
       const form = this.adjustmentForm
@@ -582,6 +631,10 @@
       if (!Number.isFinite(number)) return value
       return number.toFixed(4)
     },
+    formatOriginalAdjustmentValue(value) {
+      if (value === null || value === undefined || value === '') return ''
+      return this.formatAdjustmentValue(value)
+    },
     formatDateTime(value) {
       if (!value) return '鈥�'
       return String(value).replace('T', ' ').slice(0, 19)

--
Gitblit v1.9.1