mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-03 12:38:53 +08:00
fix:input-table删除行记录动作问题
This commit is contained in:
parent
c9fd4e3766
commit
6122306498
@ -1718,17 +1718,31 @@ export class TableControlRenderer extends FormTable {
|
|||||||
const items = [...this.state.items];
|
const items = [...this.state.items];
|
||||||
let rawItems: any = [];
|
let rawItems: any = [];
|
||||||
const deletedItems: any = [];
|
const deletedItems: any = [];
|
||||||
|
// 过滤掉无意义的索引
|
||||||
if (args.index) {
|
const indexArr = String(args?.index)
|
||||||
const indexArr = args.index.split(',');
|
.split(',')
|
||||||
rawItems = items.filter(
|
.map(i => String(i).trim())
|
||||||
(item, index) => !indexArr.includes(index.toString())
|
.filter(
|
||||||
|
i =>
|
||||||
|
i !== 'undefined' &&
|
||||||
|
i !== '' &&
|
||||||
|
parseInt(i, 10) >= 0 &&
|
||||||
|
parseInt(i, 10) < items.length
|
||||||
);
|
);
|
||||||
} else if (args.condition) {
|
|
||||||
|
if (!indexArr.length && !args?.condition) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (indexArr.length) {
|
||||||
|
rawItems = items.filter(
|
||||||
|
(item, index) => !indexArr.includes(String(index))
|
||||||
|
);
|
||||||
|
} else if (args?.condition) {
|
||||||
const itemsLength = items.length;
|
const itemsLength = items.length;
|
||||||
for (let i = 0; i < itemsLength; i++) {
|
for (let i = 0; i < itemsLength; i++) {
|
||||||
const flag = await evalExpressionWithConditionBuilder(
|
const flag = await evalExpressionWithConditionBuilder(
|
||||||
args?.condition,
|
args.condition,
|
||||||
{...items[i], rowIndex: i}
|
{...items[i], rowIndex: i}
|
||||||
);
|
);
|
||||||
if (!flag) {
|
if (!flag) {
|
||||||
|
Loading…
Reference in New Issue
Block a user