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
e1fb04ff
Commit
e1fb04ff
authored
Dec 04, 2021
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加分区配置
parent
e4a71920
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
350 additions
and
4 deletions
+350
-4
datamodel.js
src/model/datamodel.js
+10
-2
datamodeler.js
src/service/datamodeler.js
+10
-2
ImportAction.jsx
src/view/Manage/Model/Component/ImportAction.jsx
+3
-0
PartitionCURD.jsx
src/view/Manage/ModelConfig/Component/PartitionCURD.jsx
+202
-0
UpdatePartitionModal.jsx
...iew/Manage/ModelConfig/Component/UpdatePartitionModal.jsx
+121
-0
index.jsx
src/view/Manage/ModelConfig/index.jsx
+4
-0
No files found.
src/model/datamodel.js
View file @
e1fb04ff
...
@@ -86,8 +86,16 @@ export function* modelCopy(payload) {
...
@@ -86,8 +86,16 @@ export function* modelCopy(payload) {
return
yield
call
(
datamodelerService
.
modelCopy
,
payload
);
return
yield
call
(
datamodelerService
.
modelCopy
,
payload
);
}
}
export
function
*
getSupportedPartitionTypes
()
{
export
function
*
getSupportedPartitionTypes
(
payload
)
{
return
yield
call
(
datamodelerService
.
getSupportedPartitionTypes
);
return
yield
call
(
datamodelerService
.
getSupportedPartitionTypes
,
payload
);
}
export
function
*
savePartitionType
(
payload
)
{
return
yield
call
(
datamodelerService
.
savePartitionType
,
payload
);
}
export
function
*
deletePartitionType
(
payload
)
{
return
yield
call
(
datamodelerService
.
deletePartitionType
,
payload
);
}
}
export
function
*
extractExcelContent
(
payload
)
{
export
function
*
extractExcelContent
(
payload
)
{
...
...
src/service/datamodeler.js
View file @
e1fb04ff
...
@@ -43,8 +43,16 @@ export function modelCopy(payload) {
...
@@ -43,8 +43,16 @@ export function modelCopy(payload) {
return
GetJSON
(
"/datamodeler/easyDataModelerCURD/copy"
,
payload
);
return
GetJSON
(
"/datamodeler/easyDataModelerCURD/copy"
,
payload
);
}
}
export
function
getSupportedPartitionTypes
()
{
export
function
getSupportedPartitionTypes
(
payload
)
{
return
GetJSON
(
"/datamodeler/easyDataModelerCURD/getSupportedPartitionTypes"
);
return
GetJSON
(
"/datamodeler/easyDataModelerCURD/getSupportedPartitionTypes"
,
payload
);
}
export
function
savePartitionType
(
payload
)
{
return
PostJSON
(
"/datamodeler/easyDataModelerCURD/savePartitionType"
,
payload
);
}
export
function
deletePartitionType
(
payload
)
{
return
PostJSON
(
"/datamodeler/easyDataModelerCURD/deletePartitionType"
,
payload
);
}
}
export
function
extractExcelContent
(
payload
)
{
export
function
extractExcelContent
(
payload
)
{
...
...
src/view/Manage/Model/Component/ImportAction.jsx
View file @
e1fb04ff
...
@@ -259,6 +259,9 @@ const ImportAction = (props) => {
...
@@ -259,6 +259,9 @@ const ImportAction = (props) => {
const
getSupportedPartitionTypes
=
()
=>
{
const
getSupportedPartitionTypes
=
()
=>
{
dispatch
({
dispatch
({
type
:
'datamodel.getSupportedPartitionTypes'
,
type
:
'datamodel.getSupportedPartitionTypes'
,
payload
:
{
excludeBuiltin
:
false
},
callback
:
data
=>
{
callback
:
data
=>
{
setSupportedPartitionTypes
(
data
||
[]);
setSupportedPartitionTypes
(
data
||
[]);
}
}
...
...
src/view/Manage/ModelConfig/Component/PartitionCURD.jsx
0 → 100644
View file @
e1fb04ff
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Table
,
Button
,
Tooltip
,
Modal
,
Divider
}
from
'antd'
;
import
{
Action
,
TemplateId
}
from
'../../../../util/constant'
;
import
{
dispatch
}
from
'../../../../model'
;
import
{
showMessage
}
from
'../../../../util'
;
import
UpdatePartitionModal
from
'./UpdatePartitionModal'
;
const
PartitionCURD
=
(
props
)
=>
{
const
[
partitions
,
setPartitions
]
=
useState
([]);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
actionData
,
setActionData
]
=
useState
({
action
:
''
,
updataPartitionModalVisible
:
false
,
item
:
null
});
const
{
action
,
updataPartitionModalVisible
,
item
}
=
actionData
;
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
();
useEffect
(()
=>
{
getPartitions
();
},
[])
const
columns
=
[
{
title
:
'序号'
,
dataIndex
:
'key'
,
editable
:
false
,
render
:
(
text
,
record
,
index
)
=>
{
return
(
index
+
1
).
toString
();
},
width
:
60
,
},
{
title
:
'分区名称'
,
dataIndex
:
'name'
,
width
:
180
,
ellipsis
:
true
,
render
:
(
text
,
_
,
__
)
=>
{
return
(
<
Tooltip
title=
{
text
||
''
}
>
<
span
>
{
text
||
''
}
</
span
>
</
Tooltip
>
)
}
},
{
title
:
'分区中文名称'
,
dataIndex
:
'cnName'
,
width
:
180
,
ellipsis
:
true
,
render
:
(
text
,
_
,
__
)
=>
{
return
(
<
Tooltip
title=
{
text
||
''
}
>
<
span
>
{
text
||
''
}
</
span
>
</
Tooltip
>
)
}
},
{
title
:
'定义'
,
dataIndex
:
'definition'
,
width
:
180
,
ellipsis
:
true
,
render
:
(
text
,
_
,
__
)
=>
{
return
(
<
Tooltip
title=
{
text
||
''
}
>
<
span
>
{
text
||
''
}
</
span
>
</
Tooltip
>
)
}
},
{
title
:
'描述'
,
dataIndex
:
'remark'
,
width
:
180
,
ellipsis
:
true
,
render
:
(
text
,
_
,
__
)
=>
{
return
(
<
Tooltip
title=
{
text
||
''
}
>
<
span
>
{
text
||
''
}
</
span
>
</
Tooltip
>
)
}
},
{
title
:
'操作'
,
key
:
'action'
,
width
:
120
,
render
:
(
text
,
record
)
=>
{
return
(
<
div
style=
{
{
display
:
'flex'
,
alignItems
:
'center'
}
}
>
<
Button
type=
'link'
size=
'small'
onClick=
{
()
=>
{
editItem
(
record
);
}
}
style=
{
{
padding
:
0
}
}
>
编辑
</
Button
>
<
div
style=
{
{
margin
:
'0 5px'
}
}
>
<
Divider
type=
'vertical'
/>
</
div
>
<
Button
type=
'link'
size=
'small'
onClick=
{
()
=>
{
deleteItem
(
record
);
}
}
style=
{
{
padding
:
0
}
}
>
删除
</
Button
>
</
div
>
)
}
}
];
const
getPartitions
=
()
=>
{
setLoading
(
true
);
dispatch
({
type
:
'datamodel.getSupportedPartitionTypes'
,
payload
:
{
excludeBuiltin
:
true
},
callback
:
data
=>
{
setPartitions
(
data
||
[]);
setLoading
(
false
);
},
error
:
()
=>
{
setLoading
(
false
);
}
})
}
const
editItem
=
(
record
)
=>
{
setActionData
({...
actionData
,
...{
action
:
'edit'
,
updataPartitionModalVisible
:
true
,
item
:
record
}});
}
const
deleteItem
=
(
record
)
=>
{
modal
.
confirm
({
title
:
'提示!'
,
content
:
'您确定要删除该分区吗?'
,
onOk
:
()
=>
{
dispatch
({
type
:
'datamodel.deletePartitionType'
,
payload
:
{
params
:
{
id
:
record
.
id
}
},
callback
:
()
=>
{
showMessage
(
'success'
,
'模版分区成功'
);
getPartitions
();
}
})
}
});
}
const
onAddClick
=
()
=>
{
setActionData
({...
actionData
,
...{
action
:
'add'
,
updataPartitionModalVisible
:
true
}});
}
const
onUpdatePartitionModalCancel
=
(
refresh
=
false
)
=>
{
setActionData
({...
actionData
,
updataPartitionModalVisible
:
false
}
);
refresh
&&
getPartitions
();
}
return
(
<
div
>
<
div
className=
'd-flex mb-3'
style=
{
{
alignItems
:
'center'
}
}
>
<
Button
onClick=
{
onAddClick
}
>
新建
</
Button
>
</
div
>
<
Table
loading=
{
loading
}
columns=
{
columns
}
rowKey=
{
'id'
}
dataSource=
{
partitions
||
[]
}
pagination=
{
false
}
sticky
/>
<
UpdatePartitionModal
visible=
{
updataPartitionModalVisible
}
action=
{
action
}
item=
{
item
}
onCancel=
{
onUpdatePartitionModalCancel
}
/>
{
contextHolder
}
</
div
>
);
}
export
default
PartitionCURD
;
\ No newline at end of file
src/view/Manage/ModelConfig/Component/UpdatePartitionModal.jsx
0 → 100644
View file @
e1fb04ff
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Modal
,
Form
,
Input
}
from
'antd'
;
import
{
dispatch
}
from
'../../../../model'
;
import
{
showNotifaction
}
from
'../../../../util'
;
const
UpdatePartitionModal
=
(
props
)
=>
{
const
{
visible
,
onCancel
,
item
,
action
=
'add'
}
=
props
;
const
[
form
]
=
Form
.
useForm
();
const
[
confirmLoading
,
setConfirmLoading
]
=
useState
(
false
);
const
formItemLayout
=
{
labelCol
:
{
xs
:
{
span
:
24
},
sm
:
{
span
:
4
},
},
wrapperCol
:
{
xs
:
{
span
:
24
},
sm
:
{
span
:
20
},
},
};
useEffect
(()
=>
{
if
(
visible
)
{
if
(
action
!==
'add'
)
{
form
.
setFieldsValue
({
name
:
item
?.
name
||
''
,
cnName
:
item
?.
cnName
||
''
,
definition
:
item
?.
definition
||
''
,
remark
:
item
?.
remark
||
''
});
}
}
},
[
visible
])
const
handleOk
=
async
()
=>
{
try
{
const
values
=
await
form
.
validateFields
();
let
newItem
=
null
;
if
(
action
===
'add'
)
{
newItem
=
{...
values
};
}
else
{
newItem
=
{...
item
,
...
values
};
}
setConfirmLoading
(
true
);
dispatch
({
type
:
'datamodel.savePartitionType'
,
payload
:
{
data
:
newItem
},
callback
:
data
=>
{
setConfirmLoading
(
false
);
reset
();
onCancel
&&
onCancel
(
true
);
},
error
:
()
=>
{
setConfirmLoading
(
false
);
}
})
}
catch
(
errInfo
)
{
}
}
const
reset
=
()
=>
{
setConfirmLoading
(
false
);
form
.
resetFields
();
}
return
(
<
Modal
forceRender
visible=
{
visible
}
title=
{
action
===
'add'
?
'新增分区'
:
'编辑分区'
}
width=
{
520
}
confirmLoading=
{
confirmLoading
}
onCancel=
{
()
=>
{
reset
();
onCancel
&&
onCancel
();
}
}
onOk=
{
handleOk
}
>
<
Form
{
...
formItemLayout
}
form=
{
form
}
>
<
Form
.
Item
label=
"名称"
name=
"name"
rules=
{
[{
required
:
true
,
message
:
'请输入分区名称'
}]
}
>
<
Input
/>
</
Form
.
Item
>
<
Form
.
Item
label=
"中文名称"
name=
"cnName"
rules=
{
[{
required
:
true
,
message
:
'请输入分区中文名称'
}]
}
>
<
Input
/>
</
Form
.
Item
>
<
Form
.
Item
label=
"定义"
name=
"definition"
>
<
Input
/>
</
Form
.
Item
>
<
Form
.
Item
label=
"描述"
name=
"remark"
>
<
Input
.
TextArea
row=
{
4
}
/>
</
Form
.
Item
>
</
Form
>
</
Modal
>
);
}
export
default
UpdatePartitionModal
;
\ No newline at end of file
src/view/Manage/ModelConfig/index.jsx
View file @
e1fb04ff
...
@@ -4,6 +4,7 @@ import { Tabs } from 'antd';
...
@@ -4,6 +4,7 @@ import { Tabs } from 'antd';
import
WordTemplate
from
'./Component/WordTemplate'
;
import
WordTemplate
from
'./Component/WordTemplate'
;
import
TemplateCURD
from
'./Component/TemplateCURD'
;
import
TemplateCURD
from
'./Component/TemplateCURD'
;
import
ConstraintDetail
from
'./Component/ConstraintDetail'
;
import
ConstraintDetail
from
'./Component/ConstraintDetail'
;
import
PartitionCURD
from
'./Component/PartitionCURD'
;
import
'./index.less'
;
import
'./index.less'
;
...
@@ -28,6 +29,9 @@ const ModelConfig = () => {
...
@@ -28,6 +29,9 @@ const ModelConfig = () => {
<
TabPane
tab=
'规范配置'
key=
'3'
>
<
TabPane
tab=
'规范配置'
key=
'3'
>
<
ConstraintDetail
/>
<
ConstraintDetail
/>
</
TabPane
>
</
TabPane
>
<
TabPane
tab=
'分区配置'
key=
'4'
>
<
PartitionCURD
/>
</
TabPane
>
</
Tabs
>
</
Tabs
>
</
div
>
</
div
>
)
)
...
...
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