|
|
@@ -69,6 +69,7 @@
|
|
|
>
|
|
|
<el-table-column
|
|
|
v-if="showMultipleList.length"
|
|
|
+ key="selection-column"
|
|
|
type="selection"
|
|
|
width="55"
|
|
|
/>
|
|
|
@@ -199,7 +200,7 @@ import { getQueryManageButtonPage } from "@/api/mes/queryManage/button";
|
|
|
import { saveAs } from "file-saver";
|
|
|
import * as XLSX from "xlsx";
|
|
|
import FilterColumnInQuery from "./components/FilterColumnInQuery.vue";
|
|
|
-import DictTag from "./components/DictTag.vue";
|
|
|
+import DictTag from "@/components/DictTag";
|
|
|
import ParameterDetail from "./components/ParameterDetail.vue";
|
|
|
import ReportPrint from "./components/ReportPrint.vue";
|
|
|
import request from "@/utils/request";
|
|
|
@@ -282,6 +283,7 @@ export default {
|
|
|
this.showMultipleList = this.queryData.filter(
|
|
|
(item) => item.listOperationCondition === "1"
|
|
|
);
|
|
|
+ console.log("showMultipleList长度", this.showMultipleList.length);
|
|
|
this.queryList = [];
|
|
|
for (let i = 0; i < this.searchData.length; i++) {
|
|
|
const { dataType, htmlType, dictType, columnName } =
|
|
|
@@ -651,7 +653,13 @@ export default {
|
|
|
`${this.title}.xlsx`
|
|
|
);
|
|
|
}, 1000);
|
|
|
- } catch {}
|
|
|
+ } catch (error) {
|
|
|
+ // 忽略取消操作的错误
|
|
|
+ if (error !== "cancel") {
|
|
|
+ console.error("导出失败:", error);
|
|
|
+ this.$message.error("导出失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
async ExportAll() {
|
|
|
@@ -663,6 +671,12 @@ export default {
|
|
|
paramList: this.queryParamList,
|
|
|
});
|
|
|
this.$download.excel(data, this.title + ".xls");
|
|
|
+ } catch (error) {
|
|
|
+ // 忽略取消操作的错误
|
|
|
+ if (error !== "cancel") {
|
|
|
+ console.error("导出失败:", error);
|
|
|
+ this.$message.error("导出失败");
|
|
|
+ }
|
|
|
} finally {
|
|
|
this.exportLoading = false;
|
|
|
}
|
|
|
@@ -719,29 +733,35 @@ export default {
|
|
|
async saveColumnWidth() {
|
|
|
if (!this.headerWidthChange) return;
|
|
|
this.headerWidthChange = false;
|
|
|
- const widthList = [];
|
|
|
- // 确保queryData是数组
|
|
|
- if (!Array.isArray(this.queryData)) return;
|
|
|
|
|
|
- const headers = this.$refs.tableRef.$el.querySelectorAll(
|
|
|
- ".el-table__header-wrapper tr th"
|
|
|
+ const widthList = [];
|
|
|
+ // 1. 所有“逻辑上应该显示”的列
|
|
|
+ const visibleMap = new Map(
|
|
|
+ this.queryData.filter((c) => !c.ifHide).map((c) => [c.columnComment, c]) // 用列名当 key
|
|
|
);
|
|
|
- const visibleColumns = this.queryData.filter((item) => !item.ifHide);
|
|
|
- const validHeaders = [...headers].filter(
|
|
|
+
|
|
|
+ // 2. 真正渲染出来的 th
|
|
|
+ const thList = Array.from(
|
|
|
+ this.$refs.tableRef.$el.querySelectorAll(
|
|
|
+ ".el-table__header-wrapper tr th"
|
|
|
+ )
|
|
|
+ ).filter(
|
|
|
(th) =>
|
|
|
!th.classList.contains("el-table-column--selection") &&
|
|
|
- th.innerText.trim() !== ""
|
|
|
+ !th.classList.contains("el-table-column--index")
|
|
|
);
|
|
|
- validHeaders.forEach((header, i) => {
|
|
|
- const correspondingItem = visibleColumns[i];
|
|
|
- if (correspondingItem) {
|
|
|
- widthList.push({
|
|
|
- id: correspondingItem.id,
|
|
|
- javaField: header.offsetWidth,
|
|
|
- });
|
|
|
- }
|
|
|
+
|
|
|
+ thList.forEach((th) => {
|
|
|
+ const w = th.offsetWidth;
|
|
|
+ if (!w) return; // 虚拟滚动或隐藏时直接跳过
|
|
|
+ const comment = th.innerText.trim();
|
|
|
+ const col = visibleMap.get(comment);
|
|
|
+ if (col) widthList.push({ id: col.id, javaField: w });
|
|
|
});
|
|
|
- await QueryManageApi.updateWidth(widthList);
|
|
|
+
|
|
|
+ if (widthList.length) {
|
|
|
+ await QueryManageApi.updateWidth(widthList);
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
buildQueryParamFromRoute() {
|
|
|
@@ -814,7 +834,7 @@ export default {
|
|
|
|
|
|
/* ---------- 原来的表格样式 ---------- */
|
|
|
:deep(.el-table__row) {
|
|
|
- transition: none;
|
|
|
+ height: 15px !important;
|
|
|
}
|
|
|
.el-table--medium .el-table__cell,
|
|
|
.el-table--small .el-table__cell {
|