fix(测试跟踪): 用例库列表标签显示优化

--bug=1023677 --user=陈建星 【测试跟踪】功能测试-公共用例库列表-标签为空显示为[] https://www.tapd.cn/55049933/s/1340774
This commit is contained in:
chenjianxing 2023-02-22 16:01:22 +08:00 committed by 刘瑞斌
parent 8a83008b82
commit 60351d2119
3 changed files with 48 additions and 22 deletions

View File

@ -312,7 +312,7 @@ import {
getCustomFieldValueForTrack,
getProjectMemberOption
} from "@/business/utils/sdk-utils";
import {initTestCaseConditionComponents, openCaseEdit} from "@/business/case/test-case";
import {getTagToolTips, initTestCaseConditionComponents, openCaseEdit, parseColumnTag} from "@/business/case/test-case";
export default {
@ -628,25 +628,10 @@ export default {
});
},
getTagToolTips(tags) {
try {
let showTips = '';
tags.forEach((item) => {
showTips += item + ',';
});
return showTips.substr(0, showTips.length - 1);
} catch (e) {
return '';
}
return getTagToolTips(tags);
},
parseColumnTag(tags) {
if (tags.length > 1) {
let parseTags = [];
parseTags.push(tags[0]);
parseTags.push("+" + (tags.length - 1));
return parseTags;
} else {
return tags;
}
return parseColumnTag(tags);
},
initConditionComponents() {
this.condition.components = initTestCaseConditionComponents(this.condition, this.testCaseTemplate.customFields, this.trashEnable);

View File

@ -143,9 +143,20 @@
:label="$t('commons.tag')"
min-width="80">
<template v-slot:default="scope">
<ms-single-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain"
:show-tooltip="scope.row.tags.length === 1 && itemName.length * 12 <= 80"
:content="itemName" style="margin-left: 0px; margin-right: 2px"/>
<el-tooltip class="item" effect="dark" placement="top">
<div v-html="getTagToolTips(scope.row.tags)" slot="content"></div>
<div class="oneLine">
<ms-single-tag
v-for="(itemName, index) in parseColumnTag(scope.row.tags)"
:key="index"
type="success"
effect="plain"
:show-tooltip="scope.row.tags.length === 1 && itemName.length * 12 <= 100"
:content="itemName"
style="margin-left: 0px; margin-right: 2px"/>
</div>
</el-tooltip>
<span/>
</template>
</ms-table-column>
@ -240,7 +251,7 @@ import {useStore} from "@/store";
import {getProjectMemberUserFilter} from "@/api/user";
import TypeTableItem from "@/business/common/tableItems/planview/TypeTableItem";
import {getVersionFilters} from "@/business/utils/sdk-utils";
import {openCaseEdit} from "@/business/case/test-case";
import {getTagToolTips, openCaseEdit, parseColumnTag} from "@/business/case/test-case";
import PublicTestCaseShow from "@/business/case/components/public/PublicTestCaseShow"
@ -503,6 +514,12 @@ export default {
})
}
},
getTagToolTips(tags) {
return getTagToolTips(tags);
},
parseColumnTag(tags) {
return parseColumnTag(tags);
},
isOwner(testCase) {
return testCase.maintainer === this.currentUser || testCase.createUser === this.currentUser;
},

View File

@ -96,3 +96,27 @@ export function openCaseCreate(query, v) {
});
window.open(TestCaseData.href, '_blank');
}
export function getTagToolTips(tags) {
try {
let showTips = '';
tags.forEach((item) => {
showTips += item + ',';
});
return showTips.substr(0, showTips.length - 1);
} catch (e) {
return '';
}
}
export function parseColumnTag(tags) {
if (tags.length > 1) {
let parseTags = [];
parseTags.push(tags[0]);
parseTags.push("+" + (tags.length - 1));
return parseTags;
} else {
return tags;
}
}