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
933a9743
Commit
933a9743
authored
Apr 26, 2022
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
模型保存有字段正在编辑给提示
parent
c1c5612f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
72 additions
and
24 deletions
+72
-24
ContextManage.jsx
src/view/Manage/Model/Component/ContextManage.jsx
+4
-0
EditModel.jsx
src/view/Manage/Model/Component/EditModel.jsx
+50
-22
ImportActionIndex.jsx
src/view/Manage/Model/Component/ImportActionIndex.jsx
+9
-1
ImportActionTable.jsx
src/view/Manage/Model/Component/ImportActionTable.jsx
+9
-1
No files found.
src/view/Manage/Model/Component/ContextManage.jsx
0 → 100644
View file @
933a9743
import
React
from
'react'
;
export
const
EditModelContext
=
React
.
createContext
();
\ No newline at end of file
src/view/Manage/Model/Component/EditModel.jsx
View file @
933a9743
...
@@ -9,6 +9,7 @@ import { dispatchLatest } from '../../../../model';
...
@@ -9,6 +9,7 @@ import { dispatchLatest } from '../../../../model';
import
{
getQueryParam
,
showMessage
,
showNotifaction
}
from
'../../../../util'
;
import
{
getQueryParam
,
showMessage
,
showNotifaction
}
from
'../../../../util'
;
import
{
Action
,
CatalogId
,
ModelerId
,
Hints
,
ModelerData
,
PermitCheckOut
,
Editable
,
StateId
,
VersionId
,
Holder
,
DDL
,
ReadOnly
}
from
'../../../../util/constant'
;
import
{
Action
,
CatalogId
,
ModelerId
,
Hints
,
ModelerData
,
PermitCheckOut
,
Editable
,
StateId
,
VersionId
,
Holder
,
DDL
,
ReadOnly
}
from
'../../../../util/constant'
;
import
HistoryAndVersionDrawer
from
'./HistoryAndVersionDrawer'
;
import
HistoryAndVersionDrawer
from
'./HistoryAndVersionDrawer'
;
import
{
EditModelContext
}
from
'./ContextManage'
;
import
'./EditModel.less'
;
import
'./EditModel.less'
;
...
@@ -24,6 +25,8 @@ const EditModel = (props) => {
...
@@ -24,6 +25,8 @@ const EditModel = (props) => {
const
[
autoTabKey
,
setAutoTabKey
]
=
useState
(
null
);
const
[
autoTabKey
,
setAutoTabKey
]
=
useState
(
null
);
const
actionRef
=
useRef
(
''
);
const
actionRef
=
useRef
(
''
);
const
attrIsEditingRef
=
useRef
(
false
);
const
indexIsEditingRef
=
useRef
(
false
);
const
{
action
,
catalogId
,
modelerId
,
hints
,
roughModelerData
,
permitCheckOut
,
editable
,
stateId
,
versionId
,
holder
,
ddl
,
readOnly
}
=
actionData
;
const
{
action
,
catalogId
,
modelerId
,
hints
,
roughModelerData
,
permitCheckOut
,
editable
,
stateId
,
versionId
,
holder
,
ddl
,
readOnly
}
=
actionData
;
...
@@ -116,7 +119,19 @@ const EditModel = (props) => {
...
@@ -116,7 +119,19 @@ const EditModel = (props) => {
}
}
}
}
const
save
=
async
(
e
,
cid
=
''
)
=>
{
const
save
=
(
e
)
=>
{
e
.
stopPropagation
();
if
(
attrIsEditingRef
.
current
)
{
showMessage
(
"warn"
,
'还有字段正在编辑,需先保存该字段!'
);
}
else
if
(
indexIsEditingRef
.
current
)
{
showMessage
(
"warn"
,
'还有索引正在编辑,需先保存该索引!'
);
}
else
{
saveLogic
();
}
}
const
saveLogic
=
async
(
e
,
cid
=
''
)
=>
{
setAutoTabKey
(
null
);
setAutoTabKey
(
null
);
...
@@ -225,7 +240,7 @@ const EditModel = (props) => {
...
@@ -225,7 +240,7 @@ const EditModel = (props) => {
setCatalogModalVisible
(
false
);
setCatalogModalVisible
(
false
);
if
((
id
||
''
)
!==
''
)
{
if
((
id
||
''
)
!==
''
)
{
save
(
null
,
id
);
save
Logic
(
null
,
id
);
}
}
}
}
...
@@ -237,6 +252,14 @@ const EditModel = (props) => {
...
@@ -237,6 +252,14 @@ const EditModel = (props) => {
setHistoryAndVersionDrawerVisible
(
false
);
setHistoryAndVersionDrawerVisible
(
false
);
}
}
const
attrIsEditingFunction
=
(
value
)
=>
{
attrIsEditingRef
.
current
=
value
;
}
const
indexIsEditingFunction
=
(
value
)
=>
{
indexIsEditingRef
.
current
=
value
;
}
let
title
=
''
;
let
title
=
''
;
if
(
action
===
'add'
)
{
if
(
action
===
'add'
)
{
title
=
'新增模型'
;
title
=
'新增模型'
;
...
@@ -323,28 +346,33 @@ const EditModel = (props) => {
...
@@ -323,28 +346,33 @@ const EditModel = (props) => {
}
}
return
(
return
(
<
div
className=
'edit-model position-relative'
>
<
EditModelContext
.
Provider
value=
{
{
<
div
className=
'edit-header'
>
attrIsEditingFunction
,
<
span
style=
{
{
fontSize
:
16
,
fontWeight
:
'bold'
,
color
:
'#fff'
}
}
>
{
title
}
</
span
>
indexIsEditingFunction
,
</
div
>
}
}
>
<
div
className=
'edit-
container
'
>
<
div
className=
'edit-
model position-relative
'
>
<
div
className=
'edit-
container-card
'
>
<
div
className=
'edit-
header
'
>
<
ImportAction
hints=
{
hints
}
onChange=
{
onActionChange
}
action=
{
action
}
modelerId=
{
modelerId
}
ddl=
{
ddl
}
form=
{
form
}
terms=
{
terms
}
roughModelerData=
{
roughModelerData
}
permitCheckOut=
{
permitCheckOut
}
stateId=
{
stateId
}
versionId=
{
versionId
}
autoTabKey=
{
autoTabKey
}
{
...
props
}
/>
<
span
style=
{
{
fontSize
:
16
,
fontWeight
:
'bold'
,
color
:
'#fff'
}
}
>
{
title
}
</
span
>
</
div
>
</
div
>
<
div
className=
'edit-container'
>
<
div
className=
'edit-container-card'
>
<
ImportAction
hints=
{
hints
}
onChange=
{
onActionChange
}
action=
{
action
}
modelerId=
{
modelerId
}
ddl=
{
ddl
}
form=
{
form
}
terms=
{
terms
}
roughModelerData=
{
roughModelerData
}
permitCheckOut=
{
permitCheckOut
}
stateId=
{
stateId
}
versionId=
{
versionId
}
autoTabKey=
{
autoTabKey
}
{
...
props
}
/>
</
div
>
</
div
>
<
div
className=
'edit-footer'
>
{
actionsBtn
}
</
div
>
<
CatalogModal
visible=
{
catalogModalVisible
}
onCancel=
{
onCatalogModalCancel
}
/>
<
HistoryAndVersionDrawer
id=
{
modelerId
}
visible=
{
historyAndVersionDrawerVisible
}
onCancel=
{
onHistoryAndVersionDrawerCancel
}
/>
</
div
>
</
div
>
<
div
className=
'edit-footer'
>
</
EditModelContext
.
Provider
>
{
actionsBtn
}
</
div
>
<
CatalogModal
visible=
{
catalogModalVisible
}
onCancel=
{
onCatalogModalCancel
}
/>
<
HistoryAndVersionDrawer
id=
{
modelerId
}
visible=
{
historyAndVersionDrawerVisible
}
onCancel=
{
onHistoryAndVersionDrawerCancel
}
/>
</
div
>
);
);
}
}
...
...
src/view/Manage/Model/Component/ImportActionIndex.jsx
View file @
933a9743
import
React
,
{
useState
,
useCallback
,
useRef
,
useEffect
}
from
'react'
;
import
React
,
{
useState
,
useCallback
,
useRef
,
useEffect
,
useContext
}
from
'react'
;
import
{
Input
,
Form
,
Typography
,
Button
,
Select
,
Row
,
Col
,
Popover
,
Checkbox
,
Tooltip
,
Table
,
Space
}
from
'antd'
;
import
{
Input
,
Form
,
Typography
,
Button
,
Select
,
Row
,
Col
,
Popover
,
Checkbox
,
Tooltip
,
Table
,
Space
}
from
'antd'
;
import
{
DeleteOutlined
,
CloseOutlined
,
CheckOutlined
,
PlusOutlined
,
QuestionCircleOutlined
}
from
'@ant-design/icons'
;
import
{
DeleteOutlined
,
CloseOutlined
,
CheckOutlined
,
PlusOutlined
,
QuestionCircleOutlined
}
from
'@ant-design/icons'
;
import
{
DndProvider
,
useDrag
,
useDrop
}
from
'react-dnd'
;
import
{
DndProvider
,
useDrag
,
useDrop
}
from
'react-dnd'
;
...
@@ -10,6 +10,7 @@ import { useContextMenu, Menu as RcMenu, Item as RcItem } from "react-contexify"
...
@@ -10,6 +10,7 @@ import { useContextMenu, Menu as RcMenu, Item as RcItem } from "react-contexify"
import
DebounceInput
from
'./DebounceInput'
;
import
DebounceInput
from
'./DebounceInput'
;
import
{
addEventListenerForSidebar
,
removeEventListenerForSidebar
}
from
'./Help'
;
import
{
addEventListenerForSidebar
,
removeEventListenerForSidebar
}
from
'./Help'
;
import
{
showMessage
,
highlightSearchContentByTerms
,
inputWidth
}
from
'../../../../util'
;
import
{
showMessage
,
highlightSearchContentByTerms
,
inputWidth
}
from
'../../../../util'
;
import
{
EditModelContext
}
from
'./ContextManage'
;
const
{
Option
}
=
Select
;
const
{
Option
}
=
Select
;
...
@@ -292,6 +293,8 @@ const ImportActionIndex = (props) => {
...
@@ -292,6 +293,8 @@ const ImportActionIndex = (props) => {
const
[
insertIndex
,
setInsertIndex
]
=
useState
(
0
);
const
[
insertIndex
,
setInsertIndex
]
=
useState
(
0
);
const
[
currentItem
,
setCurrentItem
]
=
useState
(
null
);
const
[
currentItem
,
setCurrentItem
]
=
useState
(
null
);
const
{
indexIsEditingFunction
}
=
useContext
(
EditModelContext
);
const
dataRef
=
useRef
();
const
dataRef
=
useRef
();
dataRef
.
current
=
data
;
dataRef
.
current
=
data
;
...
@@ -305,6 +308,11 @@ const ImportActionIndex = (props) => {
...
@@ -305,6 +308,11 @@ const ImportActionIndex = (props) => {
useClickAway
(()
=>
{
useClickAway
(()
=>
{
save
();
save
();
},
tableRef
);
},
tableRef
);
useEffect
(()
=>
{
indexIsEditingFunction
&&
indexIsEditingFunction
(
editingKey
!==
null
);
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[
editingKey
])
//规则改变的时候 数据表为可编辑状态
//规则改变的时候 数据表为可编辑状态
useEffect
(()
=>
{
useEffect
(()
=>
{
...
...
src/view/Manage/Model/Component/ImportActionTable.jsx
View file @
933a9743
import
React
,
{
useState
,
useCallback
,
useRef
,
useEffect
}
from
'react'
;
import
React
,
{
useState
,
useCallback
,
useRef
,
useEffect
,
useContext
}
from
'react'
;
import
{
Input
,
Form
,
Typography
,
Button
,
Select
,
Row
,
Col
,
Popover
,
Checkbox
,
Tooltip
,
Table
,
Pagination
,
Space
}
from
'antd'
;
import
{
Input
,
Form
,
Typography
,
Button
,
Select
,
Row
,
Col
,
Popover
,
Checkbox
,
Tooltip
,
Table
,
Pagination
,
Space
}
from
'antd'
;
import
{
CheckOutlined
,
PlusOutlined
,
QuestionCircleOutlined
,
DeleteOutlined
}
from
'@ant-design/icons'
;
import
{
CheckOutlined
,
PlusOutlined
,
QuestionCircleOutlined
,
DeleteOutlined
}
from
'@ant-design/icons'
;
import
{
DndProvider
,
useDrag
,
useDrop
}
from
'react-dnd'
;
import
{
DndProvider
,
useDrag
,
useDrop
}
from
'react-dnd'
;
...
@@ -16,6 +16,7 @@ import { AppContext } from '../../../../App';
...
@@ -16,6 +16,7 @@ import { AppContext } from '../../../../App';
import
DebounceInput
from
'./DebounceInput'
;
import
DebounceInput
from
'./DebounceInput'
;
import
SuggestTable
from
'./SuggestTable'
;
import
SuggestTable
from
'./SuggestTable'
;
import
{
AttentionSvg
,
UnAttentionSvg
}
from
'./ModelSvg'
;
import
{
AttentionSvg
,
UnAttentionSvg
}
from
'./ModelSvg'
;
import
{
EditModelContext
}
from
'./ContextManage'
;
import
'./ImportActionTable.less'
;
import
'./ImportActionTable.less'
;
...
@@ -298,6 +299,8 @@ const ImportActionTable = (props) => {
...
@@ -298,6 +299,8 @@ const ImportActionTable = (props) => {
const
[
insertIndex
,
setInsertIndex
]
=
useState
(
0
);
const
[
insertIndex
,
setInsertIndex
]
=
useState
(
0
);
const
[
currentItem
,
setCurrentItem
]
=
useState
(
null
);
const
[
currentItem
,
setCurrentItem
]
=
useState
(
null
);
const
{
attrIsEditingFunction
}
=
useContext
(
EditModelContext
);
const
moveRowRef
=
useRef
({
data
,
pageNum
,
pageSize
});
const
moveRowRef
=
useRef
({
data
,
pageNum
,
pageSize
});
const
tableRef
=
useRef
(
null
);
const
tableRef
=
useRef
(
null
);
const
termsRef
=
useRef
(
null
);
const
termsRef
=
useRef
(
null
);
...
@@ -515,6 +518,11 @@ const ImportActionTable = (props) => {
...
@@ -515,6 +518,11 @@ const ImportActionTable = (props) => {
save();
save();
}, tableRef);
}, tableRef);
useEffect(() => {
attrIsEditingFunction && attrIsEditingFunction(editingKey!=='');
//eslint-disable-next-line react-hooks/exhaustive-deps
}, [ editingKey ])
//规则改变的时候 数据表为可编辑状态
//规则改变的时候 数据表为可编辑状态
useEffect(() => {
useEffect(() => {
setEditingKey('');
setEditingKey('');
...
...
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