From 38e5e4a9e03df8a7bb67cc70a7fc40f50a2abfd9 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Wed, 13 Dec 2023 12:49:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8F=82=E6=95=B0=E9=85=8D=E7=BD=AEinde?= =?UTF-8?q?x=E4=B8=BA0=E6=96=B0=E5=A2=9E=E4=B8=8D=E7=B4=AF=E5=8A=A0?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../configManage/configParamTreeTable/index.vue | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/views/configManage/configParamTreeTable/index.vue b/src/views/configManage/configParamTreeTable/index.vue index fec41f33..39b69e24 100644 --- a/src/views/configManage/configParamTreeTable/index.vue +++ b/src/views/configManage/configParamTreeTable/index.vue @@ -853,13 +853,13 @@ function arrayEditInit(data: Record, dataRule: any) { /**多列表新增行数据初始化 */ function arrayAddInit(data: any[], dataRule: any) { - let newIndex = 0; - // 有数据时取得最后的index + let dataLastIndex = 0; if (data.length !== 0) { const lastFrom = Object.assign({}, JSON.parse(JSON.stringify(data.at(-1)))); if (lastFrom.record.length > 0) { - newIndex = parseInt(lastFrom.key); + dataLastIndex = parseInt(lastFrom.key); + dataLastIndex += 1; } } @@ -870,13 +870,9 @@ function arrayAddInit(data: any[], dataRule: any) { row.value = []; continue; } - const value = row.value; + // index值 if (row.name === 'index') { - if (newIndex !== 0) { - newIndex += 1; - } else { - newIndex = parseInt(value); - } + let newIndex = dataLastIndex !== 0 ? dataLastIndex : parseInt(row.value); if (isNaN(newIndex)) { newIndex = 0; }