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
baa4eb7b
Commit
baa4eb7b
authored
Feb 25, 2022
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
模型正在编辑中,关闭窗口给提示
parent
1a6212fc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
1 deletion
+25
-1
EditModel.jsx
src/view/Manage/Model/Component/EditModel.jsx
+25
-1
No files found.
src/view/Manage/Model/Component/EditModel.jsx
View file @
baa4eb7b
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'react'
;
import
{
Form
,
Button
,
Space
,
Tooltip
}
from
'antd'
;
import
{
Form
,
Button
,
Space
,
Tooltip
}
from
'antd'
;
import
LocalStorage
from
'local-storage'
;
import
LocalStorage
from
'local-storage'
;
import
{
useMount
,
useUnmount
}
from
'ahooks'
;
import
ImportAction
from
'./ImportAction'
;
import
ImportAction
from
'./ImportAction'
;
import
CatalogModal
from
'./CatalogModal'
;
import
CatalogModal
from
'./CatalogModal'
;
...
@@ -22,6 +23,9 @@ const EditModel = (props) => {
...
@@ -22,6 +23,9 @@ const EditModel = (props) => {
const
[
historyAndVersionDrawerVisible
,
setHistoryAndVersionDrawerVisible
]
=
useState
(
false
);
const
[
historyAndVersionDrawerVisible
,
setHistoryAndVersionDrawerVisible
]
=
useState
(
false
);
const
[
autoTabKey
,
setAutoTabKey
]
=
useState
(
null
);
const
[
autoTabKey
,
setAutoTabKey
]
=
useState
(
null
);
const
mountRef
=
useRef
(
false
);
const
actionRef
=
useRef
(
''
);
const
{
action
,
catalogId
,
modelerId
,
hints
,
roughModelerData
,
permitCheckOut
,
editable
,
stateId
,
versionId
,
holder
}
=
actionData
;
const
{
action
,
catalogId
,
modelerId
,
hints
,
roughModelerData
,
permitCheckOut
,
editable
,
stateId
,
versionId
,
holder
}
=
actionData
;
const
[
form
]
=
Form
.
useForm
();
const
[
form
]
=
Form
.
useForm
();
...
@@ -51,6 +55,7 @@ const EditModel = (props) => {
...
@@ -51,6 +55,7 @@ const EditModel = (props) => {
}
}
setActionData
({
action
:
_action
,
catalogId
:
_catalogId
,
modelerId
:
_modelerId
,
hints
:
_hints
,
roughModelerData
:
_roughModelerData
,
permitCheckOut
:
(
_permitCheckOut
===
'true'
),
editable
:
(
_editable
===
'true'
),
stateId
:
_stateId
,
versionId
:
_versionId
,
holder
:
_holder
});
setActionData
({
action
:
_action
,
catalogId
:
_catalogId
,
modelerId
:
_modelerId
,
hints
:
_hints
,
roughModelerData
:
_roughModelerData
,
permitCheckOut
:
(
_permitCheckOut
===
'true'
),
editable
:
(
_editable
===
'true'
),
stateId
:
_stateId
,
versionId
:
_versionId
,
holder
:
_holder
});
actionRef
.
current
=
_action
;
const
interval
=
setInterval
(()
=>
{
const
interval
=
setInterval
(()
=>
{
heartbeat
();
heartbeat
();
...
@@ -63,12 +68,26 @@ const EditModel = (props) => {
...
@@ -63,12 +68,26 @@ const EditModel = (props) => {
//eslint-disable-next-line react-hooks/exhaustive-deps
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[])
},
[])
useMount
(()
=>
{
window
?.
addEventListener
(
'beforeunload'
,
confirmQuit
);
})
useUnmount
(()
=>
{
window
?.
removeEventListener
(
'beforeunload'
,
confirmQuit
);
})
const
heartbeat
=
()
=>
{
const
heartbeat
=
()
=>
{
dispatchLatest
({
dispatchLatest
({
type
:
'datamodel.heartbeat'
type
:
'datamodel.heartbeat'
});
});
}
}
const
confirmQuit
=
(
e
)
=>
{
if
(
actionRef
.
current
===
'edit'
)
{
e
.
returnValue
=
''
;
}
}
const
judgeAttributeRepeat
=
(
attrs
)
=>
{
const
judgeAttributeRepeat
=
(
attrs
)
=>
{
const
names
=
[],
nameCountMap
=
{},
terms
=
[];
const
names
=
[],
nameCountMap
=
{},
terms
=
[];
...
@@ -145,6 +164,7 @@ const EditModel = (props) => {
...
@@ -145,6 +164,7 @@ const EditModel = (props) => {
}
}
setActionData
({
...
actionData
,
...{
action
:
'detail'
,
modelerId
:
data
.
id
||
''
,
editable
:
data
?.
editable
||
false
,
stateId
:
data
?.
state
?.
id
||
''
}
});
setActionData
({
...
actionData
,
...{
action
:
'detail'
,
modelerId
:
data
.
id
||
''
,
editable
:
data
?.
editable
||
false
,
stateId
:
data
?.
state
?.
id
||
''
}
});
actionRef
.
current
=
'detail'
;
LocalStorage
.
set
(
'modelChange'
,
!
(
LocalStorage
.
get
(
'modelChange'
)
||
false
));
LocalStorage
.
set
(
'modelChange'
,
!
(
LocalStorage
.
get
(
'modelChange'
)
||
false
));
},
},
...
@@ -161,6 +181,8 @@ const EditModel = (props) => {
...
@@ -161,6 +181,8 @@ const EditModel = (props) => {
const
_action
=
getQueryParam
(
Action
,
props
.
location
.
search
);
const
_action
=
getQueryParam
(
Action
,
props
.
location
.
search
);
setActionData
({
...
actionData
,
...{
action
:
(
_action
===
'flow'
)?
'flow'
:
'detail'
,
modelerId
:
data
.
id
||
''
,
stateId
:
data
?.
state
?.
id
||
''
,
permitCheckOut
:
data
?.
permitCheckOut
||
false
,
editable
:
data
?.
editable
||
false
}
});
setActionData
({
...
actionData
,
...{
action
:
(
_action
===
'flow'
)?
'flow'
:
'detail'
,
modelerId
:
data
.
id
||
''
,
stateId
:
data
?.
state
?.
id
||
''
,
permitCheckOut
:
data
?.
permitCheckOut
||
false
,
editable
:
data
?.
editable
||
false
}
});
actionRef
.
current
=
(
_action
===
'flow'
)?
'flow'
:
'detail'
;
LocalStorage
.
set
(
'modelChange'
,
!
(
LocalStorage
.
get
(
'modelChange'
)
||
false
));
LocalStorage
.
set
(
'modelChange'
,
!
(
LocalStorage
.
get
(
'modelChange'
)
||
false
));
}
}
},
},
...
@@ -179,12 +201,14 @@ const EditModel = (props) => {
...
@@ -179,12 +201,14 @@ const EditModel = (props) => {
const
edit
=
()
=>
{
const
edit
=
()
=>
{
setActionData
({
...
actionData
,
action
:
'edit'
});
setActionData
({
...
actionData
,
action
:
'edit'
});
actionRef
.
current
=
'edit'
;
}
}
const
cancelEdit
=
()
=>
{
const
cancelEdit
=
()
=>
{
const
_action
=
getQueryParam
(
Action
,
props
.
location
.
search
);
const
_action
=
getQueryParam
(
Action
,
props
.
location
.
search
);
setActionData
({
...
actionData
,
action
:
(
_action
===
'flow'
)?
'flow'
:
'detail'
});
setActionData
({
...
actionData
,
action
:
(
_action
===
'flow'
)?
'flow'
:
'detail'
});
actionRef
.
current
=
(
_action
===
'flow'
)?
'flow'
:
'detail'
;
}
}
const
onActionChange
=
(
data
)
=>
{
const
onActionChange
=
(
data
)
=>
{
...
...
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