Selaa lähdekoodia

onlyoffice在线编辑

hanchaobo 2 vuotta sitten
vanhempi
commit
9948c9ed04

+ 1118
- 0
public/api.js
File diff suppressed because it is too large
Näytä tiedosto


+ 1
- 0
public/index.html Näytä tiedosto

@@ -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,

+ 7
- 0
src/api/caseManagement/caseManagement.js Näytä tiedosto

@@ -239,3 +239,10 @@ export function secretaryRoleByUserId(query) {
239 239
     params: query
240 240
   })
241 241
 }
242
+// 获取证件类型
243
+export function getIdType() {
244
+  return request({
245
+    url: '/system/dict/data/type/id_type',
246
+    method: 'get',
247
+  })
248
+}

+ 7
- 0
src/api/login.js Näytä tiedosto

@@ -83,4 +83,11 @@ export function verifyUserName(data) {
83 83
 		method: 'get',
84 84
 		params:data
85 85
 	})
86
+}
87
+// 获取证件类型
88
+export function getIdType() {
89
+  return request({
90
+    url: '/system/dict/data/type/skipToken/id_type',
91
+    method: 'get',
92
+  })
86 93
 }

+ 20
- 0
src/api/onlyoffice/onlyoffice.js Näytä tiedosto

@@ -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 Näytä tiedosto

@@ -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 Näytä tiedosto

@@ -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

+ 5
- 0
src/store/modules/user.js Näytä tiedosto

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

+ 72
- 69
src/views/caseManagement/components/addCase.vue Näytä tiedosto

@@ -118,7 +118,7 @@
118 118
           <el-col :span="24" v-if="modelFlag && showmediate">
119 119
             <el-form-item label="调解书:">
120 120
               <div v-for="(item, index) in formData.caseAttachList" :key="index" v-if="item.annexType == 7">
121
-                <div style="color: blue; cursor: pointer" @click="fileDetil(item.annexPath)">
121
+                <div style="color: blue; cursor: pointer" @click="fileDetil(item.onlyOfficeFileId)">
122 122
                   {{ item.annexName }}
123 123
                 </div>
124 124
               </div>
@@ -205,30 +205,24 @@
205 205
     ]">
206 206
               <el-select v-model="formData.affiliate.idType" placeholder="证件类型" auto-complete="off" style="width: 100%;"
207 207
                 disabled>
208
-                <el-option v-for="item in idTypeList" :key="item.id" :label="item.value" :value="item.id">
208
+                <el-option v-for="item in idTypeList" :key="Number(item.dictValue)" :label="item.dictLabel" :value="Number(item.dictValue)">
209 209
 
210 210
                 </el-option>
211 211
               </el-select>
212 212
             </el-form-item>
213 213
           </el-col>
214
-          <el-col :span="12" v-if="formData.affiliate.organizeFlag == 0 && formData.affiliate.idType == 0">
215
-            <el-form-item label="申请人身份证号码" prop="affiliate.code" :rules="[
214
+          <el-col :span="12" v-if="formData.affiliate.organizeFlag == 0">
215
+            <el-form-item label="证号码" prop="affiliate.code" :rules="[
216 216
       {
217 217
         required: true,
218
-        message: '申请人身份证号不能为空',
219
-        trigger: 'blur',
220
-      },
221
-      {
222
-        pattern:
223
-          /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
224
-        message: '请输入正确的身份证号码',
218
+        message: '证件号码不能为空',
225 219
         trigger: 'blur',
226 220
       },
227 221
     ]">
228
-              <el-input v-model="formData.affiliate.code" disabled placeholder="请输入申请人的身份证号" />
222
+              <el-input v-model="formData.affiliate.code" disabled placeholder="请输入申请人的证件号码" />
229 223
             </el-form-item>
230 224
           </el-col>
231
-          <el-col :span="12" v-if="formData.affiliate.organizeFlag == 0 && formData.affiliate.idType == 1">
225
+          <!-- <el-col :span="12" v-if="formData.affiliate.organizeFlag == 0 && formData.affiliate.idType == 1">
232 226
             <el-form-item label="申请人护照号码" prop="affiliate.code" :rules="[
