Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
szse
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
zhaochengxiang
szse
Commits
bc422663
Commit
bc422663
authored
Aug 04, 2023
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
报表动态
parent
628bb300
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
157 additions
and
92 deletions
+157
-92
assetmanage.js
src/model/assetmanage.js
+17
-0
dataassetmanager.js
src/service/dataassetmanager.js
+17
-0
AssetTable.jsx
src/view/Manage/AssetManage/Component/AssetTable.jsx
+61
-51
WorkbookDrawer.jsx
src/view/Manage/AssetManage/Component/WorkbookDrawer.jsx
+6
-8
WorksheetModal.jsx
src/view/Manage/AssetManage/Component/WorksheetModal.jsx
+56
-33
No files found.
src/model/assetmanage.js
View file @
bc422663
...
@@ -275,4 +275,20 @@ export function* getDirectoryChild(payload) {
...
@@ -275,4 +275,20 @@ export function* getDirectoryChild(payload) {
export
function
*
queryCustomTypeRootDirectory
()
{
export
function
*
queryCustomTypeRootDirectory
()
{
return
yield
call
(
service
.
queryCustomTypeRootDirectory
);
return
yield
call
(
service
.
queryCustomTypeRootDirectory
);
}
export
function
*
listSupportReportTypes
()
{
return
yield
call
(
service
.
listSupportReportTypes
)
}
export
function
*
listWorkbooksByType
(
payload
)
{
return
yield
call
(
service
.
listWorkbooksByType
,
payload
)
}
export
function
*
getViewUrlByWorkbookId
(
payload
)
{
return
yield
call
(
service
.
getViewUrlByWorkbookId
,
payload
)
}
export
function
*
saveWorkbookByType
(
payload
)
{
return
yield
call
(
service
.
saveWorkbookByType
,
payload
)
}
}
\ No newline at end of file
src/service/dataassetmanager.js
View file @
bc422663
...
@@ -282,4 +282,20 @@ export function getDirectoryChild(payload) {
...
@@ -282,4 +282,20 @@ export function getDirectoryChild(payload) {
export
function
queryCustomTypeRootDirectory
()
{
export
function
queryCustomTypeRootDirectory
()
{
return
GetJSON
(
"/dataassetmanager/directoryApi/queryCustomTypeRootDirectory"
);
return
GetJSON
(
"/dataassetmanager/directoryApi/queryCustomTypeRootDirectory"
);
}
export
function
listSupportReportTypes
()
{
return
GetJSON
(
"/dataassetmanager/reportApi/listSupportReportTypes"
)
}
export
function
listWorkbooksByType
(
payload
)
{
return
GetJSON
(
"/dataassetmanager/reportApi/listWorkbooks"
,
payload
)
}
export
function
getViewUrlByWorkbookId
(
payload
)
{
return
GetJSON
(
"/dataassetmanager/reportApi/getViewUrlByWorkbookId"
,
payload
)
}
export
function
saveWorkbookByType
(
payload
)
{
return
PostJSON
(
"/dataassetmanager/reportApi/saveWorkbook"
,
payload
)
}
}
\ No newline at end of file
src/view/Manage/AssetManage/Component/AssetTable.jsx
View file @
bc422663
...
@@ -151,6 +151,8 @@ const AssetTable = (props) => {
...
@@ -151,6 +151,8 @@ const AssetTable = (props) => {
const
[
worksheetModalVisible
,
setWorksheetModalVisible
]
=
useState
(
false
);
const
[
worksheetModalVisible
,
setWorksheetModalVisible
]
=
useState
(
false
);
const
[
workbookDrawerVisible
,
setWorkbookDrawerVisible
]
=
useState
(
false
);
const
[
workbookDrawerVisible
,
setWorkbookDrawerVisible
]
=
useState
(
false
);
const
[
biType
,
setBiType
]
=
useState
(
''
);
const
[
biType
,
setBiType
]
=
useState
(
''
);
const
[
reportTypes
,
setReportTypes
]
=
useState
();
const
[
report
,
setReport
]
=
useState
();
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
();
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
();
const
anchorId
=
getQueryParam
(
AnchorId
,
props
.
location
.
search
);
const
anchorId
=
getQueryParam
(
AnchorId
,
props
.
location
.
search
);
...
@@ -202,6 +204,8 @@ const AssetTable = (props) => {
...
@@ -202,6 +204,8 @@ const AssetTable = (props) => {
if
(
reference
===
AssetRecycleReference
)
{
if
(
reference
===
AssetRecycleReference
)
{
getFilterElementsGroupThenGetDataAssets
();
getFilterElementsGroupThenGetDataAssets
();
}
}
getReportTypes
()
//eslint-disable-next-line react-hooks/exhaustive-deps
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[
env
])
},
[
env
])
...
@@ -219,6 +223,15 @@ const AssetTable = (props) => {
...
@@ -219,6 +223,15 @@ const AssetTable = (props) => {
}
}
})
})
const
getReportTypes
=
()
=>
{
dispatch
({
type
:
'assetmanage.listSupportReportTypes'
,
callback
:
data
=>
{
setReportTypes
(
data
)
}
});
}
const
getDataAssetLocation
=
()
=>
{
const
getDataAssetLocation
=
()
=>
{
setLoading
(
true
);
setLoading
(
true
);
dispatch
({
dispatch
({
...
@@ -538,6 +551,22 @@ const AssetTable = (props) => {
...
@@ -538,6 +551,22 @@ const AssetTable = (props) => {
setFilterElementVisible
(
true
);
setFilterElementVisible
(
true
);
}
}
const
onReportAnalyseClick
=
(
val
)
=>
{
if
((
checkedKeys
||
[]).
length
===
0
)
{
showMessage
(
'warn'
,
'请先选择一个资产'
);
}
else
if
((
checkedKeys
||
[]).
length
>
1
)
{
showMessage
(
'warn'
,
'只能选择一个资产'
);
}
else
{
setReport
(
val
);
setWorksheetModalVisible
(
true
);
}
}
const
onReportWorkbookClick
=
(
val
)
=>
{
setReport
(
val
);
setWorkbookDrawerVisible
(
true
);
}
const
onTableauAnalyseClick
=
()
=>
{
const
onTableauAnalyseClick
=
()
=>
{
if
((
checkedKeys
||
[]).
length
===
0
)
{
if
((
checkedKeys
||
[]).
length
===
0
)
{
showMessage
(
'warn'
,
'请先选择一个资产'
);
showMessage
(
'warn'
,
'请先选择一个资产'
);
...
@@ -828,35 +857,20 @@ const AssetTable = (props) => {
...
@@ -828,35 +857,20 @@ const AssetTable = (props) => {
</
Menu
.
Item
>
</
Menu
.
Item
>
{
{
(
reference
===
AssetManageReference
)
&&
<
Menu
.
Item
disabled=
{
(
checkedKeys
||
[]).
length
===
0
}
>
reference
===
AssetManageReference
&&
reportTypes
?.
map
(
item
=>
<
div
className=
'text-center'
onClick=
{
onTableauAnalyseClick
}
>
<
React
.
Fragment
key=
{
item
.
code
}
>
tableau自助分析
<
Menu
.
Item
disabled=
{
(
checkedKeys
||
[]).
length
===
0
}
>
</
div
>
<
div
className=
'text-center'
onClick=
{
()
=>
{
onReportAnalyseClick
(
item
)
}
}
>
</
Menu
.
Item
>
{
`${item.name}自助分析`
}
}
</
div
>
</
Menu
.
Item
>
{
<
Menu
.
Item
>
(
reference
===
AssetManageReference
)
&&
<
Menu
.
Item
>
<
div
className=
'text-center'
onClick=
{
()
=>
{
onReportWorkbookClick
(
item
)}
}
>
<
div
className=
'text-center'
onClick=
{
onTableauWorkbookClick
}
>
{
`${item.name}工作簿`
}
tableau工作簿
</
div
>
</
div
>
</
Menu
.
Item
>
</
Menu
.
Item
>
</
React
.
Fragment
>
}
)
{
(
reference
===
AssetManageReference
)
&&
<
Menu
.
Item
disabled=
{
(
checkedKeys
||
[]).
length
===
0
}
>
<
div
className=
'text-center'
onClick=
{
onSmartBIAnalyseClick
}
>
smartBI自助分析
</
div
>
</
Menu
.
Item
>
}
{
(
reference
===
AssetManageReference
)
&&
<
Menu
.
Item
>
<
div
className=
'text-center'
onClick=
{
onSmartBIWorkbookClick
}
>
smartBI工作簿
</
div
>
</
Menu
.
Item
>
}
}
</
Menu
>
</
Menu
>
);
);
...
@@ -875,26 +889,22 @@ const AssetTable = (props) => {
...
@@ -875,26 +889,22 @@ const AssetTable = (props) => {
可见列设置
可见列设置
</
div
>
</
div
>
</
Menu
.
Item
>
</
Menu
.
Item
>
<
Menu
.
Item
disabled=
{
(
checkedKeys
||
[]).
length
===
0
}
>
{
<
div
className=
'text-center'
onClick=
{
onTableauAnalyseClick
}
>
reportTypes
?.
map
(
item
=>
tableau自助分析
<
React
.
Fragment
key=
{
item
.
code
}
>
</
div
>
<
Menu
.
Item
disabled=
{
(
checkedKeys
||
[]).
length
===
0
}
>
</
Menu
.
Item
>
<
div
className=
'text-center'
onClick=
{
()
=>
{
onReportAnalyseClick
(
item
)
}
}
>
<
Menu
.
Item
>
{
`${item.name}自助分析`
}
<
div
className=
'text-center'
onClick=
{
onTableauWorkbookClick
}
>
</
div
>
tableau工作簿
</
Menu
.
Item
>
</
div
>
<
Menu
.
Item
>
</
Menu
.
Item
>
<
div
className=
'text-center'
onClick=
{
()
=>
{
onReportWorkbookClick
(
item
)}
}
>
<
Menu
.
Item
disabled=
{
(
checkedKeys
||
[]).
length
===
0
}
>
{
`${item.name}工作簿`
}
<
div
className=
'text-center'
onClick=
{
onSmartBIAnalyseClick
}
>
</
div
>
smartBI自助分析
</
Menu
.
Item
>
</
div
>
</
React
.
Fragment
>
</
Menu
.
Item
>
)
<
Menu
.
Item
>
}
<
div
className=
'text-center'
onClick=
{
onSmartBIWorkbookClick
}
>
smartBI工作簿
</
div
>
</
Menu
.
Item
>
</
Menu
>
</
Menu
>
);
);
...
@@ -1089,7 +1099,7 @@ const AssetTable = (props) => {
...
@@ -1089,7 +1099,7 @@ const AssetTable = (props) => {
onCancel=
{
onAssetDetailDrawerCancel
}
onCancel=
{
onAssetDetailDrawerCancel
}
/>
/>
<
WorksheetModal
<
WorksheetModal
type=
{
biType
}
report=
{
report
}
visible=
{
worksheetModalVisible
}
visible=
{
worksheetModalVisible
}
id=
{
(
checkedKeys
||
[]).
length
>
0
?
checkedKeys
[
0
]:
''
}
id=
{
(
checkedKeys
||
[]).
length
>
0
?
checkedKeys
[
0
]:
''
}
metadata=
{
(
checkedItems
||
[]).
length
>
0
?
checkedItems
[
0
].
metadata
:{}
}
metadata=
{
(
checkedItems
||
[]).
length
>
0
?
checkedItems
[
0
].
metadata
:{}
}
...
@@ -1097,7 +1107,7 @@ const AssetTable = (props) => {
...
@@ -1097,7 +1107,7 @@ const AssetTable = (props) => {
/>
/>
<
WorkbookDrawer
<
WorkbookDrawer
type=
{
biType
}
report=
{
report
}
visible=
{
workbookDrawerVisible
}
visible=
{
workbookDrawerVisible
}
onCancel=
{
onWorkbookDrawerCancel
}
onCancel=
{
onWorkbookDrawerCancel
}
/>
/>
...
...
src/view/Manage/AssetManage/Component/WorkbookDrawer.jsx
View file @
bc422663
...
@@ -4,7 +4,7 @@ import { Drawer, Pagination, List } from 'antd';
...
@@ -4,7 +4,7 @@ import { Drawer, Pagination, List } from 'antd';
import
{
dispatch
}
from
'../../../../model'
;
import
{
dispatch
}
from
'../../../../model'
;
const
WorkbookDrawer
=
(
props
)
=>
{
const
WorkbookDrawer
=
(
props
)
=>
{
const
{
onCancel
,
visible
,
type
=
'tableau'
}
=
props
;
const
{
onCancel
,
visible
,
report
}
=
props
;
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
workbooks
,
setWorkbooks
]
=
useState
([]);
const
[
workbooks
,
setWorkbooks
]
=
useState
([]);
...
@@ -25,13 +25,13 @@ const WorkbookDrawer = (props) => {
...
@@ -25,13 +25,13 @@ const WorkbookDrawer = (props) => {
const
getWorkbooks
=
(
p
=
1
,
s
=
20
)
=>
{
const
getWorkbooks
=
(
p
=
1
,
s
=
20
)
=>
{
setLoading
(
true
);
setLoading
(
true
);
const
url
=
(
type
===
'tableau'
)
?
'assetmanage.listWorkbooks'
:
'assetmanage.listSmartBIWorkbooks'
;
dispatch
({
dispatch
({
type
:
url
,
type
:
'assetmanage.listWorkbooksByType'
,
payload
:
{
payload
:
{
pageNum
:
p
,
pageNum
:
p
,
pageSize
:
s
pageSize
:
s
,
type
:
report
?.
code
,
},
},
callback
:
data
=>
{
callback
:
data
=>
{
setLoading
(
false
);
setLoading
(
false
);
...
@@ -57,10 +57,8 @@ const WorkbookDrawer = (props) => {
...
@@ -57,10 +57,8 @@ const WorkbookDrawer = (props) => {
// }
// }
const
onDevelopClick
=
(
id
)
=>
{
const
onDevelopClick
=
(
id
)
=>
{
const
url
=
(
type
===
'tableau'
)
?
'assetmanage.getWorkbookUrl'
:
'assetmanage.getSmartBIWorkbookUrl'
;
dispatch
({
dispatch
({
type
:
url
,
type
:
'assetmanage.getViewUrlByWorkbookId'
,
payload
:
{
payload
:
{
workbookId
:
id
,
workbookId
:
id
,
},
},
...
@@ -74,7 +72,7 @@ const WorkbookDrawer = (props) => {
...
@@ -74,7 +72,7 @@ const WorkbookDrawer = (props) => {
<
Drawer
<
Drawer
forceRender
forceRender
visible=
{
visible
}
visible=
{
visible
}
title=
{
`${
typ
e}工作簿`
}
title=
{
`${
report?.nam
e}工作簿`
}
width=
{
900
}
width=
{
900
}
placement=
"right"
placement=
"right"
closable=
{
true
}
closable=
{
true
}
...
...
src/view/Manage/AssetManage/Component/WorksheetModal.jsx
View file @
bc422663
...
@@ -6,16 +6,22 @@ import { showMessage } from '../../../../util';
...
@@ -6,16 +6,22 @@ import { showMessage } from '../../../../util';
const
WorksheetModal
=
(
props
)
=>
{
const
WorksheetModal
=
(
props
)
=>
{
const
{
onCancel
,
visible
,
id
,
type
=
'tableau'
,
metadata
=
{}
}
=
props
;
const
{
onCancel
,
visible
,
id
,
report
,
metadata
=
{}
}
=
props
;
const
[
confirmLoading
,
setConfirmLoading
]
=
useState
(
false
);
const
[
confirmLoading
,
setConfirmLoading
]
=
useState
(
false
);
const
[
form
]
=
Form
.
useForm
();
const
[
form
]
=
Form
.
useForm
();
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
visible
)
{
if
(
visible
)
{
form
?.
setFieldsValue
({
tableName
:
metadata
?.
tableName
,
columnNames
:
metadata
?.
columnItems
?.
map
(
item
=>
item
.
metadataColumnName
)
});
form
?.
setFieldsValue
({
tableName
:
metadata
?.
tableName
,
columnNames
:
metadata
?.
columnItems
?.
map
(
item
=>
{
return
{
cnName
:
item
.
metadataColumnCnName
,
metadataColumnId
:
item
.
metadataColumnId
,
name
:
item
.
metadataColumnName
}
})
});
}
}
},
[
visible
,
type
])
},
[
visible
,
report
,
metadata
])
const
onOk
=
async
()
=>
{
const
onOk
=
async
()
=>
{
try
{
try
{
...
@@ -23,21 +29,15 @@ const WorksheetModal = (props) => {
...
@@ -23,21 +29,15 @@ const WorksheetModal = (props) => {
setConfirmLoading
(
true
);
setConfirmLoading
(
true
);
const
url
=
(
type
===
'tableau'
)
?
'assetmanage.saveWorkbook'
:
'assetmanage.saveSmartBIWorkbook'
;
let
metadataTableId
=
''
;
metadata
?.
columnItems
?.
forEach
(
item
=>
{
if
(
!
metadataTableId
)
{
metadataTableId
=
item
.
metadataTableId
;
}
})
dispatch
({
dispatch
({
type
:
url
,
type
:
'assetmanage.saveWorkbookByType'
,
payload
:
{
payload
:
{
data
:
{
data
:
{
dataAssetId
:
id
,
dataAssetId
:
id
,
metadataTableId
,
metadataTableId
:
metadata
?.
metadataTableId
,
tableName
:
metadata
?.
tableName
,
tableCnName
:
metadata
?.
tableCnName
,
type
:
report
?.
code
,
...
row
,
...
row
,
}
}
},
},
...
@@ -80,7 +80,7 @@ const WorksheetModal = (props) => {
...
@@ -80,7 +80,7 @@ const WorksheetModal = (props) => {
return
(
return
(
<
Modal
<
Modal
forceRender
forceRender
title=
'工作簿信息'
title=
{
`${report?.name}工作簿信息`
}
visible=
{
visible
}
visible=
{
visible
}
width=
{
600
}
width=
{
600
}
onCancel=
{
()
=>
{
onCancel=
{
()
=>
{
...
@@ -109,22 +109,7 @@ const WorksheetModal = (props) => {
...
@@ -109,22 +109,7 @@ const WorksheetModal = (props) => {
label=
"字段"
label=
"字段"
name=
"columnNames"
name=
"columnNames"
>
>
<
Checkbox
.
Group
>
<
ColumnsItem
data=
{
metadata
?.
columnItems
}
/>
<
Row
>
{
metadata
?.
columnItems
?.
map
((
item
,
index
)
=>
<
Col
key=
{
index
}
span=
{
8
}
>
<
Checkbox
value=
{
item
.
metadataColumnName
}
style=
{
{
lineHeight
:
'32px'
,
}
}
>
<
Typography
.
Text
style=
{
{
width
:
120
}
}
ellipsis
>
{
item
.
metadataColumnName
}
</
Typography
.
Text
>
</
Checkbox
>
</
Col
>)
}
</
Row
>
</
Checkbox
.
Group
>
</
Form
.
Item
>
</
Form
.
Item
>
<
Form
.
Item
<
Form
.
Item
label=
"元数据"
label=
"元数据"
...
@@ -138,4 +123,42 @@ const WorksheetModal = (props) => {
...
@@ -138,4 +123,42 @@ const WorksheetModal = (props) => {
);
);
}
}
export
default
WorksheetModal
;
export
default
WorksheetModal
;
\ No newline at end of file
const
ColumnsItem
=
({
value
,
onChange
,
data
})
=>
{
return
(
<
Checkbox
.
Group
onChange=
{
(
checkedValue
)
=>
{
if
((
checkedValue
??[]).
length
===
0
)
{
onChange
([])
}
else
{
const
filterData
=
(
data
??[]).
filter
(
item
=>
checkedValue
.
includes
(
item
.
metadataColumnName
))
onChange
(
filterData
.
map
(
item
=>
{
return
{
cnName
:
item
.
metadataColumnCnName
,
metadataColumnId
:
item
.
metadataColumnId
,
name
:
item
.
metadataColumnName
}
}))
}
}
}
value=
{
(
value
??[]).
map
(
item
=>
item
.
name
)
}
>
<
Row
>
{
data
?.
map
((
item
,
index
)
=>
<
Col
key=
{
index
}
span=
{
8
}
>
<
Checkbox
value=
{
item
.
metadataColumnName
}
style=
{
{
lineHeight
:
'32px'
,
}
}
>
<
Typography
.
Text
style=
{
{
width
:
120
}
}
ellipsis
>
{
item
.
metadataColumnName
}
</
Typography
.
Text
>
</
Checkbox
>
</
Col
>)
}
</
Row
>
</
Checkbox
.
Group
>
)
}
\ No newline at end of file
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