Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
vue-gjjs
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fukai
vue-gjjs
Commits
5ca35fda
Commit
5ca35fda
authored
Mar 31, 2023
by
李少勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
配合联调报文面函的word文件预览问题
parent
95137887
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
53 deletions
+41
-53
package-lock.json
package-lock.json
+0
-0
index.vue
src/components/business/docpan/views/index.vue
+0
-0
Show.vue
src/views/Docpan/Show.vue
+41
-53
No files found.
package-lock.json
View file @
5ca35fda
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/components/business/docpan/views/index.vue
View file @
5ca35fda
This diff is collapsed.
Click to expand it.
src/views/Docpan/Show.vue
View file @
5ca35fda
<
template
>
<div>
<div
style=
"height: 800px; overflow: auto"
>
<embed
v-if=
"this.model.docXML && pdf"
:src=
"pdf"
type=
"application/pdf"
height=
"100%"
width=
"100%"
/>
<c-row
v-if=
"!this.model.docXML"
>
<c-col
v-for=
"(item, index) in model.docTXT"
:key=
"index"
>
<c-col
:offset=
"4"
:span=
"8"
>
{{
item
[
0
]
}}
</c-col>
<c-col
:span=
"12"
>
{{
item
[
1
]
}}
</c-col>
</c-col>
</c-row>
</div>
</div>
<div
class=
"width: 100%;height: 100vh;overflow: auto;"
ref=
"file"
></div>
</
template
>
<
script
>
import
{
getPdf
}
from
"~/service/business/file"
;
import
{
renderAsync
}
from
'docx-preview'
;
import
Api
from
'~/service/Api'
;
import
commonProcess
from
'~/mixin/commonProcess'
;
export
default
{
data
()
{
return
{
model
:
{
docXML
:
""
},
pdf
:
""
,
};
},
created
()
{
let
doclang
=
window
.
sessionStorage
.
doclang
||
""
;
this
.
model
.
docXML
=
window
.
sessionStorage
.
docXML
;
this
.
model
.
docTXT
=
window
.
sessionStorage
.
docTXT
.
split
(
"
\
r
\
n"
)
.
filter
((
item
)
=>
item
)
.
map
((
item
)
=>
{
let
idx
=
item
.
indexOf
(
":"
);
return
[
item
.
substring
(
0
,
idx
).
trim
(),
item
.
substring
(
idx
+
1
).
trim
(),
];
});
if
(
this
.
model
.
docXML
!=
""
)
getPdf
({
xml
:
this
.
model
.
docXML
,
doclang
:
window
.
sessionStorage
.
docuil
}).
then
((
res
)
=>
{
if
(
res
.
respCode
==
SUCCESS
)
{
this
.
pdf
=
"data:application/pdf;base64,"
+
res
.
data
;
}
});
},
data
()
{
return
{
model
:
{
docXML
:
''
},
pdf
:
''
,
};
},
mixins
:
[
commonProcess
],
mounted
()
{
this
.
loadWordBlob
()
},
methods
:
{
async
loadWordBlob
()
{
let
routeQuery
=
this
.
$route
.
query
const
params
=
{
index
:
routeQuery
.
idx
,
};
let
res
=
await
Api
.
post
(
'/service/gitopn/executeDocpan'
,
this
.
wrapper
(
params
));
if
(
res
.
respCode
==
SUCCESS
)
{
let
base64Str
=
res
.
data
.
executeDocpan
;
let
bstr
=
window
.
atob
(
base64Str
);
// 解码 base-64 编码的字符串,base-64 编码使用方法是 btoa()
let
length
=
bstr
.
length
;
let
u8arr
=
new
Uint8Array
(
length
);
// 创建初始化为0的,包含length个元素的无符号整型数组
while
(
length
--
)
{
u8arr
[
length
]
=
bstr
.
charCodeAt
(
length
);
// 返回在指定的位置的字符的 Unicode 编码
}
let
blob
=
new
Blob
([
u8arr
]);
renderAsync
(
blob
,
this
.
$refs
.
file
)
}
}
}
};
</
script
>
<
style
scoped
>
</
style
>
\ No newline at end of file
::v-deep
.docx-wrapper
{
width
:
100%
;
height
:
100vh
;
padding
:
0
;
overflow
:
auto
;
}
</
style
>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment