Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
najiu-admin-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
najiu-frontend
najiu-admin-template
Commits
a0681cca
Commit
a0681cca
authored
Dec 31, 2020
by
vben
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(demo): fix demo error
parent
09c9f8a8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
18 deletions
+21
-18
index.ts
src/components/Table/src/components/editable/index.ts
+11
-9
PersonTable.vue
src/views/demo/page/form/high/PersonTable.vue
+10
-9
No files found.
src/components/Table/src/components/editable/index.ts
View file @
a0681cca
...
@@ -41,7 +41,8 @@ export function renderEditCell(column: BasicColumn) {
...
@@ -41,7 +41,8 @@ export function renderEditCell(column: BasicColumn) {
};
};
}
}
export
type
EditRecordRow
<
T
=
Hash
<
any
>>
=
{
export
type
EditRecordRow
<
T
=
Hash
<
any
>>
=
Partial
<
{
onEdit
:
(
editable
:
boolean
,
submit
?:
boolean
)
=>
Promise
<
boolean
>
;
onEdit
:
(
editable
:
boolean
,
submit
?:
boolean
)
=>
Promise
<
boolean
>
;
editable
:
boolean
;
editable
:
boolean
;
onCancel
:
Fn
;
onCancel
:
Fn
;
...
@@ -49,4 +50,5 @@ export type EditRecordRow<T = Hash<any>> = {
...
@@ -49,4 +50,5 @@ export type EditRecordRow<T = Hash<any>> = {
submitCbs
:
Fn
[];
submitCbs
:
Fn
[];
cancelCbs
:
Fn
[];
cancelCbs
:
Fn
[];
validCbs
:
Fn
[];
validCbs
:
Fn
[];
}
&
T
;
}
&
T
>
;
src/views/demo/page/form/high/PersonTable.vue
View file @
a0681cca
...
@@ -16,7 +16,6 @@
...
@@ -16,7 +16,6 @@
TableAction
,
TableAction
,
BasicColumn
,
BasicColumn
,
ActionItem
,
ActionItem
,
renderEditableRow
,
EditTableHeaderIcon
,
EditTableHeaderIcon
,
EditRecordRow
,
EditRecordRow
,
}
from
'
/@/components/Table
'
;
}
from
'
/@/components/Table
'
;
...
@@ -25,17 +24,21 @@
...
@@ -25,17 +24,21 @@
{
{
title
:
'
成员姓名
'
,
title
:
'
成员姓名
'
,
dataIndex
:
'
name
'
,
dataIndex
:
'
name
'
,
customRender
:
renderEditableRow
({
dataIndex
:
'
name
'
,
placeholder
:
'
请输入成员姓名
'
})
,
editRow
:
true
,
},
},
{
{
title
:
'
工号
'
,
title
:
'
工号
'
,
dataIndex
:
'
no
'
,
dataIndex
:
'
no
'
,
customRender
:
renderEditableRow
({
dataIndex
:
'
no
'
,
placeholder
:
'
请输入工号
'
}),
editRow
:
true
,
// customRender: renderEditableRow({ dataIndex: 'no', placeholder: '请输入工号' }),
},
},
{
{
title
:
'
所属部门
'
,
title
:
'
所属部门
'
,
dataIndex
:
'
dept
'
,
dataIndex
:
'
dept
'
,
customRender
:
renderEditableRow
({
dataIndex
:
'
dept
'
,
placeholder
:
'
请输入所属部门
'
}),
editRow
:
true
,
// customRender: renderEditableRow({ dataIndex: 'dept', placeholder: '请输入所属部门' }),
},
},
];
];
...
@@ -73,12 +76,11 @@
...
@@ -73,12 +76,11 @@
});
});
function
handleEdit
(
record
:
EditRecordRow
)
{
function
handleEdit
(
record
:
EditRecordRow
)
{
record
.
editable
=
true
;
record
.
onEdit
?.(
true
)
;
}
}
function
handleCancel
(
record
:
EditRecordRow
)
{
function
handleCancel
(
record
:
EditRecordRow
)
{
record
.
editable
=
false
;
record
.
onEdit
?.(
false
);
record
.
onCancel
&&
record
.
onCancel
();
if
(
record
.
isNew
)
{
if
(
record
.
isNew
)
{
const
data
=
getDataSource
();
const
data
=
getDataSource
();
const
index
=
data
.
findIndex
((
item
)
=>
item
.
key
===
record
.
key
);
const
index
=
data
.
findIndex
((
item
)
=>
item
.
key
===
record
.
key
);
...
@@ -87,8 +89,7 @@
...
@@ -87,8 +89,7 @@
}
}
function
handleSave
(
record
:
EditRecordRow
)
{
function
handleSave
(
record
:
EditRecordRow
)
{
record
.
editable
=
false
;
record
.
onEdit
?.(
false
,
true
);
record
.
onSubmit
&&
record
.
onSubmit
();
}
}
function
handleAdd
()
{
function
handleAdd
()
{
...
...
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