mileageGeneralDetail.vue 24.2 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825
<template>
  <div class="system-container">
    <div class="container">
      <h1>里程详情</h1>
      <div class="m-b-md title_tips">
        用于统计和展示单个有线/OBD设备的历史行程信息
      </div>

      <!-- 搜索区域 开始 -->
      <div class="search_box">
        <el-form :model="searchForm" :inline="true" size="medium">
          <el-form-item label="日期:">
            <el-date-picker
              ref="datePicker"
              v-model="dateTime"
              type="daterange"
              unlink-panels
              range-separator="~"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
              :picker-options="pickerOptions"
              :default-value="datePickerDefaultValue"
              value-format="yyyy-MM-dd"
              popper-class="mileage-datepicker-popup"
              :editable="false"
              @focus="handleDatePickerTrigger"
              @change="handleDateRangeChange"
            >
            </el-date-picker>
          </el-form-item>
          <el-form-item label="设备号:">
            <el-input placeholder="设备号" v-model="searchForm.sn" readonly>
            </el-input>
          </el-form-item>
          <el-form-item>
            <el-button
              type="primary"
              icon="el-icon-search"
              @click="searchEvent()"
              >搜索</el-button
            >
          </el-form-item>
          <el-form-item>
            <el-button type="default" icon="el-icon-refresh" @click="rest()"
              >重置</el-button
            >
          </el-form-item>
        </el-form>
      </div>
      <!-- 搜索区域 end -->

      <!-- 按钮区域 开始 -->
      <div class="links_group">
        <span>里程详情</span>
        <el-button
          class="pull-right"
          type="primary"
          icon="el-icon-download"
          size="medium"
          :loading="dloading"
          @click="downloadExcel()"
          >导出Excel</el-button
        >
      </div>
      <!-- 按钮区域 end -->

      <!-- 列表 开始 -->
      <glsx-table
        ref="glsxTable"
        :list="tableData"
        v-loading="aloding"
        :column="columnList"
        :pageTotal="pageTotal"
        @change="getList"
      >
        <div slot="operate" slot-scope="{ scope }">
          <el-link type="primary" :underline="false" @click="lookTrack(scope)"
            >查看轨迹</el-link
          >
        </div>
      </glsx-table>
      <!-- <div class="table_box">
        <el-table :data="tableData" border>
          <el-table-column label="工单号" prop=""></el-table-column>
          <el-table-column label="姓名" prop=""></el-table-column>
          <el-table-column label="设备号" prop=""></el-table-column>
          <el-table-column label="车架号" prop=""></el-table-column>
          <el-table-column label="总行驶次数" prop=""></el-table-column>
          <el-table-column label="总里程km" prop=""></el-table-column>
          <el-table-column label="操作" prop=""></el-table-column>
        </el-table>
      </div> -->
      <!-- <basic-table ref="reportTable" :tableParams="reportTableParams" :beforeSearchFn="beforeSearchFn" :searchForm="searchDataForm" :getListApi="getListApi" @dataFinished="tableDataFinished" :hasNum="false">
      </basic-table> -->
      <!-- 列表 end -->
    </div>
  </div>
</template>

