diff --git a/web/src/api/datamanagement/index.ts b/web/src/api/datamanagement/index.ts index 5909e48..42c09c7 100644 --- a/web/src/api/datamanagement/index.ts +++ b/web/src/api/datamanagement/index.ts @@ -185,4 +185,13 @@ export function saveContent(params:any){ // 'Content-Type': 'application/json' // 明确指定内容类型 // } }) +} +//excel编辑保存 +export function batchModify(params:any){ + return request ({ + url:'/experimentalData/ts-files/batchModify', + method:'post', + data:params, + + }) } \ No newline at end of file diff --git a/web/src/components/textEditing/index.vue b/web/src/components/textEditing/index.vue index bb96650..ce68309 100644 --- a/web/src/components/textEditing/index.vue +++ b/web/src/components/textEditing/index.vue @@ -52,31 +52,28 @@ const txtloading = ref(false) const loadContent = () => { txtloading.value = true apicontent({ id: props.rowId }).then((res) => { + // debugger editor.value.commands.setContent(convertNewlinesToParagraphs(res.data)) txtloading.value = false - // statusMessage.value = '内容加载成功' - // setTimeout(() => statusMessage.value = '', 2000) + }) } function convertNewlinesToParagraphs(text) { - // 分割字符串并过滤空行 - const paragraphs = text.split('\n').filter(line => line.trim() !== ''); - - // 用
标签包裹每行并拼接 - return paragraphs.map(line => `
${line}
`).join(''); + return text.split('\n').map(line => `${line}
`).join(''); } function convertParagraphsToNewlines(html) { - // 移除所有标签并替换为换行符 - return html.replace(/<\/?p>/g, '\n') - // 合并多个换行符为一个(可选) - .replace(/\n+/g, '\n') - // 移除首尾换行符(可选) - .trim(); + return html + .replace(/<\/p>/g, '\n') // 将闭合标签替换为换行符 + .replace(/
/g, '') // 移除开始标签
+ .trim(); // 移除首尾空白
}
// 保存文件内容
const saveCcontent = () => {
+ // debugger
+ console.log(editor.value.getHTML())
const content = convertParagraphsToNewlines(editor.value.getHTML())
+ console.log(content)
saveContent({ id: props.rowId, content: content }).then((res) => {
loadContent()
ElMessage.success('保存成功')
diff --git a/web/src/components/textEditing/txtexl.vue b/web/src/components/textEditing/txtexl.vue
new file mode 100644
index 0000000..70e0f4b
--- /dev/null
+++ b/web/src/components/textEditing/txtexl.vue
@@ -0,0 +1,323 @@
+
+