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
d50f3709
Commit
d50f3709
authored
Jun 09, 2023
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改bug
parent
5b0d6263
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
133 additions
and
59 deletions
+133
-59
AssetAction.jsx
src/view/Manage/AssetManage/Component/AssetAction.jsx
+2
-1
AssetDirectory.jsx
src/view/Manage/AssetManage/Component/AssetDirectory.jsx
+1
-1
AssetTable.jsx
src/view/Manage/AssetManage/Component/AssetTable.jsx
+20
-24
AttributeMaintain.jsx
src/view/Manage/AssetManage/Component/AttributeMaintain.jsx
+6
-4
index.jsx
src/view/Manage/ResizeableTable/index.jsx
+104
-29
No files found.
src/view/Manage/AssetManage/Component/AssetAction.jsx
View file @
d50f3709
import
React
,
{
useEffect
,
useState
,
useContext
,
useMemo
,
useRef
}
from
'react'
;
import
React
,
{
useEffect
,
useState
,
useContext
,
useMemo
,
useRef
}
from
'react'
;
import
{
Form
,
Spin
,
Input
,
Descriptions
,
Space
,
Button
,
Tooltip
,
Select
,
Cascader
,
Table
,
Radio
,
Divider
,
Typography
,
Modal
,
Row
,
Col
}
from
'antd'
;
import
{
Form
,
Spin
,
Input
,
Descriptions
,
Space
,
Button
,
Tooltip
,
Select
,
Cascader
,
Radio
,
Divider
,
Typography
,
Modal
,
Row
,
Col
}
from
'antd'
;
import
{
DownOutlined
,
UpOutlined
,
QuestionCircleOutlined
}
from
'@ant-design/icons'
;
import
{
DownOutlined
,
UpOutlined
,
QuestionCircleOutlined
}
from
'@ant-design/icons'
;
import
MetadataInfo
from
'./MetadataInfo'
;
import
MetadataInfo
from
'./MetadataInfo'
;
...
@@ -12,6 +12,7 @@ import AssetTagModal from './AssetTagModal';
...
@@ -12,6 +12,7 @@ import AssetTagModal from './AssetTagModal';
import
{
AnchorId
,
AnchorDirId
,
AssetManageReference
}
from
'../../../../util/constant'
;
import
{
AnchorId
,
AnchorDirId
,
AssetManageReference
}
from
'../../../../util/constant'
;
import
IndexCode
from
'./IndexCode'
;
import
IndexCode
from
'./IndexCode'
;
import
Upload
from
'./Upload'
;
import
Upload
from
'./Upload'
;
import
Table
from
'../../ResizeableTable'
;
import
{
CancelSvg
,
EditSvg
,
SaveSvg
,
FullScreenSvg
,
CancelFullScreenSvg
}
from
'./AssetSvg'
;
import
{
CancelSvg
,
EditSvg
,
SaveSvg
,
FullScreenSvg
,
CancelFullScreenSvg
}
from
'./AssetSvg'
;
import
SelectUser
from
'../../Model/Component/SelectUsers'
;
import
SelectUser
from
'../../Model/Component/SelectUsers'
;
...
...
src/view/Manage/AssetManage/Component/AssetDirectory.jsx
View file @
d50f3709
...
@@ -140,7 +140,7 @@ const AssetDirectory = (props) => {
...
@@ -140,7 +140,7 @@ const AssetDirectory = (props) => {
</
Menu
.
Item
>
</
Menu
.
Item
>
<
Menu
.
Item
>
<
Menu
.
Item
>
<
div
className=
'text-center'
onClick=
{
onFilterElementClick
}
>
<
div
className=
'text-center'
onClick=
{
onFilterElementClick
}
>
资产
属性
管理
资产
浏览
管理
</
div
>
</
div
>
</
Menu
.
Item
>
</
Menu
.
Item
>
<
Menu
.
Item
>
<
Menu
.
Item
>
...
...
src/view/Manage/AssetManage/Component/AssetTable.jsx
View file @
d50f3709
...
@@ -630,31 +630,27 @@ const AssetTable = (props) => {
...
@@ -630,31 +630,27 @@ const AssetTable = (props) => {
const
deleteAssets
=
()
=>
{
const
deleteAssets
=
()
=>
{
if
((
checkedKeys
||
[]).
length
===
0
)
return
;
if
((
checkedKeys
||
[]).
length
===
0
)
return
;
if
(
reference
===
AssetManageReference
)
{
modal
.
confirm
({
setAssetDeleteModalVisible
(
true
);
title
:
'提示'
,
}
else
{
content
:
'您确定要删除这些资产吗?'
,
modal
.
confirm
({
onOk
:
()
=>
{
title
:
'提示'
,
let
payload
=
{
content
:
'您确定要永久删除这些资产吗?'
,
data
:
checkedKeys
onOk
:
()
=>
{
let
payload
=
{
data
:
checkedKeys
}
dispatch
({
type
:
'assetmanage.deleteDataAssets'
,
payload
,
callback
:
()
=>
{
showMessage
(
"success"
,
"删除成功"
);
getDataAssets
();
setCheckedKeys
([]);
},
error
:
()
=>
{
}
})
}
}
})
}
dispatch
({
type
:
(
reference
===
AssetManageReference
)?
'assetmanage.unloadDataAssetsFromAllDirs'
:
'assetmanage.deleteDataAssets'
,
payload
,
callback
:
()
=>
{
showMessage
(
"success"
,
"删除成功"
);
getDataAssets
();
setCheckedKeys
([]);
},
error
:
()
=>
{
}
})
}
})
}
}
const
onImportAssetCancel
=
()
=>
{
const
onImportAssetCancel
=
()
=>
{
...
...
src/view/Manage/AssetManage/Component/AttributeMaintain.jsx
View file @
d50f3709
...
@@ -111,9 +111,8 @@ const FC = (props) => {
...
@@ -111,9 +111,8 @@ const FC = (props) => {
setTotal
(
data
.
totalElements
);
setTotal
(
data
.
totalElements
);
data
.
content
?.
forEach
(
item
=>
{
data
.
content
?.
forEach
(
item
=>
{
// item.startTime = item._id?.time
item
.
startTime
=
item
.
updateTime
;
// item.endTime
item
.
costTime
=
item
.
cost
;
// item.costTime
});
});
setLogs
(
data
.
content
||
[]);
setLogs
(
data
.
content
||
[]);
},
},
...
@@ -314,7 +313,10 @@ const FC = (props) => {
...
@@ -314,7 +313,10 @@ const FC = (props) => {
catalogs.map((catalog, index) => <Radio key={index} value={catalog.key}>{catalog.title}</Radio>)
catalogs.map((catalog, index) => <Radio key={index} value={catalog.key}>{catalog.title}</Radio>)
}
}
</Radio.Group>
</Radio.Group>
<Button onClick={() => { setStep(1); }}>查看日志</Button>
<Button onClick={() => {
setStep(1);
getLogs();
}}>查看日志</Button>
</div>
</div>
<div className='flex mt-3' style={{ justifyContent: 'space-between' }}>
<div className='flex mt-3' style={{ justifyContent: 'space-between' }}>
<Upload style={{ display: 'inline' }} {...uploadProps }>
<Upload style={{ display: 'inline' }} {...uploadProps }>
...
...
src/view/Manage/ResizeableTable/index.jsx
View file @
d50f3709
import
{
useEffect
,
useState
}
from
'react'
;
import
React
,
{
useEffect
,
useState
,
useRef
,
useMemo
}
from
'react'
;
import
{
Table
}
from
'antd'
;
import
{
Table
}
from
'antd'
;
import
{
Resizable
}
from
'react-resizable'
;
import
{
Resizable
}
from
'react-resizable'
;
import
ResizeObserver
from
'rc-resize-observer'
const
scrollbarWidth
=
getScrollbarWidth
()
const
ResizeableHeaderCell
=
props
=>
{
const
ResizeableHeaderCell
=
props
=>
{
const
{
onResize
,
width
,
onClick
,
...
restProps
}
=
props
;
const
{
onResize
,
width
,
onClick
,
...
restProps
}
=
props
;
...
@@ -33,44 +36,116 @@ const ResizeableHeaderCell = props => {
...
@@ -33,44 +36,116 @@ const ResizeableHeaderCell = props => {
};
};
const
ResizeableTable
=
(
props
)
=>
{
const
ResizeableTable
=
(
props
)
=>
{
const
{
columns
,
...
restProps
}
=
props
;
const
{
columns
,
...
restProps
}
=
props
const
[
_columns
,
setColumns
]
=
useState
([]);
useEffect
(()
=>
{
const
[
tableWidth
,
setTableWidth
]
=
useState
(
0
)
setColumns
([...
columns
,
{
title
:
''
,
dataIndex
:
'auto'
}]);
},
[
columns
])
const
handleResize
=
index
=>
(
e
,
{
size
})
=>
{
const
paddingCol
=
useRef
({
const
nextColumns
=
[...
_columns
];
key
:
'padding'
,
nextColumns
[
index
]
=
{
width
:
0
,
...
nextColumns
[
index
],
render
:
()
=>
undefined
width
:
size
.
width
,
})
};
setColumns
(
nextColumns
);
const
handleResize
=
(
index
)
=>
(
e
,
{
size
})
=>
{
setCols
((
prevCols
)
=>
{
const
nextColumns
=
[...(
prevCols
??
[])];
nextColumns
[
index
]
=
{
...
nextColumns
[
index
],
width
:
size
.
width
,
};
return
nextColumns
;
});
};
};
return
(
const
[
cols
,
setCols
]
=
useState
();
<
Table
components=
{
{
useEffect
(()
=>
{
header
:
{
if
(
!!
columns
&&
tableWidth
>
0
)
{
cell
:
ResizeableHeaderCell
,
const
contentWidth
=
getWidth
(
tableWidth
)
}
setDefaultWidth
(
columns
,
contentWidth
)
}
}
paddingCol
.
current
.
width
=
0
columns=
{
_columns
.
map
((
column
,
index
)
=>
{
const
cols
=
columns
.
map
((
col
,
index
)
=>
{
const
colWidth
=
col
.
width
??
100
;
return
{
return
{
...
column
,
...
col
,
onHeaderCell
:
column
=>
({
width
:
colWidth
,
ellipsis
:
true
,
onHeaderCell
:
(
column
:
any
)
=>
({
width
:
column
.
width
,
width
:
column
.
width
,
onResize
:
handleResize
(
index
),
onResize
:
handleResize
(
index
),
}),
}),
};
};
})
})
}
setCols
(
cols
)
{
...
restProps
}
}
/>
},
[
columns
,
tableWidth
])
const
cols1
=
useMemo
(()
=>
!!
cols
?
[...
cols
,
paddingCol
.
current
]
:
undefined
,
[
cols
])
return
(
<
ResizeObserver
onResize=
{
({
width
})
=>
{
setTableWidth
(
width
)
}
}
>
<
Table
components=
{
{
header
:
{
cell
:
ResizeableHeaderCell
,
}
}
}
columns=
{
cols1
}
{
...
restProps
}
/>
</
ResizeObserver
>
);
);
}
}
export
default
ResizeableTable
;
export
default
ResizeableTable
;
\ No newline at end of file
function
getWidth
(
tableWidth
)
{
// FIXME 判断没有选择列时,32为0
return
tableWidth
-
scrollbarWidth
-
32
// scrollbar width, checkbox column
}
function
setDefaultWidth
(
columns
,
width
)
{
let
rowWidth
=
0
,
count
=
0
for
(
const
col
of
columns
)
{
if
(
typeof
col
.
width
===
'number'
)
{
rowWidth
+=
col
.
width
}
else
{
count
++
}
}
if
(
count
>
0
)
{
const
defaultW
=
(
rowWidth
>
width
?
0
:
width
-
rowWidth
)
/
count
for
(
const
col
of
columns
)
{
if
(
typeof
col
.
width
!==
'number'
)
{
col
.
width
=
defaultW
}
}
}
}
export
function
getScrollbarWidth
()
{
// Creating invisible container
const
outer
=
document
.
createElement
(
'div'
);
outer
.
style
.
visibility
=
'hidden'
;
outer
.
style
.
overflow
=
'scroll'
;
// forcing scrollbar to appear
outer
.
style
.
msOverflowStyle
=
'scrollbar'
;
// needed for WinJS apps
document
.
body
.
appendChild
(
outer
);
// Creating inner element and placing it in the container
const
inner
=
document
.
createElement
(
'div'
);
outer
.
appendChild
(
inner
);
// Calculating difference between container's full width and the child width
const
scrollbarWidth
=
(
outer
.
offsetWidth
-
inner
.
offsetWidth
);
// Removing temporary elements from the DOM
outer
.
parentNode
?.
removeChild
(
outer
);
return
scrollbarWidth
;
}
\ 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