fix(测试跟踪): 创建用例时关联需求

This commit is contained in:
shiziyuan9527 2021-03-18 17:24:10 +08:00
parent 4a93952020
commit 5e5be76df5
1 changed files with 22 additions and 9 deletions

View File

@ -136,12 +136,12 @@
<el-row> <el-row>
<el-col :span="10"> <el-col :span="10">
<el-form-item label="关联需求" :label-width="formLabelWidth" prop="demandId"> <el-form-item label="关联需求" :label-width="formLabelWidth" prop="demandId">
<el-select filterable :disabled="readOnly" v-model="form.demandId" <el-select filterable :disabled="readOnly" v-model="form.demandId" @visible-change="visibleChange"
:placeholder="$t('test_track.case.input_type')" class="ms-case-input"> placeholder="请选择要关联的需求" class="ms-case-input">
<el-option <el-option
v-for="item in demandOptions" v-for="item in demandOptions"
:key="item.id" :key="item.id"
:label="item.name" :label="item.platform + ': '+item.name"
:value="item.id"> :value="item.id">
</el-option> </el-option>
</el-select> </el-select>
@ -761,18 +761,31 @@ export default {
}); });
} }
}, },
visibleChange(flag) {
if (flag) {
this.getDemandOptions();
}
},
getDemandOptions() { getDemandOptions() {
this.projectId = getCurrentProjectID() if (this.demandOptions.length === 0) {
this.result = this.$get("demand/list/" + this.projectId, response => { this.projectId = getCurrentProjectID();
this.demandOptions = response.data; this.result = {loading : true};
this.demandOptions.unshift({id: 'other', name: this.$t('test_track.case.other')}) this.$get("demand/list/" + this.projectId).then(response => {
}); this.demandOptions = response.data.data;
this.demandOptions.unshift({id: 'other', name: this.$t('test_track.case.other'), platform: 'Other'})
this.result = {loading : false};
}).catch(() => {
this.result = {loading : false};
})
}
}, },
getSelectOptions() { getSelectOptions() {
this.getModuleOptions(); this.getModuleOptions();
this.getMaintainerOptions(); this.getMaintainerOptions();
this.getTestOptions(); this.getTestOptions();
// this.getDemandOptions() if (this.type === 'edit') {
this.getDemandOptions();
}
}, },
resetForm() { resetForm() {