Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
submodule
Project
Project
Details
Activity
Releases
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
web_component
submodule
Commits
3b0be895
Commit
3b0be895
authored
Dec 15, 2020
by
zhangwenshuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加行锁定
parent
cee48c4a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
16 deletions
+20
-16
Cell.tsx
components/apolloTable/component/Cell.tsx
+20
-16
No files found.
components/apolloTable/component/Cell.tsx
View file @
3b0be895
...
@@ -60,7 +60,7 @@ const Cell = (props: CellProps) => {
...
@@ -60,7 +60,7 @@ const Cell = (props: CellProps) => {
}
}
};
};
const
turnIntoEditStatus
=
(
data
:
any
)
=>
{
const
turnIntoEditStatus
=
(
data
:
any
)
=>
{
setStatus
(
'edit'
);
setStatus
(
'edit'
);
if
(
typeof
onEmitMsg
===
'function'
)
{
if
(
typeof
onEmitMsg
===
'function'
)
{
onEmitMsg
({
...
data
,
status
:
EDIT_STATUS
.
EDITING
});
onEmitMsg
({
...
data
,
status
:
EDIT_STATUS
.
EDITING
});
...
@@ -80,9 +80,10 @@ const Cell = (props: CellProps) => {
...
@@ -80,9 +80,10 @@ const Cell = (props: CellProps) => {
return
;
return
;
}
}
let
temp
:
CellDataProps
[]
=
[];
let
temp
:
CellDataProps
[]
=
[];
cellData
&&
cellData
.
map
((
item
:
CellDataProps
)
=>
{
cellData
&&
temp
.
push
({
text
:
item
.
text
,
value
:
item
.
value
});
cellData
.
map
((
item
:
CellDataProps
)
=>
{
});
temp
.
push
({
text
:
item
.
text
,
value
:
item
.
value
});
});
if
(
temp
.
length
===
0
)
{
if
(
temp
.
length
===
0
)
{
temp
=
emptyModel
;
temp
=
emptyModel
;
}
}
...
@@ -132,8 +133,8 @@ const Cell = (props: CellProps) => {
...
@@ -132,8 +133,8 @@ const Cell = (props: CellProps) => {
const
{
current
=
1
,
pageSize
=
20
}
=
paginationConfig
||
{};
const
{
current
=
1
,
pageSize
=
20
}
=
paginationConfig
||
{};
// 构造序号
// 构造序号
const
getIndex
=
()
=>
{
const
getIndex
=
()
=>
{
if
(
typeof
showIndex
===
'function'
)
{
if
(
typeof
showIndex
===
'function'
)
{
return
showIndex
(
props
)
return
showIndex
(
props
)
;
}
}
return
(
current
-
1
)
*
pageSize
+
rowIndex
+
1
;
return
(
current
-
1
)
*
pageSize
+
rowIndex
+
1
;
};
};
...
@@ -196,9 +197,7 @@ const Cell = (props: CellProps) => {
...
@@ -196,9 +197,7 @@ const Cell = (props: CellProps) => {
/>
/>
</
div
>
</
div
>
)
}
)
}
{
{
renderFirstLeft
&&
renderFirstLeft
({
record
})
}
renderFirstLeft
&&
renderFirstLeft
({
record
})
}
</
div
>
</
div
>
);
);
};
};
...
@@ -225,7 +224,7 @@ const Cell = (props: CellProps) => {
...
@@ -225,7 +224,7 @@ const Cell = (props: CellProps) => {
}
else
{
}
else
{
detailConfig
=
config
[
String
(
columnType
)]
||
config
[
'1'
];
detailConfig
=
config
[
String
(
columnType
)]
||
config
[
'1'
];
}
}
if
(
Number
(
columnType
)
===
8
)
{
if
(
Number
(
columnType
)
===
8
)
{
empty
=
false
;
empty
=
false
;
}
}
const
DetailComp
:
any
=
detailConfig
.
detailComp
;
const
DetailComp
:
any
=
detailConfig
.
detailComp
;
...
@@ -243,12 +242,17 @@ const Cell = (props: CellProps) => {
...
@@ -243,12 +242,17 @@ const Cell = (props: CellProps) => {
<
div
<
div
className=
{
s
.
detailCell
}
className=
{
s
.
detailCell
}
onClick=
{
()
=>
{
onClick=
{
()
=>
{
// 不可编辑状态
// 不可编辑状态(无编辑权限、列只读、行锁定、单元格只读)
if
(
!
cellEditable
||
readOnlyFlag
||
(
dynamicCellConfigDTO
&&
dynamicCellConfigDTO
.
readonlyFlag
))
{
if
(
!
cellEditable
||
readOnlyFlag
||
record
.
isLocked
||
(
dynamicCellConfigDTO
&&
dynamicCellConfigDTO
.
readonlyFlag
)
)
{
return
false
;
return
false
;
}
}
// 获取当前节点的选中状态
// 获取当前节点的选中状态
const
dom
:
any
=
cellUnit
.
current
;
const
dom
:
any
=
cellUnit
.
current
;
let
selected
=
false
;
let
selected
=
false
;
if
(
dom
&&
dom
.
getAttribute
(
'data-selected-cell'
))
{
if
(
dom
&&
dom
.
getAttribute
(
'data-selected-cell'
))
{
selected
=
dom
.
getAttribute
(
'data-selected-cell'
)
===
'1'
;
selected
=
dom
.
getAttribute
(
'data-selected-cell'
)
===
'1'
;
...
@@ -264,9 +268,9 @@ const Cell = (props: CellProps) => {
...
@@ -264,9 +268,9 @@ const Cell = (props: CellProps) => {
// 否则进入选中状态
// 否则进入选中状态
if
(
dom
)
{
if
(
dom
)
{
// 先清除所有dom的选中状态及样式
// 先清除所有dom的选中状态及样式
const
doms
:
any
=
document
.
querySelectorAll
(
`.cellUnit.table_${tableId}`
);
const
doms
:
any
=
document
.
querySelectorAll
(
`.cellUnit.table_${tableId}`
);
if
(
doms
)
{
if
(
doms
)
{
doms
.
forEach
((
item
:
any
)
=>
{
doms
.
forEach
((
item
:
any
)
=>
{
item
.
setAttribute
(
'data-selected-cell'
,
'0'
);
item
.
setAttribute
(
'data-selected-cell'
,
'0'
);
item
.
classList
.
remove
(
s
.
selected
);
item
.
classList
.
remove
(
s
.
selected
);
});
});
...
@@ -403,7 +407,7 @@ const Cell = (props: CellProps) => {
...
@@ -403,7 +407,7 @@ const Cell = (props: CellProps) => {
onMouseEnter=
{
onMouseEnter
}
onMouseEnter=
{
onMouseEnter
}
onMouseLeave=
{
onMouseLeave
}
onMouseLeave=
{
onMouseLeave
}
>
>
{
columnIndex
===
0
&&
position
!==
'right'
&&
renderFirst
()
}
{
columnIndex
===
0
&&
position
!==
'right'
&&
renderFirst
()
}
<
div
<
div
id=
{
`cellUnit_${tableId}_${record.id}_${columnName}`
}
id=
{
`cellUnit_${tableId}_${record.id}_${columnName}`
}
className=
{
classNames
(
className=
{
classNames
(
...
...
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