fileEdit.html 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <!DOCTYPE html>
  2. <html lang="en" xmlns:th="http://www.thymeleaf.org">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title th:text="文件管理"></title>
  6. </head>
  7. <body>
  8. <div id="fileEdit"></div>
  9. <!--// 页面引入document的api.js([SEC-20260913] 原硬编码 OnlyOffice 服务地址死链改为运行时配置下发:onlyOfficeUrl 反代前缀,与 src/utils/onlyOffice.ts 同约定)-->
  10. <script type="text/javascript" src="/js/config.js"></script>
  11. <script type="text/javascript">
  12. document.write('<script type="text/javascript" src="' + ((typeof VUE_APP_URL !== 'undefined' && VUE_APP_URL.onlyOfficeUrl) || '/documents') + '/web-apps/apps/api/documents/api.js"><\/script>');
  13. </script>
  14. <script>
  15. //office文件在线编辑、预览
  16. new DocsAPI.DocEditor("fileEdit", // 元素id
  17. {
  18. type: "desktop",
  19. width: "100%",
  20. height: "1000px",
  21. document: {
  22. title: "文档管理",
  23. url: "http://192.168.187.1:9999/ventanaly-sharefile/fileServer/onlyOffice/read?id=[[${id}]]",//id表示文件id,后端接口用这个id来加载文件
  24. fileType:"docx",//当文件类型为doc、xls、ppt时,对应用docx、xlsx、pptx否则会保存异常。
  25. key: "",
  26. lang: "zh-CN",
  27. permissions: {
  28. "download": true,//是否可下载
  29. "edit": true,
  30. "fillForms": true,
  31. "print": true,//是否可打印
  32. }
  33. },
  34. editorConfig: {
  35. "lang": "zh-CN",
  36. mode: "edit",//view:只读且可复制内容,edit:可编辑
  37. "callbackUrl": "http://192.168.187.1:9999/ventanaly-sharefile/fileServer/onlyOffice/save?id=[[${id}]]",//id表示文件id,后端接口用这个id来加载文件
  38. "coEditing": {
  39. "mode": "fast",
  40. "change": true
  41. },
  42. "customization": {
  43. "toolbarNoTabs": true,
  44. "autosave": false,//是否自动保存
  45. "forcesave": true,//定义保存按钮是否显示
  46. "hideRightMenu": true,
  47. },
  48. //用户信息
  49. "user": {
  50. "id": "857857", //用户ID
  51. "name": "小陈" //用户名称
  52. }
  53. }
  54. });
  55. </script>
  56. </body>
  57. </html>