瀏覽代碼

feat: 报告编辑 代码 保存代码

32197351@qq.com 2 年之前
父節點
當前提交
881cb3da8c

+ 1 - 0
itdmWeb/.env

@@ -4,3 +4,4 @@ VUE_APP_PLATFORM_NAME=iTDM试验协同管理平台
 VUE_APP_SSO=false
 # 开启微应用模式
 VUE_APP_QIANKUN=false
+VUE_APP_ONLYOFFICE_URL=http://192.168.1.26

+ 4 - 1
itdmWeb/.env.development

@@ -1,7 +1,10 @@
 NODE_ENV=development
-VUE_APP_API_BASE_URL=http://localhost:8080/itdmServer
+VUE_APP_API_BASE_URL=http://192.168.1.14:8080/itdmServer
 VUE_APP_CAS_BASE_URL=http://cas.example.org:8443/cas
 VUE_APP_ONLINE_BASE_URL=http://fileview.jeecg.com/onlinePreview
 
 # 微应用列表必须VUE_APP_SUB_开头,jeecg-app-1为子应用的项目名称,也是子应用的路由父路径
 VUE_APP_SUB_jeecg-app-1 = '//localhost:8092'
+
+
+VUE_APP_ONLYOFFICE_URL=http://192.168.1.26

+ 2 - 1
itdmWeb/.env.production

@@ -1,4 +1,5 @@
 NODE_ENV=production
 VUE_APP_API_BASE_URL=http://localhost:8080/jeecg-boot
 VUE_APP_CAS_BASE_URL=http://localhost:8888/cas
-VUE_APP_ONLINE_BASE_URL=http://fileview.jeecg.com/onlinePreview
+VUE_APP_ONLINE_BASE_URL=http://fileview.jeecg.com/onlinePreview
+VUE_APP_ONLYOFFICE_URL=http://192.168.1.26

+ 2 - 1
itdmWeb/.env.test

@@ -1,4 +1,5 @@
 NODE_ENV=production
 VUE_APP_API_BASE_URL=http://boot.jeecg.com:8080/jeecg-boot
 VUE_APP_CAS_BASE_URL=http://cas.example.org:8443/cas
-VUE_APP_ONLINE_BASE_URL=http://fileview.jeecg.com/onlinePreview
+VUE_APP_ONLINE_BASE_URL=http://fileview.jeecg.com/onlinePreview
+VUE_APP_ONLYOFFICE_URL=http://192.168.1.26

+ 5 - 0
itdmWeb/public/index.html

@@ -16,6 +16,8 @@
   <script src="<%= BASE_URL %>cdn/babel-polyfill/chosen.jquery.js"></script> -->
   <!-- <link rel="stylesheet" type="text/css" href="<%= BASE_URL %>cdn/babel-polyfill/chosen.css"> -->
   <!-- <link rel="stylesheet" type="text/css" href="./cdn/babel-polyfill/chosen.css"> -->
+  <script type="text/javascript" src="<%= VUE_APP_ONLYOFFICE_URL %>/web-apps/apps/api/documents/api.js"></script>
+
   <style>
     html,
     body,
@@ -249,6 +251,9 @@
   </style>
   <!-- 全局配置 -->
   <script src="<%= BASE_URL %>static/config.js"></script>
+  <script type="text/javascript">
+    console.log('<%= VUE_APP_ONLYOFFICE_URL %>')
+  </script>
 </head>
 
 <body>

+ 14 - 1
itdmWeb/src/views/module-iTDM/baogao/ItdmBaogaoList.vue

@@ -90,6 +90,9 @@
         </template>
 
         <span slot="action" slot-scope="text, record">
+          <a @click="wordedit(record)">编辑</a>
+
+          <a-divider type="vertical" />
            <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                   <a>删除</a>
                 </a-popconfirm>
@@ -101,6 +104,8 @@
     </div>
 
     <itdm-baogao-modal ref="modalForm" @ok="modalFormOk"></itdm-baogao-modal>
