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
1c129d4d
Commit
1c129d4d
authored
Jul 14, 2022
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增主数据
parent
5f641bdf
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
109 additions
and
0 deletions
+109
-0
DataMasterTable.jsx
src/view/Manage/DataMaster/Component/DataMasterTable.jsx
+42
-0
Mock.js
src/view/Manage/DataMaster/Component/Mock.js
+9
-0
UpdateDataMasterModal.jsx
...iew/Manage/DataMaster/Component/UpdateDataMasterModal.jsx
+58
-0
UpdateDataMasterModal.less
...ew/Manage/DataMaster/Component/UpdateDataMasterModal.less
+0
-0
No files found.
src/view/Manage/DataMaster/Component/DataMasterTable.jsx
View file @
1c129d4d
import
{
useMemo
,
useState
}
from
'react'
;
import
{
useMemo
,
useState
}
from
'react'
;
import
{
Space
,
Button
,
Input
}
from
'antd'
;
import
{
Space
,
Button
,
Input
}
from
'antd'
;
import
{
useContextMenu
,
Menu
as
RcMenu
,
Item
as
RcItem
}
from
"react-contexify"
;
import
ResizeableTable
from
'../../ResizeableTable'
;
import
ResizeableTable
from
'../../ResizeableTable'
;
import
DebounceInput
from
'../../Model/Component/DebounceInput'
;
import
DebounceInput
from
'../../Model/Component/DebounceInput'
;
import
UpdateTemplateModal
from
'./UpdateTemplateModal'
;
import
UpdateTemplateModal
from
'./UpdateTemplateModal'
;
import
UpdateDataMasterModal
from
'./UpdateDataMasterModal'
;
import
{
inputWidth
}
from
'../../../../util'
;
import
{
inputWidth
}
from
'../../../../util'
;
import
DataMasterExpandedTable
from
'./DataMasterExpandedTable'
;
import
DataMasterExpandedTable
from
'./DataMasterExpandedTable'
;
import
{
tableData
}
from
'./Mock'
;
import
{
tableData
}
from
'./Mock'
;
import
'./DataMasterTable.less'
;
import
'./DataMasterTable.less'
;
import
'react-contexify/dist/ReactContexify.css'
;
const
InputDebounce
=
DebounceInput
(
300
)(
Input
);
const
InputDebounce
=
DebounceInput
(
300
)(
Input
);
...
@@ -16,6 +19,8 @@ const DataMasterTable = (props) => {
...
@@ -16,6 +19,8 @@ const DataMasterTable = (props) => {
const
[
keyword
,
setKeyword
]
=
useState
(
''
);
const
[
keyword
,
setKeyword
]
=
useState
(
''
);
const
[
checkedKeys
,
setCheckedKeys
]
=
useState
([]);
const
[
checkedKeys
,
setCheckedKeys
]
=
useState
([]);
const
[
isTemplateModalVisible
,
setIsTemplateModalVisible
]
=
useState
(
false
);
const
[
isTemplateModalVisible
,
setIsTemplateModalVisible
]
=
useState
(
false
);
const
[
isDataMasterModalVisible
,
setIsDataMasterModalVisible
]
=
useState
(
false
);
const
[
currentTemplate
,
setCurrentTemplate
]
=
useState
({});
const
columns
=
useMemo
(()
=>
{
const
columns
=
useMemo
(()
=>
{
return
([
return
([
...
@@ -67,6 +72,11 @@ const DataMasterTable = (props) => {
...
@@ -67,6 +72,11 @@ const DataMasterTable = (props) => {
]);
]);
},
[]);
},
[]);
const
MENU_ID
=
'data-master-table-contextmenu'
;
const
{
show
}
=
useContextMenu
({
id
:
MENU_ID
,
});
const
onAddClick
=
()
=>
{
const
onAddClick
=
()
=>
{
setIsTemplateModalVisible
(
true
);
setIsTemplateModalVisible
(
true
);
}
}
...
@@ -87,6 +97,18 @@ const DataMasterTable = (props) => {
...
@@ -87,6 +97,18 @@ const DataMasterTable = (props) => {
setCheckedKeys
(
keys
);
setCheckedKeys
(
keys
);
};
};
const
handleItemClick
=
({
event
,
props
,
data
,
triggerEvent
})
=>
{
const
key
=
event
.
currentTarget
.
id
;
if
(
key
===
'add'
)
{
setIsDataMasterModalVisible
(
true
);
}
}
const
onDataMasterModalCancel
=
()
=>
{
setIsDataMasterModalVisible
(
false
);
}
const
rowSelection
=
{
const
rowSelection
=
{
selectedRowKeys
:
checkedKeys
,
selectedRowKeys
:
checkedKeys
,
onChange
:
onTableSelectChange
,
onChange
:
onTableSelectChange
,
...
@@ -122,6 +144,14 @@ const DataMasterTable = (props) => {
...
@@ -122,6 +144,14 @@ const DataMasterTable = (props) => {
expandedRowRender
:
record
=>
<
DataMasterExpandedTable
/>,
expandedRowRender
:
record
=>
<
DataMasterExpandedTable
/>,
rowExpandable
:
record
=>
true
,
rowExpandable
:
record
=>
true
,
}
}
}
}
onRow=
{
(
record
)
=>
{
return
{
onContextMenu
:
event
=>
{
setCurrentTemplate
(
record
);
show
(
event
);
},
};
}
}
scroll=
{
{
y
:
'calc(100vh - 94px - 37px - 57px - 24px - 32px)'
}
}
scroll=
{
{
y
:
'calc(100vh - 94px - 37px - 57px - 24px - 32px)'
}
}
/>
/>
</
div
>
</
div
>
...
@@ -130,6 +160,18 @@ const DataMasterTable = (props) => {
...
@@ -130,6 +160,18 @@ const DataMasterTable = (props) => {
visible=
{
isTemplateModalVisible
}
visible=
{
isTemplateModalVisible
}
onCancel=
{
onTemplateModalCancel
}
onCancel=
{
onTemplateModalCancel
}
/>
/>
<
UpdateDataMasterModal
visible=
{
isDataMasterModalVisible
}
template=
{
currentTemplate
}
onCancel=
{
onDataMasterModalCancel
}
/>
<
RcMenu
id=
{
MENU_ID
}
>
<
RcItem
id=
"add"
onClick=
{
handleItemClick
}
>
新增主数据
</
RcItem
>
</
RcMenu
>
</
div
>
</
div
>
);
);
}
}
...
...
src/view/Manage/DataMaster/Component/Mock.js
View file @
1c129d4d
...
@@ -139,6 +139,15 @@ export const tableData = [
...
@@ -139,6 +139,15 @@ export const tableData = [
},
},
];
];
export
const
attrs
=
[
'attr1'
,
'attr2'
,
'attr3'
,
'attr4'
,
'attr5'
,
'attr6'
,
];
export
const
expandedTableData
=
[
export
const
expandedTableData
=
[
{
{
id
:
'1'
,
id
:
'1'
,
...
...
src/view/Manage/DataMaster/Component/UpdateDataMasterModal.jsx
0 → 100644
View file @
1c129d4d
import
{
Modal
,
Form
,
Input
}
from
"antd"
;
import
{
attrs
}
from
"./Mock"
;
import
'./UpdateDataMasterModal.less'
;
const
UpdateTemplateModal
=
(
props
)
=>
{
const
{
visible
,
onCancel
,
template
}
=
props
;
const
[
form
]
=
Form
.
useForm
();
const
formItemLayout
=
{
labelCol
:
{
xs
:
{
span
:
24
},
sm
:
{
span
:
6
},
},
wrapperCol
:
{
xs
:
{
span
:
24
},
sm
:
{
span
:
18
},
},
};
const
onFormFinish
=
async
()
=>
{
try
{
await
form
.
validateFields
();
// const row = await form.validateFields();
onCancel
&&
onCancel
();
}
catch
(
errInfo
)
{
console
.
log
(
'Validate Failed:'
,
errInfo
);
}
}
return
(
<
Modal
className=
'update-data-master-modal'
title=
'新建主数据'
visible=
{
visible
}
onCancel=
{
onCancel
}
onOk=
{
onFormFinish
}
>
<
Form
form=
{
form
}
{
...
formItemLayout
}
>
{
attrs
.
map
((
item
,
index
)
=>
{
return
(
<
Form
.
Item
key=
{
index
}
label=
{
item
}
name=
{
item
}
rules=
{
[{
required
:
true
}]
}
>
<
Input
/>
</
Form
.
Item
>
)
})
}
</
Form
>
</
Modal
>
);
}
export
default
UpdateTemplateModal
;
\ No newline at end of file
src/view/Manage/DataMaster/Component/UpdateDataMasterModal.less
0 → 100644
View file @
1c129d4d
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