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
529982bb
Commit
529982bb
authored
Oct 25, 2023
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
要素可选
parent
28c20a6b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
157 additions
and
67 deletions
+157
-67
AssetAction.jsx
src/view/Manage/AssetManage/Component/AssetAction.jsx
+12
-2
edit-assets.jsx
src/view/Manage/AssetResourceManage/edit-assets.jsx
+144
-64
ImportActionTable.jsx
src/view/Manage/Model/Component/ImportActionTable.jsx
+1
-1
No files found.
src/view/Manage/AssetManage/Component/AssetAction.jsx
View file @
529982bb
...
...
@@ -620,7 +620,7 @@ const AssetAction = (props) => {
export default AssetAction;
const MultipleItem = ({ value, onChange, element }) => {
export
const MultipleItem = ({ value, onChange, element }) => {
return (
<Select
value={value?value.split(','):undefined}
...
...
@@ -628,7 +628,17 @@ const MultipleItem = ({ value, onChange, element }) => {
disabled={element?.manualMaintain==='否'}
onChange={(val) => {
onChange?.((val??[]).length === 0 ? undefined : val.toString())
}}>
}}
dropdownRender={(originNode) => (
<div
onClick={e => {
e.stopPropagation()
}}
>
{originNode}
</div>
)}
>
{
(typeof(element?.optional) === 'string') && (element.optional??'').split(',').map((item, index) => <Select.Option key={index} value={item}>{item}</Select.Option>)
}
...
...
src/view/Manage/AssetResourceManage/edit-assets.jsx
View file @
529982bb
import
React
from
'react'
import
{
Tooltip
,
Typography
,
Input
,
Space
,
Button
,
Form
,
Spin
}
from
'antd'
import
{
Tooltip
,
Typography
,
Input
,
Space
,
Button
,
Form
,
Spin
,
Select
}
from
'antd'
import
{
SettingOutlined
}
from
'@ant-design/icons'
import
{
useClickAway
}
from
'ahooks'
import
LocalStorage
from
'local-storage'
...
...
@@ -8,9 +8,9 @@ import { dispatch } from '../../../model'
import
{
usePage
}
from
'../../../util/hooks/page'
import
Table
from
'../../../util/Component/Table'
import
{
getQueryParam
,
isSzseEnv
}
from
'../../../util'
import
{
EditableCell
}
from
'../Model/Component/ImportActionTable'
import
'../Model/Component/EditModel.less'
import
{
MultipleItem
}
from
'../AssetManage/Component/AssetAction'
const
FC
=
(
props
)
=>
{
const
ids
=
getQueryParam
(
'ids'
,
props
.
location
?.
search
)
...
...
@@ -137,69 +137,90 @@ export const EditAssets = React.forwardRef(function ({ action, ids, elementIds }
},
}),
[
form
,
editingKey
,
modifyData
,
elements
])
const
getColumnBatchEditProps
=
(
title
,
dataIndex
)
=>
({
filterDropdown
:
({
confirm
})
=>
(
<
div
style=
{
{
width
:
320
,
padding
:
8
,
}
}
onKeyDown=
{
(
e
)
=>
e
.
stopPropagation
()
}
>
<
h4
className=
'mb-3'
>
批量编辑
</
h4
>
<
Form
form=
{
colBatchEditForm
}
labelCol=
{
{
span
:
6
}
}
wrapperCol=
{
{
span
:
18
}
}
autoComplete=
"off"
const
getColumnBatchEditProps
=
(
element
,
dataIndex
)
=>
({
filterDropdown
:
({
confirm
})
=>
{
let
inputNode
=
<
Input
/>
if
(
element
?.
selectMode
===
'单选'
)
{
inputNode
=
<
Select
dropdownRender=
{
(
originNode
)
=>
(
<
div
onClick=
{
e
=>
{
e
.
stopPropagation
()
}
}
>
{
originNode
}
</
div
>
)
}
>
{
(
typeof
(
element
?.
optional
)
===
'string'
)
&&
(
element
?.
optional
??
''
).
split
(
','
).
map
((
item
,
index
)
=>
<
Select
.
Option
key=
{
index
}
value=
{
item
}
>
{
item
}
</
Select
.
Option
>)
}
</
Select
>
}
else
if
(
element
?.
selectMode
===
'多选'
)
{
inputNode
=
<
MultipleItem
element=
{
element
}
/>
}
return
(
<
div
style=
{
{
width
:
320
,
padding
:
8
,
}
}
onKeyDown=
{
(
e
)
=>
e
.
stopPropagation
()
}
>
<
Form
.
Item
name=
{
dataIndex
}
label=
{
title
}
rules=
{
[{
required
:
true
,
message
:
`请输入${title}!`
}]
}
style=
{
{
marginBottom
:
15
}
}
<
h4
className=
'mb-3'
>
批量编辑
</
h4
>
<
Form
form=
{
colBatchEditForm
}
labelCol=
{
{
span
:
6
}
}
wrapperCol=
{
{
span
:
18
}
}
autoComplete=
"off"
>
<
Input
placeholder=
{
`请输入${title}`
}
/>
</
Form
.
Item
>
</
Form
>
<
div
className=
'flex'
style=
{
{
justifyContent
:
'end'
}
}
>
<
Space
>
<
Button
size=
'small'
onClick=
{
()
=>
{
confirm
?.()
}
}
<
Form
.
Item
name=
{
dataIndex
}
label=
{
element
?.
name
}
rules=
{
[{
required
:
true
,
message
:
`请输入${element?.name}!`
}]
}
style=
{
{
marginBottom
:
15
}
}
>
取消
</
Button
>
<
Button
size=
'small'
type=
"primary"
onClick=
{
async
()
=>
{
try
{
await
save
()
const
rows
=
await
colBatchEditForm
.
validateFields
()
const
newModifyData
=
[...
modifyData
]
const
index
=
parseInt
(
dataIndex
.
slice
(
'element'
.
length
))
for
(
const
item
of
newModifyData
)
{
item
.
values
[
index
]
=
rows
[
`${dataIndex}`
]
}
setModifyData
(
newModifyData
)
{
inputNode
}
</
Form
.
Item
>
</
Form
>
<
div
className=
'flex'
style=
{
{
justifyContent
:
'end'
}
}
>
<
Space
>
<
Button
size=
'small'
onClick=
{
()
=>
{
confirm
?.()
}
catch
(
e
)
{
}
}
>
取消
</
Button
>
<
Button
size=
'small'
type=
"primary"
onClick=
{
async
()
=>
{
try
{
await
save
()
const
rows
=
await
colBatchEditForm
.
validateFields
()
const
newModifyData
=
[...
modifyData
]
const
index
=
parseInt
(
dataIndex
.
slice
(
'element'
.
length
))
for
(
const
item
of
newModifyData
)
{
item
.
values
[
index
]
=
rows
[
`${dataIndex}`
]
}
setModifyData
(
newModifyData
)
confirm
?.()
}
catch
(
e
)
{
}
}
}
>
确定
</
Button
>
</
Space
>
}
}
}
>
确定
</
Button
>
</
Space
>
</
div
>
</
div
>
</
div
>
)
,
)
}
,
filterIcon
:
(
filtered
)
=>
(
<
SettingOutlined
/>
),
...
...
@@ -231,8 +252,7 @@ export const EditAssets = React.forwardRef(function ({ action, ids, elementIds }
}
col
.
onCell
=
(
record
)
=>
({
record
,
inputType
:
'text'
,
element
,
dataIndex
:
col
.
dataIndex
,
colTitle
:
col
.
title
,
editing
:
isEditing
(
record
),
...
...
@@ -240,7 +260,7 @@ export const EditAssets = React.forwardRef(function ({ action, ids, elementIds }
if
(
action
===
'edit'
)
{
col
=
{
...
col
,
...
getColumnBatchEditProps
(
element
.
name
,
`element
${
index
}
`
)
...
getColumnBatchEditProps
(
element
,
`element
${
index
}
`
)
}
}
...
...
@@ -355,4 +375,64 @@ export const EditAssets = React.forwardRef(function ({ action, ids, elementIds }
</
Form
>
</
div
>
)
})
\ No newline at end of file
})
export
const
EditableCell
=
({
editing
,
dataIndex
,
colTitle
,
element
,
require
,
children
,
...
restProps
})
=>
{
let
editingComponent
=
null
if
(
editing
)
{
let
inputNode
=
<
Input
/>
if
(
element
?.
selectMode
===
'单选'
)
{
inputNode
=
<
Select
dropdownRender=
{
(
originNode
)
=>
(
<
div
onClick=
{
e
=>
{
e
.
stopPropagation
()
}
}
>
{
originNode
}
</
div
>
)
}
>
{
(
typeof
(
element
?.
optional
)
===
'string'
)
&&
(
element
?.
optional
??
''
).
split
(
','
).
map
((
item
,
index
)
=>
<
Select
.
Option
key=
{
index
}
value=
{
item
}
>
{
item
}
</
Select
.
Option
>)
}
</
Select
>
}
else
if
(
element
?.
selectMode
===
'多选'
)
{
inputNode
=
<
MultipleItem
element=
{
element
}
/>
}
editingComponent
=
(
<
Form
.
Item
name=
{
dataIndex
}
style=
{
{
margin
:
0
}
}
rules=
{
[
{
required
:
(
require
===
null
)?
false
:
require
,
message
:
`请输入${colTitle}!`
,
},
]
}
>
{
inputNode
}
</
Form
.
Item
>
)
}
return
(
<
td
{
...
restProps
}
>
{
editing
?
(
editingComponent
)
:
(
children
)
}
</
td
>
)
}
\ No newline at end of file
src/view/Manage/Model/Component/ImportActionTable.jsx
View file @
529982bb
...
...
@@ -28,7 +28,7 @@ const perSuggestCount = 5;
const
supportMaxAttributeCountPerPage
=
100
;
const
MENU_ID
=
'model-attribute-menu'
;
const
InputDebounce
=
DebounceInput
(
300
)(
Input
);
export
const
InputDebounce
=
DebounceInput
(
300
)(
Input
);
const
ResizeableHeaderCell
=
props
=>
{
const
{
onResize
,
width
,
onClick
,
...
restProps
}
=
props
;
...
...
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