fix(测试跟踪): 测试评审和计划关联需求禁用

--bug=1015009 --user=陈建星 【测试跟踪】用例评审-编辑用例评审-可以编辑关联需求信息,但是不生效 https://www.tapd.cn/55049933/s/1204783
This commit is contained in:
chenjianxing 2022-07-19 18:39:04 +08:00 committed by jianxing
parent 53390397a2
commit c83f2f3534
2 changed files with 40 additions and 28 deletions

View File

@ -18,12 +18,17 @@
<el-col :span="8"> <el-col :span="8">
<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"
<el-cascader v-if="!readOnly" v-model="demandValue" :show-all-levels="false" :options="demandOptions"
clearable filterable :filter-method="filterDemand"> clearable filterable :filter-method="filterDemand">
<template slot-scope="{ node, data }"> <template slot-scope="{ node, data }">
<span class="demand-span" :title="data.label">{{ data.label }}</span> <span class="demand-span" :title="data.label">{{ data.label }}</span>
</template> </template>
</el-cascader> </el-cascader>
<el-input class="demandInput" v-else :disabled="readOnly" :value="demandLabel">
</el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8" :offset="2"> <el-col :span="8" :offset="2">
@ -160,6 +165,7 @@ export default {
demandOptions: [], demandOptions: [],
relationshipCount: 0, relationshipCount: 0,
demandValue: [], demandValue: [],
demandLabel: '',
//sysList:this.sysList,// //sysList:this.sysList,//
props: { props: {
multiple: true, multiple: true,
@ -386,34 +392,29 @@ export default {
} }
}, },
getDemandOptions() { getDemandOptions() {
if (this.demandOptions.length === 0) { this.result = {loading: true};
this.result = {loading: true}; this.demandLabel = '';
this.$get("/issues/demand/list/" + this.projectId).then(response => { this.$get("/issues/demand/list/" + this.projectId).then(response => {
this.demandOptions = []; this.demandOptions = [];
if (response.data.data && response.data.data.length > 0) { if (response.data.data && response.data.data.length > 0) {
this.buildDemandCascaderOptions(response.data.data, this.demandOptions, []); this.buildDemandCascaderOptions(response.data.data, this.demandOptions, []);
} }
this.demandOptions.unshift({ this.addOtherOption();
value: 'other', }).catch(() => {
label: 'Other: ' + this.$t('test_track.case.other'), this.addOtherOption();
platform: 'Other' });
}); },
if (this.form.demandId === 'other') { addOtherOption() {
this.demandValue = ['other']; this.demandOptions.unshift({
} value: 'other',
this.result = {loading: false}; label: 'Other: ' + this.$t('test_track.case.other'),
}).catch(() => { platform: 'Other'
this.demandOptions.unshift({ });
value: 'other', if (this.form.demandId === 'other') {
label: 'Other: ' + this.$t('test_track.case.other'), this.demandValue = ['other'];
platform: 'Other' this.demandLabel = 'Other: ' + this.$t('test_track.case.other');
});
if (this.form.demandId === 'other') {
this.demandValue = ['other'];
}
this.result = {loading: false};
});
} }
this.result = {loading: false};
}, },
buildDemandCascaderOptions(data, options, pathArray) { buildDemandCascaderOptions(data, options, pathArray) {
data.forEach(item => { data.forEach(item => {
@ -421,6 +422,9 @@ export default {
label: item.platform + ': ' + item.name, label: item.platform + ': ' + item.name,
value: item.id value: item.id
} }
if (this.form.demandId === item.id) {
this.demandLabel = option.label;
}
options.push(option); options.push(option);
pathArray.push(item.id); pathArray.push(item.id);
if (item.id === this.form.demandId) { if (item.id === this.form.demandId) {
@ -475,4 +479,8 @@ export default {
word-break: break-all; word-break: break-all;
margin-right: 5px; margin-right: 5px;
} }
.demandInput {
width: 200px;
}
</style> </style>

View File

@ -428,6 +428,10 @@ export default {
this.testCaseTemplate = template; this.testCaseTemplate = template;
initFuc(testCase.id); initFuc(testCase.id);
}); });
if (this.$refs.otherInfo) {
this.$refs.otherInfo.reset();
}
}, },
openTestTestCase(item) { openTestTestCase(item) {
let testCaseData = this.$router.resolve( let testCaseData = this.$router.resolve(