Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivWeb
Project
Project
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
ReactWeb5
CivWeb
Commits
2f452290
Commit
2f452290
authored
1 year ago
by
周宏民
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: BI添加跳转
parent
579f0834
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
0 deletions
+58
-0
TabWidget.js
src/pages/system/iframe/TabWidget.js
+58
-0
No files found.
src/pages/system/iframe/TabWidget.js
View file @
2f452290
/*
* @Title:
* @Author: hongmye
* @Date: 2023-01-10 11:18:55
*/
import
React
,
{
memo
,
useEffect
,
useRef
}
from
'react'
;
import
{
FullscreenExitOutlined
,
FullscreenOutlined
}
from
'@ant-design/icons'
;
import
Iframe
from
'react-iframe'
;
...
...
@@ -13,6 +18,59 @@ const TabWidget = props => {
const
{
linkUrl
,
fullscreen
}
=
params
;
const
[
ref
,
isFullscreen
,
handleFullScreen
,
handleExitFullScreen
]
=
useFullScreen
(
fullscreen
);
const
goToPath
=
(
name
,
data
,
widgetId
)
=>
{
try
{
const
routes
=
window
.
globalConfig
?.
allWidgets
||
[];
let
info
=
null
;
// eslint-disable-next-line no-inner-declarations
function
urlSearch
(
arr
)
{
arr
.
forEach
(
a
=>
{
if
(
a
.
label
)
{
if
(
a
.
label
===
name
)
{
info
=
JSON
.
parse
(
JSON
.
stringify
(
a
));
}
}
if
(
a
.
widgets
)
{
urlSearch
(
a
.
widgets
);
}
});
}
urlSearch
(
routes
);
if
(
!
info
)
return
info
;
info
.
url
=
info
.
url
.
substr
(
0
,
1
)
===
'/'
?
info
.
url
:
`/
${
info
.
url
}
`
;
let
url
=
`/civbase/
${
info
.
product
}${
info
.
url
}
`
;
const
arr
=
url
.
split
(
'|'
);
let
paramsData
=
{};
// eslint-disable-next-line prefer-destructuring
url
=
arr
[
0
];
if
(
arr
[
1
])
{
url
+=
encodeURI
(
`|
${
arr
[
1
]}
`
);
const
arrObj
=
arr
[
1
].
split
(
'&'
);
arrObj
.
forEach
(
item
=>
{
const
temp
=
item
.
split
(
'='
);
// eslint-disable-next-line prefer-destructuring
paramsData
[
temp
[
0
]]
=
temp
[
1
];
});
}
paramsData
=
{
...
paramsData
,
...
data
,
refresh
:
true
};
paramsData
.
widget
=
widgetId
||
paramsData
.
widget
;
console
.
log
(
paramsData
,
url
);
window
.
history
.
pushState
(
paramsData
,
''
,
url
);
}
catch
(
error
)
{
console
.
log
(
'🚀 ~ error:'
,
error
);
}
};
const
onMessage
=
e
=>
{
if
(
e
?.
data
?.
name
)
{
goToPath
(
e
?.
data
?.
name
);
}
};
useEffect
(()
=>
{
window
.
addEventListener
(
'message'
,
onMessage
);
return
()
=>
{
window
.
removeEventListener
(
'message'
,
onMessage
);
};
},
[
onMessage
]);
return
(
<
div
className
=
{
styles
[
'tab-iframe'
]}
ref
=
{
ref
}
>
<
div
className
=
{
styles
[
'oper-wrap'
]}
>
...
...
This diff is collapsed.
Click to expand it.
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