askbot-dragon 1.6.21-beta → 1.6.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -11
- package/public/index.html +9 -8
- package/src/assets/image/default_avt_ui.png +0 -0
- package/src/assets/image/filtType/audio.png +0 -0
- package/src/assets/image/filtType/excel1.png +0 -0
- package/src/assets/image/filtType/general.png +0 -0
- package/src/assets/image/filtType/image1.png +0 -0
- package/src/assets/image/filtType/link.png +0 -0
- package/src/assets/image/filtType/md2.png +0 -0
- package/src/assets/image/filtType/mode.png +0 -0
- package/src/assets/image/filtType/news.png +0 -0
- package/src/assets/image/filtType/pdf1.png +0 -0
- package/src/assets/image/filtType/ppt1.png +0 -0
- package/src/assets/image/filtType/selfadd1.png +0 -0
- package/src/assets/image/filtType/txt1.png +0 -0
- package/src/assets/image/filtType/video.png +0 -0
- package/src/assets/image/filtType/wechat.png +0 -0
- package/src/assets/image/filtType/word1.png +0 -0
- package/src/assets/image/loading.gif +0 -0
- package/src/assets/js/AliyunlssUtil.js +35 -10
- package/src/assets/js/common.js +241 -0
- package/src/components/ActionAlertIframe.vue +1 -0
- package/src/components/AiGuide.vue +7 -4
- package/src/components/AnswerDocknowledge.vue +930 -389
- package/src/components/ConversationContainer.vue +7111 -1058
- package/src/components/MyEditor.vue +342 -0
- package/src/components/QwFeedback.vue +303 -0
- package/src/components/actionSatisfaction.vue +2 -2
- package/src/components/actionSendToBot.vue +2 -2
- package/src/components/answerRadio.vue +145 -64
- package/src/components/askVideo.vue +3 -6
- package/src/components/assetDetails.vue +14 -6
- package/src/components/assetMessage.vue +14 -13
- package/src/components/associationIntention.vue +31 -6
- package/src/components/fielListView.vue +1 -1
- package/src/components/file/AliyunOssComponents.vue +1 -1
- package/src/components/formTemplate.vue +1590 -1674
- package/src/components/imgView.vue +32 -0
- package/src/components/intelligentSummary.vue +231 -0
- package/src/components/markDownText.vue +198 -0
- package/src/components/myPopup.vue +14 -11
- package/src/components/pagination.vue +129 -0
- package/src/components/pdfPosition.vue +112 -90
- package/src/components/popup.vue +8 -7
- package/src/components/preview/docView.vue +114 -0
- package/src/components/preview/excelView.vue +187 -0
- package/src/components/preview/newPositionPreview.vue +370 -0
- package/src/components/preview/pdfView.vue +824 -0
- package/src/components/previewDoc.vue +6 -0
- package/src/components/previewPdf.vue +963 -200
- package/src/components/receiverMessagePlatform.vue +25 -21
- package/src/components/recommend.vue +2 -2
- package/src/components/senderMessagePlatform.vue +21 -13
- package/src/components/tree.vue +116 -103
- package/src/components/utils/AliyunIssUtil.js +35 -13
- package/src/components/utils/ckeditor.js +64 -56
- package/src/components/welcomeKnowledgeFile.vue +344 -0
- package/src/components/welcomeLlmCard.vue +141 -0
- package/src/components/welcomeSuggest.vue +98 -0
- package/src/locales/cn.json +62 -0
- package/src/locales/en.json +62 -0
- package/src/main.js +19 -3
- package/vue.config.js +0 -1
- package/src/assets/js/obsBrowser.js +0 -63
- package/src/components/utils/ckeditorImageUpload/command.js +0 -112
- package/src/components/utils/ckeditorImageUpload/editing.js +0 -12
- package/src/components/utils/ckeditorImageUpload/plugin-image.js +0 -12
- package/src/components/utils/ckeditorImageUpload/toolbar-ui.js +0 -41
- package/src/components/utils/ckeditorfileUpload/common.js +0 -175
- package/src/components/utils/ckeditorfileUpload/editing.js +0 -12
- package/src/components/utils/ckeditorfileUpload/plugin_file.js +0 -12
- package/src/components/utils/ckeditorfileUpload/toolbar_ui.js +0 -35
|
@@ -1,37 +1,45 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="pdf_view"
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
</div>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
2
|
+
<div class="pdf_view" id="pdf_view">
|
|
3
|
+
<div class="change_scale" v-if="isPC">
|
|
4
|
+
<section @click="changeScale('reduce')">
|
|
5
|
+
<i class="el-icon-minus"></i>
|
|
6
|
+
</section>
|
|
7
|
+
<el-divider direction="vertical"></el-divider>
|
|
8
|
+
<section @click="changeScale('zoom')">
|
|
9
|
+
<i class="el-icon-plus"></i>
|
|
10
|
+
</section>
|
|
11
|
+
<el-select size="small" v-model="handScale" @change="changeScale" :placeholder="$t('dragonCommon.selectScale')">
|
|
12
|
+
<el-option v-for="item in scaleList" :key="item.value" :label="item.label" :value="item.value">
|
|
13
|
+
</el-option>
|
|
14
|
+
</el-select>
|
|
15
|
+
</div>
|
|
16
|
+
<div class="pdf_container_view" id="pdf_container_view" @scroll="pdfScroll" ref="pdfView"></div>
|
|
17
|
+
<div class="btn_footer" v-if="tagIds.length > 1 && !isPC">
|
|
18
|
+
<div class="prev" @click="prev">{{ $t('dragonCommon.previous') }}</div>
|
|
19
|
+
<div class="next" @click="next">{{ $t('dragonCommon.next') }}</div>
|
|
20
|
+
</div>
|
|
21
|
+
<div id="pagination" v-if="tagIds.length > 1 && isPC">
|
|
22
|
+
<el-pagination
|
|
23
|
+
:current-page="currentPage + 1"
|
|
24
|
+
@current-change="currentChange"
|
|
25
|
+
@prev-click="prev"
|
|
26
|
+
@next-click="next"
|
|
27
|
+
layout="slot, prev, pager, next"
|
|
28
|
+
:page-size="1"
|
|
29
|
+
:total="tagIds.length"
|
|
30
|
+
>
|
|
31
|
+
<span class="total-class">{{ $t('dragonCommon.answersGeneratedByPre') }}{{tagIds.length}}{{ $t('dragonCommon.answersGeneratedByAfter') }}</span>
|
|
32
|
+
</el-pagination>
|
|
33
|
+
</div>
|
|
30
34
|
</div>
|
|
31
35
|
</template>
|
|
32
|
-
|
|
33
36
|
<script>
|
|
37
|
+
// :style="{
|
|
38
|
+
// marginBottom: tagIds.length > 1 ? '60px' : '0px',
|
|
39
|
+
// height: setHeight
|
|
40
|
+
// }"
|
|
34
41
|
import _ from 'lodash'
|
|
42
|
+
import { newInitWaterMark } from "../assets/js/common";
|
|
35
43
|
// import * as pdfjsLib from 'pdfjs-dist'
|
|
36
44
|
// pdfjsLib.GlobalWorkerOptions.workerSrc = 'pdfjs-dist/build/pdf.worker';
|
|
37
45
|
// import { TextLayerBuilder } from "pdfjs-dist/web/pdf_viewer";
|
|
@@ -47,7 +55,7 @@ const { TextLayerBuilder } = window['pdfjs-dist/web/pdf_viewer']
|
|
|
47
55
|
// import { zoomElement } from '../assets/js/hammer'
|
|
48
56
|
export default {
|
|
49
57
|
name: 'pdfView',
|
|
50
|
-
props: ['tagIds', 'isMessageRecord'],
|
|
58
|
+
props: ['tagIds', 'isMessageRecord','textWatermarkStr'],
|
|
51
59
|
data () {
|
|
52
60
|
return {
|
|
53
61
|
url: '',
|
|
@@ -96,37 +104,7 @@ export default {
|
|
|
96
104
|
transformSalce: null,
|
|
97
105
|
isPC: false,
|
|
98
106
|
handScale: 'auto',
|
|
99
|
-
scaleList: [
|
|
100
|
-
{
|
|
101
|
-
label: '自动缩放',
|
|
102
|
-
value: 'auto'
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
label: '实际比例',
|
|
106
|
-
value: 'reality'
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
label: '100%',
|
|
110
|
-
value: 1
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
label: '120%',
|
|
114
|
-
value: 1.2
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
label: '150%',
|
|
118
|
-
value: 1.5
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
label: '170%',
|
|
122
|
-
value: 1.7
|
|
123
|
-
}
|
|
124
|
-
,
|
|
125
|
-
{
|
|
126
|
-
label: '200%',
|
|
127
|
-
value: 2
|
|
128
|
-
}
|
|
129
|
-
],
|
|
107
|
+
scaleList: [],
|
|
130
108
|
scrollTop: 0,
|
|
131
109
|
scrollLeft: 0
|
|
132
110
|
}
|
|
@@ -258,6 +236,9 @@ export default {
|
|
|
258
236
|
this.contentView.style.paddingBottom = '60px'
|
|
259
237
|
// contentView.style.overflowY = 'auto'
|
|
260
238
|
this.$refs.pdfView.appendChild(this.contentView);
|
|
239
|
+
if (this.textWatermarkStr){
|
|
240
|
+
newInitWaterMark('pdf_container_view',this.textWatermarkStr)
|
|
241
|
+
}
|
|
261
242
|
}
|
|
262
243
|
this.renderPages(pageIndex)
|
|
263
244
|
},
|
|
@@ -335,30 +316,32 @@ export default {
|
|
|
335
316
|
rectdom.style.top = 0
|
|
336
317
|
rectdom.style.left = 0
|
|
337
318
|
rectdom.classList.add('rectdom')
|
|
338
|
-
|
|
319
|
+
if (lines){
|
|
320
|
+
for (let index = 0; index < lines.length; index++) {
|
|
339
321
|
if (!/^\s+$/g.test(lines[index].content)) {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
}
|
|
357
|
-
// if(this.isPC) {
|
|
358
|
-
// rectdomTop = rectdomTop - 50 < 0 ? 0 : rectdomTop - 50
|
|
359
|
-
// }
|
|
322
|
+
let postionArr = lines[index].location
|
|
323
|
+
let div = document.createElement('div')
|
|
324
|
+
div.style.position = 'absolute';
|
|
325
|
+
div.style.left = postionArr[0] * this.scale + 'px',
|
|
326
|
+
// 后端返回的坐标有基线对齐的问题,top 值是后端算好(基线top - 文字高度),在此加上文字高度的 1/9 (大致比例)为实际展示出文字的top值
|
|
327
|
+
div.style.top = postionArr[1] * this.scale + 'px'
|
|
328
|
+
div.style.height = postionArr[3] * this.scale + 'px';
|
|
329
|
+
div.style.width = postionArr[2] * this.scale + 'px'
|
|
330
|
+
div.style.backgroundColor = 'rgba(54, 106, 255, 0.3)'
|
|
331
|
+
div.classList.add('lineHeight')
|
|
332
|
+
rectdom.appendChild(div)
|
|
333
|
+
if (index == 0 && j == 0) {
|
|
334
|
+
if (this.transformSalce !== null) {
|
|
335
|
+
rectdomTop = postionArr[1] * this.scale * this.transformSalce
|
|
336
|
+
} else {
|
|
337
|
+
rectdomTop = postionArr[1] * this.scale
|
|
360
338
|
}
|
|
339
|
+
// if(this.isPC) {
|
|
340
|
+
// rectdomTop = rectdomTop - 50 < 0 ? 0 : rectdomTop - 50
|
|
341
|
+
// }
|
|
342
|
+
}
|
|
361
343
|
}
|
|
344
|
+
}
|
|
362
345
|
}
|
|
363
346
|
if (rectdom.children.length > 0) {
|
|
364
347
|
pageDom.appendChild(rectdom)
|
|
@@ -444,7 +427,7 @@ export default {
|
|
|
444
427
|
endNum = startNum + Math.ceil(height / (that.pageSize.height + that.PAGE_INTVERVAL))
|
|
445
428
|
}
|
|
446
429
|
for (let pageIndex = startNum; pageIndex < endNum; pageIndex++) {
|
|
447
|
-
if (pageIndex > 0 && pageIndex
|
|
430
|
+
if (pageIndex > 0 && pageIndex <= that.pages.length) {
|
|
448
431
|
that.loadPdfData(pageIndex)
|
|
449
432
|
}
|
|
450
433
|
}
|
|
@@ -548,7 +531,7 @@ export default {
|
|
|
548
531
|
this.currentPage = 0
|
|
549
532
|
if (!this.isPC) {
|
|
550
533
|
this.$toast({
|
|
551
|
-
message: '
|
|
534
|
+
message: this.$t('dragonCommon.firstParagraph'),
|
|
552
535
|
duration: 2000,
|
|
553
536
|
})
|
|
554
537
|
return
|
|
@@ -567,7 +550,7 @@ export default {
|
|
|
567
550
|
this.currentPage = this.tagIds.length - 1
|
|
568
551
|
if (!this.isPC) {
|
|
569
552
|
this.$toast({
|
|
570
|
-
message: '
|
|
553
|
+
message: this.$t('dragonCommon.lastParagraph'),
|
|
571
554
|
duration: 2000,
|
|
572
555
|
})
|
|
573
556
|
return
|
|
@@ -864,6 +847,7 @@ export default {
|
|
|
864
847
|
// 在 pdf_view 下创建 所有canvs的容器
|
|
865
848
|
this.contentView = document.createElement('div')
|
|
866
849
|
this.contentView.style.transformOrigin = '0px 0px 0px'
|
|
850
|
+
this.contentView.setAttribute('id','contentView');
|
|
867
851
|
this.$http.get('/knowledge-api/knowledge/knowledge-part-location-info/list?ids=' + value.join(',')).then(res => {
|
|
868
852
|
// res.data = {"data":[{"id":"64591b7d8bb8ab1b91c65f24","knowledgeId":"64591a9c8da27649473f3b4b","mainId":"fb348d095c0b4fd7bbd37826563dac7d","page":3,"total":18,"pageHeight":540.0,"pageWidth":960.00946,"publicPageFileUrl":"https://askbot-pdf-all.oss-cn-zhangjiakou.aliyuncs.com/fb348d095c0b4fd7bbd37826563dac7d/2023/05/08/11/55/18/64591b638bb8ab1b91c65eed/3.pdf","extractInfo":{"location":[280.488,161.32,398.71573,61.99298],"content":"黄花城水长城旅游区位于北京市怀柔区九渡河镇境内,距北京市区65公里,是以奇而著称,融山川、碧水、古长城为一体的旅游休闲胜地。而这里的“三绝景”更是引人入","lines":[{"content":"黄花城水长城旅游区位于北京市怀柔区九渡河镇境内,距","location":[280.488,161.32,398.71573,15.9869995]},{"content":"北京市区65公里,是以奇而著称,融山川、碧水、古长","location":[283.691,184.30899,392.3055,15.9869995]},{"content":"城为一体的旅游休闲胜地。而这里的“三绝景”更是引人入","location":[282.699,207.32599,394.3033,15.9869995]}],"tagId":null}}],"code":"0","msg":null,"traceId":null}
|
|
869
853
|
// res.data = {"data":[{"id":"64590ce1eb1320043401cc90","knowledgeId":"64590cd5017b461d67e282e1","mainId":"fb348d095c0b4fd7bbd37826563dac7d","page":2,"total":5,"pageHeight":841.8898,"pageWidth":595.30396,"publicPageFileUrl":"https://askbot-pdf-all.oss-cn-zhangjiakou.aliyuncs.com/fb348d095c0b4fd7bbd37826563dac7d/2023/05/08/10/53/20/64590ce0eb1320043401cc7b/2.pdf","extractInfo":{"location":[89.32981,638.1907,415.15512,98.63251],"content":":北京地铁 13\r号线 :藤黄\r色 :西直门站—\r东直门站 :17 :41.\r5 :6\r准\rB :2002年\r09月\r28日 ","lines":[{"content":":北京地铁 13\r号线 ","location":[89.32981,638.1907,99.44599,98.63251]},{"content":":藤黄\r色 ","location":[188.7758,638.1907,46.79959,98.63251]},{"content":":西直门站—\r东直门站 ","location":[235.5754,638.1907,86.09996,98.63251]},{"content":":17 ","location":[321.67535,638.1907,36.200012,98.63251]},{"content":":41.\r5 ","location":[357.87537,638.1907,39.400696,98.63251]},{"content":":6\r准\rB ","location":[397.27606,638.1907,41.099,98.63251]},{"content":":2002年\r09月\r28日 ","location":[438.37506,638.1907,66.10986,98.63251]}],"tagId":null}}],"code":"0","msg":null,"traceId":null}
|
|
@@ -1030,9 +1014,9 @@ export default {
|
|
|
1030
1014
|
// tagIds 会按照gpt识别的生成有序的数组,前端直接按照下标的顺序取就可以了
|
|
1031
1015
|
// 缓存拿到的所有数据
|
|
1032
1016
|
this.cachePdf = res.data.data
|
|
1033
|
-
let publicPageFileUrl = res.data.data[0].publicPageFileUrl
|
|
1017
|
+
let publicPageFileUrl = res.data.data && res.data.data[0] ? res.data.data[0].publicPageFileUrl : ''
|
|
1034
1018
|
this.currentPage = 0
|
|
1035
|
-
if (publicPageFileUrl.substring(publicPageFileUrl.lastIndexOf('.')) === '.pdf') {
|
|
1019
|
+
if (publicPageFileUrl && publicPageFileUrl.substring(publicPageFileUrl.lastIndexOf('.')) === '.pdf') {
|
|
1036
1020
|
this.preViewType = 'pdf'
|
|
1037
1021
|
this.setPageAllLine(this.cachePdf)
|
|
1038
1022
|
this.getpdfResloutePage(res.data.data[0])
|
|
@@ -1074,7 +1058,7 @@ export default {
|
|
|
1074
1058
|
}
|
|
1075
1059
|
} else {
|
|
1076
1060
|
let div = document.createElement('div')
|
|
1077
|
-
div.innerText = '
|
|
1061
|
+
div.innerText = this.$t('dragonCommon.fileloadException')
|
|
1078
1062
|
this.contentView.appendChild(div)
|
|
1079
1063
|
this.$refs.pdfView.appendChild(this.contentView)
|
|
1080
1064
|
}
|
|
@@ -1086,6 +1070,38 @@ export default {
|
|
|
1086
1070
|
}
|
|
1087
1071
|
},
|
|
1088
1072
|
mounted () {
|
|
1073
|
+
this.$i18n.locale = sessionStorage.getItem("systemLanguage") || 'cn';
|
|
1074
|
+
this.scaleList = [
|
|
1075
|
+
{
|
|
1076
|
+
label: this.$t('dragonCommon.scaleAuto'),
|
|
1077
|
+
value: 'auto'
|
|
1078
|
+
},
|
|
1079
|
+
{
|
|
1080
|
+
label: this.$t('dragonCommon.scaleReality'),
|
|
1081
|
+
value: 'reality'
|
|
1082
|
+
},
|
|
1083
|
+
{
|
|
1084
|
+
label: '100%',
|
|
1085
|
+
value: 1
|
|
1086
|
+
},
|
|
1087
|
+
{
|
|
1088
|
+
label: '120%',
|
|
1089
|
+
value: 1.2
|
|
1090
|
+
},
|
|
1091
|
+
{
|
|
1092
|
+
label: '150%',
|
|
1093
|
+
value: 1.5
|
|
1094
|
+
},
|
|
1095
|
+
{
|
|
1096
|
+
label: '170%',
|
|
1097
|
+
value: 1.7
|
|
1098
|
+
}
|
|
1099
|
+
,
|
|
1100
|
+
{
|
|
1101
|
+
label: '200%',
|
|
1102
|
+
value: 2
|
|
1103
|
+
}
|
|
1104
|
+
]
|
|
1089
1105
|
if (/(iPhone|iPad|iPod|iOS|Android)/i.test(navigator.userAgent)) {
|
|
1090
1106
|
this.isPC = false
|
|
1091
1107
|
} else {
|
|
@@ -1098,12 +1114,12 @@ export default {
|
|
|
1098
1114
|
<style lang="less" scoped>
|
|
1099
1115
|
.pdf_view {
|
|
1100
1116
|
width: 100%;
|
|
1101
|
-
height: calc(100% - 110px);
|
|
1117
|
+
// height: calc(100% - 110px);
|
|
1118
|
+
height: 100%;
|
|
1102
1119
|
overflow: auto;
|
|
1103
1120
|
background-color: #f5f7fb;
|
|
1104
1121
|
// margin-bottom: 60px;
|
|
1105
1122
|
box-sizing: border-box;
|
|
1106
|
-
|
|
1107
1123
|
// position: relative;
|
|
1108
1124
|
// > div {
|
|
1109
1125
|
// width: 100%;
|
|
@@ -1292,6 +1308,12 @@ export default {
|
|
|
1292
1308
|
background: rgba(221, 222, 223, 1);
|
|
1293
1309
|
}
|
|
1294
1310
|
}
|
|
1311
|
+
.pdf_container_view{
|
|
1312
|
+
height: 100%;
|
|
1313
|
+
width: 100%;
|
|
1314
|
+
position: relative;
|
|
1315
|
+
overflow: auto;
|
|
1316
|
+
}
|
|
1295
1317
|
}
|
|
1296
1318
|
</style>
|
|
1297
1319
|
<style lang="less">
|
package/src/components/popup.vue
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="popUp">
|
|
3
3
|
<div class="topBtn">
|
|
4
|
-
<span class="cancel" @click="closeBtn"
|
|
5
|
-
<span class="sure" @click="sure"
|
|
4
|
+
<span class="cancel" @click="closeBtn">{{ $t('dragonCommon.cancel') }}</span>
|
|
5
|
+
<span class="sure" @click="sure">{{ $t('dragonCommon.confirm') }}</span>
|
|
6
6
|
</div>
|
|
7
7
|
<slot name="popup-header" class="popup-header"></slot>
|
|
8
8
|
<div class="popup-content">
|
|
9
9
|
<div
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
class="filter-item"
|
|
11
|
+
v-for="(item, index) in options"
|
|
12
|
+
:key="index"
|
|
13
|
+
@click="checked(item, index)"
|
|
14
14
|
>
|
|
15
|
-
<div :class="[checkIdList.includes(item[props.value]) && 'setColor', 'label']">{{item[props.label]}}</div>
|
|
15
|
+
<div :class="[checkIdList.includes(item[props.value]) && 'setColor', 'label']">{{ item[props.label] }}</div>
|
|
16
16
|
</div>
|
|
17
17
|
</div>
|
|
18
18
|
<div class="popup-footer">
|
|
@@ -164,6 +164,7 @@ export default {
|
|
|
164
164
|
},
|
|
165
165
|
},
|
|
166
166
|
mounted() {
|
|
167
|
+
this.$i18n.locale = sessionStorage.getItem("systemLanguage") || 'cn';
|
|
167
168
|
console.debug('options',this.options)
|
|
168
169
|
|
|
169
170
|
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="docView">
|
|
3
|
+
<div class="docHtml"
|
|
4
|
+
ref="docHtml"
|
|
5
|
+
v-html="html"
|
|
6
|
+
@click="selectDiv"
|
|
7
|
+
>
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
export default {
|
|
14
|
+
name: "docView",
|
|
15
|
+
data(){
|
|
16
|
+
return{
|
|
17
|
+
colors: ['#E3EBFF', '#FFF5DC', '#FFE8D8','#D6F3EA','#FFF1C3'],
|
|
18
|
+
html:"",
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
props:{
|
|
22
|
+
html_result:{
|
|
23
|
+
type:String,
|
|
24
|
+
default:""
|
|
25
|
+
},
|
|
26
|
+
split_paragraphs:{
|
|
27
|
+
type:Array,
|
|
28
|
+
default(){
|
|
29
|
+
return []
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
fileSuffix:{
|
|
33
|
+
type:String,
|
|
34
|
+
default:""
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
methods:{
|
|
38
|
+
selectDiv(e){
|
|
39
|
+
this.$emit('selectDiv',e)
|
|
40
|
+
},
|
|
41
|
+
getHtml(){
|
|
42
|
+
// let url = 'https://guoranwisdom.oss-cn-zhangjiakou.aliyuncs.com/123/2024/12/09/14/18/17/123/%E5%85%AC%E5%8F%B8%E5%91%98%E5%B7%A5%E6%89%8B%E5%86%8C_1733725097.html'
|
|
43
|
+
let url = this.html_result
|
|
44
|
+
this.$http.get(url).then(res => {
|
|
45
|
+
this.html = res.data;
|
|
46
|
+
let drawer = document.getElementById('drawer_content_pre')
|
|
47
|
+
if (drawer){
|
|
48
|
+
drawer.style.backgroundImage = 'none';
|
|
49
|
+
drawer.style.overflowX = 'hidden'
|
|
50
|
+
}
|
|
51
|
+
this.$nextTick(() => {
|
|
52
|
+
this.setColor()
|
|
53
|
+
})
|
|
54
|
+
})
|
|
55
|
+
},
|
|
56
|
+
setColor(){
|
|
57
|
+
this.split_paragraphs.forEach((item,index) => {
|
|
58
|
+
const colorIndex = index % this.colors.length;
|
|
59
|
+
if (item.original_paragraph){
|
|
60
|
+
item.original_paragraph.forEach(items => {
|
|
61
|
+
let dom = document.getElementById(items.paragraph_id);
|
|
62
|
+
if (this.fileSuffix === 'TXT'){
|
|
63
|
+
const paragraphs = this.$el.querySelectorAll(`[paragraph-id="${items.paragraph_id}"]`);
|
|
64
|
+
paragraphs.forEach(paragraph => {
|
|
65
|
+
paragraph.style.background = this.colors[colorIndex]
|
|
66
|
+
})
|
|
67
|
+
} else if (dom){
|
|
68
|
+
dom.style.background = this.colors[colorIndex];
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
let newOriginal = item.original_paragraph.filter(items => !items.type)
|
|
72
|
+
let dom = document.getElementById(newOriginal[newOriginal.length - 1].paragraph_id);
|
|
73
|
+
if (dom){
|
|
74
|
+
dom.style.marginBottom = '8px';
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (item.tableId){
|
|
78
|
+
let dom = document.getElementById(item.tableId);
|
|
79
|
+
if (dom){
|
|
80
|
+
dom.style.backgroundColor = this.colors[colorIndex]
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
setTimeout(() => {
|
|
85
|
+
this.$parent.scrollToParagraph('first')
|
|
86
|
+
},500)
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
watch:{
|
|
90
|
+
html_result:{
|
|
91
|
+
handler(){
|
|
92
|
+
if (this.html_result){
|
|
93
|
+
this.getHtml();
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
immediate:true
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
</script>
|
|
101
|
+
|
|
102
|
+
<style scoped lang="less">
|
|
103
|
+
.docView{
|
|
104
|
+
width: 100%;
|
|
105
|
+
flex: none;
|
|
106
|
+
box-sizing: border-box;
|
|
107
|
+
div{
|
|
108
|
+
position: relative;
|
|
109
|
+
}
|
|
110
|
+
/deep/img{
|
|
111
|
+
max-width: 100%;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
</style>
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="excelView">
|
|
3
|
+
<table border="1" v-if="false">
|
|
4
|
+
<thead>
|
|
5
|
+
<tr>
|
|
6
|
+
<th v-for="(person2,index2) in headerArray" :key="index2">{{person2}}</th>
|
|
7
|
+
</tr>
|
|
8
|
+
</thead>
|
|
9
|
+
<tbody>
|
|
10
|
+
<tr v-for="(person, index) in rowDataList" :key="index" :id="person.id">
|
|
11
|
+
<td v-for="(person2,index2) in headerArray" :key="index2">
|
|
12
|
+
{{person[person2]}}
|
|
13
|
+
</td>
|
|
14
|
+
</tr>
|
|
15
|
+
</tbody>
|
|
16
|
+
</table>
|
|
17
|
+
<el-table
|
|
18
|
+
:data="pagedData"
|
|
19
|
+
border
|
|
20
|
+
ref="table"
|
|
21
|
+
:row-key="getRowKey"
|
|
22
|
+
:row-class-name="tableRowClassName"
|
|
23
|
+
height="100%"
|
|
24
|
+
style="width: 100%">
|
|
25
|
+
<template v-for="(item,index) in headerArray">
|
|
26
|
+
<el-table-column
|
|
27
|
+
:label="item"
|
|
28
|
+
:key="index"
|
|
29
|
+
min-width="100">
|
|
30
|
+
<template slot-scope="scope">
|
|
31
|
+
{{scope.row[item]}}
|
|
32
|
+
</template>
|
|
33
|
+
</el-table-column>
|
|
34
|
+
</template>
|
|
35
|
+
</el-table>
|
|
36
|
+
<pagination-page :pageSize="pageSize" :currentPage="currentPage" :total="rowDataList.length" @currentChange="handleCurrentChange"></pagination-page>
|
|
37
|
+
</div>
|
|
38
|
+
</template>
|
|
39
|
+
|
|
40
|
+
<script>
|
|
41
|
+
|
|
42
|
+
import PaginationPage from "../pagination";
|
|
43
|
+
export default {
|
|
44
|
+
name: "excelView",
|
|
45
|
+
components: { PaginationPage },
|
|
46
|
+
data(){
|
|
47
|
+
return{
|
|
48
|
+
rowData:[
|
|
49
|
+
{
|
|
50
|
+
"row_id": "659164be-19bd-4fd7-a47d-b04c3dbbfa6f",
|
|
51
|
+
"row_data_md": "| 王明宇 | 27 | 189 |",
|
|
52
|
+
"row_number": 2,
|
|
53
|
+
"table_html": "<table border='1' style='border-collapse:collapse;'><thead><tr><th>姓名1</th><th>年龄</th><th>身高</th></tr></thead><tbody><tr><td>王明宇</td><td>27</td><td>189</td></tr></tbody></table>"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"row_id": "fac98d6a-2580-4f62-8f50-61521debeeef",
|
|
57
|
+
"row_data_md": "| 老王 | 38 | 178 |",
|
|
58
|
+
"row_number": 3,
|
|
59
|
+
"table_html": "<table border='1' style='border-collapse:collapse;'><thead><tr><th>姓名1</th><th>年龄</th><th>身高</th></tr></thead><tbody><tr><td>老王</td><td>38</td><td>178</td></tr></tbody></table>"
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
rowDataList:[],
|
|
63
|
+
headerArray:[],
|
|
64
|
+
currentPage:1,
|
|
65
|
+
pageSize:20,
|
|
66
|
+
colors: ['#E3EBFF', '#FFF5DC', '#FFE8D8','#D6F3EA','#FFF1C3'],
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
props:{
|
|
70
|
+
headerData:{
|
|
71
|
+
type:String,
|
|
72
|
+
default:""
|
|
73
|
+
},
|
|
74
|
+
excelRowList:{
|
|
75
|
+
type:Array,
|
|
76
|
+
default(){
|
|
77
|
+
return []
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
tableChunkData:{
|
|
81
|
+
type:Array,
|
|
82
|
+
default(){
|
|
83
|
+
return [{
|
|
84
|
+
"sheet_name": null,
|
|
85
|
+
"table_md": null,
|
|
86
|
+
"tableChunkText": "| 序号 | 电子色片 | 旧色号 | 颜色名称 | R68-Y32 17w77b06c L32-1 | 新 | 色卡页码 | -ICN色号 | R | G | B | C | M | Y | | 154 | 22 | B99-G01 81w11b08c L88-4 | OW060-4 | | 雪蓝 | 蓝色系 | 210 | 218 | 223 | 5.5761039841401502E-2 | 2.08606534553369E-2 | 0 | 0.12603452469972801 |",
|
|
87
|
+
"tableChunkId": "5e80ff30-ea7e-4c47-878b-59d9b1c833ce",
|
|
88
|
+
"tableId": null
|
|
89
|
+
}]
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
computed:{
|
|
94
|
+
pagedData() {
|
|
95
|
+
const start = (this.currentPage - 1) * this.pageSize;
|
|
96
|
+
const end = start + this.pageSize;
|
|
97
|
+
return this.rowDataList.slice(start, end);
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
methods:{
|
|
101
|
+
tableRowData(){
|
|
102
|
+
const headerString = this.headerData.trim().replace(/^\||\|$/g, '');
|
|
103
|
+
|
|
104
|
+
// 使用竖线作为分隔符来分割字符串
|
|
105
|
+
const headerArray = headerString.split('|').map(item => item.trim());
|
|
106
|
+
this.headerArray = headerArray
|
|
107
|
+
for (let i =0;i<this.excelRowList.length;i++){
|
|
108
|
+
// 去除字符串两端的竖线(如果它们存在的话)
|
|
109
|
+
const trimmedString = this.excelRowList[i].row_data_md.trim().replace(/^\||\|$/g, '');
|
|
110
|
+
|
|
111
|
+
// 使用竖线作为分隔符来分割字符串
|
|
112
|
+
const resultArray = trimmedString.split('|').map(item => item.trim());
|
|
113
|
+
let obj = {}
|
|
114
|
+
for (let j=0;j<headerArray.length;j++){
|
|
115
|
+
this.$set(obj,headerArray[j],resultArray[j])
|
|
116
|
+
this.$set(obj,'id',this.excelRowList[i].row_id)
|
|
117
|
+
}
|
|
118
|
+
this.rowDataList.push(obj);
|
|
119
|
+
}
|
|
120
|
+
this.$nextTick(() => {
|
|
121
|
+
this.setRowColor('first');
|
|
122
|
+
})
|
|
123
|
+
},
|
|
124
|
+
getRowKey(row){
|
|
125
|
+
return row.id
|
|
126
|
+
},
|
|
127
|
+
setRowColor(type){
|
|
128
|
+
this.tableChunkData.forEach((item,index) => {
|
|
129
|
+
const colorIndex = index % this.colors.length;
|
|
130
|
+
let id = item.tableChunkId;
|
|
131
|
+
let dom = document.getElementsByClassName('setBgClass' + id);
|
|
132
|
+
if (dom && dom.length > 0){
|
|
133
|
+
let newDom = Array.from(dom)
|
|
134
|
+
newDom.forEach(doms => {
|
|
135
|
+
doms.style.backgroundColor = this.colors[colorIndex];
|
|
136
|
+
})
|
|
137
|
+
}
|
|
138
|
+
})
|
|
139
|
+
if (this.tableChunkData.length > 0 && type === 'first'){
|
|
140
|
+
this.scrollToRow(this.tableChunkData[0].tableChunkId)
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
tableRowClassName({ row }){
|
|
144
|
+
let id = this.tableChunkData.filter(item => item.tableChunkId == row.id);
|
|
145
|
+
if (id && id.length > 0){
|
|
146
|
+
return 'setBgClass' + id[0].tableChunkId
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
scrollToRow(rowId) {
|
|
150
|
+
this.$nextTick(() => {
|
|
151
|
+
// const row = this.rowDataList.find(row => row.id === rowId);
|
|
152
|
+
const rowIndex = this.rowDataList.findIndex(row => row.id === rowId);
|
|
153
|
+
let index = Math.ceil(rowIndex / 20)
|
|
154
|
+
this.currentPage = index;
|
|
155
|
+
setTimeout(() => {
|
|
156
|
+
let dom = document.getElementsByClassName('setBgClass' + rowId);
|
|
157
|
+
if (dom && dom.length > 0){
|
|
158
|
+
let newDom = Array.from(dom)
|
|
159
|
+
newDom.forEach(doms => {
|
|
160
|
+
doms.style.backgroundColor = this.colors[0];
|
|
161
|
+
})
|
|
162
|
+
newDom[0].scrollIntoView({ behavior: "smooth"})
|
|
163
|
+
}
|
|
164
|
+
},500)
|
|
165
|
+
});
|
|
166
|
+
},
|
|
167
|
+
handleCurrentChange(val){
|
|
168
|
+
this.currentPage = val;
|
|
169
|
+
this.$nextTick(() => {
|
|
170
|
+
this.setRowColor();
|
|
171
|
+
})
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
mounted() {
|
|
175
|
+
this.tableRowData();
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
</script>
|
|
179
|
+
|
|
180
|
+
<style scoped lang="less">
|
|
181
|
+
.excelView{
|
|
182
|
+
height: 100%;
|
|
183
|
+
/deep/.setBgClass{
|
|
184
|
+
background-color: #E3EBFF!important;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
</style>
|