zxl
6 天以前 eece5b838b0fe29ea003c355b1228de4795d3873
src/views/workbench.vue
@@ -222,7 +222,15 @@
        <div class="schedule-list-section">
          <div class="section-header">
            <h3>日程列表</h3>
            <div>
            <div class="header-actions">
              <el-date-picker
                v-model="calendarDate"
                type="date"
                placeholder="选择日期"
                size="mini"
                style="width: 140px; margin-right: 10px"
                :clearable="false"
              />
              <el-button type="text" icon="el-icon-plus" @click="handleAddSchedule">新增</el-button>
              <el-button type="text" icon="el-icon-refresh" @click="getScheduleList" :disabled="scheduleRefreshing">刷新</el-button>
            </div>
@@ -377,7 +385,15 @@
      <div class="schedule-list-section">
        <div class="section-header">
          <h3>上报列表</h3>
          <div>
            <div class="header-actions">
              <el-date-picker
                v-model="reportCalendarDate"
                type="date"
                placeholder="选择日期"
                size="mini"
                style="width: 140px; margin-right: 10px"
                :clearable="false"
              />
            <el-button type="text" icon="el-icon-refresh" @click="getReportList" :disabled="reportRefreshing">刷新</el-button>
          </div>
        </div>
@@ -543,29 +559,25 @@
  },
  watch:{
    calendarDate(newDate, oldDate) {
      // 排除「点击日期单元格」导致的变化(仅日期变,月份/年份不变)
      const isOnlyDayChange =
        newDate.getFullYear() === oldDate.getFullYear() &&
        newDate.getMonth() === oldDate.getMonth() &&
        newDate.getDate() !== oldDate.getDate();
      // 检查是否跨月/跨年
      const isMonthChanged =
        newDate.getFullYear() !== oldDate.getFullYear() ||
        newDate.getMonth() !== oldDate.getMonth();
      if (!isOnlyDayChange) {
        // 触发按钮点击逻辑(上月/下月/今日)
      if (isMonthChanged) {
        // 触发后端拉取整月数据
        this.getScheduleList();
        this.lastCalendarDate = new Date(newDate); // 更新记录的日期
      }
    },
    reportCalendarDate(newDate, oldDate) {
      // 排除「点击日期单元格」导致的变化(仅日期变,月份/年份不变)
      const isOnlyDayChange =
        newDate.getFullYear() === oldDate.getFullYear() &&
        newDate.getMonth() === oldDate.getMonth() &&
        newDate.getDate() !== oldDate.getDate();
      // 检查是否跨月/跨年
      const isMonthChanged =
        newDate.getFullYear() !== oldDate.getFullYear() ||
        newDate.getMonth() !== oldDate.getMonth();
      if (!isOnlyDayChange) {
        // 触发按钮点击逻辑(上月/下月/今日)
      if (isMonthChanged) {
        // 触发后端拉取整月数据
        this.getReportList();
        this.lastReportCalendarDate = new Date(newDate); // 更新记录的日期
      }
    },
  },