<script>
import GlsxTable from "@/components/glsx-table";
import {
  GET_JOURNEYS_SEARCHDETAIL,
  MILEAGE_GETSN,
  GET_JOURNEYS_EXPORTDETAIL,
  GET_JOURNEYS_DAILYMILEAGE,
} from "services/report";
import { deepClone, showToast } from "@/utils/util";
import { mileageDetailShortcuts } from "@/common/index";
export default {
  data() {
    return {
      searchForm: { sn: this.$route.query.sn },
      snList: [],
      dateTime: [],
      tableData: [],
      columnList: [
        {
          label: "工单号",
          prop: "workOrderNo",
          formatter: (row) => {
            return `${row.workOrderNo || "--"}`;
          },
        },
        {
          label: "姓名",
          prop: "ownerName",
          formatter: (row) => {
            return `${row.ownerName || "--"}`;
          },
        },
        {
          label: "设备号",
          prop: "sn",
          formatter: (row) => {
            return `${row.sn || "--"}`;
          },
        },
        {
          label: "车架号",
          prop: "vin",
          formatter: (row) => {
            return `${row.vin || "--"}`;
          },
        },
        {
          label: "行程开始/结束时间",
          prop: "journeyStartTime",
          formatter: (row) => {
            return `${row.journeyStartTime}~${row.journeyEndTime}`;
          },
        },
        {
          label: "行驶时长",
          prop: "durationStr",
          formatter: (row) => {
            return `${row.durationStr || "--"}`;
          },
        },
        {
          label: "行驶里程km",
          prop: "distance",
          formatter: (row) => {
            return `${row.distance ? row.distance.toFixed(2) : 0}`;
          },
        },
      ],
      pageTotal: 0,
      pickerOptions: {
        shortcuts: mileageDetailShortcuts,
        disabledDate(time) {
          const now = new Date();
          const endOfCurrentMonth = new Date(
            now.getFullYear(),
            now.getMonth() + 1,
            0,
            23,
            59,
            59,
            999,
          );
          return time.getTime() > endOfCurrentMonth.getTime();
        },
      },
      // 自定义日期标注:redDot 显示红点,label 显示在日期下方
      customDateData: {},
      _datePickerHeaderHandlers: [],
      _datePickerRenderTimer: null,
      _isInjectingDateCells: false,
      _dailyMileageCacheSn: "",
      _dailyMileageMonthCache: {},
      _dailyMileageMonthInFlight: {},
      dloading: false,
      aloding: false,
    };
  },
  components: {
    GlsxTable,
  },
  computed: {
    datePickerDefaultValue() {
      const now = new Date();
      return [
        new Date(now.getFullYear(), now.getMonth() - 1, 1),
        new Date(now.getFullYear(), now.getMonth(), 1),
      ];
    },
  },
  created() {
    //this.getSn();
  },
  mounted() {
    this.getList();
    //this.getTableList();
    this.bindDatePickerHeaderEvents();
  },
  beforeDestroy() {
    this.unbindDatePickerHeaderEvents();
  },
  methods: {
    // 日期输入框 focus 后只负责触发渲染
    handleDatePickerTrigger() {
      this.$nextTick(() => {
        this.scheduleCalendarRefresh();
      });
    },

    // 兜底保证开始日期不大于结束日期
    handleDateRangeChange(value) {
      if (!Array.isArray(value) || value.length !== 2) return;
      if (!value[0] || !value[1]) return;
      if (value[0] <= value[1]) return;

      this.dateTime = [value[1], value[0]];
    },

    // 多次延迟刷新,兼容弹层异步挂载和翻月后的 DOM 更新时间差
    scheduleCalendarRefresh() {
      // 多次尝试,不互相取消,各自独立执行
      [0, 80, 180, 300].forEach((delay) => {
        setTimeout(() => {
          // 只有 DOM 就绪才执行
          const popper = document.querySelector(".mileage-datepicker-popup");
          const hasTable = popper && popper.querySelector(".el-date-table td");
          if (!popper || !hasTable) return;

          // 同步数据(内部有缓存判断,不会重复请求)
          this.syncVisibleCalendarData();
          // 注入渲染(根据当前 customDateData 状态重新渲染)
          this.injectDateCellContent();
        }, delay);
      });
    },

    // 解析当前面板可见的月份范围
    getVisibleMonthRange() {
      const popper = document.querySelector(".mileage-datepicker-popup");
      if (!popper) return null;

      const monthList = Array.from(
        popper.querySelectorAll(".el-date-range-picker__header div"),
      )
        .map((header) => this.parseHeaderYearMonth(header).monthKey)
        .filter(Boolean)
        .sort();

      if (!monthList.length) return null;

      return {
        startMonth: monthList[0],
        endMonth: monthList[monthList.length - 1],
        rangeKey: `${this.searchForm.sn}_${monthList[0]}_${
          monthList[monthList.length - 1]
        }`,
      };
    },

    // 设备切换时清空月份缓存和当前面板上的里程标记。
    resetDailyMileageCache() {
      this._dailyMileageMonthCache = {};
      this._dailyMileageMonthInFlight = {};
      this.customDateData = {};
    },

    // 仅返回当前两个面板真正需要处理的月份,并过滤掉未来月份。
    getVisibleCalendarMonths() {
      const visibleMonthRange = this.getVisibleMonthRange();
      if (!visibleMonthRange) return [];

      const { startMonth, endMonth } = visibleMonthRange;
      const currentMonthKey = this.getCurrentMonthKey();

      return (
        startMonth === endMonth ? [startMonth] : [startMonth, endMonth]
      ).filter((month) => month && month <= currentMonthKey);
    },

    // 把接口返回的月度列表转换成日期索引,便于后续按日期直接渲染。
    buildDailyMileageMonthMap(list) {
      const calendarMap = {};
      (Array.isArray(list) ? list : []).forEach((item) => {
        if (!item || !item.date) return;
        const mileageValue =
          item.totalMileage === 0 || item.totalMileage
            ? item.totalMileage
            : "--";
        calendarMap[item.date] = {
          redDot: true,
          label: `${mileageValue}km`,
        };
      });
      return calendarMap;
    },

    // 单个月份只发一次请求;已缓存直接跳过,请求中则复用同一个 Promise。
    ensureDailyMileageMonthLoaded(month) {
      if (this._dailyMileageMonthCache[month]) return null;
      if (this._dailyMileageMonthInFlight[month]) {
        return this._dailyMileageMonthInFlight[month];
      }

      const requestParams = {
        sn: this.searchForm.sn,
        mileageStartTime: month,
        mileageEndTime: month,
      };

      const request = this.getDailyMileageCalendar(requestParams)
        .then((res) => {
          this._dailyMileageMonthCache[month] = this.buildDailyMileageMonthMap(
            res.data,
          );
        })
        .finally(() => {
          delete this._dailyMileageMonthInFlight[month];
        });

      this._dailyMileageMonthInFlight[month] = request;
      return request;
    },

    // 把当前可见月份的缓存数据合并成面板实际使用的 customDateData。
    updateCustomDateDataByMonths(months) {
      const calendarMap = {};
      months.forEach((month) => {
        const monthMap = this._dailyMileageMonthCache[month];
        if (!monthMap) return;
        Object.assign(calendarMap, monthMap);
      });
      this.customDateData = calendarMap;
    },

    // 注入依赖日期面板 DOM,统一放到 nextTick 里做一次刷新。
    refreshCalendarDateCellContent() {
      this.$nextTick(() => {
        this.injectDateCellContent();
      });
    },

    // 按当前可见月份拉取里程日历数据
    syncVisibleCalendarData() {
      if (!this.searchForm.sn) return;

      if (this._dailyMileageCacheSn !== this.searchForm.sn) {
        this._dailyMileageCacheSn = this.searchForm.sn;
        this.resetDailyMileageCache();
      }

      const months = this.getVisibleCalendarMonths();
      if (!months.length) {
        this.customDateData = {};
        this.refreshCalendarDateCellContent();
        return;
      }

      const pending = months
        .map((month) => this.ensureDailyMileageMonthLoaded(month))
        .filter(Boolean);

      if (!pending.length) {
        this.updateCustomDateDataByMonths(months);
        return;
      }

      Promise.all(pending)
        .then(() => {
          this.updateCustomDateDataByMonths(months);
        })
        .finally(() => {
          this.refreshCalendarDateCellContent();
        });
    },

    // 里程日历数据源
    getDailyMileageCalendar(params) {
      return GET_JOURNEYS_DAILYMILEAGE(params);
    },

    // 统一生成 yyyy-MM-dd,避免不同地方手写日期格式。
    formatDateKey(year, month, day) {
      return `${this.formatMonthKey(year, month)}-${String(day).padStart(
        2,
        "0",
      )}`;
    },

    // 根据单元格所属月份计算真实日期,避免 prev-month / next-month 格子误判
    getDateKeyByCell(year, month, day, cell) {
      let realYear = Number(year);
      let realMonth = Number(month);

      if (cell.classList.contains("prev-month")) {
        realMonth -= 1;
        if (realMonth === 0) {
          realMonth = 12;
          realYear -= 1;
        }
      } else if (cell.classList.contains("next-month")) {
        realMonth += 1;
        if (realMonth === 13) {
          realMonth = 1;
          realYear += 1;
        }
      }

      return this.formatDateKey(realYear, realMonth, day);
    },

    // 统一生成 yyyy-MM,给缓存 key、月份比较和 header 解析复用。
    formatMonthKey(year, month) {
      return `${year}-${String(month).padStart(2, "0")}`;
    },

    getCurrentMonthKey() {
      const now = new Date();
      return this.formatMonthKey(now.getFullYear(), now.getMonth() + 1);
    },

    // 从日期面板头部提取年、月和 monthKey,避免多处重复解析同一段文案。
    parseHeaderYearMonth(headerEl) {
      if (!headerEl) {
        return {
          year: "",
          month: "",
          monthKey: "",
        };
      }

      const headerText = (headerEl.textContent || "").trim();
      const yearMatch = headerText.match(/(\d{4})/);
      const monthMatch = headerText.match(/(\d{1,2})\s*月/);
      if (!yearMatch || !monthMatch) {
        return {
          year: "",
          month: "",
          monthKey: "",
        };
      }

      const year = yearMatch[1];
      const month = String(monthMatch[1]).padStart(2, "0");
      return {
        year,
        month,
        monthKey: this.formatMonthKey(year, month),
      };
    },

    getHeaderMonthByTarget(target) {
      const header = target.closest(".el-date-range-picker__header");
      if (!header) return "";

      const headerTitle = header.querySelector("div");
      return this.parseHeaderYearMonth(headerTitle).monthKey;
    },

    // 当前月是最大月份,不能继续往后翻
    shouldBlockNextMonth(target) {
      const nextButton = target.closest(
        ".el-date-range-picker__header .el-icon-arrow-right, .el-date-range-picker__header .el-icon-d-arrow-right, .el-date-range-picker__header button",
      );
      if (!nextButton) return false;
      const hasNextIconClass =
        nextButton.classList.contains("el-icon-arrow-right") ||
        nextButton.classList.contains("el-icon-d-arrow-right") ||
        nextButton.querySelector(
          ".el-icon-arrow-right, .el-icon-d-arrow-right",
        );
      if (!hasNextIconClass) return false;

      const headerMonth = this.getHeaderMonthByTarget(target);
      if (!headerMonth) return false;

      return headerMonth >= this.getCurrentMonthKey();
    },

    // 监听 document 捕获阶段,稳定捕获日期弹层头部翻月按钮点击
    bindDatePickerHeaderEvents() {
      if (!Array.isArray(this._datePickerHeaderHandlers)) {
        this._datePickerHeaderHandlers = [];
      }
      if (this._datePickerHeaderHandlers.length) return;
      const handler = (event) => {
        const target = event.target;
        if (!target || !target.closest) return;

        const isHeaderButton = target.closest(
          ".el-date-range-picker__header button, .el-date-range-picker__header .el-picker-panel__icon-btn",
        );
        if (!isHeaderButton) return;
        const inDatePickerPopup = target.closest(".mileage-datepicker-popup");
        if (!inDatePickerPopup) return;

        if (this.shouldBlockNextMonth(target)) {
          event.preventDefault();
          event.stopPropagation();
          if (typeof event.stopImmediatePropagation === "function") {
            event.stopImmediatePropagation();
          }
          return;
        }

        this.scheduleCalendarRefresh();
      };

      document.addEventListener("mousedown", handler, true);
      this._datePickerHeaderHandlers.push({
        button: document,
        handler,
        capture: true,
      });
    },

    // 关闭面板时移除 document 点击事件,避免重复绑定
    unbindDatePickerHeaderEvents() {
      const headerHandlers = Array.isArray(this._datePickerHeaderHandlers)
        ? this._datePickerHeaderHandlers
        : [];
      headerHandlers.forEach(({ button, handler, capture }) => {
        button.removeEventListener("mousedown", handler, capture);
      });
      this._datePickerHeaderHandlers = [];
      clearTimeout(this._datePickerRenderTimer);
      this._datePickerRenderTimer = null;
    },

    // 给日期单元格打标记 class 和属性,再由 CSS 渲染红点和文案
    // 先清掉上一次注入的节点和 class,避免重复注入后样式残留。
    resetDateCellContent(popper) {
      popper
        .querySelectorAll(
          ".mileage-date-inner-custom, .date-cell-day, .has-date-cell-dot, .has-date-cell-label",
        )
        .forEach((el) => {
          el.classList.remove(
            "mileage-date-inner-custom",
            "date-cell-day",
            "has-date-cell-dot",
            "has-date-cell-label",
          );
          if (el.hasAttribute("data-mileage-label")) {
            el.removeAttribute("data-mileage-label");
          }
        });
    },

    // 只处理单个日期格的渲染,让主循环保持简单。
    renderDateCell(cell, year, month) {
      const spanEl = cell.querySelector("div > span");
      if (!spanEl) return;
      const cellInner = cell.querySelector("div");
      if (!cellInner) return;

      const day = spanEl.textContent.trim();
      const dateKey = this.getDateKeyByCell(year, month, day, cell);
      const data = this.customDateData[dateKey];
      if (!data) return;

      cellInner.classList.add("mileage-date-inner-custom");
      spanEl.classList.add("date-cell-day");

      if (data.redDot) {
        cellInner.classList.add("has-date-cell-dot");
      }

      if (data.label) {
        cellInner.classList.add("has-date-cell-label");
        cellInner.setAttribute("data-mileage-label", data.label);
      }
    },

    // 按当前面板遍历所有日期格,并把缓存里的里程标记重新注入到 DOM 中。
    injectDateCellContent() {
      const popper = document.querySelector(".mileage-datepicker-popup");
      if (!popper) return;
      this._isInjectingDateCells = true;
      this.resetDateCellContent(popper);

      const panels = popper.querySelectorAll(".el-date-range-picker__content");

      panels.forEach((panel) => {
        const headerEl = panel.querySelector(
          ".el-date-range-picker__header div",
        );
        const { year, month } = this.parseHeaderYearMonth(headerEl);
        if (!year || !month) return;

        // Element UI 2.x 单元格结构:<td><div><span>日期</span></div></td>
        const cells = panel.querySelectorAll("td.available");
        cells.forEach((cell) => {
          this.renderDateCell(cell, year, month);
        });
      });
      setTimeout(() => {
        this._isInjectingDateCells = false;
      }, 0);
    },

    // 获取查询参数
    getParams() {
      let oParams = deepClone(this.searchForm);
      let o = this.dateTime;
      if (o && o.length > 0) {
        oParams.journeyStartTime = o[0];
        oParams.journeyEndTime = o[1];
      }
      //oParams.vin = this.$route.query.vin;

      return oParams;
    },

    // 获取列表
    getList(options) {
      let oParams = this.getParams();
      oParams.pageSize = this.$refs.glsxTable.pageSizeNum;
      oParams.pageNumber = options ? options.pageNumber || 1 : 1;
      this.aloding = true;
      GET_JOURNEYS_SEARCHDETAIL(oParams).then((res) => {
        this.aloding = false;
        let { data } = res;
        let { list, totalElements } = data || {};
        this.pageTotal = totalElements;
        this.tableData = list;
      });
    },

    // 获取设备列表
    getSn() {
      let oParams = { vin: this.$route.query.vin };
      MILEAGE_GETSN(oParams).then((res) => {
        let list = res.data || [];
        this.snList = res.data || [];
        this.$set(this.searchForm, "sn", list[0] || "");
        this.getList();
      });
    },

    // 查看轨迹
    lookTrack(row) {
      console.log(row);
      let path = `/oEshield#/monitor/replay?sn=${
        row.sn || ""
      }&isInitFence=1&name=${row.ownerName || ""}&standno=${
        row.vin || ""
      }&startTime=${row.journeyStartTime || ""}&endTime=${
        row.journeyEndTime || 0
      }&fenceId=${row.fenceId || ""}`;
      //let query = {sn:row.sn,isInitFence:1,name:row.name,standno:row.vin};
      let query = {};
      //this.$router.push({path:path})
      // history.pushState(query, path, path);
      window.open(path);
    },

    // 导出excel
    downloadExcel() {
      let _this = this;
      let oParams = this.getParams();
      _this.dloading = true;
      GET_JOURNEYS_EXPORTDETAIL(oParams).then((res) => {
        _this.dloading = false;
        if (res.code != 200) {
          return false;
        }
        window.open(res.data);
      });
    },

    // 重置
    rest() {
      //this.searchForm = {};
      this.dateTime = [];
      this.$refs.glsxTable.rest();
      this.getList();
    },

    // 搜索事件
    searchEvent() {
      this.$refs.glsxTable.rest("currentPage", 1);
      this.getList();
    },
  },
};
</script>

