2026-03-27 17:47:09 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="filter-header">
|
|
|
|
|
|
<div class="filter-container">
|
2026-04-13 16:38:07 +08:00
|
|
|
|
<span class="filter-item active" @click="handleDateRangeClick()"
|
|
|
|
|
|
>本轮</span
|
|
|
|
|
|
>
|
2026-03-27 17:47:09 +08:00
|
|
|
|
<div class="date-range-wrapper">
|
|
|
|
|
|
<el-date-picker
|
|
|
|
|
|
v-model="dateRange"
|
|
|
|
|
|
type="daterange"
|
|
|
|
|
|
range-separator="-"
|
|
|
|
|
|
start-placeholder="开始时间"
|
|
|
|
|
|
end-placeholder="结束时间"
|
|
|
|
|
|
size="small"
|
2026-04-13 11:38:11 +08:00
|
|
|
|
popper-class="custom-date-picker"
|
|
|
|
|
|
:teleported="false"
|
2026-03-27 17:47:09 +08:00
|
|
|
|
:prefix-icon="Calendar"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2026-03-31 18:10:34 +08:00
|
|
|
|
<!-- <img class="filter-icon-ai" src="../../assets/RiskWarning_img/AI1@2x.png" alt="" @click="handleAIClick" /> -->
|
2026-03-27 17:47:09 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2026-04-03 18:08:42 +08:00
|
|
|
|
import { ref, watch, inject } from "vue";
|
2026-03-27 17:47:09 +08:00
|
|
|
|
import { Calendar } from "@element-plus/icons-vue";
|
|
|
|
|
|
|
2026-04-09 14:53:44 +08:00
|
|
|
|
const emit = defineEmits(["openAIResult", "dateRangeChange"]);
|
2026-03-30 10:57:32 +08:00
|
|
|
|
|
2026-04-03 18:08:42 +08:00
|
|
|
|
// 注入兄弟组件通信机制
|
2026-04-13 11:38:11 +08:00
|
|
|
|
const triggerRefreshLeftData = inject("triggerRefreshLeftData");
|
2026-03-27 17:47:09 +08:00
|
|
|
|
const dateRange = ref([]);
|
2026-03-30 10:57:32 +08:00
|
|
|
|
|
2026-04-09 14:53:44 +08:00
|
|
|
|
// 设置日期时间为当天的23:59:59
|
|
|
|
|
|
const setEndOfDay = (date) => {
|
|
|
|
|
|
if (!date) return date;
|
|
|
|
|
|
const d = new Date(date);
|
|
|
|
|
|
d.setHours(23, 59, 59, 999);
|
|
|
|
|
|
return d;
|
|
|
|
|
|
};
|
2026-04-15 16:40:35 +08:00
|
|
|
|
// 点击本轮
|
2026-04-13 16:38:07 +08:00
|
|
|
|
const handleDateRangeClick = () => {
|
|
|
|
|
|
dateRange.value = [];
|
2026-04-15 16:40:35 +08:00
|
|
|
|
// triggerRefreshLeftData();
|
|
|
|
|
|
// 不需要手动 emit,watch 会监听 dateRange 变化并自动 emit
|
2026-04-13 16:38:07 +08:00
|
|
|
|
};
|
2026-04-03 18:08:42 +08:00
|
|
|
|
// 监听 dateRange 变化
|
2026-04-13 11:38:11 +08:00
|
|
|
|
watch(
|
|
|
|
|
|
dateRange,
|
|
|
|
|
|
(newVal, oldVal) => {
|
|
|
|
|
|
// 只有当值真正发生变化时才触发
|
2026-04-13 16:38:07 +08:00
|
|
|
|
console.log("dateRange 变化:", newVal, oldVal);
|
2026-04-13 11:38:11 +08:00
|
|
|
|
if (JSON.stringify(newVal) !== JSON.stringify(oldVal)) {
|
|
|
|
|
|
console.log("dateRange 发生变化:", newVal);
|
|
|
|
|
|
// 如果有结束日期,将其设置为当天的23:59:59
|
|
|
|
|
|
if (newVal && newVal.length === 2 && newVal[1]) {
|
|
|
|
|
|
newVal[1] = setEndOfDay(newVal[1]);
|
|
|
|
|
|
}
|
|
|
|
|
|
// 触发兄弟组件刷新
|
2026-04-15 16:40:35 +08:00
|
|
|
|
// if (triggerRefreshLeftData) {
|
|
|
|
|
|
// triggerRefreshLeftData();
|
|
|
|
|
|
// }
|
2026-04-13 11:38:11 +08:00
|
|
|
|
// 向父组件传递时间范围
|
|
|
|
|
|
emit("dateRangeChange", newVal);
|
2026-04-03 18:08:42 +08:00
|
|
|
|
}
|
2026-04-13 11:38:11 +08:00
|
|
|
|
},
|
|
|
|
|
|
{ deep: true },
|
|
|
|
|
|
);
|
2026-04-03 18:08:42 +08:00
|
|
|
|
|
2026-03-30 10:57:32 +08:00
|
|
|
|
const handleAIClick = () => {
|
|
|
|
|
|
emit("openAIResult");
|
|
|
|
|
|
};
|
2026-03-27 17:47:09 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2026-03-30 10:57:32 +08:00
|
|
|
|
// 视频屏幕自适应 - 基于视口宽度动态调整
|
|
|
|
|
|
// 基准宽度 1920px,使用 vw 单位实现自适应
|
|
|
|
|
|
@function vw($px) {
|
|
|
|
|
|
@return calc($px / 1920 * 100vw);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-27 17:47:09 +08:00
|
|
|
|
.filter-header {
|
2026-03-30 10:57:32 +08:00
|
|
|
|
padding: vw(10);
|
2026-03-27 17:47:09 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
// align-items: center;
|
2026-03-30 10:57:32 +08:00
|
|
|
|
|
|
|
|
|
|
// 小屏幕适配
|
|
|
|
|
|
@media (max-width: 1366px) {
|
|
|
|
|
|
padding: 8px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@media (max-width: 1024px) {
|
|
|
|
|
|
padding: 6px;
|
|
|
|
|
|
}
|
2026-03-27 17:47:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.filter-container {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
2026-04-13 11:38:11 +08:00
|
|
|
|
width: 100%;
|
2026-03-30 10:57:32 +08:00
|
|
|
|
height: vw(20);
|
|
|
|
|
|
min-height: 18px;
|
|
|
|
|
|
gap: vw(8);
|
|
|
|
|
|
font-size: vw(13);
|
2026-03-27 17:47:09 +08:00
|
|
|
|
|
|
|
|
|
|
.filter-item {
|
2026-04-02 16:35:45 +08:00
|
|
|
|
color: #fff;
|
|
|
|
|
|
padding: vw(8) vw(8);
|
2026-03-27 17:47:09 +08:00
|
|
|
|
background: #183c67;
|
|
|
|
|
|
box-shadow: inset 0px 0px 8px 0px #4fecff;
|
2026-04-02 16:35:45 +08:00
|
|
|
|
cursor: pointer;
|
2026-03-27 17:47:09 +08:00
|
|
|
|
|
|
|
|
|
|
// &:hover {
|
|
|
|
|
|
// border-color: rgba(64, 169, 255, 0.5);
|
|
|
|
|
|
// color: rgba(255, 255, 255, 0.8);
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// &.active {
|
|
|
|
|
|
// background: rgba(64, 169, 255, 0.2);
|
|
|
|
|
|
// color: #40a9ff;
|
|
|
|
|
|
// border-color: rgba(64, 169, 255, 0.5);
|
|
|
|
|
|
// }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.date-range-wrapper {
|
2026-04-02 16:35:45 +08:00
|
|
|
|
:deep(.el-date-editor) {
|
|
|
|
|
|
border-radius: 0px !important;
|
|
|
|
|
|
height: 2.6em !important;
|
|
|
|
|
|
}
|
2026-03-27 17:47:09 +08:00
|
|
|
|
:deep(.el-date-editor) {
|
2026-04-09 14:53:44 +08:00
|
|
|
|
width: 200px;
|
2026-04-03 18:08:42 +08:00
|
|
|
|
max-width: vw(350);
|
2026-03-27 17:47:09 +08:00
|
|
|
|
background: #183c67;
|
|
|
|
|
|
box-shadow: inset 0px 0px 8px 0px #4fecff;
|
|
|
|
|
|
|
|
|
|
|
|
.el-range-input {
|
|
|
|
|
|
background: transparent;
|
|
|
|
|
|
color: rgba(255, 255, 255, 0.8);
|
|
|
|
|
|
|
|
|
|
|
|
&::placeholder {
|
|
|
|
|
|
color: rgba(255, 255, 255, 0.5);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.el-range-separator {
|
|
|
|
|
|
color: rgba(255, 255, 255, 0.4);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.el-icon {
|
|
|
|
|
|
color: rgba(255, 255, 255, 0.5);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// &:hover {
|
|
|
|
|
|
// border-color: rgba(64, 169, 255, 0.5);
|
|
|
|
|
|
// }
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
.filter-icon-ai {
|
2026-03-30 10:57:32 +08:00
|
|
|
|
width: vw(67);
|
|
|
|
|
|
height: vw(67);
|
|
|
|
|
|
min-width: 48px;
|
|
|
|
|
|
min-height: 48px;
|
2026-03-27 17:47:09 +08:00
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|