diff --git a/src/assets/css/main.css b/src/assets/css/main.css index 4a6f778..444bb88 100644 --- a/src/assets/css/main.css +++ b/src/assets/css/main.css @@ -1149,9 +1149,9 @@ a { mso-border-top-alt: none !important; border-bottom: none !important; mso-border-bottom-alt: none !important; - border: 1px dashed #dcdfe6 !important; + /* border: 1px dashed #dcdfe6 !important; border-left: 1px dashed #dcdfe6 !important; - border-right: 1px dashed #dcdfe6 !important; + border-right: 1px dashed #dcdfe6 !important; */ word-break: keep-all !important; /* text-align: justify !important; */ } @@ -1283,7 +1283,7 @@ a { } .word-container table tbody tr td { - text-align: left !important; + text-align: center !important; border-left: none !important; mso-border-left-alt: none !important; border-right: none !important; @@ -1292,9 +1292,9 @@ a { mso-border-top-alt: none !important; border-bottom: none !important; mso-border-bottom-alt: none !important; - border: 1px dashed #dcdfe6 !important; + /* border: 1px dashed #dcdfe6 !important; border-left: 1px dashed #dcdfe6 !important; - border-right: 1px dashed #dcdfe6 !important; + border-right: 1px dashed #dcdfe6 !important; */ word-break: keep-all !important; white-space: pre-wrap !important; /* text-align: justify !important; */ diff --git a/src/common/js/TableUtils.js b/src/common/js/TableUtils.js new file mode 100644 index 0000000..4b3dc1e --- /dev/null +++ b/src/common/js/TableUtils.js @@ -0,0 +1,102 @@ +/** + * 表格数据处理工具 + */ +export const TableUtils = { + /** + * 判断是否为表头行 + * @param {number} rowIndex + * @param {Array} table + */ + isHeaderRow(rowIndex, table) { + if (!table || table.length === 0) return false; + const head = table[0]; + // 健壮性检查:确保第一行第一个单元格存在且有rowspan + const headerSpan = (head && head[0] && head[0].rowspan) ? head[0].rowspan : 1; + return rowIndex < headerSpan; + }, + + /** + * 拆分表头和表体 + */ + splitTable(tableList) { + if (!Array.isArray(tableList) || tableList.length === 0) { + return { header: [], content: [] }; + } + + const header = []; + const content = []; + let cellIdCounter = 0; + + tableList.forEach((row, rowIndex) => { + if (Array.isArray(row)) { + row.forEach((cell) => { + if (cell && typeof cell === 'object') { + cell.cellId = `cell-${cellIdCounter++}`; + } + }); + } + + if (this.isHeaderRow(rowIndex, tableList)) { + header.push(row); + } else { + content.push(row); + } + }); + + return { header, content }; + }, + + /** + * 处理合并单元格后的逻辑行 ID(用于斑马纹等) + */ + addRowIdToData(content) { + if (!content || content.length === 0) return { rowData: [], rowIds: [] }; + + const data = JSON.parse(JSON.stringify(content)); + const rowIdMap = {}; + const usedRows = new Set(); + let idCounter = 0; + + // 1. 建立逻辑行映射 + for (let i = 0; i < data.length; i++) { + if (usedRows.has(i)) continue; + + const rowId = `row-${idCounter++}`; + rowIdMap[i] = rowId; + usedRows.add(i); + + const row = data[i]; + for (let j = 0; j < row.length; j++) { + const cell = row[j]; + if (cell && cell.rowspan > 1) { + for (let k = 1; k < cell.rowspan; k++) { + const nextRowIndex = i + k; + if (nextRowIndex < data.length && !rowIdMap[nextRowIndex]) { + rowIdMap[nextRowIndex] = rowId; + usedRows.add(nextRowIndex); + } + } + } + } + } + + // 2. 注入 rowId 并提取唯一 ID 列表 + const seenIds = []; + data.forEach((row, i) => { + const rowId = rowIdMap[i]; + row.rowId = rowId; // 直接赋值给行对象 + row.forEach(cell => { + if (cell) cell.rowId = rowId; + }); + + if (rowId && !seenIds.includes(rowId)) { + seenIds.push(rowId); + } + }); + + // 取奇数或偶数 ID 用于斑马纹(根据你的需求 index % 2 === 0) + const rowIds = seenIds.filter((_, index) => index % 2 === 0); + + return { rowData: data, rowIds }; + } +}; \ No newline at end of file diff --git a/src/components/page/GenerateCharts.vue b/src/components/page/GenerateCharts.vue index 2334e04..149a4a1 100644 --- a/src/components/page/GenerateCharts.vue +++ b/src/components/page/GenerateCharts.vue @@ -1307,16 +1307,19 @@ export default { }, handleImageAdd(type) { this.picStyle = { note: '', picUrl: '', title: '' }; + this.picStyle1 = { note: '', picUrl: '', title: '' }; this.picStyle.visiTitle = 'Add Figure'; this.pictVisible = true; }, handleTableAdd(type) { this.lineStyle = { note: '', table_data: '', html_data: '' }; + this.lineStyle1 = { note: '', table_data: '', html_data: '' }; this.lineStyle.visiTitle = 'Add Table'; this.threeVisible = true; }, addUploadWordTable(data) { this.lineStyle = { note: '', table: data.table_data, html_data: data.html_data }; + this.lineStyle1 = { note: '', table: data.table_data, html_data: data.html_data }; this.lineStyle.visiTitle = 'Add Table'; this.threeVisible = true; @@ -1330,13 +1333,18 @@ export default { this.pictVisible = true; } else if (type == 'table') { this.lineStyle = {}; - this.lineStyle = { - ...data, - table: JSON.parse(data.table_data), - html_data: data.html_data, - note: data.note, - title: data.title - }; + this.lineStyle1 = {}; + // 1. 提取处理逻辑 +const formattedData = { + ...data, + table: JSON.parse(data.table_data), + // 如果 data 中已经包含了 html_data, note, title,且不需要特殊处理, + // 解构赋值 (...data) 其实已经把它们带进来了。 +}; + +// 2. 统一赋值 +this.lineStyle = formattedData; +this.lineStyle1 = { ...formattedData }; // 使用浅拷贝确保两个变量指向不同引用(如果需要独立修改) this.lineStyle.visiTitle = 'Edit Table'; this.threeVisible = true; } diff --git a/src/components/page/OnlineProofreading.vue b/src/components/page/OnlineProofreading.vue index a956f0c..b985d9e 100644 --- a/src/components/page/OnlineProofreading.vue +++ b/src/components/page/OnlineProofreading.vue @@ -135,6 +135,9 @@ + @@ -603,6 +606,7 @@ export default { }, methods: { + async copyArray(data) { try { // 将数组内容转换为字符串,使用换行符分隔 @@ -1524,7 +1528,7 @@ export default { for (let i = 0; i < this.Main_List.length; i++) { this.Main_List[i].text = this.Main_List[i].content; this.Main_List[i].getnum = 0; - // this.Main_List[i].checked = false; + } // setTimeout(async () => { diff --git a/src/components/page/components/OnlineProofreading/catalogue.vue b/src/components/page/components/OnlineProofreading/catalogue.vue index 92e8d1a..8750c42 100644 --- a/src/components/page/components/OnlineProofreading/catalogue.vue +++ b/src/components/page/components/OnlineProofreading/catalogue.vue @@ -1,26 +1,20 @@