Forráskód Böngészése

onlyoffice在线编辑保存

wucl 11 hónapja
szülő
commit
20416f3abe

+ 1 - 1
.env.production

@@ -31,7 +31,7 @@ VUE_APP_ONLYOFFICE_SERVER=http://office.scdayou.com
 VUE_APP_ONLYOFFICE_API_PREFIX=/onlyofficeApi
 
 # Onlyoffice 回调接口地址,相关文档:https://api.onlyoffice.com/editors/callback
-VUE_APP_ONLYOFFICE_CALLBACK=$VUE_APP_ONLYOFFICE_SERVER/api/onlyoffice/callback
+VUE_APP_ONLYOFFICE_CALLBACK=$VUE_APP_HOST/api/onlyoffice/callback
 
 # Onlyoffice 文档构建接口地址,相关文档:https://api.onlyoffice.com/editors/documentbuilderapi
 VUE_APP_ONLYOFFICE_DOCBUILDER=$VUE_APP_ONLYOFFICE_SERVER/api/onlyoffice/callback

+ 34 - 34
src/components/DocumentEditor/index.vue

@@ -55,40 +55,40 @@
       return {
         // 编辑器配置项,完整配置项参见:https://api.onlyoffice.com/editors/config/
         editorConfig: {
-          // 编辑器宽度
-          width: 1200,
-          // 编辑器高度
-          height: 600,
-          // 文档配置
-          document: {
-            // 权限
-            permissions: {
-              // 启用评论
-              comment: false,
-              // 启用下载
-              download: true,
-              // 启用导出
-              print: true,
-              // 启用预览
-              review: true
-            }
-          },
-          editorConfig: {
-            // 回调地址
-            callbackUrl: process.env.VUE_APP_ONLYOFFICE_CALLBACK,
-            // 设置语言
-            lang: 'zh-CN',
-            // customization 字段相关配置详解:https://api.onlyoffice.com/editors/config/editor/customization
-            customization: {
-              // 强制保存
-              forcesave: true,
-              features: {
-                // 关闭拼写检查
-                spellcheck: false
-              },
-              compactHeader: true
-            },
-          }
+          // // 编辑器宽度
+          // width: 1200,
+          // // 编辑器高度
+          // height: 600,
+          // // 文档配置
+          // document: {
+          //   // 权限
+          //   permissions: {
+          //     // 启用评论
+          //     comment: false,
+          //     // 启用下载
+          //     download: true,
+          //     // 启用导出
+          //     print: true,
+          //     // 启用预览
+          //     review: true
+          //   }
+          // },
+          // editorConfig: {
+          //   // 回调地址
+          //   callbackUrl: process.env.VUE_APP_ONLYOFFICE_CALLBACK,
+          //   // 设置语言
+          //   lang: 'zh-CN',
+          //   // customization 字段相关配置详解:https://api.onlyoffice.com/editors/config/editor/customization
+          //   customization: {
+          //     // 强制保存
+          //     forcesave: true,
+          //     features: {
+          //       // 关闭拼写检查
+          //       spellcheck: false
+          //     },
+          //     compactHeader: true
+          //   },
+          // }
         },
         id: `editor-${new Date().getTime().toString('32')}`
       }

+ 12 - 6
src/components/OnlyOffice/officeFileView.vue

@@ -15,9 +15,9 @@ export default {
     data() {
         return {
             loading: {
-                editor: false,
-                save: false,
-                forceSave: false
+                editor: true,
+                save: true,
+                forceSave: true
             },
             // 支持的word编辑器的类型
             supportWordFile:['doc', 'docm', 'docx', 'dot', 'dotm', 'dotx', 'epub', 'fb2', 'fodt', 'htm', 'html', 'mht', 'mhtml', 'odt', 'ott', 'rtf', 'stw', 'sxw', 'txt', 'wps', 'wpt', 'xml'],
@@ -38,6 +38,7 @@ export default {
                 documentType: null,
                 // 文档配置
                 document: {
+                    key: null,
                     // 文件类型
                     fileType: null,
                     // 文档url地址
@@ -46,13 +47,17 @@ export default {
                     title: null,
                     // 文档权限配置
                     permissions: {
-                        edit: false, //文件是否可以编辑,false时文件不可编辑
+                        edit: true, //文件是否可以编辑,false时文件不可编辑
                     }
                 },
                 //编辑配置
                 editorConfig: {
                     //文档操作模式 view 视图模式不可编辑  edit 编辑模式可编辑文档
-                    mode: 'view'
+                    mode: 'edit',
+                         // 回调地址
+                    callbackUrl: 'http://mbs.scdayou.com/api/onlyoffice/callback',
+                    // 设置语言
+                    lang: 'zh-CN',
                 }
             }
         }
@@ -65,7 +70,7 @@ export default {
         setConfigInfo() {
             this.editorConfig.document.title = this.$route.query.title;
             this.editorConfig.document.url = process.env.VUE_APP_API_SERVER + this.$route.query.url;
-
+            this.editorConfig.editorConfig.callbackUrl = "http://mbs.scdayou.com/api/onlyoffice/callback?originPath=/opt"+this.$route.query.url;
             const lastIndex = this.$route.query.title.lastIndexOf('.');
             this.editorConfig.document.fileType = lastIndex !== -1 ? this.$route.query.title.substring(lastIndex + 1) : null;
             if (this.supportWordFile.includes(this.editorConfig.document.fileType)) {
@@ -82,6 +87,7 @@ export default {
                 // this.editorConfig.documentType = "pdf";
                 this.editorConfig.documentType = "word";
             }
+            console.log(this.editorConfig.editorConfig.callbackUrl)
         }
     }
 }

+ 1 - 1
src/components/personalForms/entityInfo.vue

@@ -300,7 +300,7 @@ export default {
         buildingStructure: [{ required: true, message: '建筑结构不能为空', trigger: 'blur' }],
         buildingAge: [{ required: true, message: '建筑年代不能为空', trigger: 'blur' }],
         acreage: [{ required: true, message: '建筑面积不能为空', trigger: 'blur' }, { validator: isNumber, trigger: 'blur' }],
-        atFloor: [{ required: true, message: '所在楼层不能为空', trigger: 'blur' }, { validator: postiveInteger, trigger: 'blur' }],
+        atFloor: [{ required: true, message: '所在楼层不能为空', trigger: 'blur' }],
         aspect: [{ required: true, message: '朝向不能为空', trigger: 'blur' }],
         ladderToHouse: [{ required: true, message: '梯户数不能为空', trigger: 'blur' }],
         floorHeight: [{ required: true, message: '层高不能为空', trigger: 'blur' }, { validator: isNumber, trigger: 'blur' }],