소스 검색

Merge branch 'dev' of http://git.xayunmei.com/SH-Arbitrate/Arbitrate-Frontend into gyj

gyj 2 년 전
부모
커밋
25f13bbbe9

+ 1
- 0
public/index.html 파일 보기

@@ -7,6 +7,7 @@
7 7
     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
8 8
     <link rel="icon" href="<%= BASE_URL %>favicon.ico">
9 9
     <title><%= webpackConfig.name %></title>
10
+    <script src="http://121.40.189.20:8899/web-apps/apps/api/documents/api.js"></script>
10 11
     <!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]-->
11 12
 	  <style>
12 13
     html,

+ 20
- 0
src/api/onlyoffice/onlyoffice.js 파일 보기

@@ -0,0 +1,20 @@
1
+import request from '@/utils/request'
2
+// 获取onlyoffice配置文件
3
+export function getOnlyoffice(params) {
4
+  return request({
5
+    url: '/onlyOffice',
6
+    // headers: {
7
+    //   isToken: false
8
+    // },
9
+    method: 'get',
10
+    params: params
11
+  })
12
+}
13
+// 保存onlyoffice文档
14
+export function saveOnlyOfficeFile(data) {
15
+  return request({
16
+    url: '/caseApplication/saveOnlyOfficeFile',
17
+    method: 'post',
18
+    data: data
19
+  })
20
+}

+ 5
- 0
src/router/index.js 파일 보기

@@ -61,6 +61,11 @@ export const constantRoutes = [
61 61
     component: () => import('@/views/error/401'),
62 62
     hidden: true
63 63
   },
64
+  {
65
+    path: '/onlyoffice',
66
+    component: () => import('@/views/onlyoffice/onlyoffice'),
67
+    hidden: true
68
+  },
64 69
   {
65 70
     path: '',
66 71
     component: Layout,

+ 1
- 0
src/store/getters.js 파일 보기

@@ -15,5 +15,6 @@ const getters = {
15 15
   topbarRouters:state => state.permission.topbarRouters,
16 16
   defaultRoutes:state => state.permission.defaultRoutes,
17 17
   sidebarRouters:state => state.permission.sidebarRouters,
18
+  userId:state => state.user.userId,
18 19
 }
19 20
 export default getters

+ 4
- 0
src/store/modules/user.js 파일 보기

@@ -11,6 +11,9 @@ const user = {
11 11
   },
12 12
 
13 13
   mutations: {
14
+    SET_USERID:(state,userId) => {
15
+      state.userId = userId
16
+    },
14 17
     SET_TOKEN: (state, token) => {
15 18
       state.token = token
16 19
     },
@@ -60,6 +63,7 @@ const user = {
60 63
           }
61 64
           commit('SET_NAME', user.userName)
62 65
           commit('SET_AVATAR', avatar)
66
+          commit('SET_USERID',user.userId)
63 67
           resolve(res)
64 68
         }).catch(error => {
65 69
           reject(error)

+ 14
- 14
src/views/caseManagement/components/trialincourtDialog.vue 파일 보기

@@ -157,7 +157,7 @@
157 157
           <el-form-item label="裁决书:">
158 158
             <div v-if="awardArr.length == 0">裁决书暂未提供!</div>
159 159
             <div v-for="(item, index) in awardArr" :key="index">
160
-              <a href="#" @click="awardToFile(item, index)" style="color: blue">
160
+              <a href="#" @click="awardToFile(item.onlyOfficeFileId)" style="color: blue">
161 161
                 {{ item.annexName }}
162 162
               </a>
163 163
             </div>
@@ -549,10 +549,7 @@ export default {
549 549
                 }
550 550
                 //裁决书附件
551 551
                 if (item.annexType == 3) {
552
-                  this.awardArr.push({
553
-                    annexName: item.annexName,
554
-                    annexPath: item.annexPath,
555
-                  });
552
+                  this.awardArr.push(item);
556 553
                 }
557 554
               });
558 555
             }
@@ -585,11 +582,17 @@ export default {
585 582
       );
586 583
     },
587 584
     //裁决书文件
