fix(测试跟踪): 自定义字段Json解析有误
--bug=1025280 --user=宋昌昌 【测试跟踪】github#23515,功能用例-测试计划执行时,自定义字段文本框输入{}会显示为[object Object] https://www.tapd.cn/55049933/s/1361274
This commit is contained in:
parent
901f745928
commit
0d161bc271
|
@ -197,11 +197,13 @@ export function sortCustomFields(customFields) {
|
||||||
let total = 0; //定义total用于控制循环结束
|
let total = 0; //定义total用于控制循环结束
|
||||||
for (let i = 0; total < customFields.length; total++) {
|
for (let i = 0; total < customFields.length; total++) {
|
||||||
if (
|
if (
|
||||||
(typeof customFields[i].defaultValue === "string" ||
|
(typeof customFields[i].defaultValue === "string" || customFields[i].defaultValue instanceof String)
|
||||||
customFields[i].defaultValue instanceof String) && customFields[i].defaultValue !== '{}' && customFields[i].defaultValue !== '[]'
|
&& customFields[i].defaultValue !== '{}' && customFields[i].defaultValue !== '[]'
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
customFields[i].defaultValue = JSON.parse(customFields[i].defaultValue);
|
if (typeof JSON.parse(customFields[i].defaultValue) !== "object") {
|
||||||
|
customFields[i].defaultValue = JSON.parse(customFields[i].defaultValue);
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// nothing
|
// nothing
|
||||||
}
|
}
|
||||||
|
|
|
@ -512,7 +512,9 @@ export default {
|
||||||
);
|
);
|
||||||
this.testCaseTemplate.customFields.forEach((item) => {
|
this.testCaseTemplate.customFields.forEach((item) => {
|
||||||
try {
|
try {
|
||||||
item.defaultValue = JSON.parse(item.defaultValue);
|
if (typeof JSON.parse(item.defaultValue) !== "object") {
|
||||||
|
item.defaultValue = JSON.parse(item.defaultValue);
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// nothing
|
// nothing
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue