无人机管理后台前端(已迁走)
张含笑
2025-07-21 3be2e099bbc05e902dfcfabc403ade0a2aba8ef4
src/views/wel/components/calendarBox.vue
@@ -12,8 +12,8 @@
              :class="event.type"
              @click="jumpcalendar(event, data.day)"
            >
              <img :src="getEventIcon(event.type)" alt="" />
              {{ event.name }}<span>{{ event.value }}</span>
              <div class="imgBox"><img :src="getEventIcon(event.type)" alt="" /> {{ event.name }}</div>
              <span>{{ event.value }}</span>
            </div>
          </div>
        </div>
@@ -68,7 +68,6 @@
const getDate = date => {
  return date.getDate();
};
console.log('getDate', getDate);
// 获取对应日期的事件
const getEvents = dateString => {
@@ -76,12 +75,17 @@
};
const monthRange = getCurrentMonthRange();
params.value = monthRange;
console.log('params.value', params.value);
const getJobEventBar = () => {
  getCalen(params.value).then(res => {
    if (res.data.code !== 0) return;
    events.value = res.data.data;
    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) => {
@@ -107,50 +111,73 @@
</script>
<style lang="scss">
.calenBox {
 .el-button-group>.el-button:not(:first-child):not(:last-child) {
    border-radius: 0;
  //  height: 630px;
  height: pxToVh(660);
  // 隐藏按钮组中间按钮
  .el-button-group > .el-button:not(:first-child):not(:last-child) {
    display: none;
}
  .el-calendar__title {
    font-weight: bold;
    font-size: 14px;
    color: #363636;
  }
  .el-calendar-table td.is-selected {
    background-color: #f0f7ff;
    border: 2px solid #409eff;
    border-radius: 4px;
  }
  .el-calendar-table td.is-selected .date-number {
    font-weight: bold;
    color: #409eff;
  }
  .el-calendar-table td.is-selected .events {
    // padding: 2px;
  }
  .date-number {
  font-size: 13px !important;}
}
</style>
<style lang="scss" scoped>
.calenBox {
  margin-top: 17px;
  height: 567px;
  margin-top: 10px;
  // height: 630px;
  height: pxToVh(622);
  border-radius: 10px;
  overflow: hidden;
  background-color: #fff;
  ::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(91) !important;
    }
    // 选中日期样式
    .el-calendar-table td.is-selected {
      background-color: #f0f7ff;
      border: 2px solid #409eff;
      border-radius: 4px;
      .date-number {
        font-weight: bold;
        color: #409eff;
      }
    }
  }
  .event-item {
    font-size: 12px;
    // padding: 2px;
    text-align: center;
    border-radius: 3px;
    white-space: nowrap;
    // overflow: hidden;
    // text-overflow: ellipsis;
    &.work-order {
      font-weight: 400;
      font-size: 12px;
      color: #7b7b7b;
      span {
        font-weight: 600;
        font-size: 14px;
@@ -163,13 +190,16 @@
      font-weight: 400;
      font-size: 12px;
      color: #7b7b7b;
      span {
        font-weight: 600;
        font-size: 14px;
        font-size: 18px;
        color: #029d36;
        margin-left: 2px;
      }
    }
    .imgBox {
   font-size: 12px;}
  }
}
</style>