This commit is contained in:
2025-05-29 16:57:07 +08:00
parent 845785686d
commit 5f7f1d992b
18 changed files with 2144 additions and 3696 deletions

View File

@@ -196,14 +196,14 @@
:wrapperClosable="false"
:close-on-click-modal="false"
direction="rtl"
size="70%"
size="80vw"
>
<el-form ref="editMes" :model="lineStyle" label-width="80px">
<!-- <common-late-x></common-late-x> -->
<!-- :id="`editor-${new Date().getTime()}-${lineStyle.am_id}-${lineStyle.amt_id}-title`" -->
<el-form-item label="Title:">
<common-content
:id="`editor-${new Date().getTime()}-${lineStyle.am_id}-${lineStyle.amt_id}-title`"
:id="`editor-${new Date().getTime()}-${lineStyle.am_id}-${lineStyle.amt_id}-title`"
:isAutomaticUpdate="true"
:value="lineStyle.title"
@getContent="getContent"
@@ -231,7 +231,7 @@
<el-form-item label="Note:">
<!-- :id="`editor-${new Date().getTime()}-${lineStyle.am_id}-${lineStyle.amt_id}-note`" -->
<common-content
:id="`editor-${new Date().getTime()}-${lineStyle.am_id}-${lineStyle.amt_id}-note`"
:id="`editor-${new Date().getTime()}-${lineStyle.am_id}-${lineStyle.amt_id}-note`"
:isAutomaticUpdate="true"
:value="lineStyle.note"
@getContent="getContent"
@@ -265,31 +265,26 @@
:wrapperClosable="false"
:close-on-click-modal="false"
direction="rtl"
size="70%"
size="80vw"
>
<div v-for="(item, i) in uploadWordTables">
<el-button @click="addUploadWordTable(item)"> 插入Table{{ i + 1 }} </el-button>
<div class="thumbnailTableBox wordTableHtml table_Box pMain myeditabledivTable drop-target">
<!-- 标题部分 -->
<!-- <font class="font" :style="`width: ${item.width ? `${item.width}px` : '100%'}`" style="text-align: center">
<span v-html="highlightText(item.table.title || '', item.checks ? item.checks : [])"></span>
</font> -->
<!-- 表格部分 -->
<table border="1" style="width: 100%; border-collapse: collapse; text-align: center">
<tr v-for="(row, i) in item.table_data" :key="i" :class="{ 'table-header-row': isHeaderRow(i, item.table_data) }">
<td v-for="(cell, i1) in row" :key="i1" :colspan="`${cell.colspan || 1}`" :rowspan="`${cell.rowspan || 1}`">
<span v-html="cell.text"></span>
</td>
</tr>
</table>
<!-- 备注部分 -->
<!-- <font class="font" :style="`width: ${item.width ? `${item.width}px` : '100%'}`">
<span v-html="highlightText(item.table.note || '', item.checks ? item.checks : [])"></span>
</font> -->
<div style="display: flex; flex-wrap: wrap; gap: 10px; justify-content: start">
<div v-for="(item, i) in uploadWordTables" class="uploadWordTableBox">
<el-button @click="addUploadWordTable(item)" size="mini" class="insertTable"> 插入 </el-button>
<div class="thumbnailTableBox wordTableHtml table_Box pMain myeditabledivTable drop-target">
<p style="font-size: 12px;padding: 10px;box-sizing: border-box;">Table {{ i + 1 }}</p>
<table border="1" :style="`width: 800px;zoom:${zoomNum};border-collapse: collapse; text-align: center`">
<tr
v-for="(row, i) in item.table_data"
:key="i"
:class="{ 'table-header-row': isHeaderRow(i, item.table_data) }"
>
<td style="font-size: 20px;"v-for="(cell, i1) in row" :key="i1" :colspan="`${cell.colspan || 1}`" :rowspan="`${cell.rowspan || 1}`">
<span v-html="cell.text"></span>
</td>
</tr>
</table>
</div>
</div>
<!-- <div v-html="v.html_data"></div> -->
</div>
</el-drawer>
<el-dialog
@@ -412,6 +407,7 @@ import bottomTinymce from '@/components/page/components/Tinymce';
export default {
data() {
return {
zoomNum:(window.innerWidth * 0.38) / 850,
uploadWordTables: [],
tablesHtmlVisible: false,
tablesHtml: '',
@@ -574,6 +570,7 @@ export default {
},
methods: {
async copyArray(data) {
try {
// 将数组内容转换为字符串,使用换行符分隔
@@ -588,8 +585,7 @@ export default {
}
},
openLatexEditor(data) {
console.log('data at line 563:', data);
this.showLateX = true;
this.showLateX = true;
this.LateXInfo = data;
},
isShowEditComment() {
@@ -632,10 +628,8 @@ export default {
},
async getContent(type, content) {
console.log('content at line 539:', content);
if (type == 'content') {
content = this.$commonJS.transformHtmlString(content);
console.log('content at line 604:', content);
var div = document.createElement('div');
div.innerHTML = content; // 将 HTML 字符串加载到 div 中
// 替换所有 <strong> 为 <b>
@@ -1137,42 +1131,15 @@ export default {
// 处理文件上传并传递回调函数
this.$commonJS.handleFileUpload(event, function (tables) {
console.log('tables at line 786:', tables);
// 使用 Promise.all 等待所有表格解析完成
Promise.all(
tables.map((table) => {
return new Promise((resolve, reject) => {
// 解析每个表格
that.$commonJS.parseTableToArray(table, (tableList) => {
console.log('res at line 104:', tableList);
// 生成 HTML 内容
// var contentHtml = `
// <div class="thumbnailTableBox wordTableHtml table_Box" style="">
// <table border="1" style="width: auto; border-collapse: collapse; text-align: center;">
// ${tableList
// .map((row) => {
// return `
// <tr>
// ${row
// .map((cell) => {
// return `
// <td colspan="${cell.colspan || 1}" rowspan="${cell.rowspan || 1}">
// <span>${cell.text || ''}</span>
// </td>
// `;
// })
// .join('')}
// </tr>
// `;
// })
// .join('')}
// </table>
// </div>
// `;
// 将解析后的数据和生成的 HTML 返回
resolve({ table_data: tableList, html_data: '' });
});
});
@@ -1182,8 +1149,7 @@ export default {
// 所有表格的解析完成后,处理结果
that.uploadWordTables = result;
that.tablesHtmlVisible = true;
console.log('Processed tables:', that.uploadWordTables);
})
})
.catch((error) => {
console.error('Error processing tables:', error);
});
@@ -1191,16 +1157,14 @@ export default {
const file = event.target.files[0];
if (file) {
// 处理文件逻辑
console.log('处理文件:', file.name);
}
}
// 关键:重置 input 的值
event.target.value = '';
},
async onAddRow(mainId) {
console.log('data at line 886:', mainId);
await this.$api
.post(this.urlList.addRow, {
am_id: mainId,
@@ -1267,11 +1231,10 @@ export default {
addUploadWordTable(data) {
this.lineStyle = { note: '', table: data.table_data, html_data: data.html_data };
this.lineStyle.visiTitle = 'Insert Table';
this.lineStyle.visiTitle = 'Add Table';
this.threeVisible = true;
},
handleImageEdit(data, type) {
console.log('data at line 600:', data);
if (type == 'img') {
var extension = data.url.split('.').pop().toLowerCase();
this.picStyle = {};
@@ -1301,10 +1264,7 @@ export default {
this.picStyle1.title = str;
} else {
this.lineStyle1[type] = str;
}
},
onEdit(dataId) {
this.currentContent = {};
@@ -1761,12 +1721,11 @@ export default {
}
};
var cleanedTableList = content.table ? content.table : [];
console.log('content at line 998:', this.lineStyle);
cleanedTableList = cleanTableData(content.table);
var strTitle = this.lineStyle1.title? this.lineStyle1.title : '';
var strTitle = this.lineStyle1.title ? this.lineStyle1.title : '';
var strNote = this.lineStyle1.note? this.lineStyle1.note : '';
var strNote = this.lineStyle1.note ? this.lineStyle1.note : '';
if (strNote != '') {
strNote = await this.$commonJS.decodeHtml(strNote);
}
@@ -2229,6 +2188,12 @@ export default {
::v-deep .wordTableHtml table span blue {
color: rgb(0, 130, 170) !important;
}
::v-deep .wordTableHtml table span blue sup{
color: rgb(0, 130, 170) !important;
}
::v-deep .wordTableHtml table span blue sub{
color: rgb(0, 130, 170) !important;
}
.toolbar {
display: flex;
align-items: center;
@@ -2310,4 +2275,26 @@ export default {
::-webkit-scrollbar-thumb:hover {
background: #555; /* 滑块悬停时的颜色 */
}
.uploadWordTableBox {
width: 38vw;
position: relative;
height: auto;
overflow: hidden;
padding: 10px;
box-sizing: border-box;
box-shadow: rgba(0, 0, 0, 0.1) 0px 2px 12px 0px;
}
::v-deep .el-drawer__header {
margin-bottom: 0;
padding: 15px;
}
.uploadWordTableBox .insertTable{
/* display: none; */
position: absolute;
right: 10px;
}
.uploadWordTableBox:hover {
background-color: #0066990d;
/* display: block !important; */
}
</style>