From 7f1c3e31c07a161e6ba8219c4e81ae9487c94fda Mon Sep 17 00:00:00 2001 From: guanj Date: Fri, 17 Jul 2026 11:17:38 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=91=E6=B5=8B=E7=82=B9=E8=AF=84=E4=BC=B0?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/table/defaultAttribute.ts | 2 +- src/components/table/index.vue | 12 ++- .../components/MonitoringPointTab.vue | 83 ++++++++++++++++--- 3 files changed, 84 insertions(+), 13 deletions(-) diff --git a/src/components/table/defaultAttribute.ts b/src/components/table/defaultAttribute.ts index 65ed9042..137d8864 100644 --- a/src/components/table/defaultAttribute.ts +++ b/src/components/table/defaultAttribute.ts @@ -11,7 +11,7 @@ export const defaultAttribute: VxeTableProps = { scrollX: { scrollToLeftOnChange: true }, scrollY: { enabled: false }, // 注意:全局不要默认开启 treeConfig,会与 stripe 冲突;树表在页面自行配置 - customConfig: { enabled: true, allowFixed: true, storage: true, showFooter: false, immediate: true ,mode:'default'}, + customConfig: { enabled: true, allowFixed: true, storage: false, showFooter: false, immediate: true ,mode:'default'}, showOverflow: 'tooltip', showHeaderOverflow: false } diff --git a/src/components/table/index.vue b/src/components/table/index.vue index 0c0f145f..188dde21 100644 --- a/src/components/table/index.vue +++ b/src/components/table/index.vue @@ -9,10 +9,10 @@ ref="tableRef" height="auto" :key="key" - :id="getTableId()" :data="tableStore.table.data" v-loading="tableStore.table.loading" v-bind="tableBindProps" + :id="getTableId()" @checkbox-all="selectChangeEvent" @checkbox-change="selectChangeEvent" @cell-click="onCellClick" @@ -105,9 +105,17 @@ const props = withDefaults(defineProps(), { }) const attrs = useAttrs() const tableBindProps = computed(() => { + const enableStorage = props.showCustomColumn || !!tableStore?.table?.customColumnInHeader + const baseCustomConfig = (defaultAttribute.customConfig || {}) as Record + const attrsCustomConfig = ((attrs.customConfig as Record) || {}) as Record return Object.assign({}, defaultAttribute, attrs, { showOverflow: props.showOverflow, - showHeaderOverflow: false + showHeaderOverflow: false, + customConfig: { + ...baseCustomConfig, + ...attrsCustomConfig, + storage: enableStorage ? true : !!attrsCustomConfig.storage + } }) }) const onCellClick: VxeTableEvents.CellClick = params => { diff --git a/src/views/pqs/harmonicMonitoring/detailed/pollutionReport/components/MonitoringPointTab.vue b/src/views/pqs/harmonicMonitoring/detailed/pollutionReport/components/MonitoringPointTab.vue index a451c35e..975be2f4 100644 --- a/src/views/pqs/harmonicMonitoring/detailed/pollutionReport/components/MonitoringPointTab.vue +++ b/src/views/pqs/harmonicMonitoring/detailed/pollutionReport/components/MonitoringPointTab.vue @@ -47,6 +47,14 @@ @@ -57,6 +65,7 @@ auto-resize :data="tableStore.table.data" v-bind="defaultAttribute" + :id="tableId" :height="tableHeight" resizable show-overflow @@ -71,8 +80,7 @@ min-width="150" > - - + - - - - - - - + + + + + + + + + + + + + + + + + @@ -138,6 +178,7 @@ const options = dictData.getBasicData('Pollution_Calc') const tableHeight = ref(500) const tableRef = ref() const tableHeaderRef = ref() +const tableId = 'pollution-monitoring-point-report' const selectedArea = ref() const areOptions: any = dictData.state.area @@ -145,6 +186,28 @@ const allData = ref([]) const searchKeyword = ref('') const harmonicValueTitle = ref('谐波电压污染值') +let customColumnVisibleOnPress = false +const onCustomColumnMousedown = () => { + const table = tableRef.value as any + if (!table) return + customColumnVisibleOnPress = table.getCustomVisible?.() ?? !!table.reactData?.customStore?.visible + if (table.reactData?.customStore) { + table.reactData.customStore.activeBtn = true + } +} +const openCustomColumn = () => { + const table = tableRef.value as any + if (!table) return + if (table.reactData?.customStore) { + table.reactData.customStore.activeBtn = false + } + if (customColumnVisibleOnPress) { + table.closeCustom?.() + } else { + table.openCustom?.() + } +} + const cascaderProps = { label: 'name', value: 'id', @@ -244,6 +307,7 @@ const updateTotal = computed(() => { const tableStore = new TableStore({ url: '/harmonic-boot/PollutionSubstation/downPollutionLineCalc', method: 'POST', + filename: '监测点评估', column: [], beforeSearchFun: () => { delete tableStore.table.params.deptIndex @@ -293,7 +357,6 @@ tableStore.table.params.isUpToGrid = 0 tableStore.table.params.type = 1 const handleStatisticalTypeChange = (newVal: { id: any }) => { - if (newVal) { tableStore.table.params.statisticalType = newVal tableStore.table.params.ids = [newVal.id]