Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dwsproject
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dws
dwsproject
Commits
a7b9201d
Commit
a7b9201d
authored
Nov 23, 2024
by
夏超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[fix] 修改问题
parent
a09e3eee
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
0 deletions
+60
-0
jzjx_project/static/src/js/roke_craft_design.js
+60
-0
No files found.
jzjx_project/static/src/js/roke_craft_design.js
View file @
a7b9201d
...
...
@@ -4,6 +4,7 @@ odoo.define('jzjx_project.roke_craft_design', function (require) {
var
core
=
require
(
'web.core'
);
var
session
=
require
(
'web.session'
);
var
AbstractAction
=
require
(
'web.AbstractAction'
);
const
Dialog
=
require
(
"web.Dialog"
);
var
RokeCraftDesign
=
AbstractAction
.
extend
({
template
:
'jzjx_project.roke_craft_design'
,
...
...
@@ -11,6 +12,65 @@ odoo.define('jzjx_project.roke_craft_design', function (require) {
init
:
function
(
parent
,
action
,
params
)
{
this
.
action_controller
=
`
${
action
.
params
.
controller
}
&user_id=
${
session
.
uid
}
`
;
return
this
.
_super
.
apply
(
this
,
arguments
);
},
start
:
async
function
()
{
await
this
.
_super
(...
arguments
);
let
self
=
this
;
window
.
addEventListener
(
"message"
,
function
(
event
)
{
if
(
event
.
data
&&
event
.
data
.
method
===
"XFilePreview"
)
{
return
self
.
_rpc
({
model
:
"documents.document"
,
method
:
"preview_attachment_url"
,
args
:
[
event
.
data
.
doc_id
],
}).
then
(
async
(
result
)
=>
{
const
{
code
,
message
,
data
}
=
result
;
console
.
log
(
"result"
,
result
)
;
if
(
code
===
1
)
{
return
}
if
(
data
.
extra
)
{
let
preview
=
data
.
url
;
self
.
_openPreviewInDialog
(
preview
);
return
}
return
self
.
_rpc
({
model
:
"ir.config_parameter"
,
method
:
"get_param"
,
args
:
[
"kkfileview.url"
],
}).
then
((
preview_service
)
=>
{
console
.
log
(
"preview_service"
,
preview_service
)
console
.
log
(
"xxx"
,
session
[
"web.base.url"
])
console
.
log
(
"data.url"
,
data
.
url
)
let
url
=
`
${
session
[
"web.base.url"
]}${
data
.
url
}
`
;
if
(
preview_service
)
{
let
preview
=
`
${
preview_service
}
/onlinePreview?url=
${
encodeURIComponent
(
Base64
.
encode
(
url
))}
`
self
.
_openPreviewInDialog
(
preview
);
}
else
{
self
.
do_notify
(
"无法预览文件"
,
"没有找到预览服务器的相关配置。请到设置-常规设置-预览服务中设置 Server URL。"
);
}
})
});
}
});
},
_openPreviewInDialog
(
preview
)
{
let
dialog
=
new
Dialog
(
this
,
{
title
:
'文档预览'
,
size
:
'large'
,
renderFooter
:
false
,
$content
:
$
(
'<div>'
,
{
html
:
`
<iframe src="
${
preview
}
" width="100%" height="600px" scrolling="yes" frameborder="0"></iframe>
`
,
}),
});
dialog
.
open
();
}
});
...
...
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