无人机管理后台前端(已迁走)
张含笑
2025-07-23 9d09a66415382086ee09d5a620d6f5b182aa3702
Merge branch 'refs/heads/feature/v3.0.0/个人工作台优化' into dev

# Conflicts:
# src/views/wel/components/calendarBox.vue
6 files modified
453 ■■■■ changed files
src/views/wel/components/backlog.vue 2 ●●● patch | view | raw | blame | history
src/views/wel/components/calendarBox.vue 316 ●●●● patch | view | raw | blame | history
src/views/wel/components/flightStatistics.vue 94 ●●●● patch | view | raw | blame | history
src/views/wel/components/flyratio.vue 6 ●●●● patch | view | raw | blame | history
src/views/wel/components/proportionStatic.vue 31 ●●●●● patch | view | raw | blame | history
src/views/wel/components/taskOutcome.vue 4 ●●●● patch | view | raw | blame | history
src/views/wel/components/backlog.vue
@@ -240,7 +240,7 @@
.bocklogBox {
  width: 100%;
  // height: 306px;
  height: pxToVh(326);
  height: pxToVh(316);
  background: rgba(255, 255, 255, 0.41);
  box-shadow: 0px 3px 4px -1px rgba(125, 125, 125, 0.25);
  border-radius: 8px 8px 8px 8px;
src/views/wel/components/calendarBox.vue
@@ -1,6 +1,24 @@
<template>
  <div class="calenBox">
    <el-calendar ref="calendar" v-model="leftValue">
    <el-calendar ref="calendar" v-model="currentMonth"  :class="{
    'five-rows': weeksNeeded === 5,
    'six-rows': weeksNeeded === 6
  }">
      <template #header="{ date }">
        <div>
          <img :src="caleft" alt="" @click="selectDate('prev-month')" />
          <el-date-picker
            v-model="currentMonth"
            type="month"
            :clearable="false"
            :prefix-icon="''"
            @change="handleMonthChange"
            :format="'YYYY年M月'"
          />
          <img :src="caright" alt="" @click="selectDate('next-month')" />
        </div>
      </template>
      <template #date-cell="{ data }">
        <div :class="data.isSelected ? 'is-selected' : ''">
          <div class="date-number">{{ data.day.slice(8, 10) }}</div>
@@ -12,7 +30,9 @@
              :class="event.type"
              @click="jumpcalendar(event, data.day)"
            >
              <div class="imgBox"><img :src="getEventIcon(event.type)" alt="" /> {{ event.name }}</div>
              <div class="imgBox">
                <img :src="getEventIcon(event.type)" alt="" /> {{ event.name }}
              </div>
              <span>{{ event.value }}</span>
            </div>
          </div>
