fix(测试跟踪): 兼容tag脏数据
--bug=1010508 --user=陈建星 【测试跟踪】有一个项目的 功能用例,点回收站会卡住 https://www.tapd.cn/55049933/s/1108032
This commit is contained in:
parent
992097c9d0
commit
8438c5a063
|
@ -264,7 +264,14 @@ import {
|
|||
} from "@/common/js/tableUtils";
|
||||
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
|
||||
import PlanStatusTableItem from "@/business/components/track/common/tableItems/plan/PlanStatusTableItem";
|
||||
import {getCurrentProjectID, getCurrentUserId, getCurrentWorkspaceId, getUUID, hasLicense} from "@/common/js/utils";
|
||||
import {
|
||||
getCurrentProjectID,
|
||||
getCurrentUserId,
|
||||
getCurrentWorkspaceId,
|
||||
getUUID,
|
||||
hasLicense,
|
||||
parseTag
|
||||
} from "@/common/js/utils";
|
||||
import {getTestTemplate} from "@/network/custom-field-template";
|
||||
import {getProjectMember} from "@/network/user";
|
||||
import MsTable from "@/business/components/common/components/table/MsTable";
|
||||
|
@ -758,46 +765,23 @@ export default {
|
|||
if (this.projectId) {
|
||||
this.condition.projectId = this.projectId;
|
||||
this.$emit('setCondition', this.condition);
|
||||
let url = '/test/case/list';
|
||||
if (this.publicEnable) {
|
||||
url = '/test/case/publicList';
|
||||
this.condition.casePublic = true;
|
||||
this.condition.workspaceId = getCurrentWorkspaceId();
|
||||
this.page.result = this.$post(this.buildPagePath('/test/case/publicList'), this.condition, response => {
|
||||
let data = response.data;
|
||||
this.page.total = data.itemCount;
|
||||
this.page.data = data.listObject;
|
||||
this.page.data.forEach(item => {
|
||||
if (item.customFields) {
|
||||
item.customFields = JSON.parse(item.customFields);
|
||||
}
|
||||
});
|
||||
this.page.data.forEach((item) => {
|
||||
try {
|
||||
item.tags = JSON.parse(item.tags);
|
||||
} catch (e) {
|
||||
item.tags = [];
|
||||
}
|
||||
});
|
||||
})
|
||||
} else {
|
||||
this.page.result = this.$post(this.buildPagePath('/test/case/list'), this.condition, response => {
|
||||
let data = response.data;
|
||||
this.page.total = data.itemCount;
|
||||
this.page.data = data.listObject;
|
||||
this.page.data.forEach(item => {
|
||||
if (item.customFields) {
|
||||
item.customFields = JSON.parse(item.customFields);
|
||||
}
|
||||
});
|
||||
this.page.data.forEach((item) => {
|
||||
try {
|
||||
item.tags = JSON.parse(item.tags);
|
||||
} catch (e) {
|
||||
item.tags = [];
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
this.page.result = this.$post(this.buildPagePath(url), this.condition, response => {
|
||||
let data = response.data;
|
||||
this.page.total = data.itemCount;
|
||||
this.page.data = data.listObject;
|
||||
this.page.data.forEach(item => {
|
||||
if (item.customFields) {
|
||||
item.customFields = JSON.parse(item.customFields);
|
||||
}
|
||||
});
|
||||
parseTag(this.page.data);
|
||||
});
|
||||
this.$emit("getTrashList");
|
||||
this.$emit("getPublicList")
|
||||
}
|
||||
|
|
|
@ -9,10 +9,8 @@ import {
|
|||
TokenKey,
|
||||
WORKSPACE_ID
|
||||
} from "./constants";
|
||||
import axios from "axios";
|
||||
import {jsPDF} from "jspdf";
|
||||
import JSEncrypt from 'jsencrypt';
|
||||
import {CUSTOM_FIELD_TYPE_OPTION} from "@/common/js/table-constants";
|
||||
import i18n from "@/i18n/i18n";
|
||||
|
||||
export function hasRole(role) {
|
||||
|
@ -510,3 +508,18 @@ export function getTranslateOptions(data) {
|
|||
});
|
||||
return options;
|
||||
}
|
||||
|
||||
export function parseTag(data) {
|
||||
data.forEach(item => {
|
||||
try {
|
||||
let tags = JSON.parse(item.tags);
|
||||
if (tags instanceof Array) {
|
||||
item.tags = tags ? tags : [];
|
||||
} else {
|
||||
item.tags = tags ? [tags + ''] : [];
|
||||
}
|
||||
} catch (e) {
|
||||
item.tags = [];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue