2026-05-09 17:04:48 +08:00
|
|
|
|
<!-- SidePanelItem.vue -->
|
|
|
|
|
|
<template>
|
2026-07-07 10:33:29 +08:00
|
|
|
|
<SidePanelItem title="过鱼设施">
|
|
|
|
|
|
<a-spin :spinning="loading" tip="加载中...">
|
|
|
|
|
|
<div class="facility-grid">
|
|
|
|
|
|
<div
|
|
|
|
|
|
v-for="facility in facilities"
|
|
|
|
|
|
:key="facility.name"
|
|
|
|
|
|
class="facility-card"
|
|
|
|
|
|
@click="handleFacilityClick(facility)"
|
|
|
|
|
|
>
|
|
|
|
|
|
<div
|
|
|
|
|
|
style="
|
|
|
|
|
|
width: 60px;
|
|
|
|
|
|
height: 62px;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
"
|
|
|
|
|
|
>
|
|
|
|
|
|
<div class="facility-icon">
|
|
|
|
|
|
<i
|
|
|
|
|
|
style="color: #fff"
|
|
|
|
|
|
:class="facility.icon"
|
|
|
|
|
|
type="icon-shengtailiuliang2"
|
|
|
|
|
|
></i>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2026-05-09 17:04:48 +08:00
|
|
|
|
|
2026-07-07 10:33:29 +08:00
|
|
|
|
<div class="facility-info">
|
|
|
|
|
|
<div class="facility-name">{{ facility.name }}</div>
|
|
|
|
|
|
<div style="font-size: 16px">
|
|
|
|
|
|
<span class="facility-count">{{ facility.count }}</span
|
|
|
|
|
|
><span>座</span>
|
2026-05-09 17:04:48 +08:00
|
|
|
|
</div>
|
2026-07-07 10:33:29 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</a-spin>
|
|
|
|
|
|
</SidePanelItem>
|
|
|
|
|
|
<!-- 弹框 -->
|
|
|
|
|
|
<a-modal
|
|
|
|
|
|
v-model:open="modalVisible"
|
|
|
|
|
|
:title="'过鱼设施'"
|
|
|
|
|
|
:footer="null"
|
|
|
|
|
|
width="1536px"
|
|
|
|
|
|
@cancel="handleCloseModal"
|
|
|
|
|
|
>
|
|
|
|
|
|
<ModalPage v-if="currentFacility" :data="currentFacility" :jdId="'all'" />
|
|
|
|
|
|
</a-modal>
|
2026-05-09 17:04:48 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
|
|
import { ref, onMounted, onUnmounted, watch, nextTick } from 'vue';
|
|
|
|
|
|
import SidePanelItem from '@/components/SidePanelItem/index.vue';
|
2026-07-07 10:33:29 +08:00
|
|
|
|
import { useJidiSelectEventStore } from '@/store/modules/jidiSelectEvent';
|
2026-06-05 16:12:33 +08:00
|
|
|
|
import { buildGetKendoListCust } from '@/api/gyss';
|
2026-07-07 10:33:29 +08:00
|
|
|
|
import ModalPage from './ModalPage/index.vue';
|
|
|
|
|
|
import { useDraggable } from '@/utils/drag';
|
|
|
|
|
|
|
2026-05-09 17:04:48 +08:00
|
|
|
|
// 定义组件名(便于调试和递归)
|
|
|
|
|
|
defineOptions({
|
2026-07-07 10:33:29 +08:00
|
|
|
|
name: 'qixidibaohugongzuokaizhanQK'
|
2026-05-09 17:04:48 +08:00
|
|
|
|
});
|
2026-06-05 16:12:33 +08:00
|
|
|
|
const JidiSelectEventStore = useJidiSelectEventStore();
|
|
|
|
|
|
// loading状态
|
|
|
|
|
|
const loading = ref(false);
|
2026-05-09 17:04:48 +08:00
|
|
|
|
// 设施数据
|
|
|
|
|
|
const facilities = ref([
|
2026-07-07 10:33:29 +08:00
|
|
|
|
{
|
|
|
|
|
|
name: '鱼道',
|
|
|
|
|
|
count: 0,
|
|
|
|
|
|
icon: 'icon iconfont icon-map-gyssYudao',
|
|
|
|
|
|
key: 'FP_1'
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
name: '集运鱼系统',
|
|
|
|
|
|
count: 0,
|
|
|
|
|
|
icon: 'icon iconfont icon-map-gyssJiyunyuxitong',
|
|
|
|
|
|
key: 'FP_3'
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
name: '升鱼机',
|
|
|
|
|
|
count: 0,
|
|
|
|
|
|
icon: 'icon iconfont icon-map-gyssShengyuji',
|
|
|
|
|
|
key: 'FP_4'
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
name: '其他',
|
|
|
|
|
|
count: 0,
|
|
|
|
|
|
icon: 'icon iconfont icon-map-gyssQita',
|
|
|
|
|
|
key: 'FP_5'
|
|
|
|
|
|
}
|
2026-05-09 17:04:48 +08:00
|
|
|
|
]);
|
2026-07-07 10:33:29 +08:00
|
|
|
|
const baseid = ref('');
|
2026-06-05 16:12:33 +08:00
|
|
|
|
// 弹框相关状态
|
|
|
|
|
|
const modalVisible = ref(false);
|
|
|
|
|
|
const currentFacility = ref<any>(null);
|
2026-07-07 10:33:29 +08:00
|
|
|
|
useDraggable(modalVisible, { boundary: true, resetOnOpen: true });
|
2026-06-05 16:12:33 +08:00
|
|
|
|
//获取页面数据
|
|
|
|
|
|
const getData = async () => {
|
2026-07-07 10:33:29 +08:00
|
|
|
|
loading.value = true;
|
|
|
|
|
|
try {
|
|
|
|
|
|
let params = {
|
|
|
|
|
|
filter: {
|
|
|
|
|
|
logic: 'and',
|
|
|
|
|
|
filters: []
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
const res = await buildGetKendoListCust(params); //适配监控-VD
|
|
|
|
|
|
let data = res?.data?.data || res?.data || [];
|
|
|
|
|
|
|
|
|
|
|
|
// 重置所有设施的count为0
|
|
|
|
|
|
facilities.value.forEach(facility => {
|
|
|
|
|
|
facility.count = 0;
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// 遍历接口返回的所有数据
|
|
|
|
|
|
data.forEach(item => {
|
|
|
|
|
|
const matchedFacility = facilities.value.find(
|
|
|
|
|
|
facility => facility.key === item.sttpCode
|
|
|
|
|
|
);
|
|
|
|
|
|
if (matchedFacility) {
|
|
|
|
|
|
// 如果在facilities中找到对应的key,累加到该设施
|
|
|
|
|
|
matchedFacility.count +=
|
|
|
|
|
|
Number(item.built) + Number(item.building) || 0;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
// 如果没有找到对应的key,累加到FP_5(其他)
|
|
|
|
|
|
const otherFacility = facilities.value.find(
|
|
|
|
|
|
facility => facility.key === 'FP_5'
|
|
|
|
|
|
);
|
|
|
|
|
|
if (otherFacility) {
|
|
|
|
|
|
otherFacility.count +=
|
|
|
|
|
|
Number(item.built) + Number(item.building) || 0;
|
2026-06-05 16:12:33 +08:00
|
|
|
|
}
|
2026-07-07 10:33:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.error('获取数据失败:', error);
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
loading.value = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
2026-06-05 16:12:33 +08:00
|
|
|
|
// 点击处理函数
|
|
|
|
|
|
const handleFacilityClick = (facility: any) => {
|
2026-07-07 10:33:29 +08:00
|
|
|
|
currentFacility.value = facility;
|
|
|
|
|
|
modalVisible.value = true;
|
2026-06-05 16:12:33 +08:00
|
|
|
|
};
|
|
|
|
|
|
// 关闭弹框
|
|
|
|
|
|
const handleCloseModal = () => {
|
2026-07-07 10:33:29 +08:00
|
|
|
|
modalVisible.value = false;
|
|
|
|
|
|
currentFacility.value = null;
|
2026-06-05 16:12:33 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
watch(
|
2026-07-07 10:33:29 +08:00
|
|
|
|
() => JidiSelectEventStore.selectedItem,
|
|
|
|
|
|
newVal => {
|
|
|
|
|
|
baseid.value = newVal.wbsCode;
|
|
|
|
|
|
getData();
|
|
|
|
|
|
},
|
|
|
|
|
|
{ deep: true, immediate: true }
|
2026-06-05 16:12:33 +08:00
|
|
|
|
);
|
2026-05-09 17:04:48 +08:00
|
|
|
|
// 页面加载时执行
|
|
|
|
|
|
onMounted(() => {
|
2026-07-07 10:33:29 +08:00
|
|
|
|
// 延迟初始化,确保容器已渲染
|
2026-05-09 17:04:48 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// 组件卸载时清理
|
2026-07-07 10:33:29 +08:00
|
|
|
|
onUnmounted(() => {});
|
2026-05-09 17:04:48 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
.facility-grid {
|
2026-07-07 10:33:29 +08:00
|
|
|
|
width: 406px;
|
|
|
|
|
|
flex-flow: wrap;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto,
|
|
|
|
|
|
Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji,
|
|
|
|
|
|
Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;
|
2026-05-09 17:04:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.facility-card {
|
2026-07-07 10:33:29 +08:00
|
|
|
|
width: 200px;
|
|
|
|
|
|
height: 70px;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
margin: 4px 0px;
|
|
|
|
|
|
background: #fff;
|
|
|
|
|
|
border: 1px solid #e8e8e8;
|
|
|
|
|
|
border-radius: 2px;
|
|
|
|
|
|
transition: all 0.3s;
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
box-sizing: border-box;
|
2026-05-09 17:04:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.facility-icon {
|
2026-07-07 10:33:29 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
width: 40px;
|
|
|
|
|
|
height: 40px;
|
|
|
|
|
|
// margin-right: 8px;
|
|
|
|
|
|
background: #5389b5;
|
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
|
|
|
|
|
|
|
.anticon {
|
|
|
|
|
|
font-size: 24px;
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
}
|
2026-05-09 17:04:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.facility-info {
|
2026-07-07 10:33:29 +08:00
|
|
|
|
flex: 1;
|
2026-05-09 17:04:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.facility-name {
|
2026-07-07 10:33:29 +08:00
|
|
|
|
font-size: 16px;
|
|
|
|
|
|
color: #333;
|
|
|
|
|
|
// margin-bottom: 4px;
|
|
|
|
|
|
// font-weight: 500;
|
2026-05-09 17:04:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.facility-count {
|
2026-07-07 10:33:29 +08:00
|
|
|
|
font-size: 18px;
|
|
|
|
|
|
color: #2f6b98;
|
|
|
|
|
|
// font-weight: 600;
|
2026-05-09 17:04:48 +08:00
|
|
|
|
}
|
2026-07-07 10:33:29 +08:00
|
|
|
|
</style>
|