233 227
       {
234 228
         required: true,
@@ -238,7 +232,7 @@
238 232
     ]">
239 233
               <el-input v-model="formData.affiliate.code" disabled placeholder="请输入申请人的申请人护照号" />
240 234
             </el-form-item>
241
-          </el-col>
235
+          </el-col> -->
242 236
           <el-col :span="12" v-if="formData.affiliate.organizeFlag == 0">
243 237
             <el-form-item label="申请人邮箱" prop="affiliate.applicationEmail" :rules="[
244 238
       {
@@ -428,7 +422,7 @@
428 422
               <el-input v-model="formData.affiliate.respondentPhone" placeholder="请输入被申请人联系电话" />
429 423
             </el-form-item>
430 424
           </el-col>
431
-                    <el-col :span="12">
425
+          <el-col :span="12">
432 426
             <el-form-item label-width="150px" label="被申请人申请人住所" prop="affiliate.respondentHome" :rules="[
433 427
       {
434 428
         required: true,
@@ -457,43 +451,42 @@
457 451
             </el-form-item>
458 452
           </el-col>
459 453
         </el-row>
460
-              <el-col :span="12">
461
-                <el-form-item label-width="140px" label="被申请人身份证号" prop="affiliate.respondentIdentityNum" :rules="[
462
-          {
463
-            required: true,
464
-            message: '被申请人身份证号不能为空',
465
-            trigger: 'blur',
466
-          },
467
-          {
468
-            pattern:
469
-              /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
470
-            message: '请输入正确的身份证号码',
471
-            trigger: 'blur',
472
-          },
473
-        ]">
474
-              <el-input v-model="formData.affiliate.respondentIdentityNum" @blur="handleBlur"
475
-                placeholder="请输入被申请人身份证号" />
476
-            </el-form-item>
477
-            </el-col>
478
-                      <el-col :span="12">
479
-              <el-form-item label-width="140px" label="被申请人出生年月:" prop="affiliate.respondentBirth">
480
-                <el-date-picker disabled v-model="formData.affiliate.respondentBirth" type="date" placeholder="被申请人出生年月日">
481
-                </el-date-picker>
482
-              </el-form-item>
483
-            </el-col>
484
-                  <el-col :span="12">
485
-                    <el-form-item label="被申请人性别:" prop="affiliate.respondentSex" :rules="[
486
-              {
487
-                required: true,
488
-                message: '请选择性别',
489
-              },
490
-            ]">
491
-              <el-radio-group v-model="formData.affiliate.respondentSex" disabled>
492
-                <el-radio :label="0">男</el-radio>
493
-                <el-radio :label="1">女</el-radio>
494
-              </el-radio-group>
495
-            </el-form-item>
496
-          </el-col>
454
+        <el-col :span="12">
455
+          <el-form-item label-width="140px" label="被申请人身份证号" prop="affiliate.respondentIdentityNum" :rules="[
456
+      {
457
+        required: true,
458
+        message: '被申请人身份证号不能为空',
459
+        trigger: 'blur',
460
+      },
461
+      {
462
+        pattern:
463
+          /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
464
+        message: '请输入正确的身份证号码',
465
+        trigger: 'blur',
466
+      },
467
+    ]">
468
+            <el-input v-model="formData.affiliate.respondentIdentityNum" @blur="handleBlur" placeholder="请输入被申请人身份证号" />
469
+          </el-form-item>
470
+        </el-col>
471
+        <el-col :span="12">
472
+          <el-form-item label-width="140px" label="被申请人出生年月:" prop="affiliate.respondentBirth">
473
+            <el-date-picker disabled v-model="formData.affiliate.respondentBirth" type="date" placeholder="被申请人出生年月日">
474
+            </el-date-picker>
475
+          </el-form-item>
476
+        </el-col>
477
+        <el-col :span="12">
478
+          <el-form-item label="被申请人性别:" prop="affiliate.respondentSex" :rules="[
479
+      {
480
+        required: true,
481
+        message: '请选择性别',
482
+      },
483
+    ]">
484
+            <el-radio-group v-model="formData.affiliate.respondentSex" disabled>
485
+              <el-radio :label="0">男</el-radio>
486
+              <el-radio :label="1">女</el-radio>
487
+            </el-radio-group>
488
+          </el-form-item>
489
+        </el-col>
497 490
         <el-col :span="24" v-if="modelFlag">
