This commit is contained in:
2026-01-21 14:34:14 +08:00
parent b983c570ea
commit 5c7fbb76fa
20 changed files with 1729 additions and 1080 deletions

View File

@@ -16,7 +16,7 @@
<div
class="right-side"
style="
width: 285px;
width: 260px;
float: left;
height: 100%;
background-color: #fff;
@@ -67,28 +67,30 @@
@handlePaperclip="handlePaperclip"
@addComment="addCommentSetting"
@goToComment="goToComment"
@edit="handleImageEdit"
@edit="handleFigureAndTableEdit"
@delete="handleFigureAndTableDelete"
@goToListComment="goToListComment"
style="width: 100%; height: 100%; padding: 0 0px; box-sizing: border-box; background-color: #fff"
>
<template slot="catalogue1">
<catalogue
v-if="Main_List.length > 0"
:content="Main_List"
:articleId="articleId"
ref="catalogue"
@goToListComment="goToListComment"
style="width: 100%; height: 100%; padding: 0 0px; box-sizing: border-box; background-color: #fff"
>
</catalogue>
</template>
</common-word-html-type-setting>
<input type="file" ref="fileInput" style="display: none" @change="handleFileChange" />
</div>
</div>
<div style="width: 100%; width: calc(100% - 285px); float: right; height: calc(100% - 0px); background-color: #e4e9ed">
<!-- <div class="toolbar">
<div class="toolbar_item" @click="handleImageAdd('img')">
<img src="@/assets/img/upload.png" style="object-fit: contain" />
<span>Add Figure </span>
</div>
<div class="toolbar_item" @click="handleTableAdd('table')">
<img src="@/assets/img/uploadTable.png" style="object-fit: contain" />
<span>Add Table </span>
</div>
</div> -->
<div style="width: 100%; width: calc(100% - 260px); float: right; height: calc(100% - 0px); background-color: #e4e9ed">
<common-word
:articleId="articleId"
:articleId="articleId"
v-if="htmlContent"
ref="commonWord"
:value="htmlContent"
@@ -96,13 +98,13 @@
:comments="comments"
:wordStyle="wordStyle"
@onDrop="onDrop"
@onLinkUnbind="handleUnbindLink"
@onLinkConfirm="handleConfirmLink"
@saveContent="saveContent"
@editComment="editComment"
@loaded="loadedWord"
@onEdit="onEdit"
@addContent="onAddContent"
@changeSort="changeSort"
@onDelete="onDelete"
@onDeletes="onDeletes"
@@ -234,7 +236,7 @@
<font style="color: #f56c6c; margin-right: 5px">*</font>
Table:
</span>
<common-table
:articleId="articleId"
@getContent="getContent"
@@ -415,7 +417,7 @@
</el-button>
</span>
</el-dialog>
<common-late-x v-if="showLateX" @close="showLateX = false" @save="saveLateX" :LateXInfo="LateXInfo"></common-late-x>
</div>
</template>
@@ -427,6 +429,7 @@ import Tiff from 'tiff.js';
import { mediaUrl } from '@/common/js/commonJS.js'; // 引入通用逻辑
import Tinymce from '@/components/page/components/Tinymce';
import bottomTinymce from '@/components/page/components/Tinymce';
import catalogue from '@/components/page/components/table/catalogue.vue';
export default {
data() {
return {
@@ -465,9 +468,11 @@ export default {
setPositioningImage: 'api/Preaccept/positioningImage',
removePositioningImage: 'api/Preaccept/removeImage',
addImage: 'api/Preaccept/addMainImage',
editImage: 'api/Preaccept/editMainImage',
addTable: 'api/Preaccept/addMainTable',
editTable: 'api/Preaccept/editMainTable'
editImage: 'api/Preaccept/editMainImage',
editTable: 'api/Preaccept/editMainTable',
deleteImage: 'api/Articlemain/removeMainImage',
deleteTable: 'api/Articlemain/removeMainTable'
},
wordStyle: `
// p {
@@ -552,7 +557,8 @@ export default {
},
components: {
Tinymce,
bottomTinymce
bottomTinymce,
catalogue
},
computed: {
combinedValue() {
@@ -582,20 +588,16 @@ export default {
}
},
async created() {
// await this.$api.post('api/Proofread/proofRead', {
// article_id: this.$route.query.id
// });
localStorage.removeItem('scrollPosition');
this.isShowEditComment();
this.getDate();
this.getCommentList();
// this.loadDictionary().catch(console.error);
},
mounted() {},
async activated() {
// await this.$api.post('api/Proofread/proofRead', {
// article_id: this.$route.query.id
// });
this.isShowEditComment();
this.getDate();
this.getCommentList();
@@ -705,38 +707,55 @@ export default {
this.addComment(content);
}
},
handleConfirmLink(selectedMedia) {
// selectedMedia 是你从 el-radio 列表中选中的那一项(包含 ami_id 或 amt_id
const targetId = selectedMedia.select.amt_id || selectedMedia.select.ami_id;
const type = selectedMedia.type; // 'table' 或 'figure'
const tagName = `my${type}`; // 生成 mytable 或 myfigure
// 获取当前段落原本的完整 HTML 内容
let originalContent = selectedMedia.linkData.content;
// 获取用户选中的纯文本片段
const label = selectedMedia.linkData.label;
handleUnbindLink(data) {
const { label, mainId, index, content } = data;
if (!label || !originalContent) return;
const unwrapTag = (str) => {
return str.replace(/<(myfigure|mytable)[^>]*>([\s\S]*?)<\/\1>/gi, '$2');
};
// --- 核心替换逻辑 ---
// 使用正则匹配选中的文字,并用自定义标签包裹它
// 注意:这里需要考虑 label 在 HTML 中可能被拆分的情况,简单处理可直接 replace
const replacement = `<${tagName} data-id="${targetId}">${label}</${tagName}>`;
// 执行替换(仅替换第一次匹配到的,防止全篇误伤)
const newContent = originalContent.replace(label, replacement);
// 2. 执行替换
// 我们只针对传入的这个特定的 label 进行剥壳
const strippedLabel = unwrapTag(label);
console.log('newContent at line 592:', newContent);
this.saveContent(newContent, selectedMedia.linkData.mainId);
// 3. 将 content 中的原标签替换为剥壳后的文字
// 使用 split/join 或者是精准 replace确保只替换这一处
const newContent = content.replace(label, strippedLabel);
this.saveContent(newContent, mainId);
},
handleConfirmLink(selectedMedia) {
const targetId = selectedMedia.select.amt_id || selectedMedia.select.ami_id;
const type = selectedMedia.type;
const tagName = `my${type}`;
let originalContent = selectedMedia.linkData.content;
const label = selectedMedia.linkData.label;
if (!label || !originalContent) return;
const isAlreadyTagged = label.startsWith('<my') && label.endsWith('>');
let newContent = '';
if (isAlreadyTagged) {
const updatedTag = label
.replace(/<my(figure|table)/, `<${tagName}`)
.replace(/data-id=".*?"/, `data-id="${targetId}"`)
.replace(/<\/my(figure|table)>$/, `</${tagName}>`);
newContent = originalContent.replace(label, updatedTag);
} else {
const replacement = `<${tagName} data-id="${targetId}">${label}</${tagName}>`;
newContent = originalContent.replace(label, replacement);
}
this.saveContent(newContent, selectedMedia.linkData.mainId);
},
async saveContent(content, am_id) {
const loading = this.$loading({
lock: true,
text: 'Loading...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
var that = this;
var str = content.replace(/^<p>\s*(.*?)\s*<\/p>$/, '$1').trim();
str = await that.$commonJS.decodeHtml(str);
await that.$api
@@ -746,10 +765,18 @@ this.saveContent(newContent, selectedMedia.linkData.mainId);
})
.then(async (res) => {
if (res.code == 0) {
loading.close();
this.editVisible = false;
this.getDate();
this.refreshCurrentContent('content', am_id, res.data);
this.getCommentList();
} else {
loading.close();
this.$message.error(res.msg);
}
})
.catch((err) => {
loading.close();
this.$message.error(err);
});
},
async saveContentList(content, am_id) {
@@ -759,7 +786,12 @@ this.saveContent(newContent, selectedMedia.linkData.mainId);
message: 'Please enter the content!'
});
}
const loading = this.$loading({
lock: true,
text: 'Loading...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
await this.$api
.post('api/Preaccept/addMoreRow', {
article_id: this.articleId,
@@ -768,10 +800,18 @@ this.saveContent(newContent, selectedMedia.linkData.mainId);
})
.then(async (res) => {
if (res.code == 0) {
loading.close();
this.addContentVisible = false;
this.getDate();
this.refreshCurrentContent('addMoreRow', am_id, res.data);
this.getCommentList();
} else {
loading.close();
this.$message.error(res.msg);
}
})
.catch((err) => {
loading.close();
this.$message.error(err);
});
},
isHeaderRow(rowIndex, table) {
@@ -877,8 +917,10 @@ this.saveContent(newContent, selectedMedia.linkData.mainId);
var am_id;
if (type == 'img') {
am_id = this.Main_List.find((item) => item.ami_id == id).am_id;
} else {
} else if (type == 'table') {
am_id = this.Main_List.find((item) => item.amt_id == id).am_id;
} else {
am_id = id;
}
if (am_id) {
this.goToComment(am_id);
@@ -903,8 +945,10 @@ this.saveContent(newContent, selectedMedia.linkData.mainId);
}
},
async onDelete(dataId) {
var that = this;
var dataInfo = this.Main_List.find((item) => item.am_id == dataId);
var dataIndex = this.Main_List.indexOf(dataInfo);
var type = '';
if (dataInfo.type == 1) {
type = 'img';
@@ -913,53 +957,70 @@ this.saveContent(newContent, selectedMedia.linkData.mainId);
} else if (dataInfo.type == 0) {
type = 'content';
}
var url = '';
switch (type) {
case 'table':
url = that.urlList.removePositioningTable;
break;
case 'img':
url = that.urlList.removePositioningImage;
break;
case 'content':
url = that.urlList.delete;
break;
}
if (dataInfo.type == 0 && dataInfo.content == '') {
await that.$api
.post(url, {
am_id: dataId
})
.then(async (res) => {
if (res.code == 0) {
setTimeout(() => {
that.Main_List.splice(dataIndex, 1);
await this.$confirm(this.$t('commonTable.removeContent'), 'Prompt', {
confirmButtonText: 'Submit',
cancelButtonText: 'Cancel',
type: 'warning'
})
.then(async () => {
var that = this;
var url = '';
switch (type) {
case 'table':
url = that.urlList.removePositioningTable;
break;
case 'img':
url = that.urlList.removePositioningImage;
break;
case 'content':
url = that.urlList.delete;
break;
}
await that.$api
.post(url, {
am_id: dataId
})
.then(async (res) => {
if (res.code == 0) {
setTimeout(() => {
that.getDate();
that.getCommentList();
if (type == 'img') {
that.$refs.commonWordHtmlTypeSetting.refresh('img');
} else {
that.$refs.commonWordHtmlTypeSetting.refresh('table');
}
that.$forceUpdate();
});
}
});
// this.Main_List.splice(
// this.Main_List.findIndex((item) => item.p_main_id == dataId),
// 1
// );
that.getCommentList();
that.$forceUpdate();
});
} else {
this.$message.error(res.msg);
}
})
.catch((err) => {
this.$message.error(err);
});
} else {
await this.$confirm(this.$t('commonTable.removeContent'), 'Prompt', {
confirmButtonText: 'Submit',
cancelButtonText: 'Cancel',
type: 'warning'
})
.catch((err) => {
console.log('err at line 466:', err);
});
.then(async () => {
await that.$api
.post(url, {
am_id: dataId
})
.then(async (res) => {
if (res.code == 0) {
setTimeout(() => {
that.Main_List.splice(dataIndex, 1);
that.$forceUpdate();
if (type == 'img') {
that.$refs.commonWordHtmlTypeSetting.refresh('removeImg', { ami_id: dataInfo.ami_id });
} else if (type == 'table') {
that.$refs.commonWordHtmlTypeSetting.refresh('removeTable', { amt_id: dataInfo.amt_id });
}
that.getCommentList();
that.$forceUpdate();
});
}
});
})
.catch((err) => {
console.log('err at line 466:', err);
});
}
},
async onDeletes(dataId) {
await this.$confirm(this.$t('commonTable.removeContent'), 'Prompt', {
@@ -978,8 +1039,8 @@ this.saveContent(newContent, selectedMedia.linkData.mainId);
setTimeout(() => {
that.getDate();
that.getCommentList();
that.$refs.commonWordHtmlTypeSetting.refresh('img');
that.$refs.commonWordHtmlTypeSetting.refresh('table');
that.$refs.commonWordHtmlTypeSetting.reload();
that.$forceUpdate();
});
}
@@ -994,20 +1055,40 @@ this.saveContent(newContent, selectedMedia.linkData.mainId);
});
},
async changeSort(type, id) {
var that = this;
const index = this.Main_List.findIndex((item) => item.am_id == id);
if(type=='up'&&index==0){
return
}
if(type=='down'&&index==this.Main_List.length-1){
return
}
const load = this.$loading({
lock: true,
text: 'Loading...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
await that.$api
.post(type == 'up' ? '/api/Preaccept/upArticleMain' : '/api/Preaccept/downArticleMain', {
am_id: id
})
.then(async (res) => {
if (res.code == 0) {
setTimeout(() => {
that.getDate();
that.getCommentList();
that.$forceUpdate();
});
load.close();
await this.refreshCurrentContent(`${type}ArticleMain`, id);
that.$forceUpdate();
} else {
load.close();
this.$message.error(res.msg);
}
})
.catch((err) => {
load.close();
this.$message.error(err);
});
},
async addCommentSetting(content) {
@@ -1103,7 +1184,7 @@ this.saveContent(newContent, selectedMedia.linkData.mainId);
if (data && data.remark) {
this.$alert(
`<p style="display:flex;"><img src="${this.remarkImageUrl}" alt="" style="width:20px;height:20px;margin-right:10px;"/><span style=" overflow-wrap: break-word;width:calc(100% - 50px)"> ${data.remark}</span></p>`,
'Annotations',
'Comments',
{
confirmButtonText: 'OK',
dangerouslyUseHTMLString: true, // 启用 HTML 渲染
@@ -1146,6 +1227,12 @@ this.saveContent(newContent, selectedMedia.linkData.mainId);
this.commentVisible = true;
},
async onEditTitle(data) {
const loading = this.$loading({
lock: true,
text: 'Loading...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
var url;
switch (data.value) {
case 0:
@@ -1168,13 +1255,64 @@ this.saveContent(newContent, selectedMedia.linkData.mainId);
am_id: data.mainId
})
.then(async (res) => {
this.getDate();
this.getCommentList();
if (res.code == 0) {
await this.refreshCurrentContent('content', data.mainId, res.data);
loading.close();
this.getCommentList();
}
})
.catch((err) => {
loading.close();
this.$message.error(err.msg);
});
},
async refreshCurrentContent(type, mainId, resData) {
const index = this.Main_List.findIndex((item) => item.am_id == mainId);
if (type == 'upArticleMain') {
if (index == 0) {
return;
}
const item = this.Main_List[index];
// 2. 从原位置删除
this.Main_List.splice(index, 1);
// 3. 插入到前一个位置
this.Main_List.splice(index - 1, 0, item);
return;
}
if (type == 'downArticleMain') {
if (index == this.Main_List.length - 1) {
return;
}
const item = this.Main_List[index];
// 2. 从原位置删除
this.Main_List.splice(index, 1);
// 3. 插入到前一个位置
this.Main_List.splice(index + 1, 0, item);
return;
}
if (index !== -1 && resData) {
var newData = Array.isArray(resData) ? resData : (resData ? [resData] : []);
const updatedItems= newData.map((item) => ({
...item,
checked: false,
getnum: 0,
}));
if (type == 'addRow') {
this.Main_List.splice(index + 1, 0, updatedItems[0]);
} else if (type == 'addMoreRow') {
this.Main_List.splice(index + 1, 0, ...updatedItems);
}else if(type=='positioningImg'||type=='positioningTable'){
this.Main_List.splice(index + 1, 0, ...updatedItems);
}
else {
this.$set(this.Main_List, index, updatedItems[0]);
}
} else {
console.warn(`Item with am_id ${mainId} not found.`);
}
this.$forceUpdate();
},
handlePaperclip() {
this.uploadWordTables = [];
this.$refs.fileInput.click();
@@ -1231,21 +1369,18 @@ this.saveContent(newContent, selectedMedia.linkData.mainId);
},
async onAddRow(mainId) {
await this.$api
.post(this.urlList.addRow, {
am_id: mainId,
article_id: this.articleId
})
.then(async (res) => {
if(res.code == 0){
this.getDate();
this.getCommentList();
}else{
if (res.code == 0) {
this.refreshCurrentContent('addRow', mainId, res.data);
this.getCommentList();
} else {
this.$message.error(res.msg);
}
})
.catch((err) => {
this.$message.error(err.msg);
@@ -1270,8 +1405,6 @@ this.saveContent(newContent, selectedMedia.linkData.mainId);
},
async executeProofreading(data) {
console.log('data at line 1225:', data);
await this.$api
.post(this.urlList.executeProofreading, {
am_id: data.am_id,
@@ -1292,8 +1425,6 @@ this.saveContent(newContent, selectedMedia.linkData.mainId);
});
},
async revokeProofreading(data) {
console.log('data at line 1225:', data);
await this.$api
.post(this.urlList.executeProofreading, {
am_id: data.am_id,
@@ -1313,13 +1444,8 @@ this.saveContent(newContent, selectedMedia.linkData.mainId);
this.$message.error(err.msg);
});
},
async editProofreading(data) {
console.log('data at line 1225:', data);
},
deleteProofreading(data, index) {
console.log('comment at line 480:', data);
},
async editProofreading(data) {},
deleteProofreading(data, index) {},
async cancelSolveComment(data) {
await this.$api
@@ -1363,7 +1489,69 @@ this.saveContent(newContent, selectedMedia.linkData.mainId);
this.lineStyle.visiTitle = 'Add Table';
this.threeVisible = true;
},
handleImageEdit(data, type) {
async handleFigureAndTableDelete(data, type) {
await this.$confirm(this.$t('commonTable.remove' + type), 'Prompt', {
confirmButtonText: 'Submit',
cancelButtonText: 'Cancel',
type: 'warning'
})
.then(async (res) => {
const loading = this.$loading({
lock: true,
text: 'Loading...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
if (type == 'img') {
this.$api
.post(this.urlList.deleteImage, {
ami_id: data.ami_id,
article_id: this.articleId
})
.then(async (res) => {
if (res.status == 1) {
loading.close();
this.$message.success(res.msg);
this.$refs.commonWordHtmlTypeSetting.replacement('img', data.ami_id);
} else {
loading.close();
this.$message.error(res.msg);
}
})
.catch((err) => {
loading.close();
this.$message.error(err.msg);
});
}
if (type == 'table') {
this.$api
.post(this.urlList.deleteTable, {
amt_id: data.amt_id,
article_id: this.articleId
})
.then(async (res) => {
if (res.status == 1) {
loading.close();
this.$refs.commonWordHtmlTypeSetting.replacement('table', data.amt_id);
} else {
loading.close();
this.$message.error(res.msg);
}
})
.catch((err) => {
loading.close();
this.$message.error(err.msg);
});
}
})
.catch((err) => {
// this.$message.error(err.msg);
});
},
handleFigureAndTableEdit(data, type) {
if (type == 'img') {
var extension = data.url.split('.').pop().toLowerCase();
this.picStyle = {};
@@ -1373,17 +1561,15 @@ this.saveContent(newContent, selectedMedia.linkData.mainId);
} else if (type == 'table') {
this.lineStyle = {};
this.lineStyle1 = {};
// 1. 提取处理逻辑
const formattedData = {
...data,
table: JSON.parse(data.table_data),
// 如果 data 中已经包含了 html_data, note, title且不需要特殊处理
// 解构赋值 (...data) 其实已经把它们带进来了。
};
// 1. 提取处理逻辑
const formattedData = {
...data,
table: JSON.parse(data.table_data)
};
// 2. 统一赋值
this.lineStyle = formattedData;
this.lineStyle1 = { ...formattedData }; // 使用浅拷贝确保两个变量指向不同引用(如果需要独立修改)
// 2. 统一赋值
this.lineStyle = formattedData;
this.lineStyle1 = { ...formattedData }; // 使用浅拷贝确保两个变量指向不同引用(如果需要独立修改)
this.lineStyle.visiTitle = 'Edit Table';
this.threeVisible = true;
}
@@ -1448,36 +1634,40 @@ this.lineStyle1 = { ...formattedData }; // 使用浅拷贝确保两个变量指
this.currentId = dataId;
},
async onDrop(event, dataId) {
const loading = this.$loading({
lock: true,
text: 'Loading...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
if (event.dataTransfer.getData('image')) {
const draggedImage = JSON.parse(event.dataTransfer.getData('image'));
const draggedImageIndex = JSON.parse(event.dataTransfer.getData('imageIndex'));
this.$nextTick(async () => {
await this.$api
.post(this.urlList.setPositioningImage, {
am_id: dataId,
ami_id: draggedImage.ami_id
})
.then(async (res) => {
if (res.code == 0) {
this.getDate();
if (res.code == 0) {loading.close()
this.refreshCurrentContent('positioningImg',dataId, res.data);
this.$nextTick(() => {
this.$refs.commonWordHtmlTypeSetting.refresh('img');
this.$refs.commonWordHtmlTypeSetting.refresh('positioningImg', res.data);
});
this.$forceUpdate();
} else {
} else {loading.close()
this.$message.error(res.msg);
}
})
.catch((err) => {
.catch((err) => {loading.close()
this.$message.error(err.msg);
});
});
// this.Main_List.splice(index + 1, 0, draggedImage);
// this.$nextTick(() => {
// this.$refs.commonWordHtmlTypeSetting.changeIsHidden(draggedImageIndex, true, 'img');
// });
} else {
const draggedtable = JSON.parse(event.dataTransfer.getData('table'));
@@ -1488,28 +1678,27 @@ this.lineStyle1 = { ...formattedData }; // 使用浅拷贝确保两个变量指
amt_id: draggedtable.amt_id
})
.then(async (res) => {
if (res.code == 0) {
this.getDate();
if (res.code == 0) {loading.close()
this.refreshCurrentContent('positioningTable',dataId, res.data);
this.$nextTick(() => {
this.$refs.commonWordHtmlTypeSetting.refresh('table');
this.$refs.commonWordHtmlTypeSetting.refresh('positioningTable', res.data);
});
this.$forceUpdate();
} else {
loading.close()
this.$message.error(res.msg);
}
})
.catch((err) => {
loading.close()
this.$message.error(err.msg);
});
});
// const draggedtableIndex = JSON.parse(event.dataTransfer.getData('tableIndex'));
// this.Main_List.splice(index + 1, 0, draggedtable);
// console.log('this.Main_List.splice at line 447:', this.Main_List);
}
// this.getWord();
},
getCommentList() {
this.$api
@@ -1522,13 +1711,10 @@ this.lineStyle1 = { ...formattedData }; // 使用浅拷贝确保两个变量指
});
},
getWord() {
this.htmlContent = 'true';
},
// 获取数据
async getDate() {
this.imagesList = [];
let urlLInk = '';
let urlTask = {};
@@ -1548,7 +1734,7 @@ this.lineStyle1 = { ...formattedData }; // 使用浅拷贝确保两个变量指
.post(urlLInk, urlTask)
.then(async (res) => {
if (res.code == 0) {
this.Main_List = res.data.list.map(e=>{
this.Main_List = res.data.list.map((e) => {
e.checked = false;
return e;
});
@@ -1556,14 +1742,12 @@ this.lineStyle1 = { ...formattedData }; // 使用浅拷贝确保两个变量指
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 () => {
this.$nextTick(async () => {
await this.getWord();
if (this.$refs.catalogue) {
await this.$refs.catalogue.getCatalogueList();
}
loading.close();
});
// }, 1000);
@@ -1659,8 +1843,6 @@ this.lineStyle1 = { ...formattedData }; // 使用浅拷贝确保两个变量指
// 确定保存图片
async savePic() {
var str = this.picStyle1.note ? await this.$commonJS.decodeHtml(this.picStyle1.note) : '';
var titleStr = this.picStyle1.title ? await this.$commonJS.decodeHtml(this.picStyle1.title) : '';
@@ -1672,6 +1854,12 @@ this.lineStyle1 = { ...formattedData }; // 使用浅拷贝确保两个变量指
this.$message.error('Please enter a title');
return;
}
const loading = this.$loading({
lock: true,
text: 'Loading...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
if (this.picStyle.visiTitle == 'Edit Figure') {
this.$api
.post(this.urlList.editImage, {
@@ -1682,20 +1870,22 @@ this.lineStyle1 = { ...formattedData }; // 使用浅拷贝确保两个变量指
})
.then((res) => {
if (res.code == 0) {
loading.close();
this.$message.success('Successfully edit Figure!');
this.pictVisible = false;
this.$refs.commonWordHtmlTypeSetting.refresh('editImg', res.data.image?{...res.data.image,has_selected:1}:res.data);
this.refreshCurrentContent('editImg',res.data.am_id, res.data);
this.$nextTick(() => {
this.getDate();
this.getCommentList();
this.$forceUpdate();
});
this.$refs.commonWordHtmlTypeSetting.refresh('img');
} else {
loading.close();
this.$message.error(res.msg);
}
})
.catch((err) => {
loading.close();
this.$message.error(err);
});
} else {
@@ -1708,15 +1898,19 @@ this.lineStyle1 = { ...formattedData }; // 使用浅拷贝确保两个变量指
})
.then((res) => {
if (res.code == 0) {
loading.close();
this.$message.success('Successfully Add Figure!');
this.pictVisible = false;
this.getDate();
this.$refs.commonWordHtmlTypeSetting.refresh('img');
this.$refs.commonWordHtmlTypeSetting.refresh('addImg', res.data);
} else {
loading.close();
this.$message.error(res.msg);
}
})
.catch((err) => {
loading.close();
this.$message.error(err);
});
}
@@ -1766,18 +1960,18 @@ this.lineStyle1 = { ...formattedData }; // 使用浅拷贝确保两个变量指
}
if (strTitle != '') {
strTitle = await this.$commonJS.decodeHtml(strTitle);
}else{
} else {
this.$message.error('Please enter a title');
return;
}
if (content && cleanedTableList && cleanedTableList.length > 0) {
const loading = this.$loading({
lock: true,
text: 'Loading...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
lock: true,
text: 'Loading...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
if (this.lineStyle.visiTitle == 'Edit Table') {
this.$api
.post(this.urlList.editTable, {
@@ -1789,21 +1983,22 @@ this.lineStyle1 = { ...formattedData }; // 使用浅拷贝确保两个变量指
})
.then((res) => {
if (res.code == 0) {
loading.close();
this.$message.success('Successfully edit Table!');
this.threeVisible = false;
setTimeout(() => {
this.getDate();
this.$refs.commonWordHtmlTypeSetting.refresh('editTable', res.data.table?{...res.data.table,has_selected:1}:res.data);
this.refreshCurrentContent('editTable',res.data.am_id, res.data);
this.getCommentList();
this.$refs.commonWordHtmlTypeSetting.refresh('table');
});
} else {
this.$message.error(res.msg);
loading.close();
this.$message.error(res.msg);
}
})
.catch((err) => {
this.$message.error(err);
loading.close();
this.$message.error(err);
});
} else {
this.$api
@@ -1816,14 +2011,14 @@ this.lineStyle1 = { ...formattedData }; // 使用浅拷贝确保两个变量指
})
.then((res) => {
if (res.code == 0) {
loading.close();
this.$message.success('Successfully Add Table!');
this.threeVisible = false;
this.getDate();
loading.close();
this.$refs.commonWordHtmlTypeSetting.refresh('table');
this.$refs.commonWordHtmlTypeSetting.refresh('addTable', res.data);
} else {
this.$message.error(res.msg);
loading.close();
this.$message.error(res.msg);
}
})
.catch((err) => {
@@ -1940,7 +2135,7 @@ this.lineStyle1 = { ...formattedData }; // 使用浅拷贝确保两个变量指
this.$message.error('Picture size cannot exceed 20M!');
return false;
}
const isValidFormat = ['image/jpeg', 'image/png', 'image/tiff'].includes(file.type);
if (!isValidFormat) {
this.$message.error(this.$t('commonTable.uploadImageInfo'));
@@ -2337,5 +2532,4 @@ this.lineStyle1 = { ...formattedData }; // 使用浅拷贝确保两个变量指
background-color: #0066990d;
/* display: block !important; */
}
</style>