From cb2807c840b5d070ff26b5abf13d136abeebd315 Mon Sep 17 00:00:00 2001 From: song-cc-rock Date: Mon, 16 Jan 2023 16:52:22 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=E5=88=97=E8=A1=A8=E5=AF=BC=E5=85=A5=E5=A4=9A?= =?UTF-8?q?=E9=80=89=E8=BE=93=E5=85=A5=E5=AD=97=E6=AE=B5=E6=97=B6,=20?= =?UTF-8?q?=E8=A7=A3=E6=9E=90=E5=80=BC=E6=9C=89=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [BUG]v1.20.18, 用例模板添加了多个多种类型字段后,导入的用例在web 列表页不可见,但是在脑图模式可见github#21366, https://github.com/metersphere/metersphere/issues/21366 --- .../frontend/src/utils/tableUtils.js | 33 ++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/framework/sdk-parent/frontend/src/utils/tableUtils.js b/framework/sdk-parent/frontend/src/utils/tableUtils.js index 163938046a..4ea24f6109 100644 --- a/framework/sdk-parent/frontend/src/utils/tableUtils.js +++ b/framework/sdk-parent/frontend/src/utils/tableUtils.js @@ -544,11 +544,13 @@ export function getCustomFieldValue(row, field, members) { return val; } else if (field.type === 'multipleInput') { let val = ''; - if (item.value instanceof Array) { - item.value.forEach(i => { - val += i + ' '; - }); + if (!item.value || item.value === '') { + return val; } + let mulArr = parseMultipleInputToArray(item.value) + mulArr.forEach(i => { + val += i + ' '; + }); return val; } else if (field.type === 'datetime' || field.type === 'date') { return datetimeFormat(item.value); @@ -561,6 +563,29 @@ export function getCustomFieldValue(row, field, members) { } } +/** + * 多值输入值解析, 按照导入规则括号中字符可解析[, ; ,;|] + * @param mulInputStr + * @returns {*[]|*} + */ +export function parseMultipleInputToArray(mulInputStr) { + if (mulInputStr.indexOf(",")) { + return mulInputStr.split(",") + } else if (mulInputStr.indexOf(";")) { + return mulInputStr.split(";") + } else if (mulInputStr.indexOf(",")) { + return mulInputStr.split(",") + } else if (mulInputStr.indexOf(";")) { + return mulInputStr.split(";") + } else if (mulInputStr.indexOf("|")) { + return mulInputStr.split("|") + } else { + let mulArr = []; + mulArr.push(mulInputStr) + return mulArr; + } +} + /** * 获取批量编辑的自定义字段选项 * @param customFields