基础信息组件更改-增加可控制显隐的下拉框

This commit is contained in:
王兴凯 2026-06-03 18:25:57 +08:00
parent bbfea93b20
commit 28e7b8013d
6 changed files with 64 additions and 14 deletions

View File

@ -1,7 +1,7 @@
<template> <template>
<a-spin :spinning="loading"> <a-spin :spinning="loading">
<div class="modal-baseic-container"> <div class="modal-baseic-container" >
<a-row class="w-[100%]"> <a-row class="w-[100%]" v-if="!loading">
<a-col :span="!item.visible ? 24 : (item.filed == '' ? 12 : 12)" v-for="(item, index) in tabledata" <a-col :span="!item.visible ? 24 : (item.filed == '' ? 12 : 12)" v-for="(item, index) in tabledata"
:key="item.key"> :key="item.key">
<div class="col-title" v-if="!item.visible"> <div class="col-title" v-if="!item.visible">
@ -58,7 +58,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import dayjs from "dayjs"; import dayjs from "dayjs";
import { ref, onMounted, nextTick } from "vue"; import { ref, onMounted, nextTick,watch } from "vue";
import { BasicColumns, wtPointColumns, FhWpPointColumns, FhPointColumns, FhZQPointColumns, FPPointColumns, FBPointColumns, VaPointColumns, VPPointColumns, wePointColumns, waPointColumns, DwPointColumns, DwFivePointColumns, DwSixPointColumns, DwOnePointColumns, StinfoAiVidoPointColumns } from "../column.config"; import { BasicColumns, wtPointColumns, FhWpPointColumns, FhPointColumns, FhZQPointColumns, FPPointColumns, FBPointColumns, VaPointColumns, VPPointColumns, wePointColumns, waPointColumns, DwPointColumns, DwFivePointColumns, DwSixPointColumns, DwOnePointColumns, StinfoAiVidoPointColumns } from "../column.config";
import { useModelStore } from "@/store/modules/model"; import { useModelStore } from "@/store/modules/model";
import { getStcdDetail } from "@/api/mapModal" import { getStcdDetail } from "@/api/mapModal"
@ -268,6 +268,17 @@ onMounted(() => {
}, 1000); }, 1000);
}); });
//modelStore.params.stcd
watch(
() => modelStore.params.stcd,
(newStcd, oldStcd) => {
//
if (newStcd && newStcd !== oldStcd && props.url) {
console.log('【BasicInfo】stcd 变化,重新加载数据:', newStcd);
getData();
}
}
);
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -29,7 +29,8 @@
<template #contrast="{ record }"> <template #contrast="{ record }">
<span v-if="record.wt && record.beforeWt" <span v-if="record.wt && record.beforeWt"
:style="{ color: (record.wt - record.beforeWt) > 0 ? 'rgb(255, 85, 0)' : 'rgb(135, 208, 104)' }"> :style="{ color: (record.wt - record.beforeWt) > 0 ? 'rgb(255, 85, 0)' : 'rgb(135, 208, 104)' }">
{{ (record.wt - record.beforeWt) > 0 ? '+' : '' }}{{ (record.wt - record.beforeWt).toFixed(2) }} {{ (record.wt - record.beforeWt) > 0 ? '+' : '' }}{{ (record.wt -
record.beforeWt).toFixed(2) }}
</span> </span>
<span v-else>-</span> <span v-else>-</span>
</template> </template>
@ -606,6 +607,18 @@ onMounted(() => {
onUnmounted(() => { onUnmounted(() => {
destroyChart() destroyChart()
}); });
watch(
() => modelStore.params.stcd,
(newStcd, oldStcd) => {
//
if (newStcd && newStcd !== oldStcd) {
console.log('【BasicInfo】stcd 变化,重新加载数据:', newStcd);
getSelectOption()
getEchartsData()
gerTableData()
}
}
);
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -1,6 +1,11 @@
<template> <template>
<a-modal :open="visible" :title="title" width="80vw" :footer="null" :closable="true" @cancel="handleClose" <a-modal :open="visible" :title="title" width="80vw" :footer="null" :closable="true" @cancel="handleClose"
:destroyOnClose="true" class="map-modal"> :destroyOnClose="true" class="map-modal">
<div v-if="modelStore.showStcdSelector" class="stcd-selector-wrapper">
<a-select v-model:value="modelStore.params.stcd" placeholder="请选择测站" style="width: 240px; margin-bottom: 12px;"
:options="modelStore.stcdOptions" show-search :filter-option="filterOption" @change="handleStcdChange">
</a-select>
</div>
<a-tabs :active-key="currentActiveKey" @change="onTabChange"> <a-tabs :active-key="currentActiveKey" @change="onTabChange">
<a-tab-pane v-for="tab in tabsConfig" :key="tab.key" :tab="tab.name"> <a-tab-pane v-for="tab in tabsConfig" :key="tab.key" :tab="tab.name">
<div class="content"> <div class="content">
@ -102,6 +107,9 @@ const onTabChange = (key: string) => {
// //
const handleClose = () => { const handleClose = () => {
emit("update:visible", false); emit("update:visible", false);
// ,
modelStore.showStcdSelector = false;
modelStore.stcdOptions = [];
}; };
// 便使 props.data // 便使 props.data
@ -112,6 +120,17 @@ watch(
modalData.value = newVal; modalData.value = newVal;
} }
); );
//
const filterOption = (input: string, option: any) => {
return option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
};
//
const handleStcdChange = (newStcd: string) => {
console.log('【测站切换】', newStcd);
// BasicInfo.vue stcd , store
// tab ,
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -210,6 +210,8 @@ const initChart = () => {
modelStore.params.sttp = "fh_zq_point"; modelStore.params.sttp = "fh_zq_point";
modelStore.title = "水文监测"; modelStore.title = "水文监测";
modelStore.params.stcd = select.value.value; modelStore.params.stcd = select.value.value;
modelStore.showStcdSelector = true
modelStore.stcdOptions = select.value.options
} }
}); });
}; };

View File

@ -331,6 +331,8 @@ const handleDataPointClick = (params: any) => {
modelStore.params.sttp = "wt_point"; modelStore.params.sttp = "wt_point";
modelStore.title = '水温监测'; modelStore.title = '水温监测';
modelStore.params.stcd = dataItem.stcd; modelStore.params.stcd = dataItem.stcd;
modelStore.showStcdSelector = true
modelStore.stcdOptions = select.value.options
} }
}; };

View File

@ -8,7 +8,8 @@ export const useModelStore = defineStore('model', () => {
const tabList = ref([]); const tabList = ref([]);
const title = ref(''); const title = ref('');
const isBasicEdit = ref(false); const isBasicEdit = ref(false);
const showStcdSelector = ref(false); // 是否显示下拉框
const stcdOptions = ref<Array<{ label: string, value: string }>>([]); // 可选测站列表
const params = ref<{ const params = ref<{
sttp: string; sttp: string;
stcd: any; stcd: any;
@ -27,5 +28,7 @@ export const useModelStore = defineStore('model', () => {
tabList, tabList,
title, title,
isBasicEdit, isBasicEdit,
showStcdSelector, // 新增
stcdOptions // 新增
}; };
}); });