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
80906d50
Commit
80906d50
authored
Mar 07, 2024
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增项目
parent
e7fb8f33
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
193 additions
and
5 deletions
+193
-5
datamodel.js
src/model/datamodel.js
+5
-0
datamodeler.js
src/service/datamodeler.js
+5
-0
update-branch.jsx
src/view/Manage/Model/Component/update-branch.jsx
+183
-5
No files found.
src/model/datamodel.js
View file @
80906d50
...
...
@@ -614,4 +614,8 @@ export function* saveBranch(payload) {
export
function
*
deleteBranch
(
payload
)
{
return
yield
call
(
datamodelerService
.
deleteBranch
,
payload
)
}
export
function
*
getCooperationUsers
()
{
return
yield
call
(
datamodelerService
.
getCooperationUsers
)
}
\ No newline at end of file
src/service/datamodeler.js
View file @
80906d50
...
...
@@ -561,4 +561,8 @@ export function saveBranch(payload) {
export
function
deleteBranch
(
payload
)
{
return
Delete1
(
"/datamodeler/easyDataModelerBranching/deleteBranch"
,
payload
)
}
export
function
getCooperationUsers
()
{
return
GetJSON
(
"/datamodeler/easyDataModelerCooperation/users"
)
}
\ No newline at end of file
src/view/Manage/Model/Component/update-branch.jsx
View file @
80906d50
import
React
from
'react'
import
{
Modal
,
Button
,
Spin
}
from
'antd'
import
{
Modal
,
Button
,
Spin
,
Form
,
Input
,
Select
,
}
from
'antd'
import
{
useDebounceEffect
}
from
'ahooks'
import
{
SettingOutlined
}
from
'@ant-design/icons'
import
{
dispatch
}
from
'../../../../model'
import
{
AppContext
}
from
'../../../../App'
import
produce
from
'immer'
const
FC
=
(
props
)
=>
{
const
{
visible
,
type
,
item
,
onCancel
}
=
props
const
[
waiting
,
setWaiting
]
=
React
.
useState
(
false
)
const
basicRef
=
React
.
useRef
()
const
title
=
React
.
useMemo
(()
=>
{
if
(
type
===
'add'
)
return
'新增项目'
if
(
type
===
'edit'
)
return
'编辑项目'
...
...
@@ -19,7 +27,24 @@ const FC = (props) => {
const
save
=
async
()
=>
{
try
{
const
basicRows
=
await
basicRef
.
current
?.
validate
()
setWaiting
(
true
)
console
.
log
(
'basic rows'
,
basicRows
)
if
(
type
===
'add'
)
{
dispatch
({
type
:
'datamodel.saveBranch'
,
payload
:
{
data
:
basicRows
,
},
callback
:
()
=>
{
close
(
true
)
},
error
:
()
=>
{
setWaiting
(
false
)
}
})
}
}
catch
(
e
)
{
}
...
...
@@ -48,10 +73,163 @@ const FC = (props) => {
onCancel=
{
()
=>
{
close
()
}
}
>
<
Spin
spinning=
{
waiting
}
>
<
Basic
ref=
{
basicRef
}
type=
{
type
}
item=
{
item
}
/>
</
Spin
>
</
Modal
>
)
}
export
default
FC
\ No newline at end of file
export
default
FC
const
Basic
=
React
.
forwardRef
(
function
({
type
,
item
},
ref
)
{
const
[
loadingUsers
,
setLoadingUsers
]
=
React
.
useState
(
false
)
const
[
users
,
setUsers
]
=
React
.
useState
()
const
[
form
]
=
Form
.
useForm
()
const
app
=
React
.
useContext
(
AppContext
)
React
.
useImperativeHandle
(
ref
,
()
=>
({
validate
:
async
()
=>
{
let
rows
=
await
form
.
validateFields
()
if
(
type
===
'add'
)
{
rows
=
{...
rows
,
easyDataModelerMemberShip
:
{
easyDataModelerMemberShip
:
[
{
admin
:
true
,
id
:
app
?.
user
?.
userId
,
name
:
app
?.
user
?.
userName
,
},
...(
rows
.
members
??[]).
map
(
item
=>
({
admin
:
false
,
...
item
,
}))
]
}}
}
return
rows
},
}),
[
form
,
type
,
users
])
React
.
useEffect
(()
=>
{
getUsers
()
},
[])
const
marginBottom
=
React
.
useMemo
(()
=>
{
return
(
type
===
'detail'
)
?
5
:
15
},
[
type
])
const
getUsers
=
()
=>
{
setLoadingUsers
(
true
)
dispatch
({
type
:
'datamodel.getCooperationUsers'
,
callback
:
data
=>
{
setLoadingUsers
(
false
)
//id int转string
const
newData
=
produce
(
data
??[],
(
draft
)
=>
{
draft
.
forEach
(
item
=>
{
item
.
id
=
`
${
item
.
id
}
`
})
})
setUsers
(
newData
)
},
error
:
()
=>
{
setLoadingUsers
(
false
)
}
})
}
const
onValuesChange
=
(
changedValues
,
allValues
)
=>
{
}
return
(
<
Form
form=
{
form
}
labelCol=
{
{
span
:
6
}
}
wrapperCol=
{
{
span
:
18
}
}
autoComplete=
"off"
onValuesChange=
{
onValuesChange
}
>
<
Form
.
Item
label=
'项目名称'
name=
'name'
rules=
{
[{
required
:
true
,
message
:
'请输入项目名称!'
}]
}
style=
{
{
marginBottom
}
}
>
<
Input
placeholder=
"请输入项目名称"
/>
</
Form
.
Item
>
<
Form
.
Item
label=
'项目说明'
name=
'remark'
style=
{
{
marginBottom
}
}
>
<
Input
placeholder=
"请输入项目说明"
/>
</
Form
.
Item
>
<
Form
.
Item
label=
'项目负责人'
name=
'admins'
style=
{
{
marginBottom
}
}
>
{
type
===
'add'
?
<
span
>
{
app
?.
user
?.
userName
}
</
span
>
:
<
UsersItem
loading=
{
loadingUsers
}
users=
{
users
}
/>
}
</
Form
.
Item
>
<
Form
.
Item
label=
'项目成员'
name=
'members'
style=
{
{
marginBottom
}
}
rules=
{
[{
required
:
true
,
message
:
'请选择项目成员!'
}]
}
>
<
UsersItem
loading=
{
loadingUsers
}
users=
{
users
}
/>
</
Form
.
Item
>
<
Form
.
Item
label=
'模型设置'
style=
{
{
marginBottom
}
}
>
<
ModelConfigItem
/>
</
Form
.
Item
>
</
Form
>
)
})
const
UsersItem
=
({
loading
,
users
,
value
,
onChange
})
=>
{
const
[
searchValue
,
setSearchValue
]
=
React
.
useState
()
const
[
options
,
setOptions
]
=
React
.
useState
()
useDebounceEffect
(()
=>
{
setOptions
(
(
users
??[])
.
filter
(
item
=>
!
searchValue
||
(
item
.
name
??
''
).
indexOf
(
searchValue
)
!==-
1
)
.
map
(
item
=>
({
label
:
item
.
name
,
value
:
item
.
id
,
}))
)
},
[
searchValue
,
users
],
{
wait
:
300
})
return
(
<
Select
loading=
{
loading
}
mode=
'multiple'
allowClear
searchValue=
{
searchValue
}
onSearch=
{
(
val
)
=>
{
setSearchValue
(
val
)
}
}
onClear=
{
()
=>
{
setSearchValue
()
}
}
filterOption=
{
false
}
options=
{
options
}
onChange=
{
(
val
)
=>
{
onChange
?.((
users
??[]).
filter
(
item
=>
(
val
??[]).
indexOf
(
item
.
id
)
!==
-
1
))
}
}
/>
)
}
const
ModelConfigItem
=
()
=>
{
const
onConfigClick
=
()
=>
{
}
return
(
<
Button
icon=
{
<
SettingOutlined
/>
}
onClick=
{
onConfigClick
}
/>
)
}
\ 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