fix: 名称报告不能为空,模糊查询关联需求

This commit is contained in:
zhangdahai112 2022-02-16 11:42:49 +08:00 committed by 刘瑞斌
parent 9cc51b9e56
commit fe1e27bc9e
3 changed files with 13 additions and 2 deletions

View File

@ -3,7 +3,7 @@
<el-row> <el-row>
<el-col> <el-col>
<span v-if="!debug"> <span v-if="!debug">
<el-input v-if="nameIsEdit" size="mini" @blur="handleSave(report.name)" style="width: 200px" v-model="report.name"/> <el-input v-if="nameIsEdit" size="mini" @blur="handleSave(report.name)" style="width: 200px" v-model="report.name" maxlength="60" show-word-limit/>
<span v-else> <span v-else>
<router-link v-if="isSingleScenario" :to="{name: 'ApiAutomation', params: { dataSelectRange: 'edit:' + scenarioId }}"> <router-link v-if="isSingleScenario" :to="{name: 'ApiAutomation', params: { dataSelectRange: 'edit:' + scenarioId }}">
{{ report.name }} {{ report.name }}

View File

@ -4,6 +4,7 @@
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
width="40%" width="40%"
:modal-append-to-body="false" :modal-append-to-body="false"
:close-on-click-modal="false"
:before-close="close"> :before-close="close">
<el-form> <el-form>
<el-form-item :label="$t('commons.name')"> <el-form-item :label="$t('commons.name')">
@ -33,6 +34,10 @@ export default {
this.data = JSON.parse(JSON.stringify(data)); this.data = JSON.parse(JSON.stringify(data));
}, },
submit() { submit() {
if (!this.data.name) {
this.$error(this.$t("commons.name") + this.$t("commons.cannot_be_null"));
return;
}
this.$emit('submit', this.data); this.$emit('submit', this.data);
}, },
close() { close() {

View File

@ -14,7 +14,7 @@
<el-form-item :label="$t('test_track.related_requirements')" :label-width="labelWidth" <el-form-item :label="$t('test_track.related_requirements')" :label-width="labelWidth"
prop="demandId"> prop="demandId">
<el-cascader v-model="demandValue" :show-all-levels="false" :options="demandOptions" clearable filterable/> <el-cascader v-model="demandValue" :show-all-levels="false" :options="demandOptions" clearable filterable :filter-method="filterDemand"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="7"> <el-col :span="7">
@ -310,6 +310,12 @@ export default {
} }
pathArray.pop(); pathArray.pop();
}); });
},
filterDemand(node, keyword) {
if (keyword && node.text.toLowerCase().indexOf(keyword.toLowerCase()) !== -1) {
return true;
}
return false;
} }
} }
}; };