498 491
           <el-form-item v-for="item in formData.columnValueList" :label="item.name" :key="item.id">
499 492
             <el-input type="textarea" v-model="item.value"></el-input>
@@ -534,7 +527,8 @@ import {
534 527
   caseApplicationSelectById,
535 528
   updateComfire,
536 529
   getInfoByIdCard,
537
-  getUserInfo
530
+  getUserInfo,
531
+  getIdType
538 532
 } from "@/api/caseManagement/caseManagement.js";
539 533
 import { getTemplate } from "@/api/officialSeal/officialSeal.js";
540 534
 import { getToken } from "@/utils/auth";
@@ -547,7 +541,7 @@ export default {
547 541
     "tabFlag",
548 542
     "addModifyData",
549 543
   ],
550
-  dicts: ["case_built_type"],
544
+  // dicts: ["id_type"],
551 545
   data() {
552 546
     return {
553 547
       activeName: "first",
@@ -590,14 +584,14 @@ export default {
590 584
         }
591 585
       ],
592 586
       idTypeList: [
593
-        {
594
-          value: '身份证',
595
-          id: 0
596
-        },
597
-        {
598
-          value: '护照',
599
-          id: 1
600
-        }
587
+        // {
588
+        //   value: '身份证',
589
+        //   id: 0
590
+        // },
591
+        // {
592
+        //   value: '护照',
593
+        //   id: 1
594
+        // }
601 595
       ]
602 596
     };
603 597
   },
@@ -618,7 +612,7 @@ export default {
618 612
         this.buttonFlag = false;
619 613
       }
620 614
     },