588
-    awardToFile(item, index) {
589
-      window.open(
590
-        window.location.origin + "/API" + this.awardArr[index].annexPath,
591
-        "_black"
592
-      );
585
+    awardToFile(item) {
586
+      console.log(item,"LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL");
587
+      // window.open(
588
+      //   window.location.origin + "/API" + this.awardArr[index].annexPath,
589
+      //   "_black"
590
+      // );
591
+      if (this.checkPermi(['caseManagement:list:editOffice'])) {
592
+        this.$router.push({ path: '/onlyoffice', query: { id: item, flag: 1 } })
593
+      } else {
594
+        this.$router.push({ path: '/onlyoffice', query: { id: item, flag: 0 } })
595
+      }
593 596
     },
594 597
     // 庭审笔录附件
595 598
     toFile2(item, index) {
@@ -670,10 +673,7 @@ export default {
670 673
                 this.adjudicatename.caseAttachList = res.data.caseAttachList;
671 674
                  this.adjudicatename.caseAttachList.forEach(item=>{
672 675
                   if(item.annexType==3){
673
-                    this.awardArr.push({
674
-                    annexName: item.annexName,
675
-                    annexPath: item.annexPath,
676
-                  });
676
+                    this.awardArr.push(item);
677 677
                   }
678 678
                  })
679 679
                 

+ 110
- 0
src/views/onlyoffice/onlyoffice.vue 파일 보기

@@ -0,0 +1,110 @@
1
+<template>
2
+  <div style="width: 100%; height: 100%">
3
+    <div id="placeholder"></div>
4
+  </div>
5
+</template>
6
+
7
+<script>
8
+import { getOnlyoffice, saveOnlyOfficeFile } from "@/api/onlyoffice/onlyoffice";
9
+import { setToken } from "@/utils/auth";
10
+import store from "@/store";
11
+import axios from "axios";
12
+export default {
13
+  props: [],
14
+  data() {
15
+    return {
16
+      config: {},
17
+      flag: 0,
18
+      userId: store.getters.userId,
19
+      websock: null,
20
+    };
21
+  },
22
+  destroyed() {
23
+    //页面销毁时关闭ws连接
24
+    if (this.websock) {
25
+      this.websock.close(); // 关闭websocket
26
+    }
27
+  },
28
+  methods: {
29
+    getConfig(id) {
30
+      let edit = "edit";
31
+      if (this.flag == 0) {
32
+        edit = "view";
33
+      } else {
34
+        edit = "edit";
35
+      }
36
+      axios
37
+        .get(
38
+          `http://121.40.189.20:9090/onlyOfficeConfig/${edit}/${id}/${this.userId}/desktop/true/zhongcai`
39
+        )
40
+        .then((res) => {
41
+          this.config = res.data;
42
+          this.config.editorConfig.callbackUrl = this.config.editorConfig.callbackUrl + "/" + id;
43
+          console.log(this.config,"OOOOOOOOOOOOOOOOOOOOOOOOOOO");
44
+
45
+          // this.config.callbackUrl = this.config.callbackUrl + `/${this.userId}`;
46
+          var docEditor = new DocsAPI.DocEditor("placeholder", this.config);
47
+        });
48
+    },
49
+    //初始化weosocket
50
+    initWebSocket() {
51
+      if (typeof WebSocket === "undefined") {
52
+        alert("您的浏览器不支持WebSocket");
53
+        return false;
54
+      }
55
+      const wsuri = `ws://121.40.189.20:9090/api/websocket/${this.userId}`; // websocket地址
56
+      this.websock = new WebSocket(wsuri);
57
+      this.websock.onopen = this.websocketonopen;
58
+      this.websock.onmessage = this.websocketonmessage;
59
+      this.websock.onerror = this.websocketonerror;
60
+      this.websock.onclose = this.websocketclose;
61
+    },
62
+    //连接成功
63
+    websocketonopen() {
64
+      console.log("WebSocket连接成功");
65
+    },
66
+    //接收后端返回的数据
67
+    websocketonmessage(e) {
68
+      let dataJson = e.data;
69
+      if (dataJson != "conn_success") {
70
+        dataJson = JSON.parse(dataJson);
71
+      }
72
+      if (dataJson.caseId) {
73
+        saveOnlyOfficeFile({
74
+          caseAppliId: Number(dataJson.caseId),
75
+          annexName: dataJson.fileName,
76
+          annexPath: dataJson.filePath,
77
+          onlyOfficeFileId: dataJson.fileId,
78
+        }).then((res) => {
79
+          this.websock.send();
80
+        });
81
+      }
82
+      // 在这里使用后端返回的数据,对数据进行处理渲染
83
+    },
84
+    //连接建立失败重连
85
+    websocketonerror(e) {
86
+      console.log(`连接失败的信息:`, e);
87
+      this.initWebSocket(); // 连接失败后尝试重新连接
88
+    },
89
+    //关闭连接
90
+    websocketclose(e) {
91
+      console.log("断开连接", e);
92
+    },
93
+    /**是否从视频会议跳转,是处理token */
94
+    async getToken() {
95
+      setToken(this.$route.query.token);
96
+    },
97
+  },
98
+  async mounted() {
99
+    if (this.$route.query.token) {
100
+      await this.getToken();
101
+    }
102
+    let id = this.$route.query.id;
103
+    this.flag = this.$route.query.flag;
104
+    this.getConfig(id);
105
+    this.initWebSocket();
106
+  },
107
+  watch: {},
108
+};
109
+</script>
110
+<style lang="scss" scoped></style>