You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

217 lines
6.9 KiB
Vue

<!--
* @Author: donghao donghao@supervision.ltd
* @Date: 2025-03-06 15:15:01
* @LastEditors: donghao donghao@supervision.ltd
* @LastEditTime: 2025-03-12 13:30:24
* @FilePath: \vite-ai\data-dashboard\src\views\dashboard\PoleMonitor.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="pole-monitor-wrap">
<div class="module-header">
<ContentHeader bgLayout="1855">
<template #title>
<div class="w-[200px] bg_title bg_title_3">
</div>
</template>
<template #extra>
<div></div>
</template>
</ContentHeader>
</div>
<!-- 搜索区域 -->
<div class="pole-monitor-search-box">
<el-select v-model="searchForm.name" placeholder="列车号" class="custom-select">
<el-option label="A" value="deviceA"></el-option>
<el-option label="B" value="deviceB"></el-option>
</el-select>
<el-select v-model="searchForm.deviceId" placeholder="车厢号" class="custom-select">
<el-option label="ID-001" value="id001"></el-option>
<el-option label="ID-002" value="id002"></el-option>
</el-select>
<el-select v-model="searchForm.faultType" placeholder="故障类型" class="custom-select">
<el-option label="类型1" value="id001"></el-option>
<el-option label="类型2" value="id002"></el-option>
</el-select>
<el-button type="primary" @click="handleQuery" class="basic-btn query-btn">
<span class="icon"></span> 查询
</el-button>
<el-button @click="handleReset" class="basic-btn reset-btn">
<span class="icon"></span> 重置
</el-button>
</div>
<!-- 主体内容区域 -->
<div class="flex justify-between pole-monitor-main">
<!-- 左侧视频与缩略图区域 -->
<div class="left-panel w-[900px]">
<!-- 主图显示 -->
<div class="main-image">
<img src="https://picsum.photos/300/200?random=1" alt="监控画面">
<div class="image-info">
长: 35cm 宽: 52cm 高: 28cm 体积: 50960cm 重量: 58kg
</div>
</div>
<!-- 缩略图区域 -->
<div class="thumbnail-container">
<swiper ref="swiperRef" :modules="modules" :slides-per-view="4" :space-between="10" navigation
:scrollbar="{ draggable: false }" :centered-slides="false" :observer="true"
:observeParents="true" @swiper="onSwiper" @slideChange="onSlideChange">
<swiper-slide v-for="(image, index) in images" :key="index" @click="handleSlideClick(index)"
:class="{ 'active-slide': activeIndex === index }">
<img :src="image" alt="Slide" />
</swiper-slide>
</swiper>
</div>
</div>
<!-- 右侧表格区域 -->
<div class="right-panel w-[934px]">
<div class="bg-transparent baseTable_wrap">
<template v-if="pagination.total > 0">
<BaseTable class="bg-transparent baseTable_box" :total="pagination.total"
:pageSize="pagination.pageSize" :dataSource="listData" :isFixedPagination="true"
:columns="columns" :page="pagination.currentPage" @change="handleTableChange">
</BaseTable>
</template>
</div>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import ContentHeader from '@/components/ContentHeader.vue';
import { BaseTable } from "@/components/CustomTable";
import { Swiper, SwiperSlide } from "swiper/vue";
import { Navigation, Scrollbar } from "swiper/modules";
import "swiper/css";
import 'swiper/scss';
import 'swiper/scss/navigation';
defineOptions({
name: "PoleMonitorIndex"
});
const modules = [Navigation, Scrollbar];
const images = ref([
'https://picsum.photos/300/200?random=1',
'https://picsum.photos/300/200?random=2',
'https://picsum.photos/300/200?random=3',
'https://picsum.photos/300/200?random=4',
'https://picsum.photos/300/200?random=5'
]);
const activeIndex = ref(-1);
const handleSlideClick = (index) => {
console.log(index);
activeIndex.value = index;
};
const swiperRef = ref(null);
console.log(swiperRef.value);
const onSwiper = (swiper) => {
swiperRef.value = swiper;
console.log('Swiper 实例已获取:', swiper);
};
const onSlideChange = () => {
console.log("slide change");
};
// const currentRow = ref<Record<string, any>>({});
const columns = [
{
label: "车号",
property: "carNo",
width: 100,
},
{
label: "车型",
property: "carType",
width: 100,
},
{
label: "车厢号",
property: "carriageNo",
width: 100,
},
{
label: "告警类型",
property: "warnType",
width: 120,
},
{
label: "故障类型",
property: "faultType",
width: 120,
},
{
label: "等级",
property: "level",
width: 80,
},
{
label: "复核",
property: "review",
width: 80,
},
{
label: "时间",
property: "date"
}
]
const pagination = ref({ currentPage: 1, pageSize: 10, total: 0 });
const listData = ref([]);
const searchForm = reactive({
name: "",
status: "",
faultType: "",
});
const dataLoading = ref(true);
const getList = async () => {
const { currentPage, pageSize } = pagination.value;
const res = await fetch('/api/getPoleMonitorList', {
method: 'POST',
body: JSON.stringify({ ...searchForm, page: currentPage, pageSize })
})
const { data } = await res.json()
console.log(data, 'getList_data')
listData.value = data.list;
console.log(data.list);
pagination.value = {
...pagination.value,
total: data.total
};
dataLoading.value = false;
};
// 查询方法
const handleQuery = () => {
getList()
};
// 重置方法
const handleReset = () => {
searchForm.name = '';
// deviceId.value = '';
getList()
};
function handleTableChange(record) {
console.log("handleTableChange_record", record);
pagination.value = {
...pagination.value,
currentPage: record.page,
pageSize: record.pageSize
};
getList();
}
onMounted(() => {
getList();
});
</script>
<style lang="scss">
@import url('./PoleMonitor.scss');
</style>