621
-    addVisable(val) {
615
+    async addVisable(val) {
622 616
       if (val) {
623 617
         if (this.addModifyData == 1) {
624 618
           this.formData = {
@@ -640,16 +634,23 @@ export default {
640 634
         this.showmediate = false;
641 635
         this.getTemplateFn();
642 636
         if (this.addModifyData != 1) {
643
-          this.caseApplicationSelectByIdFn(this.caseData.id);
637
+          await this.getIdTypeFn();
638
+          await this.caseApplicationSelectByIdFn(this.caseData.id);
644 639
         }
645 640
       }
646 641
     },
647 642
   },
648 643
   created() {
649
-    console.log(this.formData, "000000000000000000")
650 644
     // this.getUserInfoFn();
645
+    this.getIdTypeFn();
651 646
   },
652 647
   methods: {
648
+    /** 获取证件类型 */
649
+    getIdTypeFn(){
650
+      getIdType().then(res=>{
651
+        this.idTypeList = res.data;
652
+      })
653
+    },
653 654
     /** 切换申请类型 */
654 655
     changeApplyType(val) {
655 656
       console.log(val, "变化");
@@ -668,10 +669,10 @@ export default {
668 669
       })
669 670
     },
670 671
     /** 根据案件id获取对应信息 */
671
-    caseApplicationSelectByIdFn(data) {
672
+    async caseApplicationSelectByIdFn(data) {
672 673
       this.applicantEvidence = [];
673 674
       this.respondentEvidence = [];
674
-      caseApplicationSelectById({ id: data }).then((res) => {
675
+      await caseApplicationSelectById({ id: data }).then((res) => {
675 676
         res.data.affiliate.respondentSex = Number(res.data.affiliate.respondentSex)
676 677
         this.formData = res.data;
677 678
         this.formData.caseAttachList.forEach((item) => {
@@ -709,7 +710,8 @@ export default {
709 710
     },
710 711
     /** 查看证据 */
711 712
     fileDetil(val) {
712
-      window.open(this.fileURL + val);
713
+      // window.open(this.fileURL + val);
714
+      this.$router.push({ path: '/onlyoffice', query: { id: val, flag: 0 } })
713 715
     },
714 716
     /** 查看证据 */
715 717
     toPreview(val) {
@@ -895,7 +897,8 @@ export default {
895 897
   height: 700px !important;
896 898
   overflow: auto !important;
897 899
 }
898
-::v-deep .el-input--medium .el-input__inner{
900
+
901
+::v-deep .el-input--medium .el-input__inner {
899 902
   height: 40px;
900 903
   line-height: 40px;
901 904
 }

+ 4
- 3
src/views/caseManagement/components/mediation.vue Näytä tiedosto

@@ -81,7 +81,7 @@
81 81
         <el-col :span="24">
82 82
           <el-form-item label="调解书:" v-if="recordArrMediate.length > 0">
83 83
             <div v-for="(item, index) in recordArrMediate" :key="index" style="color: blue">
84
-              <a href="#" @click="toFileMediate(item.annexPath)">{{ item.annexName }}</a>
84
+              <a href="#" @click="toFileMediate(item.onlyOfficeFileId)">{{ item.annexName }}</a>
85 85
             </div>
86 86
           </el-form-item>
87 87
         </el-col>
@@ -289,8 +289,9 @@ export default {
289 289
     toFile2(annexPath) {
290 290
       window.open(window.location.origin + "/API" + annexPath, "_black");
291 291
     },
292
-    toFileMediate(annexPath) {
293
-      window.open(window.location.origin + "/API" + annexPath, "_black");
292
+    toFileMediate(val) {
293
+      // window.open(window.location.origin + "/API" + annexPath, "_black");
294
+      this.$router.push({ path: '/onlyoffice', query: {id:val,flag:1} })
294 295
     },
295 296
     /** 生成调解书 */
296 297
     mediationFn(data) {

+ 121
- 0
src/views/onlyoffice/onlyoffice.vue Näytä tiedosto

@@ -0,0 +1,121 @@
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 store from "@/store"
10
+import axios from 'axios'
11
+export default {
12
+    props: [],
13
+    data() {
14
+        return {
15
+            config: {},
16
+            flag: 0,
17
+            userId: store.getters.userId,
18
+            websock: null
19
+        };
20
+    },
21
+    destroyed() {
22
+        //页面销毁时关闭ws连接
23
+        if (this.websock) {
24
+            this.websock.close() // 关闭websocket
25
+        }
26
+    },
27
+    methods: {
28
+        getConfig(id) {
29
+            let edit = edit;
30
+            if (this.flag == 0) {
31
+                edit = 'view';
32
+            } else {
33
+                edit = 'edit'
34
+            }
35
+            axios.get(`http://121.40.189.20:9090/onlyOfficeConfig/${edit}/${id}/${this.userId}/desktop/true`).then(res => {
36
+                this.config = res.data;
37
+                // this.config.callbackUrl = this.config.callbackUrl + `/${this.userId}`;
38
+                console.log(res.data,"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO");
39
+                var docEditor = new DocsAPI.DocEditor("placeholder", this.config);
40
+            })
41
+        },
42
+        //初始化weosocket
43
+        initWebSocket() {
44
+            if (typeof (WebSocket) === "undefined") {
45
+                alert("您的浏览器不支持WebSocket")
46
+                return false
47
+            }
48
+            const wsuri = `ws://121.40.189.20:9090/api/websocket/${this.userId}` // websocket地址
49
+            this.websock = new WebSocket(wsuri)
50
+            this.websock.onopen = this.websocketonopen
51
+            this.websock.onmessage = this.websocketonmessage
52
+            this.websock.onerror = this.websocketonerror
53
+            this.websock.onclose = this.websocketclose
54
+        },
55
+        //连接成功
56
+        websocketonopen() {
57
+            console.log('WebSocket连接成功')
58
+        },
59
+        //接收后端返回的数据
60
+        websocketonmessage(e) {
61
+            let dataJson = e.data;
62
+            if (dataJson != "conn_success") {
63
+                dataJson = JSON.parse(dataJson);
64
+            }
65
+            if (dataJson.caseId) {
66
+                saveOnlyOfficeFile({
67
+                    caseAppliId: Number(dataJson.caseId),
68
+                    annexName: dataJson.fileName,
69
+                    annexPath: dataJson.filePath,
70
+                    onlyOfficeFileId: dataJson.fileId
71
+                }).then(res => {
72
+                    this.websock.send()
73
+                })
74
+            }
75
+            // 在这里使用后端返回的数据,对数据进行处理渲染
76
+        },
77
+        //连接建立失败重连
78
+        websocketonerror(e) {
79
+            console.log(`连接失败的信息:`, e)
80
+            this.initWebSocket() // 连接失败后尝试重新连接
81
+        },
82
+        //关闭连接
83
+        websocketclose(e) {
84
+            console.log('断开连接', e)
85
+        },
86
+        // 点击按钮
87
+        // btnClick() {
88
+        //     // 因为需求是每次点击都是发起不同ws连接,拿到的数据也不一致,所以连接前要先断开上次的连接
89
+        //     if (this.websock) {
90
+        //         this.websock.close() // 关闭websocket连接
91
+        //     }
92
+        //     this.initWebSocket() // 初始化weosocket,发起连接
93
+        //     // 这里使用定时器是为了等待连接后才发送数据,避免错误
94
+        //     setTimeout(() => {
95
+        //         //添加状态判断,当为OPEN时,前端发送消息给后端
96
+        //         if (this.websock.readyState === 1) {
97
+        //             // 把后台需要的参数数据传过去
98
+        //             let obj = {
99
+        //                 jobId: 111,
100
+        //                 token: 'xxxxx',
101
+        //                 message: 'send ok'
102
+        //             }
103
+        //             //发给后端的数据需要字符串化
104
+        //             this.websock.send(JSON.stringify(obj))
105
+        //         }
106
+        //     }, 500)
107
+        // }
108
+    },
109
+    mounted() {
110
+        let id = this.$route.query.id;
111
+        this.flag = this.$route.query.flag;
112
+        this.getConfig(id);
113
+        this.initWebSocket();
114
+        console.log(this.userId, "PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP");
115
+    },
116
+    watch: {
117
+
118
+    }
119
+};
120
+</script>
121
+<style lang="scss" scoped></style>

+ 10
- 10
src/views/register.vue Näytä tiedosto

@@ -30,7 +30,7 @@
30 30
       <el-form-item prop="idType">
31 31
         <el-select v-model="registerForm.idType" placeholder="证件类型" auto-complete="off" style="width: 100%;">
32 32
           <svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
33
-          <el-option v-for="item in idTypeList" :key="item.id" :label="item.value" :value="item.id">
33
+          <el-option v-for="item in idTypeList" :key="Number(item.dictValue)" :label="item.dictLabel" :value="Number(item.dictValue)">
34 34
 
35 35
           </el-option>
36 36
         </el-select>
@@ -105,7 +105,7 @@
105 105
 </template>
106 106
 
107 107
 <script>
108
-import { getCodeImg, register, sendCode, wxregister,verifyUserName } from "@/api/login";
108
+import { getCodeImg, register, sendCode, wxregister,verifyUserName,getIdType } from "@/api/login";
109 109
 import { listRoleNotoken } from "@/api/system/role.js"
110 110
 export default {
111 111
   name: "Register",
@@ -215,25 +215,25 @@ export default {
215 215
         }
216 216
       ],
217 217
       idTypeList:[
218
-      {
219
-          value:'身份证',
220
-          id:0
221
-        },
222
-        {
223
-          value:'护照',
224
-          id:1
225
-        }
218
+      
226 219
       ]
227 220
     };
228 221
   },
229 222
   created() {
230 223
     this.getCode();
231 224
     this.getListRole();
225
+    this.getIdTypeFn();
232 226
   },
233 227
   methods: {
234 228
     changeInput(){
235 229
       verifyUserName({userName:this.registerForm.userName})
236 230
     },
231
+    /** 获取证件类型 */
232
+    getIdTypeFn(){
233
+      getIdType().then(res=>{
234
+        this.idTypeList = res.data;
235
+      })
236
+    },
237 237
     /**获取角色 */
238 238
     getListRole() {
239 239
       listRoleNotoken().then(res => {