fix(测试跟踪): 修复评论框提示及用例名称过长展示问题

--bug=1023174 --user=刘瑶
【测试跟踪】功能用例-编辑-评论-点击输入框-默认提示信息和原型不符
https://www.tapd.cn/55049933/s/1337577
--bug=1023171 --user=刘瑶
【测试跟踪】功能用例-编辑用例页面-用例名称过长-显示问题
https://www.tapd.cn/55049933/s/1337578
This commit is contained in:
nathan.liu 2023-02-17 21:25:09 +08:00 committed by nathanliu2022
parent f45db38d96
commit f59169f68e
7 changed files with 100 additions and 14 deletions

View File

@ -205,6 +205,13 @@ export default {
});
},
getTranslateOption(item) {
if (Array.isArray(item)) {
let arr = [];
item.forEach((v) => {
arr.push(v.system ? this.$t(v.text) : v.text);
});
return arr.join(" ");
}
return item.system ? this.$t(item.text) : item.text;
},
getCustomText() {
@ -216,15 +223,34 @@ export default {
) {
options = this.memberOptions;
}
if (options.length > 0) {
let option = options.find((item) => {
if (this.contentObject.content.value) {
return item.value == this.contentObject.content.value;
}
return item.value == this.contentObject.content.defaultValue;
});
if (option) {
return this.getTranslateOption(option);
if (options && options.length > 0) {
let tempValue = this.contentObject.content.value && this.contentObject.content.value.length > 0
? this.contentObject.content.value
: this.contentObject.content.defaultValue;
if(!tempValue || Array.isArray(tempValue) && tempValue.length <= 0){
return this.$t("case.none");
}
if (Array.isArray(tempValue) && tempValue.length > 0) {
let arr = [];
tempValue.forEach((v) => {
let temp = options.find((o) => {
return o.value == v;
});
if(temp){
if(Array.isArray(temp)){
arr.push(...temp);
}
else{
arr.push(temp);
}
}
});
return this.getTranslateOption(arr);
} else {
let temp = options.find((o) => {
return o.value == tempValue;
});
return this.getTranslateOption(temp);
}
}
@ -237,7 +263,11 @@ export default {
? this.$t("case.none")
: this.contentObject.content.defaultValue;
}
return "";
return this.contentObject.content.defaultValue === "" ||
this.contentObject.content.defaultValue == null
? this.$t("case.none")
: this.contentObject.content.defaultValue;
},
getStoryPlatform() {
let demandOptions = this.contentObject.content.demandOptions || [];
@ -246,7 +276,7 @@ export default {
return item.value === this.contentObject.content.demandId;
});
if (demand) {
return demand.platform;
return this.handleDemandOptionPlatform(demand);
}
}
return "";
@ -261,11 +291,33 @@ export default {
if (demand.value === "other") {
return this.$t("test_track.case.other");
}
return demand.label;
return this.handleDemandOptionLabel(demand);
}
}
return "";
},
handleDemandOptionPlatform(data) {
if (data.platform) {
return data.platform;
}
if (data.label) {
let arr = data.label.split(": ");
if (arr && arr.length > 1) {
return arr[0];
}
}
return "";
},
handleDemandOptionLabel(data) {
if (data.label) {
let arr = data.label.split(": ");
if (arr && arr.length > 1) {
return arr[1];
}
return data.label;
}
return "";
},
clickContent() {
if (this.contentClickEvent) {
this.selfEditable = true;

View File

@ -1661,6 +1661,14 @@ export default {
margin-left: px2rem(8);
margin-right: px2rem(8);
cursor: pointer;
max-width: 800px;
/* 文本不会换行显示 */
white-space: nowrap;
/* 超出盒子部分隐藏 */
overflow: hidden;
/* 文本超出的部分打点显示 */
text-overflow: ellipsis;
}
.case-name-hover:hover {
cursor: pointer;

View File

@ -227,11 +227,11 @@
>
<template slot-scope="{ data }">
<div class="story-box">
<div class="story-platform">{{ data.platform }}</div>
<div class="story-platform">{{ handleDemandOptionPlatform(data) }}</div>
<div class="story-label" v-if="data.value === 'other'">
{{ $t("test_track.case.other") }}
</div>
<div class="story-label" v-else>{{ data.label }}</div>
<div class="story-label" v-else>{{ handleDemandOptionLabel(data) }}</div>
</div>
</template>
</el-cascader>
@ -490,6 +490,28 @@ export default {
this.getVersionOptions();
},
methods: {
handleDemandOptionPlatform(data){
if(data.platform){
return data.platform
}
if(data.label){
let arr = data.label.split(": ")
if(arr && arr.length > 1){
return arr[0];
}
}
return "";
},
handleDemandOptionLabel(data){
if(data.label){
let arr = data.label.split(": ")
if(arr && arr.length > 1){
return arr[1];
}
return data.label;
}
return "";
},
validateAllForm(callback) {
callback(
this.editable ? true : this.validateForm() && this.validateCustomForm()

View File

@ -15,6 +15,7 @@
class="remark-item"
:data="tempFormData"
:default-open="richTextDefaultOpen"
:placeholder="$t('case.enter_comments_and_click_send')"
prop="richText"
/>
<div class="options">

View File

@ -143,6 +143,7 @@ const message = {
compare_with_the_latest_version: "Compare with the latest version",
view_the_latest_version: "View the latest version",
version_id_cannot_be_empty: "Version id cannot be empty",
enter_comments_and_click_send: "Enter comments and click Send",
},
attachment: {
preview: "Preview",

View File

@ -143,6 +143,7 @@ const message = {
compare_with_the_latest_version: "与最新版本比较",
view_the_latest_version: "查看最新版本",
version_id_cannot_be_empty: "版本号不能为空",
enter_comments_and_click_send: "输入评论,点击发送",
},
attachment: {
preview: "预览",

View File

@ -143,6 +143,7 @@ const message = {
compare_with_the_latest_version: "與最新版本比較",
view_the_latest_version: "查看最新版本",
version_id_cannot_be_empty: "版本號不能為空",
enter_comments_and_click_send: "輸入評論,點擊發送",
},
attachment: {
preview: "預覽",