From 8fba065bc4722644b08ae1ddd1e88c1241ada643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=85=B4=E5=87=AF?= <2448379534@qq.com> Date: Mon, 22 Jun 2026 10:00:26 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=9F=E6=80=81=E6=B5=81=E9=87=8F=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=A0=A1=E5=87=86=E5=92=8C=E8=A1=A8=E6=A0=BC=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E6=8E=92=E5=BA=8F=E6=96=B9=E5=BC=8F=E7=9A=84=E6=9B=B4?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/stll/index.ts | 8 +- frontend/src/components/BasicTable/index.vue | 82 ++++-- .../MapModal/components/EarlyWarningAlert.vue | 1 - .../SurveyQingKuang/DeviceTableModal.vue | 35 +-- .../ModalPage/index.vue | 51 +--- .../qixidiheduanjianceqingkuangEJ/index.vue | 82 ++---- .../xieFangFangShi/TwoLayer/STLLXFFS.vue | 87 ++---- .../xieFangFangShi/index.vue | 45 ++- .../TwoLayer/FenBuQingKuangTwoLayer.vue | 72 ++--- .../TwoLayer/ModalYkzhbzdjcgz.vue | 47 +-- .../ShengTaiLiuLiangDaBQKTwoLayer.vue | 54 +--- .../TwoLayer/STLLXFFS.vue | 90 +++--- .../modules/shengtaidabiaoTwoMod/index.vue | 269 ++++++++++++------ 13 files changed, 419 insertions(+), 504 deletions(-) diff --git a/frontend/src/api/stll/index.ts b/frontend/src/api/stll/index.ts index 4eaf0cd0..58db464a 100644 --- a/frontend/src/api/stll/index.ts +++ b/frontend/src/api/stll/index.ts @@ -34,7 +34,7 @@ export function evnmAutoMonitorGetKendoListCust(queryParams: any) { //获取电站 export function vmsstbprptGetKendoList(queryParams: any) { return request({ - url: '/eq/vmsstbprpt/GetKendoList', + url: '/eq/base/vmsstbprpt/GetKendoList', method: 'post', data: queryParams }); @@ -58,7 +58,7 @@ export function intervalGetKendoListCust(queryParams: any) { // 获取生态流量达标率按性能 export function eqGetKendoListCust(queryParams: any) { return request({ - url: '/api/wmp-eng-server/eng/to/eq/GetKendoListCust', + url: '/eq/to/eq/GetKendoListCust', method: 'post', data: queryParams }); @@ -82,7 +82,7 @@ export function wbsbGetKendoList(queryParams: any) { //生态流量泄放方式 export function msstbprptGetKendoList(queryParams: any) { return request({ - url: '/eq/msstbprpt/GetKendoList', + url: '/eq/base/msstbprpt/GetKendoList', method: 'post', data: queryParams }); @@ -90,7 +90,7 @@ export function msstbprptGetKendoList(queryParams: any) { //根据流域获取电站 export function qgcgetEngLimit(queryParams: any) { return request({ - url: '/api/wmp-eng-server/eng/engalong/statistics/qgc/getEngLimit', + url: '/eq/engalong/statistics/qgc/getEngLimit', method: 'post', data: queryParams }); diff --git a/frontend/src/components/BasicTable/index.vue b/frontend/src/components/BasicTable/index.vue index f124d5be..0671418a 100644 --- a/frontend/src/components/BasicTable/index.vue +++ b/frontend/src/components/BasicTable/index.vue @@ -101,6 +101,12 @@ const lastFilter = ref | undefined>(undefined); const tableContainerRef = ref(null); const tableScrollY = ref(0); // ✅ 新增:存储容器高度 +// --- 内部排序状态 --- +const internalSort = ref<{ + field: string; + order: 'ascend' | 'descend' | null; +}>({ field: '', order: null }); + // --- Computed Scroll Config --- const scrollConfig = computed(() => { const config: any = { @@ -177,10 +183,23 @@ const getList = async (filter?: Record) => { if (filter !== undefined) { lastFilter.value = filter; } - console.log(props.searchParams); try { + // 合并排序参数:优先使用用户手动排序,否则使用 searchParams 中的默认排序 + let sort = undefined; + if (internalSort.value.field && internalSort.value.order) { + sort = [ + { + field: internalSort.value.field, + dir: internalSort.value.order === 'ascend' ? 'asc' : 'desc' + } + ]; + } else if (props.searchParams?.sort) { + sort = props.searchParams.sort; + } + const params = { ...props.searchParams, + ...(sort !== undefined ? { sort } : {}), skip: page.value, take: size.value, filter: lastFilter.value @@ -219,14 +238,17 @@ const getList = async (filter?: Record) => { const handleTableChange = (pag: any, filters: any, sorter: any) => { page.value = pag.current; size.value = pag.pageSize; - if (props.enableSort) { - if (sorter && sorter.field) { - emit('sort-change', { field: sorter.field, order: sorter.order }); - } else { - emit('sort-change', { field: '', order: null }); - } - } else { + if (sorter && sorter.field) { + internalSort.value = { field: sorter.field, order: sorter.order }; + page.value = 1; // 排序时重置到第一页 getList(); + emit('sort-change', { field: sorter.field, order: sorter.order }); + } else { + // 清除排序 + internalSort.value = { field: '', order: null }; + page.value = 1; + getList(); + emit('sort-change', { field: '', order: null }); } }; const handleRowClick = (record: any) => { @@ -264,6 +286,9 @@ defineExpose({ refresh, tableData, clearSelection, + clearSort: () => { + internalSort.value = { field: '', order: null }; + }, getSelected: () => ({ keys: selectedRowKeys.value, rows: selectedRows.value @@ -351,19 +376,28 @@ const createMergeCellHandler = (dataIndex: string) => { }; }; -// --- 列配置增强(超出隐藏 + Tooltip + 插槽兼容 + 行合并)--- +// --- 列配置增强(超出隐藏 + Tooltip + 插槽兼容 + 行合并 + 排序)--- const enhancedColumns = computed(() => { return props.columns.map(col => { + const enhancedCol: any = { ...col }; + + // 处理 sort 或 sorter: true,统一转为 sorter 并绑定 sortOrder + const isSortable = enhancedCol.sort === true || enhancedCol.sorter === true; + if (isSortable) { + enhancedCol.sorter = true; + enhancedCol.sortOrder = + internalSort.value.field === enhancedCol.dataIndex + ? internalSort.value.order + : false; + } + // 处理 merge 配置 - if (col.merge && col.dataIndex) { - const baseCol = { - ...col, - customCell: createMergeCellHandler(col.dataIndex) - }; + if (enhancedCol.merge && enhancedCol.dataIndex) { + enhancedCol.customCell = createMergeCellHandler(enhancedCol.dataIndex); // 如果有 slots.customRender,移除 slots - if (baseCol.slots?.customRender) { - const { slots, ...restCol } = baseCol; + if (enhancedCol.slots?.customRender) { + const { slots, ...restCol } = enhancedCol; return { ...restCol, _slotName: slots.customRender, @@ -371,12 +405,12 @@ const enhancedColumns = computed(() => { }; } - return baseCol; + return enhancedCol; } // 如果有 slots.customRender,移除 slots(由 bodyCell 处理),保留 dataIndex 用于匹配 - if (col.slots?.customRender) { - const { slots, ...restCol } = col; + if (enhancedCol.slots?.customRender) { + const { slots, ...restCol } = enhancedCol; return { ...restCol, // 保留 slotName 供 bodyCell 模板匹配使用 @@ -386,18 +420,18 @@ const enhancedColumns = computed(() => { } // 如果已有 customRender 函数,直接返回 - if (col.customRender) { + if (enhancedCol.customRender) { return { - ...col, - ...(props.enableEllipsis && !col.ellipsis ? { ellipsis: true } : {}) + ...enhancedCol, + ...(props.enableEllipsis && !enhancedCol.ellipsis ? { ellipsis: true } : {}) }; } // 普通列,添加 ellipsis - if (!props.enableEllipsis) return col; + if (!props.enableEllipsis) return enhancedCol; return { - ...col, + ...enhancedCol, ellipsis: true }; }); diff --git a/frontend/src/components/MapModal/components/EarlyWarningAlert.vue b/frontend/src/components/MapModal/components/EarlyWarningAlert.vue index 0afb7285..7d7488da 100644 --- a/frontend/src/components/MapModal/components/EarlyWarningAlert.vue +++ b/frontend/src/components/MapModal/components/EarlyWarningAlert.vue @@ -8,7 +8,6 @@ :columns="currentColumns" :list-url="fetchTableData" :search-params="searchParams" - :enable-sort="true" /> diff --git a/frontend/src/modules/fishSurvey/SurveyQingKuang/DeviceTableModal.vue b/frontend/src/modules/fishSurvey/SurveyQingKuang/DeviceTableModal.vue index 68e8558b..b9fb5571 100644 --- a/frontend/src/modules/fishSurvey/SurveyQingKuang/DeviceTableModal.vue +++ b/frontend/src/modules/fishSurvey/SurveyQingKuang/DeviceTableModal.vue @@ -55,8 +55,6 @@ :list-url="sdFprdRGetKendoListCust" :search-params="tableSearchParams" :transform-data="customTransform" - :enable-sort="true" - @sort-change="handleSortChange" >