+    <word-edit ref="wordedit" @ok="modalFormOk"></word-edit>
+
   </a-card>
 </template>
 
@@ -110,13 +115,17 @@ import '@/assets/less/TableExpand.less'
 import { mixinDevice } from '@/utils/mixin'
 import { JeecgListMixin } from '@/mixins/JeecgListMixin'
 import ItdmBaogaoModal from './modules/ItdmBaogaoModal'
+import wordEdit from './modules/wordEdit'
+
 import { filterMultiDictText } from '@comp/dict/JDictSelectUtil'
 import { getAction } from '@api/manage'
+import WordEdit from '@views/module-iTDM/baogao/modules/wordEdit'
 
 export default {
   name: 'ItdmBaogaoList',
-  mixins: [JeecgListMixin, mixinDevice],
+  mixins: [JeecgListMixin, mixinDevice,wordEdit],
   components: {
+    WordEdit,
     ItdmBaogaoModal
   },
   data() {
@@ -196,6 +205,10 @@ export default {
     }
   },
   methods: {
+    wordedit(record){
+      this.$refs.wordedit.edit(record);
+      this.$refs.wordedit.visible=true
+    },
 
     getSuperFieldList() {
       let fieldList = []

+ 102 - 0
itdmWeb/src/views/module-iTDM/baogao/modules/wordEdit.vue

@@ -0,0 +1,102 @@
+<template>
+
+  <a-modal
+    title="Title"
+    width="80%"
+    :visible="visible"
+    @ok="handleOk"
+  @cancel="handleOk"
+  >
+
+
+  <dev v-show="visible" id="monitorOffice" ></dev>
+
+  </a-modal>
+</template>
+
+<script>
+
+
+  import { getAction } from '@api/manage'
+
+  export default {
+    name: 'wordEdit',
+    created () {
+      //备份model原始值
+      this.config.document.key=""
+      this.config.document.fileType=""
+      this.config.document.url=""
+      this.config.document.title=""
+      this.config.editorConfig.callbackUrl=""
+    },
+    data () {
+      return {
+        docEditor: null,
+        visible: false,
+        queryById: '/baogao/itdmBaogao/wordById',
+        config: {
+          document: {
+            fileType: "docx",
+            key: "1685240820786",
+            title: "1685240820786.docx",
+            url: "http://192.168.1.14:8080/itdmServer/word/1685240820786.docx",
+            referenceData: {
+              "fileKey": "1685240820786",
+              "instanceId": "http://192.168.1.14:8080/itdmServer/word/1685240820786.docx"
+            },
+          },
+          documentType: "word",
+          width: "100%",
+          height: "600px",
+          editorConfig: {
+            lang:'zh',
+            callbackUrl: "http://192.168.1.14:8080/itdmServer/word/save"
+          }
+        },
+
+      }
+    },
+    methods: {
+      edit (record) {
+        if (this.docEditor) {
+          this.docEditor.destroyEditor()
+        }
+        console.log(record)
+        const select = { id: record.id }
+        getAction(this.queryById, select).then((res) => {
+          if (res.success) {
+
+
+            this.config.document.key=res.result.key
+            this.config.document.fileType=res.result.fileType
+            this.config.document.url=process.env.VUE_APP_API_BASE_URL+"/"+res.result.url
+            this.config.document.title=res.result.title
+            this.config.editorConfig.callbackUrl=process.env.VUE_APP_API_BASE_URL+"/"+"word/save"
+
+            console.log(this.config)
+            this.docEditor = new DocsAPI.DocEditor("monitorOffice", this.config);
+
+
+          } else {
+            this.$message.warning(res.message)
+          }
+        })
+
+      },
+      handleOk(){
+        this.visible=false
+        this.config.document.key=""
+        this.config.document.fileType=""
+        this.config.document.url=""
+        this.config.document.title=""
+        this.config.editorConfig.callbackUrl=""
+        if (this.docEditor) {
+          this.docEditor.destroyEditor()
+        }
+        this.$emit("ok");
+
+      }
+
+    }
+  }
+</script>