fix(测试跟踪): 批量和编辑单个用例的标签时,统一长度限制

--bug=1032091 --user=陈建星 【测试跟踪】github#27123,【测试跟踪-功能用例】批量编辑标签时,当标签长度输入过长时会提示错误信息,但是单个用例编辑标签时可以正常保存。 https://www.tapd.cn/55049933/s/1427723
This commit is contained in:
AgAngle 2023-10-18 14:36:41 +08:00 committed by Craftsman
parent 64fa7aef84
commit 397254ded2
7 changed files with 15 additions and 6 deletions

View File

@ -151,7 +151,7 @@ export default {
tag = tag.trim();
if (tag && !this.innerTags.includes(tag)) {
if (tag.length > 15) {
this.$error(this.$t('commons.tag_length_tip'));
this.$error(this.$t('commons.tag_length_tip', [15]));
return false;
}
this.innerTags.push(tag);

View File

@ -66,6 +66,10 @@ export default {
type: String,
default: "tags",
},
maxLength: {
type: Number,
default: 15,
},
},
created() {
if (!this.currentScenario[this.prop]) {
@ -138,8 +142,8 @@ export default {
addTag(tag) {
tag = tag.trim();
if (tag && !this.innerTags.includes(tag)) {
if (tag.length > 15) {
this.$error(this.$t("commons.tag_length_tip"));
if (tag.length > this.maxLength) {
this.$error(this.$t("commons.tag_length_tip", [this.maxLength]));
return false;
}
this.innerTags.push(tag);

View File

@ -121,6 +121,10 @@ export default {
},
addTag(tag) {
tag = tag.trim()
if (tag.length > 50) {
this.$error(this.$t("commons.tag_length_tip", [50]));
return false;
}
if (tag && !this.innerTags.includes(tag)) {
this.innerTags.push(tag)
return true

View File

@ -394,7 +394,7 @@ const message = {
},
image: "Image",
tag: "Tag",
tag_length_tip: "The length of the tag cannot exceed 15 characters",
tag_length_tip: "The length of the tag cannot exceed {0} characters",
append_tag: "Append Tag",
append_tag_tip:
"Checked: add a new label; unchecked: overwrite the original label;",

View File

@ -387,7 +387,7 @@ const message = {
},
image: "镜像",
tag: "标签",
tag_length_tip: "标签长度不能超过15个字符",
tag_length_tip: "标签长度不能超过{0}个字符",
append_tag: "追加标签",
append_tag_tip: "勾选:新增标签;不勾选:覆盖原有标签;",
module: {

View File

@ -388,7 +388,7 @@ const message = {
image: "鏡像",
tag: "標簽",
append_tag: "追加標籤",
tag_length_tip: "標籤長度不能超過15個字符",
tag_length_tip: "標籤長度不能超過{0}個字符",
append_tag_tip: "勾選:新增標籤;不勾選:覆蓋原有標籤;",
module: {
select_module: "選擇模塊",

View File

@ -84,6 +84,7 @@
<ms-input-tag
:currentScenario="form"
v-if="showInputTag"
:max-length="50"
ref="tag"
class="ms-case-input"
></ms-input-tag>