Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivManage
Project
Project
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
ReactWeb5
CivManage
Commits
8bd6355e
Commit
8bd6355e
authored
Apr 11, 2023
by
涂伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: '1.增加已附加字段取消附加功能2.运维表编辑内部字段删除按钮disabled'
parent
f6388316
Pipeline
#70774
passed with stages
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
12 deletions
+35
-12
TableView.jsx
...ages/bsmanager/base/tablemanager/components/TableView.jsx
+32
-11
TableView.less
...ges/bsmanager/base/tablemanager/components/TableView.less
+3
-1
No files found.
src/pages/bsmanager/base/tablemanager/components/TableView.jsx
View file @
8bd6355e
...
@@ -67,6 +67,7 @@ const EditableCell = ({
...
@@ -67,6 +67,7 @@ const EditableCell = ({
dataSource
,
dataSource
,
tableDataCount
,
tableDataCount
,
defaultData
,
defaultData
,
setDefaultData
,
...
restProps
...
restProps
})
=>
{
})
=>
{
const
[
editing
,
setEditing
]
=
useState
(
false
);
const
[
editing
,
setEditing
]
=
useState
(
false
);
...
@@ -85,7 +86,7 @@ const EditableCell = ({
...
@@ -85,7 +86,7 @@ const EditableCell = ({
[
dataIndex
]:
record
[
dataIndex
],
[
dataIndex
]:
record
[
dataIndex
],
});
});
}
}
},
[]);
},
[
dataSource
]);
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
editing
&&
inputRef
.
current
)
{
if
(
editing
&&
inputRef
.
current
)
{
...
@@ -125,6 +126,13 @@ const EditableCell = ({
...
@@ -125,6 +126,13 @@ const EditableCell = ({
[
dataIndex
]:
values
.
IsAddFieldConfig
,
[
dataIndex
]:
values
.
IsAddFieldConfig
,
});
});
handleSave
({
...
record
,
...
values
,
index
});
handleSave
({
...
record
,
...
values
,
index
});
let
defaultArr
=
JSON
.
parse
(
JSON
.
stringify
(
defaultData
));
defaultArr
.
forEach
(
item
=>
{
if
(
item
.
Name
===
record
.
Name
)
{
item
.
IsAddFieldConfig
=
values
.
IsAddFieldConfig
;
}
});
setDefaultData
(
defaultArr
);
};
};
const
rendeFrom
=
val
=>
{
const
rendeFrom
=
val
=>
{
...
@@ -596,15 +604,24 @@ const TableView = props => {
...
@@ -596,15 +604,24 @@ const TableView = props => {
}
}
setDataSource
(
list
);
setDataSource
(
list
);
};
};
const
deleteAddField
=
(
index
,
name
)
=>
{
const
deleteAddField
=
(
row
,
index
)
=>
{
let
arr
=
JSON
.
parse
(
JSON
.
stringify
(
dataSource
));
let
arr
=
JSON
.
parse
(
JSON
.
stringify
(
dataSource
));
arr
.
forEach
(
item
=>
{
arr
.
forEach
(
item
=>
{
if
(
item
.
Name
===
n
ame
)
{
if
(
item
.
Name
===
row
.
N
ame
)
{
item
.
IsAddFieldConfig
=
false
;
item
.
IsAddFieldConfig
=
false
;
}
}
});
});
console
.
log
(
arr
,
name
,
'arrarrarrarrarrarr'
);
if
(
!
showDefault
)
{
let
defaultArr
=
JSON
.
parse
(
JSON
.
stringify
(
defaultData
));
defaultArr
.
forEach
(
item
=>
{
if
(
item
.
Name
===
row
.
Name
)
{
item
.
IsAddFieldConfig
=
false
;
}
});
setDefaultData
(
defaultArr
);
}
setDataSource
(
arr
);
setDataSource
(
arr
);
// }
};
};
// 表格设置
// 表格设置
const
components
=
{
const
components
=
{
...
@@ -717,10 +734,16 @@ const TableView = props => {
...
@@ -717,10 +734,16 @@ const TableView = props => {
render
:
(
_
,
record
,
index
)
=>
render
:
(
_
,
record
,
index
)
=>
dataSource
.
length
>=
1
?
(
dataSource
.
length
>=
1
?
(
<
Tooltip
title=
"删除"
>
<
Tooltip
title=
"删除"
>
<
DeleteOutlined
<
Button
style=
{
{
border
:
'none'
,
padding
:
'4px 5px'
,
background
:
'none'
}
}
onClick=
{
()
=>
handleDelete
(
record
,
index
)
}
onClick=
{
()
=>
handleDelete
(
record
,
index
)
}
style=
{
{
fontSize
:
'16px'
,
color
:
`${record.ReadOnly ? '#ccc' : '#e86060'}`
}
}
disabled=
{
record
.
ReadOnly
}
/>
>
<
DeleteOutlined
style=
{
{
fontSize
:
'16px'
,
color
:
`${record.ReadOnly ? '#ccc' : '#e86060'}`
}
}
disabled=
{
record
.
ReadOnly
}
/>
</
Button
>
</
Tooltip
>
</
Tooltip
>
)
:
null
,
)
:
null
,
},
},
...
@@ -743,6 +766,7 @@ const TableView = props => {
...
@@ -743,6 +766,7 @@ const TableView = props => {
dataSource
,
dataSource
,
tableDataCount
,
tableDataCount
,
defaultData
,
defaultData
,
setDefaultData
,
handleSave
,
handleSave
,
}),
}),
};
};
...
@@ -858,10 +882,7 @@ const TableView = props => {
...
@@ -858,10 +882,7 @@ const TableView = props => {
item
.
IsAddFieldConfig
?
(
item
.
IsAddFieldConfig
?
(
<
div
className=
{
styles
.
subItem
}
>
<
div
className=
{
styles
.
subItem
}
>
<
span
>
{
item
.
Alias
||
item
.
Name
}
</
span
>
{
' '
}
<
span
>
{
item
.
Alias
||
item
.
Name
}
</
span
>
{
' '
}
<
span
<
span
className=
{
styles
.
deleteItem
}
onClick=
{
()
=>
deleteAddField
(
item
,
index
)
}
>
className=
{
styles
.
deleteItem
}
onClick=
{
()
=>
deleteAddField
(
index
,
item
.
Name
)
}
>
X
X
</
span
>
</
span
>
</
div
>
</
div
>
...
...
src/pages/bsmanager/base/tablemanager/components/TableView.less
View file @
8bd6355e
...
@@ -40,7 +40,9 @@
...
@@ -40,7 +40,9 @@
// cursor: pointer;
// cursor: pointer;
// }
// }
.deleteItem {
.deleteItem {
display: none;
&:hover {
cursor: pointer;
}
}
}
}
}
}
}
...
...
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