| | |
| | | </head> |
| | | <body> |
| | | <div id="app"></div> |
| | | <script type='text/javascript' src='http://192.168.73.130:9001/web-apps/apps/api/documents/api.js'></script> |
| | | <script src="<%= htmlWebpackPlugin.options.url %>/static/luckysheet/plugins/js/plugin.js"></script> |
| | | <script src="<%= htmlWebpackPlugin.options.url %>/static/luckysheet/luckysheet.umd.js"></script> |
| | | </body> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <!--onlyoffice ç¼è¾å¨--> |
| | | <template> |
| | | <div id="vabOnlyOffice"></div> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | name: "VabOnlyOffice", |
| | | data() { |
| | | return { |
| | | doctype: "", |
| | | docEditor: null, |
| | | //åèvabOnlyOfficeç»ä»¶åæ°é
ç½® |
| | | option: { |
| | | url: "", |
| | | isEdit: false, |
| | | fileType: "", |
| | | title: "", |
| | | lang: "zh-CN", |
| | | isPrint: true, |
| | | user: {}, |
| | | editUrl: "" |
| | | } |
| | | }; |
| | | }, |
| | | created() { |
| | | const option = this.$route.query |
| | | this.option.url = option.url |
| | | this.option.isEdit = option.isEdit === "true" ? true : false |
| | | this.option.fileType = option.fileType |
| | | this.option.title = option.title |
| | | this.option.lang = option.lang |
| | | this.option.isPrint = option.isPrint |
| | | this.option.user.id = option.user_id |
| | | this.option.user.name = option.user_name |
| | | this.option.editUrl = option.editUrl |
| | | }, |
| | | beforeDestroy() { |
| | | if (this.docEditor !== null) { |
| | | this.docEditor.destroyEditor(); |
| | | this.docEditor = null; |
| | | } |
| | | }, |
| | | watch: { |
| | | option: { |
| | | handler: function(n) { |
| | | this.setEditor(n); |
| | | this.doctype = this.getFileType(n.fileType); |
| | | }, |
| | | deep: true |
| | | } |
| | | }, |
| | | mounted() { |
| | | if (this.option.url) { |
| | | this.setEditor(this.option); |
| | | } |
| | | }, |
| | | methods: { |
| | | async setEditor(option) { |
| | | console.log(`output->option`,option) |
| | | if (this.docEditor !== null) { |
| | | this.docEditor.destroyEditor(); |
| | | this.docEditor = null; |
| | | } |
| | | this.doctype = this.getFileType(option.fileType); |
| | | let config = { |
| | | document: { |
| | | //åç¼ |
| | | fileType: option.fileType, |
| | | key: option.key || "", |
| | | title: option.title, |
| | | permissions: { |
| | | edit: option.isEdit, //æ¯å¦å¯ä»¥ç¼è¾: åªè½æ¥çï¼ä¼ false |
| | | print: option.isPrint, |
| | | download: false |
| | | // "fillForms": true,//æ¯å¦å¯ä»¥å¡«åè¡¨æ ¼ï¼å¦æå°modeåæ°è®¾ç½®ä¸ºeditï¼åå¡«å表åä»
å¯¹ææ¡£ç¼è¾å¨å¯ç¨ã é»è®¤å¼ä¸editæreviewåæ°çå¼ä¸è´ã |
| | | // "review": true //è·è¸ªåå |
| | | }, |
| | | url: option.url |
| | | }, |
| | | documentType: this.doctype, |
| | | editorConfig: { |
| | | callbackUrl: option.editUrl, //"ç¼è¾wordåä¿åæ¶åè°çå°åï¼è¿ä¸ªapiéè¦èªå·±åäºï¼å°ç¼è¾åçæä»¶éè¿è¿ä¸ªapiä¿åå°èªå·±æ³è¦çä½ç½® |
| | | lang: option.lang, //è¯è¨è®¾ç½® |
| | | //å®å¶ |
| | | customization: { |
| | | autosave: false, //æ¯å¦èªå¨ä¿å |
| | | chat: true, |
| | | comments: false, |
| | | help: false, |
| | | // "hideRightMenu": false,//å®ä¹å¨ç¬¬ä¸æ¬¡å è½½æ¶æ¯æ¾ç¤ºè¿æ¯éèå³ä¾§èåã é»è®¤å¼ä¸ºfalse |
| | | //æ¯å¦æ¾ç¤ºæä»¶ |
| | | plugins: false |
| | | }, |
| | | user: { |
| | | id: option.user.id, |
| | | name: option.user.name |
| | | }, |
| | | mode: option.model ? option.model : "edit" |
| | | }, |
| | | width: "100%", |
| | | height: "100%", |
| | | token: option.token || "" |
| | | }; |
| | | |
| | | // eslint-disable-next-line no-undef,no-unused-vars |
| | | this.docEditor = new DocsAPI.DocEditor("vabOnlyOffice", config); |
| | | }, |
| | | getFileType(fileType) { |
| | | let docType = ""; |
| | | let fileTypesDoc = [ |
| | | "doc", |
| | | "docm", |
| | | "docx", |
| | | "dot", |
| | | "dotm", |
| | | "dotx", |
| | | "epub", |
| | | "fodt", |
| | | "htm", |
| | | "html", |
| | | "mht", |
| | | "odt", |
| | | "ott", |
| | | "pdf", |
| | | "rtf", |
| | | "txt", |
| | | "djvu", |
| | | "xps" |
| | | ]; |
| | | let fileTypesCsv = [ |
| | | "csv", |
| | | "fods", |
| | | "ods", |
| | | "ots", |
| | | "xls", |
| | | "xlsm", |
| | | "xlsx", |
| | | "xlt", |
| | | "xltm", |
| | | "xltx" |
| | | ]; |
| | | let fileTypesPPt = [ |
| | | "fodp", |
| | | "odp", |
| | | "otp", |
| | | "pot", |
| | | "potm", |
| | | "potx", |
| | | "pps", |
| | | "ppsm", |
| | | "ppsx", |
| | | "ppt", |
| | | "pptm", |
| | | "pptx" |
| | | ]; |
| | | if (fileTypesDoc.includes(fileType)) { |
| | | docType = "text"; |
| | | } |
| | | if (fileTypesCsv.includes(fileType)) { |
| | | docType = "spreadsheet"; |
| | | } |
| | | if (fileTypesPPt.includes(fileType)) { |
| | | docType = "presentation"; |
| | | } |
| | | return docType; |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style> |
| | | html, |
| | | body { |
| | | height: 100%; |
| | | } |
| | | #app { |
| | | font-family: Avenir, Helvetica, Arial, sans-serif; |
| | | -webkit-font-smoothing: antialiased; |
| | | -moz-osx-font-smoothing: grayscale; |
| | | text-align: center; |
| | | color: #2c3e50; |
| | | height: 100%; |
| | | } |
| | | .qualityManual-container { |
| | | padding: 0 !important; |
| | | height: 100%; |
| | | } |
| | | .qualityManual-container-office { |
| | | width: 100%; |
| | | height: calc(100% - 55px); |
| | | } |
| | | </style> |
| | |
| | | showSelect: false, |
| | | select: false, |
| | | do: [ |
| | | // { |
| | | // id: 'handleWeave', |
| | | // font: 'å¨çº¿ç¼å¶', |
| | | // type: 'text', |
| | | // method: 'handleWeave', |
| | | // disabFun: (row, index) => { |
| | | // return row.isExamine != null |
| | | // } |
| | | // }, |
| | | { |
| | | id: 'handleWeave', |
| | | font: 'å¨çº¿ç¼å¶', |
| | | type: 'text', |
| | | method: 'handleWeave', |
| | | disabFun: (row, index) => { |
| | | return row.isExamine != null |
| | | } |
| | | }, |
| | | { |
| | | id: 'download', |
| | | font: 'ä¸è½½', |
| | |
| | | } |
| | | ], |
| | | linkEvent: { |
| | | // code: { |
| | | // method: 'selectAllByOne' |
| | | // } |
| | | code: { |
| | | method: 'selectAllByOne' |
| | | } |
| | | }, |
| | | tagField: { |
| | | isRatify: { |
| | |
| | | this.upIndex++ |
| | | }, |
| | | async handleWeave(row) { |
| | | // this.value = await file.convertFileToHtml(row.url) |
| | | // this.claimVisible = true; |
| | | this.$axios.post(this.$api.insReport.wordToHtml, { |
| | | path: row.urlS ? row.urlS : row.url |
| | | }).then(res => { |
| | | if (res.code === 200) { |
| | | // console.log(11111111,res.data) |
| | | this.value = res.data |
| | | .replace(/<a [^>]*>/g, "") |
| | | .replace(/<\/a>/g, "") |
| | | .replace(/ /g, " "); |
| | | this.claimVisible = true; |
| | | const userName = JSON.parse(localStorage.getItem("user")).name; |
| | | //åèvabOnlyOfficeç»ä»¶åæ°é
ç½® |
| | | const { href } = this.$router.resolve({ |
| | | path: `/wordEdit`, |
| | | query: { |
| | | url: this.javaApi + "/word/" + row.entrustCode + ".docx", |
| | | isEdit: true, |
| | | fileType: "docx", |
| | | title: row.entrustCode + ".docx", |
| | | lang: 'zh-CN', |
| | | isPrint: true, |
| | | user: { id: 1, name: userName}, |
| | | editUrl: this.javaApi + "/insReport/onlyOffice/save?fileName=" + row.entrustCode + ".docx" |
| | | } |
| | | }).catch(error => { |
| | | console.error(error) |
| | | }) |
| | | window.open(href, '_blank'); |
| | | }, |
| | | // æéåé
|
| | | getPower(radio) { |
| | |
| | | // console.log(this.$refs.Word.getValue()) |
| | | }, |
| | | async selectAllByOne(row) { |
| | | console.log(row, await file.convertFileToHtml(row.url)); |
| | | const userName = JSON.parse(localStorage.getItem("user")).name; |
| | | //åèvabOnlyOfficeç»ä»¶åæ°é
ç½® |
| | | const { href } = this.$router.resolve({ |
| | | path: `/wordEdit`, |
| | | query: { |
| | | url: this.javaApi + "/word/" + row.entrustCode + ".docx", |
| | | isEdit: "false", |
| | | fileType: "docx", |
| | | title: row.entrustCode + ".docx", |
| | | lang: 'zh-CN', |
| | | isPrint: true, |
| | | user_id: 1, |
| | | user_name: userName |
| | | } |
| | | }) |
| | | window.open(href, '_blank'); |
| | | console.log(`output->row`,row) |
| | | }, |
| | | download(row) { |
| | | let url = row.urlS ? row.urlS : row.url; |
| | |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | </script> |
| | |
| | | },{ |
| | | path: "/test/excel", |
| | | component: () => import("../components/tool/excel.vue") |
| | | }] |
| | | },{ |
| | | path: "/wordEdit", |
| | | component: () => import("../components/tool/onlyoffice.vue") |
| | | }] |
| | | }) |