|
@ -6,11 +6,10 @@ |
|
|
<script lang="ts" setup> |
|
|
<script lang="ts" setup> |
|
|
import { DocumentEditor } from "@onlyoffice/document-editor-vue"; |
|
|
import { DocumentEditor } from "@onlyoffice/document-editor-vue"; |
|
|
import { getSystemConfig, getSplit } from "@/system/config"; |
|
|
import { getSystemConfig, getSplit } from "@/system/config"; |
|
|
import { BrowserWindow, Dialog, Notify, System } from "@/system"; |
|
|
import { BrowserWindow } from "@/system"; |
|
|
import { ref, onMounted, inject } from "vue"; |
|
|
import { ref, onMounted, inject } from "vue"; |
|
|
|
|
|
|
|
|
const config = getSystemConfig(); |
|
|
const config = getSystemConfig(); |
|
|
const sys: any = inject<System>("system"); |
|
|
|
|
|
const win: any = inject<BrowserWindow>("browserWindow"); |
|
|
const win: any = inject<BrowserWindow>("browserWindow"); |
|
|
|
|
|
|
|
|
const props = defineProps({ |
|
|
const props = defineProps({ |
|
@ -24,7 +23,7 @@ const props = defineProps({ |
|
|
}, |
|
|
}, |
|
|
ext: { |
|
|
ext: { |
|
|
type: String, |
|
|
type: String, |
|
|
default: "md", |
|
|
default: "docx", |
|
|
}, |
|
|
}, |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
@ -38,69 +37,29 @@ onMounted(async () => { |
|
|
if (path != "") { |
|
|
if (path != "") { |
|
|
title = path.split(SP).pop(); |
|
|
title = path.split(SP).pop(); |
|
|
} |
|
|
} |
|
|
|
|
|
const apiUrl = config.storenet.url || config.apiUrl |
|
|
const fileKey = "docx" + Math.random() |
|
|
const fileKey = "docx" + Math.random() |
|
|
editorConfig.value = { |
|
|
editorConfig.value = { |
|
|
document: { |
|
|
document: { |
|
|
fileType: props.ext, // 根据文件扩展名动态设置 fileType |
|
|
fileType: props.ext, // 根据文件扩展名动态设置 fileType |
|
|
key:fileKey, |
|
|
key:fileKey, |
|
|
title: title, |
|
|
title: title, |
|
|
//url: blobUrl |
|
|
url: apiUrl + "/file/readfile?stream="+fileKey+"&path=" + path, |
|
|
url: config.storenet.url + "/file/readfile?stream="+fileKey+"&path=" + path, |
|
|
|
|
|
"info": { |
|
|
"info": { |
|
|
"owner": "王重阳", |
|
|
"owner": "GodoOS", |
|
|
}, |
|
|
}, |
|
|
token: config.onlyoffice.sceret, |
|
|
|
|
|
//文档权限参数 |
|
|
|
|
|
"permissions": { |
|
|
|
|
|
"edit": true, //(文件是否可以编辑,false时文件不可编辑) |
|
|
|
|
|
"fillForms": true, //定义是否能在文档中填充表单 |
|
|
|
|
|
"print": true, //定义文档是否能打印 |
|
|
|
|
|
"review": false, //第一是否显示审阅文档菜单 |
|
|
|
|
|
"comment": true, //定义是否可以注释文档。如果注释权限设置为“ true”,则文档侧栏将包含“注释”菜单选项;只有将mode参数设置为edit时才生效,默认值与edit参数的值一致。 |
|
|
|
|
|
"copy": true, //是否允许您将内容复制到剪贴板。默认值为true。 |
|
|
|
|
|
"download": true, //定义是否可以下载文档或仅在线查看或编辑文档。如果下载权限设置为“false”下载为菜单选项将没有。默认值为true。 |
|
|
|
|
|
"modifyContentControl": true, //定义是否可以更改内容控件设置。仅当mode参数设置为edit时,内容控件修改才可用于文档编辑器。默认值为true。 |
|
|
|
|
|
"modifyFilter": true, //定义过滤器是否可以全局应用(true)影响所有其他用户,或局部应用(false),即仅适用于当前用户。如果将mode参数设置为edit,则过滤器修改仅对电子表格编辑器可用。默认值为true。 |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
}, |
|
|
documentType: props.onlyType, |
|
|
documentType: props.onlyType, |
|
|
editorConfig: { |
|
|
editorConfig: { |
|
|
lang: "zh", |
|
|
lang: "zh", |
|
|
callbackUrl: config.storenet.url + "/file/onlyofficecallback", |
|
|
callbackUrl: apiUrl + "/file/onlyofficecallback", |
|
|
"canCoAuthoring": true, |
|
|
|
|
|
"canHistoryClose": true, |
|
|
|
|
|
"canHistoryRestore": true, |
|
|
|
|
|
"canMakeActionLink": true, |
|
|
|
|
|
"canRename": true, |
|
|
|
|
|
"canRequestClose": true, |
|
|
|
|
|
"canRequestCompareFile": true, |
|
|
|
|
|
"canRequestCreateNew": true, |
|
|
|
|
|
"canRequestEditRights": true, |
|
|
|
|
|
"canRequestInsertImage": true, |
|
|
|
|
|
"canRequestMailMergeRecipients": true, |
|
|
|
|
|
"canRequestOpen": true, |
|
|
|
|
|
"canRequestReferenceData": true, |
|
|
|
|
|
"canRequestReferenceSource": true, |
|
|
|
|
|
"canRequestSaveAs": true, |
|
|
|
|
|
"canRequestSelectDocument": true, |
|
|
|
|
|
"canRequestSelectSpreadsheet": true, |
|
|
|
|
|
"canRequestSendNotify": true, |
|
|
|
|
|
"canRequestSharingSettings": true, |
|
|
|
|
|
"canRequestUsers": true, |
|
|
|
|
|
"canSaveDocumentToBinary": true, |
|
|
|
|
|
"canSendEmailAddresses": true, |
|
|
|
|
|
"canStartFilling": true, |
|
|
|
|
|
"canUseHistory": true, |
|
|
|
|
|
"user": { //用户信息 |
|
|
"user": { //用户信息 |
|
|
"id": "godoos", //用户ID |
|
|
"id": "godoos", //用户ID |
|
|
"name": "写作员" //用户全名称 |
|
|
"name": "写作员" //用户全名称 |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
"events": { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
console.log(editorConfig.value) |
|
|
//console.log(editorConfig.value) |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
const onDocumentReady = () => { |
|
|
const onDocumentReady = () => { |
|
|