<style lang="scss" scoped>
.pre_select {
  width: 100px;
}
.title_tips {
  font-size: 14px;
}
.links_group {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
</style>

<style lang="scss">
/* 日期选择器自定义内容样式 */
.mileage-datepicker-popup .el-date-table td {
  padding: 4px 0;
}

.mileage-datepicker-popup .el-date-table td div {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 40px;
  box-sizing: border-box;
  text-align: center;
  padding-top: 1px;
  padding-bottom: 1px;
  overflow: visible;
}

.mileage-datepicker-popup .mileage-date-inner-custom {
  position: relative;
  text-align: center;
}

.mileage-datepicker-popup .mileage-date-inner-custom > span {
  position: static !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  bottom: auto !important;
  transform: none !important;
}

.mileage-datepicker-popup .mileage-date-inner-custom.has-date-cell-dot::before {
  content: "";
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f56c6c;
  margin: 0 0 0px 0;
  flex: 0 0 auto;
}

.mileage-datepicker-popup .mileage-date-inner-custom.has-date-cell-label::after {
  content: attr(data-mileage-label);
  display: block;
  width: auto;
  height: auto;
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
  margin: -4px 0 0 0;
  flex: 0 0 auto;
  color: #606266;
  background: transparent;
}

.mileage-datepicker-popup .date-cell-day {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px !important;
  min-width: 24px !important;
  max-width: 24px !important;
  height: 24px !important;
  min-height: 24px !important;
  max-height: 24px !important;
  padding: 0 !important;
  line-height: 1.2 !important;
  margin: 0 !important;
  border-radius: 50%;
  box-sizing: border-box;
  flex: 0 0 24px;
}

/* 选中态只高亮日期数字,不影响自定义红点和里程文案 */
.mileage-datepicker-popup .el-date-table td.start-date .date-cell-day,
.mileage-datepicker-popup .el-date-table td.end-date .date-cell-day {
  background-color: #409eff !important;
  color: #fff !important;
}

.mileage-datepicker-popup
  .el-date-table
  td.start-date
  .mileage-date-inner-custom.has-date-cell-dot::before,
.mileage-datepicker-popup
  .el-date-table
  td.end-date
  .mileage-date-inner-custom.has-date-cell-dot::before {
  background: #f56c6c !important;
}

.mileage-datepicker-popup .el-date-table td.start-date .mileage-date-inner-custom.has-date-cell-label::after,
.mileage-datepicker-popup .el-date-table td.end-date .mileage-date-inner-custom.has-date-cell-label::after,
.mileage-datepicker-popup .el-date-table td.in-range .mileage-date-inner-custom.has-date-cell-label::after {
  background: transparent !important;
  color: #606266 !important;
}

.el-date-table td.start-date div{
  margin-left: 0 !important;
}
</style>