fix(测试跟踪): 用例列表导入多选输入字段时, 解析值有误
[BUG]v1.20.18, 用例模板添加了多个多种类型字段后,导入的用例在web 列表页不可见,但是在脑图模式可见github#21366, https://github.com/metersphere/metersphere/issues/21366
This commit is contained in:
parent
1f2d03f9f4
commit
c12064275f
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue