fix(测试用例): 用例模板中带有多选下拉框自定义字段时导入报错
--bug=1007126 --user=lyh 【github#6699】用例模板中带有多选下拉框自定义字段时导入报错 https://www.tapd.cn/55049933/s/1059014
This commit is contained in:
parent
74f89d8597
commit
53c41126da
|
@ -58,6 +58,11 @@ export function parseCustomField(data, template, customFieldForm, rules, oldFiel
|
|||
for (let i = 0; i < data.customFields.length; i++) {
|
||||
let customField = data.customFields[i];
|
||||
if (customField.name === item.name) {
|
||||
if (customField.type === 'multipleSelect') {
|
||||
if (typeof (customField.value) === 'string' || customField.value instanceof String) {
|
||||
customField.value = JSON.parse(customField.value);
|
||||
}
|
||||
}
|
||||
setDefaultValue(item, customField.value);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -469,7 +469,12 @@ export function getCustomFieldValue(row, field, members) {
|
|||
else if (['multipleSelect', 'checkbox'].indexOf(field.type) > -1) {
|
||||
if (item.value) {
|
||||
let values = '';
|
||||
if (item.value instanceof Array) {
|
||||
try {
|
||||
if (field.type === 'multipleSelect') {
|
||||
if (typeof (item.value) === 'string' || item.value instanceof String) {
|
||||
item.value = JSON.parse(item.value);
|
||||
}
|
||||
}
|
||||
item.value.forEach(v => {
|
||||
for (let j = 0; j < field.options.length; j++) {
|
||||
let option = field.options[j];
|
||||
|
@ -480,6 +485,8 @@ export function getCustomFieldValue(row, field, members) {
|
|||
}
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
values = '';
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue