From 5b166dd93003adb0749002d74109a519f746e204 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 03 八月 2024 16:49:15 +0800 Subject: [PATCH] 2024-08-03 --- src/components/normalform/modalform/mkTable/index.jsx | 17 ++++++++++++++++- 1 files changed, 16 insertions(+), 1 deletions(-) diff --git a/src/components/normalform/modalform/mkTable/index.jsx b/src/components/normalform/modalform/mkTable/index.jsx index 1baf22f..0ae8cfa 100644 --- a/src/components/normalform/modalform/mkTable/index.jsx +++ b/src/components/normalform/modalform/mkTable/index.jsx @@ -276,7 +276,18 @@ columns.forEach(col => { if (col.unique !== true || !unique) return - let _index = newData.findIndex(item => record.uuid !== item.uuid && record[col.dataIndex] === item[col.dataIndex]) + let _index = newData.findIndex(item => { + if (record.uuid === item.uuid) return false + + if (col.inputType === 'cascader') { + if (!Array.isArray(record[col.dataIndex]) || !Array.isArray(item[col.dataIndex])) { + return false + } + return record[col.dataIndex].toString() === item[col.dataIndex].toString() + } + + return record[col.dataIndex] === item[col.dataIndex] + }) if (_index > -1) { notification.warning({ @@ -341,6 +352,10 @@ if (_options.length) { col.extends.forEach(n => { record[n.value] = _options.map(o => o[n.key]).join(' / ') + + if (n.mutilLabel && !record[n.mutilLabel]) { + record[n.mutilLabel] = _options[_options.length - 1][n.key] + } }) } } else { -- Gitblit v1.8.0