From 102d1c3665710ef807ad3a015aa3c6b67e157855 Mon Sep 17 00:00:00 2001
From: hongchao <3228015117@qq.com>
Date: Fri, 5 Dec 2025 15:42:56 +0800
Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../business-details.vue | 2 +-
src/views/material/report/reportQuery.vue | 112 ++++++++++++------
2 files changed, 80 insertions(+), 34 deletions(-)
diff --git a/src/views/business-examine/direct-rotation-apply/business-details.vue b/src/views/business-examine/direct-rotation-apply/business-details.vue
index fe340c96..1b8e51fe 100644
--- a/src/views/business-examine/direct-rotation-apply/business-details.vue
+++ b/src/views/business-examine/direct-rotation-apply/business-details.vue
@@ -371,7 +371,7 @@ export default {
this.$modal.msgSuccess('审核成功')
loading.close()
setTimeout(() => {
- // const obj = { path: '/business-examine/receive-apply' }
+ // const obj = { path: '/business-examine/direct-rotation-apply' }
// this.$tab.closeOpenPage(obj)
this.$tab.closePage()
}, 500)
diff --git a/src/views/material/report/reportQuery.vue b/src/views/material/report/reportQuery.vue
index 4dd4d5b7..239022ff 100644
--- a/src/views/material/report/reportQuery.vue
+++ b/src/views/material/report/reportQuery.vue
@@ -99,14 +99,15 @@
查询
+ 重置
一键下载
-
-
+
+
{{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}
@@ -134,7 +135,7 @@
-
+
{
+ if (this.$refs.multipleTable) {
+ this.tableList.forEach(row => {
+ if (this.selectedItems.has(row.id)) {
+ this.$refs.multipleTable.toggleRowSelection(row, true);
+ }
+ });
+ }
+ });
});
},
/** 重置按钮操作 */
@@ -531,19 +552,46 @@ export default {
this.resetForm("queryForm");
this.dateRange=[]
this.queryParams.keyWord=null;
+ // 清空选中状态
+ this.selectedItems.clear();
+ if (this.$refs.multipleTable) {
+ this.$refs.multipleTable.clearSelection();
+ }
this.handleQuery();
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
+ // 查询时清除选中状态
+ this.selectedItems.clear();
+ if (this.$refs.multipleTable) {
+ this.$refs.multipleTable.clearSelection();
+ }
this.getList();
},
// 多选框选中数据
handleSelectionChange(selection) {
- this.ids = selection.map(item => item.id)
- this.infos = selection.map(item => ({ id: item.id }))
- this.single = selection.length != 1
- this.multiple = !selection.length
+ // 更新全局选中状态
+ selection.forEach(item => {
+ this.selectedItems.set(item.id, item);
+ });
+
+ // 找出当前页未被选中但之前被选中的项,并从全局选中状态中移除
+ const currentIds = selection.map(item => item.id);
+ for (let id of this.selectedItems.keys()) {
+ if (!currentIds.includes(id)) {
+ const itemInCurrentPage = this.tableList.find(row => row.id === id);
+ if (itemInCurrentPage) {
+ this.selectedItems.delete(id);
+ }
+ }
+ }
+
+ // 更新ids和infos数组,用于其他操作
+ this.ids = Array.from(this.selectedItems.keys());
+ this.infos = Array.from(this.selectedItems.values()).map(item => ({ id: item.id }));
+ this.single = this.ids.length !== 1;
+ this.multiple = this.ids.length === 0;
},
//查看
handleView(row){
@@ -852,36 +900,34 @@ export default {
async handleBulkDownload() {
const grouped = {};
try {
- if (!this.infos || !this.infos.length) {
+ // 检查是否有选中项
+ if (!this.selectedItems || this.selectedItems.size === 0) {
this.$message.warning('请先勾选要下载的行');
return;
}
- // 构建 items
- const items = this.infos.map((x) => {
- const r = this.tableList.find(t => t.id === x.id) || {};
- return {
- proName: r.proName || '',
- departName: r.departName || '',
- typeName: r.typeName || '',
- typeModelName: r.typeModelName || '',
- qualifiedUrl: r.qualifiedUrl || null,
- testReportUrl: r.testReportUrl || null,
- thirdReportUrl: r.thirdReportUrl || null,
- factoryReportUrl: r.factoryReportUrl || null,
- otherReportUrl: r.otherReportUrl || null,
- unit: r.unit || '',
- num: r.num || '',
- maCode: r.maCode || '',
- ratedLoad: r.ratedLoad || '',
- testLoad: r.testLoad || '',
- holdingTime: r.holdingTime || '',
- testTime: r.testTime || '',
- nextTestTime: r.nextTestTime || '',
- checkResult: r.checkResult || '',
- remark: ''
- };
- });
+ // 从全局选中状态构建 items,不再只依赖当前页的 tableList
+ const items = Array.from(this.selectedItems.values()).map(item => ({
+ proName: item.proName || '',
+ departName: item.departName || '',
+ typeName: item.typeName || '',
+ typeModelName: item.typeModelName || '',
+ qualifiedUrl: item.qualifiedUrl || null,
+ testReportUrl: item.testReportUrl || null,
+ thirdReportUrl: item.thirdReportUrl || null,
+ factoryReportUrl: item.factoryReportUrl || null,
+ otherReportUrl: item.otherReportUrl || null,
+ unit: item.unit || '',
+ num: item.num || '',
+ maCode: item.maCode || '',
+ ratedLoad: item.ratedLoad || '',
+ testLoad: item.testLoad || '',
+ holdingTime: item.holdingTime || '',
+ testTime: item.testTime || '',
+ nextTestTime: item.nextTestTime || '',
+ checkResult: item.checkResult || '',
+ remark: ''
+ }));
// 按工程 -> 领用日期 -> 类型-规格分组
items.forEach(item => {