@@ -24,42 +44,140 @@
<script setup>
import dayjs from 'dayjs';
import { jobEventBar, getCalen } from '@/api/home/index';
import { ref, watch, onMounted, nextTick } from 'vue';
import { getCalen } from '@/api/home/index';
import { useRouter } from 'vue-router';
import ev1 from '@/assets/images/workbench/ev1.svg';
import ev2 from '@/assets/images/workbench/ev2.svg';
import { ElMessage } from 'element-plus';
import caleft from '@/assets/images/workbench/caleft.png';
import caright from '@/assets/images/workbench/caright.png';
const router = useRouter();
const calendar = ref();
const events = ref({});
const currentMonth = ref(new Date()); // 控制当前显示的月份
const selectedDate = ref(null); // 控制选中的日期
const params = ref({
  end_date: undefined,
  start_date: undefined,
});
const eventIcons = ref({
  'work-order': ev1,
  task: ev2,
});
const monthRange = getCurrentMonthRange();
params.value = monthRange;
// 检查日期是否是当前月份
const isCurrentMonth = date => {
  return dayjs(date).isSame(dayjs(), 'month');
};
// 处理月份选择器变化
const handleMonthChange = val => {
  const selectedMonth = new Date(val);
  currentMonth.value = selectedMonth;
  // 如果是当前月份,则选中当天;否则不选中
  if (isCurrentMonth(selectedMonth)) {
    selectedDate.value = new Date();
  } else {
    selectedDate.value = null;
  }
  // 强制更新日历视图
  nextTick(() => {
    updateCalendarSelection();
  });
};
// 获取日历数据
const getJobEventBar = () => {
  getCalen(params.value).then(res => {
    if (res.data.code !== 0) return;
    const a = res.data.data;
    const filteredData = {};
    for (let date in a) {
      filteredData[date] = a[date].filter(item => item.type !== 'work-order');
    }
    events.value = filteredData;
  });
};
// 获取事件图标
const getEventIcon = type => {
  return eventIcons.value[type] || eventIcons.value.default;
};
// 获取当前月份范围
function getCurrentMonthRange() {
  return {
    start_date: dayjs().startOf('month').format('YYYY-MM-DD HH:mm:ss'),
    end_date: dayjs().endOf('month').format('YYYY-MM-DD HH:mm:ss'),
  };
}
const leftValue = ref(new Date());
// 月份切换处理
const selectDate = async val => {
  if (!calendar.value) return;
  if (val === 'prev-month') {
    currentMonth.value = dayjs(currentMonth.value).subtract(1, 'month').toDate();
  } else if (val === 'next-month') {
    currentMonth.value = dayjs(currentMonth.value).add(1, 'month').toDate();
  }
  // 如果是当前月份,则选中当天;否则不选中
  if (isCurrentMonth(currentMonth.value)) {
    selectedDate.value = new Date();
  } else {
    selectedDate.value = null;
  }
  await nextTick();
  updateCalendarSelection();
};
const updateCalendarSelection = () => {
  // 清除所有选中状态
  const selectedCells = document.querySelectorAll('.el-calendar-table td.is-selected');
  selectedCells.forEach(cell => {
    cell.classList.remove('is-selected');
  });
  // 如果是当前月份,设置当前日为选中状态
  if (isCurrentMonth(currentMonth.value) && selectedDate.value) {
    const currentDay = dayjs(selectedDate.value).date();
    const calendarCells = document.querySelectorAll('.el-calendar-table td');
    calendarCells.forEach(cell => {
      const day = parseInt(cell.querySelector('.date-number').textContent);
      if (day === currentDay) {
        cell.classList.add('is-selected');
      }
    });
  }
};
// 监听当前月份变化
watch(
  () => leftValue.value,
  (newV, oldV) => {
    if (newV && oldV) {
      const newDate = dayjs(newV);
      params.value = {
        start_date: newDate.startOf('month').format('YYYY-MM-DD HH:mm:ss'),
        end_date: newDate.endOf('month').format('YYYY-MM-DD HH:mm:ss'),
      };
      getJobEventBar();
  () => currentMonth.value,
  newMonth => {
    const newDate = dayjs(newMonth);
    params.value = {
      start_date: newDate.startOf('month').format('YYYY-MM-DD HH:mm:ss'),
      end_date: newDate.endOf('month').format('YYYY-MM-DD HH:mm:ss'),
    };
    // 如果是当前月份,则选中当天;否则清除选中
    if (isCurrentMonth(newMonth)) {
      selectedDate.value = new Date();
    } else {
      selectedDate.value = null;
    }
    nextTick(() => {
      updateCalendarSelection();
    });
    getJobEventBar();
  },
  { deep: true, immediate: true }
);
@@ -72,21 +190,6 @@
// 获取对应日期的事件
const getEvents = dateString => {
  return events.value[dateString] || [];
};
const monthRange = getCurrentMonthRange();
params.value = monthRange;
const getJobEventBar = () => {
  getCalen(params.value).then(res => {
    if (res.data.code !== 0) return;
    const a = res.data.data;
    const filteredData = {};
    for (let date in a) {
      filteredData[date] = a[date].filter(item => item.type !== 'work-order');
    }
    events.value = filteredData;
    // events.value = res.data.data
  });
};
const jumpcalendar = (event, day) => {
  if (event.name === '工单') {
@@ -105,73 +208,167 @@
    });
  }
};
const weeksNeeded = computed(() => {
  const date = dayjs(currentMonth.value);
  const firstDay = date.startOf('month').day(); // 0-6 (周日到周六)
  const days = date.daysInMonth();
  // 强制 2025 年 6 月显示六行
  if (date.year() === 2025 && date.month() === 5) {
    return 6;
  }
  // 其他月份按原逻辑计算
  return Math.ceil((firstDay + days) / 7);
})
const isSixRows = computed(() => weeksNeeded.value > 5);
onMounted(() => {
  // 初始化时如果是当前月份,选中当天;否则不选中
  if (isCurrentMonth(currentMonth.value)) {
    selectedDate.value = new Date();
  } else {
    selectedDate.value = null;
  }
  nextTick(() => {
    updateCalendarSelection();
  });
  getJobEventBar();
});
</script>
<style lang="scss">
.calenBox {
  //  height: 630px;
  height: pxToVh(660);
  height: pxToVh(670);
  // 隐藏按钮组中间按钮
  .el-button-group > .el-button:not(:first-child):not(:last-child) {
    display: none;
  }
  .el-calendar__body {
    padding-top: 0 !important;
  }
  .date-number {
  font-size: 13px !important;}
    font-size: 13px !important;
  }
  .el-calendar__header {
    justify-content: center;
    margin-top: 10px;
    padding-bottom: 0;
    border-bottom: transparent;
    div {
      display: flex;
      justify-content: center;
      align-items: center;
      img {
        width: 28px;
        height: 28px;
        cursor: pointer;
      }
      span {
        font-weight: bold;
        font-size: 14px;
        color: #363636;
        margin: 0 18px;
      }
    }
  }
  .el-calendar-table td {
    border: none;
  }
  .el-calendar-table tr td {
    border: none;
  }
  .el-calendar-table .el-calendar-day {
    box-sizing: border-box;
    padding: 0.8rem;
    background: #f5f7fa;
    border-radius: 6px 6px 6px 6px;
    border: 1px solid #efefef;
    margin-right: 5px;
    margin-bottom: 8px;
  }
  .el-input__prefix-inner {
    display: none !important;
  }
  .el-input__suffix {
    width: 0 !important;
  }
  .el-input__wrapper {
    align-items: center !important;
    cursor: text;
    box-shadow: none !important;
    display: inline-flex !important;
    flex-grow: 1;
    justify-content: center;
  }
  .el-input__inner {
    font-weight: bold;
    font-size: 14px;
    color: #363636;
  }
  .el-date-editor.el-input,
  .el-date-editor.el-input__wrapper {
    height: var(--el-input-height, var(--el-component-size));
    width: 170px !important;
  }
}
</style>
<style lang="scss" scoped>
.calenBox {
  margin-top: 10px;
  // height: 630px;
  height: pxToVh(622);
  height: pxToVh(632);
  border-radius: 10px;
  overflow: hidden;
  background-color: #fff;
  :deep(.el-date-picker .el-input__prefix-inner) {
    display: none !important;
  }
  ::v-deep(.el-calendar) {
    // height: 80%; // 日历填充容器
    // 标题样式
    .el-calendar__title {
      font-weight: bold;
      font-size: 14px;
      color: #363636;
    }
    // 日历主体
    // &__body {
    //   height: 98%; // 关键:继承父高度
    //   .el-calendar-table {
    //     height: 90% !important; // 百分比生效
    //   }
    // .el-calendar-table .el-calendar-day {
    //   height: pxToVh(88) !important;
    // }
    .el-calendar-table .el-calendar-day {
       height: pxToVh(91) !important;
    }
 &.five-rows .el-calendar-table .el-calendar-day {
    height: pxToVh(88) !important;
  }
  &.six-rows .el-calendar-table .el-calendar-day {
    height: pxToVh(78) !important;
  }
    // 选中日期样式
    .el-calendar-table td.is-selected {
      background-color: #f0f7ff;
      border: 2px solid #409eff;
      border-radius: 4px;
      .date-number {
        font-weight: bold;
        color: #409eff;
      .el-calendar-day {
        outline: 2px solid #409eff;
        outline-offset: -2px;
        border: none !important;
        .date-number {
          font-weight: bold;
          color: #409eff;
        }
      }
    }
    .el-calendar-table td.is-selected {
      background-color: transparent;
    }
  }
  .event-item {
    font-size: 12px;
    // padding: 2px;
    text-align: center;
    border-radius: 3px;
    white-space: nowrap;
    position: relative;
    z-index: 2;
    &.work-order {
      font-weight: 400;
@@ -193,13 +390,14 @@
      span {
        font-weight: 600;
        font-size: 18px;
        font-size: 17px;
        color: #029d36;
        margin-left: 2px;
      }
    }
    .imgBox {
   font-size: 12px;}
      font-size: 12px;
    }
  }
}
</style>
src/views/wel/components/flightStatistics.vue
@@ -238,20 +238,84 @@
      },
    ],
    series: [
      {
        name: '飞行时长',
        type: 'bar',
        barWidth: '8px',
        itemStyle: {
          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
            { offset: 0, color: '#91C1FF' },
            { offset: 1, color: '#2970FF' },
          ]),
          borderRadius: 4,
  // {//柱底圆片
  //           name: "",
  //           type: "pictorialBar",
  //           symbolSize: [8, 10],//调整截面形状
  //           symbolOffset: [0, 5],
  //           z: 12,
  //           itemStyle: {
  //                   "normal": {
  //                     color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  //                               offset: 0,
  //                              "color": "#91C1FF"
  //                           },
  //                           {
  //                               offset: 1,
  //                               "color": "#2970FF"
  //                           }
  //                       ],false)
  //                   }
  //               },
  //           data: flight_time,
  //       },
        //柱体
        {
            name: '飞行时长',
            type: 'bar',
             barWidth: '8px',
            itemStyle: {
                // shadowOffsetX: 200,
                // shadowOffsetY: 200,
                    "normal": {
                        "color": {
                            "x": 0,
                            "y": 0,
                            "x2": 0,
                            "y2": 1,
                            "type": "linear",
                            "global": false,
                            "colorStops": [{//第一节下面
                                "offset": 0,
                                "color": "#91C1FF"
                            }, {
                                "offset": 1,
                                "color": "#2970FF"
                            }]
                        }
                    }
                },
           data: flight_time,
        },
        //柱顶圆片
        {
           name: '飞行时长',
            type: "pictorialBar",
            symbolSize: [8, 8],//调整截面形状
            symbolOffset: [0, -3],
            z: 12,
            symbolPosition: "end",
                "itemStyle": {
                    "normal": {
                         color: new echarts.graphic.LinearGradient(0,0,0,1,
                            [{
                                    offset: 0,
                                    color: "#9DC9FD"
                                },
                                {
                                    offset: 1,
                                    color: "#3279FA"
                                }
                            ],
                            false
                        ),
                    }
                },
            data: flight_time,
        },
        data: flight_time,
      },
      {
        name: '飞行里程',
        type: 'line',
@@ -289,7 +353,7 @@
  padding: 4px 14px 0 15px;
  background: #ffffff !important;
  margin-top: 5px;
    height: pxToVh(400);
    height: pxToVh(471);
  .fytitle {
    display: flex;
@@ -388,7 +452,7 @@
    }
    .lineChart {
     height: pxToVh(233) ;
     height: pxToVh(314) ;
      width: 100%;
      .lineBox {
src/views/wel/components/flyratio.vue
@@ -200,7 +200,7 @@
.machineNest {
  width: 93%;
  margin-left: 10px;
  height: pxToVh(355);
  height: pxToVh(282);
    border-radius: 8px 8px 8px 8px;
  padding: 4px 14px 0 15px;
  background: #ffffff !important;
@@ -303,8 +303,8 @@
  }
  .nestCenter {
    width: 100%;
    // height: 600px;
    height: pxToVh(266);
    height: pxToVh(226);
    .chart {
      width: 100%;
      height: 100%;
src/views/wel/components/proportionStatic.vue
@@ -71,7 +71,6 @@
const getTypeData = () => {
  getJobEventByStatus(params.value).then(res => {
    const resList = res?.data?.data || [];
    resList.forEach(item => {
      eventTypeList.value.forEach(item1 => {
        if (item1.name === item.name) {
@@ -188,12 +187,12 @@
  border-radius: 8px 8px 8px 8px;
  padding: 4px 14px 0 15px;
  background: #ffffff !important;
//   height: 315px;
    height: pxToVh(355);
  height: pxToVh(282);
  margin-bottom: 10px;
  .card-title {
    display: flex;
    margin-bottom: 10px;
    margin-bottom: 4px;
    align-items: center;
    justify-content: space-between;
    .cardtotal {
@@ -241,19 +240,12 @@
      .status-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        // row-gap: 19px;
        // gap: 10px;
        // padding-bottom: 5px;
        .status-item {
          display: flex;
          text-align: center;
          justify-content: space-between;
        //   height: 97px;
          height: pxToVh(107);
          //   max-width: 158px;
          margin-bottom: 19px;
          height: pxToVh(97);
          margin-bottom: 10px;
          margin-right: 14px;
          width: 144px;
          background: #f6f8fe;
@@ -266,10 +258,11 @@
          }
          .statusCon {
            box-sizing: border-box;
            display: flex;
            flex-direction: column;
            // align-items: center;
            padding: 5px 4px 9px 10px;
          justify-content: space-between;
            padding: 10px 4px 39px 10px;
            text-align: left;
            .status-label {
@@ -277,6 +270,7 @@
              font-size: 14px;
              text-align: left;
              color: #383838;
              margin: 0;
            }
            .ratio {
@@ -285,15 +279,16 @@
              color: #363636;
              white-space: nowrap;
              text-align: left;
              margin-top: 10px;
            }
            .status-value {
              font-family: 'Source Han Sans CN';
              font-weight: bold;
              font-size: 30px;
              font-size: 28px;
              height: 28px;
              color: #363636;
              // margin: 5px 0;
              // font-style: italic;
            margin-top: -6px;
              display: inline-block;
              transform: skewX(-5deg);
src/views/wel/components/taskOutcome.vue
@@ -221,7 +221,7 @@
  background: #ffffff !important;
  margin-top: 10px;
  margin-left: 10px;
  height: pxToVh(400);
  height: pxToVh(473);
  .card-title {
    display: flex;
    margin-bottom: 10px;
@@ -307,7 +307,7 @@
.chart {
  width: 98%;
  // height: 265px;
  height: pxToVh(285);
  height: pxToVh(355);
  padding-left: 10px;
  margin-top: 27px;
}