fix: 优化excel模板导入,模块字数超标的提示

优化excel模板导入,模块字数超标的提示
This commit is contained in:
song.tianyang 2021-03-31 15:58:50 +08:00
parent c45e601994
commit 7cc2737a5f
2 changed files with 19 additions and 7 deletions

View File

@ -67,6 +67,16 @@ public class TestCaseDataListener extends EasyExcelListener<TestCaseExcelData> {
break;
}
}
//增加字数校验每一层不能超过100字
for (int i = 0; i < nodes.length; i++) {
String nodeStr = nodes[i];
if(StringUtils.isNotEmpty(nodeStr)){
if(nodeStr.trim().length()>100){
stringBuilder.append(Translator.get("module") + Translator.get("test_track.length_less_than") + "100:"+nodeStr);
break;
}
}
}
}
// if (StringUtils.equals(data.getType(), TestCaseConstants.Type.Functional.getValue()) && StringUtils.equals(data.getMethod(), TestCaseConstants.Method.Auto.getValue())) {

View File

@ -27,7 +27,7 @@
<i class="icon el-icon-arrow-right" :class="{'is-active': apiCase.active}" @click="active(apiCase)"/>
<el-input v-if="!apiCase.id || isShowInput" size="small" v-model="apiCase.name" :name="index" :key="index"
class="ms-api-header-select" style="width: 180px"
@blur="saveTestCase(apiCase)" :placeholder="$t('commons.input_name')" ref="nameEdit"/>
@blur="saveTestCase(apiCase,true)" :placeholder="$t('commons.input_name')" ref="nameEdit"/>
<span v-else>
{{ apiCase.id ? apiCase.name : '' }}
<i class="el-icon-edit" style="cursor:pointer" @click="showInput(apiCase)" v-tester/>
@ -48,7 +48,7 @@
<el-col :span="4">
<div class="tag-item" @click.stop>
<ms-input-tag :currentScenario="apiCase" ref="tag" @keyup.enter.native="saveTestCase(apiCase)"/>
<ms-input-tag :currentScenario="apiCase" ref="tag" @keyup.enter.native="saveTestCase(apiCase,true)"/>
</div>
</el-col>
@ -291,7 +291,7 @@
}
});
},
saveCase(row) {
saveCase(row,hideAlert) {
let tmp = JSON.parse(JSON.stringify(row));
this.isShowInput = false;
if (this.validate(tmp)) {
@ -328,16 +328,18 @@
row.createTime = data.createTime;
row.updateTime = data.updateTime;
if (!row.message) {
this.$success(this.$t('commons.save_success'));
this.$emit('refresh');
if(!hideAlert){
this.$success(this.$t('commons.save_success'));
this.$emit('refresh');
}
}
});
},
saveTestCase(row) {
saveTestCase(row,hideAlert) {
if (this.api.saved) {
this.addModule(row);
} else {
this.saveCase(row);
this.saveCase(row,hideAlert);
}
},
showInput(row) {